clawborrator-cli 0.0.45 → 0.0.47

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 (2) hide show
  1. package/README.md +288 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,288 @@
1
+ # clawborrator-cli
2
+
3
+ `claw` — command-line client for [clawborrator](https://next.clawborrator.com),
4
+ a control plane for Claude Code sessions.
5
+
6
+ What you can do with it from a terminal:
7
+
8
+ - Attach to any CC session you can see (yours or shared with you), watch
9
+ prompts and tool calls stream in, type your own prompts, approve or
10
+ deny permission gates, chat with other operators on the side.
11
+ - Send one-shot prompts to a session non-interactively (CI-friendly).
12
+ - Mint channel tokens (`ck_live_…`) and drop a ready-to-use `.mcp.json`
13
+ block so a CC running on this machine appears on the hub.
14
+ - Route prompts across sessions (`claw route @backend "what time is it"`)
15
+ with reply tracking.
16
+ - Share sessions with teammates at viewer / prompter / approver role.
17
+ - Publish a session as a public expert agent (`@<owner>/<slug>`,
18
+ callable from any prompt).
19
+ - Subscribe to webhooks for chat / permission / file / agent events.
20
+
21
+ The hub is at <https://next.clawborrator.com> by default — point at a
22
+ self-hosted instance with `claw login --hub <url>` (persists per
23
+ machine).
24
+
25
+ ---
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ # one-off (no global install)
31
+ npx clawborrator-cli@latest login
32
+
33
+ # or pin globally
34
+ npm install -g clawborrator-cli
35
+ claw login
36
+ ```
37
+
38
+ Requires Node 20+.
39
+
40
+ ---
41
+
42
+ ## First-time setup
43
+
44
+ ```bash
45
+ # 1. Authenticate (opens a browser → GitHub → back to a localhost
46
+ # callback that hands you a 30-day session token).
47
+ claw login
48
+
49
+ # 2. Confirm.
50
+ claw whoami
51
+ # logged in as @your-github-login
52
+
53
+ # 3. (optional) Mint a channel token + drop the .mcp.json block so
54
+ # your local Claude Code registers a session against the hub.
55
+ claw token mint --name "$(hostname)" --mcp-snippet --out .mcp.json
56
+ # → now restart `claude code` in this directory and it'll appear in
57
+ # `claw session list`.
58
+ ```
59
+
60
+ The session token is stored at `~/.clawborrator/config.json` (mode
61
+ 0600). To talk to a different hub, pass `--hub <url>` once on login;
62
+ the URL persists.
63
+
64
+ ---
65
+
66
+ ## Cheatsheet
67
+
68
+ ### Sessions
69
+
70
+ ```bash
71
+ claw session list # your sessions + ones shared with you
72
+ claw session ls --connected # only currently-online ones
73
+
74
+ claw session attach @backend # interactive TUI: live tail + send prompts + approve gates
75
+ claw session attach 6d04…uuid
76
+
77
+ claw session info @backend # one-shot detail dump
78
+ claw session events @backend --kind chat # transcript history (--limit / --after / --before)
79
+ claw session messages @backend # operator-to-operator chat (op-messages)
80
+
81
+ claw session prompt @backend "deploy to staging" # fire-and-forget
82
+ claw session prompt @backend "@MRIIOT/rust-expert what is a lifetime?" # public-agent dispatch
83
+ claw session prompt @backend "@alice/frontend ..." # cross-account peer (if shared)
84
+
85
+ claw session share @backend alice --role prompter # grant access (viewer | prompter | approver)
86
+ claw session shares @backend # list current shares
87
+ claw session unshare @backend alice # revoke
88
+
89
+ claw session archive @backend # soft-delete (auto-resurrects on next CC start in the same project)
90
+ claw session prune --dry-run # find duplicate-routing-name rows
91
+ claw session delete @backend --hard # permanent (cascades events / op-messages / shares)
92
+ ```
93
+
94
+ `<ref>` in any subcommand accepts the session UUID, the `@routingName`
95
+ for sessions you own, or `@owner/routingName` for sessions shared with
96
+ you.
97
+
98
+ ### Cross-session routing
99
+
100
+ ```bash
101
+ claw peers # sessions reachable for routing (yours + shared)
102
+
103
+ claw route @backend "what time is it" # ask-mode: blocks up to 60s for the reply
104
+ claw route @alice/frontend "..." --tell # tell-mode: fire-and-forget
105
+
106
+ claw probe "do you have a User model" --peers @backend,@frontend # parallel fan-out
107
+ claw probe "..." # implicit: every online reachable peer
108
+ ```
109
+
110
+ Routing requires prompter+ on the target. Peer's CC must be online
111
+ and not mid-turn for someone else (driver-claim contention returns a
112
+ 409 and you retry in a moment).
113
+
114
+ ### Channel tokens
115
+
116
+ For your local Claude Code to register a session against the hub,
117
+ clawborrator-mcp needs a `ck_live_…` token in the project's
118
+ `.mcp.json`:
119
+
120
+ ```bash
121
+ claw token mint --name "alice-laptop" --mcp-snippet --out .mcp.json
122
+ # → writes a ready-to-use .mcp.json
123
+ # → prints the plaintext token to stderr ONCE — copy it if you didn't redirect
124
+
125
+ claw token list # list active tokens
126
+ claw token revoke <id> # revoke (cascade-archives sessions registered with it)
127
+ ```
128
+
129
+ > **Windows note:** prefer `--out <path>` over PowerShell `>`
130
+ > redirection. PowerShell's default redirection writes UTF-16 LE with
131
+ > BOM, which CC rejects when parsing `.mcp.json`. `--out` writes UTF-8
132
+ > without BOM.
133
+
134
+ ### Public expert agents
135
+
136
+ A session you own can be published as `@<your-login>/<slug>`,
137
+ callable by any signed-in user:
138
+
139
+ ```bash
140
+ claw agents publish --session <uuid> --name "rust expert" --tagline "answers Rust questions" --published
141
+ # → @MRIIOT/rust-expert is live; rate-limited per-user, capped at
142
+ # 1000 queries/day by default.
143
+
144
+ claw agents list # discover everyone's published agents
145
+ claw agents list --mine # your own agents (any status, includes draft)
146
+
147
+ claw agents update @MRIIOT/rust-expert --budget 5000
148
+ claw agents update @MRIIOT/rust-expert --composable # opt out of isolation (cross-session routing tools enabled while answering)
149
+ claw agents update @MRIIOT/rust-expert --status draft # take it offline without unpublishing
150
+
151
+ claw agents inbound @MRIIOT/rust-expert --days 7 # who's been calling: ok / denied / latency / top askers / recent
152
+
153
+ claw agents unpublish @MRIIOT/rust-expert
154
+ ```
155
+
156
+ Default mode is `--isolated` (recommended): the agent's CC cannot
157
+ use cross-session routing tools while answering a public dispatch.
158
+ Use `--composable` only for orchestrator-style agents that need to
159
+ reach other peers.
160
+
161
+ Anyone can also call your agent over the
162
+ [A2A protocol](https://a2a-protocol.org) at
163
+ `/api/a2a/v1/agents/<owner>/<slug>` — see the
164
+ [A2A bridge reference](https://next.clawborrator.com/demos/a2a-docs/).
165
+
166
+ ### Webhooks
167
+
168
+ Subscribe to events for sessions you can see:
169
+
170
+ ```bash
171
+ claw webhook add --url https://your-server/hook \
172
+ --events 'chat.event,permission.requested,permission.resolved'
173
+
174
+ claw webhook list
175
+ claw webhook test <id> # queue a synthetic webhook.test delivery
176
+ claw webhook rm <id>
177
+ ```
178
+
179
+ The signing secret is shown ONCE on `add`. HMAC-SHA256 in the
180
+ `X-Clawborrator-Signature: t=…,v1=…` header (Stripe-style).
181
+ Verification recipes for Node + Python and the full event catalog
182
+ live at the
183
+ [webhooks reference](https://next.clawborrator.com/demos/webhooks/).
184
+
185
+ ### Auth
186
+
187
+ ```bash
188
+ claw login # browser-based GitHub OAuth (PKCE)
189
+ claw login --hub https://your-hub.example.com # point at a different hub; persists
190
+ claw whoami
191
+ claw logout # revokes the session token + clears local config
192
+ ```
193
+
194
+ ---
195
+
196
+ ## `claw session attach` — the TUI
197
+
198
+ This is the killer feature. Three or more humans attached to the
199
+ same Claude Code session, seeing each other's prompts in real time,
200
+ racing on tool-permission approvals, talking to each other in a side
201
+ channel that doesn't pollute Claude's context.
202
+
203
+ ```
204
+ $ claw session attach @backend
205
+
206
+ attached to @backend (cwd /home/alice/repo, role: prompter, alice (you), bob)
207
+ ───────────────────────────────────────────────────────────────────────────
208
+ [10:42] @bob › deploy to staging
209
+ [10:42] claude I'll start by running the test suite first…
210
+ [10:42] → Bash npm run test
211
+ ↳ permission gate: /y to approve, /n to deny (alice can decide)
212
+ /y
213
+ [10:42] ✓ Bash (allowed by @alice)
214
+ [10:43] ✓ Bash (npm run test exited 0)
215
+ [10:43] claude Tests pass. Running deploy now…
216
+ ───────────────────────────────────────────────────────────────────────────
217
+ > _ [/help for commands]
218
+ ```
219
+
220
+ In-TUI commands:
221
+
222
+ | | |
223
+ |---|---|
224
+ | `<text>` | send a prompt to the attached session |
225
+ | `@peer <text>` | route to a peer session and wait for the reply |
226
+ | `/op <text>` | operator-to-operator chat (visible to peers, not to Claude) |
227
+ | `/y` `/n` | approve / deny the most recent permission gate |
228
+ | `/peers` | show currently-reachable peer sessions |
229
+ | `/help` | full list |
230
+ | `Ctrl-C` | detach (the session keeps running) |
231
+
232
+ ---
233
+
234
+ ## Configuration
235
+
236
+ | Path | Contents |
237
+ |---|---|
238
+ | `~/.clawborrator/config.json` | hub URL + session token (mode 0600) |
239
+ | `$CLAWBORRATOR_HUB` | env override for hub URL (one-shot, doesn't persist) |
240
+
241
+ ---
242
+
243
+ ## Troubleshooting
244
+
245
+ **"can't connect to localhost:8787" after login.** You're on a
246
+ pre-0.0.45 install pointed at the dev default. Upgrade to
247
+ `@latest` and re-run `claw login`; the new default points at
248
+ `https://next.clawborrator.com`. Or pass `--hub` explicitly.
249
+
250
+ **OAuth callback hangs / "state is required" in the browser.** On
251
+ Windows the callback URL contains `&` which CMD's `start` builtin
252
+ treats as a separator. Upgrade to a recent version of the CLI
253
+ (0.0.41+); we now quote the URL through `windowsVerbatimArguments`.
254
+
255
+ **`.mcp.json` written via `>` doesn't work.** PowerShell encodes
256
+ redirected output as UTF-16 LE with BOM. CC's MCP parser doesn't
257
+ handle the BOM. Use `claw token mint … --mcp-snippet --out .mcp.json`
258
+ instead — that writes UTF-8 without BOM directly to disk.
259
+
260
+ **`claw session attach` shows "auth failed".** Your session token
261
+ expired (30-day hard cap, no refresh). Run `claw login` again and
262
+ re-attach.
263
+
264
+ **Cross-session routing returns "is offline" or "is processing a
265
+ turn for another user".** The peer's CC needs to be online (channel
266
+ WS open) and not mid-turn for someone else. Wait or pick a different
267
+ peer.
268
+
269
+ ---
270
+
271
+ ## Where to look next
272
+
273
+ - **Hub home & demos:** <https://next.clawborrator.com/>
274
+ - **REST API (OpenAPI):** <https://next.clawborrator.com/docs>
275
+ - **WebSocket (AsyncAPI):** <https://next.clawborrator.com/ws-docs>
276
+ - **Webhook reference:** <https://next.clawborrator.com/demos/webhooks/>
277
+ - **A2A bridge reference:** <https://next.clawborrator.com/demos/a2a-docs/>
278
+ - **Source / issues / contributing:** <https://github.com/clawborrator/hub_v1>
279
+
280
+ The CLI source is in `cli/` of the same repo; it's a thin shell over
281
+ the REST + WS surface, so anything `claw` does you can do directly
282
+ from any HTTP client.
283
+
284
+ ---
285
+
286
+ ## License
287
+
288
+ MIT.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "type": "module",
5
- "description": "claw — command-line client for clawborrator hub_v1. Manages PATs, channel tokens, sessions, cross-session routing, and webhooks; ships an inline TUI for live multi-operator session attach.",
5
+ "description": "claw — command-line client for clawborrator. Attach to remote Claude Code sessions, send prompts, resolve permission gates, route across sessions, manage public agents and webhooks. Auth via GitHub OAuth + PKCE.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/clawborrator/hub_v1",
8
8
  "repository": {