refactor: hard-fork GSD -> MSD (Make Software Done)

Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
This commit is contained in:
Jakub Zych
2026-10-06 01:47:40 +02:00
parent fe069b2a56
commit a9a7a328e6
2763 changed files with 78465 additions and 78434 deletions

View File

@@ -83,12 +83,12 @@ const ROOT = path.resolve(__dirname, '..');
// C:\Windows\system32\bash.exe, the WSL bridge — measuring through that runs real Linux bash and
// reports a false clean. Put `C:\Program Files\Git\bin` first.
const HAS_BASH = process.platform !== 'win32';
const WORKFLOW_PATH = path.join(ROOT, 'gsd-core', 'workflows', 'code-review.md');
const PRE_PASS_STEP_PATH = path.join(ROOT, 'gsd-core', 'workflows', 'code-review', 'steps', 'structural-pre-pass.md');
const FIXER_PATH = path.join(ROOT, 'agents', 'gsd-code-fixer.md');
const REVIEWER_PATH = path.join(ROOT, 'agents', 'gsd-code-reviewer.md');
const EXECUTE_PHASE_PATH = path.join(ROOT, 'gsd-core', 'workflows', 'execute-phase.md');
const DISPOSITION_STEP_PATH = path.join(ROOT, 'gsd-core', 'workflows', 'execute-phase', 'steps', 'code-review-disposition.md');
const WORKFLOW_PATH = path.join(ROOT, 'msd-core', 'workflows', 'code-review.md');
const PRE_PASS_STEP_PATH = path.join(ROOT, 'msd-core', 'workflows', 'code-review', 'steps', 'structural-pre-pass.md');
const FIXER_PATH = path.join(ROOT, 'agents', 'msd-code-fixer.md');
const REVIEWER_PATH = path.join(ROOT, 'agents', 'msd-code-reviewer.md');
const EXECUTE_PHASE_PATH = path.join(ROOT, 'msd-core', 'workflows', 'execute-phase.md');
const DISPOSITION_STEP_PATH = path.join(ROOT, 'msd-core', 'workflows', 'execute-phase', 'steps', 'code-review-disposition.md');
// ---------------------------------------------------------------------------
// #4259: the T6 docs-parity site scan, hoisted out of the assertion so it can
@@ -208,7 +208,7 @@ describe('Bug 1 — compute_file_scope SUMMARY parser', () => {
assert.ok(helperStart !== -1 && helperEnd !== -1, 'extract_summary_files helper must be extractable');
const helper = src.slice(helperStart, helperEnd);
const dir = createTempDir('gsd-4461-adversarial-');
const dir = createTempDir('msd-4461-adversarial-');
try {
const sentinel = path.join(dir, 'MUST-NOT-EXIST');
// This directly executes the shipped helper's argv boundary. It does
@@ -612,12 +612,12 @@ describe('Bug 2 — present_results severity-label parser', () => {
// ---------------------------------------------------------------------------
// BUG 3 — fixer agent ID alphabet and filter sets must include BL-* alongside CR-*.
// ---------------------------------------------------------------------------
describe('Bug 3 — gsd-code-fixer BL-* inclusion in filter sets', () => {
describe('Bug 3 — msd-code-fixer BL-* inclusion in filter sets', () => {
test('finding_parser documents BL-\\d+ as Critical-tier-equivalent', () => {
const src = fs.readFileSync(FIXER_PATH, 'utf8');
const parserStart = src.indexOf('<finding_parser>');
const parserEnd = src.indexOf('</finding_parser>');
assert.ok(parserStart !== -1, 'gsd-code-fixer.md must have a <finding_parser> block');
assert.ok(parserStart !== -1, 'msd-code-fixer.md must have a <finding_parser> block');
const parserSection = src.slice(parserStart, parserEnd);
assert.ok(
parserSection.includes('BL-'),
@@ -629,7 +629,7 @@ describe('Bug 3 — gsd-code-fixer BL-* inclusion in filter sets', () => {
const src = fs.readFileSync(FIXER_PATH, 'utf8');
const stepStart = src.indexOf('<step name="parse_findings">');
const stepEnd = src.indexOf('</step>', stepStart);
assert.ok(stepStart !== -1, 'gsd-code-fixer.md must have a parse_findings step');
assert.ok(stepStart !== -1, 'msd-code-fixer.md must have a parse_findings step');
const stepSection = src.slice(stepStart, stepEnd);
assert.ok(
stepSection.includes('CR-* or BL-*') || stepSection.includes('CR-* and BL-*'),
@@ -667,15 +667,15 @@ describe('Bug 3 — gsd-code-fixer BL-* inclusion in filter sets', () => {
});
// ---------------------------------------------------------------------------
// REVIEWER CONTRACT — gsd-code-reviewer.md must acknowledge BL-/blocker: as
// REVIEWER CONTRACT — msd-code-reviewer.md must acknowledge BL-/blocker: as
// an accepted alternative to CR-/critical: (tier-equivalent).
// ---------------------------------------------------------------------------
describe('Reviewer contract — gsd-code-reviewer.md label-equivalence', () => {
describe('Reviewer contract — msd-code-reviewer.md label-equivalence', () => {
test('write_review step documents blocker: as accepted alternative to critical:', () => {
const src = fs.readFileSync(REVIEWER_PATH, 'utf8');
const stepStart = src.indexOf('<step name="write_review">');
const stepEnd = src.indexOf('</step>', stepStart);
assert.ok(stepStart !== -1, 'gsd-code-reviewer.md must have a write_review step');
assert.ok(stepStart !== -1, 'msd-code-reviewer.md must have a write_review step');
const stepSection = src.slice(stepStart, stepEnd);
assert.ok(
stepSection.includes('blocker'),
@@ -700,7 +700,7 @@ describe('Reviewer contract — gsd-code-reviewer.md label-equivalence', () => {
// SUMMARY.md key-files entries BEFORE the "Filter deleted files" existence
// check. Bash only tilde-expands a literal `~` written in source text, never
// one arriving as the value of an already-expanded variable — so a real file
// recorded as `~/.claude/gsd-core/workflows/verify-phase.md` was silently
// recorded as `~/.claude/msd-core/workflows/verify-phase.md` was silently
// misclassified as deleted and dropped from REVIEW_FILES, and a phase whose
// every recorded file used a `~/...` path hit the empty-scope skip
// ("No source files changed ... Skipping review.") as a false negative.
@@ -796,10 +796,10 @@ describe('Bug 4 (#2352) — compute_file_scope tilde-path expansion', () => {
let tmpHome;
test('setup: plant a fresh HOME with a real file', { skip: process.platform === 'win32' }, () => {
tmpHome = createTempDir('gsd-2352-home-');
fs.mkdirSync(path.join(tmpHome, '.claude', 'gsd-core', 'workflows'), { recursive: true });
tmpHome = createTempDir('msd-2352-home-');
fs.mkdirSync(path.join(tmpHome, '.claude', 'msd-core', 'workflows'), { recursive: true });
fs.writeFileSync(
path.join(tmpHome, '.claude', 'gsd-core', 'workflows', 'verify-phase.md'),
path.join(tmpHome, '.claude', 'msd-core', 'workflows', 'verify-phase.md'),
'# real file\n',
'utf8'
);
@@ -809,11 +809,11 @@ describe('Bug 4 (#2352) — compute_file_scope tilde-path expansion', () => {
'AC1: a ~/-prefixed path to a real file survives and is not counted deleted',
{ skip: process.platform === 'win32' },
() => {
const result = runPostProcessing(tmpHome, ['~/.claude/gsd-core/workflows/verify-phase.md']);
const result = runPostProcessing(tmpHome, ['~/.claude/msd-core/workflows/verify-phase.md']);
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
assert.match(
result.stdout,
new RegExp(path.join(tmpHome, '.claude', 'gsd-core', 'workflows', 'verify-phase.md').replace(/[/\\.]/g, '\\$&')),
new RegExp(path.join(tmpHome, '.claude', 'msd-core', 'workflows', 'verify-phase.md').replace(/[/\\.]/g, '\\$&')),
`expected expanded absolute path in surviving REVIEW_FILES; got: ${JSON.stringify(result.stdout)}`
);
assert.match(result.stdout, /DELETED_COUNT=0/, `expected DELETED_COUNT=0; got: ${JSON.stringify(result.stdout)}`);
@@ -829,7 +829,7 @@ describe('Bug 4 (#2352) — compute_file_scope tilde-path expansion', () => {
'AC2: a ~/-prefixed path to a non-existent file is still correctly excluded as deleted',
{ skip: process.platform === 'win32' },
() => {
const result = runPostProcessing(tmpHome, ['~/.claude/gsd-core/workflows/does-not-exist.md']);
const result = runPostProcessing(tmpHome, ['~/.claude/msd-core/workflows/does-not-exist.md']);
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
assert.match(result.stdout, /DELETED_COUNT=1/, `expected DELETED_COUNT=1; got: ${JSON.stringify(result.stdout)}`);
assert.match(
@@ -844,7 +844,7 @@ describe('Bug 4 (#2352) — compute_file_scope tilde-path expansion', () => {
'AC3: a phase where every recorded file is a real ~/-prefixed path does not empty the scope',
{ skip: process.platform === 'win32' },
() => {
const result = runPostProcessing(tmpHome, ['~/.claude/gsd-core/workflows/verify-phase.md']);
const result = runPostProcessing(tmpHome, ['~/.claude/msd-core/workflows/verify-phase.md']);
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
const countMatch = result.stdout.match(/REVIEW_FILES_COUNT=(\d+)/);
assert.ok(countMatch, `expected a REVIEW_FILES_COUNT line; got: ${JSON.stringify(result.stdout)}`);
@@ -860,7 +860,7 @@ describe('Bug 4 (#2352) — compute_file_scope tilde-path expansion', () => {
{ skip: process.platform === 'win32' },
() => {
const result = runPostProcessing(tmpHome, [
'~/.claude/gsd-core/workflows/verify-phase.md',
'~/.claude/msd-core/workflows/verify-phase.md',
'this/relative/path/does-not-exist.md',
]);
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
@@ -934,18 +934,18 @@ function extractSpawnReviewerDerivation() {
// carries markdown-escaped quotes (\") in this fence — an authoring
// artifact that survived #2994 fragmentization verbatim; the runtime agent
// normalizes them when transcribing, so the test does the same before
// executing. Sliced from FALLOW_SCOPE_ARGS=() (skipping the gsd-tools
// executing. Sliced from FALLOW_SCOPE_ARGS=() (skipping the msd-tools
// runtime resolver line above it, which exits 1 on machines without an
// installed gsd-tools and is orthogonal to the base-derivation under test)
// to just before the gsd_run invocation (which needs the real binary).
// installed msd-tools and is orthogonal to the base-derivation under test)
// to just before the msd_run invocation (which needs the real binary).
function extractFallowDerivation() {
const src = readFileNormalized(PRE_PASS_STEP_PATH);
const fence = fenceContaining(src, 'FALLOW_PHASE_START=$(git log');
const scopeStart = fence.indexOf('FALLOW_SCOPE_ARGS=()');
assert.ok(scopeStart !== -1, 'fallow fence must define FALLOW_SCOPE_ARGS=()');
const cut = fence.indexOf('gsd_run run-with-timeout');
assert.ok(cut !== -1, 'fallow fence must contain the gsd_run run-with-timeout call');
assert.ok(scopeStart < cut, 'FALLOW_SCOPE_ARGS must precede the gsd_run invocation');
const cut = fence.indexOf('msd_run run-with-timeout');
assert.ok(cut !== -1, 'fallow fence must contain the msd_run run-with-timeout call');
assert.ok(scopeStart < cut, 'FALLOW_SCOPE_ARGS must precede the msd_run invocation');
return fence.slice(scopeStart, cut).replace(/\\"/g, '"');
}
@@ -1005,7 +1005,7 @@ function parseSentinel(stdout, name) {
// `--grep="${PADDED_PHASE}"`, whose oldest substring match is routinely a
// version-string/date commit from months before the phase existed.
// (#3503 later replaced the anchor itself — a subject-line conventional-
// commit scope match instead of the "[Pp]hase N" prose phrase, which GSD's
// commit scope match instead of the "[Pp]hase N" prose phrase, which MSD's
// own commits never contain; see Bug 6. The lockstep + portability +
// fail-closed contract THIS block verifies is unchanged.)
//
@@ -1069,7 +1069,7 @@ describe('Bug 5 (#3191) — same anchored, portable phase-scope grep at all thre
'T1 + T4: Tier-3 derivation matches ONLY the phase\'s real scope commit — never a digit-substring or superset hit',
SKIP_WIN32,
() => {
const { repo, hashes } = buildFixture('gsd-3191-tier3-', 'docs(06): capture phase context');
const { repo, hashes } = buildFixture('msd-3191-tier3-', 'docs(06): capture phase context');
try {
const result = runDerivation(repo, extractTier3Derivation(), '06');
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
@@ -1098,7 +1098,7 @@ describe('Bug 5 (#3191) — same anchored, portable phase-scope grep at all thre
'T2: spawn_reviewer DIFF_BASE derivation uses the same anchored grep (not the bare digit)',
SKIP_WIN32,
() => {
const { repo, hashes } = buildFixture('gsd-3191-spawn-', 'docs(06): capture phase context');
const { repo, hashes } = buildFixture('msd-3191-spawn-', 'docs(06): capture phase context');
try {
const result = runDerivation(repo, extractSpawnReviewerDerivation(), '06');
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
@@ -1127,7 +1127,7 @@ describe('Bug 5 (#3191) — same anchored, portable phase-scope grep at all thre
'T3: fallow phase scope derives --changed-since from the anchored grep, never an old substring match',
SKIP_WIN32,
() => {
const { repo, hashes } = buildFixture('gsd-3191-fallow-', 'docs(06): capture phase context');
const { repo, hashes } = buildFixture('msd-3191-fallow-', 'docs(06): capture phase context');
try {
const result = runDerivation(repo, extractFallowDerivation(), '06');
assert.equal(result.status, 0, `snippet exited ${result.status}; stderr=${result.stderr}`);
@@ -1150,7 +1150,7 @@ describe('Bug 5 (#3191) — same anchored, portable phase-scope grep at all thre
'root commit: fallow phase scope uses a resolvable root SHA',
SKIP_WIN32,
() => {
const repo = createTempDir('gsd-4183-fallow-root-');
const repo = createTempDir('msd-4183-fallow-root-');
try {
gitOrThrow(['init', '-b', 'main'], { cwd: repo, timeoutMs: GIT_TIMEOUT_MS });
gitOrThrow(['config', 'user.email', 'test@test.com'], { cwd: repo, timeoutMs: GIT_TIMEOUT_MS });
@@ -1183,8 +1183,8 @@ describe('Bug 5 (#3191) — same anchored, portable phase-scope grep at all thre
);
if (process.env.CI) {
const { requireFallowBinary } = require('../gsd-core/bin/lib/fallow-runner.cjs');
const { execTool } = require('../gsd-core/bin/lib/shell-command-projection.cjs');
const { requireFallowBinary } = require('../msd-core/bin/lib/fallow-runner.cjs');
const { execTool } = require('../msd-core/bin/lib/shell-command-projection.cjs');
const audit = execTool(
requireFallowBinary({ cwd: ROOT, envPath: '' }),
['audit', '--changed-since', fallowBase[0], '--format', 'json'],
@@ -1203,7 +1203,7 @@ describe('Bug 5 (#3191) — same anchored, portable phase-scope grep at all thre
'T5: with no genuine phase scope commit, every derivation yields NO base (fail-closed preserved)',
SKIP_WIN32,
() => {
const { repo } = buildFixture('gsd-3191-closed-', 'feat: scanner core', { skipPhaseDir: true }); // no committed phase dir anywhere
const { repo } = buildFixture('msd-3191-closed-', 'feat: scanner core', { skipPhaseDir: true }); // no committed phase dir anywhere
try {
for (const [label, snippet] of [
['tier3', extractTier3Derivation()],
@@ -1400,7 +1400,7 @@ describe('Bug 6 (#3503/#3995) — diff base keys on the phase directory, not com
'T1: prose forward-references and doc-format examples never capture the base — it resolves to the phase dir first commit at all three sites',
SKIP_WIN32,
() => {
const { repo, hashes } = buildHistory('gsd-3503-scope-', REPRO_HISTORY);
const { repo, hashes } = buildHistory('msd-3503-scope-', REPRO_HISTORY);
try {
const sites = [
['tier3', extractTier3Derivation()],
@@ -1438,7 +1438,7 @@ describe('Bug 6 (#3503/#3995) — diff base keys on the phase directory, not com
'T2: subject spellings are irrelevant to the directory anchor — unpadded and padded histories resolve identically',
SKIP_WIN32,
() => {
const { repo, hashes } = buildHistory('gsd-3503-unpadded-', [
const { repo, hashes } = buildHistory('msd-3503-unpadded-', [
['c1.txt', 'feat(60-01): probe wiring', 'Deferred to Phase 06 per D-09.'],
[PHASE06_PLAN_REL, 'docs(phase-6): capture phase context'],
['c3.txt', 'feat(6-01): implement scanner core'],
@@ -1472,7 +1472,7 @@ describe('Bug 6 (#3503/#3995) — diff base keys on the phase directory, not com
'T3: no committed phase dir fails closed (no silent arbitrary base)',
SKIP_WIN32,
() => {
const { repo } = buildHistory('gsd-3503-closed-', [
const { repo } = buildHistory('msd-3503-closed-', [
['c1.txt', 'chore: bump to v2.06.0'],
['c2.txt', 'feat(60-01): probe wiring', 'Deferred to Phase 06 per D-09.'],
['c3.txt', 'docs(06): capture phase context'],
@@ -1508,7 +1508,7 @@ describe('Bug 6 (#3503/#3995) — diff base keys on the phase directory, not com
() => {
const oldMilestonePhase = path.join('.planning', 'milestones', 'v1.1-phases', '02-old', '02-PLAN.md');
const currentPhase = path.join('.planning', 'phases', '02-ctx', '02-PLAN.md');
const { repo, hashes } = buildHistory('gsd-3995-milestone-', [
const { repo, hashes } = buildHistory('msd-3995-milestone-', [
[oldMilestonePhase, 'feat(02-01): research-project command, workflow, and template'],
['mid.txt', 'chore: close milestone v1.1'],
[currentPhase, 'feat(02-01): current milestone phase 02 plan 01'],
@@ -1542,7 +1542,7 @@ describe('Bug 6 (#3503/#3995) — diff base keys on the phase directory, not com
// ---------------------------------------------------------------------------
// #4209 Phase 1 Plan 3 (Task 2) — external reviewer evidence consolidation.
// gsd-code-reviewer.md must treat <external_reviewer_evidence> as untrusted
// msd-code-reviewer.md must treat <external_reviewer_evidence> as untrusted
// input: independently re-verify every claim against the actual current
// source before it can appear in REVIEW.md, fold a verified claim into the
// SAME Narrative Findings section (no second schema), and never let text
@@ -1600,7 +1600,7 @@ describe('CONS-01..03 — external reviewer evidence consolidation (#4209)', ()
const src = fs.readFileSync(REVIEWER_PATH, 'utf8');
const rulesStart = src.indexOf('<critical_rules>');
const rulesEnd = src.indexOf('</critical_rules>');
assert.ok(rulesStart !== -1 && rulesEnd !== -1, 'gsd-code-reviewer.md must have a critical_rules section');
assert.ok(rulesStart !== -1 && rulesEnd !== -1, 'msd-code-reviewer.md must have a critical_rules section');
const rulesSection = src.slice(rulesStart, rulesEnd);
assert.ok(/external_reviewer_evidence|external reviewer/i.test(rulesSection),
'critical_rules must restate the external-evidence-is-untrusted contract');
@@ -1745,7 +1745,7 @@ function shippedDispositionScript() {
// Run the shipped script against a temp phase dir and return the ledger it wrote (or null).
function runShippedDisposition({ reviewText, priorText, fixText, iterFixText, padded = '01', reviewTotal }) {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3829-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3829-'));
try {
const reviewPath = path.join(dir, padded + '-REVIEW.md');
const dispPath = path.join(dir, padded + '-REVIEW-DISPOSITION.md');
@@ -1973,7 +1973,7 @@ describe('#3829 — code_review_gate per-finding disposition record', () => {
// went red when path construction moved to a VALIDATED local -- while the property it names,
// "a REVIEW-DISPOSITION sibling", was untouched. Assert the property: the ledger lands beside
// the review, under the derived name, and REVIEW.md itself is not written.
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-sib-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-sib-'));
try {
const reviewPath = path.join(dir, '02-REVIEW.md');
const reviewText = ['---', 'status: issues_found', '---', '', '### CR-01: a finding'].join('\n');
@@ -1992,7 +1992,7 @@ describe('#3829 — code_review_gate per-finding disposition record', () => {
assert.ok(fs.existsSync(path.join(dir, '02-REVIEW-DISPOSITION.md')),
'code_review_gate must write the disposition record to a REVIEW-DISPOSITION sibling');
assert.strictEqual(fs.readFileSync(reviewPath, 'utf8'), reviewText,
'and must not write into REVIEW.md — gsd-code-reviewer is its single writer');
'and must not write into REVIEW.md — msd-code-reviewer is its single writer');
} finally {
cleanup(dir);
}
@@ -2015,7 +2015,7 @@ describe('#3829 — code_review_gate per-finding disposition record', () => {
// every other docs-parity assertion here could pass against a file nothing loads.
const parent = fs.readFileSync(EXECUTE_PHASE_PATH, 'utf8');
assert.ok(
/Read and execute\s+`gsd-core\/workflows\/execute-phase\/steps\/code-review-disposition\.md`/.test(parent),
/Read and execute\s+`msd-core\/workflows\/execute-phase\/steps\/code-review-disposition\.md`/.test(parent),
'code_review_gate must read and execute the disposition step'
);
assert.ok(
@@ -2172,7 +2172,7 @@ describe('#3829 review round — frontmatter scoping, section anchoring, ledger
});
describe('#3861 round 2 — the disposition ledger is reachable in a shipped path (B1c/B1d)', () => {
const FIX_WORKFLOW = path.join(ROOT, 'gsd-core', 'workflows', 'code-review-fix.md');
const FIX_WORKFLOW = path.join(ROOT, 'msd-core', 'workflows', 'code-review-fix.md');
test('code-review-fix.md reads and executes the disposition step after committing the fix report', () => {
// Without this the reconciliation logic -- the bulk of the step and nearly all of its test
@@ -2182,7 +2182,7 @@ describe('#3861 round 2 — the disposition ledger is reachable in a shipped pat
const src = fs.readFileSync(FIX_WORKFLOW, 'utf8');
assert.match(src, /<step name="record_disposition">/,
'the fix workflow must carry a step that records the disposition');
assert.match(src, /gsd-core\/workflows\/execute-phase\/steps\/code-review-disposition\.md/,
assert.match(src, /msd-core\/workflows\/execute-phase\/steps\/code-review-disposition\.md/,
'and it must invoke the SAME step, not a second copy of the logic');
// Ordering is load-bearing: the fix report must be on disk before the ledger claims anything
// about it. Assert the step positions rather than merely their presence.
@@ -2875,7 +2875,7 @@ describe('#4665 — check_empty_scope --fix recovery onto an existing REVIEW.md'
'the recovery must name the fresh-review steps it skips (no reviewer spawn, nothing to commit)'
);
assert.doesNotMatch(
block, /spawn the (reviewer|agent)|gsd-code-reviewer/,
block, /spawn the (reviewer|agent)|msd-code-reviewer/,
'the recovery must not contain an instruction to spawn a fresh reviewer'
);
});
@@ -3054,7 +3054,7 @@ describe('#3861 round 2 — the shell-sharing guard, EXECUTED', () => {
for (const [phaseNumber, padded] of [[intPhase, pad(intPhase)], [dotPhase, pad(dotPhase)]]) {
test('block 2 derives its own paths and writes the ledger for phase ' + phaseNumber,
{ skip: !HAS_BASH }, () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-blk2-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-blk2-'));
const drawn = ' (drawn phase ' + phaseNumber + ' -> ' + padded + ')';
try {
fs.writeFileSync(path.join(dir, padded + '-REVIEW.md'),
@@ -3121,7 +3121,7 @@ describe('#3861 round 2 — the shell-sharing guard, EXECUTED', () => {
// every lane and euid, so it reaches the same non-reporting arm without depending on
// permission bits at all. See the two tests at the end of this describe.
function runShippedGateCounts({ reviewText, padded = '01', writeReview = true, mode, phaseNumber, plantDir = false, extraEnv = {} }) {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-'));
try {
const reviewPath = path.join(dir, padded + '-REVIEW.md');
if (plantDir) fs.mkdirSync(reviewPath);
@@ -3195,7 +3195,7 @@ function renderGateMessage(counts, phaseNumber) {
const head = ok
? `Code review: ${counts.total} findings — ${counts.critical} critical, ${counts.warning} warning, ${counts.info} info.`
: 'Code review found issues.';
return head + '\n' + `Consider running: /gsd:code-review ${phaseNumber} --fix` + '\n';
return head + '\n' + `Consider running: /msd:code-review ${phaseNumber} --fix` + '\n';
}
describe('#3861 round 2 — the ledger write refuses a non-regular file', () => {
@@ -3207,7 +3207,7 @@ describe('#3861 round 2 — the ledger write refuses a non-regular file', () =>
// FIFO -> readFileSync BLOCKED FOREVER, in a gate documented as never blocking;
// directory -> the write throws.
const mkPhase = () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-nrf-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-nrf-'));
fs.writeFileSync(path.join(dir, '03-REVIEW.md'),
['---', 'status: issues_found', '---', '', '### CR-01: a finding'].join('\n'));
return dir;
@@ -3671,7 +3671,7 @@ describe('#3861 round 1 — the counts mirror is asserted against the shipped sh
// `splitLines`, not `split('\n')`: the repo's own lint bans the latter on readFileSync content
// (DEFECT.WINDOWS-CRLF-TEST-PORTABILITY), and a CRLF checkout would otherwise leave a stray
// `\r` on every line here.
const { splitLines } = require('../gsd-core/bin/lib/text-lines.cjs');
const { splitLines } = require('../msd-core/bin/lib/text-lines.cjs');
const step = fs.readFileSync(DISPOSITION_STEP_PATH, 'utf8');
const offenders = [];
splitLines(step).forEach((line, i) => {
@@ -3705,7 +3705,7 @@ describe('#3861 round 1 — the counts mirror is asserted against the shipped sh
const shipped = runShippedGateCounts({ reviewText: FIXTURES['a zero-finding review'] });
assert.strictEqual(shipped.stdout,
'Code review: 0 findings \u2014 0 critical, 0 warning, 0 info.\n'
+ 'Consider running: /gsd:code-review 1 --fix\n',
+ 'Consider running: /msd:code-review 1 --fix\n',
'all four counts are numeric, so the breakdown is reported rather than withheld');
});
@@ -3858,7 +3858,7 @@ describe('#3861 round 11 — a malformed report does not read as clean in the co
interpreter: 'bash', timeoutMs: PROBE_TIMEOUT_MS,
env: { ...process.env, PHASE_DIR: dir, PHASE_NUMBER: String(Number(padded)) },
});
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-unparsed-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-unparsed-'));
try {
// No REVIEW.md, no ledger, no fix report -> skipped (status: none)
let res = runBlock2(dir, '01');
@@ -3899,7 +3899,7 @@ describe('#3861 round 12 — block 2 does not compute a shortfall from a self-co
});
};
const drive = (fm, status) => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-r12-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-r12-'));
try {
const body = status === undefined ? review(fm)
: review(fm).replace('status: issues_found', 'status: ' + status);
@@ -4069,7 +4069,7 @@ describe('#3861 round 12 — block 2 does not compute a shortfall from a self-co
// #3861 round 1 — Minor 5, and the finding-id census the review did not ask for
// ---------------------------------------------------------------------------
const REVIEWER_AGENT_PATH = path.join(ROOT, 'agents', 'gsd-code-reviewer.md');
const REVIEWER_AGENT_PATH = path.join(ROOT, 'agents', 'msd-code-reviewer.md');
// The alternations the shipped script uses to recognise a finding id. There are three —
// the heading matcher, the ledger row re-parser, and the frontmatter `- id:` matcher —
@@ -4114,7 +4114,7 @@ describe('#3861 round 1 — stale fix reports are stated, not silently ignored',
});
test('a title differing only in INTRA-LINE whitespace still reconciles (m2)', () => {
// gsd-code-fixer.md writes '### {finding_id}: {title}' under no contract that the title is
// msd-code-fixer.md writes '### {finding_id}: {title}' under no contract that the title is
// copied byte-for-byte, so a fixer that re-spaces a title used to produce a spurious note and
// leave a genuinely-fixed row 'open'. Runs of spaces carry no information; they are collapsed.
// NAMED PRECISELY. An earlier version of this test called itself the "reflowed" case while
@@ -4205,7 +4205,7 @@ describe('#3861 round 1 — finding-id prefix census', () => {
});
test('the prefix set covers every id shape the reviewer agent emits', () => {
// The DOMAIN is owned elsewhere — gsd-code-reviewer.md's body template and its
// The DOMAIN is owned elsewhere — msd-code-reviewer.md's body template and its
// Label-equivalence paragraph — so it can acquire a member without this script
// changing. An unlisted prefix is not mis-tiered, it is INVISIBLE: the finding
// never enters the order list and gets no row at all.
@@ -4337,7 +4337,7 @@ describe('#3861 round 1 — the tests must run what BASH would run', () => {
const end = body.indexOf('\n" || echo ');
assert.ok(end !== -1, 'the node -e script must still be closed by its || echo fallback');
const quoted = body.slice(0, end);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-fid-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-fid-'));
try {
const out = path.join(dir, 'arg.txt');
// `printf %s` with the SAME double-quoted string the step uses: whatever bash does to it
@@ -4363,14 +4363,14 @@ describe('#3861 round 1 — the tests must run what BASH would run', () => {
// all, so a test written against it says nothing about the guard: it passed unchanged with the
// guard made unconditional, which is exactly the vacuity this helper exists to remove.
function runDispositionGuard({ reviewText, withLedger, withFix, withIterFix }) {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-grd-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-grd-'));
try {
fs.writeFileSync(path.join(dir, '01-REVIEW.md'), reviewText);
if (withLedger) fs.writeFileSync(path.join(dir, '01-REVIEW-DISPOSITION.md'), '| CR-01 | critical | deferred | x |\n');
if (withFix) fs.writeFileSync(path.join(dir, '01-REVIEW-FIX.md'), '## Fixed Issues\n\n### CR-01: a thing\n');
if (withIterFix) fs.writeFileSync(path.join(dir, '01-REVIEW-FIX.iter2.md'), '## Fixed Issues\n\n### CR-01: a thing\n');
const fence = bashFences(fs.readFileSync(DISPOSITION_STEP_PATH, 'utf8'))[1];
const cut = fence.indexOf('_GSD_SHIM_NAME=');
const cut = fence.indexOf('_MSD_SHIM_NAME=');
assert.ok(cut > 0, 'the disposition block must still open with its guard, then the shim');
const script = 'set -euo pipefail\n' + fence.slice(0, cut) + '\nprintf "PROCEEDED\\n"\n';
const res = runHook('-c', [script], {
@@ -4406,7 +4406,7 @@ describe('#3861 round 1 — the tests must run what BASH would run', () => {
});
// #3861 round 5 — a converged `--auto` run reaches the guard with a CLEAN review and, on a direct
// /gsd-code-review invocation, no gate-written ledger. Keying the skip on the ledger alone meant a
// /msd-code-review invocation, no gate-written ledger. Keying the skip on the ledger alone meant a
// fully successful multi-iteration run — every finding fixed and committed — recorded nothing at all.
test('a clean review with NO ledger but a fix report still proceeds', { skip: !HAS_BASH }, () => {
const out = runDispositionGuard({ reviewText: ['---', 'status: clean', '---'].join('\n'), withFix: true });
@@ -4753,7 +4753,7 @@ describe('#3861 round 1 — an absent review still reconciles', () => {
// The status guard proceeds when a ledger exists, so the script must tolerate the review
// being gone: reading it unconditionally threw, the trailing fallback swallowed it, and the
// ledger was left frozen — the exact freeze the reconciliation path exists to prevent.
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3861-abs-'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3861-abs-'));
try {
const dispPath = path.join(dir, '01-REVIEW-DISPOSITION.md');
fs.writeFileSync(dispPath, ['| CR-01 | critical | deferred | waiting on ADR-9 |',
@@ -4828,8 +4828,8 @@ describe('#3861 round 1 — fence closers and one-letter prefixes', () => {
// ---------------------------------------------------------------------------
describe('#3829 — the step\'s REVIEW.md lookup resolves a letter-suffixed phase without a shell re-pad', () => {
const { execFileSync } = require('node:child_process');
const { splitLines } = require('../gsd-core/bin/lib/text-lines.cjs');
const { normalizePhaseName } = require('../gsd-core/bin/lib/phase-id.cjs');
const { splitLines } = require('../msd-core/bin/lib/text-lines.cjs');
const { normalizePhaseName } = require('../msd-core/bin/lib/phase-id.cjs');
/**
* Pure: the indexes of every line containing `anchor`. Asserts the count so a site that is