glm-coding-router 0.2.0 → 0.3.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/README.md CHANGED
@@ -1,286 +1,326 @@
1
- # GLM Coding Router
2
-
3
- GLM Coding Plan workers for Claude Code and Codex, on Windows.
4
-
5
- Claude Code and Codex stay your orchestrators — they keep responsibility for requirements,
6
- architecture, review, and integration. `glm-coding-router` delegates well-scoped
7
- implementation work (exploration, CRUD, boilerplate, tests, mechanical refactoring) to
8
- GLM workers via Z.ai's Anthropic-compatible endpoint.
9
-
10
- One global npm install replaces the manual `.cmd` shim setup:
11
-
12
- ```text
13
- Claude / Codex → shell → glm-worker → claude.exe harness → Z.ai endpoint → GLM Coding Plan
14
- ```
15
-
16
- ## Architecture
17
-
18
- ```text
19
- Developer
20
-
21
- ┌───────────────┴───────────────┐
22
- ▼ ▼
23
- Claude Code Codex
24
- │ │
25
- └───────────────┬───────────────┘
26
- shell command
27
-
28
- ┌───────────────┼───────────────┐
29
- ▼ ▼ ▼
30
- glm-chat glm-fast glm-worker glm-review
31
- │ │ │ │
32
- └─────────┴──────────┴──────────┘
33
- claude.exe
34
- (injected environment only)
35
-
36
-
37
- https://api.z.ai/api/anthropic
38
-
39
-
40
- GLM Coding Plan
41
- GLM-5.3 / GLM-5.3-Flash
42
- ```
43
-
44
- ## Requirements
45
-
46
- - Windows 10/11 (v0.1; Linux/macOS planned for v0.2)
47
- - Node.js >= 20
48
- - Claude Code (`claude.exe`) — the GLM commands run on the Claude Code harness
49
- - Codex (optional — Claude-only setups are fully supported)
50
- - A Z.ai Coding Plan API key
51
-
52
- No Anthropic pay-as-you-go, no OpenAI API, no LiteLLM, no proxy.
53
-
54
- ## Installation
55
-
56
- ```powershell
57
- npm install -g glm-coding-router
58
- glm-router init
59
- ```
60
-
61
- `npx glm-coding-router init` also works for a one-off check, but the global install is
62
- what puts `glm-worker` on your PATH long-term.
63
-
64
- ## Quick start
65
-
66
- After `glm-router init`:
67
-
68
- ```powershell
69
- glm-chat
70
- glm-fast
71
- glm-worker "Implement validation and add tests"
72
- glm-review "Analyze the auth module"
73
- ```
74
-
75
- ## glm-chat
76
-
77
- Interactive GLM-backed Claude Code session. Resolves the Z.ai key, locates `claude.exe`,
78
- injects the Z.ai environment **into the child process only**, and spawns it with
79
- pass-through arguments:
80
-
81
- ```powershell
82
- glm-chat
83
- glm-chat --version
84
- glm-chat --any-claude-flag
85
- ```
86
-
87
- Your normal `claude` command and its authentication are untouched.
88
-
89
- ## glm-fast
90
-
91
- Interactive GLM-backed session pinned to the **fast model** (`models.fast`,
92
- `glm-5.3-flash` by default) — every model slot in the child environment maps to
93
- it, so whichever tier Claude Code picks, it gets the fast model. Same pass-through
94
- arguments as `glm-chat`:
95
-
96
- ```powershell
97
- glm-fast
98
- glm-fast --profile air
99
- ```
100
-
101
- ## glm-worker
102
-
103
- Headless implementation worker:
104
-
105
- ```powershell
106
- glm-worker "Implement validation and add tests"
107
- ```
108
-
109
- Or via stdin (a structured task packet):
110
-
111
- ```powershell
112
- @"
113
- TASK:
114
- Implement refresh token validation.
115
-
116
- SCOPE:
117
- internal/auth/
118
-
119
- VALIDATION:
120
- go test ./internal/auth/...
121
- "@ | glm-worker
122
- ```
123
-
124
- Input priority: **stdin → arguments → error**. The worker runs with
125
- `--max-turns 20 --permission-mode acceptEdits --tools Read,Glob,Grep,Edit,Write,Bash`.
126
- It never uses `--dangerously-skip-permissions`.
127
-
128
- ## glm-review
129
-
130
- Read-only worker for repository exploration, call-graph discovery, duplicate detection,
131
- dependency inspection, and preliminary review:
132
-
133
- ```powershell
134
- glm-review "Inspect this repository"
135
- ```
136
-
137
- Runs with `--tools Read,Glob,Grep` — it cannot edit files or run commands.
138
-
139
- ## Profiles
140
-
141
- All four task binaries (`glm-chat`, `glm-fast`, `glm-worker`, `glm-review`)
142
- accept `--profile <name>` to overlay saved model/maxTurns settings. Profiles
143
- live in `config.json`:
144
-
145
- ```json
146
- {
147
- "profiles": {
148
- "test": { "workerMaxTurns": 10, "fast": "glm-5.3-flash" },
149
- "frontend": { "main": "glm-5.3", "reviewMaxTurns": 30 }
150
- }
151
- }
152
- ```
153
-
154
- ```powershell
155
- glm-worker --profile test "Add failing test then fix it"
156
- glm-review --profile frontend "Review the component tree"
157
- ```
158
-
159
- Fields (all optional): `main`, `fast`, `workerMaxTurns`, `reviewMaxTurns`.
160
- Unknown profile names fail with `ERROR [11]` listing the available ones.
161
- Note: `--profile` belongs to these wrappers — it shadows Claude Code's own
162
- `--profile` flag inside them.
163
-
164
- ## CLI reference
165
-
166
- ```text
167
- glm-router init guided setup
168
- glm-router doctor [--network] full runtime diagnosis
169
- glm-router status quick offline overview
170
- glm-router key set store ZAI_API_KEY (Windows User Environment)
171
- glm-router key check key configured? from which source?
172
- glm-router config show
173
- glm-router config set models.main glm-5.3
174
- glm-router project init CLAUDE.md / AGENTS.md managed blocks (--dry-run supported)
175
- glm-router project remove
176
- glm-router skill install optional Codex delegation skill
177
- glm-router skill remove
178
- glm-router uninstall guided removal (keeps ZAI_API_KEY by default)
179
- ```
180
-
181
- Global flags: `--json --quiet --verbose --dry-run --force --yes`
182
-
183
- ## Claude integration
184
-
185
- `glm-router project init` adds a **managed block** to `CLAUDE.md` at the project root
186
- (`git rev-parse --show-toplevel`, falling back to cwd):
187
-
188
- ```text
189
- <!-- glm-coding-router:start -->
190
- ... delegation policy ...
191
- <!-- glm-coding-router:end -->
192
- ```
193
-
194
- - Everything outside the markers is preserved; existing blocks are replaced in place;
195
- runs are idempotent and never duplicate.
196
- - Files are updated atomically (tmp file fsync → rename).
197
- - On a malformed marker pair the file is left untouched with an actionable error.
198
- - CRLF/LF and UTF-8 are preserved.
199
- - `glm-router project remove` deletes only the managed block. A file the router
200
- created entirely is deleted only when it would otherwise be empty.
201
-
202
- ## Codex integration
203
-
204
- The same command updates `AGENTS.md` (Codex's repository instruction file) with an
205
- equivalent managed block. Additionally, `glm-router skill install` installs the optional
206
- `glm-delegation` skill to `~/.codex/skills/glm-delegation/SKILL.md`. If Codex is not
207
- detected, the skill step warns and skips — AGENTS.md integration and the core tool are
208
- unaffected.
209
-
210
- ## Orca behavior (stale environments)
211
-
212
- Terminals embedded in Orca snapshot the Windows environment at startup. A key added
213
- after Orca starts is invisible to those terminals. Every GLM command therefore resolves
214
- the key in this order:
215
-
216
- 1. `process.env.ZAI_API_KEY`
217
- 2. Windows User Environment (via PowerShell)
218
- 3. fail with an actionable error
219
-
220
- The key is never cached to disk.
221
-
222
- ## Security model
223
-
224
- - The key lives only in the Windows User Environment; it is never written to
225
- `config.json`, the repo, logs, or stack traces. Debug output redacts
226
- `ZAI_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and Authorization headers.
227
- - Z.ai routing environment variables (`ANTHROPIC_AUTH_TOKEN`,
228
- `ANTHROPIC_BASE_URL`, model overrides) are injected **only** into the spawned
229
- `claude.exe` child process. `ANTHROPIC_API_KEY` is blanked in the child so your
230
- normal Claude auth is never in play. `ANTHROPIC_BASE_URL` is never persisted globally.
231
- - Claude Code and Codex global authentication are never modified.
232
- - Child processes are spawned with argument arrays (`shell: false`) — prompts with
233
- quotes, pipes, ampersands, or newlines are passed verbatim, never through a shell.
234
- - No telemetry, no automatic git commits.
235
-
236
- ## Troubleshooting
237
-
238
- | Symptom | Fix |
239
- | --- | --- |
240
- | `ERROR [ZAI_KEY_MISSING]` | `glm-router key set`, then open a **new** terminal |
241
- | `ERROR [CLAUDE_NOT_FOUND]` | Install Claude Code, or `glm-router config set claudePath C:\path\to\claude.exe` |
242
- | Key works in a new terminal but not inside Orca | Expected — workers re-read the Windows User Environment automatically; run `glm-router doctor` to confirm |
243
- | `glm-*` not on PATH after install | Reopen the terminal; check `npm config get prefix` is on PATH |
244
- | `ERROR [MANAGED_BLOCK_CORRUPT]` | Fix the marker pair in the named file manually, then re-run |
245
-
246
- Run `glm-router doctor` (add `--network` to probe the Z.ai endpoint) for a full diagnosis.
247
-
248
- ## Uninstall
249
-
250
- ```powershell
251
- glm-router uninstall
252
- ```
253
-
254
- The wizard removes the config, the Codex skill, and optionally the current project
255
- integration. `ZAI_API_KEY` is **kept** by default — removing credentials requires
256
- explicit consent. Finish with `npm uninstall -g glm-coding-router`.
257
-
258
- ## Development
259
-
260
- ```powershell
261
- npm install
262
- npm run build # tsc → dist/
263
- npm test # vitest run
264
- npm run lint # eslint src tests
265
- npm run dev # tsx src/cli.ts <args>
266
- ```
267
-
268
- Integration tests spawn `tests/fixtures/fake-agent.mjs` (via `node.exe`) to verify
269
- argument passing, environment injection, and exit-code propagation without spending
270
- API quota. See the `GLM Coding Router Technical Specification v0.1.md` for the full
271
- v0.1 contract (exit codes, managed-block test matrix, acceptance criteria).
272
-
273
- ## Publishing
274
-
275
- ```powershell
276
- npm run build
277
- npm test
278
- npm publish
279
- ```
280
-
281
- `prepublishOnly` runs build + tests. The package ships only `dist/`; the four binaries
282
- (`glm-router`, `glm-chat`, `glm-fast`, `glm-worker`, `glm-review`) are declared in `bin`.
283
-
284
- ## License
285
-
286
- MIT
1
+ # GLM Coding Router
2
+
3
+ GLM Coding Plan workers for Claude Code and Codex, on Windows.
4
+
5
+ Claude Code and Codex stay your orchestrators — they keep responsibility for requirements,
6
+ architecture, review, and integration. `glm-coding-router` delegates well-scoped
7
+ implementation work (exploration, CRUD, boilerplate, tests, mechanical refactoring) to
8
+ GLM workers via Z.ai's Anthropic-compatible endpoint.
9
+
10
+ One global npm install replaces the manual `.cmd` shim setup:
11
+
12
+ ```text
13
+ Claude / Codex → shell → glm-worker → claude.exe harness → Z.ai endpoint → GLM Coding Plan
14
+ ```
15
+
16
+ ## Architecture
17
+
18
+ ```text
19
+ Developer
20
+
21
+ ┌───────────────┴───────────────┐
22
+ ▼ ▼
23
+ Claude Code Codex
24
+ │ │
25
+ └───────────────┬───────────────┘
26
+ shell command
27
+
28
+ ┌───────────────┼───────────────┐
29
+ ▼ ▼ ▼
30
+ glm-chat glm-fast glm-worker glm-review
31
+ │ │ │ │
32
+ └─────────┴──────────┴──────────┘
33
+ claude.exe
34
+ (injected environment only)
35
+
36
+
37
+ https://api.z.ai/api/anthropic
38
+
39
+
40
+ GLM Coding Plan
41
+ GLM-5.3 / GLM-5.3-Flash
42
+ ```
43
+
44
+ ## Requirements
45
+
46
+ - Windows 10/11 (v0.1; Linux/macOS planned for v0.2)
47
+ - Node.js >= 20
48
+ - Claude Code (`claude.exe`) — the GLM commands run on the Claude Code harness
49
+ - Codex (optional — Claude-only setups are fully supported)
50
+ - A Z.ai Coding Plan API key
51
+
52
+ No Anthropic pay-as-you-go, no OpenAI API, no LiteLLM, no proxy.
53
+
54
+ ## Installation
55
+
56
+ ```powershell
57
+ npm install -g glm-coding-router
58
+ glm-router init
59
+ ```
60
+
61
+ `npx glm-coding-router init` also works for a one-off check, but the global install is
62
+ what puts `glm-worker` on your PATH long-term.
63
+
64
+ ## Quick start
65
+
66
+ After `glm-router init`:
67
+
68
+ ```powershell
69
+ glm-chat
70
+ glm-fast
71
+ glm-worker "Implement validation and add tests"
72
+ glm-review "Analyze the auth module"
73
+ ```
74
+
75
+ ## glm-chat
76
+
77
+ Interactive GLM-backed Claude Code session. Resolves the Z.ai key, locates `claude.exe`,
78
+ injects the Z.ai environment **into the child process only**, and spawns it with
79
+ pass-through arguments:
80
+
81
+ ```powershell
82
+ glm-chat
83
+ glm-chat --version
84
+ glm-chat --any-claude-flag
85
+ ```
86
+
87
+ Your normal `claude` command and its authentication are untouched.
88
+
89
+ ## glm-fast
90
+
91
+ Interactive GLM-backed session pinned to the **fast model** (`models.fast`,
92
+ `glm-5.3-flash` by default) — every model slot in the child environment maps to
93
+ it, so whichever tier Claude Code picks, it gets the fast model. Same pass-through
94
+ arguments as `glm-chat`:
95
+
96
+ ```powershell
97
+ glm-fast
98
+ glm-fast --profile air
99
+ ```
100
+
101
+ ## glm-worker
102
+
103
+ Headless implementation worker:
104
+
105
+ ```powershell
106
+ glm-worker "Implement validation and add tests"
107
+ ```
108
+
109
+ Or via stdin (a structured task packet):
110
+
111
+ ```powershell
112
+ @"
113
+ TASK:
114
+ Implement refresh token validation.
115
+
116
+ SCOPE:
117
+ internal/auth/
118
+
119
+ VALIDATION:
120
+ go test ./internal/auth/...
121
+ "@ | glm-worker
122
+ ```
123
+
124
+ Input priority: **stdin → arguments → error**. The worker runs with
125
+ `--max-turns 20 --permission-mode acceptEdits --tools Read,Glob,Grep,Edit,Write,Bash`.
126
+ It never uses `--dangerously-skip-permissions`.
127
+
128
+ ## glm-review
129
+
130
+ Read-only worker for repository exploration, call-graph discovery, duplicate detection,
131
+ dependency inspection, and preliminary review:
132
+
133
+ ```powershell
134
+ glm-review "Inspect this repository"
135
+ ```
136
+
137
+ Runs with `--tools Read,Glob,Grep` — it cannot edit files or run commands.
138
+
139
+ ## Profiles
140
+
141
+ All four task binaries (`glm-chat`, `glm-fast`, `glm-worker`, `glm-review`)
142
+ accept `--profile <name>` to overlay saved model/maxTurns settings. Profiles
143
+ live in `config.json`:
144
+
145
+ ```json
146
+ {
147
+ "profiles": {
148
+ "test": { "workerMaxTurns": 10, "fast": "glm-5.3-flash" },
149
+ "frontend": { "main": "glm-5.3", "reviewMaxTurns": 30 }
150
+ }
151
+ }
152
+ ```
153
+
154
+ ```powershell
155
+ glm-worker --profile test "Add failing test then fix it"
156
+ glm-review --profile frontend "Review the component tree"
157
+ ```
158
+
159
+ Fields (all optional): `main`, `fast`, `workerMaxTurns`, `reviewMaxTurns`.
160
+ Unknown profile names fail with `ERROR [11]` listing the available ones.
161
+ Note: `--profile` belongs to these wrappers — it shadows Claude Code's own
162
+ `--profile` flag inside them.
163
+
164
+ ## delegate
165
+
166
+ Run a GLM worker in an **isolated git worktree** so parallel tasks never trample
167
+ each other's working tree (`glm-router delegate backend|frontend|tests`):
168
+
169
+ ```powershell
170
+ glm-router delegate backend "Implement refresh token validation in internal/auth"
171
+ Get-Content task.md | glm-router delegate auth-refresh
172
+ ```
173
+
174
+ Each run creates a worktree at `<repo>.glm-worktrees\<name>` (outside the repo,
175
+ so your checkout's status stays clean) on a new branch `glm/delegate/<name>`
176
+ cut from `HEAD`, and runs the standard `glm-worker` inside it. The worktree and
177
+ branch are **kept** after the run — the tool never commits, merges, or deletes
178
+ your work; the footer prints the path and the merge command:
179
+
180
+ ```text
181
+ [glm-router] worktree kept at D:\code\my-repo.glm-worktrees\backend
182
+ [glm-router] next: inspect it, then merge glm/delegate/backend (or discard with git worktree remove)
183
+ ```
184
+
185
+ - Prompt priority is stdin arguments, same as `glm-worker`.
186
+ - Profiles: `--profile test` explicitly, or when omitted — a profile literally
187
+ named after the delegate (`delegate test` → the `test` profile) if one exists.
188
+ - `--remove` deletes the worktree **after a successful run only**; plain
189
+ `git worktree remove` is used, so git refuses (and the worktree is kept) when
190
+ the worker left uncommitted changes. The branch is always kept.
191
+ - Pre-flight checks fail fast (`ERROR [31]`) when the branch or directory
192
+ already exists, or the repo has no commits yet; outside a git repo →
193
+ `ERROR [30]`. Uncommitted changes in your main checkout are **not** visible
194
+ to the worker it starts from the last commit.
195
+ - `--dry-run` prints the plan; `--json` prints pre-flight and result objects.
196
+ - Run several delegates concurrently distinct names cannot collide:
197
+
198
+ ```powershell
199
+ glm-router delegate backend "Task A" # terminal 1
200
+ glm-router delegate tests "Task B" # terminal 2
201
+ ```
202
+
203
+ ## CLI reference
204
+
205
+ ```text
206
+ glm-router init guided setup
207
+ glm-router doctor [--network] full runtime diagnosis
208
+ glm-router status quick offline overview
209
+ glm-router key set store ZAI_API_KEY (Windows User Environment)
210
+ glm-router key check key configured? from which source?
211
+ glm-router config show
212
+ glm-router config set models.main glm-5.3
213
+ glm-router delegate <name> run a GLM worker in an isolated git worktree
214
+ glm-router project init CLAUDE.md / AGENTS.md managed blocks (--dry-run supported)
215
+ glm-router project remove
216
+ glm-router skill install optional Codex delegation skill
217
+ glm-router skill remove
218
+ glm-router uninstall guided removal (keeps ZAI_API_KEY by default)
219
+ ```
220
+
221
+ Global flags: `--json --quiet --verbose --dry-run --force --yes`
222
+
223
+ ## Claude integration
224
+
225
+ `glm-router project init` adds a **managed block** to `CLAUDE.md` at the project root
226
+ (`git rev-parse --show-toplevel`, falling back to cwd):
227
+
228
+ ```text
229
+ <!-- glm-coding-router:start -->
230
+ ... delegation policy ...
231
+ <!-- glm-coding-router:end -->
232
+ ```
233
+
234
+ - Everything outside the markers is preserved; existing blocks are replaced in place;
235
+ runs are idempotent and never duplicate.
236
+ - Files are updated atomically (tmp file → fsync → rename).
237
+ - On a malformed marker pair the file is left untouched with an actionable error.
238
+ - CRLF/LF and UTF-8 are preserved.
239
+ - `glm-router project remove` deletes only the managed block. A file the router
240
+ created entirely is deleted only when it would otherwise be empty.
241
+
242
+ ## Codex integration
243
+
244
+ The same command updates `AGENTS.md` (Codex's repository instruction file) with an
245
+ equivalent managed block. Additionally, `glm-router skill install` installs the optional
246
+ `glm-delegation` skill to `~/.codex/skills/glm-delegation/SKILL.md`. If Codex is not
247
+ detected, the skill step warns and skips — AGENTS.md integration and the core tool are
248
+ unaffected.
249
+
250
+ ## Orca behavior (stale environments)
251
+
252
+ Terminals embedded in Orca snapshot the Windows environment at startup. A key added
253
+ after Orca starts is invisible to those terminals. Every GLM command therefore resolves
254
+ the key in this order:
255
+
256
+ 1. `process.env.ZAI_API_KEY`
257
+ 2. Windows User Environment (via PowerShell)
258
+ 3. fail with an actionable error
259
+
260
+ The key is never cached to disk.
261
+
262
+ ## Security model
263
+
264
+ - The key lives only in the Windows User Environment; it is never written to
265
+ `config.json`, the repo, logs, or stack traces. Debug output redacts
266
+ `ZAI_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, and Authorization headers.
267
+ - Z.ai routing environment variables (`ANTHROPIC_AUTH_TOKEN`,
268
+ `ANTHROPIC_BASE_URL`, model overrides) are injected **only** into the spawned
269
+ `claude.exe` child process. `ANTHROPIC_API_KEY` is blanked in the child so your
270
+ normal Claude auth is never in play. `ANTHROPIC_BASE_URL` is never persisted globally.
271
+ - Claude Code and Codex global authentication are never modified.
272
+ - Child processes are spawned with argument arrays (`shell: false`) — prompts with
273
+ quotes, pipes, ampersands, or newlines are passed verbatim, never through a shell.
274
+ - No telemetry, no automatic git commits.
275
+
276
+ ## Troubleshooting
277
+
278
+ | Symptom | Fix |
279
+ | --- | --- |
280
+ | `ERROR [ZAI_KEY_MISSING]` | `glm-router key set`, then open a **new** terminal |
281
+ | `ERROR [CLAUDE_NOT_FOUND]` | Install Claude Code, or `glm-router config set claudePath C:\path\to\claude.exe` |
282
+ | Key works in a new terminal but not inside Orca | Expected — workers re-read the Windows User Environment automatically; run `glm-router doctor` to confirm |
283
+ | `glm-*` not on PATH after install | Reopen the terminal; check `npm config get prefix` is on PATH |
284
+ | `ERROR [MANAGED_BLOCK_CORRUPT]` | Fix the marker pair in the named file manually, then re-run |
285
+
286
+ Run `glm-router doctor` (add `--network` to probe the Z.ai endpoint) for a full diagnosis.
287
+
288
+ ## Uninstall
289
+
290
+ ```powershell
291
+ glm-router uninstall
292
+ ```
293
+
294
+ The wizard removes the config, the Codex skill, and optionally the current project
295
+ integration. `ZAI_API_KEY` is **kept** by default — removing credentials requires
296
+ explicit consent. Finish with `npm uninstall -g glm-coding-router`.
297
+
298
+ ## Development
299
+
300
+ ```powershell
301
+ npm install
302
+ npm run build # tsc → dist/
303
+ npm test # vitest run
304
+ npm run lint # eslint src tests
305
+ npm run dev # tsx src/cli.ts <args>
306
+ ```
307
+
308
+ Integration tests spawn `tests/fixtures/fake-agent.mjs` (via `node.exe`) to verify
309
+ argument passing, environment injection, and exit-code propagation without spending
310
+ API quota. See the `GLM Coding Router — Technical Specification v0.1.md` for the full
311
+ v0.1 contract (exit codes, managed-block test matrix, acceptance criteria).
312
+
313
+ ## Publishing
314
+
315
+ ```powershell
316
+ npm run build
317
+ npm test
318
+ npm publish
319
+ ```
320
+
321
+ `prepublishOnly` runs build + tests. The package ships only `dist/`; the four binaries
322
+ (`glm-router`, `glm-chat`, `glm-fast`, `glm-worker`, `glm-review`) are declared in `bin`.
323
+
324
+ ## License
325
+
326
+ MIT
package/dist/cli.js CHANGED
@@ -13,6 +13,7 @@ import { projectInitCommand } from "./commands/project-init.js";
13
13
  import { projectRemoveCommand } from "./commands/project-remove.js";
14
14
  import { skillInstallCommand, skillRemoveCommand } from "./commands/skill.js";
15
15
  import { uninstallCommand } from "./commands/uninstall.js";
16
+ import { delegateCommand } from "./commands/delegate.js";
16
17
  const program = new Command();
17
18
  program
18
19
  .name("glm-router")
@@ -87,6 +88,12 @@ skill
87
88
  .command("remove")
88
89
  .description("remove the glm-delegation skill")
89
90
  .action(() => execute(() => Promise.resolve(skillRemoveCommand(globalOptions()))));
91
+ program
92
+ .command("delegate <name> [prompt...]")
93
+ .description("run a GLM worker in an isolated git worktree (branch glm/delegate/<name>)")
94
+ .option("--profile <name>", "profile overlay (defaults to a profile named <name> if defined)")
95
+ .option("--remove", "remove the worktree after a successful run (branch is always kept)")
96
+ .action((name, prompt, commandOptions) => execute(() => delegateCommand(name, prompt, { ...globalOptions(), ...commandOptions })));
90
97
  program
91
98
  .command("uninstall")
92
99
  .description("guided removal (keeps ZAI_API_KEY by default)")