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

@@ -1,7 +1,7 @@
'use strict';
/**
* #3897 rung 2 — the per-install `.gsd-runtime` marker rung in the CANONICAL
* #3897 rung 2 — the per-install `.msd-runtime` marker rung in the CANONICAL
* runtime resolver (`resolveRuntime`, src/runtime-slash.cts).
*
* MINED FROM PR #3382 (closed, unmerged — "Closing unmerged — not on the
@@ -30,14 +30,14 @@ const fs = require('node:fs');
const path = require('node:path');
const { createTempProject, cleanup } = require('./helpers.cjs');
const RUNTIME_SLASH_PATH = path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'runtime-slash.cjs');
const RUNTIME_NAME_POLICY_PATH = path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'runtime-name-policy.cjs');
const AGENT_ISOLATION_GUARD_PATH = path.join(__dirname, '..', 'hooks', 'gsd-agent-isolation-guard.js');
const CURSOR_SUBAGENT_START_PATH = path.join(__dirname, '..', 'hooks', 'gsd-cursor-subagent-start.js');
const RUNTIME_SLASH_PATH = path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'runtime-slash.cjs');
const RUNTIME_NAME_POLICY_PATH = path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'runtime-name-policy.cjs');
const AGENT_ISOLATION_GUARD_PATH = path.join(__dirname, '..', 'hooks', 'msd-agent-isolation-guard.js');
const CURSOR_SUBAGENT_START_PATH = path.join(__dirname, '..', 'hooks', 'msd-cursor-subagent-start.js');
/** A project whose config carries NO `runtime` key — what config-new-project writes. */
function neutralProject(t) {
const dir = createTempProject('gsd-marker-proj-');
const dir = createTempProject('msd-marker-proj-');
t.after(() => cleanup(dir));
fs.writeFileSync(path.join(dir, '.planning', 'config.json'), '{}');
return dir;
@@ -79,9 +79,9 @@ function assertMarkerSeamExists(rs) {
* the duration of `fn` (never `Object.assign`s it — assigning `undefined`
* onto `process.env` coerces to the literal string `"undefined"`, not a
* deletion) — #3897 rung 4 (isolated correctness review, NIT finding 8b):
* every `delete process.env.GSD_RUNTIME` in this file used to bypass this
* every `delete process.env.MSD_RUNTIME` in this file used to bypass this
* helper entirely and never restore the ambient value afterward, leaking a
* forced-unset GSD_RUNTIME into whatever test (in this file or a later one
* forced-unset MSD_RUNTIME into whatever test (in this file or a later one
* sharing the same process) ran next. Every test below now routes through
* this helper, `undefined`-keyed, so ambient env state is always restored.
*/
@@ -103,7 +103,7 @@ function withEnv(overrides, fn) {
}
}
describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897 rung 2)', () => {
describe('per-install .msd-runtime marker rung in the canonical resolver (#3897 rung 2)', () => {
test('T3 installMarkerResolvesWhenEnvAndConfigAbsent_3897 (#3364)', (t) => {
const rs = requireRuntimeSlash();
assertMarkerSeamExists(rs);
@@ -111,7 +111,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
rs._setInstallRuntimeMarkerForTests('codex');
t.after(() => rs._resetInstallRuntimeMarkerCacheForTests());
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
assert.equal(
rs.resolveRuntime(proj),
'codex',
@@ -128,8 +128,8 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
rs._setInstallRuntimeMarkerForTests('gemini');
t.after(() => rs._resetInstallRuntimeMarkerCacheForTests());
withEnv({ GSD_RUNTIME: 'codex' }, () => {
assert.equal(rs.resolveRuntime(proj), 'codex', 'GSD_RUNTIME must outrank both config.runtime and the install marker');
withEnv({ MSD_RUNTIME: 'codex' }, () => {
assert.equal(rs.resolveRuntime(proj), 'codex', 'MSD_RUNTIME must outrank both config.runtime and the install marker');
});
});
@@ -141,7 +141,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
rs._setInstallRuntimeMarkerForTests('codex');
t.after(() => rs._resetInstallRuntimeMarkerCacheForTests());
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
assert.equal(rs.resolveRuntime(proj), 'cursor', 'config.runtime must outrank the install marker');
});
});
@@ -153,7 +153,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
rs._setInstallRuntimeMarkerForTests(null);
t.after(() => rs._resetInstallRuntimeMarkerCacheForTests());
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
assert.equal(rs.resolveRuntime(proj), 'claude', 'with no env, no config.runtime and no marker, the default is unchanged');
});
});
@@ -164,7 +164,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
rs._resetInstallRuntimeMarkerCacheForTests();
const originalReadFileSync = fs.readFileSync;
fs.readFileSync = (p, enc) => {
if (typeof p === 'string' && p.endsWith('.gsd-runtime')) return ' \n\t ';
if (typeof p === 'string' && p.endsWith('.msd-runtime')) return ' \n\t ';
return originalReadFileSync(p, enc);
};
t.after(() => {
@@ -179,7 +179,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
);
const proj = neutralProject(t);
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
assert.equal(rs.resolveRuntime(proj), 'claude', 'an empty marker must fall through to claude');
});
});
@@ -192,8 +192,8 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
// IO failure injected by monkeypatching fs, never chmod (root bypasses
// mode bits — a chmod test would pass with zero coverage in root CI).
fs.readFileSync = (p, enc) => {
if (typeof p === 'string' && p.endsWith('.gsd-runtime')) {
const err = new Error('EACCES: permission denied, open .gsd-runtime');
if (typeof p === 'string' && p.endsWith('.msd-runtime')) {
const err = new Error('EACCES: permission denied, open .msd-runtime');
err.code = 'EACCES';
throw err;
}
@@ -212,7 +212,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
const proj = neutralProject(t);
let result;
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
assert.doesNotThrow(() => {
result = rs.resolveRuntime(proj);
});
@@ -227,13 +227,13 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
rs._setInstallRuntimeMarkerForTests('NotARealRuntime-V9');
t.after(() => rs._resetInstallRuntimeMarkerCacheForTests());
const viaMarker = withEnv({ GSD_RUNTIME: undefined }, () => rs.resolveRuntime(proj));
const viaEnv = withEnv({ GSD_RUNTIME: 'NotARealRuntime-V9' }, () => rs.resolveRuntime(neutralProject(t)));
const viaMarker = withEnv({ MSD_RUNTIME: undefined }, () => rs.resolveRuntime(proj));
const viaEnv = withEnv({ MSD_RUNTIME: 'NotARealRuntime-V9' }, () => rs.resolveRuntime(neutralProject(t)));
assert.equal(
viaMarker,
viaEnv,
'the marker rung must apply the SAME resolveRuntimeNameFromCandidates normalization GSD_RUNTIME does (N1) — one name policy, not two',
'the marker rung must apply the SAME resolveRuntimeNameFromCandidates normalization MSD_RUNTIME does (N1) — one name policy, not two',
);
assert.notEqual(
viaMarker,
@@ -251,7 +251,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
const originalReadFileSync = fs.readFileSync;
fs.readFileSync = (p, enc) => {
seenPaths.push(String(p));
if (typeof p === 'string' && p.endsWith('.gsd-runtime')) return hostile;
if (typeof p === 'string' && p.endsWith('.msd-runtime')) return hostile;
return originalReadFileSync(p, enc);
};
t.after(() => {
@@ -261,7 +261,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
const proj = neutralProject(t);
let result;
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
assert.doesNotThrow(() => {
result = rs.resolveRuntime(proj);
}, 'hostile marker content (newline, path traversal, control char) must never throw');
@@ -277,21 +277,21 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
// Compare against `resolveExplicitRuntime`'s own dependency-injected `env`
// parameter (already exported for exactly this purpose) rather than
// mutating the real `process.env.GSD_RUNTIME` via `withEnv` + a second
// mutating the real `process.env.MSD_RUNTIME` via `withEnv` + a second
// full `resolveRuntime()` round-trip. Both mechanisms exercise the
// identical `resolveRuntimeNameFromCandidates` normalization N1 requires
// (verified: both return "codex-../../etc/passwd" for this exact hostile
// input) -- but the live-env-mutation form depends on ambient
// `process.env` state around the call being pristine, which this suite
// cannot fully guarantee (this repo has a known class of ambient-`GSD_*`-
// cannot fully guarantee (this repo has a known class of ambient-`MSD_*`-
// env test-hermeticity bugs elsewhere). Asserting directly against the
// injectable primitive makes this comparison hermetic: no real process
// state is touched, and the assertion is unconditionally reproducible.
const viaEnv = rs.resolveExplicitRuntime(neutralProject(t), { GSD_RUNTIME: hostile });
const viaEnv = rs.resolveExplicitRuntime(neutralProject(t), { MSD_RUNTIME: hostile });
assert.equal(
result,
viaEnv,
'hostile marker content must normalize identically to the same string arriving via GSD_RUNTIME — no special-cased bypass for the marker rung',
'hostile marker content must normalize identically to the same string arriving via MSD_RUNTIME — no special-cased bypass for the marker rung',
);
});
@@ -302,7 +302,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
let reads = 0;
const originalReadFileSync = fs.readFileSync;
fs.readFileSync = (p, enc) => {
if (typeof p === 'string' && p.endsWith('.gsd-runtime')) {
if (typeof p === 'string' && p.endsWith('.msd-runtime')) {
reads++;
return 'codex';
}
@@ -314,7 +314,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
});
const proj = neutralProject(t);
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
rs.resolveRuntime(proj);
rs.resolveRuntime(proj);
rs.resolveRuntime(proj);
@@ -330,7 +330,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
let reads = 0;
const originalReadFileSync = fs.readFileSync;
fs.readFileSync = (p, enc) => {
if (typeof p === 'string' && p.endsWith('.gsd-runtime')) {
if (typeof p === 'string' && p.endsWith('.msd-runtime')) {
reads++;
return 'codex';
}
@@ -342,7 +342,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
});
const proj = neutralProject(t);
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
rs.resolveRuntime(proj);
assert.equal(reads, 1);
@@ -367,17 +367,17 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
const proj = neutralProject(t);
const configPath = path.join(proj, '.planning', 'config.json');
withEnv({ GSD_RUNTIME: undefined }, () => {
withEnv({ MSD_RUNTIME: undefined }, () => {
// Set the CANONICAL seam only — no disk write. A hook that still owns
// its own private reader/cache (today's state, #3566) will never
// observe this in-memory value; it will fall through to its own disk
// read or the ~/.gsd/defaults.json rung instead.
// read or the ~/.msd/defaults.json rung instead.
rs._setInstallRuntimeMarkerForTests('gemini');
const identity = guard.resolveRuntimeIdentity(proj, configPath, resolveRuntimeNameFromCandidates);
assert.equal(
identity.runtimeId,
'gemini',
'hooks/gsd-agent-isolation-guard.js must resolve the marker through the single canonical owner (runtime-slash.cts), not its own private reader/cache',
'hooks/msd-agent-isolation-guard.js must resolve the marker through the single canonical owner (runtime-slash.cts), not its own private reader/cache',
);
assert.equal(identity.confident, true);
@@ -391,7 +391,7 @@ describe('per-install .gsd-runtime marker rung in the canonical resolver (#3897
assert.equal(
isolation,
'harness-worktree',
'hooks/gsd-cursor-subagent-start.js must resolve the marker through the single canonical owner too',
'hooks/msd-cursor-subagent-start.js must resolve the marker through the single canonical owner too',
);
});
});