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:
@@ -3,9 +3,9 @@
|
||||
/**
|
||||
* VS Code extension reachability test — ADR-1239 Phase D / #1942, upgraded #2103.
|
||||
*
|
||||
* Proves the VS Code extension is keystone-WIRED: the gsd.invoke handler
|
||||
* dispatches through gsd-tools.cjs (subprocess-reuse — the shared
|
||||
* `dispatchGsdCommand` in gsd-core/bin/lib/shell-command-projection.cjs) and
|
||||
* Proves the VS Code extension is keystone-WIRED: the msd.invoke handler
|
||||
* dispatches through msd-tools.cjs (subprocess-reuse — the shared
|
||||
* `dispatchMsdCommand` in msd-core/bin/lib/shell-command-projection.cjs) and
|
||||
* returns REAL output, not just a registration on a stub. The handler is
|
||||
* exported separately from activate() so it is testable WITHOUT a VS Code host.
|
||||
*
|
||||
@@ -27,17 +27,17 @@ const path = require('node:path');
|
||||
const fs = require('node:fs');
|
||||
|
||||
const extension = require('../vscode/extension.js');
|
||||
const { activate, dispatchGsdCommand, resolveEngineRoot, resolveWorkspaceCwd } = extension;
|
||||
const { activate, dispatchMsdCommand, resolveEngineRoot, resolveWorkspaceCwd } = extension;
|
||||
const { createTempDir, cleanup } = require('./helpers.cjs');
|
||||
const shellCommandProjection = require('../gsd-core/bin/lib/shell-command-projection.cjs');
|
||||
const shellCommandProjection = require('../msd-core/bin/lib/shell-command-projection.cjs');
|
||||
|
||||
test('the extension exports activate + dispatchGsdCommand + resolveEngineRoot', () => {
|
||||
test('the extension exports activate + dispatchMsdCommand + resolveEngineRoot', () => {
|
||||
assert.equal(typeof activate, 'function');
|
||||
assert.equal(typeof dispatchGsdCommand, 'function');
|
||||
assert.equal(typeof dispatchMsdCommand, 'function');
|
||||
assert.equal(typeof resolveEngineRoot, 'function');
|
||||
});
|
||||
|
||||
test('REACHABILITY: dispatchGsdCommand dispatches a real family/subcommand through gsd-tools.cjs and returns REAL output (keystone wired, not UnknownCommand)', async () => {
|
||||
test('REACHABILITY: dispatchMsdCommand dispatches a real family/subcommand through msd-tools.cjs and returns REAL output (keystone wired, not UnknownCommand)', async () => {
|
||||
const dir = createTempDir();
|
||||
try {
|
||||
// #3217 (ADR-3180 §7.6 rule 4): a free-form ROADMAP.md (no version
|
||||
@@ -46,7 +46,7 @@ test('REACHABILITY: dispatchGsdCommand dispatches a real family/subcommand throu
|
||||
// is withheld (null), breaking this reachability proxy.
|
||||
fs.mkdirSync(path.join(dir, '.planning'), { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, '.planning', 'ROADMAP.md'), '# Roadmap\n');
|
||||
const result = await dispatchGsdCommand({ family: 'progress', subcommand: 'json', cwd: dir });
|
||||
const result = await dispatchMsdCommand({ family: 'progress', subcommand: 'json', cwd: dir });
|
||||
assert.equal(typeof result, 'string', 'returns a string result');
|
||||
const parsed = JSON.parse(result);
|
||||
assert.ok(parsed !== null && typeof parsed === 'object', 'dispatch produced a result object');
|
||||
@@ -65,7 +65,7 @@ test('REACHABILITY: dispatchGsdCommand dispatches a real family/subcommand throu
|
||||
test('REACHABILITY: an unknown family surfaces ok:false without throwing (not a silent UnknownCommand success)', async () => {
|
||||
const dir = createTempDir();
|
||||
try {
|
||||
const result = await dispatchGsdCommand({ family: 'no-such-family-8675309', cwd: dir });
|
||||
const result = await dispatchMsdCommand({ family: 'no-such-family-8675309', cwd: dir });
|
||||
const parsed = JSON.parse(result);
|
||||
assert.equal(parsed.ok, false);
|
||||
assert.match(parsed.stderr, /no-such-family-8675309|Unknown command/);
|
||||
@@ -74,34 +74,34 @@ test('REACHABILITY: an unknown family surfaces ok:false without throwing (not a
|
||||
}
|
||||
});
|
||||
|
||||
test('dispatchGsdCommand works with default args (no args → gsd-tools.cjs --help, a real working default)', async () => {
|
||||
const result = await dispatchGsdCommand();
|
||||
test('dispatchMsdCommand works with default args (no args → msd-tools.cjs --help, a real working default)', async () => {
|
||||
const result = await dispatchMsdCommand();
|
||||
assert.equal(typeof result, 'string');
|
||||
const parsed = JSON.parse(result); // must be valid JSON
|
||||
assert.equal(parsed.ok, true, `expected the --help default to be ok:true, got: ${result}`);
|
||||
assert.match(parsed.stdout, /Usage: gsd-tools/, 'the --help default produced real usage output');
|
||||
assert.match(parsed.stdout, /Usage: msd-tools/, 'the --help default produced real usage output');
|
||||
});
|
||||
|
||||
test('resolveEngineRoot finds the gsd-core/ dir from the extension location', () => {
|
||||
test('resolveEngineRoot finds the msd-core/ dir from the extension location', () => {
|
||||
const root = resolveEngineRoot(__dirname + '/../vscode');
|
||||
const fs = require('fs');
|
||||
assert.ok(fs.existsSync(require('path').join(root, 'gsd-core')),
|
||||
'resolveEngineRoot finds a dir containing gsd-core/');
|
||||
assert.ok(fs.existsSync(require('path').join(root, 'msd-core')),
|
||||
'resolveEngineRoot finds a dir containing msd-core/');
|
||||
});
|
||||
|
||||
test('the extension manifest declares the gsd.invoke command', () => {
|
||||
test('the extension manifest declares the msd.invoke command', () => {
|
||||
const pkg = require('../vscode/package.json');
|
||||
assert.ok(pkg.contributes && pkg.contributes.commands, 'manifest has commands');
|
||||
const cmd = pkg.contributes.commands.find((c) => c.command === 'gsd.invoke');
|
||||
assert.ok(cmd, 'manifest declares gsd.invoke');
|
||||
const cmd = pkg.contributes.commands.find((c) => c.command === 'msd.invoke');
|
||||
assert.ok(cmd, 'manifest declares msd.invoke');
|
||||
assert.ok(pkg.engines && pkg.engines.vscode, 'manifest declares VS Code engine');
|
||||
assert.equal(pkg.main, './extension.js', 'manifest main points to extension.js');
|
||||
});
|
||||
|
||||
// ── #2103 FIX (adversarial review, MAJOR): all three desktop dispatch
|
||||
// surfaces previously called dispatchGsdCommand WITHOUT a cwd, silently
|
||||
// surfaces previously called dispatchMsdCommand WITHOUT a cwd, silently
|
||||
// defaulting to the extension host's own process.cwd() instead of the user's
|
||||
// project — meaning GSD ran against the wrong directory. resolveWorkspaceCwd
|
||||
// project — meaning MSD ran against the wrong directory. resolveWorkspaceCwd
|
||||
// resolves vscode.workspace.workspaceFolders[0].uri.fsPath, computed fresh
|
||||
// per-invocation (never cached at activate() time). ─────────────────────────
|
||||
|
||||
@@ -118,14 +118,14 @@ test('resolveWorkspaceCwd falls back to process.cwd() when no workspace folder i
|
||||
});
|
||||
});
|
||||
|
||||
test('#2103 FIX: all three desktop dispatch surfaces (gsd.invoke command, @gsd chat participant, LM tool invoke) thread the resolved workspace folder as cwd — not process.cwd()', async () => {
|
||||
// Spy on the SHARED subprocess-shim dispatchGsdCommand (the one every
|
||||
// surface ultimately calls via extension.js's own dispatchGsdCommand) so we
|
||||
test('#2103 FIX: all three desktop dispatch surfaces (msd.invoke command, @msd chat participant, LM tool invoke) thread the resolved workspace folder as cwd — not process.cwd()', async () => {
|
||||
// Spy on the SHARED subprocess-shim dispatchMsdCommand (the one every
|
||||
// surface ultimately calls via extension.js's own dispatchMsdCommand) so we
|
||||
// observe the actual `cwd` each surface passes, without needing a real
|
||||
// gsd-tools.cjs project rooted at the mock workspace path.
|
||||
const originalShimDispatch = shellCommandProjection.dispatchGsdCommand;
|
||||
// msd-tools.cjs project rooted at the mock workspace path.
|
||||
const originalShimDispatch = shellCommandProjection.dispatchMsdCommand;
|
||||
const calls = [];
|
||||
shellCommandProjection.dispatchGsdCommand = (args) => {
|
||||
shellCommandProjection.dispatchMsdCommand = (args) => {
|
||||
calls.push(args);
|
||||
return originalShimDispatch(args);
|
||||
};
|
||||
@@ -144,7 +144,7 @@ test('#2103 FIX: all three desktop dispatch surfaces (gsd.invoke command, @gsd c
|
||||
registerTool(name, impl) { toolImpls.push({ name, impl }); return { dispose() {} }; },
|
||||
},
|
||||
workspace: {
|
||||
workspaceFolders: [{ uri: { fsPath: '/tmp/mock-gsd-workspace' } }],
|
||||
workspaceFolders: [{ uri: { fsPath: '/tmp/mock-msd-workspace' } }],
|
||||
getConfiguration: () => ({ get: () => undefined }),
|
||||
},
|
||||
LanguageModelTextPart: class { constructor(t) { this.text = t; } },
|
||||
@@ -169,35 +169,35 @@ test('#2103 FIX: all three desktop dispatch surfaces (gsd.invoke command, @gsd c
|
||||
};
|
||||
freshExtension.activate(context);
|
||||
|
||||
// Surface 1: gsd.invoke command handler.
|
||||
// Surface 1: msd.invoke command handler.
|
||||
calls.length = 0;
|
||||
await registeredCommands['gsd.invoke']({ family: 'progress', subcommand: 'json' });
|
||||
assert.equal(calls.length, 1, 'gsd.invoke handler must dispatch exactly once');
|
||||
assert.equal(calls[0].cwd, '/tmp/mock-gsd-workspace', 'gsd.invoke must thread the workspace folder as cwd');
|
||||
await registeredCommands['msd.invoke']({ family: 'progress', subcommand: 'json' });
|
||||
assert.equal(calls.length, 1, 'msd.invoke handler must dispatch exactly once');
|
||||
assert.equal(calls[0].cwd, '/tmp/mock-msd-workspace', 'msd.invoke must thread the workspace folder as cwd');
|
||||
|
||||
// Surface 1b: an explicit args.cwd still takes precedence over the resolved workspace.
|
||||
calls.length = 0;
|
||||
await registeredCommands['gsd.invoke']({ family: 'progress', subcommand: 'json', cwd: '/explicit/override' });
|
||||
await registeredCommands['msd.invoke']({ family: 'progress', subcommand: 'json', cwd: '/explicit/override' });
|
||||
assert.equal(calls[0].cwd, '/explicit/override', 'an explicit cwd argument must still override the resolved workspace folder');
|
||||
|
||||
// Surface 2: @gsd chat participant handler.
|
||||
// Surface 2: @msd chat participant handler.
|
||||
calls.length = 0;
|
||||
let markdownOut = '';
|
||||
await chatHandler({ prompt: 'progress json' }, {}, { markdown: (t) => { markdownOut += t; } }, {});
|
||||
assert.equal(calls.length, 1, 'the chat participant handler must dispatch exactly once');
|
||||
assert.equal(calls[0].cwd, '/tmp/mock-gsd-workspace', 'the chat participant must thread the workspace folder as cwd');
|
||||
assert.equal(calls[0].cwd, '/tmp/mock-msd-workspace', 'the chat participant must thread the workspace folder as cwd');
|
||||
assert.ok(markdownOut.length > 0);
|
||||
|
||||
// Surface 3: Language Model Tool invoke().
|
||||
calls.length = 0;
|
||||
const progressTool = toolImpls.find((t) => t.name === 'gsd_progress');
|
||||
assert.ok(progressTool, 'gsd_progress tool must be registered');
|
||||
const progressTool = toolImpls.find((t) => t.name === 'msd_progress');
|
||||
assert.ok(progressTool, 'msd_progress tool must be registered');
|
||||
await progressTool.impl.invoke({ input: {} }, {});
|
||||
assert.equal(calls.length, 1, 'the LM tool invoke() must dispatch exactly once');
|
||||
assert.equal(calls[0].cwd, '/tmp/mock-gsd-workspace', 'the LM tool invoke() must thread the workspace folder as cwd');
|
||||
assert.equal(calls[0].cwd, '/tmp/mock-msd-workspace', 'the LM tool invoke() must thread the workspace folder as cwd');
|
||||
} finally {
|
||||
Module._load = originalLoad;
|
||||
shellCommandProjection.dispatchGsdCommand = originalShimDispatch;
|
||||
shellCommandProjection.dispatchMsdCommand = originalShimDispatch;
|
||||
delete require.cache[extensionPath];
|
||||
delete require.cache[hostBindingPath];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user