Skip to content

Add --model / -m flag for headless (-p) mode #383

@vipulgupta2048

Description

@vipulgupta2048

Feature Description

Add a --model (and short -m) flag for headless / -p (print) mode so the model can be selected from non-interactive runs.

cmd -p "" --model deepseek-v4-pro
cmd -p "" -m deepseek-v4-pro

Accept the same model IDs the interactive /model picker shows.

Current state in v0.26.7:

  • /model and Alt+P only work in TTY interactive sessions
  • CMD_MODEL=deepseek-v4-pro cmd -p … is ignored — still returns the server-side default
  • cmd config errors with Interactive mode requires a TTY
  • Result: any script / CI / agent loop is locked to Claude Sonnet, regardless of prior interactive selection

Reproducer:

# interactive — set /model to DeepSeek V4 Pro, exit
cmd
> /model
> [select DeepSeek V4 Pro]
> /exit

# headless ignores the interactive selection
cmd -p "Reply with only your model identifier." --skip-onboarding --yolo
# → claude-3-5-sonnet-20241022

How other coding CLIs solve it (all support headless model selection):

codex exec --model gpt-5.5 ""             # OpenAI Codex
kimi --print -m kimi-k2-thinking -p ""    # Moonshot Kimi
gemini --yolo -m gemini-3.1-pro -p ""     # Google Gemini
claude --print --model claude-opus-4-7 "" # Anthropic Claude Code

Use Case

Wiring cmd into a multi-CLI factory automation loop (codex / kimi / gemini already integrated). The reason to add cmd to the loop is specifically DeepSeek V4 Pro — best open-source SWE-bench coder. Without headless model selection, cmd -p returns the same Claude Sonnet I already get from claude --print, so there is no reason to route through cmd at all. This defeats the value prop of having multiple model providers behind one CLI.

Additional Context

  • Version: v0.26.7
  • Flags tried that don't help: --skip-onboarding, --yolo
  • Env vars tried: CMD_MODEL (ignored)
  • cmd config is unusable in non-TTY contexts

How important is this to you?

Blocking adoption or production use

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions