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

@@ -33,7 +33,7 @@
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const core = require('../gsd-core/bin/lib/phase-id.cjs');
const core = require('../msd-core/bin/lib/phase-id.cjs');
const B = core.PHASE_HEADING_BASELINE;
// ─── Base spellings, transcribed by hand from d04592de ─────────────────────
@@ -209,7 +209,7 @@ describe('#612 PR-2: the reviewer counterexamples, under each convention', () =>
});
test('a legacy repo still reads its own real headings', () => {
const doc = '### Phase 5: Real\n### [GSD] Phase 2-01: Legacy\n#### Phase Details:';
const doc = '### Phase 5: Real\n### [MSD] Phase 2-01: Legacy\n#### Phase Details:';
assert.deepEqual(scan(core.phaseHeadingPrefixSrcFor(B.ANY_BRACKET, null), doc), ['5', '2-01', 'Details']);
});
@@ -237,8 +237,8 @@ describe('#612 PR-2: a label-only site never gains any-bracket tolerance', () =>
return out;
};
test('`[GSD] Phase 2-01` stays unmatched under BOTH conventions', () => {
const doc = '- [x] **[GSD] Phase 2-01: Legacy**';
test('`[MSD] Phase 2-01` stays unmatched under BOTH conventions', () => {
const doc = '- [x] **[MSD] Phase 2-01: Legacy**';
assert.deepEqual(bullets(core.phaseHeadingPrefixSrcFor(B.LABEL_ONLY, null), doc), []);
assert.deepEqual(bullets(core.phaseHeadingPrefixSrcFor(B.LABEL_ONLY, 'bracket'), doc), [],
'the bracket convention widens to bracket IDs, not to arbitrary bracket text');
@@ -250,7 +250,7 @@ describe('#612 PR-2: a label-only site never gains any-bracket tolerance', () =>
});
test('a bracket repo does admit the bracket-ID form at a label-only site', () => {
const doc = '- [ ] **[GSD.02] 05: Real**';
const doc = '- [ ] **[MSD.02] 05: Real**';
assert.deepEqual(bullets(core.phaseHeadingPrefixSrcFor(B.LABEL_ONLY, null), doc), []);
assert.deepEqual(bullets(core.phaseHeadingPrefixSrcFor(B.LABEL_ONLY, 'bracket'), doc), ['05']);
});
@@ -260,39 +260,39 @@ describe('#612 PR-2: a label-only site never gains any-bracket tolerance', () =>
describe('#612 PR-2: one bracket identity grammar, one width rule', () => {
test('the three former spellings now agree on the 1-digit-milestone family', () => {
// `GSD.2-05-feature` used to have a qualified key and a token but not be a
// `MSD.2-05-feature` used to have a qualified key and a token but not be a
// phase directory, depending on which private spelling a caller reached.
assert.equal(core.bracketQualifiedKey('GSD.2-05-feature', 'bracket'), null);
assert.equal(core.extractPhaseToken('GSD.2-05-feature', 'bracket'), 'GSD.2-05-feature');
assert.ok(!new RegExp(`^${core.BRACKET_DIR_PREFIX_SRC}`, 'i').test('GSD.2-05-feature'));
assert.equal(core.bracketQualifiedKey('MSD.2-05-feature', 'bracket'), null);
assert.equal(core.extractPhaseToken('MSD.2-05-feature', 'bracket'), 'MSD.2-05-feature');
assert.ok(!new RegExp(`^${core.BRACKET_DIR_PREFIX_SRC}`, 'i').test('MSD.2-05-feature'));
});
test('the canonical padded forms resolve identically everywhere', () => {
assert.equal(core.bracketQualifiedKey('GSD.02-05-feature', 'bracket'), 'GSD.2-5');
assert.equal(core.extractPhaseToken('GSD.02-05-feature', 'bracket'), '05');
assert.ok(new RegExp(`^${core.BRACKET_DIR_PREFIX_SRC}`, 'i').test('GSD.02-05-feature'));
assert.equal(core.bracketQualifiedKey('MSD.02-05-feature', 'bracket'), 'MSD.2-5');
assert.equal(core.extractPhaseToken('MSD.02-05-feature', 'bracket'), '05');
assert.ok(new RegExp(`^${core.BRACKET_DIR_PREFIX_SRC}`, 'i').test('MSD.02-05-feature'));
});
test('case folding: a lowercase bracket id passes every identity test', () => {
assert.equal(core.isSentinelPhaseId('gsd.999-01', 'bracket'), true, 'lowercase icebox is a sentinel');
assert.equal(core.isSentinelPhaseId('GSD.999-01', 'bracket'), true);
assert.equal(core.isSentinelPhaseId('gsd.00-01', 'bracket'), true);
assert.equal(core.isSentinelPhaseId('gsd.02-05', 'bracket'), false);
assert.equal(core.getMilestoneFromPhaseId('gsd.02-05', 'bracket'), 'v2.0');
assert.equal(core.isSentinelPhaseId('msd.999-01', 'bracket'), true, 'lowercase icebox is a sentinel');
assert.equal(core.isSentinelPhaseId('MSD.999-01', 'bracket'), true);
assert.equal(core.isSentinelPhaseId('msd.00-01', 'bracket'), true);
assert.equal(core.isSentinelPhaseId('msd.02-05', 'bracket'), false);
assert.equal(core.getMilestoneFromPhaseId('msd.02-05', 'bracket'), 'v2.0');
assert.equal(core.bracketQualifiedKey('ck.03-02', 'bracket'), 'CK.3-2');
});
test('sentinel milestones and their neighbours', () => {
for (const mm of ['00', '999']) {
assert.equal(core.isSentinelPhaseId(`GSD.${mm}-01`, 'bracket'), true, mm);
assert.equal(core.isSentinelPhaseId(`MSD.${mm}-01`, 'bracket'), true, mm);
}
for (const mm of ['01', '99', '100', '998', '1000']) {
assert.equal(core.isSentinelPhaseId(`GSD.${mm}-01`, 'bracket'), false, mm);
assert.equal(core.isSentinelPhaseId(`MSD.${mm}-01`, 'bracket'), false, mm);
}
// Widths toDir cannot emit are not bracket ids at all — pad2 never produces
// a bare `0`, and the emit validator rejects a leading-zero 3+ run.
for (const mm of ['0', '000', '0999', '002', '2']) {
assert.equal(core.isSentinelPhaseId(`GSD.${mm}-01`, 'bracket'), false, `${mm} is malformed`);
assert.equal(core.isSentinelPhaseId(`MSD.${mm}-01`, 'bracket'), false, `${mm} is malformed`);
}
});
@@ -303,17 +303,17 @@ describe('#612 PR-2: one bracket identity grammar, one width rule', () => {
});
test('G3: the capturing variant captures the id in BOTH bracket forms', () => {
// `### [GSD.999] Phase 07:` used to fall through to the base alternative,
// `### [MSD.999] Phase 07:` used to fall through to the base alternative,
// which captures nothing — so the reader saw no bracket, applied the legacy
// token rule, and counted a labeled icebox heading while excluding the
// label-less one beside it.
for (const baseline of [B.ANY_BRACKET, B.LABEL_ONLY]) {
const re = new RegExp(
`^${core.phaseHeadingPrefixSrcFor(baseline, 'bracket', true)}([\\w][\\w.-]*)\\s*:`, 'i');
for (const heading of ['[GSD.999] Phase 07: Icebox', '[GSD.999] 07: Icebox']) {
for (const heading of ['[MSD.999] Phase 07: Icebox', '[MSD.999] 07: Icebox']) {
const m = heading.match(re);
assert.ok(m, `${baseline}: ${heading}`);
assert.equal(m[1], 'GSD.999', `${baseline}: ${heading} — bracket id must be captured`);
assert.equal(m[1], 'MSD.999', `${baseline}: ${heading} — bracket id must be captured`);
assert.equal(m[2], '07');
}
}
@@ -322,11 +322,11 @@ describe('#612 PR-2: one bracket identity grammar, one width rule', () => {
test('G7: the qualified key shares the dir token boundary and width', () => {
// A qualified hit returns UNCONDITIONALLY from phaseTokenMatches, so a key
// that matches a directory isPhaseDirName rejects is a final wrong answer.
assert.equal(core.bracketQualifiedKey('GSD.02-12A-hotfix', 'bracket'), null);
assert.equal(core.bracketQualifiedKey('GSD.02-05.03.07-x', 'bracket'), null);
assert.equal(core.bracketQualifiedKey('GSD.2-05', 'bracket'), null, 'unpadded is malformed');
assert.equal(core.bracketQualifiedKey('GSD.02-05-slug', 'bracket'), 'GSD.2-5');
assert.equal(core.bracketQualifiedKey('GSD.02-05.03', 'bracket'), 'GSD.2-5.3');
assert.equal(core.bracketQualifiedKey('MSD.02-12A-hotfix', 'bracket'), null);
assert.equal(core.bracketQualifiedKey('MSD.02-05.03.07-x', 'bracket'), null);
assert.equal(core.bracketQualifiedKey('MSD.2-05', 'bracket'), null, 'unpadded is malformed');
assert.equal(core.bracketQualifiedKey('MSD.02-05-slug', 'bracket'), 'MSD.2-5');
assert.equal(core.bracketQualifiedKey('MSD.02-05.03', 'bracket'), 'MSD.2-5.3');
});
test('G7: the qualified branch resolves its own milestone and refuses malformed dirs', () => {
@@ -334,14 +334,14 @@ describe('#612 PR-2: one bracket identity grammar, one width rule', () => {
assert.equal(core.phaseTokenMatches('CK.03-02-shell', 'CK.03-02', 'bracket'), true);
assert.equal(core.phaseTokenMatches('CK.02-02-other', 'CK.03-02', 'bracket'), false,
'must not resolve to another milestone same-numbered dir');
assert.equal(core.phaseTokenMatches('GSD.02-12A-hotfix', 'GSD.02-12', 'bracket'), false,
assert.equal(core.phaseTokenMatches('MSD.02-12A-hotfix', 'MSD.02-12', 'bracket'), false,
'a directory isPhaseDirName rejects must not satisfy a qualified query');
});
test('the bracket path stays OFF without an explicit signal', () => {
assert.equal(core.bracketQualifiedKey('CK.03-02'), null);
assert.equal(core.bracketQualifiedKey('CK.03-02', 'milestone-prefixed'), null);
assert.equal(core.extractPhaseToken('GSD.02-05.03-01'), 'GSD.02-05.03-01');
assert.equal(core.extractPhaseToken('MSD.02-05.03-01'), 'MSD.02-05.03-01');
// The #2043 numeric-tail family keeps its convention-less reading.
assert.equal(core.phaseTokenMatches('P0.03-02-tenant', 'P0.3-2'), false);
});
@@ -351,14 +351,14 @@ describe('#612 PR-2: one bracket identity grammar, one width rule', () => {
describe('#612 PR-2: the bracket alternative does not span lines', () => {
test('prose on the line after a bracket-terminated heading is not a phase', () => {
const doc = '### [GSD.02]\n\n05: Orphan digits\n';
const doc = '### [MSD.02]\n\n05: Orphan digits\n';
assert.deepEqual(scan(core.phaseHeadingPrefixSrcFor(B.ANY_BRACKET, 'bracket'), doc), [],
'a heading that ends at the bracket claims nothing on later lines');
});
test('a tab between the bracket and the token is still one heading', () => {
assert.deepEqual(
scan(core.phaseHeadingPrefixSrcFor(B.ANY_BRACKET, 'bracket'), '### [GSD.02]\t05: Tabbed'),
scan(core.phaseHeadingPrefixSrcFor(B.ANY_BRACKET, 'bracket'), '### [MSD.02]\t05: Tabbed'),
['05'],
);
});
@@ -370,7 +370,7 @@ describe('#612 PR-2: phase_id_convention resolves workstream -> root', () => {
const fs = require('fs');
const path = require('path');
const os = require('os');
const { resolvePhaseIdConvention } = require('../gsd-core/bin/lib/planning-workspace.cjs');
const { resolvePhaseIdConvention } = require('../msd-core/bin/lib/planning-workspace.cjs');
const { cleanup } = require('./helpers.cjs');
let dir;
@@ -388,12 +388,12 @@ describe('#612 PR-2: phase_id_convention resolves workstream -> root', () => {
return dir;
};
const withWs = (name, fn) => {
const prev = process.env.GSD_WORKSTREAM;
if (name === null) delete process.env.GSD_WORKSTREAM;
else process.env.GSD_WORKSTREAM = name;
const prev = process.env.MSD_WORKSTREAM;
if (name === null) delete process.env.MSD_WORKSTREAM;
else process.env.MSD_WORKSTREAM = name;
try { return fn(); } finally {
if (prev === undefined) delete process.env.GSD_WORKSTREAM;
else process.env.GSD_WORKSTREAM = prev;
if (prev === undefined) delete process.env.MSD_WORKSTREAM;
else process.env.MSD_WORKSTREAM = prev;
}
};
const cleanupDir = () => cleanup(dir);
@@ -435,15 +435,15 @@ describe('#612 PR-2: phase_id_convention resolves workstream -> root', () => {
const d = setup({ root: 'bracket' });
try {
fsx.mkdirSync(path.join(d, '.planning', 'proj1'), { recursive: true });
const prev = process.env.GSD_PROJECT;
process.env.GSD_PROJECT = 'proj1';
const prev = process.env.MSD_PROJECT;
process.env.MSD_PROJECT = 'proj1';
try {
assert.equal(resolvePhaseIdConvention(d), null, 'root must not leak into a project scope');
fsx.writeFileSync(path.join(d, '.planning', 'proj1', 'config.json'),
JSON.stringify({ phase_id_convention: 'bracket' }));
assert.equal(resolvePhaseIdConvention(d), 'bracket');
} finally {
if (prev === undefined) delete process.env.GSD_PROJECT; else process.env.GSD_PROJECT = prev;
if (prev === undefined) delete process.env.MSD_PROJECT; else process.env.MSD_PROJECT = prev;
}
} finally { cleanupDir(); }
});
@@ -470,7 +470,7 @@ describe('#612 PR-2: phase_id_convention resolves workstream -> root', () => {
// ─── #2761 B1: the workstream is an ARGUMENT, not only an env var ────────
test('the ws ARGUMENT selects the config, with no GSD_WORKSTREAM set', () => {
test('the ws ARGUMENT selects the config, with no MSD_WORKSTREAM set', () => {
const d = setup({ root: 'milestone-prefixed', ws: 'bracket' });
try {
withWs(null, () => assert.equal(
@@ -480,7 +480,7 @@ describe('#612 PR-2: phase_id_convention resolves workstream -> root', () => {
} finally { cleanupDir(); }
});
test('arg and env resolve identically — `--workstream ws1` === `GSD_WORKSTREAM=ws1`', () => {
test('arg and env resolve identically — `--workstream ws1` === `MSD_WORKSTREAM=ws1`', () => {
const d = setup({ root: 'milestone-prefixed', ws: 'bracket' });
try {
const viaArg = withWs(null, () => resolvePhaseIdConvention(d, 'ws1'));
@@ -490,7 +490,7 @@ describe('#612 PR-2: phase_id_convention resolves workstream -> root', () => {
} finally { cleanupDir(); }
});
test('an explicit ws overrides GSD_WORKSTREAM rather than being ignored', () => {
test('an explicit ws overrides MSD_WORKSTREAM rather than being ignored', () => {
const d = setup({ root: 'bracket' });
try {
fs.writeFileSync(path.join(d, '.planning', 'workstreams', 'ws1', 'config.json'),
@@ -518,22 +518,22 @@ describe('#2761 B1: a workstream\'s convention scopes ITS OWN roadmap read', ()
const path = require('path');
const os = require('os');
const { extractCurrentMilestone, getMilestonePhaseFilter } =
require('../gsd-core/bin/lib/roadmap-parser.cjs');
require('../msd-core/bin/lib/roadmap-parser.cjs');
const { cleanup } = require('./helpers.cjs');
// Two bracket milestones, NEITHER carrying a version string. Under the
// bracket convention STATE's `v2.0` selects `[GSD.02]` alone; under any other
// bracket convention STATE's `v2.0` selects `[MSD.02]` alone; under any other
// convention nothing matches and the window is the whole document. So "which
// convention did this read use" is directly observable in the window.
const ROADMAP = [
'# Roadmap', '',
'## [GSD.01] Foundation', '',
'### [GSD.01] 01: Alpha',
'### [GSD.01] 02: Alpha2', '',
'## [GSD.02] Second', '',
'### [GSD.02] 01: Beta',
'### [GSD.02] 02: Beta2',
'### [GSD.02] 03: Beta3', '',
'## [MSD.01] Foundation', '',
'### [MSD.01] 01: Alpha',
'### [MSD.01] 02: Alpha2', '',
'## [MSD.02] Second', '',
'### [MSD.02] 01: Beta',
'### [MSD.02] 02: Beta2',
'### [MSD.02] 03: Beta3', '',
].join('\n');
let dir;
@@ -554,23 +554,23 @@ describe('#2761 B1: a workstream\'s convention scopes ITS OWN roadmap read', ()
return dir;
};
const withWs = (name, fn) => {
const prev = process.env.GSD_WORKSTREAM;
if (name === null) delete process.env.GSD_WORKSTREAM;
else process.env.GSD_WORKSTREAM = name;
const prev = process.env.MSD_WORKSTREAM;
if (name === null) delete process.env.MSD_WORKSTREAM;
else process.env.MSD_WORKSTREAM = name;
try { return fn(); } finally {
if (prev === undefined) delete process.env.GSD_WORKSTREAM;
else process.env.GSD_WORKSTREAM = prev;
if (prev === undefined) delete process.env.MSD_WORKSTREAM;
else process.env.MSD_WORKSTREAM = prev;
}
};
const cleanupDir = () => cleanup(dir);
const scopedToGsd02 = (window) =>
window.includes('[GSD.02] 01: Beta') && !window.includes('[GSD.01] 01: Alpha');
const scopedToMsd02 = (window) =>
window.includes('[MSD.02] 01: Beta') && !window.includes('[MSD.01] 01: Alpha');
// Repro A (trek-e). The workstream declares milestone-prefixed. Flipping ONLY
// the ROOT config used to change which milestone this workstream extracted,
// because the convention was resolved from `planningDir(cwd)` — the root,
// since no GSD_WORKSTREAM was set — while the DOCUMENT came from the
// since no MSD_WORKSTREAM was set — while the DOCUMENT came from the
// workstream. The workstream's own declaration was never consulted at all.
test('repro A: flipping the ROOT config cannot move a workstream that owns its convention', () => {
const windows = [];
@@ -585,7 +585,7 @@ describe('#2761 B1: a workstream\'s convention scopes ITS OWN roadmap read', ()
assert.equal(windows[0], windows[1],
'root=bracket and root=milestone-prefixed must produce the SAME window for a ' +
'workstream whose own config says milestone-prefixed');
assert.ok(!scopedToGsd02(windows[0]),
assert.ok(!scopedToMsd02(windows[0]),
'a milestone-prefixed workstream must not take the bracket scoping path');
});
@@ -597,12 +597,12 @@ describe('#2761 B1: a workstream\'s convention scopes ITS OWN roadmap read', ()
try {
const content = fs.readFileSync(
path.join(d, '.planning', 'workstreams', 'foo', 'ROADMAP.md'), 'utf-8');
assert.ok(scopedToGsd02(withWs(null, () => extractCurrentMilestone(content, d, 'foo'))));
assert.ok(scopedToMsd02(withWs(null, () => extractCurrentMilestone(content, d, 'foo'))));
} finally { cleanupDir(); }
});
// Repro B (trek-e): `--workstream foo` vs `GSD_WORKSTREAM=foo`.
test('repro B: the ws ARGUMENT and GSD_WORKSTREAM produce the same window', () => {
// Repro B (trek-e): `--workstream foo` vs `MSD_WORKSTREAM=foo`.
test('repro B: the ws ARGUMENT and MSD_WORKSTREAM produce the same window', () => {
const d = setup({ root: 'milestone-prefixed', ws: 'bracket' });
try {
const content = fs.readFileSync(
@@ -610,7 +610,7 @@ describe('#2761 B1: a workstream\'s convention scopes ITS OWN roadmap read', ()
const viaArg = withWs(null, () => extractCurrentMilestone(content, d, 'foo'));
const viaEnv = withWs('foo', () => extractCurrentMilestone(content, d, undefined));
assert.equal(viaArg, viaEnv, 'arg-driven and env-driven reads must agree');
assert.ok(scopedToGsd02(viaArg), 'both must take the workstream\'s own bracket scoping');
assert.ok(scopedToMsd02(viaArg), 'both must take the workstream\'s own bracket scoping');
} finally { cleanupDir(); }
});