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,5 +1,5 @@
|
||||
/**
|
||||
* Regression test for #1860: detectConfigDir in gsd-check-update.js should
|
||||
* Regression test for #1860: detectConfigDir in msd-check-update.js should
|
||||
* prioritize .claude over .config/opencode so that Claude Code sessions
|
||||
* don't report false "update available" warnings when an older OpenCode
|
||||
* install exists alongside a newer Claude Code install.
|
||||
@@ -7,10 +7,10 @@
|
||||
* All coverage here is BEHAVIORAL: it spawns the real hook (as a `node -e`
|
||||
* child, with `child_process.spawn` stubbed) and observes the resolved
|
||||
* config-dir paths it hands to its background worker via env vars. Nothing
|
||||
* in this file reads hooks/gsd-check-update.js source — the hook has no
|
||||
* in this file reads hooks/msd-check-update.js source — the hook has no
|
||||
* exports (it runs entirely on require), so its only outward, in-process
|
||||
* observable effect is the one spawn() call it makes to launch its worker.
|
||||
* That spawn's env carries GSD_GLOBAL_VERSION_FILE / GSD_PROJECT_VERSION_FILE,
|
||||
* That spawn's env carries MSD_GLOBAL_VERSION_FILE / MSD_PROJECT_VERSION_FILE,
|
||||
* which is deliberately borrowed as the observation seam here (Hyrum's Law:
|
||||
* this is an implementation detail, not a contract) rather than a real
|
||||
* subprocess launch, since the actual worker touches the network.
|
||||
@@ -27,7 +27,7 @@ const { cleanup } = require('./helpers.cjs');
|
||||
const { runNode, OUTCOME } = require('./helpers/process-seam.cjs');
|
||||
const { PROBE_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
|
||||
|
||||
const CHECK_UPDATE_PATH = path.join(__dirname, '..', 'hooks', 'gsd-check-update.js');
|
||||
const CHECK_UPDATE_PATH = path.join(__dirname, '..', 'hooks', 'msd-check-update.js');
|
||||
|
||||
// ─── Probe harness ──────────────────────────────────────────────────────────
|
||||
//
|
||||
@@ -52,9 +52,9 @@ function buildProbeSource(hookPath) {
|
||||
`require(${JSON.stringify(hookPath)});`,
|
||||
'const result = {',
|
||||
' spawned: spawned,',
|
||||
' global: capturedEnv ? capturedEnv.GSD_GLOBAL_VERSION_FILE : null,',
|
||||
' project: capturedEnv ? capturedEnv.GSD_PROJECT_VERSION_FILE : null,',
|
||||
' cache: capturedEnv ? capturedEnv.GSD_CACHE_FILE : null,',
|
||||
' global: capturedEnv ? capturedEnv.MSD_GLOBAL_VERSION_FILE : null,',
|
||||
' project: capturedEnv ? capturedEnv.MSD_PROJECT_VERSION_FILE : null,',
|
||||
' cache: capturedEnv ? capturedEnv.MSD_CACHE_FILE : null,',
|
||||
'};',
|
||||
'process.stdout.write(JSON.stringify(result) + "\\n");',
|
||||
].join('\n');
|
||||
@@ -70,7 +70,7 @@ function buildProbeSource(hookPath) {
|
||||
* @param {object} [opts.envOverrides] - applied after HOME/USERPROFILE and
|
||||
* after CLAUDE_CONFIG_DIR is deleted, so a row can reintroduce it.
|
||||
* @param {string} [opts.hookPath] - override the hook under test (defaults to
|
||||
* the real hooks/gsd-check-update.js). Used by the #3582 cold-tree suite
|
||||
* the real hooks/msd-check-update.js). Used by the #3582 cold-tree suite
|
||||
* below to point at a fixture copy instead.
|
||||
*/
|
||||
function probe({ homeDir, cwd, envOverrides = {}, hookPath = CHECK_UPDATE_PATH }) {
|
||||
@@ -108,7 +108,7 @@ function probe({ homeDir, cwd, envOverrides = {}, hookPath = CHECK_UPDATE_PATH }
|
||||
|
||||
if (parsed.spawned !== true) {
|
||||
throw new Error(
|
||||
"probe: hooks/gsd-check-update.js no longer calls child_process.spawn() to launch " +
|
||||
"probe: hooks/msd-check-update.js no longer calls child_process.spawn() to launch " +
|
||||
"its background worker. This harness's OBSERVATION POINT (reading detectConfigDir's " +
|
||||
"resolved paths off the spawn() env) has moved and needs to be re-anchored on " +
|
||||
'whatever now carries the resolved config-dir paths — this is NOT evidence that ' +
|
||||
@@ -133,7 +133,7 @@ function assertConfigDir(actualVersionFile, expectedDir, message) {
|
||||
}
|
||||
|
||||
function writeVersionFile(configDir) {
|
||||
const versionDir = path.join(configDir, 'gsd-core');
|
||||
const versionDir = path.join(configDir, 'msd-core');
|
||||
fs.mkdirSync(versionDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(versionDir, 'VERSION'), '1.0.0\n');
|
||||
}
|
||||
@@ -153,8 +153,8 @@ describe('detectConfigDir runtime behavior (#1860)', () => {
|
||||
// resolving an already-resolved path a no-op on both sides, so the two
|
||||
// mechanisms can never disagree — instead of patching the divergence
|
||||
// back together at each assertion.
|
||||
tmpHome = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-test-home-')));
|
||||
tmpProject = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-test-project-')));
|
||||
tmpHome = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-test-home-')));
|
||||
tmpProject = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-test-project-')));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -198,7 +198,7 @@ describe('detectConfigDir runtime behavior (#1860)', () => {
|
||||
});
|
||||
|
||||
test('CLAUDE_CONFIG_DIR with a valid VERSION short-circuits the search order', (t) => {
|
||||
const envDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-test-envdir-')));
|
||||
const envDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-test-envdir-')));
|
||||
t.after(() => cleanup(envDir));
|
||||
writeVersionFile(envDir);
|
||||
writeVersionFile(path.join(tmpHome, '.claude'));
|
||||
@@ -213,7 +213,7 @@ describe('detectConfigDir runtime behavior (#1860)', () => {
|
||||
});
|
||||
|
||||
test('CLAUDE_CONFIG_DIR without a VERSION file does not short-circuit the search', (t) => {
|
||||
const envDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-test-envdir-')));
|
||||
const envDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-test-envdir-')));
|
||||
t.after(() => cleanup(envDir));
|
||||
writeVersionFile(path.join(tmpHome, '.claude'));
|
||||
|
||||
@@ -227,7 +227,7 @@ describe('detectConfigDir runtime behavior (#1860)', () => {
|
||||
});
|
||||
|
||||
test('CLAUDE_CONFIG_DIR without a VERSION file anywhere falls back to the env dir itself', (t) => {
|
||||
const envDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-test-envdir-')));
|
||||
const envDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-test-envdir-')));
|
||||
t.after(() => cleanup(envDir));
|
||||
|
||||
const result = probe({ homeDir: tmpHome, cwd: tmpProject, envOverrides: { CLAUDE_CONFIG_DIR: envDir } });
|
||||
@@ -287,7 +287,7 @@ describe('detectConfigDir runtime behavior (#1860)', () => {
|
||||
assertConfigDir(
|
||||
result.global,
|
||||
path.join(tmpHome, '.config', 'opencode'),
|
||||
'an existing .claude dir with no gsd-core/VERSION file must not satisfy the search — ' +
|
||||
'an existing .claude dir with no msd-core/VERSION file must not satisfy the search — ' +
|
||||
'fs.existsSync(VERSION) is the predicate, not directory existence'
|
||||
);
|
||||
});
|
||||
@@ -311,37 +311,37 @@ describe('detectConfigDir runtime behavior (#1860)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ─── #3582: cold tree (no gsd-core/bin/lib/*.cjs) — degraded cache filename ─
|
||||
// ─── #3582: cold tree (no msd-core/bin/lib/*.cjs) — degraded cache filename ─
|
||||
//
|
||||
// gsd-core/bin/lib/package-identity.cjs is a tsc build artifact (ADR-457),
|
||||
// msd-core/bin/lib/package-identity.cjs is a tsc build artifact (ADR-457),
|
||||
// gitignored and absent on a raw plugin-marketplace / git-clone install that
|
||||
// never ran `npm run build:lib`. This SessionStart hook degrades to the
|
||||
// hardcoded fallback cache filename ('gsd-update-check.json') rather than
|
||||
// hardcoded fallback cache filename ('msd-update-check.json') rather than
|
||||
// crash session start (see the hook's own #3582 comment). The DEGRADED
|
||||
// VERDICT this test locks is observable via the SAME spawn-env probe seam
|
||||
// used above: the GSD_CACHE_FILE env var the hook hands to its worker must
|
||||
// used above: the MSD_CACHE_FILE env var the hook hands to its worker must
|
||||
// end with the fallback literal, not throw and not silently vanish.
|
||||
// Simulated hermetically via tests/helpers/cold-runtime-lib-fixture.cjs — the
|
||||
// REAL gsd-core/bin/lib/ is never touched.
|
||||
describe('gsd-check-update.js: #3582 cold tree — degrades to the fallback cache filename', () => {
|
||||
// REAL msd-core/bin/lib/ is never touched.
|
||||
describe('msd-check-update.js: #3582 cold tree — degrades to the fallback cache filename', () => {
|
||||
const { buildColdInstallTree } = require('./helpers/cold-runtime-lib-fixture.cjs');
|
||||
|
||||
test('missing compiled runtime library -> worker still launched, with the hardcoded fallback cache filename', (t) => {
|
||||
const cold = buildColdInstallTree();
|
||||
t.after(cold.cleanup);
|
||||
const home = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-cu-cold-home-')));
|
||||
const project = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-cu-cold-project-')));
|
||||
const home = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-cu-cold-home-')));
|
||||
const project = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-cu-cold-project-')));
|
||||
t.after(() => { cleanup(home); cleanup(project); });
|
||||
|
||||
const result = probe({
|
||||
homeDir: home,
|
||||
cwd: project,
|
||||
hookPath: path.join(cold.hooksDir, 'gsd-check-update.js'),
|
||||
hookPath: path.join(cold.hooksDir, 'msd-check-update.js'),
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
path.basename(result.cache),
|
||||
'gsd-update-check.json',
|
||||
'msd-update-check.json',
|
||||
`expected the hardcoded degrade fallback cache filename when package-identity.cjs cannot be built; got: ${result.cache}`,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user