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,17 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* #2071 — `gsd-tools effort sync` crashed in an INSTALLED runtime because
|
||||
* #2071 — `msd-tools effort sync` crashed in an INSTALLED runtime because
|
||||
* commands.cjs did `require('../../../bin/install.js')`, but the installer only
|
||||
* copies the `gsd-core/` subtree into a runtime home — the package-root
|
||||
* copies the `msd-core/` subtree into a runtime home — the package-root
|
||||
* `bin/install.js` is never present there, so the require threw MODULE_NOT_FOUND.
|
||||
*
|
||||
* This does a real minimal install into a temp home (the same helper the
|
||||
* golden-parity suite uses) and runs the exact repro from the issue against the
|
||||
* installed shim: `node <configDir>/gsd-core/bin/gsd-tools.cjs effort sync`. Pre-fix
|
||||
* installed shim: `node <configDir>/msd-core/bin/msd-tools.cjs effort sync`. Pre-fix
|
||||
* this throws `Cannot find module '../../../bin/install.js'`; post-fix the
|
||||
* install-time resolvers live in the shipped sibling
|
||||
* `gsd-core/bin/lib/install-effort-resolver.cjs` and the require resolves.
|
||||
* `msd-core/bin/lib/install-effort-resolver.cjs` and the require resolves.
|
||||
*
|
||||
* `--config-dir <temp>` keeps it hermetic (targets the temp install, never the
|
||||
* developer's real ~/.claude); effort sync defaults to dry-run so nothing is written.
|
||||
@@ -32,7 +32,7 @@ const { PROBE_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
|
||||
// JSON `cmdEffortSync` writes straight to fd 1 (via io.cjs's writeAllSync) can
|
||||
// actually be captured — overriding process.stdout.write in-process does not
|
||||
// intercept that write.
|
||||
const COMMANDS_CJS = path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'commands.cjs');
|
||||
const COMMANDS_CJS = path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'commands.cjs');
|
||||
|
||||
describe('#2071: effort sync runs in an installed runtime (no package-root bin/install.js)', () => {
|
||||
test('effort sync does not crash reaching for the un-shipped bin/install.js', () => {
|
||||
@@ -42,7 +42,7 @@ describe('#2071: effort sync runs in an installed runtime (no package-root bin/i
|
||||
try {
|
||||
// Installed layout invariant: the package-root installer is never copied in.
|
||||
assert.ok(!fs.existsSync(path.join(root, 'bin', 'install.js')), 'installed home must not contain bin/install.js');
|
||||
assert.ok(!fs.existsSync(path.join(configDir, 'bin', 'install.js')), 'no bin/install.js beside gsd-core');
|
||||
assert.ok(!fs.existsSync(path.join(configDir, 'bin', 'install.js')), 'no bin/install.js beside msd-core');
|
||||
|
||||
// A project effort config gives the sync something to resolve.
|
||||
fs.mkdirSync(path.join(root, '.planning'), { recursive: true });
|
||||
@@ -51,9 +51,9 @@ describe('#2071: effort sync runs in an installed runtime (no package-root bin/i
|
||||
JSON.stringify({ effort: { default: 'high' } }),
|
||||
);
|
||||
|
||||
const gsdTools = path.join(configDir, 'gsd-core', 'bin', 'gsd-tools.cjs');
|
||||
const msdTools = path.join(configDir, 'msd-core', 'bin', 'msd-tools.cjs');
|
||||
const result = runNode(
|
||||
[gsdTools, 'effort', 'sync', '--config-dir', configDir],
|
||||
[msdTools, 'effort', 'sync', '--config-dir', configDir],
|
||||
{ cwd: root, env: { ...process.env, HOME: root }, timeoutMs: PROBE_TIMEOUT_MS },
|
||||
);
|
||||
const combined = `${result.stdout || ''}${result.stderr || ''}`;
|
||||
@@ -76,15 +76,15 @@ describe('#2071: effort sync runs in an installed runtime (no package-root bin/i
|
||||
|
||||
// #3706 — OpenCode's `effort sync` path (cmdEffortSyncOpencode) maintains the
|
||||
// `variant:` frontmatter key install bakes into `~/.config/opencode/agents/
|
||||
// gsd-*.md`, mirroring the pre-existing claude/`effort:` and codex branches.
|
||||
// msd-*.md`, mirroring the pre-existing claude/`effort:` and codex branches.
|
||||
// Each case is run against a fresh sandbox: a project `cwd` (holding
|
||||
// `.planning/config.json`), a `configDir` (holding `agents/`), and an
|
||||
// isolated `home` (HOME env, so `~/.gsd/defaults.json` can never leak in from
|
||||
// isolated `home` (HOME env, so `~/.msd/defaults.json` can never leak in from
|
||||
// the real developer machine) — cmdEffortSync merges home defaults with the
|
||||
// project config, so a hermetic test must control both sources.
|
||||
describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
function makeSandbox() {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-effort-sync-opencode-'));
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-effort-sync-opencode-'));
|
||||
const cwd = path.join(root, 'project');
|
||||
const configDir = path.join(root, 'runtime-home');
|
||||
const agentsDir = path.join(configDir, 'agents');
|
||||
@@ -141,9 +141,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// with no `variant:` key gets the resolved effort injected verbatim.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
@@ -161,9 +161,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
if (process.platform === 'win32') return;
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
fs.chmodSync(filePath, 0o600);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
@@ -189,9 +189,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
if (process.platform === 'win32') return;
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
fs.chmodSync(filePath, 0o600);
|
||||
|
||||
@@ -245,16 +245,16 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// byte-identical — no write happens until dryRun is explicitly false.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const before = fs.readFileSync(filePath);
|
||||
const result = runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: true });
|
||||
const after = fs.readFileSync(filePath);
|
||||
assert.ok(before.equals(after), 'dry run must not touch the file on disk');
|
||||
assert.strictEqual(result.synced, 1);
|
||||
assert.deepStrictEqual(result.changes[0], { agent: 'gsd-executor', from: null, to: 'xhigh' });
|
||||
assert.deepStrictEqual(result.changes[0], { agent: 'msd-executor', from: null, to: 'xhigh' });
|
||||
} finally {
|
||||
cleanup(root);
|
||||
}
|
||||
@@ -265,9 +265,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// skipped and its bytes are left completely untouched (no rewrite churn).
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'high' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'high' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
]);
|
||||
const before = fs.readFileSync(filePath);
|
||||
const result = runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
@@ -285,17 +285,17 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// `variant: inherit` would name a variant that cannot resolve.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'inherit' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'inherit' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
]);
|
||||
const result = runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
assert.doesNotMatch(content, /^variant:/m);
|
||||
assert.match(content, /^name: gsd-executor$/m);
|
||||
assert.match(content, /^name: msd-executor$/m);
|
||||
assert.match(content, /^description: x$/m);
|
||||
assert.match(content, /^mode: subagent$/m);
|
||||
assert.deepStrictEqual(result.changes[0], { agent: 'gsd-executor', from: 'high', to: null });
|
||||
assert.deepStrictEqual(result.changes[0], { agent: 'msd-executor', from: 'high', to: null });
|
||||
} finally {
|
||||
cleanup(root);
|
||||
}
|
||||
@@ -307,8 +307,8 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, undefined);
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
@@ -331,14 +331,14 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('files that are not gsd-*.md are ignored', () => {
|
||||
// Protects: the gsd-*.md filter — a non-gsd file sitting in agents/ must
|
||||
test('files that are not msd-*.md are ignored', () => {
|
||||
// Protects: the msd-*.md filter — a non-msd file sitting in agents/ must
|
||||
// never be synced or skipped, i.e. never even enter the loop.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'not-gsd.md', [
|
||||
'---', 'name: not-gsd', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'not-msd.md', [
|
||||
'---', 'name: not-msd', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const result = runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
assert.strictEqual(result.synced, 0);
|
||||
@@ -354,9 +354,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// byte-identical past the closing frontmatter delimiter.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'max' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', '---', '',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'max' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', '---', '',
|
||||
'Body with: colons #hash and a --- rule.', '', 'more.',
|
||||
]);
|
||||
const before = fs.readFileSync(filePath, 'utf8');
|
||||
@@ -380,8 +380,8 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, undefined);
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'variant:', '---', '', 'Body.',
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', 'variant:', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
@@ -399,8 +399,8 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, undefined);
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'variant: ', '---', '', 'Body.',
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', 'variant: ', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
@@ -417,10 +417,10 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// detected from the matched frontmatter block.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = path.join(agentsDir, 'gsd-executor.md');
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = path.join(agentsDir, 'msd-executor.md');
|
||||
const beforeWrite = [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
].join('\r\n');
|
||||
fs.writeFileSync(filePath, beforeWrite);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
@@ -428,9 +428,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
assert.match(afterWrite, /^variant: xhigh\r$/m);
|
||||
assert.doesNotMatch(afterWrite, /(?<!\r)\n/, 'no lone LF must appear in a CRLF document');
|
||||
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'inherit' } });
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'inherit' } });
|
||||
const beforeStrip = [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', 'variant: high', '---', '', 'Body.',
|
||||
].join('\r\n');
|
||||
fs.writeFileSync(filePath, beforeStrip);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
@@ -443,23 +443,23 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
});
|
||||
|
||||
test('a symlinked agent file is skipped, never followed', () => {
|
||||
// A symlinked gsd-*.md must never have its TARGET file rewritten — the
|
||||
// A symlinked msd-*.md must never have its TARGET file rewritten — the
|
||||
// sync must skip it structurally (readdir's Dirent reports a symlink
|
||||
// entry as not-a-file), not follow it and edit whatever it points to.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
const targetPath = path.join(root, 'outside-target.md');
|
||||
const targetContent = [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
].join('\n');
|
||||
fs.writeFileSync(targetPath, targetContent);
|
||||
const linkPath = path.join(agentsDir, 'gsd-executor.md');
|
||||
const linkPath = path.join(agentsDir, 'msd-executor.md');
|
||||
try {
|
||||
fs.symlinkSync(targetPath, linkPath);
|
||||
} catch {
|
||||
return; // platform cannot create symlinks (e.g. unprivileged Windows) — skip
|
||||
}
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
const after = fs.readFileSync(targetPath, 'utf8');
|
||||
assert.strictEqual(after, targetContent, 'the symlink target must be left untouched');
|
||||
@@ -474,9 +474,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// frontmatter gains its own key.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '',
|
||||
'variant: in-the-body', '', 'more.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'opencode', dryRun: false });
|
||||
@@ -494,8 +494,8 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// rather than guessing where a frontmatter block would go.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'Just a body, no frontmatter fences at all.',
|
||||
]);
|
||||
const before = fs.readFileSync(filePath);
|
||||
@@ -512,9 +512,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// the control that the pre-existing claude behavior did not move.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'claude', dryRun: false });
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
@@ -536,9 +536,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// read_failures/write_failures key added.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-unreadable': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'gsd-unreadable.md', [
|
||||
'---', 'name: gsd-unreadable', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-unreadable': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'msd-unreadable.md', [
|
||||
'---', 'name: msd-unreadable', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
|
||||
const opts = { dryRun: false, configDir, runtime: 'claude' };
|
||||
@@ -546,7 +546,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
`const fs = require('node:fs');`,
|
||||
`const originalReadFileSync = fs.readFileSync;`,
|
||||
`fs.readFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-unreadable.md')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-unreadable.md')) {`,
|
||||
` throw new Error('injected read failure');`,
|
||||
` }`,
|
||||
` return originalReadFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -597,12 +597,12 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// bits under Docker/CI and it leaks resources).
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-broken': 'xhigh', 'gsd-executor': 'xhigh' } });
|
||||
const brokenPath = writeAgent(agentsDir, 'gsd-broken.md', [
|
||||
'---', 'name: gsd-broken', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-broken': 'xhigh', 'msd-executor': 'xhigh' } });
|
||||
const brokenPath = writeAgent(agentsDir, 'msd-broken.md', [
|
||||
'---', 'name: msd-broken', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const okPath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
const okPath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const brokenBefore = fs.readFileSync(brokenPath);
|
||||
|
||||
@@ -611,7 +611,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
`const fs = require('node:fs');`,
|
||||
`const originalWriteFileSync = fs.writeFileSync;`,
|
||||
`fs.writeFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-broken.md')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-broken.md')) {`,
|
||||
` throw new Error('injected write failure');`,
|
||||
` }`,
|
||||
` return originalWriteFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -670,9 +670,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// bits under Docker/CI and it leaks resources).
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const before = fs.readFileSync(filePath);
|
||||
|
||||
@@ -686,7 +686,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// already been truncated by a naive in-place write (which this
|
||||
// atomic-publish path no longer performs).
|
||||
`fs.writeFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-executor.md.tmp.')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-executor.md.tmp.')) {`,
|
||||
` throw new Error('injected ENOSPC mid-write');`,
|
||||
` }`,
|
||||
` return originalWriteFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -733,9 +733,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
if (process.platform === 'win32') return;
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': 'xhigh' } });
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
fs.chmodSync(filePath, 0o600);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'claude', dryRun: false });
|
||||
@@ -759,9 +759,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
for (const level of ['low', 'xhigh']) {
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-executor': level } });
|
||||
const claudePath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-executor': level } });
|
||||
const claudePath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd, home, configDir, runtime: 'claude', dryRun: false });
|
||||
const claudeContent = fs.readFileSync(claudePath, 'utf8');
|
||||
@@ -773,9 +773,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
|
||||
const { root: root2, cwd: cwd2, configDir: configDir2, agentsDir: agentsDir2, home: home2 } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd2, { agent_overrides: { 'gsd-executor': level } });
|
||||
const opencodePath = writeAgent(agentsDir2, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd2, { agent_overrides: { 'msd-executor': level } });
|
||||
const opencodePath = writeAgent(agentsDir2, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
runEffortSync({ cwd: cwd2, home: home2, configDir: configDir2, runtime: 'opencode', dryRun: false });
|
||||
const opencodeContent = fs.readFileSync(opencodePath, 'utf8');
|
||||
@@ -798,12 +798,12 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// Docker/CI and it leaks resources).
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-broken': 'xhigh', 'gsd-executor': 'xhigh' } });
|
||||
const brokenPath = writeAgent(agentsDir, 'gsd-broken.md', [
|
||||
'---', 'name: gsd-broken', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-broken': 'xhigh', 'msd-executor': 'xhigh' } });
|
||||
const brokenPath = writeAgent(agentsDir, 'msd-broken.md', [
|
||||
'---', 'name: msd-broken', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const okPath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
const okPath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const brokenBefore = fs.readFileSync(brokenPath);
|
||||
|
||||
@@ -817,7 +817,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// fs machinery the require chain itself performs) passes through
|
||||
// unmodified.
|
||||
`fs.writeFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-broken.md.tmp.')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-broken.md.tmp.')) {`,
|
||||
` throw new Error('injected write failure');`,
|
||||
` }`,
|
||||
` return originalWriteFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -838,7 +838,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
const result = JSON.parse(spawned.stdout.slice(jsonStart));
|
||||
|
||||
assert.strictEqual(result.write_failures.length, 1);
|
||||
assert.strictEqual(result.write_failures[0].agent, 'gsd-broken');
|
||||
assert.strictEqual(result.write_failures[0].agent, 'msd-broken');
|
||||
|
||||
const brokenAfter = fs.readFileSync(brokenPath);
|
||||
assert.ok(brokenBefore.equals(brokenAfter), 'the failing agent file must be byte-unchanged');
|
||||
@@ -860,12 +860,12 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// Docker/CI and it leaks resources).
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-unreadable': 'xhigh', 'gsd-executor': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'gsd-unreadable.md', [
|
||||
'---', 'name: gsd-unreadable', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-unreadable': 'xhigh', 'msd-executor': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'msd-unreadable.md', [
|
||||
'---', 'name: msd-unreadable', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
const okPath = writeAgent(agentsDir, 'gsd-executor.md', [
|
||||
'---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
const okPath = writeAgent(agentsDir, 'msd-executor.md', [
|
||||
'---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
|
||||
const opts = { dryRun: false, configDir, runtime: 'opencode' };
|
||||
@@ -873,7 +873,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
`const fs = require('node:fs');`,
|
||||
`const originalReadFileSync = fs.readFileSync;`,
|
||||
`fs.readFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-unreadable.md')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-unreadable.md')) {`,
|
||||
` throw new Error('injected read failure');`,
|
||||
` }`,
|
||||
` return originalReadFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -894,7 +894,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
const result = JSON.parse(spawned.stdout.slice(jsonStart));
|
||||
|
||||
assert.strictEqual(result.read_failures.length, 1);
|
||||
assert.strictEqual(result.read_failures[0].agent, 'gsd-unreadable');
|
||||
assert.strictEqual(result.read_failures[0].agent, 'msd-unreadable');
|
||||
|
||||
const okContent = fs.readFileSync(okPath, 'utf8');
|
||||
assert.match(okContent, /^variant: xhigh$/m, 'the sweep must continue past the unreadable agent');
|
||||
@@ -913,9 +913,9 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// text `output()` writes for that mode, not on parsed JSON.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'gsd-broken': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'gsd-broken.md', [
|
||||
'---', 'name: gsd-broken', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
writeProjectEffortConfig(cwd, { agent_overrides: { 'msd-broken': 'xhigh' } });
|
||||
writeAgent(agentsDir, 'msd-broken.md', [
|
||||
'---', 'name: msd-broken', 'description: x', 'mode: subagent', '---', '', 'Body.',
|
||||
]);
|
||||
|
||||
const opts = { dryRun: false, configDir, runtime: 'opencode' };
|
||||
@@ -923,7 +923,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
`const fs = require('node:fs');`,
|
||||
`const originalWriteFileSync = fs.writeFileSync;`,
|
||||
`fs.writeFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-broken.md.tmp.')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-broken.md.tmp.')) {`,
|
||||
` throw new Error('injected write failure');`,
|
||||
` }`,
|
||||
` return originalWriteFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -952,7 +952,7 @@ describe('#3706: effort sync maintains OpenCode variant: frontmatter', () => {
|
||||
// tmp-file + chmod + retryRenameSync discipline as the OpenCode branch above.
|
||||
describe('#3243: effort sync strips Anthropic-flavored model pins from Codex agents', () => {
|
||||
function makeSandbox() {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-effort-sync-codex-'));
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-effort-sync-codex-'));
|
||||
const cwd = path.join(root, 'project');
|
||||
const configDir = path.join(root, 'runtime-home');
|
||||
const agentsDir = path.join(configDir, 'agents');
|
||||
@@ -980,7 +980,7 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
const before = ['model = "claude-sonnet-4"', 'model_reasoning_effort = "high"', ''].join('\n');
|
||||
const filePath = writeAgent(agentsDir, 'gsd-executor.toml', [before]);
|
||||
const filePath = writeAgent(agentsDir, 'msd-executor.toml', [before]);
|
||||
fs.chmodSync(filePath, 0o600);
|
||||
|
||||
const opts = { dryRun: false, configDir, runtime: 'codex' };
|
||||
@@ -1021,10 +1021,10 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
// the sibling agent uses that fixture to prove it still gets rewritten.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeAgent(agentsDir, 'gsd-unreadable.toml', [
|
||||
writeAgent(agentsDir, 'msd-unreadable.toml', [
|
||||
'model = "claude-sonnet-4"', 'model_reasoning_effort = "high"', '',
|
||||
]);
|
||||
const okPath = writeAgent(agentsDir, 'gsd-ok.toml', [
|
||||
const okPath = writeAgent(agentsDir, 'msd-ok.toml', [
|
||||
'model = "claude-sonnet-4"', 'model_reasoning_effort = "high"', '',
|
||||
]);
|
||||
const okBefore = fs.readFileSync(okPath, 'utf8');
|
||||
@@ -1034,7 +1034,7 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
`const fs = require('node:fs');`,
|
||||
`const originalReadFileSync = fs.readFileSync;`,
|
||||
`fs.readFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-unreadable.toml')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-unreadable.toml')) {`,
|
||||
` throw new Error('injected read failure');`,
|
||||
` }`,
|
||||
` return originalReadFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -1055,7 +1055,7 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
const result = JSON.parse(spawned.stdout.slice(jsonStart));
|
||||
|
||||
assert.strictEqual(result.read_failures.length, 1);
|
||||
assert.strictEqual(result.read_failures[0].agent, 'gsd-unreadable');
|
||||
assert.strictEqual(result.read_failures[0].agent, 'msd-unreadable');
|
||||
|
||||
const okAfter = fs.readFileSync(okPath, 'utf8');
|
||||
assert.notStrictEqual(okAfter, okBefore, 'the sweep must continue past the unreadable agent and still rewrite the sibling');
|
||||
@@ -1073,7 +1073,7 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
// stdout text, not on parsed JSON.
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeAgent(agentsDir, 'gsd-unreadable.toml', [
|
||||
writeAgent(agentsDir, 'msd-unreadable.toml', [
|
||||
'model = "claude-sonnet-4"', 'model_reasoning_effort = "high"', '',
|
||||
]);
|
||||
|
||||
@@ -1082,7 +1082,7 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
`const fs = require('node:fs');`,
|
||||
`const originalReadFileSync = fs.readFileSync;`,
|
||||
`fs.readFileSync = function (targetPath, ...rest) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('gsd-unreadable.toml')) {`,
|
||||
` if (typeof targetPath === 'string' && targetPath.includes('msd-unreadable.toml')) {`,
|
||||
` throw new Error('injected read failure');`,
|
||||
` }`,
|
||||
` return originalReadFileSync.call(fs, targetPath, ...rest);`,
|
||||
@@ -1110,7 +1110,7 @@ describe('#3243: effort sync strips Anthropic-flavored model pins from Codex age
|
||||
// runtime, `effort:` key), the only public entry point that exercises them.
|
||||
describe('#3706: frontmatter line editors are scoped to the matched block', () => {
|
||||
function makeSandbox() {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-effort-sync-fm-scope-'));
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-effort-sync-fm-scope-'));
|
||||
const cwd = path.join(root, 'project');
|
||||
const configDir = path.join(root, 'runtime-home');
|
||||
const agentsDir = path.join(configDir, 'agents');
|
||||
@@ -1125,7 +1125,7 @@ describe('#3706: frontmatter line editors are scoped to the matched block', () =
|
||||
fs.mkdirSync(path.join(cwd, '.planning'), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(cwd, '.planning', 'config.json'),
|
||||
JSON.stringify({ effort: { agent_overrides: { 'gsd-executor': override } } }),
|
||||
JSON.stringify({ effort: { agent_overrides: { 'msd-executor': override } } }),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1152,7 +1152,7 @@ describe('#3706: frontmatter line editors are scoped to the matched block', () =
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, 'inherit');
|
||||
const filePath = path.join(agentsDir, 'gsd-executor.md');
|
||||
const filePath = path.join(agentsDir, 'msd-executor.md');
|
||||
const before = 'Preamble line\r\n\r\n---\r\nname: x\r\neffort: high\r\n---\r\n\r\nBody.\r\n';
|
||||
fs.writeFileSync(filePath, before);
|
||||
runEffortSync({ cwd, home, configDir });
|
||||
@@ -1175,7 +1175,7 @@ describe('#3706: frontmatter line editors are scoped to the matched block', () =
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, 'xhigh');
|
||||
const filePath = path.join(agentsDir, 'gsd-executor.md');
|
||||
const filePath = path.join(agentsDir, 'msd-executor.md');
|
||||
const before = 'effort: not-the-frontmatter\n\n---\nname: x\neffort: high\n---\n\nBody.\n';
|
||||
fs.writeFileSync(filePath, before);
|
||||
runEffortSync({ cwd, home, configDir });
|
||||
@@ -1198,24 +1198,24 @@ describe('#3706: frontmatter line editors are scoped to the matched block', () =
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, 'xhigh');
|
||||
const filePath = path.join(agentsDir, 'gsd-executor.md');
|
||||
const before = ['---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.'].join('\n');
|
||||
const filePath = path.join(agentsDir, 'msd-executor.md');
|
||||
const before = ['---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.'].join('\n');
|
||||
fs.writeFileSync(filePath, before);
|
||||
runEffortSync({ cwd, home, configDir });
|
||||
const afterSet = fs.readFileSync(filePath, 'utf8');
|
||||
assert.strictEqual(
|
||||
afterSet,
|
||||
['---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'effort: xhigh', '---', '', 'Body.'].join('\n'),
|
||||
['---', 'name: msd-executor', 'description: x', 'mode: subagent', 'effort: xhigh', '---', '', 'Body.'].join('\n'),
|
||||
);
|
||||
|
||||
writeProjectEffortConfig(cwd, 'inherit');
|
||||
const beforeRemove = ['---', 'name: gsd-executor', 'description: x', 'mode: subagent', 'effort: high', '---', '', 'Body.'].join('\n');
|
||||
const beforeRemove = ['---', 'name: msd-executor', 'description: x', 'mode: subagent', 'effort: high', '---', '', 'Body.'].join('\n');
|
||||
fs.writeFileSync(filePath, beforeRemove);
|
||||
runEffortSync({ cwd, home, configDir });
|
||||
const afterRemove = fs.readFileSync(filePath, 'utf8');
|
||||
assert.strictEqual(
|
||||
afterRemove,
|
||||
['---', 'name: gsd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.'].join('\n'),
|
||||
['---', 'name: msd-executor', 'description: x', 'mode: subagent', '---', '', 'Body.'].join('\n'),
|
||||
);
|
||||
} finally {
|
||||
cleanup(root);
|
||||
@@ -1233,16 +1233,16 @@ describe('#3706: frontmatter line editors are scoped to the matched block', () =
|
||||
const { root, cwd, configDir, agentsDir, home } = makeSandbox();
|
||||
try {
|
||||
writeProjectEffortConfig(cwd, 'xhigh');
|
||||
const filePath = path.join(agentsDir, 'gsd-executor.md');
|
||||
const filePath = path.join(agentsDir, 'msd-executor.md');
|
||||
const before = [
|
||||
'---', 'name: gsd-executor', 'effort: low', 'description: x', 'effort: high', '---', '', 'Body.',
|
||||
'---', 'name: msd-executor', 'effort: low', 'description: x', 'effort: high', '---', '', 'Body.',
|
||||
].join('\n');
|
||||
fs.writeFileSync(filePath, before);
|
||||
runEffortSync({ cwd, home, configDir });
|
||||
const after = fs.readFileSync(filePath, 'utf8');
|
||||
assert.strictEqual(
|
||||
after,
|
||||
['---', 'name: gsd-executor', 'effort: xhigh', 'description: x', '---', '', 'Body.'].join('\n'),
|
||||
['---', 'name: msd-executor', 'effort: xhigh', 'description: x', '---', '', 'Body.'].join('\n'),
|
||||
'exactly one effort: line must remain, at the position of the first occurrence, carrying the resolved value',
|
||||
);
|
||||
const occurrences = after.match(/^effort:/gm) || [];
|
||||
|
||||
Reference in New Issue
Block a user