Files
bmad-code-org__bmad-method/test/test-template-sync.js
pbean 24bc95c488 feat(skills): one deferred-work ledger contract, shared by build and code review
Add references/deferred-work-entry.md — byte-identical in bmad-build and
bmad-code-review, pinned by test-template-sync — as the single way to
write the deferred-work ledger: read the whole file first; an open match
on location and substance gets a seen-again line instead of a new entry;
a closed match gets a new entry naming the closed id; entries are native
### DW-<n> blocks with origin, location, source_spec, severity, a
two-sentence reason, and status: open; ids are minted from the highest
existing and existing lines are never rewritten. The four bmad-build
write sites and bmad-code-review's present step point at it; the
"## Deferred from: code review" heading shape is gone.

bmad-code-review: the Blind Hunter drops its ten-finding floor; step-01
loads the spec's prior review record and open ledger entries as triage
input; step-03 carries forward verdicts for unchanged code, verifies from
cited evidence, treats undemonstrated findings as false, routes
out-of-scope findings on their merits, makes patch a locality test and
defer a five-part test, and keeps an ambiguous fix at decision_needed
even without a spec — the user is present. Story-file defer bullets carry
their DW id.

Docs: build-a-change describes the ledger contract, dedupe, and
carry-forward and no longer suggests one fresh run per entry;
review-a-change describes the five-way verdict instead of the retired
dismiss and assign-severity steps. Renderer test asserts the reference is
published and referenced from every write site.
2026-08-30 16:44:07 -07:00

52 lines
1.7 KiB
JavaScript

/**
* Cross-skill vendored-copy sync check.
*
* Skills must not reach into each other's directories (PATH-05 in
* tools/skill-validator.md), so a contract two skills share is vendored into
* each. This repo-level check keeps every vendored copy byte-identical to its
* source so the contract cannot drift:
*
* - The sprint-status template: bmad-sprint-planning owns the source of truth,
* and bmad-retrospective's tests round-trip a vendored copy.
* - The deferred-work ledger entry contract: bmad-build owns the source, and
* bmad-code-review writes the same ledger from a vendored copy.
*/
const fs = require('node:fs');
const path = require('node:path');
const root = path.join(__dirname, '..');
const pairs = [
{
label: 'sprint-status template fixture',
source: 'src/bmm-skills/plan/bmad-sprint-planning/sprint-status-template.yaml',
copy: 'src/bmm-skills/ship/bmad-retrospective/scripts/tests/fixtures/sprint-status-template.yaml',
},
{
label: 'deferred-work entry contract',
source: 'src/bmm-skills/ship/bmad-build/references/deferred-work-entry.md',
copy: 'src/bmm-skills/ship/bmad-code-review/references/deferred-work-entry.md',
},
];
let failed = false;
for (const { label, source, copy } of pairs) {
const sourceText = fs.readFileSync(path.join(root, source), 'utf-8');
const copyText = fs.readFileSync(path.join(root, copy), 'utf-8');
if (sourceText !== copyText) {
failed = true;
console.error(`FAIL: ${label} is out of sync.`);
console.error(` source: ${source}`);
console.error(` copy: ${copy}`);
console.error(' Copy the source over the copy to resolve.');
continue;
}
console.log(`ok: ${label} matches its source`);
}
if (failed) process.exit(1);