Skip to content

Conversation

@drtootsie
Copy link

Implements multi-account support allowing users to configure multiple GitHub accounts with automatic switching based on repository context.

Key features:

  • Account configuration via JSON file with --accounts-config flag
  • Automatic account selection based on organization or repository patterns
  • Environment variable expansion for tokens (e.g., ${GITHUB_WORK_TOKEN})
  • Three matcher types: org (organization), repo_pattern (wildcards), all
  • Backward compatible: single GITHUB_PERSONAL_ACCESS_TOKEN still works
  • Default account fallback when no match found

Implementation:

  • pkg/accounts: Core account routing logic with Config, Router, and matcher system
  • Comprehensive test coverage with multiple matching scenarios
  • CLI flag: --accounts-config
  • Example configuration in accounts.example.json

Use cases:

  • Work + personal GitHub accounts (EMU-friendly)
  • Multiple organization access
  • Repository-specific authentication

Fixes #1940

🤖 Generated with Claude Code

Summary

Why

Fixes #

What changed

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Implements multi-account support allowing users to configure multiple
GitHub accounts with automatic switching based on repository context.

Key features:
- Account configuration via JSON file with --accounts-config flag
- Automatic account selection based on organization or repository patterns
- Environment variable expansion for tokens (e.g., ${GITHUB_WORK_TOKEN})
- Three matcher types: org (organization), repo_pattern (wildcards), all
- Backward compatible: single GITHUB_PERSONAL_ACCESS_TOKEN still works
- Default account fallback when no match found

Implementation:
- pkg/accounts: Core account routing logic with Config, Router, and matcher system
- Comprehensive test coverage with multiple matching scenarios
- CLI flag: --accounts-config <path-to-json>
- Example configuration in accounts.example.json

Use cases:
- Work + personal GitHub accounts (EMU-friendly)
- Multiple organization access
- Repository-specific authentication

Fixes github#1940

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@drtootsie drtootsie requested a review from a team as a code owner February 3, 2026 00:56
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.

Add multi-account support for client-side account switching

1 participant