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

@@ -43,11 +43,11 @@ const path = require('node:path');
const os = require('node:os');
const { makeFakeClock } = require('./helpers/clock.cjs');
const stateMod = require('../gsd-core/bin/lib/state.cjs');
const stateMod = require('../msd-core/bin/lib/state.cjs');
const { acquireStateLock, releaseStateLock, readModifyWriteStateMd } = stateMod;
const { withPlanningLock } = require('../gsd-core/bin/lib/planning-workspace.cjs');
const { createTempProject, cleanup, runGsdTools } = require('./helpers.cjs');
const { stateExtractField } = require('../gsd-core/bin/lib/state-document.cjs');
const { withPlanningLock } = require('../msd-core/bin/lib/planning-workspace.cjs');
const { createTempProject, cleanup, runMsdTools } = require('./helpers.cjs');
const { stateExtractField } = require('../msd-core/bin/lib/state-document.cjs');
// ─────────────────────────────────────────────────────────────────────────────
// 1. Fake-clock proof: acquireStateLock accepts and uses the clock seam
@@ -58,7 +58,7 @@ describe('acquireStateLock clock seam', () => {
let statePath;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-clock-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-clock-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n');
@@ -150,7 +150,7 @@ describe('acquireStateLock PID-liveness staleness (audit M1)', () => {
let statePath;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-liveness-state-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-liveness-state-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n');
@@ -258,7 +258,7 @@ describe('acquireStateLock steal-safety windows (PR #1532)', () => {
let statePath;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-stealsafety-state-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-stealsafety-state-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n');
@@ -363,7 +363,7 @@ describe('acquireStateLock recoverable errno budget + backoff (#1217)', () => {
let origOpenSync;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-clock-1217-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-clock-1217-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n');
@@ -454,7 +454,7 @@ describe('acquireStateLock boundary coverage — recoverable-errno budget (#1217
let origOpenSync;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-clock-boundary-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-clock-boundary-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n');
@@ -609,7 +609,7 @@ describe('acquireStateLock statSync/steal spin paths bounded (#1217)', () => {
let origRenameSync;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-clock-spin-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-clock-spin-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n');
@@ -805,7 +805,7 @@ describe('readModifyWriteStateMd lock cleanup on error', () => {
let statePath;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-clock-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-clock-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n\n**Status:** Planning\n');
@@ -843,7 +843,7 @@ describe('withPlanningLock clock seam', () => {
let tmpDir;
beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-clock-planning-'));
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-clock-planning-'));
fs.mkdirSync(path.join(tmpDir, '.planning'), { recursive: true });
});
@@ -885,7 +885,7 @@ describe('withPlanningLock clock seam', () => {
fs.writeFileSync(lockPath, JSON.stringify({ pid: livePid, cwd: tmpDir, acquired: new Date().toISOString() }));
// Holder reads as ALIVE via the injected probe → waited on, never stolen.
require('../gsd-core/bin/lib/planning-workspace.cjs')._setLockProbes({ isPidAlive: (pid) => pid === livePid });
require('../msd-core/bin/lib/planning-workspace.cjs')._setLockProbes({ isPidAlive: (pid) => pid === livePid });
let nowValue = 0;
const clock2 = {
@@ -904,7 +904,7 @@ describe('withPlanningLock clock seam', () => {
// The live holder's lock must be intact (never unlinked).
assert.ok(fs.existsSync(lockPath), 'live holder lock must survive the timeout (not force-stolen)');
} finally {
require('../gsd-core/bin/lib/planning-workspace.cjs')._resetLockProbes();
require('../msd-core/bin/lib/planning-workspace.cjs')._resetLockProbes();
}
});
});
@@ -929,7 +929,7 @@ describe('exit cleanup: STATE.md.lock removed on process exit', () => {
const statePath = path.join(tmpDir, '.planning', 'STATE.md');
fs.writeFileSync(statePath, '# State\n\n**Status:** Planning\n**Current Phase:** 01\n');
runGsdTools('state update Status "In progress"', tmpDir);
runMsdTools('state update Status "In progress"', tmpDir);
assert.ok(
!fs.existsSync(statePath + '.lock'),
@@ -943,7 +943,7 @@ describe('exit cleanup: STATE.md.lock removed on process exit', () => {
fs.writeFileSync(statePath, '# State\n\n**Status:** Planning\n');
// run and ignore result — we only care about the lock file
runGsdTools('state update Status "In progress"', tmpDir);
runMsdTools('state update Status "In progress"', tmpDir);
assert.ok(
!fs.existsSync(statePath + '.lock'),
@@ -973,7 +973,7 @@ describe('exit cleanup: .planning/.lock removed on process exit', () => {
path.join(tmpDir, '.planning', 'ROADMAP.md'),
'# Roadmap v1.0\n\n### Phase 1: Foundation\n**Goal:** Setup\n\n---\n'
);
runGsdTools('phase add Testing', tmpDir);
runMsdTools('phase add Testing', tmpDir);
assert.ok(
!fs.existsSync(path.join(tmpDir, '.planning', '.lock')),
@@ -985,7 +985,7 @@ describe('exit cleanup: .planning/.lock removed on process exit', () => {
// ─────────────────────────────────────────────────────────────────────────────
// 6. readModifyWriteStateMd call-site coverage
// Replaces locking-bugs:467 (source-grep audit of 9 cmd* functions)
// Uses CLI-level integration: each cmd* is exercised through gsd-tools and
// Uses CLI-level integration: each cmd* is exercised through msd-tools and
// the lock-cleanup assertion confirms readModifyWriteStateMd was called
// (the lock is only left clean by readModifyWriteStateMd's finally block).
// ─────────────────────────────────────────────────────────────────────────────
@@ -1035,7 +1035,7 @@ describe('readModifyWriteStateMd call-site coverage', () => {
}
test('cmdStateUpdate releases lock (state update)', () => {
runGsdTools('state update Status "Executing"', tmpDir);
runMsdTools('state update Status "Executing"', tmpDir);
assertNoLockFile();
});
@@ -1044,32 +1044,32 @@ describe('readModifyWriteStateMd call-site coverage', () => {
path.join(tmpDir, '.planning', 'STATE.md'),
'# State\n\n**Current Phase:** 01\n**Current Plan:** 1\n**Total Plans in Phase:** 3\n'
);
runGsdTools('state advance-plan', tmpDir);
runMsdTools('state advance-plan', tmpDir);
assertNoLockFile();
});
test('cmdStateUpdateProgress releases lock (state update-progress)', () => {
runGsdTools('state update-progress', tmpDir);
runMsdTools('state update-progress', tmpDir);
assertNoLockFile();
});
test('cmdStateAddDecision releases lock (state add-decision)', () => {
runGsdTools('state add-decision --phase 01 --summary "Use TypeScript"', tmpDir);
runMsdTools('state add-decision --phase 01 --summary "Use TypeScript"', tmpDir);
assertNoLockFile();
});
test('cmdStateAddBlocker releases lock (state add-blocker)', () => {
runGsdTools('state add-blocker --text "Blocked on review"', tmpDir);
runMsdTools('state add-blocker --text "Blocked on review"', tmpDir);
assertNoLockFile();
});
test('cmdStateRecordSession releases lock (state record-session)', () => {
runGsdTools('state record-session --stopped-at "context exhaustion at 80%"', tmpDir);
runMsdTools('state record-session --stopped-at "context exhaustion at 80%"', tmpDir);
assertNoLockFile();
});
test('cmdStateBeginPhase releases lock (state begin-phase)', () => {
runGsdTools('state begin-phase 01', tmpDir);
runMsdTools('state begin-phase 01', tmpDir);
assertNoLockFile();
});
});
@@ -1123,7 +1123,7 @@ describe('roadmap analyze behavioral correctness (50-phase)', () => {
}
test('roadmap analyze returns 50 phases with 25 complete (behavioral, no timing gate)', () => {
const result = runGsdTools('roadmap analyze', tmpDir);
const result = runMsdTools('roadmap analyze', tmpDir);
assert.ok(result.success, `roadmap analyze must succeed: ${result.error}`);
const output = JSON.parse(result.output);
@@ -1153,7 +1153,7 @@ describe('roadmap analyze behavioral correctness (50-phase)', () => {
*
* Tests in this file verify that:
* 1. state.cjs date-stamping is routed through realClock (not bare new Date()),
* so GSD_NOW_MS pins the written date deterministically in subprocess tests.
* so MSD_NOW_MS pins the written date deterministically in subprocess tests.
* 2. installer-migrations.cjs lock-loop timeout fires deterministically via
* the clock seam (in-process, using makeFakeClock — no subprocess needed).
*/
@@ -1162,7 +1162,7 @@ const { describe, test, before, after } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const { runGsdTools, cleanup } = require('./helpers.cjs');
const { runMsdTools, cleanup } = require('./helpers.cjs');
const { createFixture } = require('./fixtures/index.cjs');
const { makeFakeClock } = require('./helpers/clock.cjs');
@@ -1196,7 +1196,7 @@ const ADVANCE_FIXTURE = [
'**Last Activity:** 2024-01-10',
].join('\n') + '\n';
describe('bug-474: state date-stamping is pinned by GSD_NOW_MS', () => {
describe('bug-474: state date-stamping is pinned by MSD_NOW_MS', () => {
let tmpDir;
before(() => {
@@ -1209,11 +1209,11 @@ describe('bug-474: state date-stamping is pinned by GSD_NOW_MS', () => {
cleanup(tmpDir);
});
test('state advance-plan writes pinned date (not real today) when GSD_NOW_MS is set', () => {
test('state advance-plan writes pinned date (not real today) when MSD_NOW_MS is set', () => {
// AAA — Act: run advance-plan with a pinned historical timestamp
const result = runGsdTools('state advance-plan', tmpDir, {
GSD_TEST_MODE: '1',
GSD_NOW_MS: String(PINNED_MS),
const result = runMsdTools('state advance-plan', tmpDir, {
MSD_TEST_MODE: '1',
MSD_NOW_MS: String(PINNED_MS),
});
assert.ok(result.success, `advance-plan failed unexpectedly: ${result.error}`);
@@ -1237,11 +1237,11 @@ describe('bug-474: state date-stamping is pinned by GSD_NOW_MS', () => {
});
// ─────────────────────────────────────────────────────────────────────────────
// §2 realClock GSD_NOW_MS invalid-input hardening
// §2 realClock MSD_NOW_MS invalid-input hardening
// ─────────────────────────────────────────────────────────────────────────────
/**
* Verify that malformed / out-of-range GSD_NOW_MS values fall back to the real
* Verify that malformed / out-of-range MSD_NOW_MS values fall back to the real
* clock instead of crashing with RangeError (issue #474 hardening).
*
* Each invalid input must:
@@ -1251,29 +1251,29 @@ describe('bug-474: state date-stamping is pinned by GSD_NOW_MS', () => {
* A valid pinned value must produce the expected date string.
*/
describe('bug-474: realClock GSD_NOW_MS invalid-input hardening', () => {
const realClock = require('../gsd-core/bin/lib/clock.cjs').realClock;
describe('bug-474: realClock MSD_NOW_MS invalid-input hardening', () => {
const realClock = require('../msd-core/bin/lib/clock.cjs').realClock;
// Save and restore env so these tests cannot bleed into neighbouring tests.
let savedTestMode;
let savedNowMs;
before(() => {
savedTestMode = process.env.GSD_TEST_MODE;
savedNowMs = process.env.GSD_NOW_MS;
process.env.GSD_TEST_MODE = '1';
savedTestMode = process.env.MSD_TEST_MODE;
savedNowMs = process.env.MSD_NOW_MS;
process.env.MSD_TEST_MODE = '1';
});
after(() => {
if (savedTestMode === undefined) {
delete process.env.GSD_TEST_MODE;
delete process.env.MSD_TEST_MODE;
} else {
process.env.GSD_TEST_MODE = savedTestMode;
process.env.MSD_TEST_MODE = savedTestMode;
}
if (savedNowMs === undefined) {
delete process.env.GSD_NOW_MS;
delete process.env.MSD_NOW_MS;
} else {
process.env.GSD_NOW_MS = savedNowMs;
process.env.MSD_NOW_MS = savedNowMs;
}
});
@@ -1288,28 +1288,28 @@ describe('bug-474: realClock GSD_NOW_MS invalid-input hardening', () => {
];
for (const [label, value] of INVALID_INPUTS) {
test(`GSD_NOW_MS='${value}' (${label}) falls back to real clock — no crash, valid ISO`, () => {
test(`MSD_NOW_MS='${value}' (${label}) falls back to real clock — no crash, valid ISO`, () => {
// AAA — Arrange
process.env.GSD_NOW_MS = value;
process.env.MSD_NOW_MS = value;
// AAA — Act + Assert: must not throw
assert.doesNotThrow(
() => realClock.nowIso(),
`realClock.nowIso() must not throw for GSD_NOW_MS='${value}'`,
`realClock.nowIso() must not throw for MSD_NOW_MS='${value}'`,
);
// AAA — Assert: result is a valid ISO string (fell back to real clock)
const iso = realClock.nowIso();
assert.ok(
!Number.isNaN(Date.parse(iso)),
`realClock.nowIso() must return a valid ISO date for GSD_NOW_MS='${value}', got: ${iso}`,
`realClock.nowIso() must return a valid ISO date for MSD_NOW_MS='${value}', got: ${iso}`,
);
});
}
test('GSD_NOW_MS valid decimal integer pins the clock', () => {
test('MSD_NOW_MS valid decimal integer pins the clock', () => {
// AAA — Arrange: a known historical epoch
process.env.GSD_NOW_MS = String(PINNED_MS);
process.env.MSD_NOW_MS = String(PINNED_MS);
// AAA — Act
const tod = realClock.today();
@@ -1368,14 +1368,14 @@ describe('bug-474: installer-migrations lock-loop timeout is deterministic via c
test('acquireInstallMigrationLock timeout path fires deterministically via makeFakeClock', (t) => {
// AAA — Arrange
const os = require('os');
const { acquireInstallMigrationLock } = require('../gsd-core/bin/lib/installer-migrations.cjs');
const configDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-474-lock-'));
const { acquireInstallMigrationLock } = require('../msd-core/bin/lib/installer-migrations.cjs');
const configDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-474-lock-'));
t.after(() => {
cleanup(configDir);
});
const LOCK_NAME = 'gsd-install-migration.lock';
const LOCK_NAME = 'msd-install-migration.lock';
const lockPath = path.join(configDir, LOCK_NAME);
// Write a lock file held by process.ppid (the parent process, always alive