AGENTS.md (3586B)
1# AGENTS.md
2
3## Project Context
4
5- This app is called Reportage.
6- Reportage is a life-logging app for iPhone and Apple Watch. It replaces Reporter, an unmaintained app with the same interaction model: random notifications prompt a short survey, and each report also captures context automatically (location, weather, Health, device state).
7- Reportage syncs between iPhone and Watch using Apple's CloudKit.
8- Scripts for common tasks, including running tests, live in `Scripts/`.
9- `Notes/Design.md` is the design document. Read it before working on the data model, scheduling, context capture, sync or the Reporter importer.
10
11## Code Structure
12
13Use this file for orientation only; inspect the current filesystem and code before assuming detailed structure or ownership.
14
15- `Reportage/` is the iOS app.
16- `ReportageWatch/` is the watchOS app.
17- `Shared/` contains code shared by both apps: model types, persistence, sync record building and applying, context capture, and App Intents.
18- `Tests/` contains the unit test suite.
19- `Scripts/` contains common build/test/development scripts.
20- `Notes/` contains design notes.
21
22Persistence is Core Data. CloudKit sync uses raw `CKSyncEngine` with a `Config` zone and a `Reports` zone in the private database. It does not use NSPersistentCloudKitContainer or SwiftData. The Watch fetches only the `Config` zone.
23
24Reporter archives are imported from Reporter's JSON export. The importer must be idempotent and keep everything Reportage models: imported records keep their Reporter IDs. Reporter-only fields are dropped; the user keeps the export file as the original.
25
26## Personal Data
27
28- `reporter-export*.json` is the user's real life-log archive. It is gitignored; never commit it, copy it into the repository elsewhere, or quote its contents in notes, fixtures, logs or commit messages.
29- It is fine to read the export locally to answer questions about its structure or to verify the importer. Report aggregate findings (counts, field shapes, date ranges), not individual entries.
30- Importer tests use hand-made fixtures in `Tests/Support/` that mirror the export's quirks with invented data.
31
32## Working Notes
33
34- If `.agents/local.md` exists, read it for private machine-local instructions. Do not commit it.
35
36## Building
37
38- The Xcode project is generated from `project.yml` using XcodeGen. Do not edit `Reportage.xcodeproj/project.pbxproj` directly; run `xcodegen generate` after changing project structure.
39- Compile-check changes via `bash Scripts/build.sh`; the script picks a simulator automatically. Use this for a quick build instead of running the full unit suite.
40
41## Versioning
42
43- The version recorded in `HEAD` represents an unreleased version of Reportage.
44- Bump the version only after the preceding version has been released on the App Store; the bump begins development of the next release.
45
46## Running Tests
47
48- Run the unit suite via `bash Scripts/test-unit.sh`; the script picks a simulator automatically.
49- Capture the full output to a file on the first run, then grep + tail — never re-run the suite just to look at different parts of the output. One-shot pattern:
50 ```bash
51 bash Scripts/test-unit.sh > /tmp/test.log 2>&1; grep -E "✘|Test run with" /tmp/test.log; echo "---"; tail -15 /tmp/test.log
52 ```
53 Tests run serially, so results use Swift Testing's `✔`/`✘` format. This surfaces every failure, the Swift Testing totals and the trailing summary (totals on success, `.xcresult` path on failure). For more context on a failure, grep around the failure line in the same log file or open the `.xcresult`.