The previous layout placed epic folders directly under docs/work/
alongside prds/ and _system/. Tightening: epics now live in their
own docs/work/epics/ subfolder, peer to prds/ and _system/. Same
shape as the existing prds/ bucket.
Final docs/work/ layout:
README.md
prds/<slug>.prd.md
_system/_state.json
epics/<slug>/_epic.md + <story-folder>/_story.md
Renames (git mv preserves history):
- docs/work/binder-wrap-helper/
-> docs/work/epics/binder-wrap-helper/
- docs/work/library-evaluation-policy/
-> docs/work/epics/library-evaluation-policy/
- docs/work/ci-security-and-supply-chain/
-> docs/work/epics/ci-security-and-supply-chain/
Tooling updates:
- state-builder.mjs walks workRoot/epics/ directly; SKIP_FOLDERS
obsoleted (no more sibling folders to filter out).
- dispatch.mjs's findNextTask, tickStoryBulletInEpic, and
flipEpicDoneIfAllStoriesDone all join with "epics" segment.
- prd-ship.mjs's deriveShippingCommits walks workRoot/epics/ and
git-logs docs/work/epics/<epic>/.
- decomposer.prompt.md emits epics under docs/work/epics/<epic-id>/.
- handoff + grill-with-docs glossary references updated.
- Glossary entry for Epic updated.
Reserved future shape: when a task-tracker integration (ClickUp,
Linear) ships, the epics/ subfolder hosts <task-id>-<slug>/
folders. Today it just hosts bare slugs.
3.1 KiB
3.1 KiB
id, epic, title, type, status, feature, depends-on, blocks, created, updated
| id | epic | title | type | status | feature | depends-on | blocks | created | updated | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 02-pre-commit-check-script | library-evaluation-policy | Pre-commit check script for library trace presence | technical-story | done | scripts |
|
|
2026-05-14T06:52:02+02:00 | 2026-05-14T19:21:52.308Z |
Goal
Write scripts/library-decisions/check.mjs — the script that walks staged package.json diffs, derives the tier of each affected package, and fails the commit when a new runtime dependency in a feature- or core-tier package has no sibling approved trace staged. Wire it into .husky/pre-commit as step 4.
Why
Human and agent reviewers cannot reliably check trace presence during code review. The pre-commit hook is the last mechanical gate before a dep reaches the repo; it runs unconditionally, composes with --no-verify protection already in the bash-guard hook, and gives the committer immediate actionable feedback.
Done when
scripts/library-decisions/check.mjsexists and: (1) readsgit diff --cached --name-only -- '**/package.json'; (2) for each stagedpackage.json, derives tier from path (apps/*→ app,packages/core-*→ core,packages/*→ feature); (3) for each newly added line independencies(notdevDependencies/peerDependencies), checks thatdocs/library-decisions/*-<name>.mdis also staged withdecision: approved; (4) exits 1 with a per-package error report + pointer to the skill when any check fails; (5) app-tier and devdep additions exit 0 silently..husky/pre-commitinvokesnode scripts/library-decisions/check.mjsafter the existing state-sync guard.scripts/library-decisions/check.test.mjscovers (using a temp git repo fixture): new feature-tier dep without trace → exit 1; new feature-tier dep with approved trace staged → exit 0; new feature-tier dep with rejected-decision trace staged → exit 1; new app-tier dep → exit 0; new devdep → exit 0; multi-file diff with mixed pass/fail → exit 1 with per-package report;peerDependencies-only change → exit 0.pnpm typecheck && pnpm lint && pnpm test && pnpm conformance && pnpm fallow:audit && pnpm coverage:diffall pass.
In scope
scripts/library-decisions/check.mjs— the check script (importsschema.mjsfrom Story 01 for trace validation).scripts/library-decisions/check.test.mjs— integration tests using a temp git repo fixture (mirror pattern fromscripts/work/state-sync-guard.mjstests)..husky/pre-commit— one added line.
Out of scope
- Sandcastle reviewer prompt integration — Story 06.
--staged-against <base>flag for CI/sandcastle use — added in Story 06 when the reviewer prompt is written.pnpm libs checkergonomic wrapper — deferred per PRD.
Tasks
- Write
scripts/library-decisions/check.mjs(imports schema from Story 01; parsesgit diff --cachedoutput; tier derivation from path; staged-trace presence +decision: approvedcheck; exit-1 report with skill pointer); wire into.husky/pre-commit; writecheck.test.mjsintegration tests with temp git repo fixture covering all 7 cases from Done when; all gates pass on this single commit.