fix(cleanup): R-b review round — retired flags in the prose parsers

/code-review high on main..HEAD: the four commands that parse their own
arguments in prose (/trekbrief, /trekplan, /trekresearch, /trekexecute) lost
their --profile handling, and /trekresearch its --engine, so a typed value
became the path or the question. Each now strips a retired flag with its
value; the arg parser retires --profile only for the commands that had it
(not /trekendsession) and --engine for /trekresearch, seen red first.
Stale lines R-b left: architecture's hook row (9 scripts) and bridge agent,
the gap row's removed event ledger, README's contrarian marker, and a
dangling "also" in /trekexecute Phase 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-11-07 21:36:13 +01:00
commit b70c37f0e7
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
11 changed files with 41 additions and 18 deletions

View file

@ -13,9 +13,15 @@
import { readFileSync } from 'node:fs';
import { isMain } from '../util/is-main.mjs';
// Flags retired with a value (cleanup R-b): the flag and the word after it,
// when that word is not a flag, are consumed and dropped, never an error.
const RETIRED_VALUED = ['--profile'];
// Flags retired with a value (cleanup R-b), per command that had them: the
// flag and the word after it, when that word is not a flag, are consumed and
// dropped, never an error.
const RETIRED_PROFILE = ['--profile'];
const RETIRED_VALUED = {
trekbrief: RETIRED_PROFILE, trekplan: RETIRED_PROFILE, trekexecute: RETIRED_PROFILE,
trekreview: RETIRED_PROFILE, trekcontinue: RETIRED_PROFILE,
trekresearch: [...RETIRED_PROFILE, '--engine'],
};
const FLAG_SCHEMA = {
trekbrief: {
@ -115,7 +121,7 @@ export function parseArgs(argString, command) {
continue;
}
if (RETIRED_VALUED.includes(tok)) {
if ((RETIRED_VALUED[command] || []).includes(tok)) {
if (i + 1 < tokens.length && !tokens[i + 1].startsWith('--')) i++;
continue;
}