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.0 KiB
3.0 KiB
id, epic, title, type, status, feature, depends-on, blocks, created, updated
| id | epic | title | type | status | feature | depends-on | blocks | created | updated | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-wire-use-case-helper | binder-wrap-helper | Introduce wireUseCase helper in core-shared | technical-story | done | core-shared |
|
2026-05-13T19:17:10+02:00 | 2026-05-14T19:21:52.308Z |
Goal
Add wire-use-case.ts + wire-use-case.test.ts to packages/core-shared/src/conformance/ and export the helper from the @repo/core-shared/conformance barrel. The helper encapsulates withSpan(withCapture(withAudit?(factory(deps)))) composition and performs the container bind step, so callers pass options and get back a brand-stacked wired value.
Why
Every feature binder currently inlines the same withSpan + withCapture wrapping per use case — 30–79 lines of mechanical boilerplate per binder pair. A single helper in core-shared eliminates the structural clone groups and makes adjusting the wrapping shape a one-file change.
Done when
packages/core-shared/src/conformance/wire-use-case.tsexists and is exported frompackages/core-shared/src/conformance/index.ts.wire-use-case.test.tscovers: no-audit path (Instrumented + Captured brands present), audit path (Instrumented + Captured + Audited brands present), span-name derivation (<feature>.<name>), capture-tag structure ({ feature, layer, name }), container binding (symbol resolves to wired value), idempotent re-bind (unbind + bind when symbol already bound).pnpm typecheck && pnpm test && pnpm lint && pnpm conformance && pnpm fallow:audit && pnpm coverage:diffall pass.wire-use-case.tsreaches 100% statement/branch coverage (file is small; exhaustive test coverage is achievable).
In scope
packages/core-shared/src/conformance/wire-use-case.ts— the helper and its exported types.packages/core-shared/src/conformance/wire-use-case.test.ts— unit tests usingRecordingTracer/RecordingLogger/RecordingAuditLog(or equivalent mocks from core-shared/core-audit).- Export line added to
packages/core-shared/src/conformance/index.ts. - No changes to
withSpan,withCapture, orwithAuditinternals — the helper composes them as-is.
Out of scope
- Feature binder changes (Story 02).
- Generator template changes (Story 03).
wireControllerpeer — thelayerdiscriminator inwireUseCasecovers controllers too if the shapes converge; a separate peer is a follow-up if needed.- Repository or service binding patterns.
Tasks
- Add
wire-use-case.ts+wire-use-case.test.tstopackages/core-shared/src/conformance/and export from the conformance index — implement the helper (options object:container,symbol,factory,deps,feature,layer,name,tracer,logger, optionalauditLog) with full unit tests covering both audit and no-audit paths, brand presence assertions viaisInstrumented/isCaptured/isAudited, container binding, and idempotent re-bind; all gates pass on this single commit.