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

@@ -16,7 +16,7 @@
// change, so the next recurrence is a table row rather than a third incident.
//
// Scope: the markdown a runtime actually loads and resolves references against —
// agents/, gsd-core/workflows/, gsd-core/references/, commands/. Prose mentions inside
// agents/, msd-core/workflows/, msd-core/references/, commands/. Prose mentions inside
// *.cjs sources are out of scope: nothing tries to locate those.
const { describe, test } = require('node:test');
@@ -26,7 +26,7 @@ const fs = require('fs');
const path = require('path');
const ROOT = path.join(__dirname, '..');
const SCAN_DIRS = ['agents', 'gsd-core/workflows', 'gsd-core/references', 'commands'];
const SCAN_DIRS = ['agents', 'msd-core/workflows', 'msd-core/references', 'commands'];
// ---------------------------------------------------------------------------
// Rule A (#2020) — a dead SDK file-path reference. The SDK package was retired
@@ -38,10 +38,10 @@ const DEAD_SDK_REF = /sdk\/(?:src|dist|handlers)\//;
// Rule B (#3809) — the runtime shim named in COMMAND position.
//
// The shim filename is not a command on any platform. package.json `bin` ships
// `gsd-core`, `gsd-tools`, `gsd_run`, `gsd-mcp-server`; the .cjs file exists only at
// <runtime-root>/gsd-core/bin/. CONTEXT.md -> Runtime Launcher Module makes `gsd_run`
// the single sanctioned entry point: "Canonical space-safe shell preamble (`gsd_run`)
// used by every workflow bash block to invoke the GSD runtime CLI."
// `msd-core`, `msd-tools`, `msd_run`, `msd-mcp-server`; the .cjs file exists only at
// <runtime-root>/msd-core/bin/. CONTEXT.md -> Runtime Launcher Module makes `msd_run`
// the single sanctioned entry point: "Canonical space-safe shell preamble (`msd_run`)
// used by every workflow bash block to invoke the MSD runtime CLI."
//
// So a workflow that says `<shim> query phase.add` instructs the agent to run something
// that exits 127, after which the file-shaped token sends it looking for the file.
@@ -54,7 +54,7 @@ const DEAD_SDK_REF = /sdk\/(?:src|dist|handlers)\//;
// ---------------------------------------------------------------------------
// Built at runtime so this line is not itself an invocation the guard would flag.
const SHIM = ['gsd-tools', '.cjs'].join('');
const SHIM = ['msd-tools', '.cjs'].join('');
// The pattern is spelled out rather than escaped from SHIM at build time. A
// `SHIM.replace(/\./g, '\\.')` here is a hand-rolled escaper: it handles the dot and
@@ -63,7 +63,7 @@ const SHIM = ['gsd-tools', '.cjs'].join('');
// escaper lives in src/pattern.cts. Since SHIM is a compile-time constant whose only
// metacharacter is the dot, the honest fix is to carry no escaping logic at all.
// SHIM_PATTERN and SHIM are pinned to each other by a test below so they cannot drift.
const SHIM_PATTERN = 'gsd-tools\\.cjs';
const SHIM_PATTERN = 'msd-tools\\.cjs';
const SHIM_RE = new RegExp(
// not preceded by a path separator, word char, or hyphen (excludes `<dir>/<shim>`)
`(?<![\\w./\\\\-])${SHIM_PATTERN}` +
@@ -72,7 +72,7 @@ const SHIM_RE = new RegExp(
'g',
);
// The verb roster is DERIVED from gsd-tools.cjs's own exports, never hand-copied.
// The verb roster is DERIVED from msd-tools.cjs's own exports, never hand-copied.
//
// That file already carries three hand-maintained rosters — TOP_LEVEL_USAGE,
// HOST_COMMAND_ROUTERS and SKIP_ROOT_RESOLUTION — whose divergence is a named repo
@@ -88,7 +88,7 @@ const SHIM_RE = new RegExp(
let _cliVerbs = null;
function cliVerbs() {
if (_cliVerbs) return _cliVerbs;
const { HOST_COMMAND_ROUTERS, TOP_LEVEL_USAGE } = require('../gsd-core/bin/gsd-tools.cjs');
const { HOST_COMMAND_ROUTERS, TOP_LEVEL_USAGE } = require('../msd-core/bin/msd-tools.cjs');
const listed = TOP_LEVEL_USAGE.match(/Commands: ([\s\S]*?)\n\nGlobal flags:/);
assert.ok(listed, 'TOP_LEVEL_USAGE must contain a "Commands: ...\\n\\nGlobal flags:" block');
_cliVerbs = new Set([
@@ -109,7 +109,7 @@ function cliVerbs() {
*/
function findShimInvocations(line) {
// The canonical launcher's own single source of truth assigns the filename.
if (line.includes('_GSD_SHIM_NAME=')) return [];
if (line.includes('_MSD_SHIM_NAME=')) return [];
const found = [];
let m;
@@ -140,7 +140,7 @@ const RULES = [
{
id: '#3809',
label: `bare \`${SHIM}\` invocation`,
remedy: 'call the canonical launcher instead: `gsd_run <subcommand>`',
remedy: 'call the canonical launcher instead: `msd_run <subcommand>`',
scan: findShimInvocations,
},
];
@@ -213,13 +213,13 @@ describe('#3809 — what counts as a bare shim invocation', () => {
// Negative space: every legitimate way the filename appears in the tree today.
// Each row is a real line; flagging any of them would be an over-broad fix.
const LEGITIMATE = [
['the launcher resolver assignment', `_GSD_SHIM_NAME="${SHIM}"; _GSD_RUNTIME_ROOT="\${RUNTIME_DIR:-$(pwd)}"`],
['a node-prefixed invocation', ` node <config-dir>/gsd-core/bin/${SHIM} restore-custom-files \\`],
['a quoted node-prefixed invocation', `node "$GSD_DIR/gsd-core/bin/${SHIM}" query commit`],
['a qualified path with no subcommand', ` "$PREFERRED_CONFIG_DIR/gsd-core/bin/${SHIM}" \\`],
['prose naming the file', `# Resolve ${SHIM} WITHOUT yet knowing GSD_DIR. The running workflow lives`],
['prose whose next token is an English word', `# shim-only install (${SHIM} present, \`gsd-tools\` not on PATH) the bare call exits`],
['prose with a lowercase English word after', `the ${SHIM} file lives under gsd-core/bin`],
['the launcher resolver assignment', `_MSD_SHIM_NAME="${SHIM}"; _MSD_RUNTIME_ROOT="\${RUNTIME_DIR:-$(pwd)}"`],
['a node-prefixed invocation', ` node <config-dir>/msd-core/bin/${SHIM} restore-custom-files \\`],
['a quoted node-prefixed invocation', `node "$MSD_DIR/msd-core/bin/${SHIM}" query commit`],
['a qualified path with no subcommand', ` "$PREFERRED_CONFIG_DIR/msd-core/bin/${SHIM}" \\`],
['prose naming the file', `# Resolve ${SHIM} WITHOUT yet knowing MSD_DIR. The running workflow lives`],
['prose whose next token is an English word', `# shim-only install (${SHIM} present, \`msd-tools\` not on PATH) the bare call exits`],
['prose with a lowercase English word after', `the ${SHIM} file lives under msd-core/bin`],
['the filename at end of line', `authoritative tool for THIS install is ${SHIM}`],
['prose with a hyphenated English word after', `the ${SHIM} built-in helper does X`],
['prose with a version number after', `the ${SHIM} v1.2 release notes`],
@@ -233,7 +233,7 @@ describe('#3809 — what counts as a bare shim invocation', () => {
// `node <shim>` with no directory is NOT exempt: node resolves a bare filename
// against cwd, so it fails exactly like the bare form (found at
// gsd-core/references/model-profiles.md:231).
// msd-core/references/model-profiles.md:231).
// The verb roster is the whole advertised command surface, not the subset that happens
// to appear in the tree — a bare verb nobody has written yet must still be caught.
for (const verb of ['phase', 'state', 'verify', 'roadmap', 'milestone', 'worktree']) {
@@ -262,12 +262,12 @@ describe('#3809 — what counts as a bare shim invocation', () => {
test('property: a path-qualified or node-prefixed shim is never flagged', () => {
fc.assert(
fc.property(
fc.constantFrom('node ', 'node "', "node '", '/', './', '../', 'gsd-core/bin/', '$DIR/'),
fc.constantFrom('node ', 'node "', "node '", '/', './', '../', 'msd-core/bin/', '$DIR/'),
fc.constantFrom('query', 'commit', 'phase.add', 'audit-open', 'from-gsd2'),
(prefix, verb) => {
const line = prefix.endsWith('/')
? ` ${prefix}${SHIM} ${verb}`
: ` ${prefix}gsd-core/bin/${SHIM} ${verb}`;
: ` ${prefix}msd-core/bin/${SHIM} ${verb}`;
assert.deepEqual(findShimInvocations(line), []);
},
),
@@ -296,14 +296,14 @@ describe('#3809 — the verb roster is derived, not copied', () => {
assert.equal(new RegExp(`^${SHIM_PATTERN}$`).test(SHIM), true,
`SHIM_PATTERN (${SHIM_PATTERN}) no longer matches SHIM (${SHIM})`);
// And prove the pattern's dot is escaped rather than a wildcard.
assert.equal(new RegExp(`^${SHIM_PATTERN}$`).test('gsd-toolsXcjs'), false,
assert.equal(new RegExp(`^${SHIM_PATTERN}$`).test('msd-toolsXcjs'), false,
'the dot in SHIM_PATTERN must be escaped, not a wildcard');
});
test('covers every command gsd-tools.cjs actually dispatches', () => {
const { HOST_COMMAND_ROUTERS } = require('../gsd-core/bin/gsd-tools.cjs');
test('covers every command msd-tools.cjs actually dispatches', () => {
const { HOST_COMMAND_ROUTERS } = require('../msd-core/bin/msd-tools.cjs');
const missing = Object.keys(HOST_COMMAND_ROUTERS).filter((v) => !cliVerbs().has(v));
assert.deepEqual(missing, [], `verb(s) dispatched by gsd-tools.cjs but invisible to this guard: ${missing.join(', ')}`);
assert.deepEqual(missing, [], `verb(s) dispatched by msd-tools.cjs but invisible to this guard: ${missing.join(', ')}`);
});
test('recognises verbs that no hand-copied list had', () => {