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:
Jakub Zych
2026-10-06 01:47:40 +02:00
parent fe069b2a56
commit a9a7a328e6
2763 changed files with 78465 additions and 78434 deletions

View File

@@ -2,7 +2,7 @@
* Tests for legacy artifact cleanup seam (issue #607).
*
* Covers planLegacyCleanup and applyLegacyCleanup from
* gsd-core/bin/lib/legacy-cleanup.cjs using real temp dirs so the
* msd-core/bin/lib/legacy-cleanup.cjs using real temp dirs so the
* filesystem logic is exercised end-to-end without touching live config dirs.
*
* These tests read files they create themselves in OS temp directories —
@@ -18,7 +18,7 @@ const os = require('node:os');
const path = require('node:path');
const { planLegacyCleanup, applyLegacyCleanup } = require(
path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'legacy-cleanup.cjs')
path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'legacy-cleanup.cjs')
);
const { MANAGED_HOOKS } = require(
path.join(__dirname, '..', 'hooks', 'managed-hooks-registry.cjs')
@@ -28,12 +28,12 @@ const { cleanup } = require('./helpers.cjs');
// Assembled the same way the implementation does so this file also avoids the
// bare literal (correctness: the test content strings below DO contain it,
// which is fine — tests may reference the signal string directly).
const OLD_PACKAGE_SIGNAL = 'gsd-core' + '-cc';
const OLD_PACKAGE_SIGNAL = 'msd-core' + '-cc';
// ─── Helpers ─────────────────────────────────────────────────────────────────
function mkTmpDir() {
return fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-607-'));
return fs.mkdtempSync(path.join(os.tmpdir(), 'msd-607-'));
}
function writeFile(filePath, content) {
@@ -63,7 +63,7 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
// ── content-references-old-package ─────────────────────────────────────────
test('flags a hook file in hooks/ whose content contains the old package signal', () => {
const hookFile = path.join(configDir, 'hooks', 'gsd-check-update-worker.js');
const hookFile = path.join(configDir, 'hooks', 'msd-check-update-worker.js');
writeFile(hookFile, '// installed via ' + OLD_PACKAGE_SIGNAL + '\nconsole.log("hello");');
const plan = planLegacyCleanup([configDir], { homeDir });
@@ -74,8 +74,8 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
});
test('does NOT flag a file whose content does not reference the old package', () => {
const hookFile = path.join(configDir, 'hooks', 'gsd-check-update-worker.js');
writeFile(hookFile, '// installed via @opengsd/gsd-core\nconsole.log("ok");');
const hookFile = path.join(configDir, 'hooks', 'msd-check-update-worker.js');
writeFile(hookFile, '// installed via @golem15/msd-core\nconsole.log("ok");');
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === hookFile);
@@ -84,45 +84,45 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
// ── data-loss regression: user custom hooks must be preserved ──────────────
test('regression #607 (data-loss): user custom gsd-*.js with NO old-package content must NOT appear in plan', () => {
// Previously the orphaned-hook-by-name rule would flag any gsd-*.js not in
test('regression #607 (data-loss): user custom msd-*.js with NO old-package content must NOT appear in plan', () => {
// Previously the orphaned-hook-by-name rule would flag any msd-*.js not in
// MANAGED_HOOKS — deleting user-authored hooks. This is the key regression test.
const userHook = path.join(configDir, 'hooks', 'gsd-my-custom.js');
const userHook = path.join(configDir, 'hooks', 'msd-my-custom.js');
writeFile(userHook, '// my custom hook — does not reference the old package');
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === userHook);
assert.equal(entry, undefined, 'user custom gsd-*.js with no old-package content must NOT be in plan');
assert.equal(entry, undefined, 'user custom msd-*.js with no old-package content must NOT be in plan');
});
test('regression #607 (data-loss): user custom gsd-*.sh with NO old-package content must NOT appear in plan', () => {
const userHook = path.join(configDir, 'hooks', 'gsd-my-custom.sh');
test('regression #607 (data-loss): user custom msd-*.sh with NO old-package content must NOT appear in plan', () => {
const userHook = path.join(configDir, 'hooks', 'msd-my-custom.sh');
writeFile(userHook, '#!/bin/sh\n# my custom shell hook, clean');
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === userHook);
assert.equal(entry, undefined, 'user custom gsd-*.sh with no old-package content must NOT be in plan');
assert.equal(entry, undefined, 'user custom msd-*.sh with no old-package content must NOT be in plan');
});
// ── self-deletion regression: gsd-core/ subtree must NOT be scanned ──
// ── self-deletion regression: msd-core/ subtree must NOT be scanned ──
test('regression #607 (self-deletion): a code file under gsd-core/bin/lib/ containing old-package signal must NOT be flagged', () => {
// The subtree 'gsd-core' is no longer scanned — the current package's
test('regression #607 (self-deletion): a code file under msd-core/bin/lib/ containing old-package signal must NOT be flagged', () => {
// The subtree 'msd-core' is no longer scanned — the current package's
// own infra lives there and would falsely match if scanned.
const libFile = path.join(configDir, 'gsd-core', 'bin', 'lib', 'legacy-cleanup.cjs');
writeFile(libFile, "'use strict';\nconst SIG = 'gsd-core' + '-cc';\nmodule.exports = {};");
const libFile = path.join(configDir, 'msd-core', 'bin', 'lib', 'legacy-cleanup.cjs');
writeFile(libFile, "'use strict';\nconst SIG = 'msd-core' + '-cc';\nmodule.exports = {};");
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === libFile);
assert.equal(entry, undefined, 'code file in gsd-core/ subtree must NOT appear in plan (subtree not scanned)');
assert.equal(entry, undefined, 'code file in msd-core/ subtree must NOT appear in plan (subtree not scanned)');
});
// ── issue-607 regression: markdown files must never be flagged ─────────────
test('regression #607: CHANGELOG.md containing old-package signal must NOT be flagged', () => {
// Markdown docs legitimately cite the old package name in historical context.
const changelogFile = path.join(configDir, 'gsd-core', 'CHANGELOG.md');
writeFile(changelogFile, '# Changelog\n\nMigrated from ' + OLD_PACKAGE_SIGNAL + ' to @opengsd/gsd-core.');
const changelogFile = path.join(configDir, 'msd-core', 'CHANGELOG.md');
writeFile(changelogFile, '# Changelog\n\nMigrated from ' + OLD_PACKAGE_SIGNAL + ' to @golem15/msd-core.');
const plan = planLegacyCleanup([configDir], { homeDir });
@@ -131,7 +131,7 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
});
test('regression #607: a workflow .md file containing old-package signal must NOT be flagged', () => {
const workflowMd = path.join(configDir, 'gsd-core', 'workflows', 'update.md');
const workflowMd = path.join(configDir, 'msd-core', 'workflows', 'update.md');
writeFile(workflowMd, '# Update workflow\n\nPreviously required ' + OLD_PACKAGE_SIGNAL + ' to be installed.');
const plan = planLegacyCleanup([configDir], { homeDir });
@@ -143,7 +143,7 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
// ── dev-preferences exclusion ──────────────────────────────────────────────
test('NEVER flags dev-preferences.md even if its content contains old-package signal', () => {
// Place dev-preferences.md inside a GSD-managed subtree
// Place dev-preferences.md inside a MSD-managed subtree
const devPrefs = path.join(configDir, 'hooks', 'dev-preferences.md');
writeFile(devPrefs, '# My prefs\n\nI used to use ' + OLD_PACKAGE_SIGNAL);
@@ -164,7 +164,7 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
// ── legacy-shared-cache ────────────────────────────────────────────────────
test('flags the legacy shared cache when it exists with reason legacy-shared-cache', () => {
const cachePath = path.join(homeDir, '.cache', 'gsd', 'gsd-update-check.json');
const cachePath = path.join(homeDir, '.cache', 'msd', 'msd-update-check.json');
writeFile(cachePath, JSON.stringify({ update_available: false }));
const plan = planLegacyCleanup([], { homeDir });
@@ -177,7 +177,7 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
test('does NOT flag the legacy shared cache when it is absent', () => {
// homeDir exists but cache file was never written
const plan = planLegacyCleanup([], { homeDir });
const cachePath = path.join(homeDir, '.cache', 'gsd', 'gsd-update-check.json');
const cachePath = path.join(homeDir, '.cache', 'msd', 'msd-update-check.json');
const entry = plan.find((p) => p.path === cachePath);
assert.equal(entry, undefined, 'absent cache must not appear in plan');
});
@@ -185,7 +185,7 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
// ── deduplication and sort ─────────────────────────────────────────────────
test('de-duplicates candidates when two configDirs share same absolute path (same dir listed twice)', () => {
const signalFile = path.join(configDir, 'hooks', 'gsd-old-feature.sh');
const signalFile = path.join(configDir, 'hooks', 'msd-old-feature.sh');
writeFile(signalFile, '# ' + OLD_PACKAGE_SIGNAL);
const plan = planLegacyCleanup([configDir, configDir], { homeDir });
@@ -194,8 +194,8 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
});
test('plan entries are sorted by path', () => {
writeFile(path.join(configDir, 'hooks', 'gsd-zzz-last.js'), '// ' + OLD_PACKAGE_SIGNAL);
writeFile(path.join(configDir, 'hooks', 'gsd-aaa-first.js'), '// ' + OLD_PACKAGE_SIGNAL);
writeFile(path.join(configDir, 'hooks', 'msd-zzz-last.js'), '// ' + OLD_PACKAGE_SIGNAL);
writeFile(path.join(configDir, 'hooks', 'msd-aaa-first.js'), '// ' + OLD_PACKAGE_SIGNAL);
const plan = planLegacyCleanup([configDir], { homeDir });
const paths = plan.map((p) => p.path);
@@ -206,77 +206,77 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
// ── only known reasons ─────────────────────────────────────────────────────
test('plan entries only ever have known reasons', () => {
writeFile(path.join(configDir, 'hooks', 'gsd-worker.js'), '// ' + OLD_PACKAGE_SIGNAL);
const cachePath = path.join(homeDir, '.cache', 'gsd', 'gsd-update-check.json');
writeFile(path.join(configDir, 'hooks', 'msd-worker.js'), '// ' + OLD_PACKAGE_SIGNAL);
const cachePath = path.join(homeDir, '.cache', 'msd', 'msd-update-check.json');
writeFile(cachePath, '{}');
// Stale skill file (#1453)
const staleSkillPath = path.join(configDir, 'skills', 'gsd-docs-update', 'SKILL.md');
writeFile(staleSkillPath, '@$HOME/.codex/' + 'get-shit-done' + '/workflows/docs-update.md\n'); // gsd-allow-legacy-name
const staleSkillPath = path.join(configDir, 'skills', 'msd-docs-update', 'SKILL.md');
writeFile(staleSkillPath, '@$HOME/.codex/' + 'get-shit-done' + '/workflows/docs-update.md\n'); // msd-allow-legacy-name
// User custom hook — should NOT appear
writeFile(path.join(configDir, 'hooks', 'gsd-my-custom.js'), '// user hook, clean');
writeFile(path.join(configDir, 'hooks', 'msd-my-custom.js'), '// user hook, clean');
const plan = planLegacyCleanup([configDir], { homeDir });
const validReasons = new Set(['content-references-old-package', 'legacy-shared-cache', 'stale-get-shit-done-path']); // gsd-allow-legacy-name
const validReasons = new Set(['content-references-old-package', 'legacy-shared-cache', 'stale-get-shit-done-path']); // msd-allow-legacy-name
for (const entry of plan) {
assert.ok(validReasons.has(entry.reason), `unexpected reason: ${entry.reason}`);
}
});
// ── #1453 stale skill path in ~/.agents/skills/gsd-* ──────────────────────
// ── #1453 stale skill path in ~/.agents/skills/msd-* ──────────────────────
test('#1453: flags a SKILL.md whose content contains a get-shit-done path reference with reason stale-get-shit-done-path', () => { // gsd-allow-legacy-name
// Simulate a stale ~/.agents/skills/gsd-docs-update/SKILL.md left by an
// older GSD install that embedded the pre-rename runtime path.
const staleSkillFile = path.join(configDir, 'skills', 'gsd-docs-update', 'SKILL.md');
test('#1453: flags a SKILL.md whose content contains a get-shit-done path reference with reason stale-get-shit-done-path', () => { // msd-allow-legacy-name
// Simulate a stale ~/.agents/skills/msd-docs-update/SKILL.md left by an
// older MSD install that embedded the pre-rename runtime path.
const staleSkillFile = path.join(configDir, 'skills', 'msd-docs-update', 'SKILL.md');
writeFile(
staleSkillFile,
'---\nname: gsd-docs-update\n---\n' +
'@$HOME/.codex/' + 'get-shit-done' + '/workflows/docs-update.md\n' // gsd-allow-legacy-name
'---\nname: msd-docs-update\n---\n' +
'@$HOME/.codex/' + 'get-shit-done' + '/workflows/docs-update.md\n' // msd-allow-legacy-name
);
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === staleSkillFile);
assert.ok(entry, 'expected stale SKILL.md to appear in plan');
assert.equal(entry.reason, 'stale-get-shit-done-path'); // gsd-allow-legacy-name
assert.equal(entry.reason, 'stale-get-shit-done-path'); // msd-allow-legacy-name
});
test('#1453: does NOT flag a SKILL.md whose content contains the new gsd-core path', () => {
test('#1453: does NOT flag a SKILL.md whose content contains the new msd-core path', () => {
// A freshly installed SKILL.md references the new runtime directory name.
const freshSkillFile = path.join(configDir, 'skills', 'gsd-docs-update', 'SKILL.md');
const freshSkillFile = path.join(configDir, 'skills', 'msd-docs-update', 'SKILL.md');
writeFile(
freshSkillFile,
'---\nname: gsd-docs-update\n---\n' +
'@$HOME/.codex/gsd-core/workflows/docs-update.md\n'
'---\nname: msd-docs-update\n---\n' +
'@$HOME/.codex/msd-core/workflows/docs-update.md\n'
);
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === freshSkillFile);
assert.equal(entry, undefined, 'fresh SKILL.md (gsd-core path) must NOT appear in plan');
assert.equal(entry, undefined, 'fresh SKILL.md (msd-core path) must NOT appear in plan');
});
test('#1453: does NOT flag SKILL.md files under user-owned (non-gsd-*) skill directories', () => {
test('#1453: does NOT flag SKILL.md files under user-owned (non-msd-*) skill directories', () => {
// A user-authored skill dir with a custom name must never be touched.
const userSkillFile = path.join(configDir, 'skills', 'my-custom-skill', 'SKILL.md');
writeFile(
userSkillFile,
'---\nname: my-custom-skill\n---\n' +
'This skill uses ' + 'get-shit-done' + ' concepts.\n' // gsd-allow-legacy-name
'This skill uses ' + 'get-shit-done' + ' concepts.\n' // msd-allow-legacy-name
);
const plan = planLegacyCleanup([configDir], { homeDir });
const entry = plan.find((p) => p.path === userSkillFile);
assert.equal(entry, undefined, 'user-owned (non-gsd-*) SKILL.md must NOT appear in plan');
assert.equal(entry, undefined, 'user-owned (non-msd-*) SKILL.md must NOT appear in plan');
});
test('#1453: flags SKILL.md with stale path but preserves SKILL.md in the same dir without stale path', () => {
// Two skill dirs: one stale (get-shit-done ref), one fresh (gsd-core ref). // gsd-allow-legacy-name
const staleSkill = path.join(configDir, 'skills', 'gsd-docs-update', 'SKILL.md');
const freshSkill = path.join(configDir, 'skills', 'gsd-help', 'SKILL.md');
writeFile(staleSkill, '@$HOME/.codex/' + 'get-shit-done' + '/workflows/docs-update.md\n'); // gsd-allow-legacy-name
writeFile(freshSkill, '@$HOME/.codex/gsd-core/workflows/help.md\n');
// Two skill dirs: one stale (get-shit-done ref), one fresh (msd-core ref). // msd-allow-legacy-name
const staleSkill = path.join(configDir, 'skills', 'msd-docs-update', 'SKILL.md');
const freshSkill = path.join(configDir, 'skills', 'msd-help', 'SKILL.md');
writeFile(staleSkill, '@$HOME/.codex/' + 'get-shit-done' + '/workflows/docs-update.md\n'); // msd-allow-legacy-name
writeFile(freshSkill, '@$HOME/.codex/msd-core/workflows/help.md\n');
const plan = planLegacyCleanup([configDir], { homeDir });
@@ -284,21 +284,21 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
const freshEntry = plan.find((p) => p.path === freshSkill);
assert.ok(staleEntry, 'stale SKILL.md must appear in plan');
assert.equal(staleEntry.reason, 'stale-get-shit-done-path'); // gsd-allow-legacy-name
assert.equal(staleEntry.reason, 'stale-get-shit-done-path'); // msd-allow-legacy-name
assert.equal(freshEntry, undefined, 'fresh SKILL.md must NOT appear in plan');
});
test('#1453: regression — after upgrade to gsd-core 1.5.0, stale ~/.agents/skills/gsd-docs-update/SKILL.md is removed', () => {
test('#1453: regression — after upgrade to msd-core 1.5.0, stale ~/.agents/skills/msd-docs-update/SKILL.md is removed', () => {
// Simulate the exact scenario from issue #1453:
// ~/.agents/skills/gsd-docs-update/SKILL.md references the old get-shit-done runtime. // gsd-allow-legacy-name
// ~/.agents/skills/msd-docs-update/SKILL.md references the old get-shit-done runtime. // msd-allow-legacy-name
// The upgrade installs correctly to ~/.codex/skills/ but leaves the stale
// ~/.agents/skills/ copy which Codex can still discover.
const agentsDir = path.join(homeDir, '.agents');
const staleSkill = path.join(agentsDir, 'skills', 'gsd-docs-update', 'SKILL.md');
const staleSkill = path.join(agentsDir, 'skills', 'msd-docs-update', 'SKILL.md');
writeFile(
staleSkill,
'---\nname: gsd-docs-update\n---\n' +
'@$HOME/.Codex/' + 'get-shit-done' + '/workflows/docs-update.md\n' // gsd-allow-legacy-name
'---\nname: msd-docs-update\n---\n' +
'@$HOME/.Codex/' + 'get-shit-done' + '/workflows/docs-update.md\n' // msd-allow-legacy-name
);
// planLegacyCleanup receives ~/.agents as one of the configDirs (as _LEGACY_SCAN_SUBDIR_NAMES
@@ -306,8 +306,8 @@ describe('issue-607 legacy-cleanup: planLegacyCleanup', () => {
const plan = planLegacyCleanup([agentsDir], { homeDir });
const entry = plan.find((p) => p.path === staleSkill);
assert.ok(entry, 'stale ~/.agents/skills/gsd-docs-update/SKILL.md must appear in plan');
assert.equal(entry.reason, 'stale-get-shit-done-path'); // gsd-allow-legacy-name
assert.ok(entry, 'stale ~/.agents/skills/msd-docs-update/SKILL.md must appear in plan');
assert.equal(entry.reason, 'stale-get-shit-done-path'); // msd-allow-legacy-name
// Applying the plan removes the stale file
const result = applyLegacyCleanup(plan);
@@ -338,9 +338,9 @@ describe('issue-607 legacy-cleanup: applyLegacyCleanup', () => {
test('dryRun:true removes nothing and returns dryRun:true + all paths in skipped', () => {
// Use a content-signal hook (only way to get a plan entry now)
const signalHook = path.join(configDir, 'hooks', 'gsd-check-update-worker.js');
const signalHook = path.join(configDir, 'hooks', 'msd-check-update-worker.js');
writeFile(signalHook, '// ' + OLD_PACKAGE_SIGNAL);
const cacheFile = path.join(homeDir, '.cache', 'gsd', 'gsd-update-check.json');
const cacheFile = path.join(homeDir, '.cache', 'msd', 'msd-update-check.json');
writeFile(cacheFile, '{}');
const plan = planLegacyCleanup([configDir], { homeDir });
@@ -372,18 +372,18 @@ describe('issue-607 legacy-cleanup: applyLegacyCleanup', () => {
test('apply removes flagged files and returns them in removed[]', () => {
// Content-signal hook — flagged and must be removed
const signalHook = path.join(configDir, 'hooks', 'gsd-check-update-worker.js');
const signalHook = path.join(configDir, 'hooks', 'msd-check-update-worker.js');
writeFile(signalHook, '// ' + OLD_PACKAGE_SIGNAL);
const cacheFile = path.join(homeDir, '.cache', 'gsd', 'gsd-update-check.json');
const cacheFile = path.join(homeDir, '.cache', 'msd', 'msd-update-check.json');
writeFile(cacheFile, '{}');
// User custom hook — clean content, must NOT be in plan and must survive
const userHook = path.join(configDir, 'hooks', 'gsd-my-custom.js');
const userHook = path.join(configDir, 'hooks', 'msd-my-custom.js');
writeFile(userHook, '// user hook, no old package ref');
// Managed hook with clean content — must NOT be in plan and must survive
const managedHook = path.join(configDir, 'hooks', MANAGED_HOOKS[0]);
writeFile(managedHook, '// @opengsd/gsd-core only');
writeFile(managedHook, '// @golem15/msd-core only');
const plan = planLegacyCleanup([configDir], { homeDir });
assert.ok(plan.length > 0, 'precondition: plan must be non-empty');