Repository navigation
feat(cli): add hidden login shortcut for auth login - #65263
Conversation
There was a problem hiding this comment.
The change works as described. With this branch, opencode login shows the same arguments, flags and global --standalone/--server flags as opencode auth login. It also runs the same handler: in non-interactive runs and with an unknown integration under --standalone, the two commands print identical errors. The new test and the existing auth tests pass, and tsc -b is clean.
Public API: this adds a top-level opencode login [<target>] [--method] [--answer] command, with --standalone/--server, as an alias of opencode auth login. It is backwards compatible: auth login is unchanged. The one side effect is that opencode login no longer opens a directory named login as the positional directory argument, which is already the case for every other subcommand name.
I have no blocking concerns.
7239199 to
cde3175
Compare
There was a problem hiding this comment.
The new commit hides the shortcut as intended. Root --help, shell completions and typo suggestions no longer show login, and opencode login still parses and runs exactly like opencode auth login. I checked this by running the CLI from source. The reworked in-process test and the auth and server-connection tests pass (20/20), and tsc -b is clean.
Public API: this adds a hidden top-level opencode login [<target>] [--method] [--answer] command, with --standalone/--server, that behaves like opencode auth login. It is backwards compatible: auth login is unchanged. The hidden option on Spec.make is internal to the CLI.
I have no new concerns.
There was a problem hiding this comment.
The new commit is a test fix. #65262 landed on dev with default-directory.test.ts using opencode login as its missing-directory example, which this PR now turns into a real command, so the test now uses a name that isn't a command and still checks the same behaviour. I ran the CLI from source: opencode login still reaches the auth login handler, and an unknown name still gets the "No directory or command named" help. The CLI tests pass and tsc -b is clean.
Public API: unchanged since my last review. It adds a hidden top-level opencode login shortcut for opencode auth login and is backwards compatible.
I have no new concerns.
Issue for this PR
Closes #
Type of change
What does this PR do?
opencode loginnow works as a shortcut foropencode auth login, but it stays out ofopencode --helpand shell completions.auth loginis still the advertised command and doesn't change.$ opencode --help auth manage integrations and credentials - login Connect an integration (alias for auth login) mcp Manage MCP (Model Context Protocol) serversThe top-level
logincommand reuses the same params ([target],--method,--answer), the same--standalone/--serverflags and the samehandlers/auth/loginhandler.opencode login --helpstill prints its own help.To hide it I added a
hiddenoption toSpec.makethat just applies Effect'sCommand.unlisted. Effect already keeps unlisted commands out of parent help, completions and typo suggestions while still parsing them, so there's no argv rewriting and no second command tree.How did you verify your code works?
test/login-alias.test.tsruns the real command tree in-process: root help doesn't listlogin,login --helpmatchesauth login --help, and both commands parse the same args and--serverinto the same input. The help test fails if I drophidden: true.opencode loginandopencode auth loginwithout a TTY: same "Pass an integration ID or name" erroropencode --completions zshonly listsloginunderauthbun run check, plus the cli auth and server-connection testsScreenshots / recordings
N/A, CLI only.
Checklist
Requested by: @rekram1-node (Aiden Cline via Slack)
Added by the opencode bot (AI-generated).
Public API: adds a hidden top-level
opencode loginshortcut foropencode auth login(backwards compatible)