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:
@@ -4,13 +4,13 @@
|
||||
// verified by observing runtime outputs alone. Per CONTRIBUTING.md exception matrix.
|
||||
|
||||
/**
|
||||
* Regression guard for #1767: gsd-workflow-guard.js must be registered in settings.json
|
||||
* Regression guard for #1767: msd-workflow-guard.js must be registered in settings.json
|
||||
*
|
||||
* The hook file is built, copied, and installed — but was never registered as a
|
||||
* PreToolUse hook entry in install.js. This test ensures the registration block
|
||||
* exists with the correct structure.
|
||||
*
|
||||
* Also tests the broader anti-pattern: every hook in gsdHooks that is a JS
|
||||
* Also tests the broader anti-pattern: every hook in msdHooks that is a JS
|
||||
* PreToolUse/PostToolUse hook should have a corresponding registration block.
|
||||
* Hooks owned by the runtime-hooks-surface module (Cursor) are validated
|
||||
* behaviorally rather than by source-scan of install.js.
|
||||
@@ -37,27 +37,27 @@ const MODULE_OWNED_HOOKS = new Set([
|
||||
// (src/host-integration-adapters/imperative-hook-bus.cts), never a literal
|
||||
// buildHookCommand(..., '<hook-name>', ...) call this source-scan can match.
|
||||
// Validated behaviorally in the describe block below.
|
||||
'gsd-cursor-session-start.js',
|
||||
'gsd-cursor-post-tool.js',
|
||||
'gsd-cursor-pre-tool.js',
|
||||
'gsd-cursor-stop.js',
|
||||
'gsd-cursor-subagent-start.js',
|
||||
'gsd-cursor-subagent-stop.js',
|
||||
'msd-cursor-session-start.js',
|
||||
'msd-cursor-post-tool.js',
|
||||
'msd-cursor-pre-tool.js',
|
||||
'msd-cursor-stop.js',
|
||||
'msd-cursor-subagent-start.js',
|
||||
'msd-cursor-subagent-stop.js',
|
||||
// Windsurf/Cascade blocking hooks — registered by writeWindsurfHooksJson via the
|
||||
// WINDSURF_EVENT_SCRIPT_MAP indirection (src/runtime-hooks-surface.cts), never a
|
||||
// literal buildHookCommand(..., '<hook-name>', ...) call this source-scan matches.
|
||||
// Validated behaviorally by tests/windsurf-hooks-bridge.test.cjs.
|
||||
'gsd-windsurf-pre-write.js',
|
||||
'gsd-windsurf-pre-command.js',
|
||||
// gsd-check-update-worker.js is an implementation detail of gsd-check-update.js
|
||||
'msd-windsurf-pre-write.js',
|
||||
'msd-windsurf-pre-command.js',
|
||||
// msd-check-update-worker.js is an implementation detail of msd-check-update.js
|
||||
// (spawned internally via child_process.spawn), never itself registered as a
|
||||
// hook entry point.
|
||||
'gsd-check-update-worker.js',
|
||||
// gsd-ensure-canonical-path.js (#997) is registered ONLY in the
|
||||
'msd-check-update-worker.js',
|
||||
// msd-ensure-canonical-path.js (#997) is registered ONLY in the
|
||||
// marketplace-plugin manifest (hooks/hooks.json's SessionStart entry), not
|
||||
// via install.js's classic-installer settings.json path — the plugin
|
||||
// install mode never runs bin/install.js at all.
|
||||
'gsd-ensure-canonical-path.js',
|
||||
'msd-ensure-canonical-path.js',
|
||||
]);
|
||||
|
||||
// ADR-857 phase 5f-1b: settings-json hook registration moved to runtime-hooks-surface.cts.
|
||||
@@ -70,22 +70,22 @@ function readInstallSources() {
|
||||
}
|
||||
|
||||
describe('workflow-guard hook registration (#1767)', () => {
|
||||
test('install.js constructs a command path variable for gsd-workflow-guard.js', () => {
|
||||
test('install.js constructs a command path variable for msd-workflow-guard.js', () => {
|
||||
const content = readInstallSources();
|
||||
const lines = content.split('\n');
|
||||
// Every registered JS hook has a command variable constructed via
|
||||
// buildHookCommand() or string concatenation. Filter out references
|
||||
// that are only in the cleanup/uninstall arrays.
|
||||
const commandConstructionLines = lines.filter(line =>
|
||||
line.includes('gsd-workflow-guard.js') &&
|
||||
line.includes('msd-workflow-guard.js') &&
|
||||
(line.includes('buildHookCommand') || line.includes("'node '"))
|
||||
);
|
||||
assert.ok(
|
||||
commandConstructionLines.length > 0,
|
||||
[
|
||||
'install.js must construct a command path for gsd-workflow-guard.js',
|
||||
'install.js must construct a command path for msd-workflow-guard.js',
|
||||
'(e.g. buildHookCommand or node + dirName pattern).',
|
||||
'Currently only referenced in gsdHooks cleanup array.',
|
||||
'Currently only referenced in msdHooks cleanup array.',
|
||||
].join(' ')
|
||||
);
|
||||
});
|
||||
@@ -125,21 +125,21 @@ describe('workflow-guard hook registration (#1767)', () => {
|
||||
});
|
||||
|
||||
describe('hook registration completeness anti-pattern guard', () => {
|
||||
test('every JS hook in gsdHooks (except module-owned) has a command construction in install.js', () => {
|
||||
test('every JS hook in msdHooks (except module-owned) has a command construction in install.js', () => {
|
||||
const content = readInstallSources();
|
||||
// Use the typed export instead of source-grep regex (branch #455: retire source-grep)
|
||||
const { GSD_UNINSTALL_HOOKS } = require('../bin/install.js');
|
||||
assert.ok(Array.isArray(GSD_UNINSTALL_HOOKS), 'GSD_UNINSTALL_HOOKS must be exported from install.js');
|
||||
const { MSD_UNINSTALL_HOOKS } = require('../bin/install.js');
|
||||
assert.ok(Array.isArray(MSD_UNINSTALL_HOOKS), 'MSD_UNINSTALL_HOOKS must be exported from install.js');
|
||||
|
||||
// Cursor hooks (gsd-cursor-*.js) are registered by writeCursorHooksJson in
|
||||
// Cursor hooks (msd-cursor-*.js) are registered by writeCursorHooksJson in
|
||||
// runtime-hooks-surface module, not by direct buildHookCommand calls in install.js.
|
||||
// They are validated behaviorally in the describe block below.
|
||||
const jsHooks = GSD_UNINSTALL_HOOKS.filter(h => h.endsWith('.js') && !MODULE_OWNED_HOOKS.has(h));
|
||||
const jsHooks = MSD_UNINSTALL_HOOKS.filter(h => h.endsWith('.js') && !MODULE_OWNED_HOOKS.has(h));
|
||||
|
||||
const missing = [];
|
||||
for (const hook of jsHooks) {
|
||||
// Each JS hook should have a buildHookCommand or 'node ' command construction
|
||||
// that references the hook filename (not just the gsdHooks array or uninstall filter)
|
||||
// that references the hook filename (not just the msdHooks array or uninstall filter)
|
||||
const lines = content.split('\n').filter(line =>
|
||||
line.includes(hook) &&
|
||||
(line.includes('buildHookCommand') || line.includes("'node '"))
|
||||
@@ -152,7 +152,7 @@ describe('hook registration completeness anti-pattern guard', () => {
|
||||
assert.strictEqual(
|
||||
missing.length, 0,
|
||||
[
|
||||
'Every JS hook in gsdHooks (excluding module-owned cursor hooks) must have a command',
|
||||
'Every JS hook in msdHooks (excluding module-owned cursor hooks) must have a command',
|
||||
'construction in install.js. Missing registration for:',
|
||||
...missing.map(h => ` - ${h}`),
|
||||
].join('\n')
|
||||
@@ -175,16 +175,16 @@ describe('atomic write temp-tracking — shared Set parity guard', () => {
|
||||
|
||||
const srcHooksDir = path.join(srcDir, 'hooks');
|
||||
fs.mkdirSync(srcHooksDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'gsd-cursor-session-start.js'), '// stub\n');
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'gsd-cursor-post-tool.js'), '// stub\n');
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'msd-cursor-session-start.js'), '// stub\n');
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'msd-cursor-post-tool.js'), '// stub\n');
|
||||
|
||||
// Capture the Set BEFORE the call so we can diff it after.
|
||||
const hooksSurface = require('../gsd-core/bin/lib/runtime-hooks-surface.cjs');
|
||||
const hooksSurface = require('../msd-core/bin/lib/runtime-hooks-surface.cjs');
|
||||
const tmpsSet = hooksSurface.__atomicWrittenTmps;
|
||||
assert.ok(tmpsSet instanceof Set, '__atomicWrittenTmps must be a Set');
|
||||
const sizeBefore = tmpsSet.size;
|
||||
|
||||
const { writeCursorHooksJson } = require('../gsd-core/bin/lib/runtime-hooks-surface.cjs');
|
||||
const { writeCursorHooksJson } = require('../msd-core/bin/lib/runtime-hooks-surface.cjs');
|
||||
writeCursorHooksJson(targetDir, srcDir, {});
|
||||
|
||||
// After the write, the Set must have grown: the hooks.json temp path
|
||||
@@ -212,7 +212,7 @@ describe('cursor hook registration — behavioral guard (module-owned hooks)', (
|
||||
// runtime-hooks-surface. This test calls the function directly and asserts
|
||||
// that both managed entries appear in hooks.json. Deleting either cursor
|
||||
// hook registration from the module will cause this test to fail.
|
||||
test('writeCursorHooksJson writes both gsd-cursor-session-start and gsd-cursor-post-tool to hooks.json', (t) => {
|
||||
test('writeCursorHooksJson writes both msd-cursor-session-start and msd-cursor-post-tool to hooks.json', (t) => {
|
||||
// Create a temp target dir (simulated ~/.cursor) and a src dir with stub scripts.
|
||||
const targetDir = createTempDir('cursor-guard-target-');
|
||||
const srcDir = createTempDir('cursor-guard-src-');
|
||||
@@ -224,11 +224,11 @@ describe('cursor hook registration — behavioral guard (module-owned hooks)', (
|
||||
// Stub the hook scripts in srcDir/hooks/ so writeCursorHooksJson can copy them.
|
||||
const srcHooksDir = path.join(srcDir, 'hooks');
|
||||
fs.mkdirSync(srcHooksDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'gsd-cursor-session-start.js'), '// stub\n');
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'gsd-cursor-post-tool.js'), '// stub\n');
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'msd-cursor-session-start.js'), '// stub\n');
|
||||
fs.writeFileSync(path.join(srcHooksDir, 'msd-cursor-post-tool.js'), '// stub\n');
|
||||
|
||||
const { GSD_CURSOR_HOOK_MARKER } = require('../bin/install.js');
|
||||
const { writeCursorHooksJson } = require('../gsd-core/bin/lib/runtime-hooks-surface.cjs');
|
||||
const { MSD_CURSOR_HOOK_MARKER } = require('../bin/install.js');
|
||||
const { writeCursorHooksJson } = require('../msd-core/bin/lib/runtime-hooks-surface.cjs');
|
||||
const result = writeCursorHooksJson(targetDir, srcDir, {});
|
||||
|
||||
assert.ok(result, 'writeCursorHooksJson must return a result');
|
||||
@@ -242,33 +242,33 @@ describe('cursor hook registration — behavioral guard (module-owned hooks)', (
|
||||
// Both cursor hook entries must be present.
|
||||
assert.ok(
|
||||
Array.isArray(hookTable.sessionStart) && hookTable.sessionStart.length > 0,
|
||||
'hooks.json must contain a sessionStart entry (gsd-cursor-session-start.js)'
|
||||
'hooks.json must contain a sessionStart entry (msd-cursor-session-start.js)'
|
||||
);
|
||||
assert.ok(
|
||||
Array.isArray(hookTable.postToolUse) && hookTable.postToolUse.length > 0,
|
||||
'hooks.json must contain a postToolUse entry (gsd-cursor-post-tool.js)'
|
||||
'hooks.json must contain a postToolUse entry (msd-cursor-post-tool.js)'
|
||||
);
|
||||
|
||||
// Both entries must be GSD-managed (not user-authored stubs).
|
||||
// Both entries must be MSD-managed (not user-authored stubs).
|
||||
assert.equal(
|
||||
hookTable.sessionStart[0][GSD_CURSOR_HOOK_MARKER], true,
|
||||
'sessionStart entry must carry the GSD managed marker'
|
||||
hookTable.sessionStart[0][MSD_CURSOR_HOOK_MARKER], true,
|
||||
'sessionStart entry must carry the MSD managed marker'
|
||||
);
|
||||
assert.equal(
|
||||
hookTable.postToolUse[0][GSD_CURSOR_HOOK_MARKER], true,
|
||||
'postToolUse entry must carry the GSD managed marker'
|
||||
hookTable.postToolUse[0][MSD_CURSOR_HOOK_MARKER], true,
|
||||
'postToolUse entry must carry the MSD managed marker'
|
||||
);
|
||||
|
||||
// Both commands must reference the correct script filenames.
|
||||
const sessionCmd = hookTable.sessionStart[0].command || '';
|
||||
const postToolCmd = hookTable.postToolUse[0].command || '';
|
||||
assert.ok(
|
||||
sessionCmd.includes('gsd-cursor-session-start.js'),
|
||||
`sessionStart command must reference gsd-cursor-session-start.js, got: ${sessionCmd}`
|
||||
sessionCmd.includes('msd-cursor-session-start.js'),
|
||||
`sessionStart command must reference msd-cursor-session-start.js, got: ${sessionCmd}`
|
||||
);
|
||||
assert.ok(
|
||||
postToolCmd.includes('gsd-cursor-post-tool.js'),
|
||||
`postToolUse command must reference gsd-cursor-post-tool.js, got: ${postToolCmd}`
|
||||
postToolCmd.includes('msd-cursor-post-tool.js'),
|
||||
`postToolUse command must reference msd-cursor-post-tool.js, got: ${postToolCmd}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user