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

@@ -28,11 +28,11 @@
* being silently absorbed into agent context.
*
* Seam scope per #3596:
* - hooks/gsd-prompt-guard.js — stdin/stdout JSON contract
* - hooks/gsd-read-injection-scanner.js
* - gsd-core/bin/lib/security.cjs — sanitizer + validators
* - gsd-core/bin/lib/workstream-name-policy.cjs
* - gsd-core/bin/gsd-tools.cjs CLI — full-stack contract
* - hooks/msd-prompt-guard.js — stdin/stdout JSON contract
* - hooks/msd-read-injection-scanner.js
* - msd-core/bin/lib/security.cjs — sanitizer + validators
* - msd-core/bin/lib/workstream-name-policy.cjs
* - msd-core/bin/msd-tools.cjs CLI — full-stack contract
*
* Anti-duplication: the existing `tests/security.test.cjs`,
* `tests/security-scan.test.cjs`, `tests/prompt-injection-scan.test.cjs`,
@@ -46,7 +46,7 @@
*
* 1. `INJECTION_PATTERNS` in `security.cjs` and the two hook scripts
* intentionally do NOT flag `<instructions>...</instructions>`
* because GSD itself uses that tag as legitimate prompt scaffolding.
* because MSD itself uses that tag as legitimate prompt scaffolding.
* A hostile fake `<instructions>` block is therefore not surfaced
* by the read-injection scanner. The test below documents this
* contract and is marked REGRESSION GUARD so any future change
@@ -88,8 +88,8 @@ const { runHook: runHookSeam } = require('./helpers/process-seam.cjs');
const { MALFORMED_INPUT_HOOK_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
const REPO_ROOT = path.resolve(__dirname, '..');
const PROMPT_GUARD_HOOK = path.join(REPO_ROOT, 'hooks', 'gsd-prompt-guard.js');
const READ_SCANNER_HOOK = path.join(REPO_ROOT, 'hooks', 'gsd-read-injection-scanner.js');
const PROMPT_GUARD_HOOK = path.join(REPO_ROOT, 'hooks', 'msd-prompt-guard.js');
const READ_SCANNER_HOOK = path.join(REPO_ROOT, 'hooks', 'msd-read-injection-scanner.js');
const FIXTURE_DIR = path.join(__dirname, 'fixtures', 'adversarial', 'security');
const {
@@ -101,12 +101,12 @@ const {
validateShellArg,
validatePhaseNumber,
validateFieldName,
} = require('../gsd-core/bin/lib/security.cjs');
} = require('../msd-core/bin/lib/security.cjs');
const {
toWorkstreamSlug,
hasInvalidPathSegment,
isValidActiveWorkstreamName,
} = require('../gsd-core/bin/lib/workstream-name-policy.cjs');
} = require('../msd-core/bin/lib/workstream-name-policy.cjs');
// ─── Helpers ────────────────────────────────────────────────────────────────
@@ -119,7 +119,7 @@ const {
* document with `hookSpecificOutput.additionalContext`.
*
* The IR exposes structural fields — including the typed `findings` array
* gsd-read-injection-scanner.js emits on hookSpecificOutput — so tests assert
* msd-read-injection-scanner.js emits on hookSpecificOutput — so tests assert
* on them, not on the human-readable `additionalContext` prose.
*/
function runHook(hookPath, payload, { timeoutMs = 5000 } = {}) {
@@ -146,7 +146,7 @@ function runHook(hookPath, payload, { timeoutMs = 5000 } = {}) {
function sentinelPath(label) {
return path.join(
os.tmpdir(),
`gsd-3596-sentinel-${label}-${process.pid}-${Date.now()}`,
`msd-3596-sentinel-${label}-${process.pid}-${Date.now()}`,
);
}
@@ -225,7 +225,7 @@ describe('workstream-name-policy: hostile names are slugified or rejected', () =
describe('CLI: hostile workstream names cannot escape or execute', () => {
let tmpDir;
beforeEach(() => { tmpDir = createTempGitProject('gsd-3596-ws-'); });
beforeEach(() => { tmpDir = createTempGitProject('msd-3596-ws-'); });
afterEach(() => { cleanup(tmpDir); });
test('command substitution payload does not spawn a shell', () => {
@@ -278,7 +278,7 @@ describe('CLI: hostile workstream names cannot escape or execute', () => {
});
test('--ws traversal value is rejected before any planning IO', () => {
const escape = path.join(tmpDir, '..', '..', '..', 'gsd-3596-traverse-marker');
const escape = path.join(tmpDir, '..', '..', '..', 'msd-3596-traverse-marker');
// Try a no-op subcommand under a hostile --ws value.
const r = runCli(['--ws', '../../../etc/passwd', 'state'], { cwd: tmpDir });
@@ -305,7 +305,7 @@ describe('CLI: hostile workstream names cannot escape or execute', () => {
describe('CLI: fake-token env values are never echoed back', () => {
let tmpDir;
beforeEach(() => { tmpDir = createTempGitProject('gsd-3596-secret-'); });
beforeEach(() => { tmpDir = createTempGitProject('msd-3596-secret-'); });
afterEach(() => { cleanup(tmpDir); });
test('unknown subcommand error contains no env token values', () => {
@@ -316,7 +316,7 @@ describe('CLI: fake-token env values are never echoed back', () => {
env: {
GITHUB_TOKEN: ghToken,
OPENAI_API_KEY: openAi,
GSD_SECRET_AAAK: 'aaak_v1_should_never_appear',
MSD_SECRET_AAAK: 'aaak_v1_should_never_appear',
},
});
assert.strictEqual(r.ok, false, 'must fail under unknown subcommand');
@@ -343,9 +343,9 @@ describe('CLI: fake-token env values are never echoed back', () => {
});
});
// ─── Hook: gsd-prompt-guard advisory contract ───────────────────────────────
// ─── Hook: msd-prompt-guard advisory contract ───────────────────────────────
describe('gsd-prompt-guard: hostile .planning/ writes are advised, not blocked', () => {
describe('msd-prompt-guard: hostile .planning/ writes are advised, not blocked', () => {
test('Write of fake-instruction-override CONTEXT.md triggers advisory', () => {
const content = fs.readFileSync(
path.join(FIXTURE_DIR, 'context-instruction-override.md'), 'utf-8');
@@ -411,9 +411,9 @@ describe('gsd-prompt-guard: hostile .planning/ writes are advised, not blocked',
});
});
// ─── Hook: gsd-read-injection-scanner advisory contract ─────────────────────
// ─── Hook: msd-read-injection-scanner advisory contract ─────────────────────
describe('gsd-read-injection-scanner: hostile reads are flagged with severity', () => {
describe('msd-read-injection-scanner: hostile reads are flagged with severity', () => {
test('HIGH severity when 3+ patterns match (instruction override fixture)', () => {
const content = fs.readFileSync(
path.join(FIXTURE_DIR, 'context-instruction-override.md'), 'utf-8');
@@ -449,7 +449,7 @@ describe('gsd-read-injection-scanner: hostile reads are flagged with severity',
test('REGRESSION GUARD: bare <instructions> tag is NOT flagged (intentional whitelist)', () => {
// Documented contract in security.cjs:
// "Note: <instructions> is excluded — GSD uses it as legitimate prompt structure"
// "Note: <instructions> is excluded — MSD uses it as legitimate prompt structure"
// This test pins that contract so any future change that starts flagging
// <instructions> is a deliberate, reviewed update — not silent drift.
const content = [
@@ -558,11 +558,11 @@ describe('sanitizeForPrompt: fake boundary tags are replaced, not echoed', () =>
});
test('REGRESSION GUARD: <instructions> tag survives sanitization (legitimate use)', () => {
// Mirrors the read-scanner whitelist: <instructions> is GSD's own
// Mirrors the read-scanner whitelist: <instructions> is MSD's own
// prompt scaffolding and is intentionally preserved.
const out = sanitizeForPrompt('<instructions>do the work</instructions>');
assert.match(out, /<instructions>do the work<\/instructions>/,
'<instructions> is GSD prompt scaffolding — must survive sanitizer (PINNED)');
'<instructions> is MSD prompt scaffolding — must survive sanitizer (PINNED)');
});
});
@@ -616,7 +616,7 @@ describe('scanForInjection: fixture files trip the scanner', () => {
describe('validatePath: hostile path values are rejected before write', () => {
let tmpDir;
beforeEach(() => { tmpDir = createTempGitProject('gsd-3596-path-'); });
beforeEach(() => { tmpDir = createTempGitProject('msd-3596-path-'); });
afterEach(() => { cleanup(tmpDir); });
test('parent-directory traversal is rejected', () => {
@@ -643,7 +643,7 @@ describe('validatePath: hostile path values are rejected before write', () => {
test('symlink escaping the base is rejected', () => {
if (process.platform === 'win32') return; // symlink semantics differ on win32
const base = path.join(tmpDir, '.planning');
const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-3596-escape-'));
const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-3596-escape-'));
const linkInside = path.join(base, 'escape-link');
fs.symlinkSync(outside, linkInside);
assert.equal(tryWithinRoot('escape-link/anything', base), null,
@@ -661,7 +661,7 @@ describe('validatePath: hostile path values are rejected before write', () => {
const {
MARKDOWN_LINK_PATTERNS,
} = require('../gsd-core/bin/lib/security.cjs');
} = require('../msd-core/bin/lib/security.cjs');
describe('scanForInjection: MD-LINK-JS-SCHEME (javascript: URI)', () => {
// Source: OWASP Cross-Site Scripting Prevention Cheat Sheet
@@ -847,7 +847,7 @@ describe('scanForInjection: MD-LINK-TOKEN-IN-QUERY (sensitive key in query strin
// ─── Parity test: hook MARKDOWN_LINK_PATTERNS is superset of canonical ───────
//
// D1: Prevents future drift between security.cjs (canonical export) and
// hooks/gsd-read-injection-scanner.js (inlined for hook independence).
// hooks/msd-read-injection-scanner.js (inlined for hook independence).
//
// BEHAVIORAL contract (not source-text grep): for every ruleId in the
// canonical MARKDOWN_LINK_PATTERNS export, a probe string must (a) be
@@ -901,7 +901,7 @@ describe('MARKDOWN_LINK_PATTERNS parity: hook is a behavioral superset of canoni
);
});
test(`hook side: gsd-read-injection-scanner flags ${ruleId}`, () => {
test(`hook side: msd-read-injection-scanner flags ${ruleId}`, () => {
const r = runHook(READ_SCANNER_HOOK, {
tool_name: 'Read',
tool_input: { file_path: '/proj/docs/notes.md' },
@@ -1130,9 +1130,9 @@ describe('input validators: shell metacharacter and identifier rejection', () =>
});
});
// ─── Hook: gsd-prompt-guard under Kimi tool vocabulary (#2304) ──────────────
// ─── Hook: msd-prompt-guard under Kimi tool vocabulary (#2304) ──────────────
describe('#2304: gsd-prompt-guard engages on Kimi tool vocabulary', () => {
describe('#2304: msd-prompt-guard engages on Kimi tool vocabulary', () => {
// Payload shapes mirror kimi-cli's actual tool schemas
// (src/kimi_cli/tools/file/{write,replace}.py): WriteFile takes
// `path`/`content`, StrReplaceFile takes `path` + `edit: Edit | list[Edit]`.