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

@@ -2,8 +2,8 @@
/**
* Failing-first unit tests for src/mcp-catalog.cts (compiled to
* gsd-core/bin/lib/mcp-catalog.cjs) — issue #3072 (epic #1671 Phase B),
* `.gsd/phase/feat-3072-mcp-served-catalog/40-design.md`.
* msd-core/bin/lib/mcp-catalog.cjs) — issue #3072 (epic #1671 Phase B),
* `.msd/phase/feat-3072-mcp-served-catalog/40-design.md`.
*
* Covers 50-test-matrix.md rows 4-30 and 37-47: the catalog module's own
* surface (buildCatalog / readResource / listResources / getPrompt /
@@ -36,14 +36,14 @@ const {
listResources,
shouldCompose,
REASON,
} = require('../gsd-core/bin/lib/mcp-catalog.cjs');
const { composeWorkflow } = require('../gsd-core/bin/lib/workflow-fragments.cjs');
} = require('../msd-core/bin/lib/mcp-catalog.cjs');
const { composeWorkflow } = require('../msd-core/bin/lib/workflow-fragments.cjs');
// ─── Fixture helpers ────────────────────────────────────────────────────────
/** Build a `gsd://<segment>/<relPath>` resource uri, matching the design's `gsd://workflows/...` hostile-input examples. */
/** Build a `msd://<segment>/<relPath>` resource uri, matching the design's `msd://workflows/...` hostile-input examples. */
function resourceUri(segment, relPath) {
return `gsd://${segment}/${relPath}`;
return `msd://${segment}/${relPath}`;
}
function dirEntry(name, isDir) {
@@ -120,9 +120,9 @@ function setupSymlinkEscapeFixture() {
try {
const root = createTempDir('mcp-catalog-symlink-root-');
const outsideTarget = createTempDir('mcp-catalog-symlink-outside-');
fs.mkdirSync(path.join(root, 'gsd-core', 'workflows'), { recursive: true });
fs.mkdirSync(path.join(root, 'msd-core', 'workflows'), { recursive: true });
fs.writeFileSync(path.join(outsideTarget, 'secret.md'), 'top secret');
fs.symlinkSync(path.join(outsideTarget, 'secret.md'), path.join(root, 'gsd-core', 'workflows', 'evil.md'));
fs.symlinkSync(path.join(outsideTarget, 'secret.md'), path.join(root, 'msd-core', 'workflows', 'evil.md'));
return { ok: true, root, outsideTarget };
} catch {
return { ok: false };
@@ -133,9 +133,9 @@ function setupSymlinkEscapeFixture() {
// reused by several rows below.
const markedWorkflow = [
'before prose',
'<!-- gsd:section id="sec-a" when="always" -->',
'<!-- msd:section id="sec-a" when="always" -->',
'body line',
'<!-- /gsd:section -->',
'<!-- /msd:section -->',
'after prose',
].join('\n');
@@ -148,9 +148,9 @@ const documentsMarkerSyntax = [
'',
'A section marker pair looks like this:',
'',
'<!-- gsd:section id="example" when="always" -->',
'<!-- msd:section id="example" when="always" -->',
'example body',
'<!-- /gsd:section -->',
'<!-- /msd:section -->',
'',
'That is the whole grammar.',
'',
@@ -161,8 +161,8 @@ const documentsMarkerSyntax = [
describe('resources/list — catalog module', () => {
test('lists every catalog resource with required fields (row 4)', () => {
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/a.md': unmarkedContent,
'gsd-core/references/b.md': unmarkedContent,
'msd-core/workflows/a.md': unmarkedContent,
'msd-core/references/b.md': unmarkedContent,
});
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
assert.equal(catalog.resources.size, 2);
@@ -178,9 +178,9 @@ describe('resources/list — catalog module', () => {
test('listing order is deterministic across calls (row 5)', () => {
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/z.md': unmarkedContent,
'gsd-core/workflows/a.md': unmarkedContent,
'gsd-core/references/m.md': unmarkedContent,
'msd-core/workflows/z.md': unmarkedContent,
'msd-core/workflows/a.md': unmarkedContent,
'msd-core/references/m.md': unmarkedContent,
});
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const first = listResources(catalog).resources.map((r) => r.uri);
@@ -192,7 +192,7 @@ describe('resources/list — catalog module', () => {
test('pagination at page-1 / page / page+1 (row 6)', () => {
const makeCatalogOfSize = (n) => {
const files = {};
for (let i = 0; i < n; i++) files[`gsd-core/workflows/w${i}.md`] = unmarkedContent;
for (let i = 0; i < n; i++) files[`msd-core/workflows/w${i}.md`] = unmarkedContent;
const fake = makeFakeFs('/fake-root', files);
return buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
};
@@ -214,7 +214,7 @@ describe('resources/list — catalog module', () => {
test('paginated pages reassemble the full list (row 7)', () => {
const files = {};
for (let i = 0; i < 7; i++) files[`gsd-core/workflows/w${i}.md`] = unmarkedContent;
for (let i = 0; i < 7; i++) files[`msd-core/workflows/w${i}.md`] = unmarkedContent;
const fake = makeFakeFs('/fake-root', files);
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
@@ -233,7 +233,7 @@ describe('resources/list — catalog module', () => {
});
test('unknown cursor errors rather than restarting (row 8)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/workflows/a.md': unmarkedContent });
const fake = makeFakeFs('/fake-root', { 'msd-core/workflows/a.md': unmarkedContent });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
assert.throws(
() => listResources(catalog, { cursor: 'not-a-real-cursor' }),
@@ -250,7 +250,7 @@ describe('resources/list — catalog module', () => {
});
test('single-entry catalog needs no cursor (row 10)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/only.md': unmarkedContent });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/only.md': unmarkedContent });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const page = listResources(catalog);
assert.equal(page.resources.length, 1);
@@ -262,22 +262,22 @@ describe('resources/list — catalog module', () => {
describe('resources/read — catalog module (client-controlled path surface)', () => {
test('reads a workflow with markers stripped (row 11)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/workflows/w.md': markedWorkflow });
const fake = makeFakeFs('/fake-root', { 'msd-core/workflows/w.md': markedWorkflow });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('workflows', 'w.md'));
assert.equal(result.text, composeWorkflow(markedWorkflow, { sourcePath: 'gsd-core/workflows/w.md' }));
assert.equal(result.text, composeWorkflow(markedWorkflow, { sourcePath: 'msd-core/workflows/w.md' }));
assert.equal(result.uri, resourceUri('workflows', 'w.md'));
});
test('reads a reference verbatim (row 12)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/r.md': unmarkedContent });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/r.md': unmarkedContent });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'r.md'));
assert.equal(result.text, unmarkedContent);
});
test('a doc documenting marker syntax is never composed (row 13 — the F1 defect)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/documents-markers.md': documentsMarkerSyntax });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/documents-markers.md': documentsMarkerSyntax });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'documents-markers.md'));
assert.equal(result.text, documentsMarkerSyntax, 'a reference that documents marker syntax must be served byte-identical, never composed');
@@ -285,8 +285,8 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('markers are stripped only under workflows/ (row 14)', () => {
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/w.md': markedWorkflow,
'gsd-core/references/r.md': markedWorkflow,
'msd-core/workflows/w.md': markedWorkflow,
'msd-core/references/r.md': markedWorkflow,
});
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const workflowText = readResource(catalog, resourceUri('workflows', 'w.md')).text;
@@ -296,14 +296,14 @@ describe('resources/read — catalog module (client-controlled path surface)', (
});
test('unmarked workflow composes byte-identical (row 15)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/workflows/w.md': unmarkedContent });
const fake = makeFakeFs('/fake-root', { 'msd-core/workflows/w.md': unmarkedContent });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('workflows', 'w.md'));
assert.equal(result.text, unmarkedContent, 'composing an unmarked document is a structural no-op, not a budget trick');
});
test('unknown uri errors rather than returning empty (row 16)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/workflows/a.md': unmarkedContent });
const fake = makeFakeFs('/fake-root', { 'msd-core/workflows/a.md': unmarkedContent });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
assert.throws(
() => readResource(catalog, resourceUri('workflows', 'totally-made-up.md')),
@@ -312,14 +312,14 @@ describe('resources/read — catalog module (client-controlled path surface)', (
});
const catalogForHostileUris = () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/workflows/a.md': unmarkedContent });
const fake = makeFakeFs('/fake-root', { 'msd-core/workflows/a.md': unmarkedContent });
return buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
};
test('rejects dot-dot traversal (row 17)', () => {
const catalog = catalogForHostileUris();
assert.throws(
() => readResource(catalog, 'gsd://workflows/../../../etc/passwd'),
() => readResource(catalog, 'msd://workflows/../../../etc/passwd'),
(err) => err.reason === REASON.TRAVERSAL_REFUSED
);
});
@@ -327,7 +327,7 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('rejects backslash traversal (row 18)', () => {
const catalog = catalogForHostileUris();
assert.throws(
() => readResource(catalog, 'gsd://workflows/..\\..\\secrets.md'),
() => readResource(catalog, 'msd://workflows/..\\..\\secrets.md'),
(err) => err.reason === REASON.TRAVERSAL_REFUSED
);
});
@@ -335,7 +335,7 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('rejects percent-encoded traversal (row 19)', () => {
const catalog = catalogForHostileUris();
assert.throws(
() => readResource(catalog, 'gsd://workflows/%2e%2e%2fsecrets.md'),
() => readResource(catalog, 'msd://workflows/%2e%2e%2fsecrets.md'),
(err) => err.reason === REASON.TRAVERSAL_REFUSED
);
});
@@ -343,7 +343,7 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('rejects double-encoded traversal (row 20)', () => {
const catalog = catalogForHostileUris();
assert.throws(
() => readResource(catalog, 'gsd://workflows/%252e%252e%252fsecrets.md'),
() => readResource(catalog, 'msd://workflows/%252e%252e%252fsecrets.md'),
(err) => err.reason === REASON.TRAVERSAL_REFUSED
);
});
@@ -375,7 +375,7 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('rejects a uri containing a null byte (row 24)', () => {
const catalog = catalogForHostileUris();
assert.throws(
() => readResource(catalog, 'gsd://workflows/a.md\u0000.txt'),
() => readResource(catalog, 'msd://workflows/a.md\u0000.txt'),
(err) => err.reason === REASON.TRAVERSAL_REFUSED
);
});
@@ -403,8 +403,8 @@ describe('resources/read — catalog module (client-controlled path surface)', (
// catalog's disk snapshot at all, simulating a file added post-startup.
// Index membership, not disk existence, is the sole authority.
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/a.md': unmarkedContent,
'gsd-core/workflows/b.md': unmarkedContent,
'msd-core/workflows/a.md': unmarkedContent,
'msd-core/workflows/b.md': unmarkedContent,
});
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
assert.throws(
@@ -415,8 +415,8 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('non-indexed file types are not served (row 27)', () => {
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/a.md': unmarkedContent,
'gsd-core/workflows/section-manifest.json': '{}',
'msd-core/workflows/a.md': unmarkedContent,
'msd-core/workflows/section-manifest.json': '{}',
});
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
assert.equal(catalog.resources.size, 1, 'the .json sibling must not be indexed');
@@ -448,7 +448,7 @@ describe('resources/read — catalog module (client-controlled path surface)', (
test('unknown root segment is rejected (row 30)', () => {
const catalog = catalogForHostileUris();
assert.throws(
() => readResource(catalog, 'gsd://bogus-root-segment/a.md'),
() => readResource(catalog, 'msd://bogus-root-segment/a.md'),
(err) => err.reason === REASON.UNKNOWN_ROOT
);
});
@@ -459,7 +459,7 @@ describe('resources/read — catalog module (client-controlled path surface)', (
describe('content correctness — catalog module', () => {
test('CRLF content survives serving (row 37)', () => {
const content = ['line one', 'line two', 'line three', ''].join('\r\n');
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/r.md': content });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/r.md': content });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'r.md'));
assert.equal(result.text, content);
@@ -467,7 +467,7 @@ describe('content correctness — catalog module', () => {
test('mixed line endings survive serving (row 38)', () => {
const content = 'line one\r\nline two\nline three\r\nline four\n';
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/r.md': content });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/r.md': content });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'r.md'));
assert.equal(result.text, content);
@@ -475,7 +475,7 @@ describe('content correctness — catalog module', () => {
test('missing trailing newline is preserved (row 39)', () => {
const content = ['line one', 'line two, no trailing newline after this'].join('\n');
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/r.md': content });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/r.md': content });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'r.md'));
assert.equal(result.text, content);
@@ -483,7 +483,7 @@ describe('content correctness — catalog module', () => {
});
test('an empty file serves as empty text (row 40)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/empty.md': '' });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/empty.md': '' });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'empty.md'));
assert.equal(result.text, '');
@@ -491,7 +491,7 @@ describe('content correctness — catalog module', () => {
test('unicode content is preserved (row 41)', () => {
const content = ['# 日本語のタイトル', '', 'emoji check: 🎉🚀 café naïve', ''].join('\n');
const fake = makeFakeFs('/fake-root', { 'gsd-core/references/r.md': content });
const fake = makeFakeFs('/fake-root', { 'msd-core/references/r.md': content });
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
const result = readResource(catalog, resourceUri('references', 'r.md'));
assert.equal(result.text, content);
@@ -504,10 +504,10 @@ describe('content correctness — catalog module', () => {
describe('IO faults — injected via the seam, never chmod', () => {
test('one unreadable file does not break the catalog (row 42)', () => {
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/good.md': unmarkedContent,
'gsd-core/workflows/bad.md': unmarkedContent,
'msd-core/workflows/good.md': unmarkedContent,
'msd-core/workflows/bad.md': unmarkedContent,
});
const badAbsPath = `${fake.root}/gsd-core/workflows/bad.md`;
const badAbsPath = `${fake.root}/msd-core/workflows/bad.md`;
const realReadFile = fake.readFile;
const faultyReadFile = (absPath) => {
// Same separator-normalization as makeFakeFs: a production-supplied
@@ -533,8 +533,8 @@ describe('IO faults — injected via the seam, never chmod', () => {
});
test('a directory read failure fails closed (row 43)', () => {
const fake = makeFakeFs('/fake-root', { 'gsd-core/workflows/a.md': unmarkedContent });
const workflowsDirAbs = `${fake.root}/gsd-core/workflows`;
const fake = makeFakeFs('/fake-root', { 'msd-core/workflows/a.md': unmarkedContent });
const workflowsDirAbs = `${fake.root}/msd-core/workflows`;
const realReadDir = fake.readDir;
const faultyReadDir = (absPath) => {
// Same separator-normalization as makeFakeFs: a production-supplied
@@ -550,10 +550,10 @@ describe('IO faults — injected via the seam, never chmod', () => {
});
test('a malformed marker is contained to its file (row 44)', () => {
const malformed = ['before', '<!-- gsd:section id="x" when="always" -->', 'never closed'].join('\n');
const malformed = ['before', '<!-- msd:section id="x" when="always" -->', 'never closed'].join('\n');
const fake = makeFakeFs('/fake-root', {
'gsd-core/workflows/good.md': unmarkedContent,
'gsd-core/workflows/bad.md': malformed,
'msd-core/workflows/good.md': unmarkedContent,
'msd-core/workflows/bad.md': malformed,
});
const catalog = buildCatalog({ root: fake.root, readFile: fake.readFile, readDir: fake.readDir });
@@ -617,14 +617,14 @@ describe('resolution / scoping — module location vs cwd', () => {
);
});
test('a project-local gsd-core is never a catalog root (row 47)', (t) => {
test('a project-local msd-core is never a catalog root (row 47)', (t) => {
const decoyCwd = createTempDir('mcp-catalog-decoy-project-');
t.after(() => cleanup(decoyCwd));
const fs = require('node:fs');
const path = require('node:path');
fs.mkdirSync(path.join(decoyCwd, 'gsd-core', 'workflows'), { recursive: true });
fs.writeFileSync(path.join(decoyCwd, 'gsd-core', 'workflows', 'trap.md'), 'decoy content that must never be served');
fs.mkdirSync(path.join(decoyCwd, 'msd-core', 'workflows'), { recursive: true });
fs.writeFileSync(path.join(decoyCwd, 'msd-core', 'workflows', 'trap.md'), 'decoy content that must never be served');
const catalog = withMockedCwd(decoyCwd, () => buildCatalog({}));
@@ -632,7 +632,7 @@ describe('resolution / scoping — module location vs cwd', () => {
assert.equal(
uris.includes(resourceUri('workflows', 'trap.md')),
false,
"a project-local gsd-core/ present at ctx.cwd's decoy location must never become a catalog root"
"a project-local msd-core/ present at ctx.cwd's decoy location must never become a catalog root"
);
});
});
@@ -640,9 +640,9 @@ describe('resolution / scoping — module location vs cwd', () => {
// ─── shouldCompose — the F1 predicate (exercised directly, supplements rows 12-15) ──
describe('shouldCompose — the shared F1 predicate', () => {
test('shouldCompose is true only for paths under gsd-core/workflows/', () => {
assert.equal(shouldCompose('gsd-core/workflows/plan-phase.md'), true);
assert.equal(shouldCompose('gsd-core/references/foo.md'), false);
assert.equal(shouldCompose('commands/gsd/plan-phase.md'), false);
test('shouldCompose is true only for paths under msd-core/workflows/', () => {
assert.equal(shouldCompose('msd-core/workflows/plan-phase.md'), true);
assert.equal(shouldCompose('msd-core/references/foo.md'), false);
assert.equal(shouldCompose('commands/msd/plan-phase.md'), false);
});
});