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,21 +1,21 @@
|
||||
// allow-test-rule: source-text-is-the-product
|
||||
// commands/gsd/*.md files ARE the deployed registry — reading their frontmatter
|
||||
// commands/msd/*.md files ARE the deployed registry — reading their frontmatter
|
||||
// validates the structural contract of the command surface, not application source.
|
||||
'use strict';
|
||||
/**
|
||||
* live-command-registry.cjs
|
||||
*
|
||||
* Derives the canonical set of live slash-command tokens from the source-of-truth
|
||||
* registry: commands/gsd/*.md (one file per registered command).
|
||||
* registry: commands/msd/*.md (one file per registered command).
|
||||
*
|
||||
* Each command file has YAML frontmatter with a `name:` field:
|
||||
* name: gsd:slug (colon-style — most commands)
|
||||
* name: gsd-slug (dash-style — ns-* namespace commands)
|
||||
* name: msd:slug (colon-style — most commands)
|
||||
* name: msd-slug (dash-style — ns-* namespace commands)
|
||||
*
|
||||
* For each slug, three canonical token forms are emitted:
|
||||
* /gsd-slug — Claude / non-Gemini runtimes
|
||||
* /gsd:slug — Gemini runtime
|
||||
* $gsd-slug — Codex runtime
|
||||
* /msd-slug — Claude / non-Gemini runtimes
|
||||
* /msd:slug — Gemini runtime
|
||||
* $msd-slug — Codex runtime
|
||||
*
|
||||
* The result is memoized per process — a single fs walk is amortized across
|
||||
* all test files that import this helper. The cache is intentionally not
|
||||
@@ -31,7 +31,7 @@
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const COMMANDS_DIR = path.join(__dirname, '..', '..', 'commands', 'gsd');
|
||||
const COMMANDS_DIR = path.join(__dirname, '..', '..', 'commands', 'msd');
|
||||
|
||||
// Module-level memoization — set on first call, reused thereafter.
|
||||
let _cache = null;
|
||||
@@ -45,13 +45,13 @@ let _cache = null;
|
||||
* `${prefix}${slug}` for one of these three prefixes — see the `tokens.add`
|
||||
* calls in `getLiveCommandTokens()` below, which is the sole producer.
|
||||
*/
|
||||
const LIVE_COMMAND_TOKEN_PREFIXES = Object.freeze(['/gsd-', '/gsd:', '$gsd-']);
|
||||
const LIVE_COMMAND_TOKEN_PREFIXES = Object.freeze(['/msd-', '/msd:', '$msd-']);
|
||||
|
||||
/**
|
||||
* Extract the first whitespace-delimited "word" of a string, e.g.
|
||||
* `"/gsd-plan-phase 2"` -> `"/gsd-plan-phase"`. Real command-token payloads
|
||||
* `"/msd-plan-phase 2"` -> `"/msd-plan-phase"`. Real command-token payloads
|
||||
* carry trailing arguments (`init`'s `recommended_actions[].command` is
|
||||
* literally `/gsd-plan-phase 2`), so an exact-match test against the WHOLE
|
||||
* literally `/msd-plan-phase 2`), so an exact-match test against the WHOLE
|
||||
* string would reject every argument-carrying token — the token itself is
|
||||
* always the first word.
|
||||
*
|
||||
@@ -75,8 +75,8 @@ function firstToken(value) {
|
||||
* exemption. First it was keyed on the leaf name `command`; then on a bare
|
||||
* `String.startsWith` prefix test with an unconstrained remainder, which
|
||||
* exempted any string merely SHARING A PREFIX with a real token — e.g.
|
||||
* `/gsd-x/../../../Users/someone/.ssh/id_rsa` or `/gsd:/etc/passwd` both
|
||||
* satisfied `startsWith('/gsd-')`/`startsWith('/gsd:')`).
|
||||
* `/msd-x/../../../Users/someone/.ssh/id_rsa` or `/msd:/etc/passwd` both
|
||||
* satisfied `startsWith('/msd-')`/`startsWith('/msd:')`).
|
||||
*
|
||||
* Deliberately NOT a `startsWith` fast path over `LIVE_COMMAND_TOKEN_PREFIXES`
|
||||
* short-circuiting this check: exact membership of the first word is the
|
||||
@@ -102,10 +102,10 @@ function isLiveCommandToken(value, liveTokens) {
|
||||
* introducing a YAML parser dependency would be disproportionate.
|
||||
*
|
||||
* Supported name forms:
|
||||
* name: gsd:slug → slug = "slug"
|
||||
* name: gsd-slug → slug = "slug"
|
||||
* name: "gsd:slug" → slug = "slug" (quoted)
|
||||
* name: "gsd-slug" → slug = "slug" (quoted)
|
||||
* name: msd:slug → slug = "slug"
|
||||
* name: msd-slug → slug = "slug"
|
||||
* name: "msd:slug" → slug = "slug" (quoted)
|
||||
* name: "msd-slug" → slug = "slug" (quoted)
|
||||
*/
|
||||
function parseSlug(content, filePath) {
|
||||
// Frontmatter must start with '---' on the very first line.
|
||||
@@ -126,22 +126,22 @@ function parseSlug(content, filePath) {
|
||||
const frontmatter = content.slice(0, closingIdx);
|
||||
|
||||
// Match `name:` line, allowing optional quotes around the value.
|
||||
// The value must be one of: gsd:<slug> or gsd-<slug>
|
||||
// The value must be one of: msd:<slug> or msd-<slug>
|
||||
// where slug = [a-z0-9][a-z0-9-]*
|
||||
const nameMatch = frontmatter.match(/^name:\s*"?(gsd[:‑-])([a-z0-9][a-z0-9-]*)"?\s*$/m);
|
||||
const nameMatch = frontmatter.match(/^name:\s*"?(msd[:‑-])([a-z0-9][a-z0-9-]*)"?\s*$/m);
|
||||
if (!nameMatch) {
|
||||
throw new Error(
|
||||
`[live-command-registry] ${filePath}: could not extract slug from frontmatter ` +
|
||||
`(expected "name: gsd:<slug>" or "name: gsd-<slug>")`
|
||||
`(expected "name: msd:<slug>" or "name: msd-<slug>")`
|
||||
);
|
||||
}
|
||||
|
||||
return nameMatch[2]; // the slug after "gsd:" or "gsd-"
|
||||
return nameMatch[2]; // the slug after "msd:" or "msd-"
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Set<string> of all canonical slash-command tokens derived from
|
||||
* commands/gsd/*.md. Memoized — safe to call repeatedly without extra fs I/O.
|
||||
* commands/msd/*.md. Memoized — safe to call repeatedly without extra fs I/O.
|
||||
*
|
||||
* Throws on the first malformed file (fail-loud per CONTEXT.md k302) so
|
||||
* registry drift is caught immediately rather than silently producing an
|
||||
@@ -176,9 +176,9 @@ function getLiveCommandTokens() {
|
||||
const slug = parseSlug(content, filePath);
|
||||
|
||||
// Emit all three canonical token forms per slug.
|
||||
tokens.add(`/gsd-${slug}`); // Claude / non-Gemini
|
||||
tokens.add(`/gsd:${slug}`); // Gemini
|
||||
tokens.add(`$gsd-${slug}`); // Codex
|
||||
tokens.add(`/msd-${slug}`); // Claude / non-Gemini
|
||||
tokens.add(`/msd:${slug}`); // Gemini
|
||||
tokens.add(`$msd-${slug}`); // Codex
|
||||
}
|
||||
|
||||
_cache = tokens;
|
||||
|
||||
Reference in New Issue
Block a user