You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(spec): build-docs uses the shared generated-output sink
#3138 extracted the emit()/manageDir()/flush() sink to lib/generated-output.ts and
moved build-skill-references + build-react-blocks-contract onto it, but left
build-docs.ts carrying the inline original: #3126 was rewriting the same file at the
time and the migration would have conflicted. #3126 has landed, so collect the debt.
Two copies of a check/write sink is the one duplication this design cannot afford —
its whole claim is that --check and write are the same code, and that claim is per
copy. A fix to one (say the empty-dir prune #3138 added) silently leaves the other
behind, and the failure mode is a gate that passes on output a real run would not
produce.
Adds wasEmitted() to the shared sink. build-docs is the first caller whose later
output depends on its earlier output — each category index links only the pages that
got generated — and that question belongs to the sink: it already owns the emitted
map, and having the caller keep a second copy would fork the state the sink exists to
consolidate. The other two callers are unaffected (new export, no signature change).
The guard moves from an inline `managedDirs.size === 0` to flush()'s guard hook,
keeping the same meaning: json-schema/ is gitignored, so a fresh checkout that skips
gen:schema emits almost nothing and "nothing differs" would read as success.
Pure refactor, verified rather than assumed:
- regenerating produces byte-identical output — all 258 files, tree stays clean
- all five drift classes still fail: stale content, missing page, stale leftover,
no-schema guard, plus in-sync staying green
- both existing sink callers regress clean, including #3138's reverse test that a
hand-written .md in skills/*/references/ keeps the gate green and survives a write
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments