Skip to content

feat(cli): add hidden login shortcut for auth login - #65263

Merged
rekram1-node merged 3 commits into
devfrom
feat/cli-login-alias
Nov 20, 2026
Merged

rekram1-node merged 3 commits into
devfrom
feat/cli-login-alias

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

opencode login now works as a shortcut for opencode auth login, but it stays out of opencode --help and shell completions. auth login is 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) servers

The top-level login command reuses the same params ([target], --method, --answer), the same --standalone / --server flags and the same handlers/auth/login handler. opencode login --help still prints its own help.

To hide it I added a hidden option to Spec.make that just applies Effect's Command.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.ts runs the real command tree in-process: root help doesn't list login, login --help matches auth login --help, and both commands parse the same args and --server into the same input. The help test fails if I drop hidden: true.
  • Ran opencode login and opencode auth login without a TTY: same "Pass an integration ID or name" error
  • opencode --completions zsh only lists login under auth
  • bun run check, plus the cli auth and server-connection tests

Screenshots / recordings

N/A, CLI only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Requested by: @rekram1-node (Aiden Cline via Slack)


Added by the opencode bot (AI-generated).

Public API: adds a hidden top-level opencode login shortcut for opencode auth login (backwards compatible)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rekram1-node rekram1-node changed the title feat(cli): add login as an alias for auth login feat(cli): add hidden login shortcut for auth login Nov 20, 2026

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rekram1-node
rekram1-node merged commit f670a07 into dev Nov 20, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the feat/cli-login-alias branch November 20, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants