fix(plan): execute hands the plan to /trekexecute instead of building it in the planning session
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
be83e6e066
commit
eafe023c74
4 changed files with 81 additions and 12 deletions
|
|
@ -234,3 +234,70 @@ test('[#26] the three reference documents hold read-only tools', () => {
|
|||
assert.equal(fm.fields.model.value, 'opus', `${name}: model stays opus`);
|
||||
}
|
||||
});
|
||||
|
||||
// --- #52 ---------------------------------------------------------------------------
|
||||
// /trekplan's "execute" answer began implementing the plan in the planning
|
||||
// session, past /trekexecute's approval check (K2), test lock and step helpers.
|
||||
// It now prints the /trekexecute line and stops.
|
||||
|
||||
/** The `/trekexecute` line /trekplan prints, in both forms. */
|
||||
function printsTrekexecuteLine(part, where) {
|
||||
assert.match(part, /`\/trekexecute --project \{project_dir\}`/, `${where}: must print the /trekexecute --project line`);
|
||||
assert.match(part, /`\/trekexecute \{plan_path\}`/, `${where}: must print the /trekexecute {plan_path} line`);
|
||||
}
|
||||
|
||||
/**
|
||||
* No text that has /trekplan build the plan itself: no "Begin implementing",
|
||||
* and no "in this session" other than the one prohibition sentence.
|
||||
*/
|
||||
function neverImplementsHere(part, where) {
|
||||
const rest = part.split('Do not implement in this session.').join('');
|
||||
assert.doesNotMatch(rest, /Begin implementing/i, `${where}: still begins implementing`);
|
||||
assert.doesNotMatch(rest, /in this session/i, `${where}: still implements in this session`);
|
||||
}
|
||||
|
||||
test('[#52] Phase 11 "execute": prints the /trekexecute line and stops, never implements in this session', () => {
|
||||
const block = flat(section(read('commands/trekplan.md'), '### "execute" / "go" / "start"'));
|
||||
neverImplementsHere(block, 'Phase 11 "execute"');
|
||||
assert.match(block, /^### "execute" \/ "go" \/ "start" Do not implement in this session\./);
|
||||
printsTrekexecuteLine(block, 'Phase 11 "execute"');
|
||||
assert.match(block, /without a project directory — and stop\./);
|
||||
assert.match(block, /`\/trekexecute` is what checks the plan's approval \(K2\), locks the tests, runs one step helper per step and the review\./);
|
||||
});
|
||||
|
||||
test('[#52] Phase 11 "team": no team path, the same /trekexecute line, then stop', () => {
|
||||
const block = flat(section(read('commands/trekplan.md'), '### "execute with team" / "team"'));
|
||||
neverImplementsHere(block, 'Phase 11 "team"');
|
||||
assert.doesNotMatch(block, /proceed exactly as for "execute"/, 'Phase 11 "team": still proceeds as "execute" did');
|
||||
assert.match(block, /There is no team path\. Print the same `\/trekexecute` line and stop; parallel work is `--decompose` followed by `\/trekexecute`'s session orders\./);
|
||||
});
|
||||
|
||||
test('[#52] Phase 10 menu: "execute" is for the /trekexecute line, and a stopped gate withholds it', () => {
|
||||
const p10 = flat(section(read('commands/trekplan.md'), '## Phase 10 — Present and refine'));
|
||||
assert.doesNotMatch(p10, /start implementing/i, 'Phase 10 still offers or withholds "start implementing"');
|
||||
assert.match(p10, /- Say \*\*"execute"\*\* for the `\/trekexecute` line to run ← only when the gate exited 0/);
|
||||
assert.match(p10, /`Execution is blocked: \{the gate's reasons\}` and do not print the `\/trekexecute` line, whatever is said next, until the gate exits 0\./);
|
||||
});
|
||||
|
||||
test('[#52] sibling: plan mode step 3 prints the /trekexecute line and stops', () => {
|
||||
const pm = flat(section(read('commands/trekplan.md'), '### In plan mode'));
|
||||
assert.doesNotMatch(pm, /Then continue with the operator's choice \(Phase 11\)\./, 'plan mode still continues with the operator\'s choice');
|
||||
assert.match(pm, /Then print the `\/trekexecute` line \(Phase 11\) and stop — leaving plan mode is not an order to implement\./);
|
||||
});
|
||||
|
||||
test('[#52] hard rule: "No premature execution" holds, and nothing in Phases 10-11 implements the plan', () => {
|
||||
const text = read('commands/trekplan.md');
|
||||
const rules = flat(section(text, '## Hard rules'));
|
||||
assert.match(rules, /\*\*No premature execution\*\*: Do not modify any project files until the user explicitly approves the plan, and never while `plan-gate\.mjs` exits non-zero on it\./);
|
||||
for (const h of ['## Phase 10 — Present and refine', '## Phase 11 — Handoff']) {
|
||||
const part = flat(section(text, h));
|
||||
neverImplementsHere(part, h);
|
||||
assert.doesNotMatch(part, /start implementing|Follow the plan exactly|Mark each step complete/i, `${h}: still has /trekplan build the plan`);
|
||||
}
|
||||
});
|
||||
|
||||
test('[#52] sibling: agents/planning-orchestrator.md says "execute" gives the /trekexecute line', () => {
|
||||
const text = read('agents/planning-orchestrator.md');
|
||||
assert.doesNotMatch(text, /Say "execute" to implement/, 'planning-orchestrator still says "execute" implements');
|
||||
assert.ok(text.split('\n').includes('- Say "execute" for the /trekexecute line'), 'missing line: - Say "execute" for the /trekexecute line');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue