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

@@ -22,7 +22,7 @@
// warnings[]) instead of a silent overwrite.
//
// Session identity comes from getWorkstreamSessionKey() (env-first). Tests
// drive it with GSD_SESSION_KEY via runGsdTools's per-call env override;
// drive it with MSD_SESSION_KEY via runMsdTools's per-call env override;
// helpers blank ambient session identity, so default runs are headless
// (null session) deterministically.
@@ -31,15 +31,15 @@ const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const helpers = require('./helpers.cjs');
const { runGsdTools, createTempProject, cleanup, TOOLS_PATH, captureFdSync } = helpers;
const { runMsdTools, createTempProject, cleanup, TOOLS_PATH, captureFdSync } = helpers;
const processSeam = require('./helpers/process-seam.cjs');
const { collectSection } = require('../gsd-core/bin/lib/markdown-sectionizer.cjs');
const { collectSection } = require('../msd-core/bin/lib/markdown-sectionizer.cjs');
const { LOOP_HOOK_POINT_CLI_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
// runGsdTools's legacy shape drops stderr on success, but the #3311 contract
// runMsdTools's legacy shape drops stderr on success, but the #3311 contract
// is exactly that a conflict is VISIBLE — these tests must see stderr. Drive
// the process seam directly for the conflicting invocations (same env base
// runGsdTools applies, exposed as the TEST_ENV_BASE getter).
// runMsdTools applies, exposed as the TEST_ENV_BASE getter).
function runToolsWithStderr(args, cwd, env = {}) {
return processSeam.runNode([TOOLS_PATH, ...args], {
cwd,
@@ -48,11 +48,11 @@ function runToolsWithStderr(args, cwd, env = {}) {
});
}
const SESSION_A = { GSD_SESSION_KEY: 'session-a' };
const SESSION_B = { GSD_SESSION_KEY: 'session-b' };
const SESSION_A = { MSD_SESSION_KEY: 'session-a' };
const SESSION_B = { MSD_SESSION_KEY: 'session-b' };
// Pinned clock base for deterministic claim freshness (realClock.now() honors
// GSD_TEST_MODE + GSD_NOW_MS in the subprocess under test).
// MSD_TEST_MODE + MSD_NOW_MS in the subprocess under test).
const T0 = Date.parse('2026-08-10T09:00:00.000Z');
// A delta comfortably past any plausible claim TTL (4h) — staleness driver.
const WEEK_LATER = T0 + 7 * 24 * 60 * 60 * 1000;
@@ -189,10 +189,10 @@ describe('#3311 milestone lock: begin-phase claims', () => {
});
test('M1: begin-phase records a milestone.lock claim with phase + session key', () => {
const result = runGsdTools(
const result = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(result.success, `begin-phase failed: ${result.error}`);
@@ -206,17 +206,17 @@ describe('#3311 milestone lock: begin-phase claims', () => {
});
test('M2: second session beginning a DIFFERENT phase gets a visible conflict, claim left intact, STATE.md still updated', () => {
const first = runGsdTools(
const first = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(first.success, `first begin-phase failed: ${first.error}`);
const second = runToolsWithStderr(
['state', 'begin-phase', '--phase', '2', '--name', 'api', '--plans', '3'],
tmpDir,
{ ...SESSION_B, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0 + 1000) },
{ ...SESSION_B, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0 + 1000) },
);
assert.strictEqual(second.exitCode, 0, `second begin-phase failed: ${second.stderr}`);
@@ -243,18 +243,18 @@ describe('#3311 milestone lock: begin-phase claims', () => {
});
test('M3: same session re-targeting a different phase — no conflict, claim follows', () => {
const first = runGsdTools(
const first = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(first.success, `first begin-phase failed: ${first.error}`);
assert.ok(!JSON.parse(first.output).milestone_conflict, 'no conflict on fresh claim');
const second = runGsdTools(
const second = runMsdTools(
['state', 'begin-phase', '--phase', '2', '--name', 'api', '--plans', '3'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0 + 1000) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0 + 1000) },
);
assert.ok(second.success, `second begin-phase failed: ${second.error}`);
@@ -266,17 +266,17 @@ describe('#3311 milestone lock: begin-phase claims', () => {
});
test('M4: different session, SAME phase — no conflict (keyed by phase)', () => {
const first = runGsdTools(
const first = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(first.success, `first begin-phase failed: ${first.error}`);
const second = runGsdTools(
const second = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ ...SESSION_B, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0 + 1000) },
{ ...SESSION_B, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0 + 1000) },
);
assert.ok(second.success, `second begin-phase failed: ${second.error}`);
@@ -288,17 +288,17 @@ describe('#3311 milestone lock: begin-phase claims', () => {
// No session env at all — both invocations resolve a null session key.
// A null key must never count as "same session", or the headless parallel
// case (CI, cron) would be undetectable.
const first = runGsdTools(
const first = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(first.success, `first begin-phase failed: ${first.error}`);
const second = runGsdTools(
const second = runMsdTools(
['state', 'begin-phase', '--phase', '2', '--name', 'api', '--plans', '3'],
tmpDir,
{ GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0 + 1000) },
{ MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0 + 1000) },
);
assert.ok(second.success, `second begin-phase failed: ${second.error}`);
@@ -310,19 +310,19 @@ describe('#3311 milestone lock: begin-phase claims', () => {
});
test('M8: a claim older than the TTL is stale — takeover without conflict', () => {
const first = runGsdTools(
const first = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '4'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(first.success, `first begin-phase failed: ${first.error}`);
// A week later, session B begins phase 2: the abandoned claim must not
// fire a false conflict.
const second = runGsdTools(
const second = runMsdTools(
['state', 'begin-phase', '--phase', '2', '--name', 'api', '--plans', '3'],
tmpDir,
{ ...SESSION_B, GSD_TEST_MODE: '1', GSD_NOW_MS: String(WEEK_LATER) },
{ ...SESSION_B, MSD_TEST_MODE: '1', MSD_NOW_MS: String(WEEK_LATER) },
);
assert.ok(second.success, `second begin-phase failed: ${second.error}`);
@@ -337,10 +337,10 @@ describe('#3311 milestone lock: begin-phase claims', () => {
test('M11: a corrupt milestone.lock body is treated as no claim — no crash, no conflict', () => {
fs.writeFileSync(milestoneLockPath(tmpDir), 'not-json{garbage');
const result = runGsdTools(
const result = runMsdTools(
['state', 'begin-phase', '--phase', '2', '--name', 'api', '--plans', '3'],
tmpDir,
{ ...SESSION_B, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_B, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(result.success, `begin-phase failed on corrupt claim: ${result.error}`);
@@ -369,20 +369,20 @@ describe('#3311 milestone lock: advance-plan position checks', () => {
test('M5: position phase matching the claim advances silently and heartbeats the claim', () => {
fs.writeFileSync(path.join(tmpDir, '.planning', 'STATE.md'), BEGIN_PHASE_STATE_MD);
const begin = runGsdTools(
const begin = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '3'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(begin.success, `begin-phase failed: ${begin.error}`);
const before = readClaim(tmpDir);
assert.strictEqual(before.updated_at, T0);
const adv = runGsdTools(
const adv = runMsdTools(
['state', 'advance-plan'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0 + 60_000) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0 + 60_000) },
);
assert.ok(adv.success, `advance-plan failed: ${adv.error}`);
@@ -402,10 +402,10 @@ describe('#3311 milestone lock: advance-plan position checks', () => {
test('M6: Current Position naming ANOTHER session\'s claimed phase is reported as a conflict', () => {
// Session A legitimately began phase 1 …
fs.writeFileSync(path.join(tmpDir, '.planning', 'STATE.md'), BEGIN_PHASE_STATE_MD);
const begin = runGsdTools(
const begin = runMsdTools(
['state', 'begin-phase', '--phase', '1', '--name', 'setup', '--plans', '3'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0) },
);
assert.ok(begin.success, `begin-phase failed: ${begin.error}`);
@@ -417,7 +417,7 @@ describe('#3311 milestone lock: advance-plan position checks', () => {
const adv = runToolsWithStderr(
['state', 'advance-plan'],
tmpDir,
{ ...SESSION_A, GSD_TEST_MODE: '1', GSD_NOW_MS: String(T0 + 60_000) },
{ ...SESSION_A, MSD_TEST_MODE: '1', MSD_NOW_MS: String(T0 + 60_000) },
);
assert.strictEqual(adv.exitCode, 0, `advance-plan failed: ${adv.stderr}`);
@@ -450,13 +450,13 @@ describe('#3311 milestone lock: phase.complete', () => {
// Session A is mid-phase-1 (live claim) …
fs.writeFileSync(path.join(tmpDir, '.planning', 'milestone.lock'), JSON.stringify({
phase: '1',
session: 'gsd-session-key-session-a',
session: 'msd-session-key-session-a',
pid: 4242,
updated_at: Date.now(),
}));
// … and session B completes phase 2 in the same tree.
const result = runGsdTools(
const result = runMsdTools(
['phase', 'complete', '2'],
tmpDir,
SESSION_B,
@@ -482,12 +482,12 @@ describe('#3311 milestone lock: phase.complete', () => {
test('M10: completing the CLAIMED phase releases the claim', () => {
fs.writeFileSync(path.join(tmpDir, '.planning', 'milestone.lock'), JSON.stringify({
phase: '1',
session: 'gsd-session-key-session-a',
session: 'msd-session-key-session-a',
pid: 4242,
updated_at: Date.now(),
}));
const result = runGsdTools(['phase', 'complete', '1'], tmpDir, SESSION_A);
const result = runMsdTools(['phase', 'complete', '1'], tmpDir, SESSION_A);
assert.ok(result.success, `phase complete failed: ${result.error}`);
const out = JSON.parse(result.output);
@@ -500,7 +500,7 @@ describe('#3311 milestone lock: phase.complete', () => {
});
test('M10b: no claim file — phase.complete carries no conflict and creates no claim', () => {
const result = runGsdTools(['phase', 'complete', '1'], tmpDir, SESSION_A);
const result = runMsdTools(['phase', 'complete', '1'], tmpDir, SESSION_A);
assert.ok(result.success, `phase complete failed: ${result.error}`);
const out = JSON.parse(result.output);
@@ -523,8 +523,8 @@ describe('#3311 guard: phase.complete does not lose a concurrent STATE.md write'
try {
writePhaseCompleteFixture(tmpDir);
const stateMod = require('../gsd-core/bin/lib/state.cjs');
const phaseMod = require('../gsd-core/bin/lib/phase.cjs');
const stateMod = require('../msd-core/bin/lib/state.cjs');
const phaseMod = require('../msd-core/bin/lib/phase.cjs');
const statePath = path.join(tmpDir, '.planning', 'STATE.md');
const lockPath = statePath + '.lock';
@@ -589,7 +589,7 @@ describe('#3311 guard: phase.complete does not lose a concurrent STATE.md write'
describe('#3311 guard: advancePlan stays a targeted field replace', () => {
test('G2: only Status / Last Activity / Plan lines change inside ## Current Position', () => {
const { transitionCore } = require('../gsd-core/bin/lib/state-transition.cjs');
const { transitionCore } = require('../msd-core/bin/lib/state-transition.cjs');
const fixedClock = Object.freeze({
today: () => '2026-08-10',