ai-launcher 0.1.3 → 0.1.4

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ak1Ena
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,286 @@
1
+ # ai-launcher
2
+
3
+ One command for all your AI coding agents. Type `ai` to see every agent and account with how much of its plan limit is used, then pick one to start it in the current folder.
4
+
5
+ ![ai-launcher home: every account with usage bars, reset times and a failover switch](docs/tui.png)
6
+
7
+ - **Every agent in one list.** Claude Code (several accounts), Codex, Gemini, Antigravity, Kimi, OpenCode, Qwen, or any CLI you add.
8
+ - **Usage at a glance.** Shows 5-hour and weekly limits with reset times. Bars turn yellow at 60% and red at 90%.
9
+ - **Your own launch commands.** Add, edit or delete agents and their commands, from the command line or inside the picker.
10
+ - **Trust a folder once.** If any agent trusts the folder, every agent you start through `ai` trusts it too, so they stop asking.
11
+ - **No API calls.** Usage comes from files the agents already write on your machine.
12
+
13
+ There are two front ends with the same config: the TUI shown above (`npm i -g ai-launcher`), and a plain-bash picker that needs nothing installed ([Use it](#use-it)). Both work on macOS, Linux and Windows (PowerShell, CMD or WSL).
14
+
15
+ ## TUI (preview)
16
+
17
+ A terminal UI with two kinds of tabs:
18
+
19
+ - **`✻ home`** (the screenshot above) lists every account in failover order: its email, 5-hour and weekly usage bars, when each limit resets, and its `● on` / `○ off` failover switch. Other CLIs are listed below.
20
+ - **One tab per running CLI**, using the full window. The bottom line shows that account's usage and, for Claude, which account failover moves to next.
21
+
22
+ ![a Claude tab: the CLI fills the window, with the account's usage and the next failover account on the bottom line](docs/tui-tab.png)
23
+
24
+ On a narrow terminal, columns and key hints that don't fit are dropped, least important first. When failover triggers, the session switches to the next account in the same tab, after a 5 second notice (press enter to switch now). When a newer version is on npm, a notice appears in the title bar (checked at most once a day in the background; set `AI_LAUNCHER_NO_UPDATE_CHECK=1` to disable).
25
+
26
+ Install:
27
+
28
+ ```bash
29
+ npm i -g ai-launcher # installs the TUI as the command `ai`
30
+ cd tui && cargo build --release # or build it yourself (binary: tui/target/release/ai-launcher)
31
+ ```
32
+
33
+ Run `ai [claude args]` (npm install) or `tui/target/release/ai-launcher [claude args]` (built yourself). The first CLI you open gets those args.
34
+
35
+ The bash tool is also called `ai` (`bin/ai`, when the repo's `bin` is on your `PATH`). Whichever comes first on `PATH` runs. Round-robin, Auto and the decision model are TUI-only; the bash picker has failover and the update notice.
36
+
37
+ It reads and writes the same config as the bash `ai` (providers file, failover order and flag), so you can use both.
38
+
39
+ | Key (home) | Does |
40
+ | --- | --- |
41
+ | `up` `down` / `k` `j` | move selection |
42
+ | `enter` | open the selected account in a tab |
43
+ | `a` | add an account |
44
+ | `e` | edit the selected account |
45
+ | `d` | delete the selected account |
46
+ | `shift-up` `shift-down` / `K` `J` | change the order (top is tried first) |
47
+ | `space` | turn the account's failover on / off (or click its `● on` / `○ off` switch); an off account is skipped when a limit hits |
48
+ | `f` | failover on / off |
49
+ | `w` | switch between failover and weighted round-robin |
50
+ | `+` `-` | round-robin: raise / lower the account's weight (0 to 99, default 1; 0 is never picked) |
51
+ | `n` | round-robin: open the next account (or click `▶ Auto`) |
52
+ | `m` | set the Auto decision model |
53
+ | `r` | clear the account's limit |
54
+ | `x` | close the current tab (highlighted in the tab bar) |
55
+ | `1`-`9` | go to tab n |
56
+ | `tab` | next tab |
57
+ | `q` / `ctrl-c` | quit |
58
+
59
+ Routing mode (`w`, or click the mode label in the title bar) is saved in `<failover file>.mode`. In failover mode the list is a priority order. In round-robin mode each account shows `×weight`, and `n` (or `▶ Auto`) opens the next account in a new tab by smooth weighted round-robin: with weights 3 and 1 you get A A B A (then it repeats). Accounts that are off, weight 0 or limited are skipped. Weights are saved in `<failover file>.weights` and the rotation in `$AI_FO_STATE/wrr`, so it continues after a restart.
60
+
61
+ Optionally let a model choose instead: press `m` and enter a model name (for example `haiku`; empty means plain round-robin). Auto then runs `claude -p --model <model>` on one of your free Claude accounts, with each account's weight and usage, in the background (20 second timeout, the UI keeps working). If it fails, times out or answers with anything but an account name, the round-robin pick is used. The model name is saved in `<failover file>.model`. This is the only thing the tool asks a model; it uses your own `claude` login and counts against its plan. Bash `ai` ignores these files.
62
+
63
+ In the add form, a Claude account opens its login in a tab. A Codex or Gemini login gets its own login folder when another one of that CLI exists. Other CLI runs any command you type.
64
+
65
+ Delete asks first. A Claude account folder moves to `<accounts folder>/.trash`, so its login and history are kept.
66
+
67
+ | Key (anywhere) | Does |
68
+ | --- | --- |
69
+ | `alt-1`-`alt-9` | go to tab n, also while typing in a CLI |
70
+ | `alt-←` `alt-→` | previous / next tab |
71
+ | `ctrl-\` | go home, or from home back to the current tab |
72
+ | `alt-0` | go home |
73
+
74
+ On macOS, alt (⌥) keys need "Option as Meta" turned on in the terminal settings (Terminal: Profiles > Keyboard; iTerm2: Profiles > Keys).
75
+
76
+ | Mouse | Does |
77
+ | --- | --- |
78
+ | click a tab (or `✻ home`) | go to it |
79
+ | click a tab's `✕` | close it |
80
+ | click an account | select it; click it again to open it |
81
+ | `+ Add` / `✎ Edit` / `✕ Delete` | add, edit or delete the selected account |
82
+ | Failover switch (title bar) | failover on / off |
83
+ | Mode label (title bar, `mode: …`) | failover / round-robin |
84
+ | `▶ Auto` (round-robin mode) | open the next account |
85
+ | wheel | scroll a CLI's output (unless the CLI uses the mouse itself) |
86
+
87
+ In a tab, every key goes to the CLI except these:
88
+
89
+ | Key (in a tab) | Does |
90
+ | --- | --- |
91
+ | `enter` | on a failover notice: switch now; on an ended tab: restart it |
92
+ | `o` | on a failover notice: go home to pick another account |
93
+ | `q` / `esc` | on a failover notice: stay on the ended session |
94
+ | `x` | on an ended tab: close it |
95
+
96
+ ## Install
97
+
98
+ Nothing to install first. It's plain bash, which is built into macOS and Linux, and comes with Git for Windows (Claude Code on Windows needs Git anyway). It works from any shell.
99
+
100
+ **macOS / Linux / WSL**
101
+
102
+ ```bash
103
+ git clone https://github.com/Ak1Ena/ai-launcher ~/code/ai-launcher
104
+ echo 'export PATH="$HOME/code/ai-launcher/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
105
+ ```
106
+
107
+ **Windows (PowerShell)**
108
+
109
+ ```powershell
110
+ git clone https://github.com/Ak1Ena/ai-launcher $HOME\code\ai-launcher
111
+ $p = [Environment]::GetEnvironmentVariable('Path', 'User')
112
+ [Environment]::SetEnvironmentVariable('Path', "$p;$HOME\code\ai-launcher\bin", 'User')
113
+ ```
114
+
115
+ `ai.cmd`, `cla.cmd` and `cla-team.cmd` run the same script with Git Bash, so `ai` works from PowerShell, CMD or Git Bash. If Git is installed somewhere unusual, set `CLAUDE_CODE_GIT_BASH_PATH` to its `bash.exe`, the same variable Claude Code uses.
116
+
117
+ Open a new terminal and type `ai`.
118
+
119
+ **Optional extras.** Each one turns on more features. Without them, everything else still works:
120
+
121
+ | Tool | Adds | Built into |
122
+ | --- | --- | --- |
123
+ | [fzf](https://github.com/junegunn/fzf) | Arrow-key picker with search. Without it you get a numbered menu. | — |
124
+ | [jq](https://jqlang.org) | Usage bars, shared folder trust and failover | macOS 15+ |
125
+ | tmux | Claude team mode (`ctrl-t`, `cla-team`). Not on native Windows. | — |
126
+
127
+ ```bash
128
+ brew install fzf tmux # macOS (jq is built in on macOS 15+, else: brew install jq)
129
+ sudo apt install fzf jq tmux # Linux / WSL
130
+ winget install junegunn.fzf jqlang.jq # Windows (no tmux, so no team mode outside WSL)
131
+ ```
132
+
133
+ **Windows notes:**
134
+ - Folder-trust sharing between different agents is off on native Windows for now, because each agent's Windows path format still has to be verified. Sharing trust between Claude accounts still works.
135
+ - `cla add` copies your settings into a new account instead of linking them, because Git Bash can't make links by default.
136
+
137
+ ### Show Claude usage
138
+
139
+ Claude Code passes usage to its status line. To save it, point your status line at the bundled script in `~/.claude/settings.json`:
140
+
141
+ ```json
142
+ "statusLine": { "type": "command", "command": "bash ~/code/ai-launcher/scripts/statusline-usage.sh" }
143
+ ```
144
+
145
+ If you already have a status line command, add it after the script. The script passes the same input on to it:
146
+
147
+ ```json
148
+ "statusLine": { "type": "command", "command": "bash ~/code/ai-launcher/scripts/statusline-usage.sh my-statusline --flag" }
149
+ ```
150
+
151
+ Usage shows up after your next Claude reply. It is only reported on Pro and Max plans.
152
+
153
+ ## Use it
154
+
155
+ ```bash
156
+ ai # pick an agent and start it here
157
+ ai --resume # extra arguments go to the agent
158
+ ```
159
+
160
+ ![bash picker showing Claude accounts and Codex with usage bars, plus Gemini and OpenCode](docs/screenshot.png)
161
+
162
+ When a newer version is on npm, the picker shows an `update X available` line. It reads the same once-a-day cache as the TUI (refreshed in the background with `npm view`, only when npm exists). Set `AI_LAUNCHER_NO_UPDATE_CHECK=1` to turn it off.
163
+
164
+ | With fzf | Without fzf | What it does |
165
+ | --- | --- | --- |
166
+ | `enter` | `2` | Start the selected agent |
167
+ | `ctrl-t` | `t 2` | Start Claude in team mode (teammates in tmux split panes) |
168
+ | `ctrl-a` | `a` | Add an agent |
169
+ | `ctrl-e` | `e 2` | Edit the selected agent |
170
+ | `ctrl-x` | `x 2` | Delete the selected agent |
171
+ | `ctrl-f` | `f` | Turn failover on or off |
172
+ | `ctrl-o` | `o` | Open the failover priority screen |
173
+
174
+ ### Manage agents
175
+
176
+ | Command | What it does |
177
+ | --- | --- |
178
+ | `ai ls` | List agents with their launch command and label |
179
+ | `ai add [name] [command] [label]` | Add an agent. It asks for anything you leave out. |
180
+ | `ai edit <name> [command] [label]` | Change the command or label. It asks, showing the current value. Press Enter to keep it. |
181
+ | `ai rm <name>` | Delete an agent, after asking you to confirm. `ai add <name>` brings it back. |
182
+
183
+ ```bash
184
+ ai add aider "aider --model sonnet" "Aider"
185
+ ai edit claude "claude --model opus"
186
+ ```
187
+
188
+ Agents are saved in `~/.config/ai-launcher/providers`, one per line as `name<TAB>command<TAB>label`. On first run, the file is filled with the agents you have installed. A command runs like a shell alias, so quotes and `VAR=value` prefixes work.
189
+
190
+ ### Several Claude accounts
191
+
192
+ | Command | What it does |
193
+ | --- | --- |
194
+ | `cla add work` | Add an account and log in. Settings, skills and plugins are shared with `~/.claude`. |
195
+ | `cla` / `cla-team` | Pick a Claude account, then start it normally or in team mode |
196
+ | `cla work [team] [args]` | Start a specific account |
197
+ | `cla ls`, `cla rm work`, `cla mv work job` | List, remove or rename accounts |
198
+
199
+ Accounts live in `~/.claude-accounts/<name>`. Set `CLA_ROOT` to use another folder.
200
+
201
+ ### Several Codex or Gemini accounts
202
+
203
+ Add another agent that runs the same CLI. The first one uses your normal login; every one after it gets its own:
204
+
205
+ ```bash
206
+ ai add personal codex "Codex personal" # codex is already listed, so this is a separate login
207
+ ```
208
+
209
+ Start it from `ai` and log in. Each one gets its own row with its own usage bars (Codex). Logins live in `~/.ai-accounts/<cli>/<name>`, which the CLI gets as `CODEX_HOME` or `GEMINI_CLI_HOME`. Set `AI_ACCOUNTS` to use another folder. A new login starts with fresh settings: nothing is copied from the main one. `ai rm` keeps the folder, so adding the same name again gets the same login back.
210
+
211
+ Antigravity (`agy`) can't have several accounts yet: it always reads `~/.gemini/antigravity-cli` and has no setting to move it.
212
+
213
+ ### Failover
214
+
215
+ When a Claude account hits its usage limit, the same session resumes on the next account in your priority order. Codex has no limit hook, so it only gets a written handoff of the session, and the session ends there: accounts below Codex in the order are not tried. New Codex accounts start at the bottom. Failover is off until you turn it on.
216
+
217
+ ```bash
218
+ ai failover on # or ctrl-f in the picker
219
+ ai failover off
220
+ ai failover ls # members in order, with any limit still running
221
+ ```
222
+
223
+ Set the priority with `ai failover` (or `ctrl-o` in the picker). On that screen:
224
+
225
+ | With fzf | Without fzf | What it does |
226
+ | --- | --- | --- |
227
+ | `ctrl-u` / `ctrl-d` | `u 2` / `d 2` | Move the member up / down |
228
+ | `ctrl-x` | `x 2` | Turn the member on / off |
229
+ | `ctrl-r` | `r 2` | Clear its limit |
230
+ | `ctrl-f` | `f` | Turn failover on / off |
231
+
232
+ ```bash
233
+ ai failover order claude/work claude/personal codex # put these first, in this order
234
+ ai failover clear claude/work # forget a limit (no name = all)
235
+ ```
236
+
237
+ | Variable | Default | What it does |
238
+ | --- | --- | --- |
239
+ | `AI_FO_COOLDOWN` | `18000` | Seconds an account is skipped after it hits its limit |
240
+ | `AI_FO_STATE` | `${XDG_STATE_HOME:-~/.local/state}/ai-launcher/failover` | Where limit marks are kept |
241
+ | `AI_FO_PROMPT` | "...Continue the work exactly where you left off." | First message sent to the new account |
242
+
243
+ Needs jq. Not used in team mode. Limits: the cooldown is fixed, not the real reset time (use `ctrl-r` if the limit ended sooner). Codex can't trigger a failover, so put it last. Not available on native Windows (Git Bash yet); use WSL.
244
+
245
+ ## How it works
246
+
247
+ **Usage.** Nothing is fetched from the internet:
248
+ - **Claude:** reads `<account>/usage/usage.json`, written by `scripts/statusline-usage.sh`. The numbers are from that account's last session. Rows older than 10 minutes show their age, and a limit whose reset time has passed shows 0%.
249
+ - **Codex:** reads the rate limits saved in the newest `sessions` log of `~/.codex`, or of that agent's own login folder.
250
+ - **Other agents** don't save usage, so they show "no usage data".
251
+
252
+ **Folder trust.** When you start an agent through `ai` or `cla`, it checks whether the folder is trusted by any of Claude (main config and every account), Codex, Gemini, Qwen or Antigravity. If one trusts it, the folder is marked trusted in the others too.
253
+ - Only that exact folder is shared. Parent folders don't count.
254
+ - A folder you marked untrusted in an agent stays untrusted there.
255
+
256
+ **Staying awake.** On macOS, agents run under `caffeinate -i` so the machine doesn't sleep mid-task.
257
+
258
+ ## Add usage bars for another agent
259
+
260
+ An agent with no plugin gets a plain row. To show usage, create `plugins/<name>.sh`, where `<name>` is the agent's name in `ai ls`:
261
+
262
+ ```bash
263
+ _ai_mytool_rows() { # print one picker row per account
264
+ _ai_row mytool <id> <shown-name> "<label>" "$(_ai_bar 5h <percent> '<reset time>')"
265
+ }
266
+ _ai_mytool_run() { shift; _ai_exec "$(_ai_cmd mytool mytool)" "$@"; } # optional; $1 = row id
267
+ ```
268
+
269
+ To share folder trust with another agent, add its name to `AI_TRUST` and define `_ai_trust_<name>_has` and `_ai_trust_<name>_add` in `lib/trust.sh`.
270
+
271
+ ## Test
272
+
273
+ ```bash
274
+ bash tests/check.sh
275
+ /bin/bash tests/check.sh # on macOS: also check with the built-in bash 3.2
276
+ ```
277
+
278
+ This runs every feature against a throwaway home folder and never touches your real configs.
279
+
280
+ ## Releases
281
+
282
+ CI runs on branches and PRs. Every merge to main builds all platforms and creates or updates a draft release `v<version>`, where the version is in `tui/Cargo.toml`. Publishing the draft triggers the npm publish (needs the `NPM_TOKEN` secret). Bump the version in `tui/Cargo.toml` before the next release.
283
+
284
+ ## License
285
+
286
+ MIT
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "ai-launcher",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Launcher for AI coding CLIs",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Ak1Ena/ai-launcher.git"
9
+ },
10
+ "homepage": "https://github.com/Ak1Ena/ai-launcher#readme",
6
11
  "bin": {
7
12
  "ai": "bin/ai.js"
8
13
  },