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

@@ -21,20 +21,20 @@ const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
process.env.GSD_TEST_MODE = '1';
process.env.MSD_TEST_MODE = '1';
const { createImperativeAdapter } = require('../gsd-core/bin/lib/adapter-imperative.cjs');
const { createDeclarativeAdapter } = require('../gsd-core/bin/lib/adapter-declarative.cjs');
const { createImperativeAdapter } = require('../msd-core/bin/lib/adapter-imperative.cjs');
const { createDeclarativeAdapter } = require('../msd-core/bin/lib/adapter-declarative.cjs');
const {
profileOf,
negotiateHostCapabilities,
degradationFor,
PROFILE_BASELINES,
UNDOCUMENTED,
} = require('../gsd-core/bin/lib/host-integration.cjs');
} = require('../msd-core/bin/lib/host-integration.cjs');
const install = require('../bin/install.js');
const hooksSurface = require('../gsd-core/bin/lib/runtime-hooks-surface.cjs');
const hooksSurface = require('../msd-core/bin/lib/runtime-hooks-surface.cjs');
const { cleanup } = require('./helpers.cjs');
const CODEX_CAP = JSON.parse(
@@ -126,7 +126,7 @@ test('codex descriptor declares runtime.hostBehaviors (the folded-in behaviors)'
assert.equal(hb.cleanupSkillSidecars, true);
assert.equal(hb.agentTomlFiles, true);
assert.equal(hb.frontmatterDialect, 'codex');
assert.equal(hb.reapplyCommand, '$gsd-update --reapply');
assert.equal(hb.reapplyCommand, '$msd-update --reapply');
});
test('no `runtime === "codex"` string-equality and no positive `isCodex` gate remain in the install source (AC2)', () => {
@@ -163,7 +163,7 @@ test('upgrade 3 — codex skills resolve to $HOME/.agents/skills, not the deprec
assert.ok(!root.startsWith(codexHome), 'skills must NOT land under the deprecated $CODEX_HOME/skills');
});
test('upgrade 3 — the pre-move location is migrated (stale ~/.codex/skills/gsd-* cleaned; user content preserved)', () => {
test('upgrade 3 — the pre-move location is migrated (stale ~/.codex/skills/msd-* cleaned; user content preserved)', () => {
const codexHome = path.join(os.homedir(), '.codex');
const oldDir = install._resolveMovedSkillsOldDir('codex', codexHome, 'global');
assert.equal(oldDir, path.join(codexHome, 'skills'), 'the pre-move location is $CODEX_HOME/skills');
@@ -172,15 +172,15 @@ test('upgrade 3 — the pre-move location is migrated (stale ~/.codex/skills/gsd
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'codex-migrate-'));
const skillsDir = path.join(tmp, 'skills');
fs.mkdirSync(path.join(skillsDir, 'gsd-plan'), { recursive: true });
fs.mkdirSync(path.join(skillsDir, 'gsd-dev-preferences'), { recursive: true }); // user-owned, preserved
fs.mkdirSync(path.join(skillsDir, 'my-own-skill'), { recursive: true }); // non-gsd, preserved
fs.mkdirSync(path.join(skillsDir, 'msd-plan'), { recursive: true });
fs.mkdirSync(path.join(skillsDir, 'msd-dev-preferences'), { recursive: true }); // user-owned, preserved
fs.mkdirSync(path.join(skillsDir, 'my-own-skill'), { recursive: true }); // non-msd, preserved
try {
const removed = install.cleanupMovedSkillsOldLocation(skillsDir, 'gsd-');
assert.equal(removed, 1, 'only the managed gsd-plan dir is removed');
assert.ok(!fs.existsSync(path.join(skillsDir, 'gsd-plan')), 'stale managed skill removed');
assert.ok(fs.existsSync(path.join(skillsDir, 'gsd-dev-preferences')), 'user-owned gsd-dev-preferences preserved');
assert.ok(fs.existsSync(path.join(skillsDir, 'my-own-skill')), 'non-gsd dir preserved');
const removed = install.cleanupMovedSkillsOldLocation(skillsDir, 'msd-');
assert.equal(removed, 1, 'only the managed msd-plan dir is removed');
assert.ok(!fs.existsSync(path.join(skillsDir, 'msd-plan')), 'stale managed skill removed');
assert.ok(fs.existsSync(path.join(skillsDir, 'msd-dev-preferences')), 'user-owned msd-dev-preferences preserved');
assert.ok(fs.existsSync(path.join(skillsDir, 'my-own-skill')), 'non-msd dir preserved');
} finally {
cleanup(tmp);
}
@@ -199,8 +199,8 @@ test('upgrade 1 — codex registers all documented hooks.json lifecycle events,
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'codex-hooks-'));
try {
fs.mkdirSync(path.join(tmp, 'hooks'), { recursive: true });
fs.writeFileSync(path.join(tmp, 'hooks', 'gsd-context-monitor.js'), '// stub');
fs.writeFileSync(path.join(tmp, 'hooks', 'gsd-check-update.js'), '// stub');
fs.writeFileSync(path.join(tmp, 'hooks', 'msd-context-monitor.js'), '// stub');
fs.writeFileSync(path.join(tmp, 'hooks', 'msd-check-update.js'), '// stub');
for (const ev of install.CODEX_EXTENDED_HOOK_EVENTS) {
hooksSurface.ensureCodexHooksJsonEvent(tmp, ev, { absoluteRunner: '/usr/bin/node', platform: 'linux' });
}
@@ -225,21 +225,21 @@ test('upgrade 1 — extendedHookEvents descriptor reconciled to the schema-valid
test('upgrade 2 — the managed config block writes [agents] max_depth = 1', () => {
const block = install.generateCodexConfigBlock(
[{ name: 'gsd-foo', description: 'Foo' }, { name: 'gsd-bar', description: 'Bar' }],
[{ name: 'msd-foo', description: 'Foo' }, { name: 'msd-bar', description: 'Bar' }],
path.join(os.homedir(), '.codex'),
);
assert.match(block, /\[agents\]\nmax_depth = 1\n/, 'the block pins max_depth = 1 on a bare [agents] table');
// #2406: the bare [agents] scalar table is the ONLY [agents]-namespaced
// content the block emits — no [agents.gsd-*] role sub-tables. Codex
// content the block emits — no [agents.msd-*] role sub-tables. Codex
// auto-discovers roles from the standalone agents/<name>.toml files, so a
// config.toml role table pointing config_file back at that same file was a
// second, duplicate registration of the same role.
assert.doesNotMatch(block, /\[agents\.gsd-foo\]/, 'no [agents.gsd-foo] role table');
assert.doesNotMatch(block, /\[agents\.msd-foo\]/, 'no [agents.msd-foo] role table');
assert.doesNotMatch(block, /config_file/, 'no config_file line');
});
test('upgrade 2 — validateCodexConfigSchema accepts the managed [agents] block but still rejects break-forms', () => {
const block = install.generateCodexConfigBlock([{ name: 'gsd-foo', description: 'Foo' }], path.join(os.homedir(), '.codex'));
const block = install.generateCodexConfigBlock([{ name: 'msd-foo', description: 'Foo' }], path.join(os.homedir(), '.codex'));
assert.equal(install.validateCodexConfigSchema(block).ok, true, 'known-scalar [agents] table must validate');
// Still rejects the actual #2760 break-forms.
@@ -253,45 +253,45 @@ test('upgrade 2 — validateCodexConfigSchema accepts the managed [agents] block
});
test('upgrade 2 — uninstall removes the managed [agents] max_depth block', () => {
const block = install.generateCodexConfigBlock([{ name: 'gsd-foo', description: 'Foo' }], path.join(os.homedir(), '.codex'));
const stripped = install.stripGsdFromCodexConfig('model = "gpt-5"\n\n' + block);
const block = install.generateCodexConfigBlock([{ name: 'msd-foo', description: 'Foo' }], path.join(os.homedir(), '.codex'));
const stripped = install.stripMsdFromCodexConfig('model = "gpt-5"\n\n' + block);
assert.ok(stripped === null || !/\[agents\]/.test(stripped), `uninstall must remove the managed [agents] block; got: ${JSON.stringify(stripped)}`);
});
// Regression (#2088 review): install must NOT silently drop a user's own
// AgentsToml scalar tuning when it purges the bare [agents] table to add max_depth.
test('upgrade 2 — install preserves the user\'s own AgentsToml scalars (max_threads etc.), GSD-manages max_depth', () => {
test('upgrade 2 — install preserves the user\'s own AgentsToml scalars (max_threads etc.), MSD-manages max_depth', () => {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'codex-agents-merge-'));
try {
const cfgPath = path.join(tmp, 'config.toml');
fs.writeFileSync(cfgPath, '[agents]\nmax_threads = 4\nmax_depth = 9\ninterrupt_message = false\n\n[model]\nname = "o3"\n');
// extract helper: user scalars except the GSD-managed max_depth.
// extract helper: user scalars except the MSD-managed max_depth.
const scalars = install.extractCodexUserAgentsScalars(fs.readFileSync(cfgPath, 'utf8'));
assert.ok(scalars.includes('max_threads = 4'), 'max_threads is a preserved user scalar');
assert.ok(scalars.includes('interrupt_message = false'), 'interrupt_message is a preserved user scalar');
assert.ok(!scalars.some((s) => s.startsWith('max_depth')), 'max_depth is GSD-managed, not preserved from the user');
assert.ok(!scalars.some((s) => s.startsWith('max_depth')), 'max_depth is MSD-managed, not preserved from the user');
install.mergeCodexConfig(cfgPath, install.generateCodexConfigBlock([{ name: 'gsd-foo', description: 'Foo' }], tmp));
install.mergeCodexConfig(cfgPath, install.generateCodexConfigBlock([{ name: 'msd-foo', description: 'Foo' }], tmp));
const merged = fs.readFileSync(cfgPath, 'utf8');
assert.match(merged, /max_threads = 4/, 'user max_threads must survive install');
assert.match(merged, /interrupt_message = false/, 'user interrupt_message must survive install');
assert.match(merged, /max_depth = 1/, 'GSD pins max_depth = 1');
assert.doesNotMatch(merged, /max_depth = 9/, 'user max_depth is overridden by the GSD-managed value');
assert.match(merged, /max_depth = 1/, 'MSD pins max_depth = 1');
assert.doesNotMatch(merged, /max_depth = 9/, 'user max_depth is overridden by the MSD-managed value');
assert.equal((merged.match(/^\[agents\]$/mg) || []).length, 1, 'exactly one managed [agents] table (no duplicate)');
assert.equal(install.validateCodexConfigSchema(merged).ok, true, 'the merged config still validates');
// #2406: the fresh block never emitted an [agents.gsd-foo] role table in
// #2406: the fresh block never emitted an [agents.msd-foo] role table in
// the first place — canonical registration lives only in the standalone
// TOML, so there is nothing gsd-foo-shaped in config.toml to begin with.
assert.doesNotMatch(merged, /gsd-foo/, 'no [agents.gsd-foo] role table in the merged config');
// TOML, so there is nothing msd-foo-shaped in config.toml to begin with.
assert.doesNotMatch(merged, /msd-foo/, 'no [agents.msd-foo] role table in the merged config');
// Symmetric: uninstall restores the user's scalars and drops GSD's max_depth.
const uninstalled = install.stripGsdFromCodexConfig(merged);
// Symmetric: uninstall restores the user's scalars and drops MSD's max_depth.
const uninstalled = install.stripMsdFromCodexConfig(merged);
assert.match(uninstalled, /max_threads = 4/, 'uninstall restores the user\'s max_threads');
assert.match(uninstalled, /interrupt_message = false/, 'uninstall restores interrupt_message');
assert.doesNotMatch(uninstalled, /max_depth/, 'uninstall drops the GSD-managed max_depth');
assert.doesNotMatch(uninstalled, /gsd-foo/, 'no [agents.gsd-foo] role table remains after uninstall either');
assert.doesNotMatch(uninstalled, /max_depth/, 'uninstall drops the MSD-managed max_depth');
assert.doesNotMatch(uninstalled, /msd-foo/, 'no [agents.msd-foo] role table remains after uninstall either');
assert.equal(install.validateCodexConfigSchema(uninstalled).ok, true, 'the restored config validates');
} finally {
cleanup(tmp);