Skip to content

feat: add --agent/--model/--session CLI startup commands - #2129

Open
xielixing wants to merge 1 commit into
GCWing:mainfrom
xielixing:fix/issue-2095-cli-startup-args
Open

feat: add --agent/--model/--session CLI startup commands#2129
xielixing wants to merge 1 commit into
GCWing:mainfrom
xielixing:fix/issue-2095-cli-startup-args

Conversation

@xielixing

Copy link
Copy Markdown

Summary

Adds --agent, --model, and --session CLI startup commands to the BitFun desktop app, enabling users to launch the app pre-configured with a specific agent type, model, and/or session to restore.

Closes #2095

Changes

Rust (desktop app)

  • src/apps/desktop/src/lib.rs: Added StartupCommand struct and parse_startup_command() function. The run() method calls it at startup and passes the parsed command through .setup() to create_main_window.
  • src/apps/desktop/src/appearance.rs: generate_init_script and create_main_window accept an optional startup_command parameter. Injects window.__BITFUN_STARTUP_COMMAND__ as a JSON constant (4KB max).

TypeScript (web-ui)

  • src/web-ui/src/shared/types/global-state.ts: Added StartupCommand interface, consumeBootstrapStartupCommand() one-shot reader, and getStartupCommand() in the globalStateAPI export.
  • src/web-ui/src/flow_chat/hooks/useFlowChat.ts: createSession now consumes startup command overrides:
    • --agent: overrides the agent type for the first session
    • --model: overrides the model name for the first session
    • --session: tries to restore an existing session by ID before creating a new one (falls back to new session creation if not found)

Usage

# Start with a specific agent and model
BitFun --agent plan --model gpt-4o

# Restore a previous session
BitFun --session <session-id>

# Combine all three
BitFun --agent agentic --model claude-sonnet-4 --session abc123

Validation

  • TypeScript: tsc --noEmit passes
  • Rust: cargo check -p bitfun-desktop passes
  • Rust tests: cargo test -p bitfun-desktop appearance::tests — 3/3 passed

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.

[Feature]: 新增--agent --model --session 命令

1 participant