feat(cli): bare agent opens a connected session#46
Merged
Conversation
Rewrite a bare `agent` invocation (no args) to `agent session start --connect`, so the default entry point drops straight into a fresh connected session. Gated strictly on argv having no operands, so `agent --help`/`--version` still print the full top-level help and every subcommand dispatches unchanged.
Broaden the bare-invocation shorthand into a catch-all: any first arg that isn't a known subcommand or a top-level help/version request is treated as `agent session start --connect ...`, so `agent "fix the tests" --model ...` forwards the prompt and every trailing flag through to a fresh connected session. Top-level help/version and every subcommand still dispatch unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Any
agentinvocation that isn't a known subcommand or a top-level--help/--versionis now shorthand foragent session start --connect ..., forwarding the prompt and every trailing flag into a fresh connected session:agent→ opens a connected sessionagent "fix the tests"→agent session start --connect "fix the tests"agent "fix the tests" --model claude-opus-4-8→ prompt + all flags forwardedagent --model claude-opus-4-8 "fix"→ leading flags forwarded tooHow
src/cli.tsxinspects the first arg before parsing. If it's a known subcommand (or an alias), or a top-level-h/--help/-V/--version/help, it dispatches unchanged. Otherwise it splicessession start --connectin front of the args:Verification
bun run typecheckpasses, and each dispatch path resolves correctly (checked via--helpso nothing spends money):agent --helpagent "fix the tests" --helpsession start(prompt + flags forwarded)agent --model x "fix" --helpsession start(leading flag forwarded)agent session list --helpagent --versionCaveats
agent lets fix the tests(unquoted) becomes four positionals andstarttakes one[prompt], so Commander errors with "too many arguments". Quoted works.start --connectthe default.