sideby 0.0.0-stage → 0.2.1

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 (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -2
  3. package/README.zh-CN.md +112 -0
  4. package/dist/build.json +1 -0
  5. package/dist/src/cli/args.d.ts +13 -0
  6. package/dist/src/cli/args.js +38 -0
  7. package/dist/src/cli/commands.d.ts +50 -0
  8. package/dist/src/cli/commands.js +566 -0
  9. package/dist/src/cli/format.d.ts +16 -0
  10. package/dist/src/cli/format.js +80 -0
  11. package/dist/src/cli/json-schemas.d.ts +2 -0
  12. package/dist/src/cli/json-schemas.js +259 -0
  13. package/dist/src/cli/main.d.ts +2 -0
  14. package/dist/src/cli/main.js +276 -0
  15. package/dist/src/cli/schemas.d.ts +1 -0
  16. package/dist/src/cli/schemas.js +16 -0
  17. package/dist/src/core/account-name.d.ts +2 -0
  18. package/dist/src/core/account-name.js +2 -0
  19. package/dist/src/core/accounts.d.ts +20 -0
  20. package/dist/src/core/accounts.js +131 -0
  21. package/dist/src/core/config.d.ts +61 -0
  22. package/dist/src/core/config.js +184 -0
  23. package/dist/src/core/create.d.ts +30 -0
  24. package/dist/src/core/create.js +126 -0
  25. package/dist/src/core/doctor.d.ts +41 -0
  26. package/dist/src/core/doctor.js +171 -0
  27. package/dist/src/core/errors.d.ts +12 -0
  28. package/dist/src/core/errors.js +14 -0
  29. package/dist/src/core/file-memo.d.ts +24 -0
  30. package/dist/src/core/file-memo.js +41 -0
  31. package/dist/src/core/fs-safe.d.ts +38 -0
  32. package/dist/src/core/fs-safe.js +205 -0
  33. package/dist/src/core/handoff.d.ts +41 -0
  34. package/dist/src/core/handoff.js +54 -0
  35. package/dist/src/core/identity.d.ts +23 -0
  36. package/dist/src/core/identity.js +79 -0
  37. package/dist/src/core/last-doctor.d.ts +36 -0
  38. package/dist/src/core/last-doctor.js +69 -0
  39. package/dist/src/core/launch.d.ts +37 -0
  40. package/dist/src/core/launch.js +108 -0
  41. package/dist/src/core/login-path.d.ts +23 -0
  42. package/dist/src/core/login-path.js +96 -0
  43. package/dist/src/core/paths.d.ts +13 -0
  44. package/dist/src/core/paths.js +32 -0
  45. package/dist/src/core/quota-levels.d.ts +19 -0
  46. package/dist/src/core/quota-levels.js +34 -0
  47. package/dist/src/core/resume.d.ts +9 -0
  48. package/dist/src/core/resume.js +15 -0
  49. package/dist/src/core/secret-file.d.ts +30 -0
  50. package/dist/src/core/secret-file.js +116 -0
  51. package/dist/src/core/share-meaning.d.ts +6 -0
  52. package/dist/src/core/share-meaning.js +32 -0
  53. package/dist/src/core/share-mode-names.d.ts +1 -0
  54. package/dist/src/core/share-mode-names.js +10 -0
  55. package/dist/src/core/share-modes.d.ts +24 -0
  56. package/dist/src/core/share-modes.js +405 -0
  57. package/dist/src/core/shell-init.d.ts +31 -0
  58. package/dist/src/core/shell-init.js +84 -0
  59. package/dist/src/core/skill-check.d.ts +11 -0
  60. package/dist/src/core/skill-check.js +57 -0
  61. package/dist/src/core/usage-days.d.ts +15 -0
  62. package/dist/src/core/usage-days.js +33 -0
  63. package/dist/src/core/version.d.ts +9 -0
  64. package/dist/src/core/version.js +46 -0
  65. package/dist/src/desktop/app.d.ts +60 -0
  66. package/dist/src/desktop/app.js +316 -0
  67. package/dist/src/desktop/icon.d.ts +16 -0
  68. package/dist/src/desktop/icon.js +174 -0
  69. package/dist/src/families/claude/index.d.ts +10 -0
  70. package/dist/src/families/claude/index.js +127 -0
  71. package/dist/src/families/claude/layout.d.ts +6 -0
  72. package/dist/src/families/claude/layout.js +5 -0
  73. package/dist/src/families/claude/quota-cache.d.ts +31 -0
  74. package/dist/src/families/claude/quota-cache.js +111 -0
  75. package/dist/src/families/claude/quota.d.ts +3 -0
  76. package/dist/src/families/claude/quota.js +53 -0
  77. package/dist/src/families/claude/usage.d.ts +22 -0
  78. package/dist/src/families/claude/usage.js +146 -0
  79. package/dist/src/families/codex/index.d.ts +5 -0
  80. package/dist/src/families/codex/index.js +70 -0
  81. package/dist/src/families/codex/rollout.d.ts +67 -0
  82. package/dist/src/families/codex/rollout.js +298 -0
  83. package/dist/src/families/grok/index.d.ts +8 -0
  84. package/dist/src/families/grok/index.js +82 -0
  85. package/dist/src/families/index.d.ts +3 -0
  86. package/dist/src/families/index.js +40 -0
  87. package/dist/src/families/logos.d.ts +21 -0
  88. package/dist/src/families/logos.js +26 -0
  89. package/dist/src/families/pi/index.d.ts +3 -0
  90. package/dist/src/families/pi/index.js +54 -0
  91. package/dist/src/families/shared/sessions.d.ts +9 -0
  92. package/dist/src/families/shared/sessions.js +70 -0
  93. package/dist/src/families/shared/toml.d.ts +5 -0
  94. package/dist/src/families/shared/toml.js +16 -0
  95. package/dist/src/index.d.ts +5 -0
  96. package/dist/src/index.js +4 -0
  97. package/dist/src/panel/background.d.ts +62 -0
  98. package/dist/src/panel/background.js +274 -0
  99. package/dist/src/panel/handler.d.ts +91 -0
  100. package/dist/src/panel/handler.js +396 -0
  101. package/dist/src/panel/i18n.d.ts +287 -0
  102. package/dist/src/panel/i18n.js +570 -0
  103. package/dist/src/panel/page-logic.d.ts +154 -0
  104. package/dist/src/panel/page-logic.js +326 -0
  105. package/dist/src/panel/page-script.d.ts +2 -0
  106. package/dist/src/panel/page-script.js +1633 -0
  107. package/dist/src/panel/page-styles.d.ts +7 -0
  108. package/dist/src/panel/page-styles.js +514 -0
  109. package/dist/src/panel/page.d.ts +20 -0
  110. package/dist/src/panel/page.js +96 -0
  111. package/dist/src/panel/server.d.ts +32 -0
  112. package/dist/src/panel/server.js +133 -0
  113. package/dist/src/panel/theme.d.ts +116 -0
  114. package/dist/src/panel/theme.js +132 -0
  115. package/dist/src/plugins/account-script.d.ts +4 -0
  116. package/dist/src/plugins/account-script.js +66 -0
  117. package/dist/src/plugins/bus.d.ts +33 -0
  118. package/dist/src/plugins/bus.js +84 -0
  119. package/dist/src/plugins/loader.d.ts +58 -0
  120. package/dist/src/plugins/loader.js +250 -0
  121. package/dist/src/quota/claude-statusline.d.ts +28 -0
  122. package/dist/src/quota/claude-statusline.js +301 -0
  123. package/dist/src/quota/statusline-tap.d.ts +11 -0
  124. package/dist/src/quota/statusline-tap.js +104 -0
  125. package/dist/src/runtime.d.ts +195 -0
  126. package/dist/src/runtime.js +424 -0
  127. package/dist/src/types.d.ts +285 -0
  128. package/dist/src/types.js +3 -0
  129. package/dist/testing/demo.d.ts +8 -0
  130. package/dist/testing/demo.js +50 -0
  131. package/dist/testing/index.d.ts +36 -0
  132. package/dist/testing/index.js +118 -0
  133. package/package.json +66 -4
  134. package/schemas/alias.json +102 -0
  135. package/schemas/app-install.json +74 -0
  136. package/schemas/app-uninstall.json +54 -0
  137. package/schemas/config.json +170 -0
  138. package/schemas/doctor.json +229 -0
  139. package/schemas/error.json +25 -0
  140. package/schemas/families.json +205 -0
  141. package/schemas/list.json +177 -0
  142. package/schemas/new.json +199 -0
  143. package/schemas/next.json +127 -0
  144. package/schemas/plugins.json +74 -0
  145. package/schemas/quota-setup.json +60 -0
  146. package/schemas/quota-teardown.json +30 -0
  147. package/schemas/quota.json +203 -0
  148. package/skills/sideby/SKILL.md +61 -0
  149. package/skills/sideby/references/accounts.md +31 -0
  150. package/skills/sideby/references/diagnose.md +47 -0
  151. package/skills/sideby/references/handoff.md +41 -0
  152. package/skills/sideby/references/quota.md +14 -0
  153. package/skills/sideby/references/setup.md +31 -0
  154. package/skills/sideby/references/sharing.md +17 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adonis0123
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 CHANGED
@@ -1,3 +1,112 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img alt="sideby: one shared config, every account in its own terminal" src="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/banner.jpg" width="880">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <p align="center">
6
+ <b>Run every AI coding account side by side.</b><br>
7
+ Claude Code, Codex, Grok Build and pi: one directory per account, one shared set of skills, hooks and rules, one panel for every quota.
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/sideby"><img alt="npm" src="https://img.shields.io/npm/v/sideby"></a>
12
+ <a href="https://github.com/Adonis0123/sideby/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Adonis0123/sideby/actions/workflows/ci.yml/badge.svg"></a>
13
+ <img alt="Node 22.18+" src="https://img.shields.io/badge/node-%E2%89%A522.18-339933">
14
+ <a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/license-MIT-blue"></a>
15
+ </p>
16
+
17
+ <p align="center">English | <a href="README.zh-CN.md">中文</a></p>
18
+
19
+ ## Why
20
+
21
+ You have a work subscription, a personal one and maybe an API key. Switching tools rewrite the Host's global config, so only one account is live at a time, and your skills and hooks slowly drift apart between accounts.
22
+
23
+ - **Side by side, not switching.** Each account lives in its own directory, and sideby starts the official CLI with that directory selected. Run three accounts in three terminals; your shell is never changed.
24
+ - **One copy of skills, hooks and rules.** Your Main Account (for example `~/.claude`) is the source. Other accounts link or copy its Shared Items ([what is shared](docs/guide/usage.md#what-each-account-shares)), and `sideby doctor --fix` repairs drift without touching real files or credentials.
25
+ - **Every quota on one screen.** 5-hour and 7-day quota, reset times and 7-day token usage for every account. Out of room? `sideby next` starts the account with the most left. All from local files: no network calls, no token reads.
26
+
27
+ ## Quick start
28
+
29
+ Requires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build or pi) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) ("Set up sideby for a user") instead.
30
+
31
+ ```sh
32
+ npm i -g sideby
33
+ sideby new claude work # create ~/.claude-work, sharing ~/.claude's skills and hooks
34
+ sideby login claude:work # sign in once
35
+ sideby run work # Claude Code on the work account
36
+ sideby ui # every account's quota at http://127.0.0.1:17420
37
+ ```
38
+
39
+ `sideby run claude:main` keeps using `~/.claude` in another terminal at the same time. Arguments after `--` go to the Host: `sideby run work -- --resume`. To try it without installing, run `npx sideby`.
40
+
41
+ ## Set up with your AI agent
42
+
43
+ Paste this into Claude Code, Codex or any coding agent:
44
+
45
+ ```text
46
+ Install the sideby CLI (npm package `sideby`) and its agent skill, then set up a second Claude Code account for me.
47
+ Follow "Set up sideby for a user" in https://raw.githubusercontent.com/Adonis0123/sideby/main/llms.txt
48
+ ```
49
+
50
+ The agent checks Node and your Host CLIs, installs sideby and the skill, creates the account, tells you what it shares with your main one and makes its short command work. You sign in once in your browser; the agent gives you that one command. Once the skill is installed, short requests work too: "add another Claude account, cc008", "what do my Codex accounts share?", "which account still has quota?".
51
+
52
+ ## What it looks like
53
+
54
+ <img alt="sideby in a terminal: list accounts, check quota, pick the next account, find and fix drift" src="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/demo.gif" width="1320">
55
+
56
+ <picture>
57
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel-dark.png">
58
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png">
59
+ <img alt="sideby panel: every account's 5h and 7d quota, 7-day token usage and health in one page" src="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png" width="1280">
60
+ </picture>
61
+
62
+ ## What else it does
63
+
64
+ | You want to | Run | Guide |
65
+ |---|---|---|
66
+ | Add an API key account (DeepSeek, a gateway, …) | `sideby new claude deepseek --api` | [API accounts](docs/guide/usage.md#api-accounts) |
67
+ | Find and fix config drift between accounts | `sideby doctor --fix` | [Doctor](docs/guide/usage.md#doctor) |
68
+ | See Claude quota (Codex needs no setup) | `sideby quota setup claude --yes` | [Claude quota](docs/guide/usage.md#claude-quota) |
69
+ | Move on when an account hits its limit | `sideby next claude` | [Handoff](docs/guide/usage.md#when-an-account-hits-its-limit) |
70
+ | Short commands such as `ccw` | `sideby alias add ccw claude:work` | [Shell functions](docs/guide/configuration.md#shell-functions) |
71
+ | Reopen a session from Orca and the like in the account that holds it | `"resumeRouting": true` in config | [Resuming from other tools](docs/guide/configuration.md#resuming-from-other-tools) |
72
+ | Open the panel from the Dock or app menu | `sideby app install` | [Desktop app](docs/guide/panel.md#desktop-app) |
73
+ | Show the panel inside your own local page | `createPanelHandler()` | [Embed the panel](docs/guide/panel.md#embed-the-panel) |
74
+ | Add a Host or a pre-launch check | a local plugin | [Plugins](docs/guide/plugins.md) |
75
+
76
+ ## Supported hosts
77
+
78
+ | Host | Account directories | Sign-in | Quota | Usage (7 days) |
79
+ |---|---|---|---|---|
80
+ | Claude Code | `~/.claude`, `~/.claude-<name>` | `claude auth login` | ✓ after `quota setup claude` | ✓ |
81
+ | Codex CLI | `~/.codex`, `~/.codex-<name>` | `codex login` | ✓ | ✓ |
82
+ | Grok Build | `~/.grok`, `~/.grok-<name>` | `grok login` | no public source | no public source |
83
+ | pi | `~/.pi/agent`, `~/.pi-<name>/agent` | `/login` inside pi | no public source | no public source |
84
+
85
+ sideby starts the official binary on your `PATH` and never patches it. Tested versions and per-Host notes are in the [guide](docs/guide/usage.md#host-notes).
86
+
87
+ ## Safe by design
88
+
89
+ - It never edits a Host's global config to switch accounts, and never rotates accounts by itself.
90
+ - It never reads, prints or sends a credential value. Nothing leaves your machine: sideby calls no remote service.
91
+ - `doctor --fix` never replaces a real file and never changes where a link points.
92
+
93
+ Details and the terms-of-service question are in the [FAQ](docs/guide/faq.md).
94
+
95
+ ## Docs
96
+
97
+ - [Using sideby](docs/guide/usage.md): accounts, API accounts, Doctor, quota, Handoff, Host notes
98
+ - [Commands](docs/guide/commands.md): every command, exit codes and `--json`
99
+ - [Configuration](docs/guide/configuration.md): `config.json`, aliases, shell functions
100
+ - [Panel](docs/guide/panel.md): the panel, desktop app and embedding
101
+ - [Plugins](docs/guide/plugins.md): write your own Family or launch hook
102
+ - [FAQ](docs/guide/faq.md): terms of service, data locations, alternatives, uninstall
103
+
104
+ ## For AI agents
105
+
106
+ - [`llms.txt`](llms.txt): setup steps, commands, JSON contract and plugin API in one index. `sideby families --json` states what each Host's accounts share.
107
+ - [`skills/sideby/SKILL.md`](skills/sideby/SKILL.md): one Agent Skill for seeing, repairing and creating accounts and for moving on when one hits its limit. Install with `npx skills add Adonis0123/sideby -g`; `sideby doctor` warns when the installed copy is for another sideby version.
108
+ - [`AGENTS.md`](AGENTS.md): rules for agents working on this repository.
109
+
110
+ ## License
111
+
112
+ [MIT](LICENSE)
@@ -0,0 +1,112 @@
1
+ <p align="center">
2
+ <img alt="sideby:一份共享配置,每个账号一个终端" src="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/banner.jpg" width="880">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <b>Run every AI coding account side by side.</b><br>
7
+ 把 Claude Code、Codex、Grok Build、pi 的多个账号并排跑起来:每个账号一个目录,skills、hooks、规则共用一份,额度在一个面板里看完。
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/sideby"><img alt="npm" src="https://img.shields.io/npm/v/sideby"></a>
12
+ <a href="https://github.com/Adonis0123/sideby/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Adonis0123/sideby/actions/workflows/ci.yml/badge.svg"></a>
13
+ <img alt="Node 22.18+" src="https://img.shields.io/badge/node-%E2%89%A522.18-339933">
14
+ <a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/license-MIT-blue"></a>
15
+ </p>
16
+
17
+ <p align="center"><a href="README.md">English</a> | 中文</p>
18
+
19
+ ## 为什么用 sideby
20
+
21
+ 你有一个工作订阅、一个个人订阅,可能还有一个 API key。切换类工具会改宿主的全局配置,同一时间只有一个账号生效;各账号的 skills 和 hooks 也会慢慢变得不一致。
22
+
23
+ - **并排,不切换。** 每个账号一个独立目录,sideby 启动官方 CLI 时选中这个目录。三个账号可以同时开在三个终端里,你的 shell 环境不受影响。
24
+ - **skills、hooks、规则只维护一份。** 主账号(例如 `~/.claude`)是唯一来源,其他账号链接或复制它的共享项(Shared Item,[共享了哪些](docs/guide/usage.zh-CN.md#每个账号共享什么))。`sideby doctor --fix` 修复漂移,不碰真实文件,也不碰凭据。
25
+ - **额度一屏看完。** 每个账号的 5 小时、7 天额度、重置时间和近 7 天 token 用量。额度用完了,`sideby next` 帮你启动剩余最多的账号。数据都来自本地文件:不联网,不读 token。
26
+
27
+ ## 快速上手
28
+
29
+ 需要 Node 22.18 或更高版本,并且至少装好一个宿主 CLI(Claude Code、Codex、Grok Build 或 pi)。AI agent 请改按 [`llms.txt`](llms.txt) 里 "Set up sideby for a user" 的步骤做。
30
+
31
+ ```sh
32
+ npm i -g sideby
33
+ sideby new claude work # 新建 ~/.claude-work,共用 ~/.claude 的 skills 和 hooks
34
+ sideby login claude:work # 登录一次
35
+ sideby run work # 用 work 账号启动 Claude Code
36
+ sideby ui # 在 http://127.0.0.1:17420 查看所有账号的额度
37
+ ```
38
+
39
+ `sideby run claude:main` 可以同时在另一个终端里继续用 `~/.claude`。`--` 之后的参数原样交给宿主:`sideby run work -- --resume`。不想安装,可以先跑 `npx sideby` 试试。
40
+
41
+ ## 让 AI 帮你装
42
+
43
+ 把下面这段粘贴给 Claude Code、Codex 或其他 coding agent:
44
+
45
+ ```text
46
+ 帮我安装 sideby(npm 包 `sideby`)和它的 agent skill,再给我加一个 Claude Code 账号。
47
+ 按 https://raw.githubusercontent.com/Adonis0123/sideby/main/llms.txt 里 "Set up sideby for a user" 的步骤来。
48
+ ```
49
+
50
+ agent 会检查 Node 和宿主 CLI,装好 sideby 和 skill,建账号,告诉你它和主账号共享什么,并让短命令生效。你只需要在浏览器里登录一次,agent 会把那一行命令给你。装好 skill 之后,简短的说法也行:「再加一个 Claude 账号,叫 cc008」「我的 Codex 账号共享了什么」「哪个账号还有额度」。
51
+
52
+ ## 长什么样
53
+
54
+ <img alt="终端里的 sideby:列出账号、查看额度、推荐下一个账号、发现并修复漂移" src="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/demo.gif" width="1320">
55
+
56
+ <picture>
57
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel-dark.png">
58
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png">
59
+ <img alt="sideby 面板:每个账号的 5h、7d 额度,近 7 天 token 用量和健康状态" src="https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png" width="1280">
60
+ </picture>
61
+
62
+ ## 还能做什么
63
+
64
+ | 你想 | 命令 | 说明 |
65
+ |---|---|---|
66
+ | 加一个 API key 账号(DeepSeek、网关等) | `sideby new claude deepseek --api` | [API 账号](docs/guide/usage.zh-CN.md#api-账号) |
67
+ | 找出并修复账号之间的配置漂移 | `sideby doctor --fix` | [体检](docs/guide/usage.zh-CN.md#体检doctor) |
68
+ | 看 Claude 额度(Codex 不用设置) | `sideby quota setup claude --yes` | [Claude 额度](docs/guide/usage.zh-CN.md#claude-额度) |
69
+ | 账号撞上限额时换一个接着用 | `sideby next claude` | [接力](docs/guide/usage.zh-CN.md#账号撞上限额时) |
70
+ | 用 `ccw` 这样的短命令 | `sideby alias add ccw claude:work` | [Shell 函数](docs/guide/configuration.zh-CN.md#shell-函数) |
71
+ | 在 Orca 这类工具里重开会话时,自动进到存有它的账号 | config 里写 `"resumeRouting": true` | [从其他工具恢复会话](docs/guide/configuration.zh-CN.md#从其他工具恢复会话) |
72
+ | 从 Dock 或应用菜单打开面板 | `sideby app install` | [桌面应用](docs/guide/panel.zh-CN.md#桌面应用) |
73
+ | 把面板嵌进自己的本地页面 | `createPanelHandler()` | [嵌入面板](docs/guide/panel.zh-CN.md#嵌入面板) |
74
+ | 新增一个宿主,或加启动前检查 | 本地插件 | [插件](docs/guide/plugins.zh-CN.md) |
75
+
76
+ ## 支持的宿主
77
+
78
+ | 宿主 | 账号目录 | 登录 | 额度 | 用量(7 天) |
79
+ |---|---|---|---|---|
80
+ | Claude Code | `~/.claude`、`~/.claude-<name>` | `claude auth login` | ✓ 需先 `quota setup claude` | ✓ |
81
+ | Codex CLI | `~/.codex`、`~/.codex-<name>` | `codex login` | ✓ | ✓ |
82
+ | Grok Build | `~/.grok`、`~/.grok-<name>` | `grok login` | 无公开来源 | 无公开来源 |
83
+ | pi | `~/.pi/agent`、`~/.pi-<name>/agent` | 在 pi 里输入 `/login` | 无公开来源 | 无公开来源 |
84
+
85
+ sideby 启动 `PATH` 上的官方程序,从不修改它。测试过的版本和各宿主的注意事项见[使用指南](docs/guide/usage.zh-CN.md#宿主说明)。
86
+
87
+ ## 安全边界
88
+
89
+ - 不改宿主的全局配置来切换账号,也不会自己轮换账号。
90
+ - 不读取、不打印、不发送任何凭据的值。数据不出本机:sideby 不调用任何远程服务。
91
+ - `doctor --fix` 不替换真实文件,也不改链接的指向。
92
+
93
+ 细节和服务条款的问题见[常见问题](docs/guide/faq.zh-CN.md)。
94
+
95
+ ## 文档
96
+
97
+ - [使用指南](docs/guide/usage.zh-CN.md):账号、API 账号、体检、额度、接力、宿主说明
98
+ - [命令](docs/guide/commands.zh-CN.md):所有命令、退出码和 `--json`
99
+ - [配置](docs/guide/configuration.zh-CN.md):`config.json`、短命令、Shell 函数
100
+ - [面板](docs/guide/panel.zh-CN.md):面板、桌面应用、嵌入
101
+ - [插件](docs/guide/plugins.zh-CN.md):自己写家族或启动 hook
102
+ - [常见问题](docs/guide/faq.zh-CN.md):服务条款、数据位置、同类工具对比、卸载
103
+
104
+ ## 给 AI agent
105
+
106
+ - [`llms.txt`](llms.txt):安装步骤、命令、JSON 契约和插件 API 的索引。`sideby families --json` 给出每个宿主的账号共享什么。
107
+ - [`skills/sideby/SKILL.md`](skills/sideby/SKILL.md):一个 Agent Skill,用来查看、修复、新建账号,以及在额度用完时换账号。用 `npx skills add Adonis0123/sideby -g` 安装;装的版本和 sideby 不一致时,`sideby doctor` 会提醒。
108
+ - [`AGENTS.md`](AGENTS.md):给维护本仓库的 agent 的规则。
109
+
110
+ ## 许可证
111
+
112
+ [MIT](LICENSE)
@@ -0,0 +1 @@
1
+ {"id":"20261008T092033-baf95a"}
@@ -0,0 +1,13 @@
1
+ export declare class UsageError extends Error {
2
+ }
3
+ export interface ParsedArgs {
4
+ positionals: string[];
5
+ flags: Map<string, string | true>;
6
+ /** Everything after the first `--`, untouched. */
7
+ rest: string[];
8
+ }
9
+ /**
10
+ * Parses `--flag`, `--flag=value` and `--flag value` (for flags listed in `valued`).
11
+ * Unknown flags are usage errors so typos never silently change behaviour.
12
+ */
13
+ export declare function parseArgs(argv: readonly string[], known: readonly string[], valued?: readonly string[]): ParsedArgs;
@@ -0,0 +1,38 @@
1
+ export class UsageError extends Error {
2
+ }
3
+ /**
4
+ * Parses `--flag`, `--flag=value` and `--flag value` (for flags listed in `valued`).
5
+ * Unknown flags are usage errors so typos never silently change behaviour.
6
+ */
7
+ export function parseArgs(argv, known, valued = []) {
8
+ const positionals = [];
9
+ const flags = new Map();
10
+ for (let i = 0; i < argv.length; i++) {
11
+ const a = argv[i];
12
+ if (a === '--')
13
+ return { positionals, flags, rest: argv.slice(i + 1) };
14
+ if (a.startsWith('--') && a.length > 2) {
15
+ const [name, value] = a.slice(2).split(/=(.*)/s, 2);
16
+ if (!known.includes(name) && !valued.includes(name))
17
+ throw new UsageError(`unknown option --${name}`);
18
+ if (valued.includes(name)) {
19
+ const v = value ?? argv[++i];
20
+ if (v === undefined)
21
+ throw new UsageError(`--${name} needs a value`);
22
+ flags.set(name, v);
23
+ }
24
+ else {
25
+ if (value !== undefined)
26
+ throw new UsageError(`--${name} does not take a value`);
27
+ flags.set(name, true);
28
+ }
29
+ continue;
30
+ }
31
+ if (a === '-h') {
32
+ flags.set('help', true);
33
+ continue;
34
+ }
35
+ positionals.push(a);
36
+ }
37
+ return { positionals, flags, rest: [] };
38
+ }
@@ -0,0 +1,50 @@
1
+ import type { DoctorReport } from '../core/doctor.ts';
2
+ import type { Finding } from '../types.ts';
3
+ import { type ParsedArgs } from './args.ts';
4
+ export interface Io {
5
+ out(s: string): void;
6
+ err(s: string): void;
7
+ }
8
+ export declare function serializeDoctor(r: DoctorReport): {
9
+ status: "issues" | "ok";
10
+ accounts: {
11
+ ref: string;
12
+ family: string;
13
+ name: string;
14
+ kind: import("../types.ts").Account['kind'];
15
+ dir: string;
16
+ shared: {
17
+ ok: number;
18
+ total: number;
19
+ };
20
+ backups: number;
21
+ findings: Omit<Finding, "fix">[];
22
+ }[];
23
+ general: Omit<Finding, "fix">[];
24
+ fixes: import("../core/doctor.ts").FixOutcome[];
25
+ };
26
+ export declare function cmdList(a: ParsedArgs, io: Io): Promise<number>;
27
+ export interface NewSuggestion {
28
+ name: string;
29
+ alias?: string;
30
+ /** Why the alias the pattern suggests was left out (taken, reserved); the Account is created without it. */
31
+ aliasProblem?: string;
32
+ }
33
+ export declare function cmdNew(a: ParsedArgs, io: Io): Promise<number>;
34
+ export declare function cmdRun(a: ParsedArgs, io: Io, command: 'run' | 'login'): Promise<number>;
35
+ /**
36
+ * `sideby resume <family>`: what the Host-named shell function calls (spec §3.15). Starts the Account that holds the
37
+ * session the arguments resume by id, or runs the Host unchanged.
38
+ */
39
+ export declare function cmdResume(a: ParsedArgs, io: Io): Promise<number>;
40
+ /** `sideby next <family>`: recommend the Account with the most room, then start it (spec §3.13). */
41
+ export declare function cmdNext(a: ParsedArgs, io: Io): Promise<number>;
42
+ export declare function cmdDoctor(a: ParsedArgs, io: Io): Promise<number>;
43
+ export declare function cmdQuota(a: ParsedArgs, io: Io): Promise<number>;
44
+ export declare function cmdPlugins(a: ParsedArgs, io: Io): Promise<number>;
45
+ export declare function cmdShellInit(a: ParsedArgs, io: Io): Promise<number>;
46
+ export declare function cmdUi(a: ParsedArgs, io: Io): Promise<number>;
47
+ export declare function cmdApp(a: ParsedArgs, io: Io): Promise<number>;
48
+ export declare function cmdAlias(a: ParsedArgs, io: Io): Promise<number>;
49
+ /** `sideby families [family]`: each Family's layout, sign-in and Shared Items, from its FamilyDef (spec §3.16). */
50
+ export declare function cmdFamilies(a: ParsedArgs, io: Io): Promise<number>;