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

@@ -8,7 +8,7 @@
// hooks.
//
// These tests assert the invariant structurally: whenever a runtime stages one
// or more `.js` hooks into its GSD-owned hooks directory, a package.json forcing
// or more `.js` hooks into its MSD-owned hooks directory, a package.json forcing
// CommonJS mode exists in that SAME directory, and a require()-using hook
// actually loads under an ESM-typed parent.
@@ -26,9 +26,9 @@ const COMMONJS_MARKER = '{"type":"commonjs"}\n';
// Runtimes that stage `.js` hooks via the dedicated cursor/windsurf/codex paths
// (skipSharedHooksInstall or the !isCodex gate) — the three #2717 covers.
const AFFECTED_RUNTIMES = [
{ runtime: 'cursor', sampleHook: 'gsd-cursor-session-start.js' },
{ runtime: 'windsurf', sampleHook: 'gsd-windsurf-pre-write.js' },
{ runtime: 'codex', sampleHook: 'gsd-check-update.js' },
{ runtime: 'cursor', sampleHook: 'msd-cursor-session-start.js' },
{ runtime: 'windsurf', sampleHook: 'msd-windsurf-pre-write.js' },
{ runtime: 'codex', sampleHook: 'msd-check-update.js' },
];
function readMarker(configDir) {
@@ -51,7 +51,7 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
`${runtime} install must stage ${sampleHook} (got: ${fs.readdirSync(path.join(configDir, 'hooks')).join(',')})`,
);
// The marker must exist in the SAME directory, with GSD's exact content.
// The marker must exist in the SAME directory, with MSD's exact content.
const marker = readMarker(configDir);
assert.strictEqual(
marker,
@@ -64,7 +64,7 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
// Reproduces the exact failure mode in the issue: a config-root package.json
// declaring {"type":"module"}. Pre-fix, Node walked up from the .js hook,
// found this file, and loaded the hook as ESM → require() threw. Post-fix,
// the GSD-written hooks/package.json is nearer and wins. The hook may exit
// the MSD-written hooks/package.json is nearer and wins. The hook may exit
// non-zero for benign reasons (no STATE.md, no config, etc.) — the ONLY
// failure we gate on is the ESM/require error on stderr.
function assertHookLoadsUnderEsmRoot(t, runtime, hookFile, stdinPayload) {
@@ -97,49 +97,49 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
}
test('cursor: a require()-using hook loads under an ESM-typed config root after install', (t) => {
assertHookLoadsUnderEsmRoot(t, 'cursor', 'gsd-cursor-session-start.js', JSON.stringify({ workspace_roots: [] }));
assertHookLoadsUnderEsmRoot(t, 'cursor', 'msd-cursor-session-start.js', JSON.stringify({ workspace_roots: [] }));
});
test('codex: a require()-using hook loads under an ESM-typed config root after install', (t) => {
// codex is the !isCodex-gated path most likely to regress (its marker write
// lives in bin/install.js, not the surface). gsd-check-update.js uses
// lives in bin/install.js, not the surface). msd-check-update.js uses
// require() at module load, so it surfaces the ESM failure immediately.
assertHookLoadsUnderEsmRoot(t, 'codex', 'gsd-check-update.js', '');
assertHookLoadsUnderEsmRoot(t, 'codex', 'msd-check-update.js', '');
});
test('uninstall path: removeCommonJsMarkerIfGsdOwned removes only GSD-owned markers', (t) => {
// The uninstall cleanup uses removeCommonJsMarkerIfGsdOwned (exported from
test('uninstall path: removeCommonJsMarkerIfMsdOwned removes only MSD-owned markers', (t) => {
// The uninstall cleanup uses removeCommonJsMarkerIfMsdOwned (exported from
// the runtime-hooks-surface). Assert its contract directly: it deletes a
// GSD-written marker but never a user-authored package.json.
// MSD-written marker but never a user-authored package.json.
const {
removeCommonJsMarkerIfGsdOwned,
removeCommonJsMarkerIfMsdOwned,
ensureCommonJsMarker,
} = require('../gsd-core/bin/lib/runtime-hooks-surface.cjs');
} = require('../msd-core/bin/lib/runtime-hooks-surface.cjs');
// Case 1: GSD-owned marker is removed.
const dirA = createTempDir('gsd-2717-rmA-');
// Case 1: MSD-owned marker is removed.
const dirA = createTempDir('msd-2717-rmA-');
t.after(() => cleanup(dirA));
assert.ok(ensureCommonJsMarker(dirA), 'ensureCommonJsMarker writes the marker');
const markerA = path.join(dirA, 'package.json');
assert.strictEqual(fs.readFileSync(markerA, 'utf8'), COMMONJS_MARKER);
assert.ok(removeCommonJsMarkerIfGsdOwned(dirA), 'removes a GSD-owned marker');
assert.ok(!fs.existsSync(markerA), 'GSD-owned marker is gone');
assert.ok(removeCommonJsMarkerIfMsdOwned(dirA), 'removes a MSD-owned marker');
assert.ok(!fs.existsSync(markerA), 'MSD-owned marker is gone');
// Case 2: user-authored package.json is preserved.
const dirB = createTempDir('gsd-2717-keepB-');
const dirB = createTempDir('msd-2717-keepB-');
t.after(() => cleanup(dirB));
const userContent = '{"name":"user-owned","type":"module"}\n';
fs.writeFileSync(path.join(dirB, 'package.json'), userContent);
assert.ok(!removeCommonJsMarkerIfGsdOwned(dirB), 'does not remove a non-GSD package.json');
assert.ok(!removeCommonJsMarkerIfMsdOwned(dirB), 'does not remove a non-MSD package.json');
assert.strictEqual(fs.readFileSync(path.join(dirB, 'package.json'), 'utf8'), userContent);
// Case 3: no marker → no-op, no throw.
const dirC = createTempDir('gsd-2717-noopC-');
const dirC = createTempDir('msd-2717-noopC-');
t.after(() => cleanup(dirC));
assert.ok(!removeCommonJsMarkerIfGsdOwned(dirC), 'no-op when no marker exists');
assert.ok(!removeCommonJsMarkerIfMsdOwned(dirC), 'no-op when no marker exists');
// Case 4: ensureCommonJsMarker is idempotent and does not clobber a user file.
const dirD = createTempDir('gsd-2717-idemD-');
const dirD = createTempDir('msd-2717-idemD-');
t.after(() => cleanup(dirD));
fs.writeFileSync(path.join(dirD, 'package.json'), userContent);
assert.ok(!ensureCommonJsMarker(dirD), 'does not overwrite a user-authored package.json');
@@ -147,7 +147,7 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
});
// #4759: the shared hooks path's `preserved-foreign` report used to make an
// unconditional module-resolution claim ("GSD hooks may not resolve as
// unconditional module-resolution claim ("MSD hooks may not resolve as
// CommonJS") that is FALSE for the ordinary case — any foreign file that does
// not declare {"type":"module"} leaves the staged .js hooks loading as
// CommonJS (Node's default). The sibling plugin path
@@ -157,7 +157,7 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
// true.
test('#4759: preserved-foreign hooks marker warning must not claim the hooks may not load when the file declares commonjs', (t) => {
const foreignCommonJs = '{\n "type": "commonjs"\n}\n';
const root = createTempDir('gsd-4759-commonjs-');
const root = createTempDir('msd-4759-commonjs-');
// Register cleanup BEFORE the spawn: runMinimalInstall deliberately never
// removes a caller-provided root, on the failure path either, so a spawn
// failure must not leak the temp tree.
@@ -190,14 +190,14 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
);
// The preserved-foreign notice stays, now with the conditional wording.
assert.ok(
/Left existing hooks\/package\.json untouched \(not GSD's marker\)\. If it declares "type": "module", the staged hooks will not load\./.test(output),
/Left existing hooks\/package\.json untouched \(not MSD's marker\)\. If it declares "type": "module", the staged hooks will not load\./.test(output),
`expected the conditional preserved-foreign wording; output:\n${output}`,
);
});
test('#4759: a module-typed foreign hooks package.json gets the conditional will-not-load warning', (t) => {
const foreignEsm = '{\n "type": "module"\n}\n';
const root = createTempDir('gsd-4759-esm-');
const root = createTempDir('msd-4759-esm-');
t.after(() => cleanup(root));
const hooksDir = path.join(root, '.claude', 'hooks');
fs.mkdirSync(hooksDir, { recursive: true });
@@ -228,7 +228,7 @@ describe('#2717 CommonJS marker for staged .js hooks', () => {
// old unconditional claim was false here too, and this is arguably the most
// common real file (any hand-authored package.json).
const foreignNoType = '{\n "name": "user-hooks"\n}\n';
const root = createTempDir('gsd-4759-notype-');
const root = createTempDir('msd-4759-notype-');
t.after(() => cleanup(root));
const hooksDir = path.join(root, '.claude', 'hooks');
fs.mkdirSync(hooksDir, { recursive: true });