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

@@ -119,13 +119,13 @@ function truncatePostureValue(value: string): string {
* Resolve the agents directory for the given runtime.
*
* Priority:
* 1. GSD_AGENTS_DIR env var (explicit override, any runtime)
* 1. MSD_AGENTS_DIR env var (explicit override, any runtime)
* 2. For claude runtime: __dirname-relative path (agents/ sibling of
* gsd-core/) — correct for repo runs and runtime-config-dir installs,
* msd-core/) — correct for repo runs and runtime-config-dir installs,
* where the sibling agents/ IS the user's agents dir — UNLESS that path
* carries an exact node_modules segment. gsd-tools.cjs lives inside
* gsd-core/bin/ in every install shape, but on an npm-global install
* gsd-core/ sits inside the package (not the runtime config dir) and the
* carries an exact node_modules segment. msd-tools.cjs lives inside
* msd-core/bin/ in every install shape, but on an npm-global install
* msd-core/ sits inside the package (not the runtime config dir) and the
* package ships its own agents/, so the install-relative path resolves
* to the bundled copy and the check validates the package against
* itself — agents_installed can never be false. In that case resolve
@@ -134,25 +134,25 @@ function truncatePostureValue(value: string): string {
* 3. For non-claude runtimes with a manifest-backed project-local install:
* <projectRoot>/<localConfigDir>/agents (or <projectRoot>/agents when
* the runtime's local install targets the project root). Requiring the
* GSD manifest prevents runtime-native project agents from shadowing a
* working global GSD install. Symlinked local agent directories are ignored.
* MSD manifest prevents runtime-native project agents from shadowing a
* working global MSD install. Symlinked local agent directories are ignored.
* 4. For non-claude runtimes: getGlobalConfigDir(runtime)/agents
*
* @param runtime - the active runtime name; defaults to GSD_RUNTIME env, then 'claude'
* @param runtime - the active runtime name; defaults to MSD_RUNTIME env, then 'claude'
* @param projectRoot - canonical project root for local-install discovery
*/
function getAgentsDir(runtime?: string, projectRoot?: string): string {
if (process.env['GSD_AGENTS_DIR']) {
return process.env['GSD_AGENTS_DIR'];
if (process.env['MSD_AGENTS_DIR']) {
return process.env['MSD_AGENTS_DIR'];
}
const resolved = runtime ?? (process.env['GSD_RUNTIME'] || 'claude');
const resolved = runtime ?? (process.env['MSD_RUNTIME'] || 'claude');
if (resolved === 'claude') {
const installRelative = path.join(__dirname, '..', '..', '..', 'agents');
// #3203: a lexical guard, not an install-shape test. It targets the
// layouts where the sibling agents/ is the package's own bundled copy and
// the check would otherwise validate the package against itself; a path
// merely carrying a directory of that name resolves the same way, and a
// non-empty GSD_AGENTS_DIR overrides both.
// non-empty MSD_AGENTS_DIR overrides both.
if (installRelative.split(path.sep).includes('node_modules')) {
return path.join(getGlobalConfigDir('claude'), 'agents');
}
@@ -174,7 +174,7 @@ function getAgentsDir(runtime?: string, projectRoot?: string): string {
return path.join(getGlobalConfigDir(resolved), 'agents');
}
const localAgentsDir = path.join(localConfigDir, 'agents');
const manifestPath = path.join(localConfigDir, 'gsd-file-manifest.json');
const manifestPath = path.join(localConfigDir, 'msd-file-manifest.json');
try {
if (fs.lstatSync(localAgentsDir).isDirectory() && fs.lstatSync(manifestPath).isFile()) {
return localAgentsDir;
@@ -187,13 +187,13 @@ function getAgentsDir(runtime?: string, projectRoot?: string): string {
}
/**
* Check which GSD agents are installed on disk.
* Check which MSD agents are installed on disk.
*
* @param runtime - the active runtime name; defaults to GSD_RUNTIME env, then 'claude'
* @param runtime - the active runtime name; defaults to MSD_RUNTIME env, then 'claude'
* @param projectRoot - canonical project root for local-install discovery
*/
function checkAgentsInstalled(runtime?: string, projectRoot?: string): AgentsInstalledResult {
const resolvedRuntime = runtime ?? (process.env['GSD_RUNTIME'] || 'claude');
const resolvedRuntime = runtime ?? (process.env['MSD_RUNTIME'] || 'claude');
const agentsDir = getAgentsDir(resolvedRuntime, projectRoot);
const expectedAgents = Object.keys(MODEL_PROFILES);
const installed: string[] = [];
@@ -219,7 +219,7 @@ function checkAgentsInstalled(runtime?: string, projectRoot?: string): AgentsIns
}
// ── Manifest-backed completeness check ──────────────────────────────────────
// If a gsd-file-manifest.json exists alongside the agents dir (parent dir),
// If a msd-file-manifest.json exists alongside the agents dir (parent dir),
// verify that every manifest-tracked file for each expected agent is present
// on disk. Missing manifest-tracked files indicate an incomplete install even
// when the plain presence check above passed (e.g. .md present, .toml absent).
@@ -282,14 +282,14 @@ function checkAgentsInstalled(runtime?: string, projectRoot?: string): AgentsIns
*
* Read-only: detects, never repairs (repair is Phase 3, #3243).
*
* @param runtime - the active runtime name; defaults to GSD_RUNTIME env, then 'claude'
* @param runtime - the active runtime name; defaults to MSD_RUNTIME env, then 'claude'
* @param projectRoot - canonical project root for local-install discovery
*/
function checkCodexModelPosture(runtime?: string, projectRoot?: string): CodexModelPostureResult {
// Short-circuit BEFORE any filesystem access: a non-codex runtime must never
// have its agents directory resolved or a stray .toml inspected, however
// violating that file's contents would be if it were ever read (#3242 row 25).
const resolvedRuntime = runtime ?? (process.env['GSD_RUNTIME'] || 'claude');
const resolvedRuntime = runtime ?? (process.env['MSD_RUNTIME'] || 'claude');
if (resolvedRuntime !== 'codex') {
return {
ok: true,
@@ -392,7 +392,7 @@ function checkCodexModelPosture(runtime?: string, projectRoot?: string): CodexMo
// copy every time — it is the only place the `tools:` contract a role
// derives its sandbox_mode from actually lives, in every install shape
// (repo-dev tree or npm-global package, where the package still ships its
// own agents/ alongside bin/ and gsd-core/).
// own agents/ alongside bin/ and msd-core/).
function _canonicalAgentSourceDir(): string {
return path.join(__dirname, '..', '..', '..', 'agents');
}
@@ -411,7 +411,7 @@ function _canonicalAgentSourceDir(): string {
* lazily `require('bin/install.js')` to reach the same derivation, but
* requiring `bin/install.js` runs its whole CLI top-level, including an
* ASCII banner print to stdout, which corrupted every stdout-JSON caller of
* this posture check, e.g. `gsd-tools validate agents`) — so the emitter and
* this posture check, e.g. `msd-tools validate agents`) — so the emitter and
* this posture check can never silently diverge on the same tool-contract
* predicate — the exact generative-fix-divergence shape this epic exists to
* close. `deriveCodexSandboxMode` itself is total (never throws, #3897
@@ -424,11 +424,11 @@ function _canonicalAgentSourceDir(): string {
*
* Read-only: detects, never repairs — same posture as {@link checkCodexModelPosture}.
*
* @param runtime - the active runtime name; defaults to GSD_RUNTIME env, then 'claude'
* @param runtime - the active runtime name; defaults to MSD_RUNTIME env, then 'claude'
* @param projectRoot - canonical project root for local-install discovery
*/
function checkCodexSandboxPosture(runtime?: string, projectRoot?: string): CodexSandboxPostureResult {
const resolvedRuntime = runtime ?? (process.env['GSD_RUNTIME'] || 'claude');
const resolvedRuntime = runtime ?? (process.env['MSD_RUNTIME'] || 'claude');
if (resolvedRuntime !== 'codex') {
return {
ok: true,
@@ -562,20 +562,20 @@ function agentFileExists(agentsDir: string, name: string, runtime: string): bool
/**
* Resolve a per-plan `agent_hint` specialist name to a dispatchable subagent
* type on the active runtime (#1689). Unlike {@link checkAgentsInstalled},
* which validates the fixed GSD roster, this answers "does an agent file for
* which validates the fixed MSD roster, this answers "does an agent file for
* this ARBITRARY name exist in the active runtime's agent dir(s)?" — so a plan
* can opt into a domain specialist (e.g. a Flutter engineer) that shares the
* gsd-executor contract without being part of the built-in roster.
* msd-executor contract without being part of the built-in roster.
*
* Probes BOTH the runtime-canonical agents dir ({@link getAgentsDir}, which
* honors `GSD_AGENTS_DIR`, project-local manifest-backed installs, and the
* honors `MSD_AGENTS_DIR`, project-local manifest-backed installs, and the
* claude install-relative path) AND the runtime's global config agents dir, so
* a specialist installed at either level is recognized. The decision in #1689
* explicitly requires consulting the active runtime's agent dir rather than
* only the Claude runtime's user-global and project-local agent dirs.
*
* @returns the name when a matching agent file exists; `null` when it does not
* (the caller falls back to `gsd-executor`). An empty/whitespace name always
* (the caller falls back to `msd-executor`). An empty/whitespace name always
* returns `null`.
*/
function resolveAgentHint(name: string, runtime?: string, projectRoot?: string): string | null {
@@ -586,7 +586,7 @@ function resolveAgentHint(name: string, runtime?: string, projectRoot?: string):
// path.join and match an unrelated file — that would echo an invalid
// subagent_type and block the wave, defeating fail-closed resolution.
if (trimmed.includes('/') || trimmed.includes('\\') || trimmed.includes('..')) return null;
const resolvedRuntime = runtime ?? (process.env['GSD_RUNTIME'] || 'claude');
const resolvedRuntime = runtime ?? (process.env['MSD_RUNTIME'] || 'claude');
const candidateDirs = new Set<string>();
candidateDirs.add(getAgentsDir(resolvedRuntime, projectRoot));