create-anpunkit 2.0.3 → 2.2.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.
- package/bin/cli.js +3 -2
- package/package.json +1 -1
- package/template/.claude/agents/e2e-runner.md +44 -13
- package/template/.claude/agents/implementer.md +13 -7
- package/template/.claude/agents/infra-provisioner.md +33 -2
- package/template/.claude/agents/planner.md +79 -6
- package/template/.claude/agents/researcher.md +19 -8
- package/template/.claude/agents/spec-author.md +118 -0
- package/template/.claude/agents/test-author.md +76 -43
- package/template/.claude/anpunkit-manifest.json +47 -27
- package/template/.claude/commands/infra.md +28 -3
- package/template/.claude/commands/overview.md +84 -24
- package/template/.claude/commands/phase.md +139 -40
- package/template/.claude/commands/replan.md +23 -9
- package/template/.cursor/commands/infra.md +26 -1
- package/template/.cursor/commands/overview.md +83 -23
- package/template/.cursor/commands/phase.md +138 -39
- package/template/.cursor/commands/replan.md +22 -8
- package/template/.gitattributes +1 -0
- package/template/AGENTS.md +215 -36
- package/template/CLAUDE.md +1 -0
- package/template/README.md +59 -23
- package/template/anpunkit.png +0 -0
- package/template/commands.src/infra.md +28 -3
- package/template/commands.src/overview.md +84 -24
- package/template/commands.src/phase.md +139 -40
- package/template/commands.src/replan.md +23 -9
- package/template/docs/DESIGN_LOG.md +192 -1
- package/template/index.html +339 -0
- package/template/scripts/spec-conformance.sh +93 -0
- package/template/scripts/spec-staleness.sh +115 -0
- package/template/setup.sh +110 -47
- package/template/tests/helpers/spec-assert.py +162 -0
- package/template/tests/helpers/spec-assert.ts +158 -0
|
@@ -17,6 +17,31 @@
|
|
|
17
17
|
|
|
18
18
|
Newest first. One entry per architectural change. Appended by `/log-decision`.
|
|
19
19
|
|
|
20
|
+
- **(v2.2)** — **Spec-driven behavioral contract.** Closes the v2.1 residual:
|
|
21
|
+
fabrication under a thin acceptance surface. In v2.1 a phase's whole contract was
|
|
22
|
+
a single `acceptance:` line; `implementer` and `test-author` each independently
|
|
23
|
+
elaborated it, and when both filled the same gap the same plausible-but-wrong way
|
|
24
|
+
the suite went green on a broken core — TEST REVIEW (review of *coverage*, after
|
|
25
|
+
RED) could not catch a faithful mapping to a *fabricated* criterion. The reframe:
|
|
26
|
+
the reviewable, authoritative artifact is the SPEC, not the test. New mechanism —
|
|
27
|
+
skeleton case-NAMES locked at `/overview` (planner) → per-phase concrete filling by
|
|
28
|
+
a new **`spec-author`** (real inputs/expecteds in shared `fixtures/`) → **SPEC
|
|
29
|
+
REVIEW** human gate UPSTREAM of code → tests GENERATED from the locked rows
|
|
30
|
+
(deep-equality + matcher tokens for `data`, Playwright-from-descriptor for `ui`),
|
|
31
|
+
sharing the same fixtures so a test cannot assert different values than the spec.
|
|
32
|
+
Two new orchestrator-procedure scripts (`spec-staleness.sh`, `spec-conformance.sh`)
|
|
33
|
+
replace the human TEST REVIEW gate. `test-author`/`e2e-runner` become harness
|
|
34
|
+
EMITTERS; `implementer` reads the filled spec as its contract (author ≠ implementer).
|
|
35
|
+
New decision entries §5.43–§5.56. New files: `.claude/agents/spec-author.md`,
|
|
36
|
+
`scripts/spec-staleness.sh`, `scripts/spec-conformance.sh`, `tests/helpers/
|
|
37
|
+
spec-assert.{py,ts}`, plus per-project `docs/spec-phase-<n>.md` + `fixtures/`.
|
|
38
|
+
REMOVED: the v2.1 human TEST REVIEW gate (humans no longer review tests).
|
|
39
|
+
NOTE: the v2.1 entries §5.33–§5.42 (TEST REVIEW gate, mandatory frontend E2E +
|
|
40
|
+
evidence, DATAFLOW coverage, datasource understanding, auth proof/liveness,
|
|
41
|
+
installer tool-selection) live in the v2.1 release bundle and the on-disk AGENTS.md
|
|
42
|
+
hard rules; they were never merged into this on-disk log (a hybrid file). The v2.2
|
|
43
|
+
decision numbers continue at §5.43 for continuity with the requirements doc.
|
|
44
|
+
|
|
20
45
|
- **(v2.0.2)** — KB setup stays PATH-FIRST: the user clones the KB repo
|
|
21
46
|
themselves (`git clone ... ~/anpunkit-kb`) and passes `--kb-path` (or the
|
|
22
47
|
interactive prompt). New: the remote URL is auto-recorded from the clone's
|
|
@@ -452,6 +477,150 @@ native wiring).
|
|
|
452
477
|
|
|
453
478
|
---
|
|
454
479
|
|
|
480
|
+
> **Numbering note (v2.2).** §5.33–§5.42 are the v2.1 decisions (TEST REVIEW gate,
|
|
481
|
+
> mandatory frontend E2E + evidence, DATAFLOW transition coverage, datasource
|
|
482
|
+
> understanding, auth proof/liveness, installer tool-selection). They were recorded
|
|
483
|
+
> in the v2.1 release bundle and are reflected in AGENTS.md's hard rules, but were
|
|
484
|
+
> never merged into this on-disk log. v2.2 continues at §5.43 for continuity with the
|
|
485
|
+
> v2.2 requirements doc rather than renumbering.
|
|
486
|
+
|
|
487
|
+
### 5.43 Spec file is a per-phase artifact, not inline in PLAN.md (v2.2)
|
|
488
|
+
**Problem:** a phase's whole behavioral contract was one `acceptance:` line; two
|
|
489
|
+
agents independently elaborated it and could agree on the same wrong contract.
|
|
490
|
+
**Decision:** `docs/spec-phase-<n>.md` is a new per-phase artifact; `PLAN.md`'s
|
|
491
|
+
`acceptance:` stays a one-line summary, the spec is its concrete expansion. The spec
|
|
492
|
+
is self-correlating: a GENERATED header transcludes that phase's `acceptance:` line +
|
|
493
|
+
the in-scope `DATAFLOW.md` transition rows and embeds a staleness hash; only the
|
|
494
|
+
example-case table is human-authored. **Rejected:** expanding `acceptance:` inline in
|
|
495
|
+
PLAN.md — couples the contract to `/replan` churn, bloats PLAN, mixes phase-ordering
|
|
496
|
+
review with concrete-behavior review.
|
|
497
|
+
|
|
498
|
+
### 5.44 Two-layer baseline/delta — case-names up front, values per phase (v2.2)
|
|
499
|
+
**Decision:** lock behavior in two passes. (1) Up-front case-NAME contract at
|
|
500
|
+
`/overview`: for every DATAFLOW transition + every acceptance criterion, enumerate
|
|
501
|
+
the case names (happy / each edge / each failure + error code), no values yet —
|
|
502
|
+
skeleton spec files. (2) Per-phase concrete filling at `/phase` start (after
|
|
503
|
+
RESEARCH, before SCAFFOLD): `spec-author` fills real payloads/outputs grounded in
|
|
504
|
+
fresh research + the confirmed datasource baseline. **Rationale:** the only design
|
|
505
|
+
that gives BOTH "complete requirements locked before implementation" (names up front)
|
|
506
|
+
and "values grounded in real facts, not plan-time guesses" (per-phase fill). Mirrors
|
|
507
|
+
the established baseline/delta shape (datasource understanding, DATAFLOW coverage).
|
|
508
|
+
|
|
509
|
+
### 5.45 Skeleton→filled single file; "no unfilled stub" is the conformance invariant (v2.2)
|
|
510
|
+
**Decision:** skeletons are generated at `/overview` (names + `TBD`); `spec-author`
|
|
511
|
+
fills in-place. Invariant: no `TBD` may remain when `spec-conformance.sh` runs
|
|
512
|
+
(between RED and GREEN). **Consequence:** a case that cannot be filled from research
|
|
513
|
+
is escalated as UNDERSPEC / `CASE-SET-DIVERGENCE` BEFORE SCAFFOLD, not discovered at
|
|
514
|
+
GREEN.
|
|
515
|
+
|
|
516
|
+
### 5.46 Case structure: table row + boundary-typed fixture-ref (v2.2)
|
|
517
|
+
**Decision:** each case is one row — `case-id | covers | boundary | input-ref |
|
|
518
|
+
expected-ref | error-code | volatile`. `covers` = a DATAFLOW transition-id
|
|
519
|
+
(convention `Object:from->to`, no new DATAFLOW column) or acceptance criterion-id
|
|
520
|
+
(`ACC-<k>`). `boundary` ∈ {`data`,`ui`}. Refs point to `fixtures/<case-id>-*.json`
|
|
521
|
+
(scalars may inline). **Key property:** the harness loads the SAME fixture files the
|
|
522
|
+
spec row references — transcription from spec to test is STRUCTURAL, not honor-system;
|
|
523
|
+
a test physically cannot assert different values than the spec.
|
|
524
|
+
|
|
525
|
+
### 5.47 Boundary test is system-of-record per case; optional mock mirror (v2.2)
|
|
526
|
+
**Decision:** every case has exactly one BOUNDARY test — `data`: real
|
|
527
|
+
HTTP/CLI/message vs the running backend + real services (v2.1's "real API suite");
|
|
528
|
+
`ui`: Playwright vs the deployed/local-docker target (v2.1's E2E). The boundary test
|
|
529
|
+
is the phase gate; green mock alone never closes (rule 5 / §5.38 preserved). A mock
|
|
530
|
+
mirror is optional, shares the fixture + comparator via `TEST_MODE`. "E2E" is
|
|
531
|
+
generalized to *outer-boundary*, not browser-specific: on `has_frontend: false` all
|
|
532
|
+
cases are `data` and `ui` rows are invalid.
|
|
533
|
+
|
|
534
|
+
### 5.48 Human TEST REVIEW removed; assertion is generated deep-equality (v2.2)
|
|
535
|
+
**Decision:** remove the v2.1 human TEST REVIEW gate. Humans never review tests.
|
|
536
|
+
Tests are not authored — a harness generator emits a deep-equality assertion against
|
|
537
|
+
`fixtures/<case-id>-expected.json` per case row. SPEC REVIEW (§5.50) is the
|
|
538
|
+
human gate; it sits upstream (before SCAFFOLD), reviews concrete behavior in plain
|
|
539
|
+
language, and is the correctness-bearing moment TEST REVIEW was not (wrong thing,
|
|
540
|
+
wrong layer: TEST REVIEW reviewed coverage and asked humans to read assertions).
|
|
541
|
+
|
|
542
|
+
### 5.49 Volatile fields use matcher tokens in the fixture (v2.2)
|
|
543
|
+
**Decision:** volatile fields (generated IDs, timestamps, order, cursors) are matched
|
|
544
|
+
by TYPE, not excluded. The expected fixture carries sentinels — `<UUID>`, `<ISO8601>`,
|
|
545
|
+
`<ANY_STRING>`, `<ANY_NUMBER>`, `<UNORDERED>`, `<MATCHES:regex>`. The per-language
|
|
546
|
+
comparator `tests/helpers/spec-assert.*` honors them. A token asserts PRESENCE +
|
|
547
|
+
SHAPE, never "ignore this field" (a missing volatile field still fails). The
|
|
548
|
+
comparator is bounded + kit-versioned (one impl per supported language); no
|
|
549
|
+
per-project comparator code.
|
|
550
|
+
|
|
551
|
+
### 5.50 SPEC REVIEW — per-phase human gate on concrete fillings (v2.2)
|
|
552
|
+
**Decision:** after `spec-author` fills + `spec-staleness.sh` passes, the orchestrator
|
|
553
|
+
surfaces filled cases as FALSIFIABLE CLAIMS; the human confirms/corrects. Rejection
|
|
554
|
+
classification: wrong expected → fix row + fixture (no re-research); wrong input shape
|
|
555
|
+
→ re-dispatch `spec-author`; new case OR contradicted case → hard re-entry (§5.52).
|
|
556
|
+
Unskippable on TDD phases; absent on non-TDD. Replaces v2.1 human TEST REVIEW.
|
|
557
|
+
|
|
558
|
+
### 5.51 Up-front case-name completeness folded into existing /overview approval (v2.2)
|
|
559
|
+
**Decision:** the existing end-of-`/overview` approval (PLAN.md + DATAFLOW.md) is
|
|
560
|
+
EXTENDED to confirm the cross-phase skeleton case-name set (per phase: covered
|
|
561
|
+
transition/acceptance ids + enumerated case names, no values). One confirmation, one
|
|
562
|
+
surface, no new gate — the names derive from the same PLAN + DATAFLOW being approved.
|
|
563
|
+
|
|
564
|
+
### 5.52 Any case-set divergence at phase time → hard re-entry (v2.2)
|
|
565
|
+
**Decision:** if phase-time RESEARCH reveals a case not enumerated up front, or one
|
|
566
|
+
that contradicts an enumerated case (locked contract impossible), the phase STOPS.
|
|
567
|
+
`spec-author` returns `CASE-SET-DIVERGENCE`; the human amends the up-front skeleton;
|
|
568
|
+
re-confirms the amended case(s) + any case sharing their `covers` id (the staleness
|
|
569
|
+
hash certifies the unchanged remainder — not re-read); `spec-author` re-fills from
|
|
570
|
+
scratch. **Rationale:** AI writes code; the human owns the contract. No fold-forward,
|
|
571
|
+
no AI amendment of the case-name set.
|
|
572
|
+
|
|
573
|
+
### 5.53 Dedicated spec-author agent; author ≠ implementer invariant (v2.2)
|
|
574
|
+
**Decision:** a new `spec-author` (Opus) fills the per-phase spec + fixtures after
|
|
575
|
+
RESEARCH, before SPEC REVIEW; returns `CASE-SET-DIVERGENCE` when a case can't be
|
|
576
|
+
filled from real facts or research reveals an unlisted branch. It is NOT
|
|
577
|
+
`implementer`. The **author ≠ implementer** invariant replaces v2.1's test-author
|
|
578
|
+
blindness invariant: `implementer` reads the filled spec as its contract (normal
|
|
579
|
+
spec-driven development), `test-author` becomes a harness emitter (reads spec rows,
|
|
580
|
+
generates the assertion harness, authors no assertions).
|
|
581
|
+
|
|
582
|
+
### 5.54 UI boundary cases use generated Playwright; e2e-runner is an emitter (v2.2)
|
|
583
|
+
**Decision:** for `ui` cases, `e2e-runner` stops authoring blind and EMITS a
|
|
584
|
+
Playwright assertion from the case's `fixtures/<case-id>-ui.json` descriptor. The
|
|
585
|
+
descriptor vocabulary is closed + kit-versioned: `visible`, `text-equals`, `enabled`,
|
|
586
|
+
`count`. Screenshot-on-each-UI-existence-assertion (v2.1 §5.35) is retained as the
|
|
587
|
+
visual backstop. `ui` cases have no mock mirror (the browser is the boundary). On
|
|
588
|
+
`has_frontend: false`, `ui` rows are invalid.
|
|
589
|
+
|
|
590
|
+
### 5.55 spec-staleness.sh + spec-conformance.sh as orchestrator-procedure scripts (v2.2)
|
|
591
|
+
**Decision:** two new scripts, same idiom as `regression.sh` (`set -euo pipefail`,
|
|
592
|
+
nonzero = loud fail). `spec-staleness.sh` re-hashes the current PLAN acceptance line +
|
|
593
|
+
in-scope DATAFLOW rows and compares to the spec's embedded header hash (`stamp`
|
|
594
|
+
subcommand embeds it at `/overview`/regenerate; default `check` compares); runs after
|
|
595
|
+
SPEC fill + at SPEC REVIEW entry. `spec-conformance.sh` asserts no `TBD` remains and
|
|
596
|
+
every case-id is cited by a boundary test (`# spec: <case-id>`); runs between RED and
|
|
597
|
+
GREEN, replacing the human TEST REVIEW gate. Both port to Cursor for free (same
|
|
598
|
+
`/phase` body, same bash scripts — no new hook wiring). **Design choice (impl):**
|
|
599
|
+
hashing lives ONLY in the script (a `stamp` subcommand), not duplicated in agent
|
|
600
|
+
prompts; transition-ids are derived (`Object:from->to`) so DATAFLOW needs no new column.
|
|
601
|
+
|
|
602
|
+
### 5.56 Rule 14 re-seamed: transition→case reachability; conformance owns case→test (v2.2)
|
|
603
|
+
**Decision:** v2.1 rule 14 (DATAFLOW transition coverage) is re-seamed. New
|
|
604
|
+
responsibility: every reachable DATAFLOW transition must have ≥1 FILLED CASE in
|
|
605
|
+
`docs/spec-phase-<n>.md` (was: ≥1 test in `tests/regression/`). Reachability judgment
|
|
606
|
+
unchanged (orchestrator decides at CLOSE; unreachable list PENDING; all live by final
|
|
607
|
+
phase or FAIL HARD). The case→test half moves to `spec-conformance.sh` (every case-id
|
|
608
|
+
cited by a boundary test, which by placement convention lands in `tests/regression/`).
|
|
609
|
+
The full guarantee is preserved by the chain: reachable transition → filled case
|
|
610
|
+
(rule 14) → cited boundary test (conformance) → regression corpus (placement). The
|
|
611
|
+
ENDPOINTS coverage gate is unchanged and orthogonal (endpoint-keyed vs behavior-keyed).
|
|
612
|
+
|
|
613
|
+
**Numbering reconciliation (v2.2).** The requirements doc's hard-rule table labeled
|
|
614
|
+
new rules 12–16, but its own "Non-changes" section retains the frontend-E2E (old 13),
|
|
615
|
+
datasource (old 15) and auth (old 16) rules — so the table is illustrative, not literal.
|
|
616
|
+
AGENTS.md realizes a coherent set: rule **12** = SPEC REVIEW (reuses the slot freed by
|
|
617
|
+
the removed TEST REVIEW); rule **14** = re-seamed DATAFLOW (kept in place); rules
|
|
618
|
+
**13/15/16** keep their v2.1 meanings (frontend E2E / datasource / auth); the remaining
|
|
619
|
+
new rules append as **17** (spec staleness), **18** (spec conformance), **19** (author ≠
|
|
620
|
+
implementer). This preserves every existing `hard rule N` cross-reference except 12.
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
|
|
455
624
|
## 6. Current file inventory
|
|
456
625
|
```
|
|
457
626
|
|
|
@@ -542,6 +711,24 @@ create-anpunkit/ npx package (package.json, bin/cli.js, build.
|
|
|
542
711
|
ownership taxonomy, adapter generation, idempotent JSON hook merge, VERIFY,
|
|
543
712
|
backup, `--dry-run`).
|
|
544
713
|
|
|
714
|
+
### v2.2 additions to the inventory
|
|
715
|
+
|
|
716
|
+
```
|
|
717
|
+
.claude/agents/spec-author.md NEW — fills per-phase spec + fixtures (Opus); author ≠ implementer
|
|
718
|
+
scripts/spec-staleness.sh NEW — stamp/check the spec header hash vs PLAN+DATAFLOW (rule 17)
|
|
719
|
+
scripts/spec-conformance.sh NEW — no-TBD + every case-id cited by a boundary test (rule 18)
|
|
720
|
+
tests/helpers/spec-assert.py NEW — kit comparator (matcher tokens), Python
|
|
721
|
+
tests/helpers/spec-assert.ts NEW — kit comparator (matcher tokens), TS/JS
|
|
722
|
+
docs/spec-phase-<n>.md NEW per-project — skeleton at /overview, filled per phase (committed)
|
|
723
|
+
fixtures/<case-id>-*.json NEW per-project — shared by spec row + generated harness (committed)
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
Role deltas: `planner` also writes skeleton specs; `test-author` + `e2e-runner`
|
|
727
|
+
become harness EMITTERS (generate from spec rows, author no assertions);
|
|
728
|
+
`implementer` FILL reads the filled spec as its contract. `.gitattributes` gains
|
|
729
|
+
`*.py text eol=lf` (the kit now ships a Python comparator). REMOVED: the v2.1 human
|
|
730
|
+
TEST REVIEW gate + the `docs/test-plan-phase-<n>.md` artifact.
|
|
731
|
+
|
|
545
732
|
## 7. How each original problem maps to its fix
|
|
546
733
|
|
|
547
734
|
| Problem | Fix |
|
|
@@ -587,7 +774,11 @@ backup, `--dry-run`).
|
|
|
587
774
|
4. The phase gate is a REAL test. A mock suite never closes a phase.
|
|
588
775
|
5. Noisy work writes full output to `docs/research/` and returns only
|
|
589
776
|
terse summary + path — keeps the orchestrator context clean.
|
|
590
|
-
6.
|
|
777
|
+
6. The behavioral contract is the human-approved SPEC; tests are GENERATED from its
|
|
778
|
+
case rows against shared fixtures (author ≠ implementer). This is the v2.2
|
|
779
|
+
unbiased-test guarantee — it replaces v2.1's "tests written blind" (the spec
|
|
780
|
+
fixtures are authored before code, so the contract can't be shaped to an impl).
|
|
781
|
+
(Non-TDD phases keep blind-from-acceptance tests — no spec to drive them.)
|
|
591
782
|
7. Never script the Microsoft login UI.
|
|
592
783
|
8. Fail loud, never silent — especially hook wiring.
|
|
593
784
|
9. Honest failure classification — environment issues never burn the debug budget.
|