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:
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* Tests for `scripts/lint-hooks-runtime-build-seam.cjs` — the CI guard that
|
||||
* every `hooks/**` file requiring a compiled `gsd-core/bin/lib/*.cjs` module
|
||||
* every `hooks/**` file requiring a compiled `msd-core/bin/lib/*.cjs` module
|
||||
* must also self-heal via `ensureRuntimeBuild()` first (#3582).
|
||||
*
|
||||
* Mirrors the sibling `lint-*-drift.cjs` test convention (see e.g.
|
||||
@@ -42,14 +42,14 @@ describe('scanRepo — real hooks/ tree', () => {
|
||||
test('the real tree has REAL compiled-lib requires (the detector is not silently inert)', () => {
|
||||
// A detector that never matches anything would also report zero
|
||||
// violations. Prove it actually found the six #3582 hook files' real
|
||||
// gsd-core/bin/lib/*.cjs requires and confirmed each is seam-wired.
|
||||
// msd-core/bin/lib/*.cjs requires and confirmed each is seam-wired.
|
||||
const hookFiles = [
|
||||
'gsd-agent-isolation-guard.js',
|
||||
'gsd-cursor-subagent-start.js',
|
||||
'gsd-statusline.js',
|
||||
'gsd-check-update-worker.js',
|
||||
'gsd-check-update.js',
|
||||
'gsd-update-banner.js',
|
||||
'msd-agent-isolation-guard.js',
|
||||
'msd-cursor-subagent-start.js',
|
||||
'msd-statusline.js',
|
||||
'msd-check-update-worker.js',
|
||||
'msd-check-update.js',
|
||||
'msd-update-banner.js',
|
||||
];
|
||||
for (const name of hookFiles) {
|
||||
const text = fs.readFileSync(path.join(REPO_ROOT, 'hooks', name), 'utf8');
|
||||
@@ -73,12 +73,12 @@ describe('scanFile — pure detection', () => {
|
||||
test('a compiled-lib require with NO seam require/call is detected', () => {
|
||||
const text = [
|
||||
"'use strict';",
|
||||
"const { runtimes } = require('../gsd-core/bin/lib/capability-registry.cjs');",
|
||||
"const { runtimes } = require('../msd-core/bin/lib/capability-registry.cjs');",
|
||||
'module.exports = { runtimes };',
|
||||
'',
|
||||
].join('\n');
|
||||
const { compiledLibRequires, hasSeamRequire, hasSeamCall } = scanFile(text);
|
||||
assert.deepStrictEqual(compiledLibRequires, ['../gsd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.deepStrictEqual(compiledLibRequires, ['../msd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.equal(hasSeamRequire, false);
|
||||
assert.equal(hasSeamCall, false);
|
||||
});
|
||||
@@ -86,17 +86,17 @@ describe('scanFile — pure detection', () => {
|
||||
test('a compiled-lib require WITH a seam require + call is not flagged', () => {
|
||||
const text = [
|
||||
"'use strict';",
|
||||
"const { ensureRuntimeBuild } = require('../gsd-core/bin/ensure-runtime-build.cjs');",
|
||||
"const { ensureRuntimeBuild } = require('../msd-core/bin/ensure-runtime-build.cjs');",
|
||||
'function f() {',
|
||||
' ensureRuntimeBuild();',
|
||||
" const { runtimes } = require('../gsd-core/bin/lib/capability-registry.cjs');",
|
||||
" const { runtimes } = require('../msd-core/bin/lib/capability-registry.cjs');",
|
||||
' return runtimes;',
|
||||
'}',
|
||||
'module.exports = { f };',
|
||||
'',
|
||||
].join('\n');
|
||||
const { compiledLibRequires, hasSeamRequire, hasSeamCall } = scanFile(text);
|
||||
assert.deepStrictEqual(compiledLibRequires, ['../gsd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.deepStrictEqual(compiledLibRequires, ['../msd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.equal(hasSeamRequire, true);
|
||||
assert.equal(hasSeamCall, true);
|
||||
});
|
||||
@@ -105,8 +105,8 @@ describe('scanFile — pure detection', () => {
|
||||
const text = [
|
||||
"'use strict';",
|
||||
// Imported but never invoked — must not satisfy the guard.
|
||||
"const { ensureRuntimeBuild } = require('../gsd-core/bin/ensure-runtime-build.cjs');",
|
||||
"const { runtimes } = require('../gsd-core/bin/lib/capability-registry.cjs');",
|
||||
"const { ensureRuntimeBuild } = require('../msd-core/bin/ensure-runtime-build.cjs');",
|
||||
"const { runtimes } = require('../msd-core/bin/lib/capability-registry.cjs');",
|
||||
'module.exports = { runtimes, ensureRuntimeBuild };',
|
||||
'',
|
||||
].join('\n');
|
||||
@@ -118,7 +118,7 @@ describe('scanFile — pure detection', () => {
|
||||
test('a real require() inside a // comment is NOT counted (comment-only mention)', () => {
|
||||
const text = [
|
||||
"'use strict';",
|
||||
"// example: require('../gsd-core/bin/lib/capability-registry.cjs')",
|
||||
"// example: require('../msd-core/bin/lib/capability-registry.cjs')",
|
||||
"const fs = require('fs');",
|
||||
'',
|
||||
].join('\n');
|
||||
@@ -127,21 +127,21 @@ describe('scanFile — pure detection', () => {
|
||||
});
|
||||
|
||||
// Regression: this repo's own hook comments legitimately spell the glob
|
||||
// `gsd-core/bin/lib/*.cjs` inside a `//` line — a `/` immediately followed
|
||||
// `msd-core/bin/lib/*.cjs` inside a `//` line — a `/` immediately followed
|
||||
// by `*` forms a bare `/*` token. A naive whole-text
|
||||
// `/\*[\s\S]*?\*\//g` block-comment stripper reads that as an OPENING
|
||||
// block comment and silently deletes everything up to the next unrelated
|
||||
// `*/` later in the file — including real require() lines. Caught while
|
||||
// authoring this guard (it ate its own seam require in
|
||||
// hooks/gsd-agent-isolation-guard.js); locked here so it cannot regress.
|
||||
// hooks/msd-agent-isolation-guard.js); locked here so it cannot regress.
|
||||
test('a `//` comment containing a glob like lib/*.cjs does not swallow later real code', () => {
|
||||
const text = [
|
||||
"'use strict';",
|
||||
'// gsd-core/bin/lib/*.cjs (foo.cjs, bar.cjs) are compiled artifacts.',
|
||||
"const { ensureRuntimeBuild } = require('../gsd-core/bin/ensure-runtime-build.cjs');",
|
||||
'// msd-core/bin/lib/*.cjs (foo.cjs, bar.cjs) are compiled artifacts.',
|
||||
"const { ensureRuntimeBuild } = require('../msd-core/bin/ensure-runtime-build.cjs');",
|
||||
'function f() {',
|
||||
' ensureRuntimeBuild();',
|
||||
" const { runtimes } = require('../gsd-core/bin/lib/capability-registry.cjs');",
|
||||
" const { runtimes } = require('../msd-core/bin/lib/capability-registry.cjs');",
|
||||
' return runtimes;',
|
||||
'}',
|
||||
'/* a real, later, unrelated block comment */',
|
||||
@@ -150,12 +150,12 @@ describe('scanFile — pure detection', () => {
|
||||
].join('\n');
|
||||
const stripped = stripComments(text);
|
||||
assert.ok(
|
||||
stripped.includes("require('../gsd-core/bin/ensure-runtime-build.cjs')"),
|
||||
stripped.includes("require('../msd-core/bin/ensure-runtime-build.cjs')"),
|
||||
'the seam require must survive comment-stripping',
|
||||
);
|
||||
assert.ok(stripped.includes('ensureRuntimeBuild();'), 'the seam call must survive comment-stripping');
|
||||
const { compiledLibRequires, hasSeamRequire, hasSeamCall } = scanFile(text);
|
||||
assert.deepStrictEqual(compiledLibRequires, ['../gsd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.deepStrictEqual(compiledLibRequires, ['../msd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.equal(hasSeamRequire, true);
|
||||
assert.equal(hasSeamCall, true);
|
||||
});
|
||||
@@ -164,7 +164,7 @@ describe('scanFile — pure detection', () => {
|
||||
const text = [
|
||||
"'use strict';",
|
||||
'/**',
|
||||
" * Example: require('../gsd-core/bin/lib/capability-registry.cjs') is",
|
||||
" * Example: require('../msd-core/bin/lib/capability-registry.cjs') is",
|
||||
' * mentioned here only as documentation prose.',
|
||||
' */',
|
||||
"const fs = require('fs');",
|
||||
@@ -183,7 +183,7 @@ describe('scanRepo — on-disk fixture tree (proves the guard is not vacuous)',
|
||||
fs.mkdirSync(hooksDir, { recursive: true });
|
||||
const badLines = [
|
||||
"'use strict';",
|
||||
"const { runtimes } = require('../gsd-core/bin/lib/capability-registry.cjs');",
|
||||
"const { runtimes } = require('../msd-core/bin/lib/capability-registry.cjs');",
|
||||
'module.exports = { runtimes };',
|
||||
'',
|
||||
];
|
||||
@@ -192,9 +192,9 @@ describe('scanRepo — on-disk fixture tree (proves the guard is not vacuous)',
|
||||
const goodLines = withSeam
|
||||
? [
|
||||
"'use strict';",
|
||||
"const { ensureRuntimeBuild } = require('../gsd-core/bin/ensure-runtime-build.cjs');",
|
||||
"const { ensureRuntimeBuild } = require('../msd-core/bin/ensure-runtime-build.cjs');",
|
||||
'ensureRuntimeBuild();',
|
||||
"const { runtimes } = require('../gsd-core/bin/lib/capability-registry.cjs');",
|
||||
"const { runtimes } = require('../msd-core/bin/lib/capability-registry.cjs');",
|
||||
'module.exports = { runtimes };',
|
||||
'',
|
||||
]
|
||||
@@ -214,7 +214,7 @@ describe('scanRepo — on-disk fixture tree (proves the guard is not vacuous)',
|
||||
}
|
||||
|
||||
test('a fixture hook requiring a compiled module with NO seam is FLAGGED', (t) => {
|
||||
const dir = createTempDir('gsd-lint-hooks-seam-');
|
||||
const dir = createTempDir('msd-lint-hooks-seam-');
|
||||
t.after(() => cleanup(dir));
|
||||
writeFixtureTree(dir, { withSeam: true });
|
||||
|
||||
@@ -226,12 +226,12 @@ describe('scanRepo — on-disk fixture tree (proves the guard is not vacuous)',
|
||||
`hooks/good-hook.js (seam-wired) must NOT be flagged, got: ${JSON.stringify(files)}`,
|
||||
);
|
||||
const bad = violations.find((v) => v.file === 'hooks/bad-hook.js');
|
||||
assert.deepStrictEqual(bad.compiledLibRequires, ['../gsd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.deepStrictEqual(bad.compiledLibRequires, ['../msd-core/bin/lib/capability-registry.cjs']);
|
||||
assert.ok(bad.missing.length > 0);
|
||||
});
|
||||
|
||||
test('hooks/dist/ (generated build-output copy) is never scanned, even with the same violation', (t) => {
|
||||
const dir = createTempDir('gsd-lint-hooks-seam-dist-');
|
||||
const dir = createTempDir('msd-lint-hooks-seam-dist-');
|
||||
t.after(() => cleanup(dir));
|
||||
writeFixtureTree(dir, { withSeam: true });
|
||||
|
||||
@@ -244,7 +244,7 @@ describe('scanRepo — on-disk fixture tree (proves the guard is not vacuous)',
|
||||
});
|
||||
|
||||
test('a fixture tree with NO offending hooks reports zero violations (no false positive)', (t) => {
|
||||
const dir = createTempDir('gsd-lint-hooks-seam-clean-');
|
||||
const dir = createTempDir('msd-lint-hooks-seam-clean-');
|
||||
t.after(() => cleanup(dir));
|
||||
writeFixtureTree(dir, { withSeam: false });
|
||||
fs.unlinkSync(path.join(dir, 'hooks', 'bad-hook.js'));
|
||||
|
||||
Reference in New Issue
Block a user