Skip to content

Alias top-level auth commands - #3754

Merged
lawrencecchen merged 1 commit into
mainfrom
feat-cli-auth-aliases
May 8, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
feat-cli-auth-aliases

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Route cmux login and cmux logout through existing auth login/logout handling
  • Add help text for both top-level aliases
  • Add CLI integration coverage for both aliases

Verification

  • ./scripts/reload.sh --tag authalias
  • built CLI: cmux login --help, cmux logout --help, cmux --help | rg ...
  • xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -configuration Debug -destination 'platform=macOS' -derivedDataPath /Users/lawrence/Library/Developer/Xcode/DerivedData/cmux-authalias build-for-testing

Note

Low Risk
Low risk: adds CLI command aliases and help text, plus integration tests, without changing the underlying auth RPC behavior.

Overview
Adds top-level cmux login and cmux logout commands as aliases that route through the existing auth login/logout code path (by rewriting args so the same subcommand handler runs).

Updates CLI help output to document the new aliases (including cmux --help and per-command help), and adds integration tests (CLIAuthAliasTests) to verify the aliases invoke auth.begin_sign_in/auth.sign_out and produce the expected stdout.

Reviewed by Cursor Bugbot for commit 6e1476d. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Add top-level cmux login and cmux logout aliases that invoke the existing auth flow. This improves discoverability without changing behavior.

  • New Features
    • Help text for login/logout aliases; root help lists both.
    • Integration tests validate alias behavior and underlying RPC calls.

Written for commit 6e1476d. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

  • New Features
    • The login and logout commands are now available as convenient aliases for auth login and auth logout, streamlining your CLI experience.

@vercel

vercel Bot commented May 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment May 8, 2026 10:04pm
cmux-staging Building Building Preview, Comment May 8, 2026 10:04pm

@coderabbitai

coderabbitai Bot commented May 8, 2026 •

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 006721e5-f344-4abc-8ede-abd0efc2155a

📥 Commits

Reviewing files that changed from the base of the PR and between a89aaf1 and 6e1476d.

📒 Files selected for processing (3)
  • CLI/cmux.swift
  • GhosttyTabs.xcodeproj/project.pbxproj
  • cmuxTests/CLIAuthAliasTests.swift

📝 Walkthrough

Walkthrough

The PR adds top-level login and logout command aliases that route to auth login and auth logout. The dispatcher normalizes arguments and delegates to the existing auth handler. User-facing help and documentation explain the aliases. Two integration tests with Unix socket mocking verify the alias behavior end-to-end, and the Xcode project is updated to compile the new test file.

Changes

Login/Logout Alias Implementation

Layer / File(s) Summary
Command Dispatch Logic
CLI/cmux.swift
Command dispatcher expands to handle "login" and "logout" by normalizing arguments into an authArgs array and delegating to the auth handler with extracted subcommand.
User-Facing Help & Documentation
CLI/cmux.swift
Help/docs switch adds documentation blocks for login and logout as aliases; capabilities output lists login | logout as aliases for auth subcommands.
Integration Tests
cmuxTests/CLIAuthAliasTests.swift
Two integration tests verify alias behavior: testTopLevelLoginAliasesAuthLogin confirms login triggers auth.begin_sign_in; testTopLevelLogoutAliasesAuthLogout confirms logout triggers auth.sign_out. Both mock the auth server over Unix socket.
Build Configuration
GhosttyTabs.xcodeproj/project.pbxproj
Xcode project registers CLIAuthAliasTests.swift in PBXBuildFile, PBXFileReference, cmuxTests group children, and test target source phase.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • manaflow-ai/cmux#2103: Both PRs modify top-level command dispatch in CLI/cmux.swift, adding additional top-level command aliases/handlers to the main dispatcher switch.

Poem

🐰 Hop, hop—now login's quick to spell,
No auth prefix, just cmux login works well!
Aliases hop through, the dispatcher knows,
Tests mock the server as auth flow goes. ✨

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Alias top-level auth commands' clearly and concisely summarizes the main change of adding login/logout as aliases for auth login/logout.
Description check ✅ Passed The description covers the summary, verification steps, and includes automated reviews, but is missing the Testing section structure and checklist items from the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed No new types or isolation concerns introduced. Only command routing and help text modified. Test and config files excluded per rules.
Cmux Swift Blocking Runtime ✅ Passed No blocking synchronization introduced in production code. Test-only scaffolding (DispatchSemaphore, NSLock) is permitted per review rules.
Cmux No Hacky Sleeps ✅ Passed Rule scope is TypeScript, JavaScript, shell, and non-Swift runtime scripts only. PR contains only Swift code and Xcode config, which are explicitly out of scope. Swift is covered by a separate rule.
Cmux Swift Concurrency ✅ Passed PR introduces no legacy async patterns. Auth alias code uses synchronous client.sendV2() calls. Tests use standard XCTest with runProcess() and wait(for:), which is allowed for XCTest boundaries.
Cmux Swift @Concurrent ✅ Passed No violations of swift-concurrent-annotation rules. No new async functions, @concurrent annotations, or actor isolation patterns introduced. Auth handlers use synchronous sendV2() calls.
Cmux Swift File And Package Boundaries ✅ Passed Only 14 net lines added to CLI/cmux.swift (20.5K line file). Well under 250-line threshold for existing oversized files. Focused alias routing change with no new responsibilities.
Cmux Swift Logging ✅ Passed PR adds alias routing and help text with no new logging statements. Existing print calls are for CLI output (allowed). Test file is exempt. No secrets exposed. Complies with swift-logging.md rules.
Cmux Swiftui State Layout ✅ Passed PR contains no SwiftUI code. Changes are CLI command routing, test infrastructure, and Xcode project metadata. SwiftUI state layout check is not applicable.
Cmux Architecture Rethink ✅ Passed PR implements clean command aliasing with single shared action path, no timing repairs, no new mutable state, and test-only sync patterns only.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR introduces CLI command aliasing and test-only fixtures with no NSWindow/NSPanel/NSWindowController/SwiftUI Window creation. Changes do not violate the auxiliary window close shortcuts rule.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-cli-auth-aliases

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds cmux login and cmux logout as top-level aliases for cmux auth login and cmux auth logout by extending the command dispatch switch and prepending the command name to commandArgs before the subcommand resolution, with help text and integration tests for both aliases.

  • CLI routing (CLI/cmux.swift): The \"auth\" case is expanded to \"auth\", \"login\", \"logout\"; for non-auth commands authArgs is built as [command] + commandArgs so sub always resolves to the invoked alias name, correctly routing to the existing login/logout branches without duplicating any logic.
  • Help text (CLI/cmux.swift): New \"login\" and \"logout\" help blocks and a global-help-text line documenting the aliases are added.
  • Tests (cmuxTests/CLIAuthAliasTests.swift): Two end-to-end integration tests (one per alias) exercise the full socket round-trip using the existing mock-server harness.

Confidence Score: 5/5

The change is additive and narrowly scoped: it wires two new top-level commands to an already-tested code path without touching auth state management, token handling, or any shared production state.

The alias construction ([command] + commandArgs) is correct — sub always resolves to the alias name for the login/logout cases, the default error branch is unreachable from the alias paths, and the --help dispatch is updated consistently. Integration tests exercise the full socket round-trip for both aliases and assert the right RPC methods are called. No concurrent, actor-isolation, logging, or architectural concerns are introduced.

No files require special attention.

Important Files Changed

Filename Overview
CLI/cmux.swift Extends the auth command switch to handle "login" and "logout" as top-level aliases; routing logic via [command] + commandArgs prepend is correct and the fallback "status" default is unreachable for the alias paths. Help text is consistent.
cmuxTests/CLIAuthAliasTests.swift New integration test file covering both aliases end-to-end against a mock Unix-socket server; assertions cover exit code, stdout, and the specific RPC method dispatched.
GhosttyTabs.xcodeproj/project.pbxproj Registers the new CLIAuthAliasTests.swift source file in the Xcode project; build file, file reference, group entry, and Sources phase entry are all consistently added.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[cmux command] --> B{command?}
    B -->|auth| C[authArgs = commandArgs]
    B -->|login| D[authArgs = login + commandArgs]
    B -->|logout| E[authArgs = logout + commandArgs]
    C --> F[sub = authArgs.first or status]
    D --> F
    E --> F
    F --> G{sub?}
    G -->|status| H[auth.status RPC]
    G -->|login| I[auth.status then auth.begin_sign_in RPC]
    G -->|logout| J[auth.status then auth.sign_out RPC]
    G -->|other| K[CLIError]
Loading

Reviews (1): Last reviewed commit: "Alias top-level auth commands" | Re-trigger Greptile

@lawrencecchen
lawrencecchen merged commit 2d447fd into main May 8, 2026
25 checks passed
@lawrencecchen
lawrencecchen deleted the feat-cli-auth-aliases branch May 8, 2026 22:16

This branch was successfully deployed

1 active deployment
Preview – cmux — 6e1476d7 Deployed May 8, 2026 by vercel[bot]
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.

1 participant