claude-org 0.1.0 → 0.2.0
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/CHANGELOG.md +6 -1
- package/README.md +20 -8
- package/lib/usage.js +6 -5
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.2.0 — 2026-10-03
|
|
4
|
+
|
|
5
|
+
- Add `ccorg` as a short command alias for `claude-org` (same binary)
|
|
6
|
+
- Docs: clarify Setup (org picker, token is printed and saved manually, repeat once per org); example labels are `work` / `personal` and explicitly arbitrary
|
|
7
|
+
|
|
8
|
+
## 0.1.0 — 2026-10-03
|
|
4
9
|
|
|
5
10
|
Initial public release.
|
|
6
11
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Launch [Claude Code](https://code.claude.com) under a specific Anthropic **organization** — and keep running when the 5-hour usage limit hits, by failing over to another org you belong to.
|
|
4
4
|
|
|
5
|
-
When one account has multiple Claude organizations (e.g. a personal
|
|
5
|
+
When one account has multiple Claude organizations (e.g. a personal org and your company's org, or several personal orgs), hitting the usage limit stalls your session. `claude-org` switches the credential `claude` starts with, and — in `proxy` mode — swaps it **mid-session** the moment the limit hits, so a long-running task never stops.
|
|
6
6
|
|
|
7
7
|
Requires Node.js 18+. Zero runtime dependencies. Works on Windows, macOS, and Linux.
|
|
8
8
|
|
|
@@ -12,31 +12,43 @@ Requires Node.js 18+. Zero runtime dependencies. Works on Windows, macOS, and Li
|
|
|
12
12
|
npm install -g claude-org
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
This installs two commands that behave identically: `claude-org` and the shorter alias `ccorg`. Examples below use `claude-org`; substitute `ccorg` anywhere.
|
|
16
|
+
|
|
15
17
|
## Setup
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Each org you want to switch between needs its own long-lived token, saved under a label you choose. The plain `claude` login (no token file) is called the **default org** and needs no setup.
|
|
20
|
+
|
|
21
|
+
Repeat steps 1–2 **once per org**:
|
|
22
|
+
|
|
23
|
+
1. Generate a token for one org (valid ~1 year):
|
|
18
24
|
|
|
19
25
|
```sh
|
|
20
26
|
claude setup-token
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
A browser opens. If your account belongs to several orgs, an **org picker** appears — choose the org this token is for. Approve, paste the auth code back into the terminal, and `claude setup-token` **prints the token to stdout**. It does not save it anywhere; you save it in the next step.
|
|
24
30
|
|
|
25
|
-
2. Save
|
|
31
|
+
2. Save that token (no trailing newline) as `~/.claude/org-tokens/<name>.token`. `<name>` is just a label you pick — it does not need to match the org's plan or display name. `work` and `personal` are common; `client-a`, `personal2`, etc. are equally fine.
|
|
26
32
|
|
|
27
33
|
```sh
|
|
28
34
|
# bash / macOS / Linux
|
|
29
35
|
mkdir -p ~/.claude/org-tokens
|
|
30
|
-
printf '%s' '<token>' > ~/.claude/org-tokens/
|
|
36
|
+
printf '%s' '<token>' > ~/.claude/org-tokens/work.token
|
|
31
37
|
```
|
|
32
38
|
|
|
33
39
|
```powershell
|
|
34
40
|
# PowerShell
|
|
35
41
|
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\org-tokens" | Out-Null
|
|
36
|
-
Set-Content -NoNewline "$env:USERPROFILE\.claude\org-tokens\
|
|
42
|
+
Set-Content -NoNewline "$env:USERPROFILE\.claude\org-tokens\work.token" "<token>"
|
|
37
43
|
```
|
|
38
44
|
|
|
39
|
-
The
|
|
45
|
+
The token may visually wrap onto two lines in the terminal — join it into one.
|
|
46
|
+
|
|
47
|
+
3. Check that each label points at the org you intended:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
claude-org status
|
|
51
|
+
```
|
|
40
52
|
|
|
41
53
|
## Commands
|
|
42
54
|
|
|
@@ -44,7 +56,7 @@ npm install -g claude-org
|
|
|
44
56
|
|---|---|
|
|
45
57
|
| `claude-org proxy [claude args...]` | Launch via a local proxy: a **running** session fails over to another org the moment the 5h limit hits. Needs 2+ org tokens (incl. one for the default side). |
|
|
46
58
|
| `claude-org auto [claude args...]` | Launch on the preferred org if usable, else on the default org. Decided once at launch. |
|
|
47
|
-
| `claude-org <name> [claude args...]` | Launch with that org's token, e.g. `claude-org
|
|
59
|
+
| `claude-org <name> [claude args...]` | Launch with that org's token, e.g. `claude-org work --resume`. |
|
|
48
60
|
| `claude-org probe [<name>]` | Print the org's 5h window state on one line (`status= 5h_util= 5h_reset= 5h_reset_local=`). Exit 0 when `allowed`. |
|
|
49
61
|
| `claude-org watch` | Poll the preferred org until its window recovers, then notify (terminal + optional `CLAUDE_ORG_NOTIFY_CMD`). |
|
|
50
62
|
| `claude-org status` | `claude auth status` for every saved token + the default login. |
|
package/lib/usage.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
// Usage text shown for `claude-org` with no args (exit 2) and for
|
|
4
4
|
// help/--help/-h (exit 0). Kept compatible with the original bash version.
|
|
5
|
-
const USAGE = `claude-org: launch Claude Code with a specific org's long-lived token
|
|
5
|
+
const USAGE = `claude-org (alias: ccorg): launch Claude Code with a specific org's long-lived token
|
|
6
6
|
(switch between the "default org" login and "token orgs").
|
|
7
7
|
|
|
8
|
-
Background: when one email has multiple Claude orgs (e.g. a personal
|
|
9
|
-
|
|
8
|
+
Background: when one email has multiple Claude orgs (e.g. a personal org and
|
|
9
|
+
your company's org) and you hit the usage limit, you want to continue on the other
|
|
10
10
|
org with --resume. Claude Code has no org-switch command, but
|
|
11
11
|
CLAUDE_CODE_OAUTH_TOKEN (env) takes precedence over the saved OAuth login
|
|
12
12
|
(https://code.claude.com/docs/en/authentication "Authentication precedence").
|
|
13
13
|
Get a token per org with \`claude setup-token\` (valid 1 year) and store it as
|
|
14
|
-
~/.claude/org-tokens/<name>.token.
|
|
14
|
+
~/.claude/org-tokens/<name>.token. <name> is any label you choose (e.g. work,
|
|
15
|
+
personal). The plain login (no env) org is called "default";
|
|
15
16
|
no token file is needed for it.
|
|
16
17
|
|
|
17
18
|
Usage (<prefer> resolves: CLAUDE_ORG_PREFER -> first of CLAUDE_ORG_ORDER -> first
|
|
@@ -22,7 +23,7 @@ token org alphabetically):
|
|
|
22
23
|
connector MCPs are unavailable)
|
|
23
24
|
claude-org auto [claude args...] launch on <prefer> if usable, else default
|
|
24
25
|
(decided once at launch)
|
|
25
|
-
claude-org <name> [claude args...] e.g. claude-org
|
|
26
|
+
claude-org <name> [claude args...] e.g. claude-org work --resume
|
|
26
27
|
claude-org probe [<name>] print the org's 5h window state on one line
|
|
27
28
|
(exit 0 when allowed)
|
|
28
29
|
claude-org watch wait until <prefer> recovers, then notify
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-org",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Switch Claude Code between multiple Anthropic organizations, with automatic failover on the 5-hour rate limit",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|
|
8
|
-
"claude-org": "bin/claude-org.js"
|
|
8
|
+
"claude-org": "bin/claude-org.js",
|
|
9
|
+
"ccorg": "bin/claude-org.js"
|
|
9
10
|
},
|
|
10
11
|
"engines": {
|
|
11
12
|
"node": ">=18"
|