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 @@
|
||||
|
||||
/**
|
||||
* TDD tests for installer migration 004:
|
||||
* 2026-06-09-prune-stale-pristine-get-shit-done // gsd-allow-legacy-name
|
||||
* 2026-06-09-prune-stale-pristine-get-shit-done // msd-allow-legacy-name
|
||||
*
|
||||
* Verifies plan() logic for:
|
||||
* 1. Stale pristine subdir absent -> empty plan (idempotency)
|
||||
@@ -18,11 +18,11 @@ const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
// Load compiled module (build:lib compiles src/*.cts -> gsd-core/bin/lib/*.cjs)
|
||||
const migration = require('../gsd-core/bin/lib/installer-migrations/004-prune-stale-pristine-snapshots.cjs');
|
||||
// Load compiled module (build:lib compiles src/*.cts -> msd-core/bin/lib/*.cjs)
|
||||
const migration = require('../msd-core/bin/lib/installer-migrations/004-prune-stale-pristine-snapshots.cjs');
|
||||
|
||||
function createTempDir() {
|
||||
return fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-migration-004-test-'));
|
||||
return fs.mkdtempSync(path.join(os.tmpdir(), 'msd-migration-004-test-'));
|
||||
}
|
||||
|
||||
function cleanup(dir) {
|
||||
@@ -38,7 +38,7 @@ function writeFile(root, relPath, content) {
|
||||
|
||||
function writeManifest(root, files) {
|
||||
fs.writeFileSync(
|
||||
path.join(root, 'gsd-file-manifest.json'),
|
||||
path.join(root, 'msd-file-manifest.json'),
|
||||
JSON.stringify({
|
||||
version: '1.3.0',
|
||||
timestamp: '2026-06-01T00:00:00.000Z',
|
||||
@@ -53,7 +53,7 @@ function writeManifest(root, files) {
|
||||
const {
|
||||
classifyArtifact: realClassifyArtifact,
|
||||
readInstallManifest,
|
||||
} = require('../gsd-core/bin/lib/installer-migrations.cjs');
|
||||
} = require('../msd-core/bin/lib/installer-migrations.cjs');
|
||||
|
||||
function makePlanCtx(configDir) {
|
||||
const manifest = readInstallManifest(configDir);
|
||||
@@ -99,11 +99,11 @@ describe('migration 004 metadata', () => {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('plan() — stale pristine subdir absent', () => {
|
||||
test('returns empty array when gsd-pristine/get-shit-done/ does not exist', () => { // gsd-allow-legacy-name
|
||||
test('returns empty array when msd-pristine/get-shit-done/ does not exist', () => { // msd-allow-legacy-name
|
||||
const configDir = createTempDir();
|
||||
try {
|
||||
// Only gsd-pristine/gsd-core/ exists — no legacy subdir.
|
||||
writeFile(configDir, 'gsd-pristine/gsd-core/workflows/plan.md', 'pristine snapshot\n');
|
||||
// Only msd-pristine/msd-core/ exists — no legacy subdir.
|
||||
writeFile(configDir, 'msd-pristine/msd-core/workflows/plan.md', 'pristine snapshot\n');
|
||||
writeManifest(configDir, {});
|
||||
|
||||
const actions = migration.plan(makePlanCtx(configDir));
|
||||
@@ -113,7 +113,7 @@ describe('plan() — stale pristine subdir absent', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('returns empty array when gsd-pristine/ does not exist at all', () => {
|
||||
test('returns empty array when msd-pristine/ does not exist at all', () => {
|
||||
const configDir = createTempDir();
|
||||
try {
|
||||
writeManifest(configDir, {});
|
||||
@@ -130,11 +130,11 @@ describe('plan() — stale pristine subdir absent', () => {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('plan() — stale pristine files present', () => {
|
||||
test('emits remove-managed for each file under gsd-pristine/get-shit-done/', () => { // gsd-allow-legacy-name
|
||||
test('emits remove-managed for each file under msd-pristine/get-shit-done/', () => { // msd-allow-legacy-name
|
||||
const configDir = createTempDir();
|
||||
try {
|
||||
writeFile(configDir, 'gsd-pristine/get-shit-done/workflows/plan.md', 'old pristine\n'); // gsd-allow-legacy-name
|
||||
writeFile(configDir, 'gsd-pristine/get-shit-done/skills/gsd-foo/SKILL.md', 'old skill\n'); // gsd-allow-legacy-name
|
||||
writeFile(configDir, 'msd-pristine/get-shit-done/workflows/plan.md', 'old pristine\n'); // msd-allow-legacy-name
|
||||
writeFile(configDir, 'msd-pristine/get-shit-done/skills/msd-foo/SKILL.md', 'old skill\n'); // msd-allow-legacy-name
|
||||
writeManifest(configDir, {});
|
||||
|
||||
const actions = migration.plan(makePlanCtx(configDir));
|
||||
@@ -142,8 +142,8 @@ describe('plan() — stale pristine files present', () => {
|
||||
for (const action of actions) {
|
||||
assert.equal(action.type, 'remove-managed', `expected remove-managed, got ${action.type}`);
|
||||
assert.ok(
|
||||
action.relPath.replace(/\\/g, '/').startsWith('gsd-pristine/get-shit-done/'), // gsd-allow-legacy-name
|
||||
`relPath should start with gsd-pristine/get-shit-done/, got: ${action.relPath}`, // gsd-allow-legacy-name
|
||||
action.relPath.replace(/\\/g, '/').startsWith('msd-pristine/get-shit-done/'), // msd-allow-legacy-name
|
||||
`relPath should start with msd-pristine/get-shit-done/, got: ${action.relPath}`, // msd-allow-legacy-name
|
||||
);
|
||||
assert.equal(typeof action.reason, 'string');
|
||||
assert.ok(action.reason.length > 0, 'reason must not be empty');
|
||||
@@ -158,13 +158,13 @@ describe('plan() — stale pristine files present', () => {
|
||||
test('emits exactly one remove-managed per file (correct relPaths)', () => {
|
||||
const configDir = createTempDir();
|
||||
try {
|
||||
writeFile(configDir, 'gsd-pristine/get-shit-done/workflows/execute-phase.md', 'pristine\n'); // gsd-allow-legacy-name
|
||||
writeFile(configDir, 'msd-pristine/get-shit-done/workflows/execute-phase.md', 'pristine\n'); // msd-allow-legacy-name
|
||||
writeManifest(configDir, {});
|
||||
|
||||
const actions = migration.plan(makePlanCtx(configDir));
|
||||
assert.equal(actions.length, 1);
|
||||
const relPathNorm = actions[0].relPath.replace(/\\/g, '/');
|
||||
assert.equal(relPathNorm, 'gsd-pristine/get-shit-done/workflows/execute-phase.md'); // gsd-allow-legacy-name
|
||||
assert.equal(relPathNorm, 'msd-pristine/get-shit-done/workflows/execute-phase.md'); // msd-allow-legacy-name
|
||||
} finally {
|
||||
cleanup(configDir);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ describe('plan() — stale pristine files present', () => {
|
||||
test('actions include classification override to managed-pristine', () => {
|
||||
const configDir = createTempDir();
|
||||
try {
|
||||
writeFile(configDir, 'gsd-pristine/get-shit-done/workflows/plan.md', 'pristine snapshot\n'); // gsd-allow-legacy-name
|
||||
writeFile(configDir, 'msd-pristine/get-shit-done/workflows/plan.md', 'pristine snapshot\n'); // msd-allow-legacy-name
|
||||
writeManifest(configDir, {});
|
||||
|
||||
const actions = migration.plan(makePlanCtx(configDir));
|
||||
@@ -194,14 +194,14 @@ describe('plan() — stale pristine files present', () => {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('plan() — stale pristine root is a symlink', () => {
|
||||
test('returns empty array when gsd-pristine/get-shit-done/ is a symlink', () => { // gsd-allow-legacy-name
|
||||
test('returns empty array when msd-pristine/get-shit-done/ is a symlink', () => { // msd-allow-legacy-name
|
||||
const configDir = createTempDir();
|
||||
const externalDir = createTempDir();
|
||||
try {
|
||||
writeFile(externalDir, 'workflows/plan.md', 'pristine content\n');
|
||||
// Create gsd-pristine/ as a real dir but make get-shit-done/ a symlink. // gsd-allow-legacy-name
|
||||
fs.mkdirSync(path.join(configDir, 'gsd-pristine'), { recursive: true });
|
||||
const legacyLink = path.join(configDir, 'gsd-pristine', 'get-shit-done'); // gsd-allow-legacy-name
|
||||
// Create msd-pristine/ as a real dir but make get-shit-done/ a symlink. // msd-allow-legacy-name
|
||||
fs.mkdirSync(path.join(configDir, 'msd-pristine'), { recursive: true });
|
||||
const legacyLink = path.join(configDir, 'msd-pristine', 'get-shit-done'); // msd-allow-legacy-name
|
||||
fs.symlinkSync(externalDir, legacyLink);
|
||||
writeManifest(configDir, {});
|
||||
|
||||
@@ -223,13 +223,13 @@ describe('plan() — symlinked entry inside stale pristine dir is skipped', () =
|
||||
const configDir = createTempDir();
|
||||
const externalTarget = createTempDir();
|
||||
try {
|
||||
// A real file inside gsd-pristine/get-shit-done/ // gsd-allow-legacy-name
|
||||
writeFile(configDir, 'gsd-pristine/get-shit-done/workflows/plan.md', 'real pristine\n'); // gsd-allow-legacy-name
|
||||
// A real file inside msd-pristine/get-shit-done/ // msd-allow-legacy-name
|
||||
writeFile(configDir, 'msd-pristine/get-shit-done/workflows/plan.md', 'real pristine\n'); // msd-allow-legacy-name
|
||||
|
||||
// A symlink inside the same dir pointing to external target.
|
||||
const externalFile = path.join(externalTarget, 'external.md');
|
||||
fs.writeFileSync(externalFile, 'external content\n', 'utf8');
|
||||
const symlinkPath = path.join(configDir, 'gsd-pristine', 'get-shit-done', 'workflows', 'symlinked.md'); // gsd-allow-legacy-name
|
||||
const symlinkPath = path.join(configDir, 'msd-pristine', 'get-shit-done', 'workflows', 'symlinked.md'); // msd-allow-legacy-name
|
||||
fs.symlinkSync(externalFile, symlinkPath);
|
||||
|
||||
writeManifest(configDir, {});
|
||||
@@ -253,14 +253,14 @@ describe('plan() — symlinked entry inside stale pristine dir is skipped', () =
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('plan() — integration: stale pristine files are removed', () => {
|
||||
test('stale gsd-pristine/get-shit-done/ file is removed after apply', () => { // gsd-allow-legacy-name
|
||||
test('stale msd-pristine/get-shit-done/ file is removed after apply', () => { // msd-allow-legacy-name
|
||||
const configDir = createTempDir();
|
||||
try {
|
||||
const fileContent = 'old pristine snapshot content written by gsd installer\n';
|
||||
writeFile(configDir, 'gsd-pristine/get-shit-done/workflows/plan.md', fileContent); // gsd-allow-legacy-name
|
||||
const fileContent = 'old pristine snapshot content written by msd installer\n';
|
||||
writeFile(configDir, 'msd-pristine/get-shit-done/workflows/plan.md', fileContent); // msd-allow-legacy-name
|
||||
writeManifest(configDir, {});
|
||||
|
||||
const { planInstallerMigrations, applyInstallerMigrationPlan } = require('../gsd-core/bin/lib/installer-migrations.cjs');
|
||||
const { planInstallerMigrations, applyInstallerMigrationPlan } = require('../msd-core/bin/lib/installer-migrations.cjs');
|
||||
const plan = planInstallerMigrations({
|
||||
configDir,
|
||||
migrations: [migration],
|
||||
@@ -271,7 +271,7 @@ describe('plan() — integration: stale pristine files are removed', () => {
|
||||
applyInstallerMigrationPlan({ configDir, plan });
|
||||
|
||||
// File must be gone after apply.
|
||||
const stillThere = fs.existsSync(path.join(configDir, 'gsd-pristine', 'get-shit-done', 'workflows', 'plan.md')); // gsd-allow-legacy-name
|
||||
const stillThere = fs.existsSync(path.join(configDir, 'msd-pristine', 'get-shit-done', 'workflows', 'plan.md')); // msd-allow-legacy-name
|
||||
assert.equal(stillThere, false, 'stale pristine file must be removed after apply');
|
||||
} finally {
|
||||
cleanup(configDir);
|
||||
|
||||
Reference in New Issue
Block a user