llmswap-cli 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. llmswap_cli-1.0.0/.github/FUNDING.yml +2 -0
  2. llmswap_cli-1.0.0/.github/ISSUE_TEMPLATE/bug_report.yml +53 -0
  3. llmswap_cli-1.0.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. llmswap_cli-1.0.0/.github/ISSUE_TEMPLATE/feature_request.yml +16 -0
  5. llmswap_cli-1.0.0/.github/pull_request_template.md +14 -0
  6. llmswap_cli-1.0.0/.github/workflows/ci.yml +62 -0
  7. llmswap_cli-1.0.0/.github/workflows/publish.yml +29 -0
  8. llmswap_cli-1.0.0/.gitignore +19 -0
  9. llmswap_cli-1.0.0/.python-version +1 -0
  10. llmswap_cli-1.0.0/.vscode/launch.json +60 -0
  11. llmswap_cli-1.0.0/AGENTS.md +47 -0
  12. llmswap_cli-1.0.0/CONTRIBUTING.md +80 -0
  13. llmswap_cli-1.0.0/LICENSE +22 -0
  14. llmswap_cli-1.0.0/PKG-INFO +181 -0
  15. llmswap_cli-1.0.0/README.md +149 -0
  16. llmswap_cli-1.0.0/assets/banner.png +0 -0
  17. llmswap_cli-1.0.0/assets/cswap-list.png +0 -0
  18. llmswap_cli-1.0.0/assets/tui-watch.png +0 -0
  19. llmswap_cli-1.0.0/docs/architecture.md +151 -0
  20. llmswap_cli-1.0.0/docs/auto-switch.md +78 -0
  21. llmswap_cli-1.0.0/docs/claude-code.md +455 -0
  22. llmswap_cli-1.0.0/docs/feature-map.md +39 -0
  23. llmswap_cli-1.0.0/docs/img/dashboard.svg +245 -0
  24. llmswap_cli-1.0.0/docs/img/list.svg +142 -0
  25. llmswap_cli-1.0.0/docs/json-output.md +88 -0
  26. llmswap_cli-1.0.0/docs/menubar.md +38 -0
  27. llmswap_cli-1.0.0/docs/providers.md +51 -0
  28. llmswap_cli-1.0.0/docs/session-mode.md +119 -0
  29. llmswap_cli-1.0.0/docs/warm-up.md +53 -0
  30. llmswap_cli-1.0.0/pyproject.toml +74 -0
  31. llmswap_cli-1.0.0/src/claude_swap/__init__.py +24 -0
  32. llmswap_cli-1.0.0/src/claude_swap/__main__.py +6 -0
  33. llmswap_cli-1.0.0/src/claude_swap/app_bundle.py +330 -0
  34. llmswap_cli-1.0.0/src/claude_swap/appearance.py +219 -0
  35. llmswap_cli-1.0.0/src/claude_swap/autoswitch.py +3065 -0
  36. llmswap_cli-1.0.0/src/claude_swap/cache.py +44 -0
  37. llmswap_cli-1.0.0/src/claude_swap/claude_locks.py +279 -0
  38. llmswap_cli-1.0.0/src/claude_swap/cli.py +2265 -0
  39. llmswap_cli-1.0.0/src/claude_swap/credentials.py +2156 -0
  40. llmswap_cli-1.0.0/src/claude_swap/exceptions.py +102 -0
  41. llmswap_cli-1.0.0/src/claude_swap/fsutil.py +409 -0
  42. llmswap_cli-1.0.0/src/claude_swap/json_output.py +455 -0
  43. llmswap_cli-1.0.0/src/claude_swap/launch_agent.py +862 -0
  44. llmswap_cli-1.0.0/src/claude_swap/lines.py +153 -0
  45. llmswap_cli-1.0.0/src/claude_swap/list_view.py +371 -0
  46. llmswap_cli-1.0.0/src/claude_swap/locking.py +87 -0
  47. llmswap_cli-1.0.0/src/claude_swap/logging_config.py +64 -0
  48. llmswap_cli-1.0.0/src/claude_swap/macos_keychain.py +240 -0
  49. llmswap_cli-1.0.0/src/claude_swap/mappings.py +127 -0
  50. llmswap_cli-1.0.0/src/claude_swap/menubar.py +1433 -0
  51. llmswap_cli-1.0.0/src/claude_swap/migrations.py +360 -0
  52. llmswap_cli-1.0.0/src/claude_swap/models.py +329 -0
  53. llmswap_cli-1.0.0/src/claude_swap/oauth.py +1628 -0
  54. llmswap_cli-1.0.0/src/claude_swap/pace.py +161 -0
  55. llmswap_cli-1.0.0/src/claude_swap/paths.py +250 -0
  56. llmswap_cli-1.0.0/src/claude_swap/poll_policy.py +337 -0
  57. llmswap_cli-1.0.0/src/claude_swap/printer.py +252 -0
  58. llmswap_cli-1.0.0/src/claude_swap/process_detection.py +370 -0
  59. llmswap_cli-1.0.0/src/claude_swap/session.py +2696 -0
  60. llmswap_cli-1.0.0/src/claude_swap/settings.py +827 -0
  61. llmswap_cli-1.0.0/src/claude_swap/signin.py +238 -0
  62. llmswap_cli-1.0.0/src/claude_swap/snapshot_source.py +121 -0
  63. llmswap_cli-1.0.0/src/claude_swap/spawn.py +135 -0
  64. llmswap_cli-1.0.0/src/claude_swap/subscription.py +349 -0
  65. llmswap_cli-1.0.0/src/claude_swap/switcher.py +9807 -0
  66. llmswap_cli-1.0.0/src/claude_swap/transfer.py +807 -0
  67. llmswap_cli-1.0.0/src/claude_swap/tui/__init__.py +43 -0
  68. llmswap_cli-1.0.0/src/claude_swap/tui/app.py +482 -0
  69. llmswap_cli-1.0.0/src/claude_swap/tui/autoview.py +381 -0
  70. llmswap_cli-1.0.0/src/claude_swap/tui/cswap.tcss +205 -0
  71. llmswap_cli-1.0.0/src/claude_swap/tui/dashboard.py +434 -0
  72. llmswap_cli-1.0.0/src/claude_swap/tui/data.py +194 -0
  73. llmswap_cli-1.0.0/src/claude_swap/tui/modals.py +159 -0
  74. llmswap_cli-1.0.0/src/claude_swap/tui/theme.py +88 -0
  75. llmswap_cli-1.0.0/src/claude_swap/tui/widgets.py +544 -0
  76. llmswap_cli-1.0.0/src/claude_swap/update_check.py +509 -0
  77. llmswap_cli-1.0.0/src/claude_swap/usage_bars.py +208 -0
  78. llmswap_cli-1.0.0/src/claude_swap/usage_rows.py +160 -0
  79. llmswap_cli-1.0.0/src/claude_swap/usage_store.py +1429 -0
  80. llmswap_cli-1.0.0/src/llmswap/AGENTS.md +11 -0
  81. llmswap_cli-1.0.0/src/llmswap/__init__.py +3 -0
  82. llmswap_cli-1.0.0/src/llmswap/__main__.py +4 -0
  83. llmswap_cli-1.0.0/src/llmswap/cli.py +535 -0
  84. llmswap_cli-1.0.0/src/llmswap/config.py +101 -0
  85. llmswap_cli-1.0.0/src/llmswap/httpjson.py +50 -0
  86. llmswap_cli-1.0.0/src/llmswap/jwt.py +20 -0
  87. llmswap_cli-1.0.0/src/llmswap/menubar.py +218 -0
  88. llmswap_cli-1.0.0/src/llmswap/model.py +172 -0
  89. llmswap_cli-1.0.0/src/llmswap/paths.py +41 -0
  90. llmswap_cli-1.0.0/src/llmswap/providers/AGENTS.md +12 -0
  91. llmswap_cli-1.0.0/src/llmswap/providers/base.py +619 -0
  92. llmswap_cli-1.0.0/src/llmswap/providers/claude.py +187 -0
  93. llmswap_cli-1.0.0/src/llmswap/providers/codex.py +274 -0
  94. llmswap_cli-1.0.0/src/llmswap/providers/gemini.py +80 -0
  95. llmswap_cli-1.0.0/src/llmswap/providers/registry.py +30 -0
  96. llmswap_cli-1.0.0/src/llmswap/render.py +127 -0
  97. llmswap_cli-1.0.0/src/llmswap/rotate.py +102 -0
  98. llmswap_cli-1.0.0/src/llmswap/store.py +138 -0
  99. llmswap_cli-1.0.0/src/llmswap/tui.py +182 -0
  100. llmswap_cli-1.0.0/src/llmswap/usage_cache.py +72 -0
  101. llmswap_cli-1.0.0/src/llmswap/warm/plan.py +118 -0
  102. llmswap_cli-1.0.0/src/llmswap/warm/runner.py +175 -0
  103. llmswap_cli-1.0.0/src/llmswap/warm/schedule.py +264 -0
  104. llmswap_cli-1.0.0/tests/__init__.py +1 -0
  105. llmswap_cli-1.0.0/tests/conftest.py +1016 -0
  106. llmswap_cli-1.0.0/tests/fixtures/sample_config.json +10 -0
  107. llmswap_cli-1.0.0/tests/llmswap/__init__.py +0 -0
  108. llmswap_cli-1.0.0/tests/llmswap/conftest.py +52 -0
  109. llmswap_cli-1.0.0/tests/llmswap/test_claude_provider.py +59 -0
  110. llmswap_cli-1.0.0/tests/llmswap/test_codex_provider.py +171 -0
  111. llmswap_cli-1.0.0/tests/llmswap/test_credential_safety.py +212 -0
  112. llmswap_cli-1.0.0/tests/llmswap/test_gemini_provider.py +45 -0
  113. llmswap_cli-1.0.0/tests/llmswap/test_rotate.py +64 -0
  114. llmswap_cli-1.0.0/tests/llmswap/test_schedule.py +61 -0
  115. llmswap_cli-1.0.0/tests/llmswap/test_tui_and_cli.py +187 -0
  116. llmswap_cli-1.0.0/tests/llmswap/test_warm_plan.py +96 -0
  117. llmswap_cli-1.0.0/tests/llmswap/test_warm_runner.py +119 -0
  118. llmswap_cli-1.0.0/tests/test_account_policy_cli.py +236 -0
  119. llmswap_cli-1.0.0/tests/test_account_policy_store.py +612 -0
  120. llmswap_cli-1.0.0/tests/test_account_policy_stray_standby_key.py +118 -0
  121. llmswap_cli-1.0.0/tests/test_account_policy_values.py +258 -0
  122. llmswap_cli-1.0.0/tests/test_add_account_identity.py +832 -0
  123. llmswap_cli-1.0.0/tests/test_api_key_accounts.py +1153 -0
  124. llmswap_cli-1.0.0/tests/test_app_bundle.py +308 -0
  125. llmswap_cli-1.0.0/tests/test_appearance.py +336 -0
  126. llmswap_cli-1.0.0/tests/test_autoswitch.py +8033 -0
  127. llmswap_cli-1.0.0/tests/test_autoswitch_account_threshold.py +1318 -0
  128. llmswap_cli-1.0.0/tests/test_autoswitch_landing_room.py +518 -0
  129. llmswap_cli-1.0.0/tests/test_backup_read_pacing.py +494 -0
  130. llmswap_cli-1.0.0/tests/test_cache.py +72 -0
  131. llmswap_cli-1.0.0/tests/test_claude_locks.py +1187 -0
  132. llmswap_cli-1.0.0/tests/test_cli.py +3097 -0
  133. llmswap_cli-1.0.0/tests/test_colour_cache_isolation.py +196 -0
  134. llmswap_cli-1.0.0/tests/test_config_cli.py +461 -0
  135. llmswap_cli-1.0.0/tests/test_credentials.py +663 -0
  136. llmswap_cli-1.0.0/tests/test_fsutil.py +788 -0
  137. llmswap_cli-1.0.0/tests/test_home_isolation.py +15 -0
  138. llmswap_cli-1.0.0/tests/test_json_output.py +893 -0
  139. llmswap_cli-1.0.0/tests/test_launch_agent.py +1145 -0
  140. llmswap_cli-1.0.0/tests/test_lines.py +255 -0
  141. llmswap_cli-1.0.0/tests/test_list_view.py +552 -0
  142. llmswap_cli-1.0.0/tests/test_locking.py +366 -0
  143. llmswap_cli-1.0.0/tests/test_logging_config.py +59 -0
  144. llmswap_cli-1.0.0/tests/test_login_account.py +646 -0
  145. llmswap_cli-1.0.0/tests/test_login_expiry.py +413 -0
  146. llmswap_cli-1.0.0/tests/test_macos_keychain.py +234 -0
  147. llmswap_cli-1.0.0/tests/test_macos_keychain_contract.py +1396 -0
  148. llmswap_cli-1.0.0/tests/test_mappings.py +204 -0
  149. llmswap_cli-1.0.0/tests/test_menubar.py +1007 -0
  150. llmswap_cli-1.0.0/tests/test_migrations.py +531 -0
  151. llmswap_cli-1.0.0/tests/test_move_accounts.py +849 -0
  152. llmswap_cli-1.0.0/tests/test_network_guard.py +54 -0
  153. llmswap_cli-1.0.0/tests/test_oauth.py +2733 -0
  154. llmswap_cli-1.0.0/tests/test_oauth_weekly_only.py +433 -0
  155. llmswap_cli-1.0.0/tests/test_pace.py +169 -0
  156. llmswap_cli-1.0.0/tests/test_paths.py +366 -0
  157. llmswap_cli-1.0.0/tests/test_poll_policy.py +502 -0
  158. llmswap_cli-1.0.0/tests/test_printer.py +324 -0
  159. llmswap_cli-1.0.0/tests/test_priority_strategy.py +401 -0
  160. llmswap_cli-1.0.0/tests/test_process_detection.py +731 -0
  161. llmswap_cli-1.0.0/tests/test_real_store_guard.py +937 -0
  162. llmswap_cli-1.0.0/tests/test_session.py +6323 -0
  163. llmswap_cli-1.0.0/tests/test_settings.py +876 -0
  164. llmswap_cli-1.0.0/tests/test_signin.py +286 -0
  165. llmswap_cli-1.0.0/tests/test_spawn.py +306 -0
  166. llmswap_cli-1.0.0/tests/test_subscription.py +978 -0
  167. llmswap_cli-1.0.0/tests/test_swap_accounts.py +964 -0
  168. llmswap_cli-1.0.0/tests/test_switcher.py +16225 -0
  169. llmswap_cli-1.0.0/tests/test_theme.py +67 -0
  170. llmswap_cli-1.0.0/tests/test_transfer.py +2356 -0
  171. llmswap_cli-1.0.0/tests/test_tui.py +2051 -0
  172. llmswap_cli-1.0.0/tests/test_tui_policy_display.py +222 -0
  173. llmswap_cli-1.0.0/tests/test_update_check.py +938 -0
  174. llmswap_cli-1.0.0/tests/test_usage_bars.py +92 -0
  175. llmswap_cli-1.0.0/tests/test_usage_store.py +2029 -0
  176. llmswap_cli-1.0.0/tests/test_weekly_only_strategies.py +148 -0
  177. llmswap_cli-1.0.0/tests/test_worker_gc_freeze.py +79 -0
  178. llmswap_cli-1.0.0/tools/screenshots.py +82 -0
  179. llmswap_cli-1.0.0/uv.lock +293 -0
@@ -0,0 +1,2 @@
1
+ github: realiti4
2
+ buy_me_a_coffee: realiti4
@@ -0,0 +1,53 @@
1
+ name: Bug report
2
+ description: Something in cswap isn't working right
3
+ labels: [bug]
4
+ body:
5
+ - type: textarea
6
+ id: what-happened
7
+ attributes:
8
+ label: What happened?
9
+ description: What did you do, what did you see, and what did you expect instead?
10
+ placeholder: Ran `cswap switch 2`, got ... — expected ...
11
+ validations:
12
+ required: true
13
+ - type: input
14
+ id: version
15
+ attributes:
16
+ label: cswap version and install method
17
+ description: Output of `cswap --version`, and whether you installed with uv, pipx, or from source.
18
+ placeholder: cswap 1.0.0, installed with uv
19
+ validations:
20
+ required: true
21
+ - type: dropdown
22
+ id: os
23
+ attributes:
24
+ label: Operating system
25
+ description: Credentials are stored differently per platform, so this matters a lot.
26
+ options:
27
+ - macOS
28
+ - Linux
29
+ - Windows
30
+ - WSL
31
+ validations:
32
+ required: true
33
+ - type: dropdown
34
+ id: claude-code
35
+ attributes:
36
+ label: How do you run Claude Code?
37
+ multiple: true
38
+ options:
39
+ - CLI (terminal)
40
+ - VS Code extension
41
+ - Desktop app
42
+ - type: input
43
+ id: claude-code-version
44
+ attributes:
45
+ label: Claude Code version
46
+ description: Output of `claude --version`, if you know it. cswap depends on how Claude Code stores its login, which changes between versions.
47
+ placeholder: 2.1.319
48
+ - type: textarea
49
+ id: logs
50
+ attributes:
51
+ label: Command output or logs
52
+ description: Paste the failing command's output — `cswap list` for account-state issues, `cswap auto` log lines for auto-switch issues. Re-running the command with `--debug` adds detail. Formatted automatically, no backticks needed. Please redact emails/account identifiers, and never paste access/refresh tokens, API keys, setup tokens, or credential-file/Keychain contents.
53
+ render: shell
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: 📖 Tips & how it works
4
+ url: https://github.com/realiti4/claude-swap#tips
5
+ about: Restart-after-switch behavior, macOS Keychain caching, and other common gotchas are covered in the README.
6
+ - name: 💬 Questions & ideas
7
+ url: https://github.com/realiti4/claude-swap/discussions
8
+ about: Ask a question or float a rough idea in Discussions.
@@ -0,0 +1,16 @@
1
+ name: Feature request
2
+ description: Suggest an improvement or new capability
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What problem would this solve?
9
+ description: Describe the situation where you miss this feature — the workflow matters more than the mechanism.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: solution
14
+ attributes:
15
+ label: What would you like to happen?
16
+ description: A rough sketch is fine — commands, flags, behavior.
@@ -0,0 +1,14 @@
1
+ <!--
2
+ Thanks for the pull request! A few sentences under each heading is plenty.
3
+
4
+ Title: a plain sentence that says what changes.
5
+ More in CONTRIBUTING.md.
6
+ -->
7
+
8
+ ## What and why
9
+
10
+ <!-- What changes, and the problem it solves. Link the issue if there is one: "Fixes #123". -->
11
+
12
+ ## How it was tested
13
+
14
+ <!-- The commands you actually ran, and on which platform (macOS, Linux, Windows). Say what you could not test. -->
@@ -0,0 +1,62 @@
1
+ name: CI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ jobs:
11
+ # The whole suite on every platform and the supported Python versions. The
12
+ # macOS and Windows runners prove the Keychain, file-lock and TUI paths.
13
+ test:
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu-latest, macos-latest, windows-latest]
18
+ python: ['3.12']
19
+ include:
20
+ - os: ubuntu-latest
21
+ python: '3.13'
22
+ - os: ubuntu-latest
23
+ python: '3.14'
24
+ runs-on: ${{ matrix.os }}
25
+ timeout-minutes: 20
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@v6
32
+ with:
33
+ python-version: ${{ matrix.python }}
34
+
35
+ - name: Install dependencies
36
+ run: uv sync --locked
37
+
38
+ - name: Run tests
39
+ run: uv run pytest -o faulthandler_timeout=600
40
+
41
+ # The wheel installs on its own and the command works: catches a package
42
+ # that tests (which run from the source tree) would miss.
43
+ package:
44
+ runs-on: ubuntu-latest
45
+
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - name: Install uv
50
+ uses: astral-sh/setup-uv@v6
51
+ with:
52
+ python-version: '3.12'
53
+
54
+ - name: Build
55
+ run: uv build
56
+
57
+ - name: Install the wheel and run it
58
+ run: |
59
+ uv tool install dist/*.whl
60
+ llmswap --version
61
+ llmswap providers
62
+ llmswap list --json
@@ -0,0 +1,29 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: '3.12'
21
+
22
+ - name: Install build dependencies
23
+ run: pip install build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Publish to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,19 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # macOS Finder folder metadata
13
+ .DS_Store
14
+
15
+ # superpowers session planning artifacts (not part of the project)
16
+ docs/superpowers/
17
+
18
+ # cswap export files: they hold account logins in plain text
19
+ *.cswap
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,60 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "cswap --list",
6
+ "type": "debugpy",
7
+ "request": "launch",
8
+ "module": "claude_swap.cli",
9
+ "args": ["--list"],
10
+ "cwd": "${workspaceFolder}",
11
+ "env": {
12
+ "PYTHONPATH": "${workspaceFolder}/src"
13
+ },
14
+ "console": "integratedTerminal"
15
+ },
16
+ {
17
+ "name": "cswap --switch",
18
+ "type": "debugpy",
19
+ "request": "launch",
20
+ "module": "claude_swap.cli",
21
+ "args": ["--switch"],
22
+ "cwd": "${workspaceFolder}",
23
+ "env": {
24
+ "PYTHONPATH": "${workspaceFolder}/src"
25
+ },
26
+ "console": "integratedTerminal"
27
+ },
28
+ {
29
+ "name": "cswap --purge",
30
+ "type": "debugpy",
31
+ "request": "launch",
32
+ "module": "claude_swap.cli",
33
+ "args": ["--purge"],
34
+ "cwd": "${workspaceFolder}",
35
+ "env": {
36
+ "PYTHONPATH": "${workspaceFolder}/src"
37
+ },
38
+ "console": "integratedTerminal"
39
+ },
40
+ {
41
+ "name": "cswap (custom args)",
42
+ "type": "debugpy",
43
+ "request": "launch",
44
+ "module": "claude_swap.cli",
45
+ "args": ["${input:cliArgs}"],
46
+ "cwd": "${workspaceFolder}",
47
+ "env": {
48
+ "PYTHONPATH": "${workspaceFolder}/src"
49
+ },
50
+ "console": "integratedTerminal"
51
+ }
52
+ ],
53
+ "inputs": [
54
+ {
55
+ "id": "cliArgs",
56
+ "type": "promptString",
57
+ "description": "CLI arguments (e.g., --list, --status, --switch)"
58
+ }
59
+ ]
60
+ }
@@ -0,0 +1,47 @@
1
+ # Working on llmswap
2
+
3
+ For coding agents and the people driving them.
4
+
5
+ llmswap switches Claude Code, Codex and Gemini CLI between several accounts. It reads and writes people's login credentials, so a careless change can cost someone their stored logins. The `claude_swap` package is the Claude Code engine inherited from [claude-swap](https://github.com/realiti4/claude-swap); the `llmswap` package is the provider layer, dashboard and warm-up on top of it ([src/llmswap/AGENTS.md](src/llmswap/AGENTS.md)).
6
+
7
+ Read [docs/architecture.md](docs/architecture.md) first. It says which module owns what, how a switch, a usage fetch and a token refresh run, and the rules that hold across the codebase: lock order, no network under a lock, what may be written into a slot.
8
+
9
+ ## Commands
10
+
11
+ - `uv sync` installs the locked dependencies.
12
+ - `uv run pytest` runs the whole suite, in parallel by default.
13
+ - `uv run pytest tests/test_usage_store.py` runs one file. Prefer this while you work. llmswap's own tests are in `tests/llmswap/`.
14
+ - Never run the CLI by hand against your real home while developing. Point `HOME`, `LLMSWAP_HOME`, `CODEX_HOME` and `GEMINI_CLI_HOME` at a temporary directory first: the account store and the logins in it are real people's.
15
+
16
+ No linter or formatter is configured. Match the style of the file you are in.
17
+
18
+ ## Code
19
+
20
+ - Put a test beside the existing ones in `tests/test_<module>.py`. Tests run against a temporary home and an in-memory Keychain; do not work around those guards.
21
+ - CI runs on Linux, macOS and Windows. Credentials live in the Keychain on macOS and in files elsewhere, so go through `credentials.py` and `paths.py` instead of assuming one platform.
22
+ - Never print or log a token or the contents of a credential file. Summarise its state, as `oauth.build_token_status` does.
23
+ - A claim about how Claude Code or Anthropic's endpoints behave needs evidence. Say which Claude Code version you read or what you measured, as the existing docstrings do. Do not guess.
24
+ - `--json` output is a contract. Add fields; never rename or remove one.
25
+ - Runtime dependencies are deliberately few. Do not add one without asking in an issue first.
26
+ - Comments and docstrings describe what the code does now and why. Leave out the history of how you got there: no investigation logs, round numbers or "previously".
27
+
28
+ ## Documentation
29
+
30
+ Each topic has one home. Link to it; do not copy it.
31
+
32
+ - `README.md` shows what the tool does and how to use each feature at a glance. Keep an addition to a line or two.
33
+ - `docs/` holds the exact rules and reference: `auto-switch.md`, `json-output.md`, `menubar.md`. When you change that behaviour, update that page.
34
+ - How a mechanism works belongs in the docstring of the module that owns it.
35
+ - `docs/architecture.md` changes only when module ownership, a cross-module flow or a codebase-wide rule changes.
36
+
37
+ Do not add planning, investigation or handoff documents to the repository.
38
+
39
+ ## Pull requests
40
+
41
+ Read [CONTRIBUTING.md](CONTRIBUTING.md) before you open a pull request; it says what one should look like. Three things apply to you as an agent in particular:
42
+
43
+ - Stay on the one problem you were asked to solve. Mention unrelated things you notice instead of fixing them in the same change.
44
+ - Reading the whole diff is the job of the person you are working for. Do not say they have done it, and do not stop to ask them to confirm it.
45
+ - Report only the checks you actually ran, and say what you left unverified.
46
+
47
+ Opening an issue or a pull request from the command line skips the forms, so follow them yourself. `.github/ISSUE_TEMPLATE/bug_report.yml` lists what a bug report needs, and `.github/pull_request_template.md` gives the shape of a description. Keep the detail in proportion to the change.
@@ -0,0 +1,80 @@
1
+ # Contributing to claude-swap
2
+
3
+ Thanks for wanting to help. I maintain claude-swap in my spare time, and a lot of what is good in it came from other people. Bug reports, ideas, documentation fixes and code are all welcome, whether this is your first contribution anywhere or your hundredth.
4
+
5
+ ## Ways to help
6
+
7
+ - **Report a bug.** Use the [bug report form](https://github.com/realiti4/claude-swap/issues/new/choose). It asks for the few things needed to reproduce the problem and tells you what to redact.
8
+ - **Suggest something.** Use the feature request form for a concrete proposal, or [Discussions](https://github.com/realiti4/claude-swap/discussions) for a question or a half-formed idea.
9
+ - **Improve the documentation.** Typos, unclear sentences and missing examples are all worth a pull request.
10
+ - **Send code.** The rest of this page is about that.
11
+
12
+ ## Before you write code
13
+
14
+ For a bug fix, a test or a documentation fix, go ahead and open a pull request.
15
+
16
+ For a new feature, a new flag or a change to how something is meant to behave, please open an issue first. A short conversation up front saves you from building something that turns out not to fit, and I can usually point you at the right place in the code.
17
+
18
+ ## Setting up
19
+
20
+ You need [uv](https://docs.astral.sh/uv/getting-started/installation/). It installs the right Python for you.
21
+
22
+ ```bash
23
+ git clone https://github.com/realiti4/claude-swap.git
24
+ cd claude-swap
25
+ uv sync
26
+ uv run cswap help
27
+ ```
28
+
29
+ `uv run cswap ...` runs the code in your checkout, not an installed copy. To work on the macOS menu bar, use `uv sync --extra menubar`.
30
+
31
+ ## Trying your change
32
+
33
+ The copy in your checkout works on your real accounts, so save a copy of them before you experiment. Keep the file outside the checkout: it holds your logins in plain text.
34
+
35
+ ```bash
36
+ cswap export ~/cswap-backup.cswap --full
37
+ ```
38
+
39
+ Treat it as a safety net, not an undo button. Login tokens rotate, so an older export can hold a token that no longer works. If an account goes missing, `cswap import ~/cswap-backup.cswap` puts it back and leaves working accounts alone. If an account ends up needing a fresh login, [Refresh expired tokens](README.md#refresh-expired-tokens) in the README says how.
40
+
41
+ A few things that help when something misbehaves:
42
+
43
+ - Add `--debug` to a command to see debug logging, for example `uv run cswap list --debug`.
44
+ - The log file is `claude-swap.log` in the data directory (its location per platform is in the [README](README.md#data-locations)).
45
+ - For VS Code, `.vscode/launch.json` has debugger configurations ready, including one that asks for the arguments.
46
+
47
+ ## Tests
48
+
49
+ ```bash
50
+ uv run pytest # everything, in parallel
51
+ uv run pytest tests/test_usage_store.py # one file
52
+ uv run pytest tests/test_usage_store.py -n 0 --pdb # no parallelism, stop in the debugger on a failure
53
+ ```
54
+
55
+ The tests never touch your real accounts: they run in a temporary home with a fake Keychain.
56
+
57
+ A bug fix should come with a test that fails without it. CI runs on Linux, macOS and Windows; if you could only try one of them, say so in the pull request and that is fine.
58
+
59
+ There is no formatter or linter to run. Match the code around your change.
60
+
61
+ ## Finding your way around
62
+
63
+ [docs/architecture.md](docs/architecture.md) says which module owns what and how the main flows run. If you work with a coding agent, [AGENTS.md](AGENTS.md) holds the short rules for it.
64
+
65
+ ## Opening a pull request
66
+
67
+ Using AI tools is welcome. What matters is that a person stands behind the change:
68
+
69
+ - Keep a pull request to one problem, together with its tests and documentation. Send unrelated fixes separately; focused pull requests are easier to review.
70
+ - Read your whole diff before you ask for review, and be ready to explain it.
71
+ - Say what you tested and how, and what you could not test.
72
+ - Keep README additions to a line or two. Detail belongs in `docs/`.
73
+
74
+ ## What happens next
75
+
76
+ Reviews can take me a while. I may ask for changes, or merge and tidy something up in a follow-up commit. Neither is a judgement of your work. If a pull request has been quiet for a while, a ping is welcome.
77
+
78
+ ## Stuck?
79
+
80
+ Open a discussion, or a draft pull request with a question in it. Asking early is always fine.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Richard Lao
4
+ Copyright (c) 2026 Onur Cetinkol
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.5
2
+ Name: llmswap-cli
3
+ Version: 1.0.0
4
+ Summary: One account switcher for Claude Code, Codex and Gemini CLI: usage, rotation before limits, and warm-up pings
5
+ Project-URL: Homepage, https://github.com/richard7ao/llmswap
6
+ Project-URL: Repository, https://github.com/richard7ao/llmswap
7
+ Project-URL: Issues, https://github.com/richard7ao/llmswap/issues
8
+ Project-URL: Upstream, https://github.com/realiti4/claude-swap
9
+ Author: Richard Lao
10
+ Author-email: Onur Cetinkol <onurcetinkol@gmail.com>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: account-switcher,claude-code,cli,codex,gemini-cli,rate-limit
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Topic :: Utilities
26
+ Requires-Python: >=3.12
27
+ Requires-Dist: textual<9,>=8.2.8
28
+ Requires-Dist: truststore>=0.10.4
29
+ Provides-Extra: menubar
30
+ Requires-Dist: rumps>=0.4.0; extra == 'menubar'
31
+ Description-Content-Type: text/markdown
32
+
33
+ <!-- README rule: say what the user can do, give a minimal example, and mention only caveats that change their decision.
34
+ Mechanics go in docs/, rationale in the PR. When behavior changes, edit the existing text instead of appending. -->
35
+
36
+ # llmswap
37
+
38
+ **One account switcher for every coding-agent CLI.** Save several logins for Claude Code, Codex and Gemini CLI, switch without logging out, see every account's 5-hour and weekly usage in one dashboard, rotate before a limit hits, and start each account's 5-hour window early with scheduled warm-up pings.
39
+
40
+ <p align="center">
41
+ <img src="docs/img/dashboard.svg" alt="The llmswap dashboard: Claude Code, Codex and Gemini CLI accounts with usage bars and reset countdowns" width="760">
42
+ </p>
43
+
44
+ llmswap is a fork of [claude-swap](https://github.com/realiti4/claude-swap) by Onur Cetinkol (MIT). Everything claude-swap does for Claude Code is kept; Codex, Gemini CLI, the unified dashboard and warm-up are new. See [credits](#credits).
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ uv tool install llmswap-cli # or: pipx install llmswap-cli
50
+ ```
51
+
52
+ The command is `llmswap`. (The name `llmswap` on PyPI belongs to an unrelated project, so the package is `llmswap-cli`.) Python 3.12+.
53
+
54
+ llmswap ships claude-swap's `claude_swap` package inside it. Install it in its own tool environment (uv tool or pipx, as above) and do not put it in the same Python environment as the standalone `claude-swap` package: both provide `claude_swap`.
55
+
56
+ ## Quick start
57
+
58
+ ```bash
59
+ llmswap add # save the login every installed CLI is signed in with now
60
+ llmswap codex login # sign in to a second Codex account without touching the first
61
+ llmswap list -r # every account, every window, read live
62
+ llmswap switch codex:2 # make Codex account 2 the default login
63
+ llmswap run codex:1 -- exec "fix the tests" # run as account 1 in this terminal only
64
+ llmswap # the dashboard
65
+ ```
66
+
67
+ `llmswap list` on a terminal draws a bar per window:
68
+
69
+ <p align="center">
70
+ <img src="docs/img/list.svg" alt="llmswap list: bars for the 5-hour and 7-day windows of each account" width="720">
71
+ </p>
72
+
73
+ ## What it does
74
+
75
+ | | Claude Code | Codex | Gemini CLI |
76
+ |---|---|---|---|
77
+ | Save and switch logins without logging out | yes | yes | run only ¹ |
78
+ | Live 5-hour and weekly usage | yes | yes | not reported ² |
79
+ | Rotate before a limit (`llmswap auto`) | yes | yes | – |
80
+ | Parallel sessions (`llmswap run`) | yes | yes | yes |
81
+ | Warm-up pings | yes | yes | – ³ |
82
+
83
+ ¹ Gemini CLI keeps its one default login in the system keychain, which llmswap does not touch. Each Gemini account lives in its own private home and runs with `llmswap run gemini:<n>`.
84
+ ² Gemini reports quota per model per day inside the CLI. llmswap does not read it yet.
85
+ ³ Gemini has no 5-hour window to start.
86
+
87
+ Per-provider commands (`llmswap <provider> ...`): `add`, `login`, `switch`, `run`, `remove`, `alias`, `enable`/`disable` (hold an account out of rotation), `usage`. `llmswap claude ...` is claude-swap's complete command set, documented in [docs/claude-code.md](docs/claude-code.md). Provider details and the evidence behind each are in [docs/providers.md](docs/providers.md).
88
+
89
+ `llmswap list --json` is a stable contract: fields are added, never renamed or removed ([docs/json-output.md](docs/json-output.md#llmswap-list---json-all-providers)).
90
+
91
+ ## Rotate before a limit
92
+
93
+ ```bash
94
+ llmswap auto # watch every minute, switch when the active account reaches 90%
95
+ llmswap auto --once # one pass, for cron
96
+ llmswap codex disable 3 # keep an account out of rotation
97
+ ```
98
+
99
+ Claude Code uses claude-swap's engine with its cooldowns, per-account thresholds and tiers ([docs/auto-switch.md](docs/auto-switch.md)). Other providers move to the account with the most headroom once the active one reaches the threshold, skipping disabled and API-key accounts, with a five-minute cooldown. Running Codex sessions need a restart to use the new login.
100
+
101
+ ## Warm-up pings
102
+
103
+ A 5-hour window starts at an account's first request and ends five hours later. If you start work cold, the window you burn through ends mid-day. Warm-up sends the smallest possible request through the official CLI as soon as an account's window has reset (or never started), so the window is already running when you sit down, and the next one starts as early as possible.
104
+
105
+ ```bash
106
+ llmswap warm add codex:1 claude:2 # choose accounts (nothing is warmed by default)
107
+ llmswap warm quiet 23:00 07:00 # no pings overnight
108
+ llmswap warm enable # installs the schedule
109
+ llmswap warm status # what is due and when
110
+ ```
111
+
112
+ It is **opt-in and off by default**, and `llmswap warm enable` makes you confirm you have read the terms below before it installs anything. `enable` installs a job in your platform's own scheduler (launchd on macOS, a systemd user timer or cron on Linux, Task Scheduler on Windows) that runs `llmswap warm tick` every five minutes. Most ticks do nothing: a tick pings an account only when its 5-hour window is cold, it is outside quiet hours, and it has not just been pinged. A failing account is retried with growing delay. `llmswap warm disable` removes the job. Details: [docs/warm-up.md](docs/warm-up.md).
113
+
114
+ **Read your provider's terms first.** Warm-up sends real requests with your own logins through the official CLIs, on a schedule, unattended, and spends a little of your quota.
115
+
116
+ - Anthropic's [Consumer Terms](https://www.anthropic.com/legal/consumer-terms) say you may not, "except when you are accessing our Services via an Anthropic API Key or where we otherwise explicitly permit it, … access the Services through automated or non-human means, whether through a bot, script, or otherwise." A scheduled `claude -p` on a Pro or Max login can fall under that. Team and Enterprise accounts are on different terms, and Anthropic may permit it explicitly; checking is your job. For that reason `warm add --all` skips Claude accounts: each one must be named.
117
+ - OpenAI's [Terms of Use](https://openai.com/policies/terms-of-use/) bar "automatically or programmatically extracting data or Output" and making your account available to anyone else.
118
+
119
+ Use only accounts you own. Turning warm-up on is your decision and your risk. The same goes for `llmswap auto` and `llmswap run`: they use your own logins, and you are responsible for how your plan's terms treat them.
120
+
121
+ ## Menu bar (macOS)
122
+
123
+ ```bash
124
+ uv tool install 'llmswap-cli[menubar]'
125
+ llmswap menubar # runs under launchd, starts at login
126
+ ```
127
+
128
+ Shows the fullest active window in the menu bar, every account's usage in the menu, and switches or pings with a click. `llmswap menubar --uninstall` removes it.
129
+
130
+ ## Compared with the others
131
+
132
+ What each project's own README says it does (checked 5 Dec 2026). Where another project does something llmswap does not, the table says so.
133
+
134
+ | | llmswap | [claude-swap](https://github.com/realiti4/claude-swap) | [codex-swap](https://github.com/aneym/codex-swap) | [ccswap](https://github.com/errhythm/ccswap) | [Codex Switcher](https://github.com/Lampese/codex-switcher) | [PlanSwap](https://github.com/n2ns/planswap) | [cwarm](https://github.com/wonderbyte/cwarm) | [aisw](https://github.com/burakdede/aisw) |
135
+ |---|---|---|---|---|---|---|---|---|
136
+ | Claude Code | yes | yes | – | yes | – | yes | warm only | yes |
137
+ | Codex | yes | – | yes | yes | yes | yes | – | yes |
138
+ | Gemini CLI | run only ¹ | – | – | – | – | – | – | switch |
139
+ | Antigravity | – | – | – | yes | – | yes | – | – |
140
+ | Switch without logging out | yes | yes | yes | yes | yes | yes | – | yes |
141
+ | Live 5h / weekly usage | Claude, Codex | yes | yes | yes | yes | yes | – | – |
142
+ | Auto-rotate before a limit | yes | yes | at launch | yes | – | recommends | – | – |
143
+ | Parallel sessions | yes | yes | – | yes | – | – | – | – |
144
+ | Folder-to-account mapping | Claude only | yes | – | yes | – | – | – | – |
145
+ | Terminal dashboard | yes | yes | – | yes | – | – | – | – |
146
+ | Menu bar | macOS | macOS | – | macOS | yes (app) | – | – | – |
147
+ | Other front ends | – | VS Code extension works | – | Raycast, T3 hub | – | VS Code | – | shell hook |
148
+ | Scheduled warm-up | yes, native scheduler | – | manual `anchor` | during auto-switch | yes (app) | – | yes, Claude only | – |
149
+ | Form | CLI | CLI | CLI | CLI | desktop app | VS Code | CLI | CLI |
150
+
151
+ llmswap's differences: one provider interface (a new CLI is one module), warm-up that follows each account's own reset time and runs from the platform scheduler, and a single command over Claude Code, Codex and Gemini CLI. Research notes and what was borrowed from each: [docs/feature-map.md](docs/feature-map.md).
152
+
153
+ ## Status and known limits
154
+
155
+ - Claude Code support is the inherited claude-swap engine, unchanged.
156
+ - Codex and the warm-up pings were built from Codex CLI 0.174.0's source and checked with fixtures and a fake `codex` binary in a temporary home. They have **not yet been run against a live Codex or Claude account**. In particular, the rule "0% used with a full window away means the window is cold" is documented by other tools but not yet confirmed here on a real account. Report what you see.
157
+ - Gemini CLI: private homes and `llmswap run gemini:<n>` only. Usage is not read and there is no default-login switch, because Gemini keeps its login in the OS keychain or an encrypted file.
158
+ - Copilot CLI, opencode, Cursor CLI and Grok CLI are left out for now; [docs/providers.md](docs/providers.md) says why for each.
159
+
160
+ ## Safety
161
+
162
+ - Tests and development never touch real logins: they run against temporary homes and fake keychains.
163
+ - A login is written into a saved slot only when its identity matches that slot, and the default login is never overwritten if it is not saved. Rotated refresh tokens are captured back before a switch.
164
+ - llmswap never runs `codex logout` or any logout: those revoke the refresh token on the provider's side and break every saved copy.
165
+ - Tokens are never printed, logged or put in `--json` output.
166
+
167
+ ## Data locations
168
+
169
+ llmswap keeps its own data in `~/.llmswap/` (macOS, Windows) or `${XDG_DATA_HOME:-~/.local/share}/llmswap/` (Linux); set `LLMSWAP_HOME` to move it. Claude Code accounts stay where claude-swap keeps them ([docs/claude-code.md](docs/claude-code.md#data-locations)).
170
+
171
+ ## Credits
172
+
173
+ - [claude-swap](https://github.com/realiti4/claude-swap) by Onur Cetinkol: the Claude Code engine, TUI, menu bar, usage store and auto-switch this project is built on. MIT; the original copyright is kept in [LICENSE](LICENSE).
174
+ - Patterns studied in [codex-swap](https://github.com/aneym/codex-swap), [ccswap](https://github.com/errhythm/ccswap), [Codex Switcher](https://github.com/Lampese/codex-switcher), [cwarm](https://github.com/wonderbyte/cwarm), [aisw](https://github.com/burakdede/aisw) and [CodexBar](https://github.com/steipete/CodexBar); see [docs/feature-map.md](docs/feature-map.md).
175
+ - Claude, Codex and Gemini are products of Anthropic, OpenAI and Google. llmswap is not affiliated with them.
176
+
177
+ ## License
178
+
179
+ MIT. Copyright (c) 2026 Richard Lao and Onur Cetinkol. See [LICENSE](LICENSE).
180
+
181
+ Contributing: [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).