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:
@@ -6,7 +6,7 @@ const { describe, test, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { runGsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
|
||||
function writeSkill(rootDir, name, description, body = '') {
|
||||
const skillDir = path.join(rootDir, name);
|
||||
@@ -27,23 +27,23 @@ describe('skill-manifest', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = createTempProject();
|
||||
homeDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'gsd-skill-manifest-home-'));
|
||||
homeDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'msd-skill-manifest-home-'));
|
||||
|
||||
writeSkill(path.join(tmpDir, '.claude', 'skills'), 'project-claude', 'Project Claude skill');
|
||||
writeSkill(path.join(tmpDir, '.claude', 'skills'), 'gsd-help', 'Installed GSD skill');
|
||||
writeSkill(path.join(tmpDir, '.claude', 'skills'), 'msd-help', 'Installed MSD skill');
|
||||
writeSkill(path.join(tmpDir, '.agents', 'skills'), 'project-agents', 'Project agent skill');
|
||||
writeSkill(path.join(tmpDir, '.codex', 'skills'), 'project-codex', 'Project Codex skill');
|
||||
|
||||
writeSkill(path.join(homeDir, '.claude', 'skills'), 'global-claude', 'Global Claude skill');
|
||||
writeSkill(path.join(homeDir, '.codex', 'skills'), 'global-codex', 'Global Codex skill');
|
||||
writeSkill(
|
||||
path.join(homeDir, '.claude', 'gsd-core', 'skills'),
|
||||
path.join(homeDir, '.claude', 'msd-core', 'skills'),
|
||||
'legacy-import',
|
||||
'Deprecated import-only skill'
|
||||
);
|
||||
|
||||
fs.mkdirSync(path.join(homeDir, '.claude', 'commands', 'gsd'), { recursive: true });
|
||||
fs.writeFileSync(path.join(homeDir, '.claude', 'commands', 'gsd', 'help.md'), '# legacy');
|
||||
fs.mkdirSync(path.join(homeDir, '.claude', 'commands', 'msd'), { recursive: true });
|
||||
fs.writeFileSync(path.join(homeDir, '.claude', 'commands', 'msd', 'help.md'), '# legacy');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -55,7 +55,7 @@ describe('skill-manifest', () => {
|
||||
// On Windows, os.homedir() reads USERPROFILE (not HOME). The SUT scans
|
||||
// global skill roots via os.homedir(), so the test must also override
|
||||
// USERPROFILE to keep the fixture's homeDir visible.
|
||||
const result = runGsdTools(['skill-manifest'], tmpDir, { HOME: homeDir, USERPROFILE: homeDir });
|
||||
const result = runMsdTools(['skill-manifest'], tmpDir, { HOME: homeDir, USERPROFILE: homeDir });
|
||||
assert.ok(result.success, `Command should succeed: ${result.error || result.output}`);
|
||||
|
||||
const manifest = JSON.parse(result.output);
|
||||
@@ -68,8 +68,8 @@ describe('skill-manifest', () => {
|
||||
assert.deepStrictEqual(skillNames, [
|
||||
'global-claude',
|
||||
'global-codex',
|
||||
'gsd-help',
|
||||
'legacy-import',
|
||||
'msd-help',
|
||||
'project-agents',
|
||||
'project-claude',
|
||||
'project-codex',
|
||||
@@ -100,27 +100,27 @@ describe('skill-manifest', () => {
|
||||
deprecated: importedSkill.deprecated,
|
||||
},
|
||||
{
|
||||
root: '.claude/gsd-core/skills',
|
||||
root: '.claude/msd-core/skills',
|
||||
scope: 'import-only',
|
||||
installed: false,
|
||||
deprecated: true,
|
||||
}
|
||||
);
|
||||
|
||||
const gsdSkill = manifest.skills.find((skill) => skill.name === 'gsd-help');
|
||||
assert.strictEqual(gsdSkill.installed, true);
|
||||
const msdSkill = manifest.skills.find((skill) => skill.name === 'msd-help');
|
||||
assert.strictEqual(msdSkill.installed, true);
|
||||
|
||||
const legacyRoot = manifest.roots.find((root) => root.scope === 'legacy-commands');
|
||||
assert.ok(legacyRoot, 'legacy commands root should be reported');
|
||||
assert.strictEqual(legacyRoot.present, true);
|
||||
|
||||
assert.strictEqual(manifest.installation.gsd_skills_installed, true);
|
||||
assert.strictEqual(manifest.installation.msd_skills_installed, true);
|
||||
assert.strictEqual(manifest.installation.legacy_claude_commands_installed, true);
|
||||
assert.strictEqual(manifest.counts.skills, 7);
|
||||
});
|
||||
|
||||
test('writes manifest to .planning/skill-manifest.json when --write flag is used', () => {
|
||||
const result = runGsdTools(['skill-manifest', '--write'], tmpDir, { HOME: homeDir, USERPROFILE: homeDir });
|
||||
const result = runMsdTools(['skill-manifest', '--write'], tmpDir, { HOME: homeDir, USERPROFILE: homeDir });
|
||||
assert.ok(result.success, `Command should succeed: ${result.error || result.output}`);
|
||||
|
||||
const manifestPath = path.join(tmpDir, '.planning', 'skill-manifest.json');
|
||||
@@ -132,7 +132,7 @@ describe('skill-manifest', () => {
|
||||
});
|
||||
|
||||
test('global roots honor runtime-home env overrides instead of hardcoded home paths', () => {
|
||||
const result = runGsdTools(['skill-manifest'], tmpDir, {
|
||||
const result = runMsdTools(['skill-manifest'], tmpDir, {
|
||||
HOME: homeDir,
|
||||
USERPROFILE: homeDir,
|
||||
CLAUDE_CONFIG_DIR: path.join(homeDir, 'claude-custom'),
|
||||
@@ -150,18 +150,18 @@ describe('skill-manifest', () => {
|
||||
});
|
||||
|
||||
// bug-929: nested layout discovery
|
||||
test('bug-929: discovers concrete skills nested under gsd-ns-* routers', () => {
|
||||
test('bug-929: discovers concrete skills nested under msd-ns-* routers', () => {
|
||||
// Mirrors the on-disk shape that stageSkillsForRuntimeAsSkills emits for
|
||||
// cline/qwen/hermes/augment/trae/antigravity when nested=true:
|
||||
// <root>/gsd-ns-workflow/SKILL.md — router (top-level)
|
||||
// <root>/gsd-ns-workflow/skills/plan/SKILL.md — concrete
|
||||
// <root>/gsd-ns-workflow/skills/execute/SKILL.md — concrete
|
||||
// <root>/gsd-ns-workflow/skills/spec-phase/SKILL.md — dual-routed concrete
|
||||
// <root>/gsd-ns-manage/SKILL.md — router (top-level)
|
||||
// <root>/gsd-ns-manage/skills/progress/SKILL.md — concrete
|
||||
// <root>/gsd-ns-manage/skills/spec-phase/SKILL.md — same dual-routed concrete (dedupe by name)
|
||||
// <root>/gsd-standalone/SKILL.md — flat top-level skill (no skills/ subdir)
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'gsd-nested-skills-'));
|
||||
// <root>/msd-ns-workflow/SKILL.md — router (top-level)
|
||||
// <root>/msd-ns-workflow/skills/plan/SKILL.md — concrete
|
||||
// <root>/msd-ns-workflow/skills/execute/SKILL.md — concrete
|
||||
// <root>/msd-ns-workflow/skills/spec-phase/SKILL.md — dual-routed concrete
|
||||
// <root>/msd-ns-manage/SKILL.md — router (top-level)
|
||||
// <root>/msd-ns-manage/skills/progress/SKILL.md — concrete
|
||||
// <root>/msd-ns-manage/skills/spec-phase/SKILL.md — same dual-routed concrete (dedupe by name)
|
||||
// <root>/msd-standalone/SKILL.md — flat top-level skill (no skills/ subdir)
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'msd-nested-skills-'));
|
||||
|
||||
function writeNestedSkill(dir, name, description) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
@@ -175,50 +175,50 @@ describe('skill-manifest', () => {
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
// Router 1: gsd-ns-workflow
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-workflow'), 'gsd-ns-workflow', 'Workflow router');
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-workflow', 'skills', 'plan'), 'gsd-plan', 'Plan skill');
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-workflow', 'skills', 'execute'), 'gsd-execute', 'Execute skill');
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-workflow', 'skills', 'spec-phase'), 'gsd-spec-phase', 'Spec phase skill');
|
||||
// Router 1: msd-ns-workflow
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-workflow'), 'msd-ns-workflow', 'Workflow router');
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-workflow', 'skills', 'plan'), 'msd-plan', 'Plan skill');
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-workflow', 'skills', 'execute'), 'msd-execute', 'Execute skill');
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-workflow', 'skills', 'spec-phase'), 'msd-spec-phase', 'Spec phase skill');
|
||||
|
||||
// Router 2: gsd-ns-manage
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-manage'), 'gsd-ns-manage', 'Manage router');
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-manage', 'skills', 'progress'), 'gsd-progress', 'Progress skill');
|
||||
// Router 2: msd-ns-manage
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-manage'), 'msd-ns-manage', 'Manage router');
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-manage', 'skills', 'progress'), 'msd-progress', 'Progress skill');
|
||||
// Same spec-phase under a second router (dual-routed); must appear exactly once in manifest
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-ns-manage', 'skills', 'spec-phase'), 'gsd-spec-phase', 'Spec phase skill');
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-ns-manage', 'skills', 'spec-phase'), 'msd-spec-phase', 'Spec phase skill');
|
||||
|
||||
// Flat top-level skill (not a router, no skills/ subdir)
|
||||
writeNestedSkill(path.join(skillsDir, 'gsd-standalone'), 'gsd-standalone', 'Standalone flat skill');
|
||||
writeNestedSkill(path.join(skillsDir, 'msd-standalone'), 'msd-standalone', 'Standalone flat skill');
|
||||
|
||||
const result = runGsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
const result = runMsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
assert.ok(result.success, `Command should succeed: ${result.error || result.output}`);
|
||||
|
||||
const manifest = JSON.parse(result.output);
|
||||
const skillNames = manifest.skills.map((s) => s.name).sort();
|
||||
|
||||
// 2 routers + 4 unique concretes (gsd-spec-phase deduped) + 1 flat = 7 total
|
||||
// 2 routers + 4 unique concretes (msd-spec-phase deduped) + 1 flat = 7 total
|
||||
assert.deepStrictEqual(skillNames, [
|
||||
'gsd-execute',
|
||||
'gsd-ns-manage',
|
||||
'gsd-ns-workflow',
|
||||
'gsd-plan',
|
||||
'gsd-progress',
|
||||
'gsd-spec-phase',
|
||||
'gsd-standalone',
|
||||
'msd-execute',
|
||||
'msd-ns-manage',
|
||||
'msd-ns-workflow',
|
||||
'msd-plan',
|
||||
'msd-progress',
|
||||
'msd-spec-phase',
|
||||
'msd-standalone',
|
||||
]);
|
||||
assert.strictEqual(manifest.counts.skills, 7, 'dual-routed concrete must be deduped to one entry');
|
||||
|
||||
// Concrete skills should have a forward-slash nested file_path (posix-stable on all platforms)
|
||||
const planSkill = manifest.skills.find((s) => s.name === 'gsd-plan');
|
||||
assert.ok(planSkill, 'gsd-plan should be discovered');
|
||||
const planSkill = manifest.skills.find((s) => s.name === 'msd-plan');
|
||||
assert.ok(planSkill, 'msd-plan should be discovered');
|
||||
assert.ok(
|
||||
planSkill.file_path.includes('skills/plan'),
|
||||
`gsd-plan file_path should reflect nested location with forward slashes, got: ${planSkill.file_path}`
|
||||
`msd-plan file_path should reflect nested location with forward slashes, got: ${planSkill.file_path}`
|
||||
);
|
||||
|
||||
// Router should also appear as a skill entry
|
||||
const routerSkill = manifest.skills.find((s) => s.name === 'gsd-ns-workflow');
|
||||
assert.ok(routerSkill, 'gsd-ns-workflow router should be discovered as a top-level skill');
|
||||
const routerSkill = manifest.skills.find((s) => s.name === 'msd-ns-workflow');
|
||||
assert.ok(routerSkill, 'msd-ns-workflow router should be discovered as a top-level skill');
|
||||
|
||||
cleanup(skillsDir);
|
||||
});
|
||||
@@ -226,27 +226,27 @@ describe('skill-manifest', () => {
|
||||
test('bug-929: discovers nested concretes even when router has no top-level SKILL.md', () => {
|
||||
// Edge case: a router dir has a skills/ subdir with concretes but no top-level SKILL.md.
|
||||
// The concrete skills should still be discovered.
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'gsd-router-only-skills-'));
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'msd-router-only-skills-'));
|
||||
|
||||
// Router dir with skills/ but no SKILL.md of its own
|
||||
const concreteDir = path.join(skillsDir, 'gsd-ns-noroot', 'skills', 'orphan-skill');
|
||||
const concreteDir = path.join(skillsDir, 'msd-ns-noroot', 'skills', 'orphan-skill');
|
||||
fs.mkdirSync(concreteDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(concreteDir, 'SKILL.md'), [
|
||||
'---',
|
||||
'name: gsd-orphan',
|
||||
'name: msd-orphan',
|
||||
'description: Orphan skill under router without top-level SKILL.md',
|
||||
'---',
|
||||
'',
|
||||
'# gsd-orphan',
|
||||
'# msd-orphan',
|
||||
].join('\n'));
|
||||
|
||||
const result = runGsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
const result = runMsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
assert.ok(result.success, `Command should succeed: ${result.error || result.output}`);
|
||||
|
||||
const manifest = JSON.parse(result.output);
|
||||
assert.deepStrictEqual(
|
||||
manifest.skills.map((s) => s.name).sort(),
|
||||
['gsd-orphan'],
|
||||
['msd-orphan'],
|
||||
);
|
||||
assert.strictEqual(manifest.counts.skills, 1);
|
||||
|
||||
@@ -254,7 +254,7 @@ describe('skill-manifest', () => {
|
||||
});
|
||||
|
||||
test('bug-929: flat layout (no nested skills/ subdirs) still works correctly', () => {
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'gsd-flat-skills-'));
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'msd-flat-skills-'));
|
||||
|
||||
function writeFlat(name, description) {
|
||||
const dir = path.join(skillsDir, name);
|
||||
@@ -269,29 +269,29 @@ describe('skill-manifest', () => {
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
writeFlat('gsd-alpha', 'Alpha skill');
|
||||
writeFlat('gsd-beta', 'Beta skill');
|
||||
writeFlat('gsd-gamma', 'Gamma skill');
|
||||
writeFlat('msd-alpha', 'Alpha skill');
|
||||
writeFlat('msd-beta', 'Beta skill');
|
||||
writeFlat('msd-gamma', 'Gamma skill');
|
||||
|
||||
const result = runGsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
const result = runMsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
assert.ok(result.success, `Command should succeed: ${result.error || result.output}`);
|
||||
|
||||
const manifest = JSON.parse(result.output);
|
||||
assert.deepStrictEqual(
|
||||
manifest.skills.map((s) => s.name).sort(),
|
||||
['gsd-alpha', 'gsd-beta', 'gsd-gamma']
|
||||
['msd-alpha', 'msd-beta', 'msd-gamma']
|
||||
);
|
||||
assert.strictEqual(manifest.counts.skills, 3, 'flat layout count should be exact, no phantom nesting');
|
||||
|
||||
cleanup(skillsDir);
|
||||
});
|
||||
|
||||
test('bug-929: non-gsd-ns-* dirs with a skills/ subdir are NOT scanned (guard)', () => {
|
||||
// Regression guard for the `if (!entry.name.startsWith('gsd-ns-')) continue;` guard
|
||||
test('bug-929: non-msd-ns-* dirs with a skills/ subdir are NOT scanned (guard)', () => {
|
||||
// Regression guard for the `if (!entry.name.startsWith('msd-ns-')) continue;` guard
|
||||
// in buildSkillManifest. A user tool dir like `my-tool/` that happens to have its
|
||||
// own `skills/` subdirectory must NOT have those skills vacuumed up.
|
||||
// Only `gsd-ns-<router>/skills/<stem>/SKILL.md` paths are in scope.
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'gsd-guard-test-'));
|
||||
// Only `msd-ns-<router>/skills/<stem>/SKILL.md` paths are in scope.
|
||||
const skillsDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'msd-guard-test-'));
|
||||
|
||||
// Non-router dir with a flat SKILL.md at its own root — SHOULD be found (flat scan).
|
||||
const topLevelDir = path.join(skillsDir, 'my-tool');
|
||||
@@ -318,29 +318,29 @@ describe('skill-manifest', () => {
|
||||
].join('\n'));
|
||||
|
||||
// Another non-router dir (prefixed differently, could look router-like but isn't)
|
||||
const otherDir = path.join(skillsDir, 'gsd-settings');
|
||||
const otherDir = path.join(skillsDir, 'msd-settings');
|
||||
fs.mkdirSync(otherDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(otherDir, 'SKILL.md'), [
|
||||
'---',
|
||||
'name: gsd-settings',
|
||||
'description: A flat gsd-* skill that is not a router',
|
||||
'name: msd-settings',
|
||||
'description: A flat msd-* skill that is not a router',
|
||||
'---',
|
||||
'',
|
||||
'# gsd-settings',
|
||||
'# msd-settings',
|
||||
].join('\n'));
|
||||
// Give gsd-settings its own skills/ subdir — must not be traversed since it's not gsd-ns-*
|
||||
const otherNestedDir = path.join(skillsDir, 'gsd-settings', 'skills', 'subsetting');
|
||||
// Give msd-settings its own skills/ subdir — must not be traversed since it's not msd-ns-*
|
||||
const otherNestedDir = path.join(skillsDir, 'msd-settings', 'skills', 'subsetting');
|
||||
fs.mkdirSync(otherNestedDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(otherNestedDir, 'SKILL.md'), [
|
||||
'---',
|
||||
'name: gsd-subsetting',
|
||||
'name: msd-subsetting',
|
||||
'description: A nested skill that must not be vacuumed up',
|
||||
'---',
|
||||
'',
|
||||
'# gsd-subsetting',
|
||||
'# msd-subsetting',
|
||||
].join('\n'));
|
||||
|
||||
const result = runGsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
const result = runMsdTools(['skill-manifest', '--skills-dir', skillsDir], tmpDir);
|
||||
assert.ok(result.success, `Command should succeed: ${result.error || result.output}`);
|
||||
|
||||
const manifest = JSON.parse(result.output);
|
||||
@@ -349,8 +349,8 @@ describe('skill-manifest', () => {
|
||||
// Only the flat top-level SKILL.md entries should be found; nested non-router skills are ignored
|
||||
assert.deepStrictEqual(
|
||||
skillNames,
|
||||
['gsd-settings', 'my-tool'],
|
||||
'nested skills under non-gsd-ns-* dirs must not be discovered',
|
||||
['msd-settings', 'my-tool'],
|
||||
'nested skills under non-msd-ns-* dirs must not be discovered',
|
||||
);
|
||||
assert.strictEqual(
|
||||
manifest.counts.skills,
|
||||
@@ -361,11 +361,11 @@ describe('skill-manifest', () => {
|
||||
// Confirm the forbidden names are absent
|
||||
assert.ok(
|
||||
!skillNames.includes('my-tool-helper'),
|
||||
'my-tool/skills/helper/SKILL.md must not appear (guard: my-tool is not gsd-ns-*)',
|
||||
'my-tool/skills/helper/SKILL.md must not appear (guard: my-tool is not msd-ns-*)',
|
||||
);
|
||||
assert.ok(
|
||||
!skillNames.includes('gsd-subsetting'),
|
||||
'gsd-settings/skills/subsetting/SKILL.md must not appear (guard: gsd-settings is not gsd-ns-*)',
|
||||
!skillNames.includes('msd-subsetting'),
|
||||
'msd-settings/skills/subsetting/SKILL.md must not appear (guard: msd-settings is not msd-ns-*)',
|
||||
);
|
||||
|
||||
cleanup(skillsDir);
|
||||
@@ -382,7 +382,7 @@ describe('skill-manifest', () => {
|
||||
'use strict';
|
||||
|
||||
// allow-test-rule: source-text-is-the-product (see #2792)
|
||||
// commands/gsd/*.md files ARE what the runtime loads — testing their
|
||||
// commands/msd/*.md files ARE what the runtime loads — testing their
|
||||
// frontmatter content tests the deployed system-prompt contract.
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
@@ -392,24 +392,24 @@ const path = require('node:path');
|
||||
|
||||
const { parseRequires } = require('./helpers/nested-layout.cjs');
|
||||
|
||||
const COMMANDS_DIR = path.join(__dirname, '..', 'commands', 'gsd');
|
||||
const COMMANDS_DIR = path.join(__dirname, '..', 'commands', 'msd');
|
||||
|
||||
const NAMESPACE_SKILLS = [
|
||||
{ file: 'ns-workflow.md', name: 'gsd-workflow' },
|
||||
{ file: 'ns-project.md', name: 'gsd-project' },
|
||||
{ file: 'ns-review.md', name: 'gsd-quality' },
|
||||
{ file: 'ns-context.md', name: 'gsd-context' },
|
||||
{ file: 'ns-manage.md', name: 'gsd-manage' },
|
||||
{ file: 'ns-ideate.md', name: 'gsd-ideate' },
|
||||
{ file: 'ns-workflow.md', name: 'msd-workflow' },
|
||||
{ file: 'ns-project.md', name: 'msd-project' },
|
||||
{ file: 'ns-review.md', name: 'msd-quality' },
|
||||
{ file: 'ns-context.md', name: 'msd-context' },
|
||||
{ file: 'ns-manage.md', name: 'msd-manage' },
|
||||
{ file: 'ns-ideate.md', name: 'msd-ideate' },
|
||||
];
|
||||
|
||||
// Route targets named in any namespace body. The cross-reference test below
|
||||
// asserts that every one of these resolves to a surviving command file or to
|
||||
// a known consolidated parent (which absorbs flag-form invocations of folded
|
||||
// skills, e.g. `gsd-map-codebase --fast` for the former `gsd-scan`).
|
||||
// skills, e.g. `msd-map-codebase --fast` for the former `msd-scan`).
|
||||
const FLAG_FORM_PARENTS = new Set([
|
||||
'gsd-code-review', // --fix absorbs former gsd-code-review-fix
|
||||
'gsd-map-codebase', // --fast absorbs scan, --query absorbs intel
|
||||
'msd-code-review', // --fix absorbs former msd-code-review-fix
|
||||
'msd-map-codebase', // --fast absorbs scan, --query absorbs intel
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -527,23 +527,23 @@ describe('Namespace skill bodies carry a routing table', () => {
|
||||
|
||||
test(`${file} — body has at least one Invoke target`, () => {
|
||||
const fm = readNamespaceFile(file);
|
||||
const hasInvoke = /\bgsd-[a-z-]+/i.test(fm._body);
|
||||
assert.ok(hasInvoke, `${file} body must reference at least one gsd-* sub-skill`);
|
||||
const hasInvoke = /\bmsd-[a-z-]+/i.test(fm._body);
|
||||
assert.ok(hasInvoke, `${file} body must reference at least one msd-* sub-skill`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// ── Context guard contract on gsd-health ──────────────────────────────
|
||||
// ── Context guard contract on msd-health ──────────────────────────────
|
||||
// Asserts the `--context` surface promised by #2792 is wired through to
|
||||
// both the command frontmatter and the workflow body. The classifier
|
||||
// itself is covered by tests/context-utilization.test.cjs and the SDK
|
||||
// CLI by tests/validate-context.test.cjs.
|
||||
|
||||
describe('gsd-health --context flag is wired into command + workflow', () => {
|
||||
describe('msd-health --context flag is wired into command + workflow', () => {
|
||||
const HEALTH_CMD = path.join(COMMANDS_DIR, 'health.md');
|
||||
const HEALTH_WORKFLOW = path.join(__dirname, '..', 'gsd-core', 'workflows', 'health.md');
|
||||
const HEALTH_WORKFLOW = path.join(__dirname, '..', 'msd-core', 'workflows', 'health.md');
|
||||
|
||||
test('commands/gsd/health.md argument-hint advertises --context', () => {
|
||||
test('commands/msd/health.md argument-hint advertises --context', () => {
|
||||
const raw = fs.readFileSync(HEALTH_CMD, 'utf-8');
|
||||
const fm = parseFrontmatter(raw);
|
||||
assert.ok(
|
||||
@@ -552,7 +552,7 @@ describe('gsd-health --context flag is wired into command + workflow', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('commands/gsd/health.md body documents the three-state utilization table', () => {
|
||||
test('commands/msd/health.md body documents the three-state utilization table', () => {
|
||||
const raw = fs.readFileSync(HEALTH_CMD, 'utf-8');
|
||||
const body = parseFrontmatter(raw)._body.toLowerCase();
|
||||
assert.ok(body.includes('healthy'), 'body must name the healthy state');
|
||||
@@ -564,7 +564,7 @@ describe('gsd-health --context flag is wired into command + workflow', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('gsd-core/workflows/health.md has a context_check step', () => {
|
||||
test('msd-core/workflows/health.md has a context_check step', () => {
|
||||
const raw = fs.readFileSync(HEALTH_WORKFLOW, 'utf-8');
|
||||
assert.match(
|
||||
raw,
|
||||
@@ -573,7 +573,7 @@ describe('gsd-health --context flag is wired into command + workflow', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('workflow context_check invokes gsd-sdk query validate.context', () => {
|
||||
test('workflow context_check invokes msd-sdk query validate.context', () => {
|
||||
const raw = fs.readFileSync(HEALTH_WORKFLOW, 'utf-8');
|
||||
// Extract just the context_check step's body so a stray reference
|
||||
// elsewhere in the file can't satisfy this assertion.
|
||||
@@ -581,11 +581,11 @@ describe('gsd-health --context flag is wired into command + workflow', () => {
|
||||
const stepMatch = raw.match(/<step name="context_check">([\s\S]*?)<\/step>/);
|
||||
assert.ok(stepMatch, 'context_check step must be a closed <step>...</step> block');
|
||||
const stepBody = stepMatch[1];
|
||||
// After #3797 architectural fix, callsites use gsd_run
|
||||
// After #3797 architectural fix, callsites use msd_run
|
||||
assert.match(
|
||||
stepBody,
|
||||
/gsd_run\s+query\s+validate\.context/,
|
||||
'context_check must call `gsd_run query validate.context`',
|
||||
/msd_run\s+query\s+validate\.context/,
|
||||
'context_check must call `msd_run query validate.context`',
|
||||
);
|
||||
assert.match(stepBody, /--tokens-used/, 'context_check must pass --tokens-used');
|
||||
assert.match(stepBody, /--context-window/, 'context_check must pass --context-window');
|
||||
@@ -630,7 +630,7 @@ describe('namespace nesting completeness (#69)', () => {
|
||||
assert.deepStrictEqual(
|
||||
bad,
|
||||
[],
|
||||
`Router requires entries with no matching commands/gsd/<stem>.md: ${bad.join(', ')}`,
|
||||
`Router requires entries with no matching commands/msd/<stem>.md: ${bad.join(', ')}`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -649,16 +649,16 @@ describe('namespace nesting completeness (#69)', () => {
|
||||
const childSet = new Set(children);
|
||||
const content = fs.readFileSync(path.join(COMMANDS_DIR, `${routerStem}.md`), 'utf-8');
|
||||
const fm = parseFrontmatter(content);
|
||||
// Extract gsd-<stem> tokens from table data rows (last cell), strip flags
|
||||
// Extract msd-<stem> tokens from table data rows (last cell), strip flags
|
||||
for (const line of fm._body.split('\n')) {
|
||||
if (!line.startsWith('|') || /^\|[\s\-:|]+\|?\s*$/.test(line)) continue;
|
||||
const cells = line.split('|').map((c) => c.trim()).filter(Boolean);
|
||||
if (cells.length < 2) continue;
|
||||
const lastCell = cells[cells.length - 1];
|
||||
for (const match of lastCell.matchAll(/\bgsd-([a-z][a-z0-9-]*)/g)) {
|
||||
for (const match of lastCell.matchAll(/\bmsd-([a-z][a-z0-9-]*)/g)) {
|
||||
const stem = match[1];
|
||||
if (!childSet.has(stem)) {
|
||||
bad.push(`${routerStem}: body table references gsd-${stem} but it's not in requires`);
|
||||
bad.push(`${routerStem}: body table references msd-${stem} but it's not in requires`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -682,18 +682,18 @@ describe('Namespace router targets resolve to surviving skills', () => {
|
||||
if (!f.endsWith('.md')) continue;
|
||||
const base = f.replace(/\.md$/, '');
|
||||
if (base.startsWith('ns-')) continue; // namespace routers themselves
|
||||
surviving.add(`gsd-${base}`);
|
||||
surviving.add(`msd-${base}`);
|
||||
// The PR #2858 rename canonicalized extract_learnings → extract-learnings.
|
||||
// Until #2790 rebases onto current main, accept either source filename
|
||||
// as resolving to the canonical hyphenated identifier.
|
||||
if (base === 'extract_learnings') surviving.add('gsd-extract-learnings');
|
||||
if (base === 'extract_learnings') surviving.add('msd-extract-learnings');
|
||||
}
|
||||
|
||||
for (const { file } of NAMESPACE_SKILLS) {
|
||||
test(`${file} — every routing target resolves`, () => {
|
||||
const fm = readNamespaceFile(file);
|
||||
// Extract every gsd-<name> token that appears in a table-row right column.
|
||||
// Strip flag suffixes (`gsd-foo --bar` → `gsd-foo`) before resolving.
|
||||
// Extract every msd-<name> token that appears in a table-row right column.
|
||||
// Strip flag suffixes (`msd-foo --bar` → `msd-foo`) before resolving.
|
||||
const targets = new Set();
|
||||
for (const line of fm._body.split('\n')) {
|
||||
// Only consider markdown table data rows: lines that start with `|`
|
||||
@@ -701,18 +701,18 @@ describe('Namespace router targets resolve to surviving skills', () => {
|
||||
if (!line.startsWith('|') || /^\|[\s\-:|]+\|?\s*$/.test(line)) continue;
|
||||
const cells = line.split('|').map((c) => c.trim()).filter(Boolean);
|
||||
if (cells.length < 2) continue;
|
||||
for (const m of cells[cells.length - 1].matchAll(/\bgsd-[a-z][a-z0-9-]*/g)) {
|
||||
for (const m of cells[cells.length - 1].matchAll(/\bmsd-[a-z][a-z0-9-]*/g)) {
|
||||
targets.add(m[0]);
|
||||
}
|
||||
}
|
||||
assert.ok(targets.size > 0, `${file} routing table must reference at least one gsd-* target`);
|
||||
assert.ok(targets.size > 0, `${file} routing table must reference at least one msd-* target`);
|
||||
const unresolved = [...targets].filter(
|
||||
(t) => !surviving.has(t) && !FLAG_FORM_PARENTS.has(t),
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
unresolved,
|
||||
[],
|
||||
`${file} routes to skills that don't exist in commands/gsd/: ${unresolved.join(', ')}`,
|
||||
`${file} routes to skills that don't exist in commands/msd/: ${unresolved.join(', ')}`,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user