@moonmath-ai/zro 0.1.16 → 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.
- package/LICENSE +21 -0
- package/README.md +101 -74
- package/SECURITY.md +35 -0
- package/dist/args.d.ts +2 -4
- package/dist/args.js +182 -66
- package/dist/args.js.map +1 -1
- package/dist/catalog.d.ts +17 -0
- package/dist/catalog.js +25 -0
- package/dist/catalog.js.map +1 -0
- package/dist/{constants.d.ts → engine/constants.d.ts} +32 -1
- package/dist/{constants.js → engine/constants.js} +31 -1
- package/dist/engine/constants.js.map +1 -0
- package/dist/engine/files.js.map +1 -0
- package/dist/engine/key.js.map +1 -0
- package/dist/engine/serializers.js.map +1 -0
- package/dist/{tools → engine/tools}/claude.js +3 -3
- package/dist/engine/tools/claude.js.map +1 -0
- package/dist/{tools → engine/tools}/codex.d.ts +2 -0
- package/dist/{tools → engine/tools}/codex.js +12 -6
- package/dist/engine/tools/codex.js.map +1 -0
- package/dist/{tools → engine/tools}/grok.js +4 -4
- package/dist/engine/tools/grok.js.map +1 -0
- package/dist/engine/tools/helpers.js.map +1 -0
- package/dist/{tools → engine/tools}/hermes.js +2 -2
- package/dist/engine/tools/hermes.js.map +1 -0
- package/dist/engine/tools/kilo.d.ts +4 -0
- package/dist/engine/tools/kilo.js +333 -0
- package/dist/engine/tools/kilo.js.map +1 -0
- package/dist/engine/tools/omp.d.ts +5 -0
- package/dist/engine/tools/omp.js +358 -0
- package/dist/engine/tools/omp.js.map +1 -0
- package/dist/{tools → engine/tools}/openclaw.js +2 -2
- package/dist/engine/tools/openclaw.js.map +1 -0
- package/dist/{tools → engine/tools}/opencode.js +5 -5
- package/dist/engine/tools/opencode.js.map +1 -0
- package/dist/{tools → engine/tools}/pi.js +2 -2
- package/dist/engine/tools/pi.js.map +1 -0
- package/dist/engine/types.d.ts +46 -0
- package/dist/engine/types.js +2 -0
- package/dist/engine/types.js.map +1 -0
- package/dist/install.d.ts +9 -0
- package/dist/install.js +133 -0
- package/dist/install.js.map +1 -0
- package/dist/model-catalog.d.ts +23 -0
- package/dist/model-catalog.js +148 -0
- package/dist/model-catalog.js.map +1 -0
- package/dist/preferences.d.ts +9 -0
- package/dist/preferences.js +31 -0
- package/dist/preferences.js.map +1 -0
- package/dist/run.d.ts +1 -17
- package/dist/run.js +655 -176
- package/dist/run.js.map +1 -1
- package/dist/types.d.ts +52 -47
- package/dist/ui.d.ts +16 -0
- package/dist/ui.js +135 -0
- package/dist/ui.js.map +1 -0
- package/package.json +17 -9
- package/dist/constants.js.map +0 -1
- package/dist/files.js.map +0 -1
- package/dist/key.js.map +0 -1
- package/dist/models.d.ts +0 -6
- package/dist/models.js +0 -128
- package/dist/models.js.map +0 -1
- package/dist/primes.d.ts +0 -10
- package/dist/primes.js +0 -98
- package/dist/primes.js.map +0 -1
- package/dist/serializers.js.map +0 -1
- package/dist/tools/claude.js.map +0 -1
- package/dist/tools/codex.js.map +0 -1
- package/dist/tools/grok.js.map +0 -1
- package/dist/tools/helpers.js.map +0 -1
- package/dist/tools/hermes.js.map +0 -1
- package/dist/tools/openclaw.js.map +0 -1
- package/dist/tools/opencode.js.map +0 -1
- package/dist/tools/pi.js.map +0 -1
- package/dist/upgrade.d.ts +0 -27
- package/dist/upgrade.js +0 -319
- package/dist/upgrade.js.map +0 -1
- /package/dist/{files.d.ts → engine/files.d.ts} +0 -0
- /package/dist/{files.js → engine/files.js} +0 -0
- /package/dist/{key.d.ts → engine/key.d.ts} +0 -0
- /package/dist/{key.js → engine/key.js} +0 -0
- /package/dist/{serializers.d.ts → engine/serializers.d.ts} +0 -0
- /package/dist/{serializers.js → engine/serializers.js} +0 -0
- /package/dist/{tools → engine/tools}/claude.d.ts +0 -0
- /package/dist/{tools → engine/tools}/grok.d.ts +0 -0
- /package/dist/{tools → engine/tools}/helpers.d.ts +0 -0
- /package/dist/{tools → engine/tools}/helpers.js +0 -0
- /package/dist/{tools → engine/tools}/hermes.d.ts +0 -0
- /package/dist/{tools → engine/tools}/openclaw.d.ts +0 -0
- /package/dist/{tools → engine/tools}/opencode.d.ts +0 -0
- /package/dist/{tools → engine/tools}/pi.d.ts +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MoonMath AI
|
|
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,105 +1,132 @@
|
|
|
1
1
|
# zro
|
|
2
2
|
|
|
3
|
-
`zro` launches coding
|
|
3
|
+
`zro` launches supported coding agents through the Zro inference endpoint using isolated,
|
|
4
|
+
Zro-owned configuration. It leaves each agent's normal configuration untouched and starts website
|
|
5
|
+
login automatically when needed.
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
npm install --global @moonmath-ai/zro
|
|
9
|
+
zro login
|
|
10
|
+
zro claude
|
|
8
11
|
```
|
|
9
12
|
|
|
10
|
-
It does not edit your normal tool configs. It injects the Zro endpoint, API key, model catalog, temporary config, or Zro-owned app home needed by the launched child process.
|
|
11
|
-
|
|
12
|
-
Defaults:
|
|
13
|
-
|
|
14
|
-
- Base URL: `https://zro.moonmath.ai/v1`
|
|
15
|
-
- Model: `minimax-m3`
|
|
16
|
-
- Packaged model list: `minimax-m3`, `glm-5.2`, `kimi-k2.7-code`
|
|
17
|
-
|
|
18
|
-
Supported platforms: macOS and Linux. On Windows, run `zro` from WSL.
|
|
19
|
-
|
|
20
13
|
## Usage
|
|
21
14
|
|
|
22
|
-
Store your Zro key once:
|
|
23
|
-
|
|
24
15
|
```bash
|
|
25
|
-
zro
|
|
26
|
-
zro
|
|
27
|
-
zro
|
|
28
|
-
zro launch
|
|
29
|
-
zro launch
|
|
30
|
-
zro
|
|
31
|
-
zro
|
|
32
|
-
zro
|
|
16
|
+
zro # interactive agent picker
|
|
17
|
+
zro claude # open directly on the default model
|
|
18
|
+
zro codex -m glm-5.2 # choose a model for this session
|
|
19
|
+
zro kilo -m minimax-m3 # launch Kilo Code through Zro
|
|
20
|
+
zro omp -m glm-5.2 # launch Oh My Pi through Zro
|
|
21
|
+
zro oc -- --help # short aliases + native tool arguments
|
|
22
|
+
zro again # reopen the last tool/model pair
|
|
23
|
+
zro login # choose website or API key login
|
|
24
|
+
zro login --no-browser # print an approval URL for a remote machine
|
|
25
|
+
zro login --manual # enter an API key manually
|
|
26
|
+
zro logout # remove the stored login
|
|
27
|
+
zro status # connection, installed tools, last session
|
|
28
|
+
zro models # readable model catalog
|
|
29
|
+
zro install claude # install a supported agent
|
|
30
|
+
zro claude --install # install if missing, then open
|
|
31
|
+
zro install claude@2.1.105 # install a pinned agent version
|
|
32
|
+
zro install claude --upgrade # upgrade one agent
|
|
33
|
+
zro install --upgrade # upgrade zro itself
|
|
34
|
+
zro claude --dry-run # secret-safe session preview
|
|
35
|
+
zro codex --json # machine-readable preview
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
export ZRO_API_KEY=sk-...
|
|
39
|
-
zro launch claude
|
|
40
|
-
```
|
|
38
|
+
## Supported tools
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
Claude Code, Codex CLI, Codex App, Grok Build, Kilo Code, Oh My Pi, OpenCode, Hermes, OpenClaw, and Pi are supported.
|
|
41
|
+
Each adapter launches the installed tool as a child process with isolated configuration. Most
|
|
42
|
+
session files are temporary; Codex App uses a persistent Zro-owned home so the desktop app can
|
|
43
|
+
reopen. Native tool arguments can be placed after `--`.
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
zro login [--api-key <key>]
|
|
46
|
-
zro logout
|
|
47
|
-
zro auth status
|
|
48
|
-
zro launch <tool> [--api-key <key>] [--model <id>] [--print] [-- <tool args...>]
|
|
49
|
-
```
|
|
45
|
+
## Installation and upgrades
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
Zro requires Node.js 18 or later and supports macOS and Linux. On Windows, use WSL.
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
`zro install <tool>` installs npm-distributed agents globally. Hermes, Grok Build, and Oh My Pi use
|
|
50
|
+
their official shell installers; Oh My Pi uses its prebuilt binary so Bun is not required. Add
|
|
51
|
+
`--upgrade` to update an installed agent, or pin an npm-distributed agent version with either
|
|
52
|
+
`tool@version` or `--version version`.
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
`zro <tool> --install` installs a missing agent and opens it in one command. `zro install
|
|
55
|
+
--upgrade` upgrades the Zro CLI itself. Version validation and installer errors are reported directly
|
|
56
|
+
by npm or the tool's official installer.
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
## Authentication
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
Run `zro login` and choose **Login with website** or **Login with API key**. Use
|
|
61
|
+
`zro login --manual` to go directly to API-key entry, or `zro login --no-browser` to start
|
|
62
|
+
website login without opening a browser automatically.
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
Website login creates a revocable API key after approval. The generated key is encrypted to an
|
|
65
|
+
ephemeral public key belonging to the CLI, so the device-login database record never contains a
|
|
66
|
+
usable plaintext credential. The CLI sends a generic device label unless `ZRO_DEVICE_NAME` is
|
|
67
|
+
explicitly set.
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
If website login cannot start in an interactive terminal, `zro` immediately falls back to a masked
|
|
70
|
+
API-key paste prompt. Non-interactive commands still exit with instructions instead of waiting for
|
|
71
|
+
input.
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
| `codex-app` | Codex App | Starts `codex app` with `CODEX_HOME=~/.config/zro/codex-app`, a Zro provider config, `.env`, and model catalog. Your normal `~/.codex/config.toml` is not modified. |
|
|
74
|
-
| `grok` | Grok Build | Starts `grok` with an isolated `GROK_HOME` containing a `config.toml` that registers the Zro provider, every packaged Zro model, and the Zro MCP server. Your normal `~/.grok/config.toml` is not modified. |
|
|
75
|
-
| `opencode` | OpenCode | Starts `opencode` with a temporary `XDG_CONFIG_HOME` containing a merged Zro provider config and an isolated copy of the user's OpenCode config resources. |
|
|
76
|
-
| `hermes` | Hermes | Starts `hermes` with a temporary home config that registers the Zro provider and selected model. |
|
|
77
|
-
| `openclaw` | OpenClaw | Starts `openclaw` with a temporary home config that registers the Zro provider and selected model. |
|
|
78
|
-
| `pi` | Pi | Starts `pi` with a temporary `PI_CODING_AGENT_DIR` containing a merged Zro `models.json`. |
|
|
73
|
+
`ZRO_API_KEY` takes precedence over the stored key. The primary credential is stored under
|
|
74
|
+
`~/.config/zro/credentials.json`. Codex App also keeps the active key in its isolated app home at
|
|
75
|
+
`~/.config/zro/codex-app/.env`; `zro logout` removes both stored copies. An environment-provided
|
|
76
|
+
`ZRO_API_KEY` remains set in the current shell after logout.
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
The last tool/model pair is stored in `~/.config/zro/preferences.json`. Set `ZRO_AUTH_URL` to use a
|
|
79
|
+
development authentication server. For remote development with a browser-side port forward, set
|
|
80
|
+
`ZRO_PUBLIC_URL` to the forwarded website origin.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
- Temporary launch files are created in per-launch directories under `~/.cache/zro/launches` (or `$XDG_CACHE_HOME/zro/launches`) and removed after the launched process exits. Codex App uses persistent Zro-owned files under `~/.config/zro/codex-app`.
|
|
86
|
-
- API keys are never printed unmasked. `--print` redacts secret environment values.
|
|
82
|
+
Before starting an agent, `zro` verifies the selected credential with the inference API. Rejected
|
|
83
|
+
credentials and unavailable validation endpoints stop the launch instead of passing the failure to
|
|
84
|
+
the child agent.
|
|
87
85
|
|
|
88
|
-
|
|
86
|
+
When signed in, the CLI fetches the active model catalog from Zro and passes that catalog to every
|
|
87
|
+
supported agent adapter. It caches successful catalogs under `~/.cache/zro/model-catalog.json` for
|
|
88
|
+
offline startup and falls back to bundled defaults only when no valid cache is available. An
|
|
89
|
+
authentication rejection never uses the cache and removes it; `zro logout` removes it as well.
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
When logged in, `zro status` also shows the current plan allowance, usage-pack balance, total
|
|
92
|
+
available spend, and 30-day request and token activity. JSON output includes the same account data.
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
- Same-repository pull requests and opt-in manual runs make live calls with packaged models, exercise disabled/low and maximum reasoning settings, and require each client to report prompt-cache reads. Fork pull requests skip these checks because secrets are unavailable.
|
|
94
|
-
- Live API checks require the repository Actions secret `ZRO_API_KEY`. Reports contain client versions and token counters, never the key or raw request headers.
|
|
94
|
+
## Safety
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
- Normal agent configs are never edited.
|
|
97
|
+
- Temporary session files live under `~/.cache/zro/sessions` and are removed when the agent exits.
|
|
98
|
+
- Kilo Code runs with a temporary home and XDG profile. Zro copies only sanitized preferences and
|
|
99
|
+
safe agent/command/skill assets; provider credentials, MCP definitions, sessions, databases,
|
|
100
|
+
dependency trees, and symlinks remain outside the profile.
|
|
101
|
+
- Kilo telemetry, OTLP export, automatic updates, model-catalog refresh, cloud session ingest and
|
|
102
|
+
sharing, remote control, and default vendor plugins are disabled. Model and MCP requests still go
|
|
103
|
+
to their configured Zro endpoints.
|
|
104
|
+
- Oh My Pi runs with a temporary home, XDG roots, agent directory, and model cache. Zro copies only
|
|
105
|
+
sanitized display preferences and local agent/command/prompt/skill/theme assets; auth state,
|
|
106
|
+
databases, sessions, dependency trees, secret files, and symlinks stay outside the profile.
|
|
107
|
+
- Oh My Pi OTLP export, Auto QA reporting, startup update checks, marketplace updates, remote
|
|
108
|
+
memory, and remote compaction are disabled. Its Zro model and MCP files contain environment
|
|
109
|
+
variable names rather than API-key values.
|
|
110
|
+
- Codex App uses persistent configuration under `~/.config/zro/codex-app`; logout removes its key.
|
|
111
|
+
- API keys are masked in human and JSON previews.
|
|
112
|
+
- `--dry-run` writes nothing and starts nothing.
|
|
113
|
+
- macOS and Linux are supported; use WSL on Windows.
|
|
114
|
+
|
|
115
|
+
See [SECURITY.md](SECURITY.md) for the security model and private vulnerability reporting.
|
|
116
|
+
|
|
117
|
+
## Development
|
|
97
118
|
|
|
98
119
|
```bash
|
|
99
|
-
npm
|
|
100
|
-
|
|
120
|
+
npm ci
|
|
121
|
+
npm test
|
|
122
|
+
npm run build
|
|
123
|
+
node dist/cli.js status
|
|
101
124
|
|
|
102
|
-
#
|
|
103
|
-
npm run test:clients
|
|
104
|
-
ZRO_API_KEY=sk-... npm run test:live
|
|
125
|
+
# Production compatibility and live API checks require a real key.
|
|
126
|
+
ZRO_API_KEY=sk-... npm run test:clients
|
|
127
|
+
ZRO_API_KEY=sk-... npm run test:live
|
|
105
128
|
```
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
Zro is licensed under the [MIT License](LICENSE).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please do not open a public issue for a suspected vulnerability. Report it privately through
|
|
6
|
+
GitHub's security advisory interface for this repository.
|
|
7
|
+
|
|
8
|
+
Include the affected version, reproduction steps, impact, and any suggested mitigation. We will
|
|
9
|
+
acknowledge a complete report as soon as practical and coordinate disclosure after a fix is
|
|
10
|
+
available.
|
|
11
|
+
|
|
12
|
+
## Security model
|
|
13
|
+
|
|
14
|
+
Zro stores credentials with user-only filesystem permissions and creates isolated configuration
|
|
15
|
+
for each launched tool. Normal tool configuration is read only when an adapter needs to preserve
|
|
16
|
+
compatible user settings; it is not modified. Temporary session files are removed when the child
|
|
17
|
+
process exits.
|
|
18
|
+
|
|
19
|
+
Kilo Code receives a per-session `HOME` and XDG profile. Its adapter copies only a sanitized subset
|
|
20
|
+
of user preferences plus regular files from known agent, command, skill, mode, and plugin asset
|
|
21
|
+
directories. It excludes provider and MCP configuration, model overrides, auth/account state,
|
|
22
|
+
sessions, databases, caches, dependency manifests and trees, telemetry state, and symbolic links.
|
|
23
|
+
The high-precedence generated configuration refers to the credential as `{env:ZRO_API_KEY}` rather
|
|
24
|
+
than writing its value to disk.
|
|
25
|
+
|
|
26
|
+
Oh My Pi also receives a per-session `HOME`, XDG profile, and `PI_CODING_AGENT_DIR`. Its adapter
|
|
27
|
+
copies a sanitized subset of display preferences and regular files from known agent, command,
|
|
28
|
+
prompt, skill, and theme directories. Auth databases, sessions, caches, dependency trees, secret
|
|
29
|
+
files, and symlinks are excluded. Zro supplies the provider key and MCP bearer through child-process
|
|
30
|
+
environment variables, disables OTLP export and Auto QA reporting, and forces update, remote-memory,
|
|
31
|
+
and remote-compaction controls through a temporary high-precedence settings overlay.
|
|
32
|
+
|
|
33
|
+
Browser login uses a short-lived device code. The CLI generates an ephemeral RSA keypair, and the
|
|
34
|
+
website encrypts the issued credential to that public key. The private key remains in CLI memory
|
|
35
|
+
and is not written to disk.
|
package/dist/args.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare
|
|
3
|
-
export declare function usage(): string;
|
|
4
|
-
export declare function parseArgs(argv: string[]): CliArgs;
|
|
1
|
+
import type { CliRequest } from "./types.js";
|
|
2
|
+
export declare function parseArgs(argv: string[]): CliRequest;
|
package/dist/args.js
CHANGED
|
@@ -1,71 +1,187 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export function usage() {
|
|
5
|
-
return `Usage:
|
|
6
|
-
zro login [--api-key <key>]
|
|
7
|
-
zro logout
|
|
8
|
-
zro auth status
|
|
9
|
-
zro launch <tool> [--api-key <key>] [--model <id>] [--print] [-- <tool args...>]
|
|
10
|
-
zro version
|
|
11
|
-
|
|
12
|
-
Supported tools:
|
|
13
|
-
${SUPPORTED_TOOLS_LIST}
|
|
14
|
-
|
|
15
|
-
Options:
|
|
16
|
-
--api-key <key> Use this Zro API key for login or the launched session.
|
|
17
|
-
--model <id> Model to launch. Defaults to ${DEFAULT_MODEL}, or prompts in a TTY.
|
|
18
|
-
--print Show the launch plan without starting the tool.
|
|
19
|
-
-- Pass the remaining arguments to the launched tool.`;
|
|
20
|
-
}
|
|
1
|
+
import { resolveTool, TOOLS } from "./catalog.js";
|
|
2
|
+
const HELP = new Set(["help", "-h", "--help"]);
|
|
3
|
+
const VERSION = new Set(["version", "-v", "--version"]);
|
|
21
4
|
export function parseArgs(argv) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.command
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
program.command("version").action(() => {
|
|
47
|
-
result = { command: "version" };
|
|
48
|
-
});
|
|
49
|
-
program
|
|
50
|
-
.command("launch <tool>")
|
|
51
|
-
.option("--api-key <key>")
|
|
52
|
-
.option("--model <id>")
|
|
53
|
-
.option("--print")
|
|
54
|
-
.allowExcessArguments(true)
|
|
55
|
-
.action((tool, opts, cmd) => {
|
|
56
|
-
result = {
|
|
57
|
-
command: "launch",
|
|
58
|
-
tool,
|
|
59
|
-
apiKey: opts.apiKey,
|
|
60
|
-
model: opts.model,
|
|
61
|
-
print: !!opts.print,
|
|
62
|
-
extraArgs: cmd.args.slice(1)
|
|
5
|
+
if (argv.length === 0)
|
|
6
|
+
return { command: "home", output: "human" };
|
|
7
|
+
if (HELP.has(argv[0]))
|
|
8
|
+
return { command: "help", output: outputMode(argv) };
|
|
9
|
+
if (VERSION.has(argv[0]))
|
|
10
|
+
return { command: "version", output: outputMode(argv) };
|
|
11
|
+
const command = argv[0].toLowerCase();
|
|
12
|
+
if (command === "login") {
|
|
13
|
+
const loginArgs = argv.slice(1);
|
|
14
|
+
const manual = loginArgs.includes("--manual");
|
|
15
|
+
const noBrowser = loginArgs.includes("--no-browser");
|
|
16
|
+
const parsed = parseOptions(loginArgs.filter((value) => value !== "--manual" && value !== "--no-browser"), false);
|
|
17
|
+
assertNoExtraArgs(parsed.extraArgs, command);
|
|
18
|
+
return {
|
|
19
|
+
command: "login",
|
|
20
|
+
apiKey: parsed.apiKey,
|
|
21
|
+
method: manual || parsed.apiKey
|
|
22
|
+
? "manual"
|
|
23
|
+
: noBrowser || parsed.output === "json"
|
|
24
|
+
? "browser"
|
|
25
|
+
: "choose",
|
|
26
|
+
openBrowser: !noBrowser,
|
|
27
|
+
output: parsed.output,
|
|
63
28
|
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
29
|
+
}
|
|
30
|
+
if (command === "logout") {
|
|
31
|
+
const parsed = parseOptions(argv.slice(1), false);
|
|
32
|
+
assertNoExtraArgs(parsed.extraArgs, command);
|
|
33
|
+
return { command: "logout", output: parsed.output };
|
|
34
|
+
}
|
|
35
|
+
if (command === "status" || command === "doctor" || command === "auth") {
|
|
36
|
+
const rest = command === "auth" && argv[1] === "status" ? argv.slice(2) : argv.slice(1);
|
|
37
|
+
const parsed = parseOptions(rest, false);
|
|
38
|
+
assertNoExtraArgs(parsed.extraArgs, command);
|
|
39
|
+
return { command: "status", output: parsed.output };
|
|
40
|
+
}
|
|
41
|
+
if (command === "models") {
|
|
42
|
+
const parsed = parseOptions(argv.slice(1), false);
|
|
43
|
+
assertNoExtraArgs(parsed.extraArgs, command);
|
|
44
|
+
return { command: "models", output: parsed.output };
|
|
45
|
+
}
|
|
46
|
+
if (command === "install")
|
|
47
|
+
return parseInstallArgs(argv.slice(1));
|
|
48
|
+
if (command === "again") {
|
|
49
|
+
const parsed = parseOptions(argv.slice(1), false);
|
|
50
|
+
assertNoExtraArgs(parsed.extraArgs, command);
|
|
51
|
+
return { command: "again", dryRun: parsed.dryRun, output: parsed.output };
|
|
52
|
+
}
|
|
53
|
+
if (command === "launch" || command === "run") {
|
|
54
|
+
const value = argv[1];
|
|
55
|
+
if (!value)
|
|
56
|
+
throw new Error(`Choose a tool: ${toolNames()}`);
|
|
57
|
+
const tool = resolveTool(value);
|
|
58
|
+
if (!tool)
|
|
59
|
+
throw new Error(`Unknown tool "${value}". Choose: ${toolNames()}`);
|
|
60
|
+
const parsed = parseOptions(argv.slice(2), true);
|
|
61
|
+
return { command: "launch", tool, ...parsed };
|
|
62
|
+
}
|
|
63
|
+
const tool = resolveTool(command);
|
|
64
|
+
if (!tool)
|
|
65
|
+
throw new Error(`Unknown command "${argv[0]}". Run zro help.`);
|
|
66
|
+
const parsed = parseOptions(argv.slice(1), true);
|
|
67
|
+
return { command: "launch", tool, ...parsed };
|
|
68
|
+
}
|
|
69
|
+
function parseOptions(argv, allowPassthrough) {
|
|
70
|
+
const result = {
|
|
71
|
+
dryRun: false,
|
|
72
|
+
output: "human",
|
|
73
|
+
extraArgs: []
|
|
74
|
+
};
|
|
75
|
+
let passthrough = false;
|
|
76
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
77
|
+
const value = argv[index];
|
|
78
|
+
if (passthrough) {
|
|
79
|
+
result.extraArgs.push(value);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (value === "--") {
|
|
83
|
+
passthrough = true;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (value === "--model" || value === "-m") {
|
|
87
|
+
result.model = requiredValue(argv, ++index, value);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (value.startsWith("--model=")) {
|
|
91
|
+
result.model = value.slice("--model=".length);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (value === "--api-key") {
|
|
95
|
+
result.apiKey = requiredValue(argv, ++index, value);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (value.startsWith("--api-key=")) {
|
|
99
|
+
result.apiKey = value.slice("--api-key=".length);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (value === "--dry-run" || value === "-n") {
|
|
103
|
+
result.dryRun = true;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (value === "--inspect" || value === "--print") {
|
|
107
|
+
throw new Error(`Unknown Zro option ${value}. Use --dry-run.`);
|
|
108
|
+
}
|
|
109
|
+
if (value === "--install" && allowPassthrough) {
|
|
110
|
+
result.install = true;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (value === "--json") {
|
|
114
|
+
result.output = "json";
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (value === "-h" || value === "--help") {
|
|
118
|
+
throw new Error("Run zro help for Zro options. Pass tool help after --, for example: zro codex -- --help");
|
|
119
|
+
}
|
|
120
|
+
if (!allowPassthrough)
|
|
121
|
+
result.extraArgs.push(value);
|
|
122
|
+
else
|
|
123
|
+
result.extraArgs.push(value);
|
|
124
|
+
}
|
|
125
|
+
if (result.output === "json" && allowPassthrough)
|
|
126
|
+
result.dryRun = true;
|
|
69
127
|
return result;
|
|
70
128
|
}
|
|
129
|
+
function parseInstallArgs(argv) {
|
|
130
|
+
let tool;
|
|
131
|
+
let version;
|
|
132
|
+
let upgrade = false;
|
|
133
|
+
let index = 0;
|
|
134
|
+
if (argv[0] && !argv[0].startsWith("-")) {
|
|
135
|
+
const rawTool = argv[0];
|
|
136
|
+
const separator = rawTool.lastIndexOf("@");
|
|
137
|
+
if (separator > 0) {
|
|
138
|
+
tool = rawTool.slice(0, separator);
|
|
139
|
+
version = rawTool.slice(separator + 1);
|
|
140
|
+
if (!version)
|
|
141
|
+
throw new Error("A version is required after @.");
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
tool = rawTool;
|
|
145
|
+
}
|
|
146
|
+
index = 1;
|
|
147
|
+
}
|
|
148
|
+
for (; index < argv.length; index += 1) {
|
|
149
|
+
const value = argv[index];
|
|
150
|
+
if (value === "--upgrade") {
|
|
151
|
+
upgrade = true;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (value === "--version") {
|
|
155
|
+
const next = requiredValue(argv, ++index, value);
|
|
156
|
+
if (version)
|
|
157
|
+
throw new Error(`Conflicting versions: ${version} and ${next}.`);
|
|
158
|
+
version = next;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
throw new Error(`Unexpected argument for install: ${value}`);
|
|
162
|
+
}
|
|
163
|
+
if (!tool && !upgrade) {
|
|
164
|
+
throw new Error("Missing <tool>. Use --upgrade to upgrade zro itself.");
|
|
165
|
+
}
|
|
166
|
+
if (tool && version && upgrade) {
|
|
167
|
+
throw new Error("Choose either a pinned version or --upgrade, not both.");
|
|
168
|
+
}
|
|
169
|
+
return { command: "install", tool, upgrade, version };
|
|
170
|
+
}
|
|
171
|
+
function requiredValue(argv, index, option) {
|
|
172
|
+
const value = argv[index];
|
|
173
|
+
if (!value || value === "--")
|
|
174
|
+
throw new Error(`${option} needs a value.`);
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
function outputMode(argv) {
|
|
178
|
+
return argv.includes("--json") ? "json" : "human";
|
|
179
|
+
}
|
|
180
|
+
function assertNoExtraArgs(args, command) {
|
|
181
|
+
if (args.length)
|
|
182
|
+
throw new Error(`Unexpected argument for ${command}: ${args[0]}`);
|
|
183
|
+
}
|
|
184
|
+
function toolNames() {
|
|
185
|
+
return TOOLS.map((tool) => tool.id).join(", ");
|
|
186
|
+
}
|
|
71
187
|
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;AAExD,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAEnE,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UA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c,EAAE,KAAa,EAAE,MAAc;IAClE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,iBAAiB,CAAC,CAAC;IAC1E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,IAAc;IAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AACpD,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAc,EAAE,OAAe;IACxD,IAAI,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACrF,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolId } from "./engine/types.js";
|
|
2
|
+
export interface ToolDescriptor {
|
|
3
|
+
id: ToolId;
|
|
4
|
+
name: string;
|
|
5
|
+
hint: string;
|
|
6
|
+
aliases: readonly string[];
|
|
7
|
+
executable: string;
|
|
8
|
+
package?: string;
|
|
9
|
+
installer?: {
|
|
10
|
+
url: string;
|
|
11
|
+
args?: readonly string[];
|
|
12
|
+
binDir: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const TOOLS: readonly ToolDescriptor[];
|
|
16
|
+
export declare function resolveTool(value: string): ToolId | undefined;
|
|
17
|
+
export declare function describeTool(id: ToolId): ToolDescriptor;
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const TOOLS = [
|
|
2
|
+
{ id: "claude", name: "Claude Code", hint: "Anthropic's coding agent", aliases: ["c", "cc"], executable: "claude", package: "@anthropic-ai/claude-code@latest" },
|
|
3
|
+
{ id: "codex", name: "Codex CLI", hint: "OpenAI's terminal agent", aliases: ["cx"], executable: "codex", package: "@openai/codex@latest" },
|
|
4
|
+
{ id: "codex-app", name: "Codex App", hint: "OpenAI's desktop app", aliases: ["app"], executable: "codex", package: "@openai/codex@latest" },
|
|
5
|
+
{ id: "kilo", name: "Kilo Code", hint: "Kilo's terminal coding agent", aliases: ["kc", "kilocode"], executable: "kilo", package: "@kilocode/cli@latest" },
|
|
6
|
+
{ id: "omp", name: "Oh My Pi", hint: "Power-user terminal coding agent", aliases: ["oh-my-pi", "ohmypi"], executable: "omp", installer: { url: "https://omp.sh/install", args: ["--binary"], binDir: ".local/bin" } },
|
|
7
|
+
{ id: "opencode", name: "OpenCode", hint: "Open source coding agent", aliases: ["oc"], executable: "opencode", package: "opencode-ai@latest" },
|
|
8
|
+
{ id: "grok", name: "Grok Build", hint: "xAI's coding agent", aliases: ["gr"], executable: "grok", installer: { url: "https://x.ai/cli/install.sh", binDir: ".local/bin" } },
|
|
9
|
+
{ id: "hermes", name: "Hermes", hint: "Nous Research's agent", aliases: ["h"], executable: "hermes", installer: { url: "https://hermes-agent.nousresearch.com/install.sh", args: ["--skip-setup"], binDir: ".local/bin" } },
|
|
10
|
+
{ id: "openclaw", name: "OpenClaw", hint: "Personal AI assistant", aliases: ["claw"], executable: "openclaw", package: "openclaw@latest" },
|
|
11
|
+
{ id: "pi", name: "Pi", hint: "Minimal coding agent", aliases: [], executable: "pi", package: "@earendil-works/pi-coding-agent@latest" }
|
|
12
|
+
];
|
|
13
|
+
const TOOL_LOOKUP = new Map();
|
|
14
|
+
for (const tool of TOOLS) {
|
|
15
|
+
TOOL_LOOKUP.set(tool.id, tool.id);
|
|
16
|
+
for (const alias of tool.aliases)
|
|
17
|
+
TOOL_LOOKUP.set(alias, tool.id);
|
|
18
|
+
}
|
|
19
|
+
export function resolveTool(value) {
|
|
20
|
+
return TOOL_LOOKUP.get(value.toLowerCase());
|
|
21
|
+
}
|
|
22
|
+
export function describeTool(id) {
|
|
23
|
+
return TOOLS.find((tool) => tool.id === id);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,KAAK,GAA8B;IAC9C,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,kCAAkC,EAAE;IAChK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE;IAC1I,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE;IAC5I,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,8BAA8B,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE;IACzJ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,kCAAkC,EAAE,OAAO,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,E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