Commit Graph

10 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
4e1167e390 test(scripts): resolveClaudeAuth — subscription/api-key/missing modes 2026-05-13 09:30:11 +02:00
936611ba62 feat(scripts): dispatch.mjs — subscription-first auth via ~/.claude mount 2026-05-13 09:28:20 +02:00
d1b00f1cf5 feat(scripts): pnpm work dispatch — wire CLI to dispatch.mjs 2026-05-13 08:19:19 +02:00
da811eb461 feat(scripts): dispatch.mjs — planner + execute-mode skeleton 2026-05-13 08:18:58 +02:00
4cf979aaa5 feat(scripts): pnpm work ready + blocked subcommands, DAG-aware next 2026-05-13 08:05:19 +02:00
23fedac1a8 feat(scripts): state-builder reads depends-on + blocks from frontmatter 2026-05-13 08:04:38 +02:00
1ebffa68a6 feat(scripts): state-sync-guard for pre-commit safety net 2026-05-13 07:54:03 +02:00
be8e89baed feat(scripts): pnpm work CLI — rebuild-state, status, next 2026-05-13 07:46:51 +02:00
6b57d76dc2 feat(scripts): work state-builder — walks docs/work/ tree 2026-05-13 07:46:28 +02:00