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:
@@ -55,9 +55,9 @@ const HOOKS_DIR = path.join(__dirname, '..', 'hooks');
|
||||
// not PreToolUse/PostToolUse/SessionStart enforcement hooks, so #3911's
|
||||
// migration (and this table) does not apply to them.
|
||||
const NON_TERMINATING_HOOKS = new Set([
|
||||
'gsd-check-update.js',
|
||||
'gsd-check-update-worker.js',
|
||||
'gsd-update-banner.js',
|
||||
'msd-check-update.js',
|
||||
'msd-check-update-worker.js',
|
||||
'msd-update-banner.js',
|
||||
]);
|
||||
|
||||
function hookPath(name) {
|
||||
@@ -99,8 +99,8 @@ function tempDir(prefix) {
|
||||
|
||||
before(() => {
|
||||
// --- worktree fixture: a linked git worktree on an agent-* branch, used by
|
||||
// gsd-worktree-path-guard.js's deny case (absolute path escaping the active
|
||||
// worktree's git root) and gsd-windsurf-pre-write.js's deny case (same
|
||||
// msd-worktree-path-guard.js's deny case (absolute path escaping the active
|
||||
// worktree's git root) and msd-windsurf-pre-write.js's deny case (same
|
||||
// escape shape, different protocol). ---------------------------------------
|
||||
const mainRepo = tempDir('hooks-crash-main-');
|
||||
gitOrThrow(['init', '-q', mainRepo], { timeoutMs: GIT_FIXTURE_TIMEOUT_MS });
|
||||
@@ -113,14 +113,14 @@ before(() => {
|
||||
gitOrThrow(['-C', mainRepo, 'worktree', 'add', '-b', 'agent-test', worktreePath], { timeoutMs: GIT_FIXTURE_TIMEOUT_MS });
|
||||
cleanupPaths.push(worktreePath);
|
||||
|
||||
// --- gsd-write-guard.js: a curated ROADMAP.md big enough to trip the 40%
|
||||
// --- msd-write-guard.js: a curated ROADMAP.md big enough to trip the 40%
|
||||
// shrink-ratio guard (well above the FLOOR_LINES=40 exemption). -------------
|
||||
const wgProject = tempDir('hooks-crash-wg-');
|
||||
fs.mkdirSync(path.join(wgProject, '.planning'), { recursive: true });
|
||||
const roadmapPath = path.join(wgProject, '.planning', 'ROADMAP.md');
|
||||
fs.writeFileSync(roadmapPath, Array.from({ length: 292 }, (_, i) => `line ${i + 1}`).join('\n') + '\n');
|
||||
|
||||
// --- gsd-workflow-guard.js: a repo on an agent-* branch with
|
||||
// --- msd-workflow-guard.js: a repo on an agent-* branch with
|
||||
// hooks.workflow_guard enabled, so `git add -f` trips the ONE hard-block. --
|
||||
const wfRepo = tempDir('hooks-crash-wf-');
|
||||
gitOrThrow(['init', '-q', '-b', 'agent-test', wfRepo], { timeoutMs: GIT_FIXTURE_TIMEOUT_MS });
|
||||
@@ -132,9 +132,9 @@ before(() => {
|
||||
gitOrThrow(['-C', wfRepo, 'add', '-A'], { timeoutMs: GIT_FIXTURE_TIMEOUT_MS });
|
||||
gitOrThrow(['-C', wfRepo, 'commit', '-m', 'seed'], { timeoutMs: GIT_FIXTURE_TIMEOUT_MS });
|
||||
|
||||
// --- gsd-agent-isolation-guard.js: `.planning/config.json` as a DIRECTORY
|
||||
// --- msd-agent-isolation-guard.js: `.planning/config.json` as a DIRECTORY
|
||||
// (EISDIR) — the guard's documented "cannot verify -> DENY" fail-closed
|
||||
// path (mirrors tests/gsd-agent-isolation-guard.test.cjs's own fixture). ---
|
||||
// path (mirrors tests/msd-agent-isolation-guard.test.cjs's own fixture). ---
|
||||
const aigProject = tempDir('hooks-crash-aig-');
|
||||
fs.mkdirSync(path.join(aigProject, '.planning', 'config.json'), { recursive: true });
|
||||
|
||||
@@ -151,7 +151,7 @@ after(() => {
|
||||
|
||||
const TABLE = [
|
||||
{
|
||||
file: 'gsd-worktree-path-guard.js',
|
||||
file: 'msd-worktree-path-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
// #3911: this hook's deny path depends on several bounded (2000ms)
|
||||
@@ -173,13 +173,13 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-write-guard.js',
|
||||
file: 'msd-write-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
deny: () => ({
|
||||
payload: { tool_name: 'Write', tool_input: { file_path: fixtures.roadmapPath, content: 'short\n' } },
|
||||
env: { GSD_ALLOW_PLANNING_SHRINK: undefined },
|
||||
env: { MSD_ALLOW_PLANNING_SHRINK: undefined },
|
||||
}),
|
||||
assertDeny: (r) => {
|
||||
const out = JSON.parse(r.stdout);
|
||||
@@ -190,7 +190,7 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-secret-read-guard.js',
|
||||
file: 'msd-secret-read-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { tool_name: 'Bash', tool_input: { command: 'cd /proj && grep -n foo src/a.js' } } }),
|
||||
@@ -206,12 +206,12 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-workflow-guard.js',
|
||||
file: 'msd-workflow-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
// #3911: the force-add block depends on a bounded (2000ms) spawnSync(git
|
||||
// branch --show-current) probe — see gitProbeMayRace note on the
|
||||
// gsd-worktree-path-guard.js row above.
|
||||
// msd-worktree-path-guard.js row above.
|
||||
gitProbeMayRace: true,
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
deny: () => ({
|
||||
@@ -226,44 +226,44 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-context-monitor.js',
|
||||
file: 'msd-context-monitor.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: {} }), // no session_id -> allow(undefined)
|
||||
},
|
||||
{
|
||||
file: 'gsd-config-reload.js',
|
||||
file: 'msd-config-reload.js',
|
||||
stdinTimeoutMs: 8000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { file_path: '/tmp/not-a-gsd-config.json' } }), // basename mismatch -> allow
|
||||
allow: () => ({ payload: { file_path: '/tmp/not-a-msd-config.json' } }), // basename mismatch -> allow
|
||||
},
|
||||
{
|
||||
file: 'gsd-read-injection-scanner.js',
|
||||
file: 'msd-read-injection-scanner.js',
|
||||
stdinTimeoutMs: 5000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { tool_name: 'Bash' } }), // not in SCANNED_TOOLS -> allow
|
||||
},
|
||||
{
|
||||
file: 'gsd-prompt-guard.js',
|
||||
file: 'msd-prompt-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-read-guard.js',
|
||||
file: 'msd-read-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-agent-isolation-guard.js',
|
||||
file: 'msd-agent-isolation-guard.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
deny: () => ({
|
||||
payload: { tool_name: 'Task', tool_input: { subagent_type: 'gsd-executor' } },
|
||||
payload: { tool_name: 'Task', tool_input: { subagent_type: 'msd-executor' } },
|
||||
cwd: fixtures.aigProject,
|
||||
env: { GSD_RUNTIME: undefined },
|
||||
env: { MSD_RUNTIME: undefined },
|
||||
}),
|
||||
assertDeny: (r) => {
|
||||
const out = JSON.parse(r.stdout);
|
||||
@@ -278,7 +278,7 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-windsurf-pre-command.js',
|
||||
file: 'msd-windsurf-pre-command.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null, // catch calls allow(undefined) directly — no HOOK_ON_CRASH declared
|
||||
allow: () => ({ payload: { tool_info: { command_line: 'ls -la' } } }),
|
||||
@@ -289,11 +289,11 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-windsurf-pre-write.js',
|
||||
file: 'msd-windsurf-pre-write.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null, // catch calls allow(undefined) directly — no HOOK_ON_CRASH declared
|
||||
// #3911: this hook's deny path depends on bounded (2000ms) spawnSync(git,
|
||||
// ...) probes, same shape as gsd-worktree-path-guard.js above.
|
||||
// ...) probes, same shape as msd-worktree-path-guard.js above.
|
||||
gitProbeMayRace: true,
|
||||
allow: () => ({ payload: { tool_info: { file_path: 'nonexistent.txt' } }, cwd: os.tmpdir() }),
|
||||
deny: () => ({
|
||||
@@ -306,55 +306,55 @@ const TABLE = [
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-statusline.js',
|
||||
file: 'msd-statusline.js',
|
||||
stdinTimeoutMs: 3000,
|
||||
declaredOnCrash: 'allow',
|
||||
crashSkipReason:
|
||||
'the crash() call this hook declares ON_CRASH for guards only the require.main ' +
|
||||
"self-heal block (ensureRuntimeBuild() failing on an unbuilt gsd-core/bin/lib tree) — " +
|
||||
"self-heal block (ensureRuntimeBuild() failing on an unbuilt msd-core/bin/lib tree) — " +
|
||||
"the per-request stdin handler's own catch is a silent fail with no crash() call at all. " +
|
||||
'Forcing the self-heal path to fail would require corrupting the built lib tree or actually ' +
|
||||
'invoking a build, both out of scope for a behavioral spawn test.',
|
||||
allow: () => ({ payload: {} }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-ensure-canonical-path.js',
|
||||
file: 'msd-ensure-canonical-path.js',
|
||||
stdinTimeoutMs: null, // never reads stdin at all — see the C4 note below
|
||||
declaredOnCrash: null, // no HOOK_ON_CRASH import/usage; allow(undefined) is unconditional
|
||||
allow: () => ({ payload: undefined }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-cursor-post-tool.js',
|
||||
file: 'msd-cursor-post-tool.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null,
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-cursor-pre-tool.js',
|
||||
file: 'msd-cursor-pre-tool.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null,
|
||||
allow: () => ({ payload: { tool_name: 'Read' } }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-cursor-session-start.js',
|
||||
file: 'msd-cursor-session-start.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null,
|
||||
allow: () => ({ payload: {} }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-cursor-stop.js',
|
||||
file: 'msd-cursor-stop.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null,
|
||||
allow: () => ({ payload: {} }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-cursor-subagent-start.js',
|
||||
file: 'msd-cursor-subagent-start.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null,
|
||||
allow: () => ({ payload: {} }),
|
||||
},
|
||||
{
|
||||
file: 'gsd-cursor-subagent-stop.js',
|
||||
file: 'msd-cursor-subagent-stop.js',
|
||||
stdinTimeoutMs: 10000,
|
||||
declaredOnCrash: null,
|
||||
allow: () => ({ payload: {} }),
|
||||
@@ -495,8 +495,8 @@ describe('hooks-crash-policy: C4 stdin never closes -> bounded termination, not
|
||||
// #3911 regression — deterministic git-probe timeout (no load required).
|
||||
//
|
||||
// The C2 loop above tolerates a raced timeout but cannot FORCE one: on a
|
||||
// quiet machine the git probes in gsd-worktree-path-guard.js,
|
||||
// gsd-workflow-guard.js, and gsd-windsurf-pre-write.js always answer well
|
||||
// quiet machine the git probes in msd-worktree-path-guard.js,
|
||||
// msd-workflow-guard.js, and msd-windsurf-pre-write.js always answer well
|
||||
// inside their 2000ms budget, so C2 alone would never actually exercise the
|
||||
// undetermined-probe branch. This suite forces the timeout deterministically
|
||||
// by putting a stub `git` on PATH that sleeps past every affected hook's own
|
||||
@@ -517,7 +517,7 @@ describe('hooks-crash-policy: #3911 git-probe timeout forced via a stub git -> a
|
||||
before(() => {
|
||||
stubDir = tempDir('hooks-crash-git-stub-');
|
||||
// Not built on win32: the affected hooks spawn `git` via spawnSync with
|
||||
// no `shell: true` (see hooks/gsd-worktree-path-guard.js's SPAWNOPT-based
|
||||
// no `shell: true` (see hooks/msd-worktree-path-guard.js's SPAWNOPT-based
|
||||
// `spawnSync('git', args, { ...SPAWNOPT, cwd })` call), so Windows'
|
||||
// CreateProcess resolves `git.exe` only and never a PATH `.cmd`/`.bat`
|
||||
// shim — a stub written here could never be exercised. See the
|
||||
@@ -537,13 +537,13 @@ describe('hooks-crash-policy: #3911 git-probe timeout forced via a stub git -> a
|
||||
// the stub, not a real git binary that might legitimately be fast.
|
||||
const CASES = [
|
||||
{
|
||||
file: 'gsd-worktree-path-guard.js',
|
||||
file: 'msd-worktree-path-guard.js',
|
||||
build: () => ({
|
||||
payload: { tool_name: 'Write', tool_input: { file_path: path.join(os.tmpdir(), 'gsd-3911-stub-target.txt') } },
|
||||
payload: { tool_name: 'Write', tool_input: { file_path: path.join(os.tmpdir(), 'msd-3911-stub-target.txt') } },
|
||||
}),
|
||||
},
|
||||
{
|
||||
file: 'gsd-workflow-guard.js',
|
||||
file: 'msd-workflow-guard.js',
|
||||
build: () => {
|
||||
const wfProject = tempDir('hooks-crash-wf-stub-');
|
||||
fs.mkdirSync(path.join(wfProject, '.planning'), { recursive: true });
|
||||
@@ -557,9 +557,9 @@ describe('hooks-crash-policy: #3911 git-probe timeout forced via a stub git -> a
|
||||
},
|
||||
},
|
||||
{
|
||||
file: 'gsd-windsurf-pre-write.js',
|
||||
file: 'msd-windsurf-pre-write.js',
|
||||
build: () => ({
|
||||
payload: { tool_info: { file_path: 'gsd-3911-stub-target.txt' } },
|
||||
payload: { tool_info: { file_path: 'msd-3911-stub-target.txt' } },
|
||||
cwd: os.tmpdir(),
|
||||
}),
|
||||
},
|
||||
@@ -568,7 +568,7 @@ describe('hooks-crash-policy: #3911 git-probe timeout forced via a stub git -> a
|
||||
for (const c of CASES) {
|
||||
test(`${c.file}: git timing out still allows, WITH a stderr diagnostic naming the probe (not silent)`, (t) => {
|
||||
if (process.platform === 'win32') {
|
||||
// See hooks/gsd-worktree-path-guard.js's spawnSync('git', args, { ...SPAWNOPT, cwd })
|
||||
// See hooks/msd-worktree-path-guard.js's spawnSync('git', args, { ...SPAWNOPT, cwd })
|
||||
// call (no `shell: true`): CreateProcess resolves git.exe only.
|
||||
t.skip(
|
||||
'win32: the hooks spawn git via spawnSync without shell:true, so CreateProcess ' +
|
||||
@@ -610,7 +610,7 @@ describe('hooks-crash-policy: #3911 git-probe timeout forced via a stub git -> a
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// hooks/dist parity (#3911 review finding) — lint:hooks-runtime-build-seam
|
||||
// only checks that a hook requiring a compiled gsd-core/bin/lib/*.cjs module
|
||||
// only checks that a hook requiring a compiled msd-core/bin/lib/*.cjs module
|
||||
// also calls ensureRuntimeBuild(); it never compares hooks/dist/** against
|
||||
// hooks/**. Nothing else in the suite proves the three files P7 adds under
|
||||
// hooks/lib/ (cli-exit.js, exit-code-registry.js, hook-exit.js) actually
|
||||
|
||||
Reference in New Issue
Block a user