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

@@ -7,22 +7,22 @@
* `runMinimalInstall`) plus targeted unit coverage to prove the four real
* upgrades Kilo contributes as part of the imperative-adapter migration:
*
* UPGRADE 1 — native hook-bus plugin: `.kilo/plugins/gsd-core.js`, a
* byte-identical copy of `.opencode/plugins/gsd-core.js` (Kilo is an
* UPGRADE 1 — native hook-bus plugin: `.kilo/plugins/msd-core.js`, a
* byte-identical copy of `.opencode/plugins/msd-core.js` (Kilo is an
* OpenCode fork sharing the same plugin/extension event bus).
*
* UPGRADE 2 — active-model routing: `convertClaudeToKiloFrontmatter` now
* emits a `model:` field from the resolved model override instead of
* always stripping it (mirrors the OpenCode upgrade, #2256).
*
* UPGRADE 3 — MCP companion documented + reachable: `docs/how-to/connect-gsd-mcp-server.md`
* UPGRADE 3 — MCP companion documented + reachable: `docs/how-to/connect-msd-mcp-server.md`
* covers Kilo's `mcp`-keyed config (not `mcpServers`), and the companion the
* doc points at (`bin/gsd-mcp-server.js`) is proven live by spawning it and
* doc points at (`bin/msd-mcp-server.js`) is proven live by spawning it and
* performing a real initialize + tools/list handshake (AC4: "test: connect
* and list tools") — mirrors tests/gsd-mcp-server-bin.test.cjs exactly.
* and list tools") — mirrors tests/msd-mcp-server-bin.test.cjs exactly.
*
* UPGRADE 4 — named subagent dispatch: GSD's specialist agents install as
* `<configDir>/agents/gsd-*.md` with `mode: subagent` + a `permission:`
* UPGRADE 4 — named subagent dispatch: MSD's specialist agents install as
* `<configDir>/agents/msd-*.md` with `mode: subagent` + a `permission:`
* block — the slug Kilo's Task tool dispatches by.
*/
@@ -39,16 +39,16 @@ const { runMinimalInstall, BUILD_SCRIPT } = require('./helpers/install-shared.cj
const { cleanup } = require('./helpers.cjs');
const { listAgentFiles } = require('./helpers/agent-roster.cjs');
const { convertClaudeToKiloFrontmatter } = require('../bin/install.js');
const { PROTOCOL_VERSION } = require('../gsd-core/bin/lib/mcp-server.cjs');
const { PROTOCOL_VERSION } = require('../msd-core/bin/lib/mcp-server.cjs');
const MCP_SERVER_BIN = path.join(__dirname, '..', 'bin', 'gsd-mcp-server.js');
const MCP_SERVER_BIN = path.join(__dirname, '..', 'bin', 'msd-mcp-server.js');
const KILO_CAP = JSON.parse(
fs.readFileSync(path.join(__dirname, '..', 'capabilities', 'kilo', 'capability.json'), 'utf8'),
);
const ADAPTER_SRC = path.join(__dirname, '..', '.kilo', 'plugins', 'gsd-core.js');
const OPENCODE_ADAPTER_SRC = path.join(__dirname, '..', '.opencode', 'plugins', 'gsd-core.js');
const ADAPTER_SRC = path.join(__dirname, '..', '.kilo', 'plugins', 'msd-core.js');
const OPENCODE_ADAPTER_SRC = path.join(__dirname, '..', '.opencode', 'plugins', 'msd-core.js');
/** Extract the YAML frontmatter block (between the first pair of `---` lines), or null. */
function parseFrontmatter(content) {
@@ -57,20 +57,20 @@ function parseFrontmatter(content) {
}
// ---------------------------------------------------------------------------
// UPGRADE 1: native hook-bus plugin (.kilo/plugins/gsd-core.js)
// UPGRADE 1: native hook-bus plugin (.kilo/plugins/msd-core.js)
// ---------------------------------------------------------------------------
for (const scope of ['global', 'local']) {
test(`kilo --${scope}: installs .../plugins/gsd-core.js byte-identical to the repo source (UPGRADE 1)`, (t) => {
test(`kilo --${scope}: installs .../plugins/msd-core.js byte-identical to the repo source (UPGRADE 1)`, (t) => {
const { configDir, root } = runMinimalInstall({ runtime: 'kilo', scope });
t.after(() => cleanup(root));
const installedPluginPath = path.join(configDir, 'plugins', 'gsd-core.js');
const installedPluginPath = path.join(configDir, 'plugins', 'msd-core.js');
assert.ok(fs.existsSync(installedPluginPath), `${installedPluginPath} must exist`);
const installed = fs.readFileSync(installedPluginPath);
const source = fs.readFileSync(ADAPTER_SRC);
assert.ok(installed.equals(source), 'installed plugin must byte-equal the repo .kilo/plugins/gsd-core.js source');
assert.ok(installed.equals(source), 'installed plugin must byte-equal the repo .kilo/plugins/msd-core.js source');
});
}
@@ -92,9 +92,9 @@ function loaderExtract(mod) {
return servers;
}
test('.kilo/plugins/gsd-core.js loads as raw CommonJS and exposes id "gsd-core" + server._internals (UPGRADE 1)', () => {
test('.kilo/plugins/msd-core.js loads as raw CommonJS and exposes id "msd-core" + server._internals (UPGRADE 1)', () => {
const mod = require(ADAPTER_SRC);
assert.equal(mod.id, 'gsd-core');
assert.equal(mod.id, 'msd-core');
// NON-ENUMERABLE so it never lands in Object.values (would throw in the loader loop).
assert.ok(!Object.keys(mod).includes('id'), 'id must be non-enumerable');
const servers = loaderExtract(mod); // must not throw
@@ -104,19 +104,19 @@ test('.kilo/plugins/gsd-core.js loads as raw CommonJS and exposes id "gsd-core"
assert.ok(mod.server._internals, 'server._internals must be present');
});
// DEFECT.GENERATIVE-FIX parity guard: .kilo/plugins/gsd-core.js is a deliberate
// byte-copy of .opencode/plugins/gsd-core.js (Kilo is an OpenCode fork sharing
// DEFECT.GENERATIVE-FIX parity guard: .kilo/plugins/msd-core.js is a deliberate
// byte-copy of .opencode/plugins/msd-core.js (Kilo is an OpenCode fork sharing
// the same plugin/extension event bus, see the UPGRADE 1 doc comment above).
// Nothing enforces that copy relationship — a future edit to either file that
// forgets its twin would silently drift the two runtimes apart. This fails the
// instant that happens.
test('.kilo/plugins/gsd-core.js stays byte-identical to .opencode/plugins/gsd-core.js (Kilo is an OpenCode fork; parity guard, UPGRADE 1)', () => {
test('.kilo/plugins/msd-core.js stays byte-identical to .opencode/plugins/msd-core.js (Kilo is an OpenCode fork; parity guard, UPGRADE 1)', () => {
const kilo = fs.readFileSync(ADAPTER_SRC, 'utf8');
const opencode = fs.readFileSync(OPENCODE_ADAPTER_SRC, 'utf8');
assert.equal(
kilo,
opencode,
'.kilo/plugins/gsd-core.js and .opencode/plugins/gsd-core.js must stay byte-identical — ' +
'.kilo/plugins/msd-core.js and .opencode/plugins/msd-core.js must stay byte-identical — ' +
'Kilo is an OpenCode fork and intentionally reuses the same plugin verbatim; if you edited ' +
'one, mirror the change into the other (or this guard will keep failing).',
);
@@ -127,18 +127,18 @@ test('.kilo/plugins/gsd-core.js stays byte-identical to .opencode/plugins/gsd-co
// ---------------------------------------------------------------------------
const SAMPLE_AGENT = `---
name: gsd-executor
description: Executes GSD plans with atomic commits
name: msd-executor
description: Executes MSD plans with atomic commits
tools: Read, Write, Edit, Bash, Grep, Glob
color: yellow
---
<role>
You are a GSD plan executor.
You are a MSD plan executor.
</role>`;
const SAMPLE_COMMAND = `---
name: gsd-execute-phase
name: msd-execute-phase
description: Execute all plans in a phase
allowed-tools:
- Read
@@ -168,8 +168,8 @@ test('UPGRADE 2: convertClaudeToKiloFrontmatter emits NO model: for commands, ev
// Note: a bare runMinimalInstall does NOT configure a runtime model_overrides/
// model_profile_overrides config, so installed agents will NOT carry a model:
// line from a plain install — that is expected (readGsdEffectiveModelOverrides
// / readGsdRuntimeProfileResolver resolve to nothing) and is NOT a regression.
// line from a plain install — that is expected (readMsdEffectiveModelOverrides
// / readMsdRuntimeProfileResolver resolve to nothing) and is NOT a regression.
// The unit tests above are the correct surface for proving U2's "stop
// stripping, emit requested model" behavior change.
@@ -177,13 +177,13 @@ test('UPGRADE 2: convertClaudeToKiloFrontmatter emits NO model: for commands, ev
// UPGRADE 3: MCP companion documented
// ---------------------------------------------------------------------------
// allow-test-rule: docs-parity (#2093) — docs/how-to/connect-gsd-mcp-server.md
// allow-test-rule: docs-parity (#2093) — docs/how-to/connect-msd-mcp-server.md
// must document Kilo's real mcp-keyed config (not mcpServers); the doc prose IS
// the canonical statement of that fact and there is no runtime API to enumerate
// it, so reading the file and asserting on its text is the only parity check
// available.
test('UPGRADE 3: docs/how-to/connect-gsd-mcp-server.md documents Kilo\'s mcp-keyed config', () => {
const docPath = path.join(__dirname, '..', 'docs', 'how-to', 'connect-gsd-mcp-server.md');
test('UPGRADE 3: docs/how-to/connect-msd-mcp-server.md documents Kilo\'s mcp-keyed config', () => {
const docPath = path.join(__dirname, '..', 'docs', 'how-to', 'connect-msd-mcp-server.md');
const doc = fs.readFileSync(docPath, 'utf8');
assert.match(doc, /Kilo/, 'doc must mention Kilo');
assert.match(doc, /`mcp` key \(\*\*not\*\* `mcpServers`\)/,
@@ -194,11 +194,11 @@ test('UPGRADE 3: docs/how-to/connect-gsd-mcp-server.md documents Kilo\'s mcp-key
});
// AC4 ("test: connect and list tools"): prove the companion Kilo's `mcp` config
// points at (bin/gsd-mcp-server.js) is actually reachable, not just documented.
// Mirrors tests/gsd-mcp-server-bin.test.cjs's spawn/handshake mechanism exactly
// points at (bin/msd-mcp-server.js) is actually reachable, not just documented.
// Mirrors tests/msd-mcp-server-bin.test.cjs's spawn/handshake mechanism exactly
// (same shim, same line-delimited JSON-RPC over stdio, same clean-exit-on-EOF
// contract) rather than reinventing the protocol handshake.
test('UPGRADE 3: gsd-mcp-server companion is reachable — spawn, initialize, tools/list over stdio (AC4)', () => {
test('UPGRADE 3: msd-mcp-server companion is reachable — spawn, initialize, tools/list over stdio (AC4)', () => {
const stdin = [
JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize' }),
JSON.stringify({ jsonrpc: '2.0', id: 2, method: 'tools/list' }),
@@ -208,10 +208,10 @@ test('UPGRADE 3: gsd-mcp-server companion is reachable — spawn, initialize, to
input: stdin,
encoding: 'utf-8',
timeout: PROBE_TIMEOUT_MS,
env: { ...process.env, GSD_TEST_MODE: '1' },
env: { ...process.env, MSD_TEST_MODE: '1' },
});
assert.strictEqual(res.status, 0, `gsd-mcp-server must exit cleanly on stdin EOF; stderr: ${res.stderr}`);
assert.strictEqual(res.status, 0, `msd-mcp-server must exit cleanly on stdin EOF; stderr: ${res.stderr}`);
const lines = res.stdout.trim().split('\n').map((l) => JSON.parse(l));
assert.strictEqual(lines.length, 2, 'one response per request');
assert.strictEqual(lines[0].id, 1);
@@ -220,8 +220,8 @@ test('UPGRADE 3: gsd-mcp-server companion is reachable — spawn, initialize, to
const toolNames = lines[1].result.tools.map((t) => t.name).sort();
assert.deepStrictEqual(
toolNames,
['gsd_invoke_command', 'gsd_read_state', 'gsd_write_state'],
'the companion Kilo\'s mcp config connects to advertises the real GSD tool surface',
['msd_invoke_command', 'msd_read_state', 'msd_write_state'],
'the companion Kilo\'s mcp config connects to advertises the real MSD tool surface',
);
});
@@ -244,17 +244,17 @@ for (const scope of ['global', 'local']) {
const expectedNames = listAgentFiles();
assert.equal(expectedNames.length, 35,
'sanity: shipped GSD agent roster is 35 files — update this boundary if the roster changes');
'sanity: shipped MSD agent roster is 35 files — update this boundary if the roster changes');
const installedFiles = fs.readdirSync(agentsDir)
.filter((f) => f.startsWith('gsd-') && f.endsWith('.md'));
.filter((f) => f.startsWith('msd-') && f.endsWith('.md'));
assert.ok(installedFiles.length >= expectedNames.length,
`expected at least ${expectedNames.length} installed agents under ${agentsDir}, got ${installedFiles.length}`);
for (const name of expectedNames) {
assert.ok(installedFiles.includes(`${name}.md`), `${name}.md must be installed under ${agentsDir}`);
}
for (const known of ['gsd-code-reviewer', 'gsd-planner', 'gsd-executor']) {
for (const known of ['msd-code-reviewer', 'msd-planner', 'msd-executor']) {
const filePath = path.join(agentsDir, `${known}.md`);
assert.ok(fs.existsSync(filePath), `${filePath} must exist`);
@@ -323,11 +323,11 @@ before(() => {
// The PreToolUse guards the plugin spawns that ship today. When a new
// guard lands on the plugin's dispatch path, add it here.
const PLUGIN_GUARD_HOOKS = [
'gsd-prompt-guard.js',
'gsd-read-guard.js',
'gsd-worktree-path-guard.js',
'gsd-workflow-guard.js',
'gsd-secret-read-guard.js',
'msd-prompt-guard.js',
'msd-read-guard.js',
'msd-worktree-path-guard.js',
'msd-workflow-guard.js',
'msd-secret-read-guard.js',
];
for (const scope of ['global', 'local']) {
@@ -335,12 +335,12 @@ for (const scope of ['global', 'local']) {
const { manifest, configDir, root } = runMinimalInstall({ runtime: 'kilo', scope });
t.after(() => cleanup(root));
// The shared hooks bundle lands in the config dir, next to gsd-core/.
// The shared hooks bundle lands in the config dir, next to msd-core/.
for (const hook of PLUGIN_GUARD_HOOKS) {
const hookPath = path.join(configDir, 'hooks', hook);
assert.ok(fs.existsSync(hookPath), `${hookPath} must be staged by the install`);
}
// #2544: the CommonJS marker is staged INSIDE the directories GSD owns and
// #2544: the CommonJS marker is staged INSIDE the directories MSD owns and
// fills — hooks/ (the staged guard scripts) and plugins/ (the native
// adapter) — never at the config root, which is user-writable territory on
// Kilo (where a package.json declares local-plugin npm dependencies).
@@ -350,21 +350,21 @@ for (const scope of ['global', 'local']) {
assert.equal(JSON.parse(fs.readFileSync(marker, 'utf8')).type, 'commonjs');
}
assert.ok(!fs.existsSync(path.join(configDir, 'package.json')),
'the config root must not receive a GSD package.json (#2544)');
'the config root must not receive a MSD package.json (#2544)');
// Staged hooks are tracked in the manifest (drift/uninstall accounting).
assert.ok(manifest && manifest.files['hooks/gsd-prompt-guard.js'],
assert.ok(manifest && manifest.files['hooks/msd-prompt-guard.js'],
'manifest must track the staged guard hooks');
// The installed plugin's own walk-up resolution (hooks/ + gsd-core/ both
// The installed plugin's own walk-up resolution (hooks/ + msd-core/ both
// present) lands on the config dir — i.e. HOOKS_DIR points at the staged
// scripts, closing the resolveRepoRoot fallback miss from #2305.
const installedPlugin = path.join(configDir, 'plugins', 'gsd-core.js');
const installedPlugin = path.join(configDir, 'plugins', 'msd-core.js');
assert.ok(fs.existsSync(installedPlugin), 'native plugin must be staged');
delete require.cache[require.resolve(installedPlugin)];
const mod = require(installedPlugin);
assert.equal(mod.server._internals.REPO_ROOT, fs.realpathSync(configDir),
'plugin REPO_ROOT must resolve to the config dir (hooks/ + gsd-core/ siblings)');
'plugin REPO_ROOT must resolve to the config dir (hooks/ + msd-core/ siblings)');
});
}
@@ -372,10 +372,10 @@ test('kilo: a disallowed write through the REAL installed tree is rejected by th
const { configDir, root } = runMinimalInstall({ runtime: 'kilo', scope: 'global' });
t.after(() => cleanup(root));
// Build a GSD-shaped executor worktree: gsd-worktree-path-guard hard-blocks
// Build a MSD-shaped executor worktree: msd-worktree-path-guard hard-blocks
// only when cwd is a linked worktree on a worktree-agent-* branch and the
// write targets an absolute path outside that worktree's toplevel.
const scratch = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-kilo-2305-')));
const scratch = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-kilo-2305-')));
t.after(() => cleanup(scratch));
const mainRepo = path.join(scratch, 'main');
fs.mkdirSync(mainRepo, { recursive: true });
@@ -392,7 +392,7 @@ test('kilo: a disallowed write through the REAL installed tree is rejected by th
git(['worktree', 'add', '-q', '-b', 'worktree-agent-2305', wt], mainRepo);
// Load the plugin exactly as installed and pin its cwd to the worktree.
const installedPlugin = path.join(configDir, 'plugins', 'gsd-core.js');
const installedPlugin = path.join(configDir, 'plugins', 'msd-core.js');
delete require.cache[require.resolve(installedPlugin)];
const mod = require(installedPlugin);
const handlers = await mod.server({ directory: wt });