fix(execute): name and read --profile and --gates in the hint, the usage block and Phase 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
af36578f12
commit
2b5d5f72bc
5 changed files with 82 additions and 7 deletions
|
|
@ -628,3 +628,73 @@ test('[#1] sibling: README.md gives the four values, and no strictness table', (
|
|||
assert.doesNotMatch(sec, /`adaptive` \(default\)/);
|
||||
assert.match(sec, /accept `--gates \[true\|false\|closed\|open\]`/);
|
||||
});
|
||||
|
||||
// --- #30 ---------------------------------------------------------------------------
|
||||
|
||||
const EXEC = 'commands/trekexecute.md';
|
||||
const SAME_ON_OPUS = 'the step helper and the controller stay on opus';
|
||||
|
||||
/** Phase 1's top-level numbered rules, each as [number, text of its first line]. */
|
||||
function phase1Rules() {
|
||||
const sec = section(read(EXEC), '## Phase 1 — Parse mode and validate input').split('\n');
|
||||
const stop = sec.findIndex((l) => l.startsWith('If no path is provided'));
|
||||
assert.ok(stop !== -1, 'Phase 1 must still say what happens when no path is provided');
|
||||
return sec.slice(0, stop)
|
||||
.map((l) => l.match(/^(\d+)\. (.*)$/))
|
||||
.filter(Boolean)
|
||||
.map((m) => [Number(m[1]), m[2]]);
|
||||
}
|
||||
|
||||
test('[#30] the frontmatter hint names --profile <name> and --gates', () => {
|
||||
const m = read(EXEC).match(/^argument-hint: (.*)$/m);
|
||||
assert.ok(m, 'trekexecute has no argument-hint');
|
||||
assert.ok(m[1].includes('[--profile <name>]'), `the hint does not name --profile <name>: ${m[1]}`);
|
||||
assert.ok(m[1].includes('[--gates [true|false|closed|open]]'), `the hint does not name --gates: ${m[1]}`);
|
||||
assert.equal(m[1],
|
||||
'"[--project <dir>] [--profile <name>] [--gates [true|false|closed|open]] [--fg | --resume | --dry-run | --validate | --step N | --session N] [plan.md]"');
|
||||
});
|
||||
|
||||
test('[#30] Phase 1 strips --profile <name>, and its last rule reads what is left after the flags are stripped', () => {
|
||||
const f = flat(section(read(EXEC), '## Phase 1 — Parse mode and validate input'));
|
||||
assert.doesNotMatch(f, /the entire argument string is the file path/i,
|
||||
'Phase 1 still reads the whole argument string as the file path');
|
||||
const rules = phase1Rules();
|
||||
assert.deepEqual(rules.map(([n]) => n), rules.map((_, i) => i + 1), 'Phase 1 rules are not numbered 1..n');
|
||||
const [last, profile] = [rules[rules.length - 1][1], rules[rules.length - 2][1]];
|
||||
assert.ok(last.startsWith('Otherwise: the arguments left after every flag above is stripped are the file path.'),
|
||||
`the last rule does not read what is left after the flags: ${last}`);
|
||||
assert.ok(profile.includes('`--profile <name>`: set `profile = {name}`; strip both tokens'),
|
||||
`the rule before the last one is not the --profile strip rule: ${profile}`);
|
||||
});
|
||||
|
||||
test('[#30] the usage block names --profile and --gates, and its --profile line keeps the helper and the controller on opus', () => {
|
||||
const usage = partAt(EXEC, 'Usage: /trekexecute <plan.md>', (l) => l.startsWith('```'));
|
||||
assert.ok(usage.includes('/trekexecute --profile <name> <plan.md>'), 'the usage block has no --profile line');
|
||||
assert.ok(usage.includes(`--profile Profile for this run's resolver; ${SAME_ON_OPUS}`),
|
||||
'the Modes list has no --profile line, or it does not keep the helper and the controller on opus');
|
||||
assert.ok(usage.includes('--gates Record gates_mode: bare, true or closed = on; false or open = off'),
|
||||
'the Modes list has no --gates line');
|
||||
});
|
||||
|
||||
test('[#30] sibling: Profile section says the profile changes no model here', () => {
|
||||
const f = flat(section(read(EXEC), '## Profile (v4.1)'));
|
||||
assert.doesNotMatch(f, /drives `phase_models\.execute`/, 'the Profile section still says the profile drives the execute model');
|
||||
assert.ok(f.includes('The selected profile goes to the resolver. It changes no model here: the step helper and the '
|
||||
+ 'controller run opus (Composition rule below), and nothing in this command reads `parallel_agents`.'),
|
||||
'the Profile section does not say the profile changes no model here');
|
||||
});
|
||||
|
||||
test('[#30] sibling: docs/command-modes.md /trekexecute --profile row keeps the helper and the controller on opus', () => {
|
||||
const sec = section(read('docs/command-modes.md'), '## /trekexecute modes');
|
||||
const rows = sec.split('\n').filter((l) => l.startsWith('| `--profile <name>` |'));
|
||||
assert.equal(rows.length, 1, 'expected one --profile row under /trekexecute modes');
|
||||
assert.doesNotMatch(rows[0], /Model profile for the execute phase/);
|
||||
assert.ok(rows[0].includes(`| (v4.1.0) Profile for this run's resolver; ${SAME_ON_OPUS}.`), rows[0]);
|
||||
});
|
||||
|
||||
test('[#30] sibling: README.md /trekexecute Profile row keeps the helper and the controller on opus', () => {
|
||||
const rows = read('README.md').split('\n').filter((l) => l.startsWith('| **Profile** | `/trekexecute '));
|
||||
assert.equal(rows.length, 1, 'expected one /trekexecute Profile row in README.md');
|
||||
assert.doesNotMatch(rows[0], /Pin model profile for execution/);
|
||||
assert.ok(rows[0].includes(`| (v4.1.0) Profile for this run's resolver; ${SAME_ON_OPUS}.`), rows[0]);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue