Skip to content

Accept an initial prompt argument in the freebuff CLI - #1477

Open
ojspace wants to merge 1 commit into
CodebuffAI:mainfrom
ojspace:feat/freebuff-initial-prompt-arg
Open

ojspace wants to merge 1 commit into
CodebuffAI:mainfrom
ojspace:feat/freebuff-initial-prompt-arg

Conversation

@ojspace

@ojspace ojspace commented Oct 3, 2026

Copy link
Copy Markdown

What

Let the freebuff CLI accept an initial prompt as a positional argument, the way codebuff already does:

freebuff "add a dark mode toggle"
freebuff --cwd ~/shop-app "fix the failing checkout test"

login stays the one command. Any other first word is the start of the prompt, so freebuff publish the release notes is a prompt, not the codebuff publish command (which Freebuff does not expose).

Why

Today the Freebuff build strips the [prompt...] argument, so freebuff "say hi" fails with:

error: command-argument value 'say hi' is invalid for argument 'command'. Allowed choices are login.

That is the one thing that keeps Freebuff out of every tool that opens a coding agent in a terminal with a task already typed in: multi-agent orchestrators, tmux/zellij launchers, editor and IDE "open agent with this prompt" actions, shell aliases, scripts that start a TUI session. All of those already drive claude, codex, opencode, kilo, copilot, goose and codebuff this way; Freebuff is the only one they have to launch empty, so it is the one they leave out of their agent picker. See #947 for the longer story.

How it keeps ads and sessions intact

Nothing about the run path changes. The prompt goes through the same initialPrompt prop and useChatInput effect codebuff uses, which calls onSubmitPrompt -> routeUserPrompt -> the message queue. With no live session the queue holds the text and useFreebuffChatAdmission starts the session with the saved model exactly as if the user had typed it on the landing screen. The landing screen, the ad dock, inline ads, Freebucks confirmation, country/rate-limit notices and the takeover prompt all render as before; this only pre-fills what the user would have typed. Every ad impression happens in the Freebuff TUI, same as today.

This is deliberately not a headless mode. A --print / NDJSON mode (the other half of #947) needs an answer for where ads go, and that is a product decision for the Freebuff team; this PR is the part that has no such question.

Changes

  • cli/src/cli-args.ts: Freebuff branch accepts [prompt...]; login is detected as a command only when it is the first word; the Argument import is gone. The help text gains a Commands: footer matching codebuff's.
  • cli/src/__tests__/cli-args.test.ts: new Freebuff cases (joined prompt, prompt with --cwd and --continue, command-word prompt). login still parses as a command with no prompt.
  • README.md: one quick-start example.

Verification

  • cd cli && bun test src/__tests__/cli-args.test.ts: 20 pass (17 before).
  • freebuff -h now prints Usage: freebuff [options] [prompt...] with the Commands: login footer.
  • bun run typecheck in cli/ reports the same 18 pre-existing sdk/src/impl/llm.ts provider-options errors on main and on this branch; none in the touched files.
  • Note for maintainers: the public export's cli/bunfig.toml preloads ../test/setup-scm-loader.ts, which is not in the export, so bun test cannot start without a local shim (related to cli: restore the .scm preload so cd cli && bun test starts #1363).

🤖 Generated with Claude Code

https://claude.ai/code/session_01HgZQgjCVwHjmWGErkMdAUu

The Freebuff build stripped the `[prompt...]` positional that codebuff
accepts, so `freebuff "say hi"` failed with "invalid for argument
'command'". Every tool that opens a coding agent in a terminal with the
task already typed in (orchestrators, tmux launchers, editor and IDE
actions, scripts) could drive codebuff, claude, codex, opencode, kilo and
copilot this way but not Freebuff.

Accept `[prompt...]` in the Freebuff branch of the parser. `login` stays
the only command and is recognised only as the first word, so a prompt
that begins with a codebuff command word (`publish ...`) remains a
prompt. The text flows through the existing initialPrompt -> useChatInput
-> message queue -> chat admission path, so the session, landing screen
and ad surfaces behave exactly as when the user types.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgZQgjCVwHjmWGErkMdAUu

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant