|
| 1 | +# Munchkin |
| 2 | + |
| 3 | +Munchkin is a cross-platform OAuth account manager for Codex, Gemini, and Qwen CLIs. |
| 4 | + |
| 5 | +It gives you an encrypted local vault for multiple accounts, fast switching, account verification, Codex quota tracking, backup/export flows, and an optional Codex load-balancing mode. The goal is simple: keep one clean machine setup and switch between saved CLI identities without reinstalling tools or reauthenticating every time. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Encrypted vault protected by a master password |
| 10 | +- Multi-account support for: |
| 11 | + - Codex CLI |
| 12 | + - Gemini CLI |
| 13 | + - Qwen CLI |
| 14 | +- Import current sessions or add new accounts through the real provider login flow |
| 15 | +- One-step switching between saved accounts |
| 16 | +- Account verification with health states such as `healthy`, `token-only`, and `reauth-required` |
| 17 | +- Active-session sync back into the vault so refreshed sessions are not lost |
| 18 | +- Codex quota refresh and cached usage status |
| 19 | +- Codex process-level load balancing across saved accounts |
| 20 | +- Vault export/import for backup and recovery |
| 21 | +- Interactive dashboard with arrow-key menus |
| 22 | +- Structured operational logs |
| 23 | +- Packaged Windows installer and cross-platform release pipeline |
| 24 | + |
| 25 | +## Why it exists |
| 26 | + |
| 27 | +Most CLI tools assume one active auth context per machine. That breaks down fast when you use separate personal, work, testing, or shared accounts. |
| 28 | + |
| 29 | +Munchkin solves that by storing provider-specific auth snapshots in an encrypted vault and applying them back to the right CLI when you switch. |
| 30 | + |
| 31 | +## Supported providers |
| 32 | + |
| 33 | +### Codex |
| 34 | + |
| 35 | +- Managed file-backed auth snapshots |
| 36 | +- Session verification |
| 37 | +- Quota refresh |
| 38 | +- Optional load balancing |
| 39 | +- Optional bridge configuration for `codex-lb`-style proxy setups |
| 40 | + |
| 41 | +### Gemini |
| 42 | + |
| 43 | +- OAuth snapshot capture and restore from local cached credentials |
| 44 | +- Verification and switching support |
| 45 | + |
| 46 | +### Qwen |
| 47 | + |
| 48 | +- OAuth snapshot capture and restore from local cached credentials |
| 49 | +- Verification and switching support |
| 50 | + |
| 51 | +## Installation |
| 52 | + |
| 53 | +### Local development |
| 54 | + |
| 55 | +```powershell |
| 56 | +npm install |
| 57 | +npm run build |
| 58 | +npm link |
| 59 | +``` |
| 60 | + |
| 61 | +Then run: |
| 62 | + |
| 63 | +```powershell |
| 64 | +munchkin |
| 65 | +``` |
| 66 | + |
| 67 | +### Windows packaged installer |
| 68 | + |
| 69 | +Build: |
| 70 | + |
| 71 | +```powershell |
| 72 | +npm run package:installer |
| 73 | +``` |
| 74 | + |
| 75 | +Artifacts: |
| 76 | + |
| 77 | +- `build\package\munchkin.exe` |
| 78 | +- `build\package\Munchkin-Setup.exe` |
| 79 | + |
| 80 | +### macOS and Linux package |
| 81 | + |
| 82 | +Build on the native platform: |
| 83 | + |
| 84 | +```bash |
| 85 | +npm install |
| 86 | +npm run package:unix |
| 87 | +``` |
| 88 | + |
| 89 | +Artifact: |
| 90 | + |
| 91 | +- `build/package/munchkin-<platform>-<arch>.tar.gz` |
| 92 | + |
| 93 | +Archive contents: |
| 94 | + |
| 95 | +- `munchkin` |
| 96 | +- `install.sh` |
| 97 | +- `uninstall.sh` |
| 98 | + |
| 99 | +## Usage |
| 100 | + |
| 101 | +### Dashboard |
| 102 | + |
| 103 | +Run: |
| 104 | + |
| 105 | +```powershell |
| 106 | +munchkin |
| 107 | +``` |
| 108 | + |
| 109 | +The dashboard includes: |
| 110 | + |
| 111 | +- account add/import/switch/rename/remove |
| 112 | +- verification |
| 113 | +- sync active account |
| 114 | +- quota refresh |
| 115 | +- export/import backup |
| 116 | +- Codex load balancer controls |
| 117 | +- recent logs |
| 118 | + |
| 119 | +### CLI commands |
| 120 | + |
| 121 | +```powershell |
| 122 | +munchkin list |
| 123 | +munchkin verify |
| 124 | +munchkin verify -p codex -n main |
| 125 | +munchkin use codex main |
| 126 | +munchkin sync codex |
| 127 | +munchkin quota |
| 128 | +munchkin quota --all |
| 129 | +munchkin run codex -- exec "Reply with OK only." |
| 130 | +munchkin lb enable |
| 131 | +munchkin lb status |
| 132 | +munchkin lb bridge enable --base-url http://127.0.0.1:2455 |
| 133 | +munchkin export-vault |
| 134 | +munchkin import-vault C:\path\to\backup.json |
| 135 | +munchkin logs --limit 20 |
| 136 | +munchkin doctor |
| 137 | +``` |
| 138 | + |
| 139 | +## Packaging and releases |
| 140 | + |
| 141 | +The repo includes a GitHub Actions workflow that: |
| 142 | + |
| 143 | +- builds on Windows, macOS, and Linux |
| 144 | +- runs typecheck and tests |
| 145 | +- packages native artifacts per platform |
| 146 | +- publishes a GitHub release automatically when you push a tag like `v1.0.0` |
| 147 | + |
| 148 | +Workflow file: |
| 149 | + |
| 150 | +- [.github/workflows/release.yml](E:\Coding\munchkin\.github\workflows\release.yml) |
| 151 | + |
| 152 | +## Security notes |
| 153 | + |
| 154 | +- Account snapshots are encrypted at rest in the local vault |
| 155 | +- OAuth sessions can still expire or be rotated by upstream providers |
| 156 | +- Shared OAuth sessions are inherently fragile if the same account is used elsewhere |
| 157 | +- A saved account may exist but still require reauthentication; use `verify` to confirm health |
| 158 | + |
| 159 | +## Operational notes |
| 160 | + |
| 161 | +- Codex quota support is implemented for saved Codex accounts only |
| 162 | +- Gemini can use keychain-backed storage on some machines, which may limit how much local auth state can be captured |
| 163 | +- The optional `lb bridge` commands only modify Codex configuration; they do not embed the external `codex-lb` server |
| 164 | +- Windows artifacts were built and verified in this workspace |
| 165 | +- macOS and Linux artifacts are intended to be built on native runners through the release workflow |
| 166 | + |
| 167 | +## License |
| 168 | + |
| 169 | +MIT |
0 commit comments