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 @@
|
||||
/**
|
||||
* runtime-slash.cts — single source of truth for emitting GSD slash-command
|
||||
* runtime-slash.cts — single source of truth for emitting MSD slash-command
|
||||
* references in user-facing runtime output (recommended-actions JSON, persisted
|
||||
* ROADMAP.md entries, verify/validate fix hints, error messages, etc.).
|
||||
*
|
||||
@@ -7,15 +7,15 @@
|
||||
* to a TypeScript source of truth. Behaviour is preserved byte-for-behaviour from
|
||||
* the prior hand-written .cjs; only types are added.
|
||||
*
|
||||
* Background: #2808 unified all GSD skill installs to register under the hyphen
|
||||
* form (`name: gsd-<cmd>`). The legacy colon form `/gsd:<cmd>` is no longer
|
||||
* Background: #2808 unified all MSD skill installs to register under the hyphen
|
||||
* form (`name: msd-<cmd>`). The legacy colon form `/msd:<cmd>` is no longer
|
||||
* routable by Claude Code skill installs, but ~50 runtime emissions in
|
||||
* bin/lib/*.cjs still hardcoded it (#3584). Codex installs need the shell-var
|
||||
* `$gsd-<cmd>` form. This module is the only place the runtime should decide
|
||||
* `$msd-<cmd>` form. This module is the only place the runtime should decide
|
||||
* which shape to emit.
|
||||
*
|
||||
* - codex: $gsd-<cmd> (shell-var syntax)
|
||||
* - claude, cursor, opencode, kilo, etc.: /gsd-<cmd>
|
||||
* - codex: $msd-<cmd> (shell-var syntax)
|
||||
* - claude, cursor, opencode, kilo, etc.: /msd-<cmd>
|
||||
*
|
||||
* The colon form is never emitted.
|
||||
*
|
||||
@@ -28,17 +28,17 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { canonicalizeRuntimeName, resolveRuntimeNameFromCandidates } from './runtime-name-policy.cjs';
|
||||
|
||||
export function formatGsdSlash(commandName: unknown, runtime: unknown): unknown {
|
||||
export function formatMsdSlash(commandName: unknown, runtime: unknown): unknown {
|
||||
if (typeof commandName !== 'string') return commandName;
|
||||
if (commandName === '') return commandName;
|
||||
|
||||
// Strip any existing leading prefix so the helper is idempotent and accepts
|
||||
// both legacy `/gsd:<name>` and canonical hyphen-form input (plus the bare
|
||||
// `gsd:<name>` shorthand and codex `$gsd-<name>` shell-var input).
|
||||
const stripped = commandName.replace(/^[/$]?gsd[-:]/i, '');
|
||||
// both legacy `/msd:<name>` and canonical hyphen-form input (plus the bare
|
||||
// `msd:<name>` shorthand and codex `$msd-<name>` shell-var input).
|
||||
const stripped = commandName.replace(/^[/$]?msd[-:]/i, '');
|
||||
// If the regex matched nothing (no prefix), the input is already a bare name.
|
||||
const bare = stripped === commandName ? commandName : stripped;
|
||||
// Defensive: a degenerate input like `/gsd:`, `gsd-`, or whitespace-only
|
||||
// Defensive: a degenerate input like `/msd:`, `msd-`, or whitespace-only
|
||||
// normalizes to empty. Returning the original colon-form would re-emit the
|
||||
// deprecated shape that this module exists to suppress (#3584). Return an
|
||||
// empty string so callers see "no command" rather than the broken input.
|
||||
@@ -65,19 +65,19 @@ export function formatGsdSlash(commandName: unknown, runtime: unknown): unknown
|
||||
const style = runtimes[rt]?.runtime?.commandStyle;
|
||||
|
||||
if (style === 'shell-var') {
|
||||
// shell-var runtimes (currently: codex) use $gsd-<cmd> syntax. The command
|
||||
// shell-var runtimes (currently: codex) use $msd-<cmd> syntax. The command
|
||||
// token is lowercased because shell-var identifiers are conventionally
|
||||
// lowercase; matches the convertCodexSlash() projection in bin/install.js.
|
||||
return `$gsd-${token.toLowerCase()}${tail}`;
|
||||
return `$msd-${token.toLowerCase()}${tail}`;
|
||||
}
|
||||
return `/gsd-${token}${tail}`;
|
||||
return `/msd-${token}${tail}`;
|
||||
}
|
||||
|
||||
// ─── #3897 rung 2: the per-install `.gsd-runtime` marker, promoted from ──────
|
||||
// ─── #3897 rung 2: the per-install `.msd-runtime` marker, promoted from ──────
|
||||
// model-resolver.cts (#2297) to this module — the canonical owner of runtime
|
||||
// identity (resolveRuntime, formatGsdSlash). `bin/install.js` writes
|
||||
// `<install>/gsd-core/.gsd-runtime` beside VERSION for every runtime install
|
||||
// (#2297). This module compiles to `gsd-core/bin/lib/runtime-slash.cjs`
|
||||
// identity (resolveRuntime, formatMsdSlash). `bin/install.js` writes
|
||||
// `<install>/msd-core/.msd-runtime` beside VERSION for every runtime install
|
||||
// (#2297). This module compiles to `msd-core/bin/lib/runtime-slash.cjs`
|
||||
// (ADR-457) — the SAME directory `model-resolver.cjs` compiles to — so the
|
||||
// `__dirname`-relative path below is unchanged from the promoted original.
|
||||
//
|
||||
@@ -94,7 +94,7 @@ let _installMarkerCache: string | null | undefined;
|
||||
* Never throws (N4) — an absent/unreadable marker (dev/source tree, an
|
||||
* install predating #2297, EACCES, hostile content, ...) is "no signal",
|
||||
* never a resolution failure; a throw here would break a session in
|
||||
* `gsd-agent-isolation-guard.js`, which is worse than resolving the wrong
|
||||
* `msd-agent-isolation-guard.js`, which is worse than resolving the wrong
|
||||
* runtime.
|
||||
*
|
||||
* The raw marker string is returned as-is (trimmed) — callers MUST route it
|
||||
@@ -105,7 +105,7 @@ let _installMarkerCache: string | null | undefined;
|
||||
export function readInstallRuntimeMarker(): string | null {
|
||||
if (_installMarkerCache !== undefined) return _installMarkerCache;
|
||||
try {
|
||||
const markerPath = path.join(__dirname, '..', '..', '.gsd-runtime');
|
||||
const markerPath = path.join(__dirname, '..', '..', '.msd-runtime');
|
||||
const raw = fs.readFileSync(markerPath, 'utf8').trim();
|
||||
_installMarkerCache = raw || null;
|
||||
} catch {
|
||||
@@ -130,21 +130,21 @@ export function _resetInstallRuntimeMarkerCacheForTests(): void {
|
||||
* Resolve the explicit runtime for a project directory, from the two
|
||||
* explicit sources only — no default is applied.
|
||||
*
|
||||
* env.GSD_RUNTIME > config.runtime > null
|
||||
* env.MSD_RUNTIME > config.runtime > null
|
||||
*
|
||||
* Returns null when neither explicit source is set, so a caller can
|
||||
* distinguish "config said claude" from "nothing was set" (needed by
|
||||
* #3245's host-detection rung, which must only run when this returns null).
|
||||
*
|
||||
* @param projectDir - path to the project directory, or null/undefined
|
||||
* @param env - environment variables to read GSD_RUNTIME from; defaults to process.env
|
||||
* @param env - environment variables to read MSD_RUNTIME from; defaults to process.env
|
||||
* @returns the resolved runtime name, or null if neither source is set
|
||||
*/
|
||||
export function resolveExplicitRuntime(
|
||||
projectDir: string | null | undefined,
|
||||
env: Record<string, string | undefined> = process.env,
|
||||
): string | null {
|
||||
const envRuntime = resolveRuntimeNameFromCandidates(env['GSD_RUNTIME']);
|
||||
const envRuntime = resolveRuntimeNameFromCandidates(env['MSD_RUNTIME']);
|
||||
if (envRuntime) return envRuntime;
|
||||
if (projectDir) {
|
||||
try {
|
||||
@@ -173,20 +173,20 @@ export function resolveExplicitRuntime(
|
||||
/**
|
||||
* Resolve the effective runtime for a project directory.
|
||||
*
|
||||
* process.env.GSD_RUNTIME > config.runtime > install marker > 'claude'
|
||||
* process.env.MSD_RUNTIME > config.runtime > install marker > 'claude'
|
||||
*
|
||||
* Mirrors the precedence already used by profile-output.cjs and the rest of
|
||||
* the runtime resolution chain. Returns a lowercased string so downstream
|
||||
* comparisons can be case-blind.
|
||||
*
|
||||
* #3897 rung 2: the per-install `.gsd-runtime` marker is the THIRD rung,
|
||||
* #3897 rung 2: the per-install `.msd-runtime` marker is the THIRD rung,
|
||||
* between the two explicit sources and the 'claude' default — matching
|
||||
* model-resolver.cts's own description of it as "the third precedence rung"
|
||||
* before this reader was promoted here. The marker's raw contents are never
|
||||
* trusted verbatim (N1): they are routed through the SAME
|
||||
* `resolveRuntimeNameFromCandidates` normalization the env rung uses, so an
|
||||
* unknown or hostile marker value degrades exactly like an unknown
|
||||
* GSD_RUNTIME value would.
|
||||
* MSD_RUNTIME value would.
|
||||
*
|
||||
* @param projectDir - path to the project directory, or null/undefined
|
||||
* @returns the resolved runtime name
|
||||
@@ -201,8 +201,8 @@ export function resolveRuntime(projectDir: string | null | undefined): string {
|
||||
|
||||
/**
|
||||
* Convenience: format using the runtime resolved from a project directory.
|
||||
* Equivalent to `formatGsdSlash(name, resolveRuntime(projectDir))`.
|
||||
* Equivalent to `formatMsdSlash(name, resolveRuntime(projectDir))`.
|
||||
*/
|
||||
export function formatGsdSlashFor(projectDir: string | null | undefined, commandName: unknown): unknown {
|
||||
return formatGsdSlash(commandName, resolveRuntime(projectDir));
|
||||
export function formatMsdSlashFor(projectDir: string | null | undefined, commandName: unknown): unknown {
|
||||
return formatMsdSlash(commandName, resolveRuntime(projectDir));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user