Repository navigation
Conversation
|
Good catch and a sensible fix. The root cause description is accurate: A few things worth double-checking before this lands:
Tests are present and cover the four cases that matter, including the untouched Codebuff path. This is a focused, in-scope change with a clear cause and a plausible fix - worth a maintainer's time to verify against the private tree's actual Freebuff CLI behavior. |
freebuff "fix the flaky login test" fails with "command-argument value ... is invalid for argument 'command'", because the Freebuff branch declares its positional with choices(['login', 'doctor']). That check runs before the prompt is used, so the initialPrompt the TUI already accepts can never be set from argv, and a launcher has no way to start a session with its task except by typing into the TUI. Take bare words as the initial prompt the way the Codebuff branch already does, while keeping login and doctor as commands.
59bc217 to
72d6334
Compare
freebuff "fix the flaky login test"exits with:The Freebuff branch of
parseArgsdeclares its positional withchoices(['login', 'doctor']), so validation runs before the prompt is used.The TUI already accepts an
initialPromptthreaded fromparseArgsinto thechat component, but the return object hardcodes
initialPrompt: !isFreebuff && args.length > 0 ? ... : null, so a Freebuffbuild can never set it from argv.
That blocks launchers. Agent of Empires starts an agent in a tmux pane with
--extra-argsappended to the launch line, and its dotfiles already pass afirst task that way for other agents (
-- '<prompt>'). For Freebuff there isnothing to hand the task to, so the only workaround is typing into the TUI,
which is what a launcher exists to avoid.
This change accepts bare words as the initial prompt the way the Codebuff
branch already does, and keeps
loginanddoctoras commands:freebuff "fix the flaky login test"initialPrompt: "fix the flaky login test"freebuff logincommand: "login",initialPrompt: nullfreebuff --trust-agents fix ittrustAgents: true,initialPrompt: "fix it"freebuff /importcommand: "/import",initialPrompt: nullTests: five cases in
cli/src/__tests__/cli-args.test.tscovering those shapes,/import, a command followed by extra words, and the unchanged Codebuff path.No dependency changes. The full file runs green with a real
bun install(22 pass, 0 fail).
Tradeoff: dropping
choices()also drops theinvalid for argument 'command'error for near-miss typos like
freebuff logn, which now becomes an initialprompt instead. That is the cost of letting a launcher pass a task, and it is
the behavior Codebuff already has.
.allowExcessArguments(true)is not carriedover from the Codebuff branch: the variadic
[prompt...]positional alreadyabsorbs the remaining words, so Freebuff keeps its argument validation as
strict as it was.