create-anpunkit 2.1.0 → 2.3.0

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 (68) hide show
  1. package/bin/cli.js +2 -2
  2. package/package.json +2 -3
  3. package/template/.claude/agents/debugger.md +1 -1
  4. package/template/.claude/agents/e2e-runner.md +56 -29
  5. package/template/.claude/agents/implementer.md +14 -8
  6. package/template/.claude/agents/infra-provisioner.md +53 -59
  7. package/template/.claude/agents/planner.md +99 -30
  8. package/template/.claude/agents/researcher.md +16 -1
  9. package/template/.claude/agents/spec-author.md +126 -0
  10. package/template/.claude/agents/synthesizer.md +1 -1
  11. package/template/.claude/agents/test-author.md +81 -63
  12. package/template/.claude/anpunkit-manifest.json +66 -107
  13. package/template/.claude/commands/infra.md +7 -3
  14. package/template/.claude/commands/log-decision.md +1 -1
  15. package/template/.claude/commands/log-issue.md +1 -1
  16. package/template/.claude/commands/overview.md +55 -13
  17. package/template/.claude/commands/phase.md +153 -81
  18. package/template/.claude/commands/quick.md +1 -1
  19. package/template/.claude/commands/replan.md +1 -1
  20. package/template/.claude/commands/store-wisdom.md +1 -1
  21. package/template/.claude/commands/synthesize.md +1 -1
  22. package/template/.claude/commands/unstuck.md +1 -1
  23. package/template/.claude/hooks/session-start.sh +5 -11
  24. package/template/.claude/ref/compression.md +56 -0
  25. package/template/.claude/skills/karpathy-guidelines/SKILL.md +1 -1
  26. package/template/.gitattributes +1 -0
  27. package/template/AGENTS.md +264 -130
  28. package/template/CLAUDE.md +5 -9
  29. package/template/README.md +116 -136
  30. package/template/commands.src/infra.md +7 -3
  31. package/template/commands.src/log-decision.md +1 -1
  32. package/template/commands.src/log-issue.md +1 -1
  33. package/template/commands.src/overview.md +55 -13
  34. package/template/commands.src/phase.md +153 -81
  35. package/template/commands.src/quick.md +1 -1
  36. package/template/commands.src/replan.md +1 -1
  37. package/template/commands.src/store-wisdom.md +1 -1
  38. package/template/commands.src/synthesize.md +1 -1
  39. package/template/commands.src/unstuck.md +1 -1
  40. package/template/docs/DESIGN_LOG.md +414 -9
  41. package/template/knowledge/azure.md +161 -0
  42. package/template/knowledge/webapp.md +265 -0
  43. package/template/scripts/spec-conformance.sh +93 -0
  44. package/template/scripts/spec-staleness.sh +115 -0
  45. package/template/setup.sh +30 -111
  46. package/template/tests/helpers/spec-assert.py +162 -0
  47. package/template/tests/helpers/spec-assert.ts +158 -0
  48. package/template/.claude/hooks/cursor-session-start.sh +0 -17
  49. package/template/.claude/skills/caveman/SKILL.md +0 -39
  50. package/template/.cursor/commands/infra.md +0 -82
  51. package/template/.cursor/commands/log-decision.md +0 -29
  52. package/template/.cursor/commands/log-issue.md +0 -23
  53. package/template/.cursor/commands/overview.md +0 -145
  54. package/template/.cursor/commands/phase.md +0 -249
  55. package/template/.cursor/commands/quick.md +0 -25
  56. package/template/.cursor/commands/replan.md +0 -73
  57. package/template/.cursor/commands/store-wisdom.md +0 -191
  58. package/template/.cursor/commands/synthesize.md +0 -22
  59. package/template/.cursor/commands/unstuck.md +0 -36
  60. package/template/.cursor/hooks.json +0 -14
  61. package/template/.cursor/rules/anpunkit.md +0 -11
  62. package/template/anpunkit.png +0 -0
  63. package/template/docker-compose.test.yml +0 -34
  64. package/template/e2e/global-setup.ts +0 -57
  65. package/template/index.html +0 -340
  66. package/template/playwright.config.ts +0 -28
  67. package/template/scripts/auth-setup.sh +0 -51
  68. package/template/scripts/e2e-stack.sh +0 -65
@@ -1,14 +1,18 @@
1
1
  # anpunkit — AI-coding system development workflow
2
2
 
3
- A reusable, self-navigating workflow for **Claude Code and Cursor**. Install with
4
- one `npx` command, or clone it directly into your project.
3
+ A reusable, self-navigating workflow for **Claude Code**. Install with one `npx`
4
+ command, or clone it directly into your project.
5
5
 
6
6
  ## Why
7
7
 
8
8
  Codifies a `design-research -> grill -> plan -> implement -> test -> deploy` loop
9
- with vertical-slice phases, blind testing, agent orchestration, automatic context
10
- hygiene, and Azure infrastructure as a first-class Phase 0 so the workflow runs
11
- itself instead of being hand-steered every session.
9
+ with vertical-slice phases, blind testing, agent orchestration, and automatic
10
+ context hygiene so the workflow runs itself instead of being hand-steered every
11
+ session. The invariant core (loop, gates, doc system, commands) is use-case
12
+ agnostic; web/Azure practice ships as **preinstalled knowledge docs**
13
+ (`knowledge/webapp.md`, `knowledge/azure.md`) that the researcher consults only
14
+ when your declared project type calls for them. Works for web apps, desktop apps,
15
+ scripts, and libraries alike.
12
16
 
13
17
  ## The core idea
14
18
 
@@ -22,20 +26,22 @@ Putting "read the issue log" in a hook is why it stops getting skipped.
22
26
  ```bash
23
27
  cd my-project
24
28
  npx create-anpunkit # non-destructive: never clobbers your files
25
- # then open Claude Code or Cursor — the session-start hook fires automatically
26
- /overview # bootstrap the project (includes Phase 0 infra)
29
+ # then open Claude Code — the session-start hook fires automatically
30
+ /overview # bootstrap the project (declares project type + flags)
27
31
  ```
28
- Useful flags: `--dry-run` (print the per-tool plan, write nothing), `--force`
29
- (overwrite user-modified kit files), `--tools <claude,cursor>` (install only the
30
- selected tools' files; interactive menu if omitted on a fresh TTY install),
31
- `--add-tool <name>` (lay down an additional tool's files into an existing
32
- project), `--kb-path <dir>` (your pre-cloned KB repo; remote auto-recorded from
33
- its origin) / `--no-kb`.
32
+ Useful flags: `--dry-run` (print the plan, write nothing), `--force` (overwrite
33
+ user-modified kit files), `--kb-path <dir>` (your pre-cloned KB repo; remote
34
+ auto-recorded from its origin) / `--no-kb`.
34
35
 
35
36
  Upgrading an existing anpunkit project? Re-run `npx create-anpunkit`. It refreshes
36
37
  kit-owned files, preserves anything you modified as `<file>.anpunkit-new`, merges
37
- hook config into your existing `settings.json` / `.cursor/hooks.json`, and writes a
38
- timestamped `.anpunkit-backup-*/` first.
38
+ hook config into your existing `.claude/settings.json`, and writes a timestamped
39
+ `.anpunkit-backup-*/` first.
40
+
41
+ > **Upgrading from v2.2 (Cursor dropped):** v2.3 is Claude Code only. After
42
+ > upgrading you may safely delete the now-orphaned `.cursor/`,
43
+ > `.claude/hooks/cursor-session-start.sh`, and `.claude/anpunkit-tools.json` —
44
+ > setup.sh no longer manages them.
39
45
 
40
46
  **Kit developers — clone + `setup.sh`:**
41
47
  ```bash
@@ -50,9 +56,9 @@ cd my-project && bash setup.sh
50
56
 
51
57
  |Command |Does |
52
58
  |-----------------|------------------------------------------------------------------------------|
53
- |`/overview` |design-research → RESEARCH REVIEW → grill (×2, incl. data/state flow) → OVERVIEW + DATAFLOW → PLAN (Phase 0 first) → STATE|
54
- |`/infra` |provision Azure infra: Bicep → what-if → review → apply → INFRA.md + .env.test → AUTH PROOF|
55
- |`/phase [n]` |run one phase: research → SCAFFOLD → RED → TEST REVIEW → GREEN → E2E, with circuit breaker|
59
+ |`/overview` |design-research → RESEARCH REVIEW → grill (×2, incl. data/state flow) → OVERVIEW (+ project flags) + DATAFLOW → PLAN → STATE|
60
+ |`/infra` |provision infra (when `infra_needed`): IaC → what-if → review → apply → INFRA.md + .env.test → AUTH PROOF|
61
+ |`/phase [n]` |run one phase: research → SPEC fill → SPEC REVIEW → SCAFFOLD → RED → conformance → GREEN → boundary/E2E, with circuit breaker|
56
62
  |`/quick [change]`|small obvious change, direct, no agent chain |
57
63
  |`/unstuck` |deep re-research after a circuit breaker (you trigger it) |
58
64
  |`/synthesize` |compress STATE.md, dedup ISSUES.md, prune snapshots |
@@ -63,23 +69,40 @@ cd my-project && bash setup.sh
63
69
 
64
70
  ## Subagents
65
71
 
66
- `researcher` (Haiku, two modes: design + impl) · `planner` (Opus) · `infra-provisioner` (Opus) ·
67
- `implementer` (Opus, SCAFFOLD/FILL modes) · `test-author` (Opus, blind, RED-first) · `debugger` (Opus, isolated) ·
68
- `e2e-runner` (Opus, blind, Playwright) · `synthesizer` (Haiku)
72
+ `researcher` (Haiku, two modes: design + impl) · `planner` (Opus, also writes skeleton specs) ·
73
+ `infra-provisioner` (Opus) · `spec-author` (Opus, fills per-phase spec + fixtures) ·
74
+ `implementer` (Opus, SCAFFOLD/FILL modes) · `test-author` (Opus, harness emitter) · `debugger` (Opus, isolated) ·
75
+ `e2e-runner` (Opus, Playwright emitter) · `synthesizer` (Haiku)
69
76
 
70
77
  The main session is the orchestrator — it routes, it does not implement.
71
78
 
72
- ## The loop (v2.1: TDD-first + human gates + coverage guards)
73
-
74
- Phases that add a public callable surface run test-first:
75
- `RESEARCH -> SCAFFOLD -> RED -> TEST REVIEW -> GREEN -> E2E -> FIX -> CLOSE`. The
76
- implementer writes interface stubs only; the `test-author` writes the suite blind
77
- against those stubs (it must collect cleanly and FAIL — the RED gate) and emits a
78
- `docs/test-plan-phase-<n>.md` with a mandatory "NOT covered / assumptions"
79
- section. **TEST REVIEW** is a human gate: you approve the test plan before the
80
- implementer fills to green so "all tests passed but the core was broken" can't
81
- slip through silently. Pure infra/config/doc phases keep the direct
82
- `RESEARCH -> IMPLEMENT -> TEST` order (no TEST REVIEW — no public surface).
79
+ ## The loop (v2.3: adaptive to project type + spec-driven contract + upstream human gate)
80
+
81
+ **Project flags (declared at `/overview`).** The grill asks your `project_type`
82
+ (web app / desktop app / script / library / other) and what "shipped" means. From
83
+ that it derives `infra_needed`, `e2e_kind` (browser / cli / http / library-api),
84
+ `deploy_kind` (cloud-deploy / package-publish / install-run-verified / none), and
85
+ which `knowledge_docs` to consult all recorded in `docs/OVERVIEW.md`, never
86
+ inferred mid-phase. Phase 0 (infra) exists only when `infra_needed`; the boundary
87
+ run is selected by `e2e_kind`; the final phase completes `deploy_kind`.
88
+
89
+
90
+ Phases that add a public callable surface run spec-first:
91
+ `RESEARCH -> SPEC fill -> spec-staleness -> SPEC REVIEW -> SCAFFOLD -> RED -> spec-conformance -> GREEN -> boundary/E2E -> FIX -> CLOSE`.
92
+ The reviewable, authoritative artifact is the **spec**, not the test. At `/overview`
93
+ the planner enumerates the case *names* per phase (skeleton `docs/spec-phase-<n>.md`).
94
+ At phase start the new `spec-author` fills them with concrete cases — real inputs,
95
+ real expected outputs, matcher tokens for volatile fields — written to shared
96
+ `fixtures/` files. **SPEC REVIEW** is a human gate that sits *upstream* (before any
97
+ code): you confirm falsifiable claims in plain language ("empty order → 422
98
+ EMPTY_ORDER"). Tests are then GENERATED from the locked spec rows (deep-equality +
99
+ matcher tokens for `data`; Playwright from the descriptor for `ui`) loading the
100
+ *same* fixtures — so a test physically cannot assert different values than the spec.
101
+ `spec-conformance.sh` blocks GREEN until no `TBD` remains and every case-id is cited
102
+ by a boundary test. This is the v2.2 fix for "both agents independently fabricated
103
+ the same wrong contract from a one-line acceptance and the suite went green on a
104
+ broken core." Pure infra/config/doc phases keep the direct
105
+ `RESEARCH -> IMPLEMENT -> TEST` order (no spec, no SPEC REVIEW — no public surface).
83
106
 
84
107
  Frontend phases are detected by a **deterministic path match** (`has_frontend` +
85
108
  the frontend root, both set in `docs/OVERVIEW.md`): if a phase changes a file
@@ -107,37 +130,22 @@ Methodology lives in one place: the portable **`AGENTS.md`** at the repo root.
107
130
 
108
131
  |Tool |What you get |
109
132
  |--------------|------------------------------------------------------------------------------------------------------|
110
- |**Claude Code** (full, reference)|commands, all 3 lifecycle hooks **with context injection**, named subagents, shared KB, `@AGENTS.md` import|
111
- |**Cursor** (full)|generated commands (`.cursor/commands/`), lifecycle hooks (`.cursor/hooks.json`: sessionStart / preCompact / subagentStop), methodology via a `.cursor/rules/` pointer to `AGENTS.md`|
112
- |**Other tools**|read `AGENTS.md` if they support the open standard; no generated adapters; not claimed as supported in v2.0|
113
-
114
- One canonical command body in `commands.src/<name>.md` generates both tools' command sets at install.
115
-
116
- **Cursor — verified against cursor.com/docs (June 2026):**
117
- - **sessionStart context injection: works.** Cursor's `sessionStart` hook accepts an
118
- `additional_context` JSON output field injected into the conversation's initial
119
- context. Cursor expects JSON (Claude injects raw stdout), so the shipped wiring
120
- runs the shared body through `cursor-session-start.sh`, a thin JSON-envelope
121
- wrapper. The hook is fire-and-forget (non-blocking).
122
- - **Named subagents: work natively.** Cursor reads `.claude/agents/*.md` directly
123
- (documented Claude-compatibility path), with `/name` invocation and
124
- description-based delegation one set of role files serves both tools.
125
- Caveat: `model: haiku/opus` tiers are Claude-specific; Cursor falls back to
126
- `inherit`/a compatible model.
127
- - **Hook path resolution: project hooks run from the project root** (not
128
- `.cursor/`), so the shipped wiring uses `bash .claude/hooks/<script>.sh`. Cursor
129
- sets `CLAUDE_PROJECT_DIR` as a compatibility alias, so the shared scripts run
130
- unchanged.
131
- - **preCompact is observational** in Cursor (cannot modify compaction); the
132
- snapshot side-effect still runs, which is all the COMPRESS ritual needs.
133
-
134
- > Note: Cursor can also load `.claude/settings.json` hooks directly ("Third-party
135
- > skills" toggle). anpunkit does not rely on this — it requires a manual settings
136
- > toggle (silent no-op if forgotten) and would double-fire hooks alongside
137
- > `.cursor/hooks.json`. The explicit native wiring is the supported path.
138
-
139
- Codex is **not** a target in v2.0 (its repo-committed command path is deprecated
140
- home-dir custom-prompts with a divergent UX).
133
+ |**Claude Code** (the supported target)|commands, all 3 lifecycle hooks **with context injection**, named subagents, shared KB, `@AGENTS.md` import|
134
+ |**Other tools**|read `AGENTS.md` if they support the open standard; no generated adapters, no support claim|
135
+
136
+ The canonical command bodies live in `commands.src/<name>.md`, copied to
137
+ `.claude/commands/` at install. **Cursor support was dropped in v2.3** (§5.69) —
138
+ the maintenance cost exceeded demand. v2.3 is Claude Code only.
139
+
140
+ ## Compression
141
+
142
+ Output compression is a kit-native, always-on facility (`.claude/ref/compression.md`),
143
+ not a skill and never model-invoked. Two profiles: `user` (human-facing, keeps the
144
+ Auto-Clarity exception for security warnings, irreversible-action confirmations,
145
+ multi-step sequences, and clarification requests) and `internal` (agent↔agent,
146
+ harder). `AGENTS.md` declares `user`; every subagent prompt points at `internal`.
147
+ Exact-output artifacts (fixtures, spec rows, generated tests) are exempted by
148
+ structural gates in the emitter prompts.
141
149
 
142
150
  ## How each problem is solved
143
151
 
@@ -149,10 +157,10 @@ home-dir custom-prompts with a divergent UX).
149
157
  |Context rot during debugging |`researcher` + `debugger` write full output to `docs/research/`, return only a summary + path|
150
158
  |Want orchestration |8 scoped subagents; `/phase` is the orchestrator routing them |
151
159
  |Handoff / memory keeps growing |`synthesizer` + PreCompact hook compress and dedup |
152
- |Azure auth friction per session |`scripts/auth-setup.sh` — one token check, once per session |
153
- |Infra created ad-hoc mid-phase |`infra-provisioner` + Phase 0 — provisioned once, reviewed before apply |
154
- |Planning without domain knowledge |design-researcher runs before planning; double grill absorbs findings |
155
- |Deployment not in the plan |planner always puts deploy task in last phase |
160
+ |Cloud auth friction per session |liveness ritual recorded in INFRA.md `## AUTH` (Azure: `knowledge/azure.md`) — one check per session|
161
+ |Infra created ad-hoc mid-phase |`infra-provisioner` + Phase 0 when `infra_needed` — provisioned once, reviewed before apply |
162
+ |Planning without domain knowledge |design-researcher runs before planning; consults matching `knowledge/*.md`; double grill absorbs findings|
163
+ |Deployment not in the plan |planner always puts the `deploy_kind` completion task in the last phase |
156
164
  |No endpoint summary at project end |final-phase close shows usage endpoints from docs/ENDPOINTS.md |
157
165
  |Re-discovering same gotchas across projects|`/store-wisdom` promotes findings to shared KB; researcher checks KB before web |
158
166
 
@@ -160,14 +168,19 @@ home-dir custom-prompts with a divergent UX).
160
168
 
161
169
  - `docs/STATE.md` — current position, kept small (rewritten each phase)
162
170
  - `docs/ISSUES.md` — error log, deduped by synthesizer
163
- - `docs/PLAN.md` — vertical-slice phase plan (Phase 0 always first)
171
+ - `docs/PLAN.md` — vertical-slice phase plan (Phase 0 first when `infra_needed`)
164
172
  - `docs/HISTORY.md` — one line per finished phase
165
173
  - `docs/OVERVIEW.md` — project scope, written after double-grill
166
174
  - `docs/DATAFLOW.md` — state-transition table per key object (grilled at /overview; drives CLOSE coverage gate)
167
- - `docs/INFRA.md` — Azure resource manifest + cost estimates (written by infra-provisioner)
175
+ - `docs/spec-phase-<n>.md` — per-phase behavioral contract (skeleton at /overview, filled by spec-author; human-reviewed at SPEC REVIEW)
176
+ - `fixtures/<case-id>-{input,expected,ui}.json` — shared by the spec row and the generated test harness (committed; part of the contract)
177
+ - `tests/helpers/spec-assert.{py,ts}` — kit-versioned matcher-aware comparator (honors `<UUID>`, `<ISO8601>`, … tokens)
178
+ - `docs/INFRA.md` — infra resource manifest + cost estimates (when `infra_needed`; written by infra-provisioner)
168
179
  - `docs/ENDPOINTS.md` — API/service endpoint catalogue (maintained by implementer)
169
180
  - `docs/.snapshots/` — pre-compact recovery markers (auto-pruned, gitignored)
170
- - `infra/`Bicep templates (generated by infra-provisioner, committed to git)
181
+ - `knowledge/webapp.md`, `knowledge/azure.md` preinstalled matured practice + materializable templates
182
+ - `.claude/ref/compression.md` — kit-native compression profiles (`user`, `internal`)
183
+ - `infra/` — IaC templates (generated by infra-provisioner, committed to git)
171
184
 
172
185
  ## Shared Knowledge Base (optional)
173
186
 
@@ -205,8 +218,8 @@ See `docs/KB_GUIDE.md` in the anpunkit-kb repo (created by first `/store-wisdom`
205
218
 
206
219
  ```
207
220
  /overview once per project (design-research + double grill)
208
- /infra once per project (Phase 0) — after /overview
209
- scripts/auth-setup.sh once per session (Azure projects)
221
+ /infra once per project (Phase 0) — only when infra_needed
222
+ <INFRA.md AUTH command> once per session (infra projects; Azure: scripts/auth-setup.sh)
210
223
  /phase 1 -> /synthesize -> /clear
211
224
  /phase 2 -> /synthesize -> /clear
212
225
  ...
@@ -216,83 +229,50 @@ scripts/auth-setup.sh once per session (Azure projects)
216
229
  # learned something worth keeping? -> /store-wisdom
217
230
  ```
218
231
 
219
- ## Azure infrastructure (Phase 0)
232
+ ## Use-case knowledge (infra, E2E, deploy)
233
+
234
+ The invariant core ships nothing use-case specific. Matured web/Azure practice
235
+ lives in **preinstalled knowledge docs** that the `researcher` consults at RESEARCH
236
+ when your declared `project_type` matches (recorded in OVERVIEW `knowledge_docs`):
220
237
 
221
- The kit treats Azure infra as **Phase 0** — provisioned once before any code
222
- phase starts, owned by the `infra-provisioner` subagent.
238
+ - **`knowledge/webapp.md`** browser E2E practice (Playwright, closed assert
239
+ vocabulary, screenshot evidence) plus the E2E stack ritual and the
240
+ `playwright.config.ts` / `e2e/global-setup.ts` / `docker-compose.test.yml` /
241
+ `scripts/e2e-stack.sh` templates, materialized into your project on demand.
242
+ - **`knowledge/azure.md`** — the once-per-session auth ritual (`scripts/auth-setup.sh`
243
+ template), Entra/MSAL ROPC + MFA-excluded test account practice, and the Bicep /
244
+ `az` provisioning patterns (Key Vault, THB cost annotations, SEA region default).
223
245
 
224
- ### Phase 0 flow
246
+ ### Infra (Phase 0, when `infra_needed`)
247
+
248
+ Application project types (web app, desktop app, service) set `infra_needed: true`;
249
+ scripts and libraries set it false and skip Phase 0 entirely. When present, Phase 0
250
+ is provisioned once before any code phase, owned by `infra-provisioner`:
225
251
 
226
252
  ```
227
- /overview # includes Phase 0 in PLAN.md automatically
228
- /infra # generates Bicep -> what-if diff -> you review -> "go" -> apply
229
- # writes docs/INFRA.md (resource manifest + cost estimates)
253
+ /overview # declares infra_needed; includes Phase 0 in PLAN.md when true
254
+ /infra # generates IaC -> what-if diff -> you review -> "go" -> apply
255
+ # writes docs/INFRA.md (resource manifest + cost estimates + ## AUTH)
230
256
  # writes .env.test (generated, never fill manually)
231
257
  # runs AUTH PROOF (every credential proven reusable headlessly)
232
258
  /phase 1 # PRE-FLIGHT checks Phase 0 is done before starting
233
259
  ```
234
260
 
235
- ### Session startup (Azure projects)
236
-
237
- Run once per session before any Azure work:
238
-
239
- ```bash
240
- scripts/auth-setup.sh
241
- ```
242
-
243
- Checks your `az` token is fresh and the right subscription is active.
244
- Prompts `az login` only if stale. No credential storage — your account only.
245
-
246
- ### What /infra does
247
-
248
- 1. `infra-provisioner` reads `docs/OVERVIEW.md` for the system design
249
- 1. Generates `infra/main.bicep` + per-service modules under `infra/modules/`
250
- 1. Runs `az deployment what-if` — shows exactly what will be created
251
- 1. **Stops and waits for your "go"** — nothing applied without your review
252
- 1. Applies the deployment
253
- 1. Writes `docs/INFRA.md` — resource IDs, endpoints, cost estimates (THB, SEA region)
254
- 1. Generates `.env.test` from the manifest
255
- 1. Runs the **AUTH PROOF** — proves every credential (Entra/MSAL + datasources) is obtainable headlessly twice in a row
256
-
257
- Re-run `/infra` any time infra drifts or a new resource is needed.
258
- Re-run `/infra regenerate-env` to refresh `.env.test` only.
259
- Re-run `/infra auth-proof` to re-prove credentials on demand.
260
-
261
- ### Cost awareness
262
-
263
- `infra-provisioner` annotates every resource in `INFRA.md` with an estimated
264
- monthly cost. It uses production-appropriate SKUs by default — not artificially
265
- cheap dev tiers that need resizing before go-live.
266
-
267
- ### E2E target
268
-
269
- `infra-provisioner` determines the E2E target from the system design:
270
-
271
- - **azure-deployed**: `E2E_STACK_EXTERNAL=1` — Playwright hits your deployed Azure app.
272
- - **local-docker**: Containers run the app, pointed at real Azure services.
273
-
274
- ### Test data
275
-
276
- Seeding and cleanup are **deployment phase** concerns, not E2E concerns.
277
- `e2e-stack.sh` has no seed/cleanup commands.
278
-
279
- ## End-to-end testing
280
-
281
- Three layers: unit/integration (mock suite), real API (`test-author`), and
282
- functional browser E2E (`e2e-runner`, Playwright).
261
+ Cloud specifics (Azure `az`/Bicep commands, region/cost conventions, the session
262
+ auth ritual) live in `knowledge/azure.md`, consulted by `infra-provisioner`.
283
263
 
284
- **Phase gate:** a frontend-touching phase closes only when the real API suite
285
- AND the browser E2E suite pass with screenshot evidence. Mock-green alone never closes a phase.
264
+ ### Boundary testing (per `e2e_kind`)
286
265
 
287
- **MSAL / Entra ID auth.** Browser E2E never drives the Microsoft login UI.
288
- `e2e/global-setup.ts` uses ROPC flow with a dedicated test account (MFA excluded
289
- via Conditional Access) to fetch a real token and inject it into the MSAL cache.
266
+ The boundary run is selected by the phase's bound `e2e_kind`:
290
267
 
291
- **E2E setup (one-time per project):**
268
+ - **browser** (frontend phases): `e2e-runner` emits Playwright from each `ui` case's
269
+ descriptor and captures a screenshot at every UI-existence assertion — on success
270
+ too — to a gitignored `docs/evidence/` dir. Stack ritual + templates:
271
+ `knowledge/webapp.md`.
272
+ - **cli / http / library-api**: the phase's real-mode boundary suite runs against
273
+ the shipped outer surface, transcript captured as evidence.
292
274
 
293
- 1. Run `/infra` it generates `.env.test` automatically and runs the AUTH PROOF.
294
- 1. Provision the Entra test user + Conditional Access MFA exclusion.
295
- 1. `npm i -D @playwright/test && npx playwright install chromium`
275
+ Mock-green alone never closes a phase.
296
276
 
297
277
  ## Windows / Git Bash
298
278
 
@@ -3,16 +3,20 @@ description: Provision or verify Azure infrastructure. Generates Bicep, shows wh
3
3
  argument-hint: [provision | verify | update <what changed> | regenerate-env | auth-proof]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode. You are the ORCHESTRATOR.
6
+ compression: user (.claude/ref/compression.md). You are the ORCHESTRATOR.
7
7
 
8
8
  Action: $ARGUMENTS (default: "provision" if INFRA.md missing, "verify" if present)
9
9
 
10
+ Only meaningful when docs/OVERVIEW.md has `infra_needed: true`. If
11
+ `infra_needed: false`, tell me this project has no infra phase and STOP.
12
+
10
13
  ---
11
14
 
12
15
  ## PRE-FLIGHT
13
16
 
14
- 1. Check `az account show` if it fails, STOP.
15
- Tell me: "Run `scripts/auth-setup.sh` first."
17
+ 1. Confirm cloud CLI auth per the project's knowledge doc (Azure:
18
+ `knowledge/azure.md` ritual `bash scripts/auth-setup.sh`; materialize it if
19
+ absent). If it fails, STOP and tell me the exact command to run.
16
20
 
17
21
  2. Determine mode from $ARGUMENTS or default logic.
18
22
 
@@ -3,7 +3,7 @@ description: Record an architectural decision in docs/DESIGN_LOG.md. Use only wh
3
3
  argument-hint: [what changed]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode.
6
+ compression: user (.claude/ref/compression.md).
7
7
 
8
8
  Append an architectural decision to docs/DESIGN_LOG.md. Change: $ARGUMENTS
9
9
 
@@ -3,7 +3,7 @@ description: Log an error to docs/ISSUES.md with root cause + solution, in the c
3
3
  argument-hint: [short error description]
4
4
  ---
5
5
 
6
- Caveman ULTRA mode.
6
+ compression: user (.claude/ref/compression.md).
7
7
 
8
8
  Append an entry to docs/ISSUES.md. Error: $ARGUMENTS
9
9
 
@@ -2,7 +2,7 @@
2
2
  description: Bootstrap a new project. Runs design-research, research review, double grill (incl. data/state flow), datasource-understanding baseline, and planning. Run once per project.
3
3
  ---
4
4
 
5
- Caveman ULTRA mode.
5
+ compression: user (.claude/ref/compression.md).
6
6
 
7
7
  Recommended: run from plan mode (Shift+Tab). Planning agents are read-only by
8
8
  tool grant; plan mode adds a read-only gate on the main session too. Optional.
@@ -16,11 +16,17 @@ Goal: stand up a fresh project workspace with a well-grounded plan.
16
16
  ### Round 1 — Initial grill
17
17
 
18
18
  1. Run the `grill-me` skill to interrogate me. Goal: understand initial scope.
19
- Cover: project purpose, success criteria, external services, Azure services
20
- needed (type + sizing), region, deployment target (Azure or local for E2E),
21
- known constraints, unknowns. ALSO establish:
19
+ Cover: project purpose, success criteria, external services, cloud/infra
20
+ services needed (type + sizing, if any), region, known constraints, unknowns.
21
+ ALSO establish:
22
+ - **project_type**: web app / desktop app / script / library / other. This
23
+ drives the deterministic flag derivation (step 6) and knowledge-doc
24
+ selection.
22
25
  - **has_frontend**: is there a browser-facing UI? If yes, what is the frontend
23
26
  root path (e.g. `src/web/`, `app/`)? This drives the mandatory-E2E path match.
27
+ - **deploy meaning**: what does "done and shipped" mean for this project —
28
+ cloud deploy (where?), package publish (which registry?), verified
29
+ install/run instructions, or none (why)? This sets `deploy_kind`.
24
30
  Do not stop early. Do not write OVERVIEW.md yet.
25
31
 
26
32
  Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
@@ -86,11 +92,23 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
86
92
  - Project purpose and success criteria
87
93
  - Scope and constraints (informed by research findings)
88
94
  - External services with confirmed capabilities/limits
89
- - "Azure services" section: every service with expected SKU
90
- - Deployment target (azure-deployed or local-docker for E2E)
95
+ - Cloud/infra services section: every service with expected SKU (if any)
91
96
  - `has_frontend: true|false` and, if true, the frontend root path
92
97
  - Known risks / open questions (if any remain)
93
98
 
99
+ PROJECT FLAGS (hard rule 10 — declared once here, recorded verbatim, never
100
+ re-derived later):
101
+ - `project_type: web app|desktop app|script|library|other` (declared in round 1)
102
+ - `infra_needed: true|false` — derived: application types (web app, desktop
103
+ app, service) → true; script / library → false. Overridable here with a
104
+ stated reason.
105
+ - `e2e_kind: browser|cli|http|library-api` — derived: has_frontend → browser;
106
+ backend/API service → http; script → cli; library → library-api.
107
+ - `deploy_kind: cloud-deploy|package-publish|install-run-verified|none(<reason>)`
108
+ (from the round-1 "deploy meaning" answer).
109
+ - `knowledge_docs:` — derived list: web app or has_frontend → `knowledge/webapp.md`;
110
+ Azure services declared OR Azure cloud-deploy → `knowledge/azure.md`; else empty.
111
+
94
112
  OVERVIEW.md is written HERE — after the re-grill, not before.
95
113
 
96
114
  7. Write docs/DATAFLOW.md — a state-transition table per key object, driven by the
@@ -112,13 +130,27 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
112
130
 
113
131
  8. Hand OVERVIEW.md + DATAFLOW.md + design-research findings to the `planner`
114
132
  subagent. PLAN.md MUST:
115
- - Start with Phase 0 (infra setup) as the first entry (always).
116
- - End with a final code phase that contains the deploy task block.
133
+ - Start with Phase 0 (infra setup) as the first entry IFF `infra_needed: true`;
134
+ when `infra_needed: false` there is no Phase 0 Phase 1 is the first entry.
135
+ - End with a final code phase whose deploy task completes `deploy_kind`
136
+ (cloud deploy / package publish / verified install-run / none-with-reason).
117
137
  - For any phase whose `changes` touch the frontend root: include ≥1
118
138
  UI-existence acceptance criterion naming the specific user-visible
119
139
  interactive element the phase introduces (not "page renders 200").
120
140
  - Map each phase to the DATAFLOW transitions it is expected to make reachable.
121
141
 
142
+ The planner ALSO writes the up-front SKELETON spec files (v2.2, §5.44/§5.51):
143
+ one `docs/spec-phase-<n>.md` per public-surface phase (skip Phase 0 + pure
144
+ infra/config/doc phases), enumerating the case NAMES — happy path, each named
145
+ edge, each named failure + error code — for every `dataflow:` transition and
146
+ every `acceptance` criterion, with `TBD` values. The generated header transcludes
147
+ that phase's `acceptance:` line + in-scope `DATAFLOW.md` transition rows verbatim.
148
+
149
+ 8b. STAMP each skeleton's staleness hash: for every `docs/spec-phase-<n>.md` the
150
+ planner wrote, run `bash scripts/spec-staleness.sh stamp <n>`. This embeds the
151
+ hash of the transcluded acceptance line + transition rows so phase-time
152
+ `/phase` can detect upstream drift. (Values are filled per phase by `spec-author`.)
153
+
122
154
  9. Create docs/STATE.md:
123
155
  ```
124
156
 
@@ -126,15 +158,18 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
126
158
 
127
159
  phase: 0 (pending)
128
160
  completed: project bootstrapped — design research, research review, double grill (incl. data/state flow) done
129
- next: run /infra to provision Azure infrastructure
161
+ next: <if infra_needed: "run /infra to provision infrastructure (Phase 0)"; else "run /phase 1">
130
162
  blocker: none
131
163
 
132
164
  ```
165
+ When `infra_needed: false`, set `phase: 1 (pending)` and the next line to
166
+ "run /phase 1".
133
167
  10. Create docs/ISSUES.md with header `# Issues` and `## Archived` section.
134
168
 
135
169
  11. Create empty docs/HISTORY.md.
136
170
 
137
- 12. Create docs/INFRA.md from the template (populated by /infra).
171
+ 12. Create docs/INFRA.md from the template (populated by /infra). Skip when
172
+ `infra_needed: false`.
138
173
 
139
174
  13. Create docs/ENDPOINTS.md:
140
175
  ```
@@ -144,6 +179,13 @@ blocker: none
144
179
  ```
145
180
 
146
181
  Then stop and show me PLAN.md + DATAFLOW.md for approval before any phase starts.
147
-
148
- Remind me: "Run `/infra` next to provision the Azure environment (Phase 0) and
149
- run the one-time AUTH PROOF before starting Phase 1."
182
+ EXTEND the approval surface (v2.2, §5.51 — one confirmation, no new gate): for each
183
+ public-surface phase, list the transition/acceptance ids it covers and the enumerated
184
+ case NAMES (no values). I confirm the case-name set is COMPLETE here these names
185
+ are the up-front behavioral contract; values get filled + reviewed per phase at
186
+ `/phase` SPEC REVIEW.
187
+
188
+ Remind me of the next step per `infra_needed`:
189
+ - `infra_needed: true` → "Run `/infra` next to provision the environment (Phase 0)
190
+ and run the one-time AUTH PROOF before starting Phase 1."
191
+ - `infra_needed: false` → "No infra phase — run `/phase 1` to start."