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,14 +1,14 @@
'use strict';
process.env.GSD_TEST_MODE = '1';
process.env.MSD_TEST_MODE = '1';
/**
* Unit tests for host-runtime-detection.cjs (#3245, epic #2313 Phase 5).
*
* Requires the COMPILED artifact:
* ../gsd-core/bin/lib/host-runtime-detection.cjs
* ../msd-core/bin/lib/host-runtime-detection.cjs
*
* detectHostRuntime is a pure, injected-deps function; resolveReportedRuntime
* layers the explicit GSD_RUNTIME/config.json precedence (via runtime-slash's
* layers the explicit MSD_RUNTIME/config.json precedence (via runtime-slash's
* resolveExplicitRuntime) above the host-detection rung. Neither writes to
* disk (#2297).
*/
@@ -22,7 +22,7 @@ const fc = require('fast-check');
const { createTempProject, cleanup } = require('./helpers.cjs');
const LIB_DIR = path.join(__dirname, '..', 'gsd-core', 'bin', 'lib');
const LIB_DIR = path.join(__dirname, '..', 'msd-core', 'bin', 'lib');
const {
CODEX_SESSION_ENV_SIGNALS,
@@ -124,13 +124,13 @@ describe('detectHostRuntime', () => {
});
test('nonexistent CODEX_HOME degrades to no detection', () => {
const home = path.join(os.tmpdir(), 'gsd-nonexistent-codex-home-' + Date.now());
const home = path.join(os.tmpdir(), 'msd-nonexistent-codex-home-' + Date.now());
const result = detectHostRuntime({ env: { CODEX_HOME: home }, fileExists: () => false });
assert.deepStrictEqual(result, NONE_RESULT);
});
test('CODEX_HOME pointing at a file degrades to no detection', (t) => {
const tmpFile = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-codex-home-file-')), 'not-a-dir');
const tmpFile = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-codex-home-file-')), 'not-a-dir');
fs.writeFileSync(tmpFile, 'not a codex home\n');
t.after(() => cleanup(path.dirname(tmpFile)));
// No `fileExists` override: exercises the real fs.existsSync default.
@@ -215,42 +215,42 @@ describe('detectHostRuntime', () => {
describe('resolveReportedRuntime: precedence', () => {
function withProject(t) {
const savedGsdRuntime = process.env.GSD_RUNTIME;
delete process.env.GSD_RUNTIME;
const savedMsdRuntime = process.env.MSD_RUNTIME;
delete process.env.MSD_RUNTIME;
const tmpDir = createTempProject();
t.after(() => {
cleanup(tmpDir);
if (savedGsdRuntime === undefined) delete process.env.GSD_RUNTIME;
else process.env.GSD_RUNTIME = savedGsdRuntime;
if (savedMsdRuntime === undefined) delete process.env.MSD_RUNTIME;
else process.env.MSD_RUNTIME = savedMsdRuntime;
});
return tmpDir;
}
test('env runtime wins with no other signal', (t) => {
const tmpDir = withProject(t);
const result = resolveReportedRuntime(tmpDir, { env: { GSD_RUNTIME: 'opencode' } });
const result = resolveReportedRuntime(tmpDir, { env: { MSD_RUNTIME: 'opencode' } });
assert.strictEqual(result, 'opencode');
});
test('GSD_RUNTIME outranks config and detection', (t) => {
test('MSD_RUNTIME outranks config and detection', (t) => {
const tmpDir = withProject(t);
writeConfig(tmpDir, JSON.stringify({ runtime: 'claude' }));
const result = resolveReportedRuntime(tmpDir, {
env: { GSD_RUNTIME: 'opencode', CODEX_SANDBOX: 'seatbelt', CODEX_SANDBOX_NETWORK_DISABLED: '1' },
env: { MSD_RUNTIME: 'opencode', CODEX_SANDBOX: 'seatbelt', CODEX_SANDBOX_NETWORK_DISABLED: '1' },
});
assert.strictEqual(result, 'opencode');
});
test('env alias normalizes before detection can fire', (t) => {
const tmpDir = withProject(t);
const result = resolveReportedRuntime(tmpDir, { env: { GSD_RUNTIME: 'codex-cli' } });
const result = resolveReportedRuntime(tmpDir, { env: { MSD_RUNTIME: 'codex-cli' } });
assert.strictEqual(result, 'codex');
});
test('invalid GSD_RUNTIME falls through to config', (t) => {
test('invalid MSD_RUNTIME falls through to config', (t) => {
const tmpDir = withProject(t);
writeConfig(tmpDir, JSON.stringify({ runtime: 'kimi' }));
const result = resolveReportedRuntime(tmpDir, { env: { GSD_RUNTIME: ' ' } });
const result = resolveReportedRuntime(tmpDir, { env: { MSD_RUNTIME: ' ' } });
assert.strictEqual(result, 'kimi');
});
@@ -322,7 +322,7 @@ describe('resolveReportedRuntime: precedence', () => {
// collapses it.
test('probe path is joined, not concatenated', (t) => {
const tmpDir = withProject(t);
const homeWithTrailingSep = path.join(os.tmpdir(), 'gsd-3245-trailing') + path.sep;
const homeWithTrailingSep = path.join(os.tmpdir(), 'msd-3245-trailing') + path.sep;
const spy = spyFileExists([]);
const result = resolveReportedRuntime(tmpDir, {
env: { CODEX_HOME: homeWithTrailingSep },
@@ -426,17 +426,17 @@ describe('resolveReportedRuntime: precedence', () => {
describe('runtime-slash: frozen contract (#3245 extraction must not move it)', () => {
test('resolveRuntime contract is unchanged by the extraction', (t) => {
const savedGsdRuntime = process.env.GSD_RUNTIME;
delete process.env.GSD_RUNTIME;
const savedMsdRuntime = process.env.MSD_RUNTIME;
delete process.env.MSD_RUNTIME;
t.after(() => {
if (savedGsdRuntime === undefined) delete process.env.GSD_RUNTIME;
else process.env.GSD_RUNTIME = savedGsdRuntime;
if (savedMsdRuntime === undefined) delete process.env.MSD_RUNTIME;
else process.env.MSD_RUNTIME = savedMsdRuntime;
});
assert.strictEqual(resolveRuntime(undefined), 'claude');
assert.strictEqual(resolveRuntime(null), 'claude');
assert.strictEqual(
resolveRuntime(path.join(os.tmpdir(), 'gsd-nonexistent-project-' + Date.now())),
resolveRuntime(path.join(os.tmpdir(), 'msd-nonexistent-project-' + Date.now())),
'claude',
);
@@ -447,21 +447,21 @@ describe('runtime-slash: frozen contract (#3245 extraction must not move it)', (
writeConfig(tmpDir, JSON.stringify({ runtime: 'opencode' }));
assert.strictEqual(resolveRuntime(tmpDir), 'opencode');
process.env.GSD_RUNTIME = 'kimi';
process.env.MSD_RUNTIME = 'kimi';
assert.strictEqual(resolveRuntime(tmpDir), 'kimi');
});
test('resolveRuntime ignores a codex session signal', (t) => {
// Detection is deliberately NOT wired into resolveRuntime — only
// resolveReportedRuntime's separate ladder consults it — so command-style
// emission (formatGsdSlash et al.) does not move (ADR-2313 scope boundary).
const savedGsdRuntime = process.env.GSD_RUNTIME;
// emission (formatMsdSlash et al.) does not move (ADR-2313 scope boundary).
const savedMsdRuntime = process.env.MSD_RUNTIME;
const savedCodexSandbox = process.env.CODEX_SANDBOX;
delete process.env.GSD_RUNTIME;
delete process.env.MSD_RUNTIME;
process.env.CODEX_SANDBOX = 'seatbelt';
t.after(() => {
if (savedGsdRuntime === undefined) delete process.env.GSD_RUNTIME;
else process.env.GSD_RUNTIME = savedGsdRuntime;
if (savedMsdRuntime === undefined) delete process.env.MSD_RUNTIME;
else process.env.MSD_RUNTIME = savedMsdRuntime;
if (savedCodexSandbox === undefined) delete process.env.CODEX_SANDBOX;
else process.env.CODEX_SANDBOX = savedCodexSandbox;
});
@@ -472,11 +472,11 @@ describe('runtime-slash: frozen contract (#3245 extraction must not move it)', (
});
test('explicit claude is distinguishable from the default', (t) => {
const savedGsdRuntime = process.env.GSD_RUNTIME;
delete process.env.GSD_RUNTIME;
const savedMsdRuntime = process.env.MSD_RUNTIME;
delete process.env.MSD_RUNTIME;
t.after(() => {
if (savedGsdRuntime === undefined) delete process.env.GSD_RUNTIME;
else process.env.GSD_RUNTIME = savedGsdRuntime;
if (savedMsdRuntime === undefined) delete process.env.MSD_RUNTIME;
else process.env.MSD_RUNTIME = savedMsdRuntime;
});
const tmpDir = createTempProject();
@@ -581,27 +581,27 @@ describe('detectHostRuntime: properties', () => {
});
});
// ── #4717 — the per-install .gsd-runtime marker outranks host detection ──────
// ── #4717 — the per-install .msd-runtime marker outranks host detection ──────
// On a multi-runtime machine (CODEX_HOME exported globally), host sniffing
// misreports every Claude Code session as codex. The per-install marker names
// the runtime that owns THIS tree — a stronger signal than host detection.
// Ladder: explicit (GSD_RUNTIME / config.runtime) > marker > host detection >
// Ladder: explicit (MSD_RUNTIME / config.runtime) > marker > host detection >
// 'claude'. Marker-less trees (dev/source, pre-#2297 installs) are unchanged.
describe('resolveReportedRuntime: install-marker rung (#4717)', () => {
const slash = require('../gsd-core/bin/lib/runtime-slash.cjs');
const slash = require('../msd-core/bin/lib/runtime-slash.cjs');
// Self-contained withProject: clears GSD_RUNTIME (the marker rung sits below
// Self-contained withProject: clears MSD_RUNTIME (the marker rung sits below
// it) and scaffolds a throwaway project — scoped to this describe so the
// sibling precedence describe's own helper is untouched.
function withProject4717(t) {
const savedGsdRuntime = process.env.GSD_RUNTIME;
delete process.env.GSD_RUNTIME;
const savedMsdRuntime = process.env.MSD_RUNTIME;
delete process.env.MSD_RUNTIME;
const tmpDir = createTempProject();
t.after(() => {
cleanup(tmpDir);
if (savedGsdRuntime === undefined) delete process.env.GSD_RUNTIME;
else process.env.GSD_RUNTIME = savedGsdRuntime;
if (savedMsdRuntime === undefined) delete process.env.MSD_RUNTIME;
else process.env.MSD_RUNTIME = savedMsdRuntime;
});
return tmpDir;
}
@@ -634,11 +634,11 @@ describe('resolveReportedRuntime: install-marker rung (#4717)', () => {
'a codex-owned tree reports codex even where host sniffing would say claude');
});
test('explicit GSD_RUNTIME still outranks the marker (#4717 ladder rung 1)', (t) => {
test('explicit MSD_RUNTIME still outranks the marker (#4717 ladder rung 1)', (t) => {
const tmpDir = withProject4717(t);
slash._setInstallRuntimeMarkerForTests('codex');
t.after(() => slash._resetInstallRuntimeMarkerCacheForTests());
const result = resolveReportedRuntime(tmpDir, { env: { GSD_RUNTIME: 'claude' } });
const result = resolveReportedRuntime(tmpDir, { env: { MSD_RUNTIME: 'claude' } });
assert.strictEqual(result, 'claude');
});