create-anpunkit 2.0.1 → 2.1.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.
@@ -1,7 +1,7 @@
1
1
  # anpunkit — portable agent methodology (single source of truth)
2
2
 
3
- <!-- ANPUNKIT-AGENTS-SENTINEL-v2.0 -->
4
- > **SENTINEL.** The HTML comment above (`ANPUNKIT-AGENTS-SENTINEL-v2.0`) is a
3
+ <!-- ANPUNKIT-AGENTS-SENTINEL-v2.1 -->
4
+ > **SENTINEL.** The HTML comment above (`ANPUNKIT-AGENTS-SENTINEL-v2.1`) is a
5
5
  > load-bearing marker. `setup.sh` greps for it to confirm this file resolved on
6
6
  > disk and was not clobbered. Do not remove or rename it.
7
7
 
@@ -31,7 +31,7 @@ A phase runs in one of two orders, chosen at RESEARCH time by the TDD
31
31
  APPLICABILITY check (see Procedures → `phase`):
32
32
 
33
33
  - **TDD phase** (`TDD_PHASE=true`):
34
- `RESEARCH -> SCAFFOLD -> RED -> GREEN -> TEST(e2e) -> FIX -> CLOSE`
34
+ `RESEARCH -> SCAFFOLD -> RED -> TEST REVIEW -> GREEN -> E2E -> FIX -> CLOSE`
35
35
  - **Non-TDD phase** (pure infra / config / doc — `TDD_PHASE=false`):
36
36
  `RESEARCH -> IMPLEMENT -> TEST -> FIX -> CLOSE`
37
37
 
@@ -41,6 +41,22 @@ from the acceptance spec." Size is NOT the criterion. On ambiguity, default
41
41
  `TDD_PHASE=true` AND state the classification + reason so a human can override to
42
42
  non-TDD before SCAFFOLD fires.
43
43
 
44
+ **TEST REVIEW (v2.1)** is a mandatory human gate on every TDD phase, sitting
45
+ between RED and GREEN. After `test-author` writes the suite it emits a
46
+ `docs/test-plan-phase-<n>.md` (acceptance criteria → test names, plus a mandatory
47
+ "NOT covered / assumptions" section). The orchestrator surfaces it; FILL cannot
48
+ fire until the human approves. A rejected coverage map is classified at the gate:
49
+ a misread of an adequate spec → re-dispatch `test-author` with feedback; an
50
+ underspecified acceptance spec → sharpen `PLAN.md` and re-dispatch fresh. The gate
51
+ is unskippable on TDD phases and absent on the non-TDD path (no public surface to
52
+ mis-test). This is the fix for "all tests green, core still broken." (§5.33)
53
+
54
+ **E2E is mandatory, not a judgment call (v2.1).** If the project is frontend-bearing
55
+ (`has_frontend: true` in `docs/OVERVIEW.md`) AND the phase's `changes` touch the
56
+ frontend root recorded in OVERVIEW.md, `e2e-runner` MUST run before CLOSE. The
57
+ trigger is a deterministic path match, not "does this phase feel frontend-y." A
58
+ frontend file changed with no E2E run is a loud CLOSE failure. (§5.34)
59
+
44
60
  -----
45
61
 
46
62
  ## Roles (fresh-context workers)
@@ -53,21 +69,36 @@ terse summary + path. Workers cannot address the user — only the orchestrator
53
69
  can. Escalation is at most two hops.
54
70
 
55
71
  - **researcher** — two modes. DESIGN: domain/constraint research before planning
56
- (service limits, API contracts, architectural constraints, cost surprises).
57
- IMPL: per-phase codebase + service investigation. Checks the shared KB snapshot
58
- first (step 0). Writes findings to `docs/research/`; returns terse summary + path.
72
+ (service limits, API contracts, architectural constraints, cost surprises);
73
+ for any external datasource, drafts a falsifiable DATA UNDERSTANDING (grain,
74
+ fields-under-test with meaning + real nullability/range, sample-fixture shape,
75
+ the assumption that if wrong makes a test meaningless) to `docs/research/
76
+ datasource-<name>.md`. IMPL: per-phase codebase + service investigation. Checks
77
+ the shared KB snapshot first (step 0). Writes findings to `docs/research/`;
78
+ returns terse summary + path.
59
79
  - **planner** — research → vertical-slice `docs/PLAN.md`. Phase 0 (infra) always
60
- first; the last phase always contains the deploy task.
80
+ first; the last phase always contains the deploy task. For any phase whose
81
+ `changes` touch the frontend root, the `acceptance` MUST include ≥1 UI-existence
82
+ criterion naming the specific user-visible interactive element introduced (not
83
+ "page renders 200"). Populates each phase's expected `DATAFLOW.md` transitions.
61
84
  - **infra-provisioner** — generates Bicep, runs `az deployment what-if`, applies
62
- only on human approval, writes `docs/INFRA.md` + `.env.test`.
85
+ only on human approval, writes `docs/INFRA.md` + `.env.test`. Runs the one-time
86
+ AUTH PROOF (§5.37): proves every credential the project's real tests will use is
87
+ obtainable headlessly twice in a row (prime + reuse) with zero prompts.
63
88
  - **implementer** — builds ONE phase. Two MODES for TDD phases (SCAFFOLD: stubs
64
89
  only; FILL: logic to green) plus a legacy full-build mode for non-TDD phases.
65
90
  Writes code, never tests. Maintains `docs/ENDPOINTS.md` each phase.
66
91
  - **test-author** — writes tests BLIND (never reads implementation logic). On TDD
67
92
  phases it is dispatched BEFORE logic exists (RED-first), so blindness is
68
- structural, not honor-system. Writes a MOCK suite + a REAL API suite.
93
+ structural, not honor-system. Writes a MOCK suite + a REAL API suite, and emits
94
+ `docs/test-plan-phase-<n>.md` (the TEST REVIEW artifact) with a mandatory "NOT
95
+ covered / assumptions" section. For phases touching an external datasource,
96
+ surfaces any DATA UNDERSTANDING delta (new table/column beyond the confirmed
97
+ baseline) for confirmation before the real suite runs.
69
98
  - **e2e-runner** — writes/runs functional browser E2E (Playwright) BLIND. Reads
70
- `docs/INFRA.md` for the target.
99
+ `docs/INFRA.md` for the target. Captures a screenshot at EACH UI-existence
100
+ assertion regardless of pass/fail (capture-on-success, not just on-failure) to
101
+ `docs/evidence/e2e-phase-<n>/`, plus a summary in `docs/research/e2e-<slug>.md`.
71
102
  - **debugger** — debugs in an ISOLATED context. Writes a trace to
72
103
  `docs/research/debug-<slug>.md`; returns a summary.
73
104
  - **synthesizer** — compresses `docs/STATE.md` / `docs/ISSUES.md`, prunes
@@ -83,12 +114,16 @@ Named procedures, each with a canonical body in `commands.src/<name>.md` and a
83
114
  generated copy per tool (`.claude/commands/`, `.cursor/commands/`).
84
115
 
85
116
  - **overview** — bootstrap a project: design-research → grill r1 → design-research
86
- → re-grill r2 `OVERVIEW.md` planner `PLAN.md` (Phase 0 always first).
117
+ RESEARCH REVIEW → re-grill r2 (covers data structures, dataflow, and object
118
+ state flow) → `OVERVIEW.md` (+ `has_frontend`/frontend-root, `DATAFLOW.md`,
119
+ confirmed datasource understanding) → planner → `PLAN.md` (Phase 0 always first).
87
120
  - **infra** — provision/verify Azure infra: Bicep → what-if → human review → apply
88
- → `INFRA.md` + `.env.test`.
121
+ → `INFRA.md` + `.env.test`. Runs the one-time AUTH PROOF.
89
122
  - **phase [n]** — run one phase end-to-end with the circuit breaker. Chooses the
90
- TDD or non-TDD order at RESEARCH. CLOSE runs the regression guard + ENDPOINTS
91
- coverage gate.
123
+ TDD or non-TDD order at RESEARCH. PRE-FLIGHT runs the auth liveness check. TDD
124
+ phases stop at TEST REVIEW before GREEN. Frontend phases run mandatory E2E with
125
+ screenshot evidence. CLOSE runs the regression guard + ENDPOINTS coverage gate +
126
+ DATAFLOW transition-coverage gate + evidence-present check.
92
127
  - **quick [change]** — small, obvious, non-phase change; no agent chain. Stays
93
128
  non-TDD. Runs the mock regression corpus after the change.
94
129
  - **unstuck** — deep re-research after a circuit breaker (human-triggered).
@@ -126,7 +161,7 @@ recover: current phase, next action, open blocker.
126
161
 
127
162
  -----
128
163
 
129
- ## Hard rules (1–11)
164
+ ## Hard rules (1–16)
130
165
 
131
166
  1. Before debugging ANY error: grep `docs/ISSUES.md` AND `docs/research/INDEX.md`.
132
167
  The SESSION-OPEN ritual surfaces ISSUES.md — there is no excuse to miss it.
@@ -136,9 +171,11 @@ recover: current phase, next action, open blocker.
136
171
  attempts.
137
172
  4. End of phase -> synthesize -> context reset -> next phase.
138
173
  5. **PHASE GATE** = the current-phase REAL API suite passes AND (frontend phase)
139
- the E2E suite passes AND the accumulated mock regression corpus stays green AND
140
- every `docs/ENDPOINTS.md` entry has at least one test in `tests/regression/`.
141
- The final phase additionally runs the full REAL regression corpus. A green
174
+ the E2E suite passes with screenshot evidence captured AND the accumulated mock
175
+ regression corpus stays green AND every `docs/ENDPOINTS.md` entry has at least
176
+ one test in `tests/regression/` AND every REACHABLE `docs/DATAFLOW.md` transition
177
+ has at least one test in `tests/regression/`. The final phase additionally runs
178
+ the full REAL regression corpus and requires zero PENDING transitions. A green
142
179
  mock suite alone can never close a phase.
143
180
  6. Tests are written by `test-author`, which never sees the implementation logic
144
181
  (unbiased). On TDD phases the suite is written before the logic (RED-first).
@@ -148,13 +185,42 @@ recover: current phase, next action, open blocker.
148
185
  8. E2E auth = ROPC with a dedicated MFA-excluded test account. NEVER script the
149
186
  Microsoft login UI.
150
187
  9. Architectural change (new/removed agent, hook, command, or a changed workflow
151
- rule)? -> run `log-decision` before closing.
188
+ rule)? -> run `log-decision` before closing. A phase that changes an object's
189
+ state lifecycle MUST update `docs/DATAFLOW.md` in the same CLOSE.
152
190
  10. Azure project? Run `scripts/auth-setup.sh` ONCE per session before any Azure
153
191
  work. Never debug an auth error without checking this first.
154
- 11. **No-rationalization (scoped).** Do not downgrade a TDD phase to non-TDD to
155
- dodge the RED gate, and do not route phase-worthy work through `quick` to
156
- dodge it. (Scoped deliberately to these two seams; this is not a broad
157
- "never make excuses" rule.)
192
+ 11. **No-rationalization (scoped).** Do not, in order to dodge a gate:
193
+ downgrade a TDD phase to non-TDD or route phase-worthy work through `quick`
194
+ (RED gate); set `has_frontend: false` or keep a touched element out of the
195
+ acceptance spec (E2E / UI-existence gate); mark a reachable transition PENDING
196
+ (DATAFLOW gate); or skip evidence capture. (Scoped deliberately to these named
197
+ seams; this is not a broad "never make excuses" rule.)
198
+ 12. **TEST REVIEW (TDD phases).** GREEN cannot begin until the human approves
199
+ `docs/test-plan-phase-<n>.md`. Rejection is classified at the gate (misread
200
+ spec → re-dispatch test-author with feedback; underspec → sharpen PLAN.md and
201
+ re-dispatch fresh). Unskippable on TDD phases; absent on the non-TDD path.
202
+ 13. **Mandatory frontend E2E + evidence.** When `has_frontend: true` and the
203
+ phase's `changes` touch the frontend root recorded in OVERVIEW.md, E2E MUST
204
+ run. Each UI-existence assertion captures a screenshot (on success too) to
205
+ `docs/evidence/e2e-phase-<n>/`. Frontend files changed with no E2E run, or a
206
+ closed frontend phase with no evidence on disk, fails CLOSE hard. (Evidence is
207
+ gitignored — present-on-disk at CLOSE is the check, not committed history.)
208
+ 14. **DATAFLOW transition coverage.** Every transition in `docs/DATAFLOW.md` whose
209
+ trigger is reachable in the code shipped so far MUST have ≥1 test in
210
+ `tests/regression/`; zero coverage on a reachable transition fails CLOSE hard.
211
+ Unreachable transitions list as PENDING. Any transition still PENDING at the
212
+ final phase fails hard. Peer to the ENDPOINTS coverage gate.
213
+ 15. **Datasource data understanding.** Real-suite / E2E tests against an external
214
+ datasource are HARD-BLOCKED until that datasource's DATA UNDERSTANDING is
215
+ confirmed (baseline at `/overview`; per-phase delta-confirm for any
216
+ new table/column). The mock suite still runs. No testing against data you
217
+ never confirmed understanding of.
218
+ 16. **Auth proof + liveness.** A one-time AUTH PROOF at `/infra` proves every
219
+ credential the real tests use — Entra/MSAL app login AND external datasource
220
+ credentials — is obtainable headlessly twice in a row (prime + reuse) with
221
+ zero prompts; "reusable without interaction" means exactly this. Each `/phase`
222
+ PRE-FLIGHT runs a cheap liveness check (token obtainable, not expired) before
223
+ dispatching real/E2E. Both fail loud; the mock suite proceeds regardless.
158
224
 
159
225
  -----
160
226
 
@@ -176,13 +242,23 @@ the KB. The kit works normally without a KB.
176
242
  - `docs/HISTORY.md` — one line per finished phase.
177
243
  - `docs/DESIGN_LOG.md` — kit architectural rationale (§5.x decision log).
178
244
  - `docs/OVERVIEW.md` — project scope. Written after the double-grill in `overview`.
245
+ Carries `has_frontend` + the frontend root path, and the data/state-flow summary.
246
+ - `docs/DATAFLOW.md` — state-transition table per key object (`object | states |
247
+ transition (from→to) | trigger | who writes | external system`). Living doc,
248
+ grill-driven; drives the CLOSE transition-coverage gate. The data-side analogue
249
+ of `ENDPOINTS.md`. (v2.1)
250
+ - `docs/test-plan-phase-<n>.md` — the TEST REVIEW artifact: acceptance → test names
251
+ + mandatory "NOT covered / assumptions" section. Human-approved before GREEN. (v2.1)
252
+ - `docs/evidence/e2e-phase-<n>/` — screenshot evidence captured at each UI-existence
253
+ assertion (gitignored; present-on-disk at CLOSE is the gate). (v2.1)
179
254
  - `docs/INFRA.md` — Azure infra manifest: resource IDs, endpoints, cost estimates,
180
- E2E target.
255
+ E2E target, AUTH PROOF result.
181
256
  - `docs/ENDPOINTS.md` — API/service endpoint catalogue. Maintained by implementer
182
257
  each phase. Drives the CLOSE coverage gate.
183
258
  - `docs/research/` — full research + debug files. `INDEX.md` is the searchable map.
184
259
  `design-<slug>.md` (design research), `<slug>.md` (impl research),
185
- `debug-<slug>.md` (debugger traces).
260
+ `debug-<slug>.md` (debugger traces), `datasource-<name>.md` (confirmed data
261
+ understanding, referenced from DATAFLOW.md external rows).
186
262
  - `docs/.snapshots/` — pre-compact recovery markers (auto-pruned, gitignored).
187
263
  - `infra/` — Bicep templates. Committed (IaC audit trail). `infra/params.json`
188
264
  holds no secrets.
@@ -25,8 +25,12 @@ npx create-anpunkit # non-destructive: never clobbers your files
25
25
  # then open Claude Code or Cursor — the session-start hook fires automatically
26
26
  /overview # bootstrap the project (includes Phase 0 infra)
27
27
  ```
28
- Useful flags: `--dry-run` (print the plan, write nothing), `--force` (overwrite
29
- user-modified kit files), `--kb-path <dir>` / `--kb-remote <url>` / `--no-kb`.
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`.
30
34
 
31
35
  Upgrading an existing anpunkit project? Re-run `npx create-anpunkit`. It refreshes
32
36
  kit-owned files, preserves anything you modified as `<file>.anpunkit-new`, merges
@@ -46,13 +50,13 @@ cd my-project && bash setup.sh
46
50
 
47
51
  |Command |Does |
48
52
  |-----------------|------------------------------------------------------------------------------|
49
- |`/overview` |design-research → grill (×2) → OVERVIEW → PLAN (Phase 0 always first) → STATE |
50
- |`/infra` |provision Azure infra: Bicep → what-if → review → apply → INFRA.md + .env.test|
51
- |`/phase [n]` |run one phase: research → implementblind test, with circuit breaker |
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 → SCAFFOLDRED → TEST REVIEW → GREEN → E2E, with circuit breaker|
52
56
  |`/quick [change]`|small obvious change, direct, no agent chain |
53
57
  |`/unstuck` |deep re-research after a circuit breaker (you trigger it) |
54
58
  |`/synthesize` |compress STATE.md, dedup ISSUES.md, prune snapshots |
55
- |`/replan` |revise PLAN.md when it drifts |
59
+ |`/replan` |revise PLAN.md when it drifts (reconciles regression corpus + DATAFLOW) |
56
60
  |`/log-issue` |append an error with root cause + failed attempts |
57
61
  |`/log-decision` |record an architectural change in DESIGN_LOG.md |
58
62
  |`/store-wisdom` |promote resolved issues + research findings to shared KB |
@@ -65,19 +69,36 @@ cd my-project && bash setup.sh
65
69
 
66
70
  The main session is the orchestrator — it routes, it does not implement.
67
71
 
68
- ## The loop (v2.0: TDD-first + regression guard)
72
+ ## The loop (v2.1: TDD-first + human gates + coverage guards)
69
73
 
70
74
  Phases that add a public callable surface run test-first:
71
- `RESEARCH -> SCAFFOLD -> RED -> GREEN -> TEST -> FIX -> CLOSE`. The implementer
72
- writes interface stubs only; the `test-author` writes the suite blind against
73
- those stubs (it must collect cleanly and FAIL — the RED gate); the implementer
74
- then fills to green. Pure infra/config/doc phases keep the direct
75
- `RESEARCH -> IMPLEMENT -> TEST` order.
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).
83
+
84
+ Frontend phases are detected by a **deterministic path match** (`has_frontend` +
85
+ the frontend root, both set in `docs/OVERVIEW.md`): if a phase changes a file
86
+ under the frontend root, **E2E is mandatory**, the acceptance spec must name the
87
+ specific user-visible element it introduces (not "page renders 200"), and the
88
+ `e2e-runner` captures a screenshot at each such assertion — on success too — to a
89
+ gitignored `docs/evidence/` dir. That's the fix for shipping a missing sign-in button.
76
90
 
77
91
  Every phase CLOSE runs the accumulated **mock regression corpus**
78
- (`tests/regression/`, via `scripts/regression.sh`) and a hard ENDPOINTS coverage
79
- gate so a contract built in an early phase cannot be silently broken later. The
80
- final phase additionally runs the full real corpus.
92
+ (`tests/regression/`, via `scripts/regression.sh`) plus a hard ENDPOINTS coverage
93
+ gate AND a **DATAFLOW transition-coverage gate** every reachable state
94
+ transition in `docs/DATAFLOW.md` (the data-side analogue of `ENDPOINTS.md`,
95
+ grilled out at `/overview`) must have a regression test. The final phase
96
+ additionally runs the full real corpus and allows zero PENDING transitions.
97
+
98
+ External datasources get a confirmed, falsifiable **DATA UNDERSTANDING** (grain,
99
+ fields, sample shape, meaning-breaking assumption) before real tests run, and auth
100
+ is proven reusable once at `/infra` (obtainable headlessly twice in a row) with a
101
+ cheap liveness check each phase.
81
102
 
82
103
  Methodology lives in one place: the portable **`AGENTS.md`** at the repo root.
83
104
  `CLAUDE.md` is a thin `@AGENTS.md` shim with Claude-native wiring only.
@@ -142,6 +163,7 @@ home-dir custom-prompts with a divergent UX).
142
163
  - `docs/PLAN.md` — vertical-slice phase plan (Phase 0 always first)
143
164
  - `docs/HISTORY.md` — one line per finished phase
144
165
  - `docs/OVERVIEW.md` — project scope, written after double-grill
166
+ - `docs/DATAFLOW.md` — state-transition table per key object (grilled at /overview; drives CLOSE coverage gate)
145
167
  - `docs/INFRA.md` — Azure resource manifest + cost estimates (written by infra-provisioner)
146
168
  - `docs/ENDPOINTS.md` — API/service endpoint catalogue (maintained by implementer)
147
169
  - `docs/.snapshots/` — pre-compact recovery markers (auto-pruned, gitignored)
@@ -157,14 +179,20 @@ re-discovering the same Azure/Databricks gotchas project after project.
157
179
  **Setup (one-time per machine):**
158
180
 
159
181
  ```bash
160
- # 1. Create a GitHub repo: anpunkit-kb (empty)
161
- # 2. Clone it somewhere permanent on your machine
162
- git clone git@github.com:your-username/anpunkit-kb.git ~/anpunkit-kb
182
+ # 1. Create a GitHub repo: anpunkit-kb (empty is fine)
183
+ # 2. Clone it yourself, somewhere permanent you own the git auth
184
+ git clone git@github.com:<you>/anpunkit-kb.git ~/anpunkit-kb
163
185
 
164
- # 3. During setup.sh, provide the path when prompted
165
- bash setup.sh
186
+ # 3. Point anpunkit at it
187
+ npx create-anpunkit --kb-path ~/anpunkit-kb
188
+ # (or paste the path at the interactive prompt)
166
189
  ```
167
190
 
191
+ That's the last manual git you'll run against the KB. From then on the
192
+ **session-start hook pulls** each session and **`/store-wisdom` commits and
193
+ pushes** (always with your approval). The remote URL is recorded automatically
194
+ from the clone's `origin`; `--kb-remote <url>` overrides it if needed.
195
+
168
196
  **Usage:**
169
197
 
170
198
  ```
@@ -200,6 +228,7 @@ phase starts, owned by the `infra-provisioner` subagent.
200
228
  /infra # generates Bicep -> what-if diff -> you review -> "go" -> apply
201
229
  # writes docs/INFRA.md (resource manifest + cost estimates)
202
230
  # writes .env.test (generated, never fill manually)
231
+ # runs AUTH PROOF (every credential proven reusable headlessly)
203
232
  /phase 1 # PRE-FLIGHT checks Phase 0 is done before starting
204
233
  ```
205
234
 
@@ -219,13 +248,15 @@ Prompts `az login` only if stale. No credential storage — your account only.
219
248
  1. `infra-provisioner` reads `docs/OVERVIEW.md` for the system design
220
249
  1. Generates `infra/main.bicep` + per-service modules under `infra/modules/`
221
250
  1. Runs `az deployment what-if` — shows exactly what will be created
222
- 1. **Stops and waits for your go”** — nothing applied without your review
251
+ 1. **Stops and waits for your "go"** — nothing applied without your review
223
252
  1. Applies the deployment
224
253
  1. Writes `docs/INFRA.md` — resource IDs, endpoints, cost estimates (THB, SEA region)
225
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
226
256
 
227
257
  Re-run `/infra` any time infra drifts or a new resource is needed.
228
258
  Re-run `/infra regenerate-env` to refresh `.env.test` only.
259
+ Re-run `/infra auth-proof` to re-prove credentials on demand.
229
260
 
230
261
  ### Cost awareness
231
262
 
@@ -251,7 +282,7 @@ Three layers: unit/integration (mock suite), real API (`test-author`), and
251
282
  functional browser E2E (`e2e-runner`, Playwright).
252
283
 
253
284
  **Phase gate:** a frontend-touching phase closes only when the real API suite
254
- AND the browser E2E suite pass. Mock-green alone never closes a phase.
285
+ AND the browser E2E suite pass with screenshot evidence. Mock-green alone never closes a phase.
255
286
 
256
287
  **MSAL / Entra ID auth.** Browser E2E never drives the Microsoft login UI.
257
288
  `e2e/global-setup.ts` uses ROPC flow with a dedicated test account (MFA excluded
@@ -259,7 +290,7 @@ via Conditional Access) to fetch a real token and inject it into the MSAL cache.
259
290
 
260
291
  **E2E setup (one-time per project):**
261
292
 
262
- 1. Run `/infra` — it generates `.env.test` automatically.
293
+ 1. Run `/infra` — it generates `.env.test` automatically and runs the AUTH PROOF.
263
294
  1. Provision the Entra test user + Conditional Access MFA exclusion.
264
295
  1. `npm i -D @playwright/test && npx playwright install chromium`
265
296
 
Binary file
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Provision or verify Azure infrastructure. Generates Bicep, shows what-if diff for your review, applies only after your approval, writes docs/INFRA.md and .env.test.
3
- argument-hint: [provision | verify | update <what changed> | regenerate-env]
2
+ description: Provision or verify Azure infrastructure. Generates Bicep, shows what-if diff for your review, applies only after your approval, writes docs/INFRA.md and .env.test. Runs the one-time AUTH PROOF.
3
+ argument-hint: [provision | verify | update <what changed> | regenerate-env | auth-proof]
4
4
  ---
5
5
 
6
6
  Caveman ULTRA mode. You are the ORCHESTRATOR.
@@ -36,6 +36,31 @@ Action: $ARGUMENTS (default: "provision" if INFRA.md missing, "verify" if presen
36
36
  4. On "make changes": dispatch UPDATE with feedback. Loop to step 2.
37
37
 
38
38
  5. On APPLIED: tell me INFRA.md ✓, .env.test ✓, and any manual steps remaining.
39
+ Then run AUTH PROOF (below) before declaring Phase 0 complete.
40
+
41
+ ---
42
+
43
+ ## AUTH PROOF (one-time, hard rule 16)
44
+
45
+ Runs after a successful PROVISION (and on demand via `/infra auth-proof`). Proves
46
+ every credential the project's real tests will use is reusable WITHOUT interaction.
47
+ "Reusable" is defined falsifiably: obtainable headlessly TWICE IN A ROW.
48
+
49
+ 1. Enumerate the credentials in scope: the Entra/MSAL app login, plus every
50
+ external datasource credential referenced in docs/DATAFLOW.md (external rows)
51
+ and docs/ENDPOINTS.md (auth column) — Azure SQL, Tableau, etc.
52
+
53
+ 2. Dispatch `infra-provisioner` to run, for EACH credential, a headless obtain
54
+ twice in a row: first call primes (token fetch / connect), second call must
55
+ succeed from cache/refresh with ZERO prompts. The Microsoft login UI is never
56
+ driven (ROPC + dedicated MFA-excluded test account; hard rule 8).
57
+
58
+ 3. Result:
59
+ - All credentials pass twice headlessly -> write `AUTH PROOF: PASS <timestamp>`
60
+ to docs/INFRA.md with the per-credential list. Phase 0 may complete.
61
+ - Any credential prompts or fails the second obtain -> NOT reusable. Write
62
+ `AUTH PROOF: FAIL` + which credential, STOP, tell me what to fix. Phase 0 is
63
+ not complete until the proof passes.
39
64
 
40
65
  ---
41
66
 
@@ -43,7 +68,7 @@ Action: $ARGUMENTS (default: "provision" if INFRA.md missing, "verify" if presen
43
68
 
44
69
  1. Check INFRA.md exists. If missing: tell me to run `/infra provision` first.
45
70
  2. Dispatch `infra-provisioner` VERIFY mode.
46
- 3. Return drift report.
71
+ 3. Return drift report. If the AUTH PROOF marker is missing or stale, re-run AUTH PROOF.
47
72
 
48
73
  ---
49
74
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Bootstrap a new project. Runs design-research, double grill, and planning. Run once per project.
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
5
  Caveman ULTRA mode.
@@ -18,7 +18,9 @@ Goal: stand up a fresh project workspace with a well-grounded plan.
18
18
  1. Run the `grill-me` skill to interrogate me. Goal: understand initial scope.
19
19
  Cover: project purpose, success criteria, external services, Azure services
20
20
  needed (type + sizing), region, deployment target (Azure or local for E2E),
21
- known constraints, unknowns.
21
+ known constraints, unknowns. ALSO establish:
22
+ - **has_frontend**: is there a browser-facing UI? If yes, what is the frontend
23
+ root path (e.g. `src/web/`, `app/`)? This drives the mandatory-E2E path match.
22
24
  Do not stop early. Do not write OVERVIEW.md yet.
23
25
 
24
26
  Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
@@ -33,74 +35,115 @@ Store the round-1 answers as working context — do NOT write OVERVIEW.md yet.
33
35
  Quotas, rate limits, known gaps?
34
36
  - Azure services: any sizing or SKU constraints relevant to the use case?
35
37
  - Auth patterns: any MSAL/Entra constraints for this scenario?
38
+ - Each external DATASOURCE: its DATA UNDERSTANDING (see step 4).
36
39
  - Any other architectural assumption in the round-1 answers worth verifying.
37
40
 
38
41
  3. Dispatch `researcher` in DESIGN mode with the DESIGN TOPICS list.
39
- It returns a terse summary + file paths. Read the design-<slug>.md files
40
- only if needed.
42
+ It returns a terse summary + file paths. For every external datasource it
43
+ drafts a DATA UNDERSTANDING to `docs/research/datasource-<name>.md`:
44
+ grain (one row = what?), the fields likely under test with their meaning and
45
+ real-world nullability/range, a sample-fixture shape, and the assumption that
46
+ if wrong makes a test meaningless. Read the design-<slug>.md files only if needed.
47
+
48
+ ---
49
+
50
+ ### RESEARCH REVIEW (v2.1 — read-and-confirm, not a grill)
51
+
52
+ 4. Surface the design-research findings to me DIRECTLY, phrased as FALSIFIABLE
53
+ CLAIMS about my systems — not a passive findings dump. For example:
54
+ "I understand your Tableau extract refreshes nightly and the API is read-only;
55
+ the `orders` grain is one row per line-item; `status` is never null in practice."
56
+ For each external datasource, present its drafted DATA UNDERSTANDING for me to
57
+ confirm or correct. Then:
58
+ - Minor corrections -> fold forward as seed context for round-2 grill.
59
+ - A MATERIAL error (wrong service tier, wrong data model, wrong grain) ->
60
+ re-dispatch `researcher` with the correction, then re-present. Do not carry
61
+ a known-wrong research file into grill or OVERVIEW.md.
62
+ A confirmed datasource understanding is recorded as the BASELINE in its
63
+ `datasource-<name>.md`. (Per-phase delta-confirms happen later in `/phase`.)
41
64
 
42
65
  ---
43
66
 
44
67
  ### Round 2 — Research-informed re-grill
45
68
 
46
- 4. Run `grill-me` again — a second focused pass. Seed it with:
69
+ 5. Run `grill-me` again — a second focused pass. Seed it with:
47
70
  - The round-1 answers (already established — do not re-ask these)
48
71
  - The design-research key findings and new questions raised
72
+ - The RESEARCH REVIEW corrections
49
73
 
50
- The re-grill asks whatever it needs to build complete understanding. It is
51
- not limited to "gaps from research" research context makes new questions
52
- relevant even if it found no blockers. Do not re-ask what round 1 already
53
- established clearly.
74
+ This pass MUST explicitly cover DATA STRUCTURE and DATAFLOW, especially the
75
+ STATE FLOW of each key object: what are the core entities, what states does
76
+ each move through, what transition triggers each change, who writes it, and
77
+ does any state map to an external system. The re-grill asks whatever else it
78
+ needs for complete understanding. Do not re-ask what round 1 established.
54
79
 
55
80
  ---
56
81
 
57
- ### Write OVERVIEW.md
82
+ ### Write OVERVIEW.md + DATAFLOW.md
58
83
 
59
- 5. Write docs/OVERVIEW.md from the COMBINED output of round-1 + design-research
60
- + round-2. Include:
84
+ 6. Write docs/OVERVIEW.md from the COMBINED output of round-1 + design-research
85
+ + research review + round-2. Include:
61
86
  - Project purpose and success criteria
62
87
  - Scope and constraints (informed by research findings)
63
88
  - External services with confirmed capabilities/limits
64
89
  - "Azure services" section: every service with expected SKU
65
90
  - Deployment target (azure-deployed or local-docker for E2E)
91
+ - `has_frontend: true|false` and, if true, the frontend root path
66
92
  - Known risks / open questions (if any remain)
67
93
 
68
94
  OVERVIEW.md is written HERE — after the re-grill, not before.
69
95
 
96
+ 7. Write docs/DATAFLOW.md — a state-transition table per key object, driven by the
97
+ round-2 data/state-flow grill. The data-side analogue of ENDPOINTS.md. Columns:
98
+ ```
99
+ # Dataflow — <project name>
100
+ > Maintained from /overview; updated each phase that changes an object lifecycle.
101
+ > Each transition row is one testable unit (drives the CLOSE coverage gate).
102
+
103
+ | object | states | transition (from→to) | trigger | who writes | external system |
104
+ |--------|--------|----------------------|---------|------------|-----------------|
105
+ | Order | draft,submitted,fulfilled | draft→submitted | POST /orders/submit | order-svc | — |
106
+ ```
107
+ Any row whose `external system` is populated ties to a `datasource-<name>.md`.
108
+
70
109
  ---
71
110
 
72
111
  ### Plan
73
112
 
74
- 6. Hand OVERVIEW.md + design-research findings to the `planner` subagent.
75
- PLAN.md MUST:
113
+ 8. Hand OVERVIEW.md + DATAFLOW.md + design-research findings to the `planner`
114
+ subagent. PLAN.md MUST:
76
115
  - Start with Phase 0 (infra setup) as the first entry (always).
77
116
  - End with a final code phase that contains the deploy task block.
117
+ - For any phase whose `changes` touch the frontend root: include ≥1
118
+ UI-existence acceptance criterion naming the specific user-visible
119
+ interactive element the phase introduces (not "page renders 200").
120
+ - Map each phase to the DATAFLOW transitions it is expected to make reachable.
78
121
 
79
- 7. Create docs/STATE.md:
122
+ 9. Create docs/STATE.md:
80
123
  ```
81
124
 
82
125
  # STATE
83
126
 
84
127
  phase: 0 (pending)
85
- completed: project bootstrapped — design research done, double grill done
128
+ completed: project bootstrapped — design research, research review, double grill (incl. data/state flow) done
86
129
  next: run /infra to provision Azure infrastructure
87
130
  blocker: none
88
131
 
89
132
  ```
90
- 8. Create docs/ISSUES.md with header `# Issues` and `## Archived` section.
133
+ 10. Create docs/ISSUES.md with header `# Issues` and `## Archived` section.
91
134
 
92
- 9. Create empty docs/HISTORY.md.
135
+ 11. Create empty docs/HISTORY.md.
93
136
 
94
- 10. Create docs/INFRA.md from the template (populated by /infra).
137
+ 12. Create docs/INFRA.md from the template (populated by /infra).
95
138
 
96
- 11. Create docs/ENDPOINTS.md:
139
+ 13. Create docs/ENDPOINTS.md:
97
140
  ```
98
141
  # Endpoints — <project name>
99
142
  > Maintained by implementer. Updated each phase.
100
143
  > Base URL: (populated after deployment phase)
101
144
  ```
102
145
 
103
- Then stop and show me PLAN.md for approval before any phase starts.
146
+ Then stop and show me PLAN.md + DATAFLOW.md for approval before any phase starts.
104
147
 
105
- Remind me: "Run `/infra` next to provision the Azure environment (Phase 0)
106
- before starting Phase 1."
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."