Commit Graph

24 Commits

Author SHA1 Message Date
32d20872e3 feat(work): pnpm work prd-ship + auto-flip integration in sandcastle
Closes the PRD-lifecycle gap surfaced by the user: when sandcastle
finishes an epic's last task, the seed PRD should auto-flip from
approved -> shipped. Builds the mechanism, wires it into the work
CLI + state index + reviewer prompt + docs.

scripts/work/prd-ship.mjs (new):
  - parseFrontmatter / serializeFrontmatter — minimal YAML-ish parser
    sufficient for PRD frontmatter (scalar + list shapes)
  - flipPrdStatus — pure function: takes PRD text, returns new text
    with status=shipped + shipped=<date> + optional shipping-commits.
    Refuses to flip draft, idempotent fail-soft on already-shipped,
    rejects unexpected statuses
  - deriveShippingCommits — best-effort git log of the linked epic
    folder for the --auto-commits flag
  - findPrdPath — id -> path lookup under docs/work/prds/
  - runCli — wiring for `pnpm work prd-ship <id> [--commits|--auto-commits]`

scripts/work/prd-ship.test.mjs (new, 17 tests):
  - Frontmatter parser handles scalars + lists + missing frontmatter
  - flipPrdStatus covers all transitions + refusals + body/key preservation
  - findPrdPath + serializeFrontmatter coverage

scripts/work/state-builder.mjs:
  - Epic entries gain a `prd` field
  - New computeNeedsPrdShip surfaces epics done with PRD status not yet
    shipped: state.needs_prd_ship[] with action commands

scripts/work/cli.mjs:
  - New subcommand `pnpm work prd-ship <id>`

.sandcastle/reviewer.prompt.md:
  - "Epic close-out: PRD status flip" section instructing reviewer to
    check _state.json.needs_prd_ship and run the suggested action
  - JSON output extends with prd_shipped: "<id>" | null

docs/work/README.md:
  - "PRD lifecycle" section documenting the 4 statuses + auto-flip

Future PRDs follow the lifecycle automatically: decomposer refuses
draft, human flips to approved, sandcastle ships the epic, reviewer
runs prd-ship on the final task, PRD lands as shipped with its
commit trail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:51:48 +02:00
fc27eef6eb docs(coverage): sync docs to shipped state + wire sandcastle prompts
Closes the staleness gap after the 10-commit coverage epic shipped.

Doc sync (item 1 from the user's choice):
  - CLAUDE.md Quick Start: adds pnpm coverage:aggregate / coverage:diff
    / mutate to the command listing
  - CLAUDE.md: new "Sibling architecture: coverage (ADR-020)" section
    after the conformance gate table — captures the 4-layer table +
    points at docs/guides/coverage.md + ADR-020 + says agents must run
    coverage:diff before reporting complete
  - AGENTS.md preamble: now lists coverage as a parallel multi-latency
    quality system alongside conformance, with the same gate / latency
    framing
  - PRD frontmatter: status draft -> shipped + shipped date +
    shipping-commits list (all 10 SHAs anchoring the trace)
  - PRD findings table: each row gets a Resolution column citing the
    commit that closed it; conclusion text updated to past tense
  - ADR-020 implementation phasing: rewritten as a status table with
    each step linked to the commit that shipped it + Boot-time
    assertFeatureConformance explicitly marked Deferred with rationale
  - docs/guides/coverage.md: removed "Boot wiring lands in the next
    story" line; replaced with the deferral rationale + clarified
    that two readers (vitest, coverage:diff) consume the manifest

Sandcastle prompts (item 2 from the user's choice):
  - .sandcastle/implementer.prompt.md: new "Coverage gates" section
    after the conformance-gates list, requiring `pnpm test --coverage`,
    `pnpm coverage:aggregate`, and `pnpm coverage:diff` to all pass
    before reporting `complete`. Machine-readable JSON shape of
    coverage:diff documented (status / uncovered[] / kind enum), with
    explicit instructions on how to interpret each kind. Allowlist
    expansion requires justification + test.
  - .sandcastle/reviewer.prompt.md: AC coverage relabeled to "AC
    coverage (acceptance criteria, not test coverage)" to disambiguate;
    new check #7 "Coverage gates (ADR-020)" requiring CI's
    Coverage — diff (L1) step green + per-layer thresholds met +
    no silent allowlist expansion + manifest band drift detection.

Effect: future agent runs through sandcastle now treat coverage as a
first-class blocking gate, parallel to conformance. PRs no longer
discover coverage failures only via CI; the implementer is required
to check before reporting done, and the reviewer is required to
verify.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:47:16 +02:00
7eb783aee1 docs(prds): seed agent-first coverage architecture PRD
Captures the brainstorm convergence (2026-05-13) into a draft PRD that
seeds the implementation epic. Decisions captured:

- 4-layer coverage architecture (L0 vitest thresholds, L1 diff coverage,
  L2 aggregate summary.json, L3 mutation testing on entities + use-cases)
- Manifest-driven coverage band as the single source of truth — vitest
  config, assertFeatureConformance boot check, and pnpm coverage:diff
  all derive expectations from feature.manifest.ts
- Cover-the-diff (every changed line exercised) not cover-the-new-code
- Aggregate trend committed as coverage/summary.json; no SaaS dep
- Stryker for mutation, on-demand only, NOT in default pnpm test

L0 verification findings (also captured in the PRD):
- auth / blog / marketing-pages: green (100% layer bands hold)
- navigation: real test gaps in entities + controllers (~86%)
- media: missing @vitest/coverage-v8 dep + vitest.config has no
  coverage block at all (entirely absent — the most extreme case of
  the duplication problem the manifest-driven keystone eliminates)

Status remains draft until the human review pass. Decomposer will
refuse to run on draft.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 13:37:21 +02:00
e203a9d58e chore(work): close out template-reset-v1 epic — all 12 tasks done
Mark epic + story status done, check all task boxes, rebuild _state.json.
All checks green: typecheck, tests (360 passing), lint, turbo boundaries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 10:18:29 +02:00
2ceaa08944 chore(template-reset): update snapshots, fix lint, rebuild state
- Regenerate audit + realtime core-package e2e snapshots (template
  Phase-label changes altered file hashes)
- Fix pre-existing lint error in auth authentication.service.ts:
  rename unused params to _user / _sessionId, drop stale eslint-disable
  comments that were on wrong lines
- Mark story tasks 1-9 done; rebuild _state.json

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 10:17:50 +02:00
075b729266 feat: archive setup-history epics + plans + refactor-logs to .archive/ 2026-05-13 09:43:49 +02:00
c7ce0d9819 docs(work): scaffold template-reset-v1 epic 2026-05-13 09:43:09 +02:00
9ca1022f9c docs(work): close sandcastle-subscription-auth-v1 epic 2026-05-13 09:32:14 +02:00
b6948fa881 docs(work): scaffold sandcastle-subscription-auth-v1 epic 2026-05-13 09:27:02 +02:00
244313c914 docs(work): close docs-and-runbook-v1 epic 2026-05-13 09:05:54 +02:00
cf8d69106e docs(work): scaffold docs-and-runbook-v1 epic + stories 2026-05-13 09:03:15 +02:00
072e08d855 docs(work): close fallow-integration-v1 epic 2026-05-13 08:55:50 +02:00
2722305398 docs(work): scaffold fallow-integration-v1 epic + stories 2026-05-13 08:47:30 +02:00
10603bd250 docs(work): close visual-regression-v1 epic 2026-05-13 08:32:58 +02:00
4fa108dd48 docs(work): scaffold visual-regression-v1 epic + stories 2026-05-13 08:24:55 +02:00
06c9fb1823 docs(work): close sandcastle-dispatch-v1 epic 2026-05-13 08:22:08 +02:00
35664f67d5 docs(work): scaffold sandcastle-dispatch-v1 epic + stories 2026-05-13 08:16:09 +02:00
1385219b48 docs(work): close elicitation-prompts-v1 epic 2026-05-13 08:12:28 +02:00
7d08aff089 docs(work): scaffold elicitation-prompts-v1 epic + stories 2026-05-13 08:09:38 +02:00
e92610e7f1 docs(work): close dag-and-readiness-v1 epic 2026-05-13 08:06:21 +02:00
adabb3428d docs(work): scaffold dag-and-readiness-v1 epic + stories 2026-05-13 07:59:53 +02:00
ca006494c5 docs(work): close pre-commit-hooks-v1 epic 2026-05-13 07:56:33 +02:00
ee315352ff docs(work): close work-system-v1 epic 2026-05-13 07:47:33 +02:00
9858d49787 feat: wire pnpm work CLI + initial _state.json snapshot 2026-05-13 07:47:03 +02:00