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:
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Regression tests for bug #2136
|
||||
*
|
||||
* gsd-check-update-worker.js uses a MANAGED_HOOKS array (now in the shared
|
||||
* managed-hooks-registry.cjs module) to detect stale hooks after a GSD update.
|
||||
* It must list every hook file that GSD ships so that all deployed hooks are
|
||||
* msd-check-update-worker.js uses a MANAGED_HOOKS array (now in the shared
|
||||
* managed-hooks-registry.cjs module) to detect stale hooks after a MSD update.
|
||||
* It must list every hook file that MSD ships so that all deployed hooks are
|
||||
* checked for staleness — not just the .js ones.
|
||||
*
|
||||
* The original bug: the 3 bash hooks (gsd-phase-boundary.sh,
|
||||
* gsd-session-state.sh, gsd-validate-commit.sh) were missing from
|
||||
* The original bug: the 3 bash hooks (msd-phase-boundary.sh,
|
||||
* msd-session-state.sh, msd-validate-commit.sh) were missing from
|
||||
* MANAGED_HOOKS, so they would never be detected as stale after an update.
|
||||
*
|
||||
* Migration note (#455): previously used fs.readFileSync + regex on the worker
|
||||
@@ -27,16 +27,16 @@ const HOOKS_DIR = path.join(__dirname, '..', 'hooks');
|
||||
const { MANAGED_HOOKS } = require(path.join(HOOKS_DIR, 'managed-hooks-registry.cjs'));
|
||||
|
||||
describe('bug #2136: MANAGED_HOOKS must include all shipped hook files', () => {
|
||||
// List all GSD-managed hook files in hooks/ (names starting with "gsd-")
|
||||
// List all MSD-managed hook files in hooks/ (names starting with "msd-")
|
||||
const shippedHooks = fs.readdirSync(HOOKS_DIR)
|
||||
.filter(f => f.startsWith('gsd-') && (f.endsWith('.js') || f.endsWith('.sh')));
|
||||
.filter(f => f.startsWith('msd-') && (f.endsWith('.js') || f.endsWith('.sh')));
|
||||
|
||||
test('MANAGED_HOOKS is a non-empty array', () => {
|
||||
assert.ok(Array.isArray(MANAGED_HOOKS), 'MANAGED_HOOKS must be an array');
|
||||
assert.ok(MANAGED_HOOKS.length > 0, 'MANAGED_HOOKS must not be empty');
|
||||
});
|
||||
|
||||
test('every shipped gsd-*.js hook is in MANAGED_HOOKS', () => {
|
||||
test('every shipped msd-*.js hook is in MANAGED_HOOKS', () => {
|
||||
const jsHooks = shippedHooks.filter(f => f.endsWith('.js'));
|
||||
for (const hookFile of jsHooks) {
|
||||
assert.ok(
|
||||
@@ -46,7 +46,7 @@ describe('bug #2136: MANAGED_HOOKS must include all shipped hook files', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('every shipped gsd-*.sh hook is in MANAGED_HOOKS', () => {
|
||||
test('every shipped msd-*.sh hook is in MANAGED_HOOKS', () => {
|
||||
const shHooks = shippedHooks.filter(f => f.endsWith('.sh'));
|
||||
for (const hookFile of shHooks) {
|
||||
assert.ok(
|
||||
@@ -70,11 +70,11 @@ describe('bug #2136: MANAGED_HOOKS must include all shipped hook files', () => {
|
||||
/**
|
||||
* Regression test for bug #4076
|
||||
*
|
||||
* gsd-node-runner.sh was registered in MANAGED_HOOKS but shipped without a
|
||||
* "gsd-hook-version" header. gsd-check-update-worker.js treats a hook with
|
||||
* msd-node-runner.sh was registered in MANAGED_HOOKS but shipped without a
|
||||
* "msd-hook-version" header. msd-check-update-worker.js treats a hook with
|
||||
* no header as "definitely stale" (there is no way to tell it apart from a
|
||||
* pre-version-tracking file), so every install on an otherwise up-to-date
|
||||
* version showed a permanent, unclearable "⚠ stale hooks — run /gsd-update"
|
||||
* version showed a permanent, unclearable "⚠ stale hooks — run /msd-update"
|
||||
* warning naming that one file.
|
||||
*
|
||||
* This is the same *class* as bug #2136 (bash hooks missing the header
|
||||
@@ -85,13 +85,13 @@ describe('bug #2136: MANAGED_HOOKS must include all shipped hook files', () => {
|
||||
* rather than a hardcoded list of hook filenames — so a future hook added to
|
||||
* the registry without a header fails CI instead of shipping silently.
|
||||
*/
|
||||
describe('bug #4076: every MANAGED_HOOKS entry carries a gsd-hook-version header', () => {
|
||||
// Mirrors the exact regex gsd-check-update-worker.js uses at runtime to
|
||||
describe('bug #4076: every MANAGED_HOOKS entry carries a msd-hook-version header', () => {
|
||||
// Mirrors the exact regex msd-check-update-worker.js uses at runtime to
|
||||
// detect the header (both "//" JS-style and "#" bash-style comments).
|
||||
const VERSION_HEADER_RE = /(?:\/\/|#) gsd-hook-version:\s*(.+)/;
|
||||
const VERSION_HEADER_RE = /(?:\/\/|#) msd-hook-version:\s*(.+)/;
|
||||
|
||||
for (const entry of MANAGED_HOOKS) {
|
||||
test(`${entry} has a gsd-hook-version header matching the worker's detection regex`, () => {
|
||||
test(`${entry} has a msd-hook-version header matching the worker's detection regex`, () => {
|
||||
const hookPath = path.join(HOOKS_DIR, entry);
|
||||
// Note: `entry` is a loop variable, not a literal path, so
|
||||
// local/no-source-grep's static literal-path detector does not flag
|
||||
@@ -104,15 +104,15 @@ describe('bug #4076: every MANAGED_HOOKS entry carries a gsd-hook-version header
|
||||
const match = content.match(VERSION_HEADER_RE);
|
||||
assert.ok(
|
||||
match,
|
||||
`${entry} is listed in MANAGED_HOOKS but has no "# gsd-hook-version:" / ` +
|
||||
`"// gsd-hook-version:" header — gsd-check-update-worker.js treats a ` +
|
||||
`${entry} is listed in MANAGED_HOOKS but has no "# msd-hook-version:" / ` +
|
||||
`"// msd-hook-version:" header — msd-check-update-worker.js treats a ` +
|
||||
`missing header as "definitely stale", producing a permanent, ` +
|
||||
`unclearable "⚠ stale hooks" warning on every up-to-date install (#4076)`
|
||||
);
|
||||
assert.ok(
|
||||
match[1].trim() === '{{GSD_VERSION}}' || /^\d+\.\d+\.\d+/.test(match[1].trim()),
|
||||
`${entry}'s gsd-hook-version header must be either the unstamped ` +
|
||||
`"{{GSD_VERSION}}" placeholder (source tree) or a concrete semver ` +
|
||||
match[1].trim() === '{{MSD_VERSION}}' || /^\d+\.\d+\.\d+/.test(match[1].trim()),
|
||||
`${entry}'s msd-hook-version header must be either the unstamped ` +
|
||||
`"{{MSD_VERSION}}" placeholder (source tree) or a concrete semver ` +
|
||||
`string (installed tree) — got "${match[1].trim()}"`
|
||||
);
|
||||
});
|
||||
@@ -126,13 +126,13 @@ describe('bug #4076: every MANAGED_HOOKS entry carries a gsd-hook-version header
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe("folded:bug-2136-sh-hook-version (consolidation epic #1969 B6 #1975)", () => {
|
||||
// Consolidation #1969: this block spawns a REAL install and asserts side effects.
|
||||
// The host suite sets GSD_TEST_MODE=1 at collection time, which the install child
|
||||
// The host suite sets MSD_TEST_MODE=1 at collection time, which the install child
|
||||
// inherits via process.env and which suppresses hook/skill writes. Clear it for
|
||||
// this block's duration (standalone had it unset); restore after.
|
||||
const { before: __gtmBefore, after: __gtmAfter } = require('node:test');
|
||||
let __savedGsdTestMode;
|
||||
__gtmBefore(() => { __savedGsdTestMode = process.env.GSD_TEST_MODE; delete process.env.GSD_TEST_MODE; });
|
||||
__gtmAfter(() => { if (__savedGsdTestMode === undefined) delete process.env.GSD_TEST_MODE; else process.env.GSD_TEST_MODE = __savedGsdTestMode; });
|
||||
let __savedMsdTestMode;
|
||||
__gtmBefore(() => { __savedMsdTestMode = process.env.MSD_TEST_MODE; delete process.env.MSD_TEST_MODE; });
|
||||
__gtmAfter(() => { if (__savedMsdTestMode === undefined) delete process.env.MSD_TEST_MODE; else process.env.MSD_TEST_MODE = __savedMsdTestMode; });
|
||||
|
||||
// allow-test-rule: structural-regression-guard (see #2136)
|
||||
// The shebang line must be `#!/usr/bin/env bash` (PATH-resolved) rather than
|
||||
@@ -144,23 +144,23 @@ describe('bug #4076: every MANAGED_HOOKS entry carries a gsd-hook-version header
|
||||
/**
|
||||
* Regression tests for bug #2136 / #2206
|
||||
*
|
||||
* Root cause: three bash hooks (gsd-phase-boundary.sh, gsd-session-state.sh,
|
||||
* gsd-validate-commit.sh) shipped without a gsd-hook-version header, and the
|
||||
* stale-hook detector in gsd-check-update.js only matched JavaScript comment
|
||||
* Root cause: three bash hooks (msd-phase-boundary.sh, msd-session-state.sh,
|
||||
* msd-validate-commit.sh) shipped without a msd-hook-version header, and the
|
||||
* stale-hook detector in msd-check-update.js only matched JavaScript comment
|
||||
* syntax (//) — not bash comment syntax (#).
|
||||
*
|
||||
* Result: every session showed "⚠ stale hooks — run /gsd-update" immediately
|
||||
* Result: every session showed "⚠ stale hooks — run /msd-update" immediately
|
||||
* after a fresh install, because the detector saw hookVersion: 'unknown' for
|
||||
* all three bash hooks.
|
||||
*
|
||||
* This fix requires THREE parts working in concert:
|
||||
* 1. Bash hooks ship with "# gsd-hook-version: {{GSD_VERSION}}"
|
||||
* 2. install.js substitutes {{GSD_VERSION}} in .sh files at install time
|
||||
* 3. gsd-check-update.js regex matches both "//" and "#" comment styles
|
||||
* 1. Bash hooks ship with "# msd-hook-version: {{MSD_VERSION}}"
|
||||
* 2. install.js substitutes {{MSD_VERSION}} in .sh files at install time
|
||||
* 3. msd-check-update.js regex matches both "//" and "#" comment styles
|
||||
*
|
||||
* Neither fix alone is sufficient:
|
||||
* - Headers + regex fix only (no install.js fix): installed hooks contain
|
||||
* literal "{{GSD_VERSION}}" — the {{-guard silently skips them, making
|
||||
* literal "{{MSD_VERSION}}" — the {{-guard silently skips them, making
|
||||
* bash hook staleness permanently undetectable after future updates.
|
||||
* - Headers + install.js fix only (no regex fix): installed hooks are
|
||||
* stamped correctly but the detector still can't read bash "#" comments,
|
||||
@@ -169,8 +169,8 @@ describe('bug #4076: every MANAGED_HOOKS entry carries a gsd-hook-version header
|
||||
|
||||
'use strict';
|
||||
|
||||
// NOTE: Do NOT set GSD_TEST_MODE here — the E2E install tests spawn the
|
||||
// real installer subprocess, which skips all install logic when GSD_TEST_MODE=1.
|
||||
// NOTE: Do NOT set MSD_TEST_MODE here — the E2E install tests spawn the
|
||||
// real installer subprocess, which skips all install logic when MSD_TEST_MODE=1.
|
||||
|
||||
const { describe, test, before, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
@@ -181,8 +181,8 @@ const { runNode } = require('./helpers/process-seam.cjs');
|
||||
const { throwIfFailed } = require('./helpers/git-fixture.cjs');
|
||||
|
||||
const HOOKS_DIR = path.join(__dirname, '..', 'hooks');
|
||||
const _CHECK_UPDATE_FILE = path.join(HOOKS_DIR, 'gsd-check-update.js');
|
||||
const WORKER_FILE = path.join(HOOKS_DIR, 'gsd-check-update-worker.js');
|
||||
const _CHECK_UPDATE_FILE = path.join(HOOKS_DIR, 'msd-check-update.js');
|
||||
const WORKER_FILE = path.join(HOOKS_DIR, 'msd-check-update-worker.js');
|
||||
const INSTALL_SCRIPT = path.join(__dirname, '..', 'bin', 'install.js');
|
||||
const BUILD_SCRIPT = path.join(__dirname, '..', 'scripts', 'build-hooks.js');
|
||||
// scripts/build-hooks.js copies pre-built hook files into hooks/dist and
|
||||
@@ -191,9 +191,9 @@ const BUILD_SCRIPT = path.join(__dirname, '..', 'scripts', 'build-hooks.js');
|
||||
const { INSTALL_TIMEOUT_MS, PROBE_TIMEOUT_MS, BUILD_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
|
||||
|
||||
const SH_HOOKS = [
|
||||
'gsd-phase-boundary.sh',
|
||||
'gsd-session-state.sh',
|
||||
'gsd-validate-commit.sh',
|
||||
'msd-phase-boundary.sh',
|
||||
'msd-session-state.sh',
|
||||
'msd-validate-commit.sh',
|
||||
];
|
||||
|
||||
// ─── Ensure hooks/dist/ is populated before install tests ────────────────────
|
||||
@@ -233,14 +233,14 @@ function runInstaller(configDir) {
|
||||
// Part 1: Bash hook sources carry the version header placeholder
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
describe('bug #2136 part 1: bash hook sources carry gsd-hook-version placeholder', () => {
|
||||
describe('bug #2136 part 1: bash hook sources carry msd-hook-version placeholder', () => {
|
||||
for (const sh of SH_HOOKS) {
|
||||
test(`${sh} contains "# gsd-hook-version: {{GSD_VERSION}}"`, () => {
|
||||
test(`${sh} contains "# msd-hook-version: {{MSD_VERSION}}"`, () => {
|
||||
const content = fs.readFileSync(path.join(HOOKS_DIR, sh), 'utf8');
|
||||
assert.ok(
|
||||
content.includes('# gsd-hook-version: {{GSD_VERSION}}'),
|
||||
`${sh} must include "# gsd-hook-version: {{GSD_VERSION}}" so the ` +
|
||||
`installer can stamp it and gsd-check-update.js can detect staleness`
|
||||
content.includes('# msd-hook-version: {{MSD_VERSION}}'),
|
||||
`${sh} must include "# msd-hook-version: {{MSD_VERSION}}" so the ` +
|
||||
`installer can stamp it and msd-check-update.js can detect staleness`
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -259,15 +259,15 @@ describe('bug #2136 part 1: bash hook sources carry gsd-hook-version placeholder
|
||||
`${sh} line 1 must be "#!/usr/bin/env bash" for cross-distro portability`
|
||||
);
|
||||
assert.ok(
|
||||
lines[1].startsWith('# gsd-hook-version:'),
|
||||
`${sh} line 2 must be the gsd-hook-version header (got: "${lines[1]}")`
|
||||
lines[1].startsWith('# msd-hook-version:'),
|
||||
`${sh} line 2 must be the msd-hook-version header (got: "${lines[1]}")`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Part 2: gsd-check-update-worker.js regex handles bash "#" comment syntax
|
||||
// Part 2: msd-check-update-worker.js regex handles bash "#" comment syntax
|
||||
// (Logic moved from inline -e template literal to dedicated worker file)
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -287,7 +287,7 @@ describe('bug #2136 part 2: stale-hook detector handles bash comment syntax', ()
|
||||
src.includes('(?://|#)'); // direct form in plain JS worker
|
||||
assert.ok(
|
||||
hasBashAlternative,
|
||||
'gsd-check-update-worker.js version regex must include an alternative for bash "#" comments. ' +
|
||||
'msd-check-update-worker.js version regex must include an alternative for bash "#" comments. ' +
|
||||
'Expected to find (?:\\/\\/|#) or (?://|#) in the source. ' +
|
||||
'The original "//" only regex causes bash hooks to always report hookVersion: "unknown"'
|
||||
);
|
||||
@@ -295,13 +295,13 @@ describe('bug #2136 part 2: stale-hook detector handles bash comment syntax', ()
|
||||
|
||||
test('version regex does not use the old JS-only form as the sole pattern', () => {
|
||||
// The old regex inside the template literal was the string:
|
||||
// /\\/\\/ gsd-hook-version:\\s*(.+)/
|
||||
// which, when evaluated in the subprocess, produced: /\/\/ gsd-hook-version:\s*(.+)/
|
||||
// /\\/\\/ msd-hook-version:\\s*(.+)/
|
||||
// which, when evaluated in the subprocess, produced: /\/\/ msd-hook-version:\s*(.+)/
|
||||
// That only matched JS "//" comments — never bash "#".
|
||||
// We verify that the old exact string no longer appears.
|
||||
assert.ok(
|
||||
!src.includes('\\/\\/ gsd-hook-version'),
|
||||
'gsd-check-update-worker.js must not use the old JS-only (\\/\\/ gsd-hook-version) ' +
|
||||
!src.includes('\\/\\/ msd-hook-version'),
|
||||
'msd-check-update-worker.js must not use the old JS-only (\\/\\/ msd-hook-version) ' +
|
||||
'escape form as the sole version matcher — it cannot match bash "#" comments'
|
||||
);
|
||||
});
|
||||
@@ -315,23 +315,23 @@ describe('bug #2136 part 2: stale-hook detector handles bash comment syntax', ()
|
||||
// which breaks simple extraction), so instead we confirm the source matches
|
||||
// our expectation and run the regex itself.
|
||||
assert.ok(
|
||||
src.includes('gsd-hook-version'),
|
||||
'gsd-check-update-worker.js must contain a gsd-hook-version version check'
|
||||
src.includes('msd-hook-version'),
|
||||
'msd-check-update-worker.js must contain a msd-hook-version version check'
|
||||
);
|
||||
|
||||
// The fixed regex that must be present: matches both comment styles
|
||||
const fixedRegex = /(?:\/\/|#) gsd-hook-version:\s*(.+)/;
|
||||
const fixedRegex = /(?:\/\/|#) msd-hook-version:\s*(.+)/;
|
||||
|
||||
assert.ok(
|
||||
fixedRegex.test('# gsd-hook-version: 1.36.0'),
|
||||
'bash-style "# gsd-hook-version: X" must be matchable by the required regex'
|
||||
fixedRegex.test('# msd-hook-version: 1.36.0'),
|
||||
'bash-style "# msd-hook-version: X" must be matchable by the required regex'
|
||||
);
|
||||
assert.ok(
|
||||
fixedRegex.test('// gsd-hook-version: 1.36.0'),
|
||||
'JS-style "// gsd-hook-version: X" must still match (no regression)'
|
||||
fixedRegex.test('// msd-hook-version: 1.36.0'),
|
||||
'JS-style "// msd-hook-version: X" must still match (no regression)'
|
||||
);
|
||||
assert.ok(
|
||||
!fixedRegex.test('gsd-hook-version: 1.36.0'),
|
||||
!fixedRegex.test('msd-hook-version: 1.36.0'),
|
||||
'line without a comment prefix must not match (prevents false positives)'
|
||||
);
|
||||
});
|
||||
@@ -346,7 +346,7 @@ describe('bug #2136 part 4: installed .sh hooks contain stamped concrete version
|
||||
let tmpDir;
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = createTempDir('gsd-2136-install-');
|
||||
tmpDir = createTempDir('msd-2136-install-');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -363,16 +363,16 @@ describe('bug #2136 part 4: installed .sh hooks contain stamped concrete version
|
||||
const content = fs.readFileSync(hookPath, 'utf8');
|
||||
|
||||
assert.ok(
|
||||
content.includes('# gsd-hook-version:'),
|
||||
`installed ${sh} must contain a "# gsd-hook-version:" header`
|
||||
content.includes('# msd-hook-version:'),
|
||||
`installed ${sh} must contain a "# msd-hook-version:" header`
|
||||
);
|
||||
assert.ok(
|
||||
!content.includes('{{GSD_VERSION}}'),
|
||||
`installed ${sh} must not contain literal "{{GSD_VERSION}}" — ` +
|
||||
!content.includes('{{MSD_VERSION}}'),
|
||||
`installed ${sh} must not contain literal "{{MSD_VERSION}}" — ` +
|
||||
`install.js must substitute it with the concrete package version`
|
||||
);
|
||||
|
||||
const versionMatch = content.match(/# gsd-hook-version:\s*(\S+)/);
|
||||
const versionMatch = content.match(/# msd-hook-version:\s*(\S+)/);
|
||||
assert.ok(versionMatch, `installed ${sh} version header must have a version value`);
|
||||
assert.match(
|
||||
versionMatch[1],
|
||||
@@ -384,7 +384,7 @@ describe('bug #2136 part 4: installed .sh hooks contain stamped concrete version
|
||||
|
||||
test('stale-hook detector reports zero stale bash hooks immediately after fresh install', () => {
|
||||
// This is the definitive end-to-end proof: after install, run the actual
|
||||
// version-check logic (extracted from gsd-check-update.js) against the
|
||||
// version-check logic (extracted from msd-check-update.js) against the
|
||||
// installed hooks and verify none are flagged stale.
|
||||
const hooksDir = runInstaller(tmpDir);
|
||||
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
||||
@@ -411,8 +411,8 @@ describe('bug #2136 part 4: installed .sh hooks contain stamped concrete version
|
||||
const hooksDir = ${JSON.stringify(hooksDir)};
|
||||
const installed = ${JSON.stringify(installedVersion)};
|
||||
const shHooks = ${JSON.stringify(SH_HOOKS)};
|
||||
// Use the same regex that the fixed gsd-check-update.js uses
|
||||
const versionRe = /(?:\\/\\/|#) gsd-hook-version:\\s*(.+)/;
|
||||
// Use the same regex that the fixed msd-check-update.js uses
|
||||
const versionRe = /(?:\\/\\/|#) msd-hook-version:\\s*(.+)/;
|
||||
|
||||
const staleHooks = [];
|
||||
for (const hookFile of shHooks) {
|
||||
@@ -462,15 +462,15 @@ describe('bug #2136 part 4: installed .sh hooks contain stamped concrete version
|
||||
/**
|
||||
* Regression test for bug #941
|
||||
*
|
||||
* `managed-hooks-registry.cjs` is shipped alongside gsd-check-update-worker.js
|
||||
* `managed-hooks-registry.cjs` is shipped alongside msd-check-update-worker.js
|
||||
* in hooks/dist/ (it is listed in HOOKS_TO_COPY in scripts/build-hooks.js).
|
||||
* However, the manifest-writing loop in bin/install.js gated on
|
||||
* file.startsWith('gsd-') && (file.endsWith('.js') || file.endsWith('.sh'))
|
||||
* file.startsWith('msd-') && (file.endsWith('.js') || file.endsWith('.sh'))
|
||||
* — which `managed-hooks-registry.cjs` fails on both predicates (wrong prefix,
|
||||
* .cjs extension). The result: after every install, `detect-custom-files`
|
||||
* found the installed file in the hooks/ dir but had no manifest entry for it
|
||||
* and reported a perpetual false-positive "Found 1 custom file(s)" warning on
|
||||
* every `/gsd-update`.
|
||||
* every `/msd-update`.
|
||||
*
|
||||
* Fix: drive the manifest hooks loop from HOOKS_TO_COPY (the canonical build
|
||||
* set), so the manifest set is structurally identical to what was installed.
|
||||
@@ -480,7 +480,7 @@ describe('bug #2136 part 4: installed .sh hooks contain stamped concrete version
|
||||
|
||||
'use strict';
|
||||
|
||||
process.env.GSD_TEST_MODE = '1';
|
||||
process.env.MSD_TEST_MODE = '1';
|
||||
|
||||
const { describe, test, before, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
@@ -493,8 +493,8 @@ const crypto = require('node:crypto');
|
||||
|
||||
const INSTALL_SCRIPT = path.join(__dirname, '..', 'bin', 'install.js');
|
||||
const BUILD_SCRIPT = path.join(__dirname, '..', 'scripts', 'build-hooks.js');
|
||||
const TOOLS_PATH = path.join(__dirname, '..', 'gsd-core', 'bin', 'gsd-tools.cjs');
|
||||
const MANIFEST_NAME = 'gsd-file-manifest.json';
|
||||
const TOOLS_PATH = path.join(__dirname, '..', 'msd-core', 'bin', 'msd-tools.cjs');
|
||||
const MANIFEST_NAME = 'msd-file-manifest.json';
|
||||
// scripts/build-hooks.js copies pre-built hook files into hooks/dist and
|
||||
// syntax-checks them with vm — it does not compile/bundle anything. See
|
||||
// tests/helpers/timeouts.cjs for the class-norm justification.
|
||||
@@ -527,12 +527,12 @@ function cleanup(dir) {
|
||||
* Returns the path to configDir.
|
||||
*/
|
||||
function runInstaller(configDir) {
|
||||
// Clear GSD_TEST_MODE so the installer's main() block actually runs.
|
||||
// The test file sets GSD_TEST_MODE=1 (top of file) to suppress in-process
|
||||
// Clear MSD_TEST_MODE so the installer's main() block actually runs.
|
||||
// The test file sets MSD_TEST_MODE=1 (top of file) to suppress in-process
|
||||
// import side effects, but when install.js is spawned as a subprocess it
|
||||
// must not skip the main() gate or the install is a no-op.
|
||||
const env = { ...process.env, CLAUDE_CONFIG_DIR: configDir };
|
||||
delete env.GSD_TEST_MODE;
|
||||
delete env.MSD_TEST_MODE;
|
||||
throwIfFailed(
|
||||
runNode(
|
||||
[INSTALL_SCRIPT, '--claude', '--global', '--yes'],
|
||||
@@ -549,7 +549,7 @@ function runInstaller(configDir) {
|
||||
function detectCustomFiles(configDir) {
|
||||
const result = runNode(
|
||||
[TOOLS_PATH, 'detect-custom-files', '--config-dir', configDir],
|
||||
{ env: { ...process.env, GSD_SESSION_KEY: '' }, timeoutMs: PROBE_TIMEOUT_MS },
|
||||
{ env: { ...process.env, MSD_SESSION_KEY: '' }, timeoutMs: PROBE_TIMEOUT_MS },
|
||||
);
|
||||
throwIfFailed(result, `node ${TOOLS_PATH} detect-custom-files --config-dir ${configDir}`);
|
||||
return JSON.parse(result.stdout.trim());
|
||||
@@ -561,14 +561,14 @@ describe('bug #941 — managed-hooks-registry.cjs recorded in file manifest', ()
|
||||
let tmpDir;
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = createTempDir('gsd-bug-941-');
|
||||
tmpDir = createTempDir('msd-bug-941-');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup(tmpDir);
|
||||
});
|
||||
|
||||
test('managed-hooks-registry.cjs appears in gsd-file-manifest.json after install', () => {
|
||||
test('managed-hooks-registry.cjs appears in msd-file-manifest.json after install', () => {
|
||||
runInstaller(tmpDir);
|
||||
|
||||
const manifestPath = path.join(tmpDir, MANIFEST_NAME);
|
||||
@@ -596,7 +596,7 @@ describe('bug #941 — managed-hooks-registry.cjs recorded in file manifest', ()
|
||||
);
|
||||
});
|
||||
|
||||
test('gsd-file-manifest.json covers the full HOOKS_TO_COPY set (forward-proof)', () => {
|
||||
test('msd-file-manifest.json covers the full HOOKS_TO_COPY set (forward-proof)', () => {
|
||||
runInstaller(tmpDir);
|
||||
|
||||
const manifestPath = path.join(tmpDir, MANIFEST_NAME);
|
||||
|
||||
Reference in New Issue
Block a user