nativeapptemplate-agent 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CLAUDE.md +10 -8
  2. package/README.md +65 -21
  3. package/dist/agents/judge.d.ts +8 -0
  4. package/dist/agents/judge.d.ts.map +1 -1
  5. package/dist/agents/judge.js +167 -29
  6. package/dist/agents/judge.js.map +1 -1
  7. package/dist/agents/repair.d.ts +14 -0
  8. package/dist/agents/repair.d.ts.map +1 -0
  9. package/dist/agents/repair.js +103 -0
  10. package/dist/agents/repair.js.map +1 -0
  11. package/dist/agents/types.d.ts +34 -1
  12. package/dist/agents/types.d.ts.map +1 -1
  13. package/dist/dispatch.d.ts +21 -2
  14. package/dist/dispatch.d.ts.map +1 -1
  15. package/dist/dispatch.js +250 -14
  16. package/dist/dispatch.js.map +1 -1
  17. package/dist/env-bridge.d.ts +17 -0
  18. package/dist/env-bridge.d.ts.map +1 -0
  19. package/dist/env-bridge.js +211 -0
  20. package/dist/env-bridge.js.map +1 -0
  21. package/dist/index.d.ts +11 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +88 -3
  24. package/dist/index.js.map +1 -1
  25. package/dist/mcp.d.ts +5 -0
  26. package/dist/mcp.d.ts.map +1 -0
  27. package/dist/mcp.js +83 -0
  28. package/dist/mcp.js.map +1 -0
  29. package/dist/mobile.d.ts +31 -0
  30. package/dist/mobile.d.ts.map +1 -0
  31. package/dist/mobile.js +179 -0
  32. package/dist/mobile.js.map +1 -0
  33. package/dist/rails-lifecycle.d.ts +16 -0
  34. package/dist/rails-lifecycle.d.ts.map +1 -0
  35. package/dist/rails-lifecycle.js +184 -0
  36. package/dist/rails-lifecycle.js.map +1 -0
  37. package/dist/rename-overrides.d.ts +23 -0
  38. package/dist/rename-overrides.d.ts.map +1 -0
  39. package/dist/rename-overrides.js +58 -0
  40. package/dist/rename-overrides.js.map +1 -0
  41. package/dist/repair-loop.d.ts +25 -0
  42. package/dist/repair-loop.d.ts.map +1 -0
  43. package/dist/repair-loop.js +67 -0
  44. package/dist/repair-loop.js.map +1 -0
  45. package/dist/report/collect.d.ts +28 -0
  46. package/dist/report/collect.d.ts.map +1 -0
  47. package/dist/report/collect.js +117 -0
  48. package/dist/report/collect.js.map +1 -0
  49. package/dist/report/model.d.ts +49 -0
  50. package/dist/report/model.d.ts.map +1 -0
  51. package/dist/report/model.js +2 -0
  52. package/dist/report/model.js.map +1 -0
  53. package/dist/report/render.d.ts +3 -0
  54. package/dist/report/render.d.ts.map +1 -0
  55. package/dist/report/render.js +242 -0
  56. package/dist/report/render.js.map +1 -0
  57. package/dist/report/theme.d.ts +2 -0
  58. package/dist/report/theme.d.ts.map +1 -0
  59. package/dist/report/theme.js +115 -0
  60. package/dist/report/theme.js.map +1 -0
  61. package/dist/slug.d.ts +3 -0
  62. package/dist/slug.d.ts.map +1 -1
  63. package/dist/slug.js +30 -0
  64. package/dist/slug.js.map +1 -1
  65. package/dist/validation/capture.d.ts.map +1 -1
  66. package/dist/validation/capture.js +19 -2
  67. package/dist/validation/capture.js.map +1 -1
  68. package/dist/validation/discover.js +1 -1
  69. package/dist/validation/discover.js.map +1 -1
  70. package/dist/validation/index.d.ts +8 -2
  71. package/dist/validation/index.d.ts.map +1 -1
  72. package/dist/validation/index.js +4 -1
  73. package/dist/validation/index.js.map +1 -1
  74. package/dist/validation/launch.d.ts +10 -0
  75. package/dist/validation/launch.d.ts.map +1 -1
  76. package/dist/validation/launch.js +127 -12
  77. package/dist/validation/launch.js.map +1 -1
  78. package/dist/validation/layer1.d.ts.map +1 -1
  79. package/dist/validation/layer1.js +12 -4
  80. package/dist/validation/layer1.js.map +1 -1
  81. package/dist/validation/layer2.js +1 -1
  82. package/dist/validation/layer2.js.map +1 -1
  83. package/dist/validation/scenarios/queue.d.ts +12 -0
  84. package/dist/validation/scenarios/queue.d.ts.map +1 -0
  85. package/dist/validation/scenarios/queue.js +216 -0
  86. package/dist/validation/scenarios/queue.js.map +1 -0
  87. package/dist/validation/stage1.d.ts +2 -0
  88. package/dist/validation/stage1.d.ts.map +1 -1
  89. package/dist/validation/stage1.js +2 -0
  90. package/dist/validation/stage1.js.map +1 -1
  91. package/dist/validation/stage2-judge.d.ts +23 -0
  92. package/dist/validation/stage2-judge.d.ts.map +1 -0
  93. package/dist/validation/stage2-judge.js +225 -0
  94. package/dist/validation/stage2-judge.js.map +1 -0
  95. package/dist/validation/stage2.d.ts +74 -0
  96. package/dist/validation/stage2.d.ts.map +1 -0
  97. package/dist/validation/stage2.js +328 -0
  98. package/dist/validation/stage2.js.map +1 -0
  99. package/dist/validation/visual-judge.d.ts +37 -0
  100. package/dist/validation/visual-judge.d.ts.map +1 -1
  101. package/dist/validation/visual-judge.js +100 -16
  102. package/dist/validation/visual-judge.js.map +1 -1
  103. package/dist/version.d.ts +2 -0
  104. package/dist/version.d.ts.map +1 -0
  105. package/dist/version.js +17 -0
  106. package/dist/version.js.map +1 -0
  107. package/package.json +6 -3
  108. package/scripts/ruby/rename.rb +7 -3
package/CLAUDE.md CHANGED
@@ -30,11 +30,13 @@ Project-wide Claude Code instructions. Keep this file short — it's loaded into
30
30
 
31
31
  ## Substrate (what the agent operates on)
32
32
 
33
- The agent works on either the free (MIT-licensed) edition or the paid edition — the same code path handles both, validated end-to-end. Pick which substrate to use by pointing the env vars at the corresponding repos:
33
+ The agent targets BOTH the paid and free (MIT-licensed) editions — the same code path handles both, validated end-to-end. **Test the paid edition first**: the free edition is a strict subset of paid (paid = free + multi-tenancy + invitations + role permissions + org switching), so anything that works on paid works on free, but not vice-versa. Catching paid-only regressions first avoids "free passes, paid breaks" surprises.
34
+
35
+ Env vars point at the paid edition by default. Pick which substrate to use by pointing them at the corresponding repos:
34
36
 
35
37
  - `$NATIVEAPPTEMPLATE_API` — Rails 8.1 API repo (`nativeapptemplateapi`, single repo serves both editions; multi-tenancy + invitations are conditional features)
36
- - `$NATIVEAPPTEMPLATE_IOS` — SwiftUI iOS repo. Free: `NativeAppTemplate-Free-iOS` (Swift 15,311 LOC). Paid: `NativeAppTemplate` (Swift 23,003 LOC, adds org switching, invitations, role permissions).
37
- - `$NATIVEAPPTEMPLATE_ANDROID` — Jetpack Compose Android repo. Free: `NativeAppTemplate-Free-Android` (Kotlin 19,521 LOC). Paid: `NativeAppTemplate` (Kotlin 28,401 LOC).
38
+ - `$NATIVEAPPTEMPLATE_IOS` — SwiftUI iOS repo. Paid: `NativeAppTemplate` (Swift 23,003 LOC, adds org switching, invitations, role permissions). Free: `NativeAppTemplate-Free-iOS` (Swift 15,311 LOC).
39
+ - `$NATIVEAPPTEMPLATE_ANDROID` — Jetpack Compose Android repo. Paid: `NativeAppTemplate` (Kotlin 28,401 LOC). Free: `NativeAppTemplate-Free-Android` (Kotlin 19,521 LOC).
38
40
 
39
41
  The renamer's substitution rules (Shop / Shopkeeper / ItemTag / NativeAppTemplate) apply identically to both editions. Paid-only concepts (Account, Member, Invitation) aren't in the rename plan, so paid features survive the generation intact. Both editions hit the same Rails OpenAPI server, so the reviewer's three-way diff works against either.
40
42
 
@@ -46,7 +48,7 @@ The renamer's substitution rules (Shop / Shopkeeper / ItemTag / NativeAppTemplat
46
48
  - `Shopkeeper` → the authenticated user/owner of a Shop
47
49
  - `ItemTag` (aka Number Tag) → a queue entry, attached to a Shop
48
50
  - **ItemTag has TWO states: `Idled` ↔ `Completed`.** It's a toggle, not a three-state machine. If a user's spec wants three states (e.g. "in-service"), extend the machine rather than assume it.
49
- - Free edition is single-organization (personal account is transparent). Paid-edition features (multi-tenancy, invitations, roles, org switching) are out of scope for the hackathon.
51
+ - Free edition is single-organization (personal account is transparent). Paid edition adds multi-tenancy, invitations, roles, org switching — all out of scope for the rename pipeline (paid-only concepts aren't in the rename plan), but the agent still operates against paid substrates by default since paid is a superset of free.
50
52
 
51
53
  ## Repository state
52
54
 
@@ -62,7 +64,7 @@ npm run dev -- "your spec here"
62
64
 
63
65
  # Substrate commands — run from the matching generated project dir in ./out/<slug>/
64
66
  bin/dev # Rails API
65
- xcodebuild -scheme NativeAppTemplate -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' build # iOS
67
+ xcodebuild -scheme NativeAppTemplate -destination 'platform=iOS Simulator,name=iPhone 17 Pro,OS=26.2' build # iOS
66
68
  ./gradlew assembleDebug && ./gradlew installDebug # Android
67
69
 
68
70
  # Validation (run from this repo root)
@@ -89,7 +91,7 @@ Three clean operations on the substrate (details in `docs/SPEC.md` section 4):
89
91
 
90
92
  ## Guardrails
91
93
 
92
- - **Self-repair loop hard-capped at 5 iterations** per generated project. On exceed, surface residuals and exit.
94
+ - **Self-repair loop hard-capped at 5 iterations** per generated project, opt-in via `NATIVEAPPTEMPLATE_REPAIR` (targets Layer 1/2 only; Layer 3 + reviewer are surfaced, not auto-repaired). On exceed, surface residuals and exit. Code: `src/repair-loop.ts` + `src/agents/repair.ts`.
93
95
  - Known-cryptic failure modes: Jetpack Compose compilation, Hilt DI. Slow down and verify rather than pattern-match on those.
94
96
  - **Do not invent tests for the generated code.** The substrate already has tests; use them.
95
97
  - **Never modify the substrate repos** — clone them fresh into `./out/<slug>/{rails,ios,android}` before editing.
@@ -132,6 +134,6 @@ Ships as:
132
134
 
133
135
  - **Don't reimplement mobile UI automation.** Use mobile-mcp. The hackathon is not about inventing device automation.
134
136
  - **Don't extend scope beyond the queue / simple-CRUD-SaaS family** during the hackathon week. See `docs/SPEC.md` section 9 for the full non-goals list.
135
- - **Don't target the paid edition.** The deliverable operates only on the MIT-licensed free edition so judges can reproduce it end-to-end.
137
+ - **Test the paid edition first.** Free is a strict subset of paid, so running paid first catches regressions that wouldn't surface against free alone. The OSS reproducibility story (judges/contributors with no paid license) lives in the free edition — once paid is green, point env vars at the free repos and re-run for the public demo.
136
138
  - **Don't skip the validation layers to save time.** They are the demo story. A run that green-builds without passing Layer 3 is a failed run.
137
- - **Don't edit, commit, push, or run `git clean` / `rm` inside `$NATIVEAPPTEMPLATE_API`, `$NATIVEAPPTEMPLATE_IOS`, or `$NATIVEAPPTEMPLATE_ANDROID`.** Those are the developer's working copies of the free-edition substrate, possibly shared with other projects on the same machine. Copy them into `./out/<slug>/` first; change nothing in place. If unsure whether a command is safe, ask.
139
+ - **Don't edit, commit, push, or run `git clean` / `rm` inside `$NATIVEAPPTEMPLATE_API`, `$NATIVEAPPTEMPLATE_IOS`, or `$NATIVEAPPTEMPLATE_ANDROID`.** Those are the developer's working copies of the substrate (paid by default; possibly free), shared with other projects on the same machine. Copy them into `./out/<slug>/` first; change nothing in place. If unsure whether a command is safe, ask.
package/README.md CHANGED
@@ -8,7 +8,16 @@ A Claude Code agent that turns a natural-language spec — something as informal
8
8
 
9
9
  Coherent across all three, in under an hour.
10
10
 
11
- > **Status:** Hackathon build. Developed during [Built with Opus 4.7: a Claude Code Hackathon](https://cerebralvalley.ai/e/built-with-4-7-hackathon) (April 21–27, 2026). Active development in progress — expect breaking changes through the end of April.
11
+ [![npm](https://img.shields.io/npm/v/nativeapptemplate-agent.svg)](https://www.npmjs.com/package/nativeapptemplate-agent)
12
+ [![CI](https://github.com/nativeapptemplate/nativeapptemplate-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/nativeapptemplate/nativeapptemplate-agent/actions/workflows/ci.yml)
13
+ [![license: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
14
+ [![node: >=22](https://img.shields.io/node/v/nativeapptemplate-agent.svg)](https://nodejs.org/)
15
+
16
+ ```bash
17
+ npx nativeapptemplate-agent "a walk-in clinic queue for small veterinary practices"
18
+ ```
19
+
20
+ > **Status: v0.1.2 stable.** First built during [Built with Opus 4.7: a Claude Code Hackathon](https://cerebralvalley.ai/e/built-with-4-7-hackathon) (April 21–27, 2026); shipped to npm post-hackathon. Verified end-to-end on the three demo specs below from a fresh `/tmp/` cwd. Stage 2 (scripted-CRUD walk-through via `mobile-mcp` against a live Rails server) and paid-edition parity validation landed post-launch. Active development continues — see the [roadmap](./ROADMAP.md) for what's next.
12
21
 
13
22
  ---
14
23
 
@@ -35,10 +44,14 @@ It will:
35
44
  3. **Rename the skeleton** — `Shop → Clinic`, `Shopkeeper → Vet`, etc. — consistently across Ruby migrations, Swift models, Kotlin data classes, policies, tests, and localized copy.
36
45
  4. **Adapt or replace the domain module** — keep `ItemTag` for walk-in queue variants; strip and insert a new resource for non-queue SaaS.
37
46
  5. **Drive the build green** — `bin/rails test`, `xcodebuild test`, `./gradlew test` must all pass before the agent exits.
38
- 6. **Validate the output** across three layers (structural, runtime, semantic). Details in [`docs/SPEC.md`](./docs/SPEC.md) section 6.
47
+ 6. **Validate the output** across three layers (structural, runtime, semantic) and write a self-contained HTML + JSON [validation report](#validation-report). Details in [`docs/SPEC.md`](./docs/SPEC.md) section 6.
39
48
 
40
49
  ## Demo
41
50
 
51
+ https://github.com/user-attachments/assets/bd1ed091-93d8-45d7-b502-c21720218484
52
+
53
+ 90-second end-to-end run: spec → renamed Rails API + iOS app + Android app, all three platforms validated. Also on [YouTube](https://youtu.be/z08ueZX-02I) for full-screen viewing.
54
+
42
55
  Three demo specs, both adapt and replace paths, all four validation layers green end-to-end:
43
56
 
44
57
  | Spec | Domain entity (post-rename) | Path | Result |
@@ -47,16 +60,9 @@ Three demo specs, both adapt and replace paths, all four validation layers green
47
60
  | `"a restaurant waitlist for casual dining"` | `Shop → Restaurant`, `Shopkeeper → Host` | adapt | Layer 1 3/3 · Layer 2 3/3 · Layer 3 2/2 · Reviewer PASS |
48
61
  | `"a personal task tracker with due dates"` | `ItemTag → Todo` (replaces queue entry entirely) | replace | Layer 1 3/3 · Layer 2 3/3 · Layer 3 2/2 · Reviewer PASS |
49
62
 
50
- Layer 2 ran in build mode — real `xcodebuild build` and `./gradlew assembleDebug`, full app builds installed on iPhone 17 simulator and Android emulator. Layer 3 captured the home-screen via `xcrun simctl io booted screenshot` / `adb exec-out screencap` and judged against the rubric using Opus 4.7 vision (median of 3 samples per criterion).
51
-
52
- The agent works on either the **free (MIT) edition** or the **paid edition** without code changes — the same pipeline handles both substrates; multi-tenant features (org switching, invitations, role permissions) survive the rename pipeline when targeting paid.
63
+ Layer 2 ran in build mode — real `xcodebuild build` and `./gradlew assembleDebug`, full app builds installed on iPhone 17 Pro simulator and Android emulator. Layer 3 captured the home-screen via `xcrun simctl io booted screenshot` / `adb exec-out screencap` and judged against the rubric using Opus 4.7 vision (median of 3 samples per criterion). With `NATIVEAPPTEMPLATE_VISUAL=2`, Layer 2 additionally drives a scripted-CRUD walk-through via `mobile-mcp` against a live Rails server — Welcome → Sign Up → email-confirm via `bin/rails runner` → Sign In → drill into the auto-seeded sample — and Layer 3 then judges the post-walk screenshot against a domain-content rubric.
53
64
 
54
- <table>
55
- <tr>
56
- <td align="center"><img src="docs/images/demo-ios-vet-clinic-queue.png" width="300"><br><sub>iOS — Vet Clinic Queue welcome screen</sub></td>
57
- <td align="center"><img src="docs/images/demo-android-vet-clinic-queue.png" width="300"><br><sub>Android — Vet Clinic Queue welcome screen</sub></td>
58
- </tr>
59
- </table>
65
+ The agent works on either the **free (MIT) edition** or the **paid edition** without code changes — the same pipeline handles both substrates; multi-tenant features (org switching, invitations, role permissions) survive the rename pipeline when targeting paid. The agent tests paid first because free is a strict subset of paid; running paid first catches regressions that wouldn't surface against free alone.
60
66
 
61
67
  Both screenshots are real captures from the booted iOS Simulator and Android emulator post-`./gradlew assembleDebug` / `xcodebuild build`, after the agent installed and launched the generated app.
62
68
 
@@ -89,12 +95,10 @@ The agent operates on the free, MIT-licensed edition of NativeAppTemplate — th
89
95
 
90
96
  Combined ~42.5k LOC. Extracted from [MyTurnTag Creator](https://myturntag.com), a walk-in queue-management SaaS live on both app stores since 2024.
91
97
 
92
- ## Usage (target interface)
93
-
94
- > **Not yet functional — hackathon build in progress.** The interface below is the target; `npx` won't work until v0.1 ships at the end of hackathon week.
98
+ ## Usage
95
99
 
96
100
  ```bash
97
- # Standalone CLI — must-have for the hackathon demo
101
+ # Standalone CLI
98
102
  npx nativeapptemplate-agent "a walk-in clinic queue for small veterinary practices"
99
103
 
100
104
  # Stretch specs the agent is also designed to handle
@@ -103,9 +107,11 @@ npx nativeapptemplate-agent "a personal task tracker with due dates"
103
107
 
104
108
  # Generated output appears under ./out/<slug>/
105
109
  tree ./out/clinic-queue/
106
- # ├── rails/ ← Rails 8.1 API, git-initialized, buildable
107
- # ├── ios/ ← SwiftUI iOS project, buildable
108
- # └── android/ ← Jetpack Compose Android project, buildable
110
+ # ├── rails/ ← Rails 8.1 API, git-initialized, buildable
111
+ # ├── ios/ ← SwiftUI iOS project, buildable
112
+ # ├── android/ ← Jetpack Compose Android project, buildable
113
+ # ├── report.json ← machine-readable validation result
114
+ # └── validation-report.html ← self-contained visual report (open in a browser)
109
115
  ```
110
116
 
111
117
  The agent will also be available as a Claude Code plugin.
@@ -132,6 +138,10 @@ The agent will also be available as a Claude Code plugin.
132
138
  ### Optional flags
133
139
 
134
140
  - `NATIVEAPPTEMPLATE_VISUAL=1` — opts the run into Stage 1 visual judging (Layer 3). When set, Layer 2 runs in **build mode** instead of fast mode (full `xcodebuild build` + `./gradlew assembleDebug`), then for each platform the agent installs the app on the booted sim/emulator, captures the home screen, and judges it with Opus 4.7 vision against `DEFAULT_STAGE1_RUBRIC`. Adds 60-180s per platform depending on cold-build time. Requires a sim/emulator booted for each platform you want judged. Off by default — `npm run dev` keeps the existing fast path.
141
+ - `NATIVEAPPTEMPLATE_VISUAL=2` — implies `=1` and additionally runs **Stage 2**: the agent boots the generated Rails app under `mise exec -- bin/dev` (after `bundle install` + `bin/rails db:prepare` + `bin/rails db:seed_fu`), waits for it to listen, then drives the iOS sim and Android emulator through the parameterized queue scenario (Sign Up → email-confirm via `bin/rails runner` → Sign In → drill into auto-seeded sample). Layer 3 then judges the last captured screenshot against `DEFAULT_STAGE2_RUBRIC` (domain content + no substrate-token leak). Adds 2–4 minutes per platform on top of `=1`. Requires both sims/emulators booted and the substrate's `mise` toolchain installed for `bin/dev`.
142
+ - `NATIVEAPPTEMPLATE_REPAIR` — opts into the bounded self-repair loop. Set `on` (or a positive integer N, hard-capped at 5) to enable. When the first validation pass fails on a **code-repairable** layer — Layer 1 leftover substrate tokens or Layer 2 build/compile errors — the agent runs a Claude Agent SDK repair pass scoped to the failing generated project (Read/Edit/Bash inside `out/<slug>/<platform>/` only), re-validates that platform, and repeats up to the cap. Each attempt is recorded in the validation report's self-repair table. Layer 3 (vision) and contract-reviewer misses are surfaced but not auto-repaired (a Layer 3 miss is usually environmental, not a source bug). Off by default; when the loop can't close the failures the agent still exits non-zero.
143
+ - `NATIVEAPPTEMPLATE_BRIDGE=off` — skip writing to `~/.gradle/gradle.properties`. The agent normally mirrors `NATIVEAPPTEMPLATE_API_*` (HOST/PORT/SCHEME) into renamed-product variants (`<PRODUCT>_API_*`) at run time so the generated Android app picks them up via `gradle.properties` and the iOS sim launch picks them up via `SIMCTL_CHILD_*`. Set this to disable the file write (process.env injection still runs for child-spawn paths).
144
+ - `NATIVEAPPTEMPLATE_BRIDGE_DRY_RUN=1` — log what would be written to `~/.gradle/gradle.properties` instead of writing. Useful before granting the bridge write access to your user-global gradle.
135
145
  - `NATIVEAPPTEMPLATE_AGENT_ANTHROPIC_KEY` — dedicated workspace key, see [Security](#security).
136
146
  - `ANDROID_SERIAL` — when more than one Android device/emulator is attached (e.g. a physical device plus a running emulator), `adb` standard practice is to set `ANDROID_SERIAL=<serial>` to disambiguate. The agent honors this transparently because it runs `adb` directly. Run `adb devices` to list serials. Visual-judge runs with multiple Android targets attached will error with `more than one device/emulator` if this isn't set.
137
147
 
@@ -142,11 +152,45 @@ The agent resolves `adb` to a known-good binary in this priority order: `$ANDROI
142
152
  The agent doesn't just generate code and exit — it validates the output.
143
153
 
144
154
  1. **Structural.** `ripgrep` for leftover domain tokens; OpenAPI contract parity check between Rails, iOS networking, and Android repository layers. A silent rename inconsistency fails the run before any tests execute.
145
- 2. **Runtime.** Boot the generated Rails server; build and launch iOS and Android apps; drive a scripted CRUD scenario via [`mobile-next/mobile-mcp`](https://github.com/mobile-next/mobile-mcp). Any 4xx/5xx or unhandled client error fails the run.
155
+ 2. **Runtime.** Verify the generated Rails app boots (`bin/rails runner 'puts OK'`); type-check or build the iOS and Android apps. With `NATIVEAPPTEMPLATE_VISUAL=1`, escalate to a full build (`xcodebuild build` + `./gradlew assembleDebug`) and install on the booted sim/emulator. With `=2`, additionally boot the live Rails server and drive a scripted CRUD walk-through via [`mobile-next/mobile-mcp`](https://github.com/mobile-next/mobile-mcp). Any 4xx/5xx or unhandled client error fails the run.
146
156
  3. **Semantic.** Opus 4.7 as judge — scores whether the generated code and rendered UI actually express the intended domain. Vision judges read simulator/emulator screenshots directly.
147
157
 
148
158
  See [`docs/SPEC.md`](./docs/SPEC.md) for the full design.
149
159
 
160
+ ## Validation report
161
+
162
+ Every run writes a report of the validation results to the output directory:
163
+
164
+ [![Example validation report (free edition): a self-contained HTML page showing the overall PASS verdict, a platform×layer matrix, per-layer detail, embedded iOS + Android home-screen captures with the vision judge's rationales, the contract-parity check, and the domain rename plan](./docs/images/validation-report.png)](./docs/images/validation-report.png)
165
+
166
+ *Example report from a free-edition run of `"a walk-in queue for small veterinary clinics"` — all three layers green. Click to view full size; the real artifact is a live, self-contained HTML file you open in a browser.*
167
+
168
+ - **`out/<slug>/validation-report.html`** — a self-contained HTML report (screenshots base64-embedded, no external assets, no JavaScript) you can open in a browser, attach to a PR, or drop into a demo. It shows the overall verdict, a platform×layer matrix, Layer 1 leftover-token findings, Layer 2 build commands + `stderr`, Layer 3 home-screen screenshots with the vision judge's per-criterion rationales (plus the Stage 2 filmstrip when `NATIVEAPPTEMPLATE_VISUAL=2`), the reviewer's contract diff, and the domain rename plan.
169
+ - **`out/<slug>/report.json`** — the same data, machine-readable, for CI gating or programmatic use. The full schema lives in [`docs/validation-report.md`](./docs/validation-report.md).
170
+
171
+ The CLI **exits non-zero when validation fails**, so a shell `&&` chain or CI step catches it:
172
+
173
+ ```bash
174
+ npx nativeapptemplate-agent "a walk-in clinic queue" && echo "validation passed"
175
+ ```
176
+
177
+ Naming flags:
178
+
179
+ | Flag | Default | Effect |
180
+ |---|---|---|
181
+ | `--project-name="Vet Clinic"` | planner's pick | Name the project. Accepts a human name (`"Vet Clinic"`), PascalCase (`VetClinic`), or kebab (`vet-clinic`); from it the agent derives the Pascal project name (`NativeAppTemplate → VetClinic` across all three platforms), the slug/output dir (`out/vet-clinic/`), the DB prefix + env-bridge token, and the display name. Invalid (no derivable slug) is reported and skipped. |
182
+ | `--rename From=To` | planner's pick | Override one of the planner's domain rename targets (repeatable). `From` is a substrate token (`Shop`, `Shopkeeper`, `ItemTag`); the planner fills in everything else. An override that matches no planned rename is reported and skipped. Example: `--rename Shopkeeper=Vet --rename Shop=Clinic` |
183
+
184
+ Report flags:
185
+
186
+ | Flag | Default | Effect |
187
+ |---|---|---|
188
+ | `--no-report` | — | Skip writing the report |
189
+ | `--report-format=html\|json\|both` | `both` | Which artifact(s) to write |
190
+ | `--report-embed=true\|false` | `true` | Embed screenshots as `data:` URIs (single portable file) vs. copy to `report-assets/` |
191
+ | `--report-open` | — | Open the HTML in your browser when the run finishes (macOS) |
192
+ | `--exit-zero` | — | Always exit 0, even on validation failure (e.g. when you only want the report) |
193
+
150
194
  ## Security
151
195
 
152
196
  `ANTHROPIC_API_KEY` is the only sensitive secret the agent needs.
@@ -172,9 +216,9 @@ The agent strips `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and `NATIVEAPPTEMP
172
216
 
173
217
  ## Contributing
174
218
 
175
- During hackathon week (April 21–27, 2026) the repository moves quickly and breaking changes are expected. After that, contributions are welcome via standard GitHub issues and PRs. A `CONTRIBUTING.md` with detailed guidelines will land once the hackathon dust settles.
219
+ Issues and PRs welcome. The repository is stable now (v0.1.x) — no more hackathon-pace rewrites. A `CONTRIBUTING.md` with detailed guidelines will land alongside v0.2.
176
220
 
177
- If you spot something broken before then, feel free to open an issue — just don't be surprised if the fix lands as part of a larger rewrite.
221
+ For now, the simplest path is: open an issue describing what you're trying to do, and we'll figure out the right shape together before code lands. Bug reports with reproducible commands (and the `/tmp/<dir>/tmp/trace/` log) are especially welcome.
178
222
 
179
223
  ## License
180
224
 
@@ -16,6 +16,14 @@ export type VisualJudgeConfig = {
16
16
  screenshotDir?: string;
17
17
  rubric?: readonly Layer3Criterion[];
18
18
  spec?: string;
19
+ stage2?: {
20
+ primaryResourceName: string;
21
+ fullName: string;
22
+ email: string;
23
+ password: string;
24
+ railsOutDir: string;
25
+ rubric?: readonly Layer3Criterion[];
26
+ };
19
27
  };
20
28
  export declare function runJudge(input: JudgeInput): Promise<JudgeResult>;
21
29
  //# sourceMappingURL=judge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../src/agents/judge.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEX,cAAc,EAEd,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAKF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAWF,wBAAsB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CA2CtE"}
1
+ {"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../src/agents/judge.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAAK,UAAU,EAAqB,MAAM,yBAAyB,CAAC;AAMxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAGX,cAAc,EAGd,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAWF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QACP,mBAAmB,EAAE,MAAM,CAAC;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;KACrC,CAAC;CACH,CAAC;AAQF,wBAAsB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAkEtE"}
@@ -1,9 +1,15 @@
1
1
  import { resolve } from "node:path";
2
+ import { setTimeout as sleep } from "node:timers/promises";
2
3
  import { trace } from "../trace.js";
3
4
  import { isStub } from "../stub.js";
5
+ import { createMobileClient } from "../mobile.js";
4
6
  import { runLayer1 } from "../validation/layer1.js";
5
7
  import { runLayer2 } from "../validation/layer2.js";
6
8
  import { runStage1Visual } from "../validation/stage1.js";
9
+ import { runStage2Visual, selectDevice } from "../validation/stage2-judge.js";
10
+ import { recoverFromErrorScreen } from "../validation/stage2.js";
11
+ import { discoverIosArtifact, discoverAndroidArtifact } from "../validation/discover.js";
12
+ import { buildQueueScenario } from "../validation/scenarios/queue.js";
7
13
  export async function runJudge(input) {
8
14
  if (isStub("judge"))
9
15
  return runStubJudge();
@@ -16,32 +22,54 @@ export async function runJudge(input) {
16
22
  evaluate(input.android, layer2Mode),
17
23
  ]);
18
24
  for (const r of reports) {
19
- const l1 = r.layer1Pass ? "PASS" : `FAIL (${r.layer1Findings} leftover tokens)`;
20
- const l2 = r.layer2Pass ? `PASS (${(r.layer2DurationMs / 1000).toFixed(1)}s)` : "FAIL";
21
- trace("judge", `${r.platform}: Layer 1 ${l1} · Layer 2 ${l2} [${r.layer2Command}]`);
25
+ const l1 = r.layer1.pass ? "PASS" : `FAIL (${r.layer1.findings.length} leftover tokens)`;
26
+ const l2 = r.layer2.pass ? `PASS (${(r.layer2.durationMs / 1000).toFixed(1)}s)` : "FAIL";
27
+ trace("judge", `${r.platform}: Layer 1 ${l1} · Layer 2 ${l2} [${r.layer2.command}]`);
22
28
  }
23
29
  let visualReport;
24
30
  let layer3Summary = "Layer 3 skipped";
25
31
  if (input.visual && (input.visual.iosDir || input.visual.androidDir)) {
26
32
  visualReport = await runVisualPhase(input.visual, input.domain);
33
+ if (input.visual.stage2) {
34
+ visualReport = await runStage2Phase(visualReport, input.visual, input.domain);
35
+ }
27
36
  layer3Summary = formatLayer3Summary(visualReport);
28
37
  }
29
38
  else {
30
39
  trace("judge", "Layer 3 (semantic, Opus 4.7 vision judge) — visual config not provided; skipped");
31
40
  }
32
- const layer1Layer2Pass = reports.every((r) => r.layer1Pass && r.layer2Pass);
41
+ const layer1Layer2Pass = reports.every((r) => r.layer1.pass && r.layer2.pass);
33
42
  const visualPass = visualReport
34
43
  ? Object.values(visualReport).every((r) => Boolean(r) && r.pass)
35
44
  : true;
36
45
  const reviewerPass = input.reviewer.contractParity === "pass";
37
46
  const overallPass = layer1Layer2Pass && visualPass && reviewerPass;
38
- const l1Total = reports.filter((r) => r.layer1Pass).length;
39
- const l2Total = reports.filter((r) => r.layer2Pass).length;
47
+ const l1Total = reports.filter((r) => r.layer1.pass).length;
48
+ const l2Total = reports.filter((r) => r.layer2.pass).length;
40
49
  const reviewerSummary = reviewerPass ? "reviewer PASS" : "reviewer FAIL";
50
+ const platforms = reports.map((r) => {
51
+ const layer3 = r.platform === "ios" ? visualReport?.ios
52
+ : r.platform === "android" ? visualReport?.android
53
+ : undefined;
54
+ return {
55
+ platform: r.platform,
56
+ layer1: { pass: r.layer1.pass, findings: r.layer1.findings },
57
+ layer2: {
58
+ pass: r.layer2.pass,
59
+ command: r.layer2.command,
60
+ mode: layer2Mode,
61
+ exitCode: r.layer2.exitCode,
62
+ durationMs: r.layer2.durationMs,
63
+ ...(r.layer2.stderrTail !== undefined ? { stderrTail: r.layer2.stderrTail } : {}),
64
+ },
65
+ ...(layer3 !== undefined ? { layer3 } : {}),
66
+ };
67
+ });
41
68
  return {
42
69
  overallPass,
43
70
  summary: `Layer 1 ${l1Total}/3 pass · Layer 2 ${l2Total}/3 pass · ${layer3Summary} · ${reviewerSummary}`,
44
71
  ...(visualReport ? { visual: visualReport } : {}),
72
+ platforms,
45
73
  };
46
74
  }
47
75
  async function runVisualPhase(config, domain) {
@@ -52,23 +80,140 @@ async function runVisualPhase(config, domain) {
52
80
  platforms.push("android");
53
81
  const rubric = config.rubric;
54
82
  trace("judge", `Layer 3 (semantic) — judging ${platforms.join(" + ")} home screen against rubric`);
55
- const stage1 = await runStage1Visual({
56
- ...(config.iosDir !== undefined ? { iosDir: config.iosDir } : {}),
57
- ...(config.androidDir !== undefined ? { androidDir: config.androidDir } : {}),
58
- spec: config.spec ?? domain.displayName,
59
- ...(rubric !== undefined ? { rubric } : {}),
60
- ...(config.screenshotDir !== undefined ? { screenshotDir: config.screenshotDir } : {}),
61
- });
62
- const report = {};
63
- if (stage1.ios) {
64
- report.ios = toPlatformReport(stage1.ios);
65
- trace("judge", `Layer 3 ios: ${stage1.ios.ok ? "PASS" : "FAIL"}` + (stage1.ios.error ? ` — ${stage1.ios.error}` : ""));
83
+ // iOS recovery for Stage 1: the paid app intermittently lands on a "Something
84
+ // went wrong" error screen at launch. On a renders-cleanly retry, tap its
85
+ // "Back to Start Screen" button (logs out + returns to welcome) so the
86
+ // re-capture sees a clean screen. Only when WDA is available (VISUAL=2, i.e.
87
+ // stage2 configured) and not in stub mode; the mobile client is created
88
+ // lazily on first retry and closed in the finally below.
89
+ let recoverClient;
90
+ let recoverUnavailable = false;
91
+ const canRecover = config.stage2 !== undefined && config.iosDir !== undefined && !isStub("judge");
92
+ const iosRecover = canRecover
93
+ ? async () => {
94
+ if (recoverUnavailable)
95
+ return;
96
+ if (!recoverClient) {
97
+ try {
98
+ recoverClient = await createMobileClient();
99
+ const err = await selectDevice(recoverClient, "ios");
100
+ if (err) {
101
+ recoverUnavailable = true;
102
+ return;
103
+ }
104
+ }
105
+ catch {
106
+ recoverUnavailable = true;
107
+ return;
108
+ }
109
+ }
110
+ const tapped = await recoverFromErrorScreen(recoverClient);
111
+ if (tapped) {
112
+ trace("judge", "Layer 3 ios: tapped 'Back to Start Screen' to clear error screen, re-capturing");
113
+ await sleep(2_000); // let the welcome screen render before re-capture
114
+ }
115
+ }
116
+ : undefined;
117
+ try {
118
+ const stage1 = await runStage1Visual({
119
+ ...(config.iosDir !== undefined ? { iosDir: config.iosDir } : {}),
120
+ ...(config.androidDir !== undefined ? { androidDir: config.androidDir } : {}),
121
+ spec: config.spec ?? domain.displayName,
122
+ ...(rubric !== undefined ? { rubric } : {}),
123
+ ...(config.screenshotDir !== undefined ? { screenshotDir: config.screenshotDir } : {}),
124
+ ...(iosRecover ? { iosRecover } : {}),
125
+ });
126
+ const report = {};
127
+ if (stage1.ios) {
128
+ report.ios = toPlatformReport(stage1.ios);
129
+ trace("judge", `Layer 3 ios: ${stage1.ios.ok ? "PASS" : "FAIL"}` + (stage1.ios.error ? ` — ${stage1.ios.error}` : ""));
130
+ }
131
+ if (stage1.android) {
132
+ report.android = toPlatformReport(stage1.android);
133
+ trace("judge", `Layer 3 android: ${stage1.android.ok ? "PASS" : "FAIL"}` + (stage1.android.error ? ` — ${stage1.android.error}` : ""));
134
+ }
135
+ return report;
66
136
  }
67
- if (stage1.android) {
68
- report.android = toPlatformReport(stage1.android);
69
- trace("judge", `Layer 3 android: ${stage1.android.ok ? "PASS" : "FAIL"}` + (stage1.android.error ? ` — ${stage1.android.error}` : ""));
137
+ finally {
138
+ if (recoverClient)
139
+ await recoverClient.close().catch(() => { });
70
140
  }
71
- return report;
141
+ }
142
+ async function runStage2Phase(base, config, domain) {
143
+ if (!config.stage2)
144
+ return base;
145
+ // Per-platform scenarios with platform-suffixed emails so iOS and
146
+ // Android signups don't collide on "email already taken" — both
147
+ // run against the same shared Rails DB.
148
+ const baseInputs = {
149
+ fullName: config.stage2.fullName,
150
+ password: config.stage2.password,
151
+ primaryResourceName: config.stage2.primaryResourceName,
152
+ railsOutDir: config.stage2.railsOutDir,
153
+ };
154
+ const splitEmail = config.stage2.email.split("@");
155
+ const emailLocal = splitEmail[0] ?? "stage2";
156
+ const emailDomain = splitEmail[1] ?? "example.com";
157
+ const iosScenario = buildQueueScenario(domain, { ...baseInputs, email: `${emailLocal}+ios@${emailDomain}` }, "ios");
158
+ const androidScenario = buildQueueScenario(domain, { ...baseInputs, email: `${emailLocal}+android@${emailDomain}` }, "android");
159
+ // Only walk Stage 2 on platforms whose Stage 1 already passed — a
160
+ // failed launch means there's no live app to drive.
161
+ const wantIos = config.iosDir !== undefined && base.ios?.pass === true;
162
+ const wantAndroid = config.androidDir !== undefined && base.android?.pass === true;
163
+ if (!wantIos && !wantAndroid) {
164
+ trace("judge", "Stage 2 — skipped (no Stage 1 PASS to build on)");
165
+ return base;
166
+ }
167
+ const platforms = [wantIos && "ios", wantAndroid && "android"].filter(Boolean).join(" + ");
168
+ trace("judge", `Stage 2 — scripted-CRUD walk via mobile-mcp on ${platforms}`);
169
+ // Resolve the app ids so Stage 2 can foreground the app before walking (it
170
+ // can drop to springboard between stages). Best-effort: a discovery miss
171
+ // just skips the foreground step.
172
+ const iosArtifact = wantIos && config.iosDir !== undefined ? await discoverIosArtifact(config.iosDir) : null;
173
+ const androidArtifact = wantAndroid && config.androidDir !== undefined ? await discoverAndroidArtifact(config.androidDir) : null;
174
+ const merged = { ...base };
175
+ // Guard the whole Stage 2 walk: mobile-mcp runs in a child process, and if
176
+ // it exits mid-walk the SDK rejects with `McpError: Connection closed`. That
177
+ // must degrade to a recorded Stage 2 failure — not an unhandled throw that
178
+ // aborts dispatch before the report is written.
179
+ try {
180
+ const stage2 = await runStage2Visual({
181
+ spec: config.spec ?? domain.displayName,
182
+ ...(wantIos ? { iosScenario } : {}),
183
+ ...(wantAndroid ? { androidScenario } : {}),
184
+ ...(iosArtifact ? { iosAppId: iosArtifact.bundleId } : {}),
185
+ ...(androidArtifact ? { androidAppId: androidArtifact.packageName } : {}),
186
+ ...(config.stage2.rubric !== undefined ? { rubric: config.stage2.rubric } : {}),
187
+ ...(config.screenshotDir !== undefined ? { screenshotDir: config.screenshotDir } : {}),
188
+ });
189
+ if (stage2.ios && merged.ios) {
190
+ merged.ios = mergeStage2(merged.ios, stage2.ios);
191
+ trace("judge", `Stage 2 ios: ${stage2.ios.pass ? "PASS" : "FAIL"}` + (stage2.ios.error ? ` — ${stage2.ios.error}` : ""));
192
+ }
193
+ if (stage2.android && merged.android) {
194
+ merged.android = mergeStage2(merged.android, stage2.android);
195
+ trace("judge", `Stage 2 android: ${stage2.android.pass ? "PASS" : "FAIL"}` + (stage2.android.error ? ` — ${stage2.android.error}` : ""));
196
+ }
197
+ }
198
+ catch (err) {
199
+ const message = err instanceof Error ? err.message : String(err);
200
+ trace("judge", `Stage 2 — aborted: ${message}; recorded as Stage 2 failure so the run still produces a report`);
201
+ if (wantIos && merged.ios)
202
+ merged.ios = mergeStage2(merged.ios, stage2Failure(iosScenario.name, message));
203
+ if (wantAndroid && merged.android)
204
+ merged.android = mergeStage2(merged.android, stage2Failure(androidScenario.name, message));
205
+ }
206
+ return merged;
207
+ }
208
+ function stage2Failure(scenarioName, error) {
209
+ return { pass: false, scenarioName, stepCount: 0, stepsPassed: 0, screenshots: [], error };
210
+ }
211
+ function mergeStage2(base, stage2) {
212
+ return {
213
+ ...base,
214
+ pass: base.pass && stage2.pass,
215
+ stage2,
216
+ };
72
217
  }
73
218
  function toPlatformReport(result) {
74
219
  const report = { pass: result.ok };
@@ -107,13 +252,6 @@ async function evaluate(worker, layer2Mode) {
107
252
  runLayer1({ projectDir: outDir, forbiddenTokens: worker.renamedFrom }),
108
253
  runLayer2({ platform: worker.platform, outDir, mode: layer2Mode }),
109
254
  ]);
110
- return {
111
- platform: worker.platform,
112
- layer1Pass: layer1.pass,
113
- layer1Findings: layer1.findings.length,
114
- layer2Pass: layer2.pass,
115
- layer2Command: layer2.command,
116
- layer2DurationMs: layer2.durationMs,
117
- };
255
+ return { platform: worker.platform, layer1, layer2 };
118
256
  }
119
257
  //# sourceMappingURL=judge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"judge.js","sourceRoot":"","sources":["../../src/agents/judge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAmB,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC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AAM,CAAC,MAAM,CAAC,CAAC;IAErD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzC,SAAS,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;QACtE,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;KACnE,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { DomainSpec, Platform } from "./types.js";
2
+ export type RepairLayer = "layer1" | "layer2";
3
+ export type RepairTarget = {
4
+ platform: Platform;
5
+ outDir: string;
6
+ layer: RepairLayer;
7
+ detail: string;
8
+ forbiddenTokens?: readonly string[];
9
+ };
10
+ export type RepairOutcome = {
11
+ action: string;
12
+ };
13
+ export declare function runRepair(target: RepairTarget, domain: DomainSpec): Promise<RepairOutcome>;
14
+ //# sourceMappingURL=repair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair.d.ts","sourceRoot":"","sources":["../../src/agents/repair.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQvD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,QAAQ,CAAC;IAGnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IAGnB,MAAM,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAI1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF,wBAAsB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAkDhG"}