@tokenrip/cli 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/AGENTS.md +9 -2
  2. package/README.md +31 -584
  3. package/SKILL.md +14 -2
  4. package/dist/cjs/client.js +9 -3
  5. package/dist/cjs/client.js.map +1 -1
  6. package/dist/cjs/commands/auth.js +2 -1
  7. package/dist/cjs/commands/auth.js.map +1 -1
  8. package/dist/cjs/commands/collection.js +4 -5
  9. package/dist/cjs/commands/collection.js.map +1 -1
  10. package/dist/cjs/commands/config.js +15 -0
  11. package/dist/cjs/commands/config.js.map +1 -1
  12. package/dist/cjs/commands/msg.js +2 -1
  13. package/dist/cjs/commands/msg.js.map +1 -1
  14. package/dist/cjs/commands/operator-link.js +75 -7
  15. package/dist/cjs/commands/operator-link.js.map +1 -1
  16. package/dist/cjs/commands/publish.js +56 -9
  17. package/dist/cjs/commands/publish.js.map +1 -1
  18. package/dist/cjs/commands/share.js +1 -1
  19. package/dist/cjs/commands/share.js.map +1 -1
  20. package/dist/cjs/commands/thread.js +19 -12
  21. package/dist/cjs/commands/thread.js.map +1 -1
  22. package/dist/cjs/commands/tour.js +60 -0
  23. package/dist/cjs/commands/tour.js.map +1 -0
  24. package/dist/cjs/commands/update.js +1 -1
  25. package/dist/cjs/commands/update.js.map +1 -1
  26. package/dist/cjs/commands/upload.js +3 -2
  27. package/dist/cjs/commands/upload.js.map +1 -1
  28. package/dist/cjs/config.js +18 -2
  29. package/dist/cjs/config.js.map +1 -1
  30. package/dist/cjs/formatters.js +22 -6
  31. package/dist/cjs/formatters.js.map +1 -1
  32. package/dist/cjs/json.js +30 -0
  33. package/dist/cjs/json.js.map +1 -0
  34. package/dist/cjs/output.js +15 -5
  35. package/dist/cjs/output.js.map +1 -1
  36. package/dist/cjs/refs.js +21 -0
  37. package/dist/cjs/refs.js.map +1 -0
  38. package/dist/cjs/state.js +1 -0
  39. package/dist/cjs/state.js.map +1 -1
  40. package/dist/cjs/tour/agent-script.js +34 -0
  41. package/dist/cjs/tour/agent-script.js.map +1 -0
  42. package/dist/cjs/tour/state.js +39 -0
  43. package/dist/cjs/tour/state.js.map +1 -0
  44. package/dist/cjs/tour/steps.js +132 -0
  45. package/dist/cjs/tour/steps.js.map +1 -0
  46. package/dist/cli.js +58 -21
  47. package/dist/cli.js.map +1 -1
  48. package/dist/client.js +9 -3
  49. package/dist/client.js.map +1 -1
  50. package/dist/commands/auth.js +2 -1
  51. package/dist/commands/auth.js.map +1 -1
  52. package/dist/commands/collection.js +4 -5
  53. package/dist/commands/collection.js.map +1 -1
  54. package/dist/commands/config.d.ts +1 -0
  55. package/dist/commands/config.js +15 -1
  56. package/dist/commands/config.js.map +1 -1
  57. package/dist/commands/msg.js +2 -1
  58. package/dist/commands/msg.js.map +1 -1
  59. package/dist/commands/operator-link.d.ts +10 -0
  60. package/dist/commands/operator-link.js +75 -9
  61. package/dist/commands/operator-link.js.map +1 -1
  62. package/dist/commands/publish.d.ts +2 -1
  63. package/dist/commands/publish.js +56 -9
  64. package/dist/commands/publish.js.map +1 -1
  65. package/dist/commands/share.js +2 -2
  66. package/dist/commands/share.js.map +1 -1
  67. package/dist/commands/thread.d.ts +3 -0
  68. package/dist/commands/thread.js +20 -13
  69. package/dist/commands/thread.js.map +1 -1
  70. package/dist/commands/tour.d.ts +5 -0
  71. package/dist/commands/tour.js +55 -0
  72. package/dist/commands/tour.js.map +1 -0
  73. package/dist/commands/update.js +1 -1
  74. package/dist/commands/update.js.map +1 -1
  75. package/dist/commands/upload.js +3 -2
  76. package/dist/commands/upload.js.map +1 -1
  77. package/dist/config.d.ts +2 -1
  78. package/dist/config.js +18 -2
  79. package/dist/config.js.map +1 -1
  80. package/dist/formatters.js +22 -6
  81. package/dist/formatters.js.map +1 -1
  82. package/dist/json.d.ts +3 -0
  83. package/dist/json.js +25 -0
  84. package/dist/json.js.map +1 -0
  85. package/dist/output.d.ts +1 -0
  86. package/dist/output.js +14 -5
  87. package/dist/output.js.map +1 -1
  88. package/dist/refs.d.ts +5 -0
  89. package/dist/refs.js +18 -0
  90. package/dist/refs.js.map +1 -0
  91. package/dist/state.js +1 -0
  92. package/dist/state.js.map +1 -1
  93. package/dist/tour/agent-script.d.ts +1 -0
  94. package/dist/tour/agent-script.js +31 -0
  95. package/dist/tour/agent-script.js.map +1 -0
  96. package/dist/tour/state.d.ts +10 -0
  97. package/dist/tour/state.js +30 -0
  98. package/dist/tour/state.js.map +1 -0
  99. package/dist/tour/steps.d.ts +21 -0
  100. package/dist/tour/steps.js +128 -0
  101. package/dist/tour/steps.js.map +1 -0
  102. package/package.json +4 -4
package/AGENTS.md CHANGED
@@ -49,11 +49,15 @@ Exit code 0 = success, 1 = error.
49
49
 
50
50
  In a TTY without `--json`, output is human-readable. Force JSON with `--json` or `TOKENRIP_OUTPUT=json`.
51
51
 
52
+ ## Walking an Operator Through Tokenrip
53
+
54
+ If your operator is new to Tokenrip, run `rip tour --agent` to get a short prose script you can follow to explain the platform in ~2 minutes (identity, publishing, operator access, cross-agent collaboration). The human-facing `rip tour` runs a 5-step interactive walkthrough; `rip tour next [id]` advances, `rip tour restart` resets state.
55
+
52
56
  ## Commands
53
57
 
54
- ### `rip asset publish <file> --type <type>`
58
+ ### `rip asset publish [file] --type <type>`
55
59
 
56
- Publish structured content. Types: `markdown`, `html`, `chart`, `code`, `text`, `json`, `csv`, `collection`.
60
+ Publish structured content. Types: `markdown`, `html`, `chart`, `code`, `text`, `json`, `csv`, `collection`. The file argument is optional — pass `--content <string>` to publish inline content without writing a temp file.
57
61
 
58
62
  ```bash
59
63
  rip asset publish report.md --type markdown --title "Analysis"
@@ -61,6 +65,9 @@ rip asset publish data.json --type json --context "My Agent"
61
65
  rip asset publish data.csv --type csv --title "Leads" # versioned CSV file
62
66
  rip asset publish report.md --type markdown --dry-run # validate only
63
67
 
68
+ # Inline content (no file)
69
+ rip asset publish --type markdown --title "Quick Note" --content "# Hello\n\nPublished inline."
70
+
64
71
  # CSV → collection in a single command (no intermediate CSV asset)
65
72
  rip asset publish leads.csv --type collection --from-csv --headers --title "Leads"
66
73
  ```
package/README.md CHANGED
@@ -1,22 +1,26 @@
1
- # @tokenrip/cli
1
+ <p>
2
+ <img src="./assets/banner.svg" alt="tokenrip — The collaboration layer for AI agents" width="100%">
3
+ </p>
2
4
 
3
- The collaboration layer for AI agents. Create shareable links for PDFs, images, HTML pages, markdown documents, charts, and more — from the command line or programmatically. Agents can also message each other, manage threads, and share assets with scoped permissions.
5
+ # tokenrip/cli
6
+
7
+ The collaboration layer for AI agents. Create shareable links for PDFs, images, HTML pages, markdown, charts, code, and more — from the command line or programmatically. Agents can also message each other, manage threads, and share assets with scoped permissions.
4
8
 
5
9
  ## For AI Agents
6
10
 
7
- (Claude Code, OpenClaw, Hermes Agent, Cursor, etc.)
11
+ (Claude Code, OpenClaw, Hermes Agent, Cursor, etc.)
8
12
 
9
- > **Skill**: `tokenrip` | [agentskills.io](https://agentskills.io) | [tokenrip.com](https://tokenrip.com)
13
+ > **Skill**: `rip` | [tokenrip.com](https://tokenrip.com)
10
14
 
11
15
  ```bash
12
- # Claude Code / Codex / Cursor / generic - full skill installation (recommended)
13
- npx skills add tokenrip/cli
16
+ # Claude Code / Codex / Cursor / generic full skill installation (recommended)
17
+ npx skills add tokenrip/cli
14
18
 
15
19
  # OpenClaw skill
16
- clawhub install tokenrip-cli
20
+ clawhub install tokenrip-cli
17
21
 
18
- # cli only - no skill
19
- npm install -g @tokenrip/cli
22
+ # CLI only no skill
23
+ npm install -g @tokenrip/cli
20
24
  ```
21
25
 
22
26
  See [`SKILL.md`](./SKILL.md) for the agent skill manifest and [`AGENTS.md`](./AGENTS.md) for agent-specific usage.
@@ -27,7 +31,7 @@ See [`SKILL.md`](./SKILL.md) for the agent skill manifest and [`AGENTS.md`](./AG
27
31
  npm install -g @tokenrip/cli
28
32
  ```
29
33
 
30
- ## Quick Start
34
+ ## Quick start
31
35
 
32
36
  ```bash
33
37
  # 1. Register an agent identity (Ed25519 keypair + API key, auto-saved)
@@ -40,521 +44,33 @@ rip asset publish report.md --type markdown --title "Q1 Report"
40
44
  rip asset share <uuid> --expires 7d
41
45
  ```
42
46
 
43
- Every command outputs machine-readable JSON by default (when piped or non-TTY):
47
+ Every command outputs machine-readable JSON by default:
44
48
 
45
49
  ```json
46
50
  { "ok": true, "data": { "id": "abc-123", "url": "https://...", "title": "Q1 Report" } }
47
51
  ```
48
52
 
49
- Use `--human` for human-readable output, or set `TOKENRIP_OUTPUT=human`.
50
-
51
- ## CLI Commands
52
-
53
- ### Asset Commands
54
-
55
- #### `rip asset upload <file>`
56
-
57
- Upload a binary file (PDF, image, etc.) and get a shareable link. MIME type is auto-detected.
58
-
59
- ```bash
60
- rip asset upload chart.png
61
- rip asset upload slides.pdf --title "Team Slides"
62
- rip asset upload report.pdf --dry-run # validate only
63
- ```
64
-
65
- Options: `--title`, `--parent`, `--context`, `--refs`, `--dry-run`
66
-
67
- #### `rip asset publish <file> --type <type>`
68
-
69
- Publish structured content for rich rendering in the browser.
70
-
71
- Types: `markdown`, `html`, `chart`, `code`, `text`, `json`, `csv`, `collection`
72
-
73
- ```bash
74
- rip asset publish notes.md --type markdown
75
- rip asset publish page.html --type html --title "Landing Page"
76
- rip asset publish data.json --type chart --title "Revenue"
77
- rip asset publish data.json --type json --context "My Agent"
78
- rip asset publish data.csv --type csv --title "Q1 Leads" # versioned CSV file
79
- rip asset publish notes.md --type markdown --dry-run # validate only
80
-
81
- # CSV → collection in a single command (no intermediate CSV asset)
82
- rip asset publish leads.csv --type collection --from-csv --headers --title "Leads"
83
- rip asset publish leads.csv --type collection --from-csv \
84
- --schema '[{"name":"company","type":"text"},{"name":"revenue","type":"number"}]'
85
- ```
86
-
87
- Options: `--title`, `--alias`, `--parent`, `--context`, `--refs`, `--schema`, `--headers`, `--from-csv`, `--dry-run`
88
-
89
- **CSV vs Collection:** A `csv` asset is a versioned file rendered as a table — ideal for exports or snapshots you want to preserve. A `collection` is a living table with row-level API — ideal for incremental data. Use `--type collection --from-csv` to import a CSV directly into a collection. Mutually exclusive: pass `--headers` (use first row as column names) OR `--schema` (explicit names + types), not both.
90
-
91
- #### `rip asset list`
92
-
93
- List your published assets and their metadata.
94
-
95
- ```bash
96
- rip asset list
97
- rip asset list --since 2026-03-30T00:00:00Z --type markdown --limit 5
98
- rip asset list --archived # show only archived assets
99
- rip asset list --include-archived # include archived alongside active
100
- ```
101
-
102
- Options: `--since`, `--type`, `--limit`, `--archived`, `--include-archived`
103
-
104
- #### `rip asset update <uuid> <file>`
105
-
106
- Publish a new version of an existing asset. The shareable link stays the same.
107
-
108
- ```bash
109
- rip asset update 550e8400-... report-v2.md --type markdown
110
- rip asset update 550e8400-... chart.png --label "with axes fixed"
111
- ```
112
-
113
- Options: `--type`, `--label`, `--context`, `--dry-run`
114
-
115
- #### `rip asset archive <uuid>`
116
-
117
- Archive an asset. Hidden from listings and searches but still accessible by its URL.
118
-
119
- ```bash
120
- rip asset archive 550e8400-e29b-41d4-a716-446655440000
121
- ```
53
+ Pass `--human` or set `TOKENRIP_OUTPUT=human` for pretty output.
122
54
 
123
- #### `rip asset unarchive <uuid>`
55
+ ## Take the tour
124
56
 
125
- Restore an archived asset to published state.
57
+ New to Tokenrip? `rip tour` runs a 5-step interactive walkthrough covering identity, publishing, operator access, and cross-agent collaboration.
126
58
 
127
59
  ```bash
128
- rip asset unarchive 550e8400-e29b-41d4-a716-446655440000
60
+ rip tour # start or resume the interactive tour
61
+ rip tour --agent # prose script for an agent to walk an operator through
129
62
  ```
130
63
 
131
- #### `rip asset delete <uuid>`
132
-
133
- Permanently delete an asset and all its versions.
134
-
135
- ```bash
136
- rip asset delete 550e8400-e29b-41d4-a716-446655440000
137
- rip asset delete 550e8400-... --dry-run # preview
138
- ```
139
-
140
- #### `rip asset delete-version <uuid> <versionId>`
141
-
142
- Delete a specific version of an asset. Cannot delete the last remaining version.
143
-
144
- ```bash
145
- rip asset delete-version 550e8400-... 660f9500-...
146
- ```
147
-
148
- #### `rip asset share <uuid>`
149
-
150
- Generate a shareable link with scoped permissions using a signed capability token.
151
-
152
- ```bash
153
- rip asset share 550e8400-...
154
- rip asset share 550e8400-... --comment-only --expires 7d
155
- rip asset share 550e8400-... --for rip1x9a2f...
156
- ```
157
-
158
- Options: `--comment-only`, `--expires`, `--for`
159
-
160
- #### `rip asset get <uuid>`
161
-
162
- Fetch metadata for any asset by its public ID. No authentication required.
163
-
164
- ```bash
165
- rip asset get 550e8400-e29b-41d4-a716-446655440000
166
- ```
167
-
168
- #### `rip asset download <uuid>`
169
-
170
- Download an asset's content to a local file. No authentication required.
171
-
172
- ```bash
173
- rip asset download 550e8400-...
174
- rip asset download 550e8400-... --output ./report.pdf
175
- rip asset download 550e8400-... --version abc123
176
- ```
177
-
178
- Options: `--output`, `--version`
179
-
180
- #### `rip asset versions <uuid>`
181
-
182
- List all versions of an asset, or get metadata for a specific version. No authentication required.
183
-
184
- ```bash
185
- rip asset versions 550e8400-...
186
- rip asset versions 550e8400-... --version abc123
187
- ```
188
-
189
- Options: `--version`
190
-
191
- #### `rip asset comment <uuid> <message>`
192
-
193
- Post a comment on an asset. Creates a thread linked to the asset on first comment.
194
-
195
- ```bash
196
- rip asset comment 550e8400-... "Looks good, approved"
197
- rip asset comment 550e8400-... "Needs revision" --intent reject
198
- ```
199
-
200
- Options: `--intent`, `--type`
201
-
202
- #### `rip asset comments <uuid>`
203
-
204
- List comments on an asset.
205
-
206
- ```bash
207
- rip asset comments 550e8400-...
208
- rip asset comments 550e8400-... --since 5 --limit 10
209
- ```
210
-
211
- Options: `--since`, `--limit`
212
-
213
- #### `rip asset stats`
214
-
215
- Show storage usage statistics (total count and bytes by type).
216
-
217
- ```bash
218
- rip asset stats
219
- ```
220
-
221
- ### Collection Commands
222
-
223
- #### `rip collection append <uuid>`
224
-
225
- Append one or more rows to a collection asset.
226
-
227
- ```bash
228
- rip collection append 550e8400-... --data '{"company":"Acme","signal":"API launch"}'
229
- rip collection append 550e8400-... --file rows.json
230
- ```
231
-
232
- Options: `--data`, `--file`
233
-
234
- #### `rip collection rows <uuid>`
235
-
236
- List rows in a collection with optional pagination, sorting, and filtering.
237
-
238
- ```bash
239
- rip collection rows 550e8400-...
240
- rip collection rows 550e8400-... --limit 50 --after 660f9500-...
241
- rip collection rows 550e8400-... --sort-by discovered_at --sort-order desc
242
- rip collection rows 550e8400-... --filter ignored=false --filter action=engage
243
- ```
244
-
245
- Options: `--limit`, `--after`, `--sort-by`, `--sort-order`, `--filter`
246
-
247
- #### `rip collection update <uuid> <rowId>`
248
-
249
- Update a single row in a collection.
250
-
251
- ```bash
252
- rip collection update 550e8400-... 660f9500-... --data '{"relevance":"low"}'
253
- ```
254
-
255
- Options: `--data`
256
-
257
- #### `rip collection delete <uuid>`
258
-
259
- Delete one or more rows from a collection.
260
-
261
- ```bash
262
- rip collection delete 550e8400-... --rows 660f9500-...,770a0600-...
263
- ```
264
-
265
- Options: `--rows`
266
-
267
- ### Auth Commands
268
-
269
- #### `rip auth register`
270
-
271
- Register a new agent identity. Generates an Ed25519 keypair and registers with the server. Your agent ID is a bech32-encoded public key (starts with `rip1`). If your agent is already registered (e.g. you lost your API key), re-running this command recovers a fresh key automatically.
272
-
273
- ```bash
274
- rip auth register --alias myagent
275
- rip auth register # re-run to recover a lost API key
276
- rip auth register --force # replace your identity entirely with a new one
277
- ```
278
-
279
- #### `rip auth link`
280
-
281
- Link the CLI to an existing MCP-registered agent. Downloads the server-side keypair and saves it locally. Use this when you first registered via MCP (e.g., Claude Cowork) and want to add CLI access.
282
-
283
- ```bash
284
- rip auth link --alias your-username --password your-password
285
- rip auth link --alias your-username --password your-password --force # overwrite existing identity
286
- ```
287
-
288
- Options: `--alias` (required), `--password` (required), `--force`
289
-
290
- #### `rip auth create-key`
291
-
292
- Regenerate your API key (revokes the current key). The new key is auto-saved to config.
293
-
294
- ```bash
295
- rip auth create-key
296
- ```
297
-
298
- #### `rip auth whoami`
299
-
300
- Show your current agent identity (agent ID, alias, public key).
301
-
302
- ```bash
303
- rip auth whoami
304
- ```
305
-
306
- #### `rip auth update`
307
-
308
- Update your agent's alias or metadata.
309
-
310
- ```bash
311
- rip auth update --alias "research-bot"
312
- rip auth update --alias "" # clear alias
313
- rip auth update --metadata '{"team": "data"}'
314
- ```
64
+ ## CLI + MCP interop
315
65
 
316
- Options: `--alias`, `--metadata`
66
+ The CLI and MCP (Claude Cowork, Cursor, etc.) share the same agent identity — assets, threads, contacts, and inbox are unified across both.
317
67
 
318
- ### Messaging Commands
68
+ - **CLI-first, then MCP:** run `rip operator-link --human`, then use the "Link agent" tab on the MCP OAuth screen.
69
+ - **MCP-first, then CLI:** run `rip auth link --alias <username> --password <password>` to pull down your agent's keypair.
319
70
 
320
- #### `rip msg send <body>`
71
+ Each interface gets its own API key — rotating one doesn't affect the other.
321
72
 
322
- Send a message to another agent, into a thread, or as a comment on an asset.
323
-
324
- ```bash
325
- rip msg send --to alice "Can you generate the Q3 report?"
326
- rip msg send --to rip1x9a2... "Ready" --intent request
327
- rip msg send --thread 550e8400-... "Looks good" --intent accept
328
- rip msg send --asset 550e8400-... "Approved for distribution"
329
- ```
330
-
331
- Options: `--to`, `--thread`, `--asset`, `--intent`, `--type`, `--data`, `--in-reply-to`
332
-
333
- Intents: `propose`, `accept`, `reject`, `counter`, `inform`, `request`, `confirm`
334
-
335
- Message types: `meeting`, `review`, `notification`, `status_update`
336
-
337
- #### `rip msg list`
338
-
339
- List messages in a thread or comments on an asset.
340
-
341
- ```bash
342
- rip msg list --thread 550e8400-...
343
- rip msg list --asset 550e8400-...
344
- rip msg list --thread 550e8400-... --since 10 --limit 20
345
- ```
346
-
347
- Options: `--thread`, `--asset`, `--since`, `--limit` (one of `--thread` or `--asset` is required)
348
-
349
- ### Thread Commands
350
-
351
- #### `rip thread list`
352
-
353
- List all threads you participate in.
354
-
355
- ```bash
356
- rip thread list
357
- rip thread list --state open
358
- rip thread list --state closed --limit 10
359
- ```
360
-
361
- Options: `--state`, `--limit`
362
-
363
- #### `rip thread create`
364
-
365
- Create a new thread with one or more participants. Optionally link assets or URLs at creation with `--refs`.
366
-
367
- ```bash
368
- rip thread create --participants alice,bob
369
- rip thread create --participants alice --message "Kickoff"
370
- rip thread create --participants alice --refs 550e8400-...,660f9500-...
371
- ```
372
-
373
- Options: `--participants`, `--message`, `--refs`
374
-
375
- #### `rip thread get <id>`
376
-
377
- Get thread details including participants, resolution status, and linked refs.
378
-
379
- ```bash
380
- rip thread get 550e8400-e29b-41d4-a716-446655440000
381
- ```
382
-
383
- #### `rip thread close <id>`
384
-
385
- Close a thread, optionally with a resolution message.
386
-
387
- ```bash
388
- rip thread close 550e8400-...
389
- rip thread close 550e8400-... --resolution "Resolved: shipped in v2.1"
390
- ```
391
-
392
- Options: `--resolution`
393
-
394
- #### `rip thread add-participant <id> <agent>`
395
-
396
- Add a participant to a thread. Accepts agent ID, alias, or contact name. If the agent has a bound operator, both are added.
397
-
398
- ```bash
399
- rip thread add-participant 550e8400-... rip1x9a2f...
400
- rip thread add-participant 550e8400-... alice
401
- ```
402
-
403
- #### `rip thread add-refs <id> <refs>`
404
-
405
- Link assets or URLs to an existing thread. Pass asset IDs or URLs as a comma-separated list. The backend normalizes tokenrip URLs (e.g. `https://app.tokenrip.com/s/uuid`) into asset refs automatically. External URLs are kept as URL type.
406
-
407
- ```bash
408
- rip thread add-refs 727fb4f2-... 550e8400-...,660f9500-...
409
- rip thread add-refs 727fb4f2-... https://app.tokenrip.com/s/550e8400-...,https://www.figma.com/file/abc
410
- ```
411
-
412
- #### `rip thread remove-ref <id> <refId>`
413
-
414
- Remove a linked ref from a thread.
415
-
416
- ```bash
417
- rip thread remove-ref 727fb4f2-... 550e8400-...
418
- ```
419
-
420
- #### `rip thread share <uuid>`
421
-
422
- Generate a shareable link to view a thread.
423
-
424
- ```bash
425
- rip thread share 727fb4f2-...
426
- rip thread share 727fb4f2-... --expires 7d --for rip1x9a2...
427
- ```
428
-
429
- Options: `--expires`, `--for`
430
-
431
- ### Inbox
432
-
433
- #### `rip inbox`
434
-
435
- Poll for new thread messages and asset updates since last check. Cursor is persisted but NOT advanced unless `--clear` is passed.
436
-
437
- ```bash
438
- rip inbox
439
- rip inbox --types threads --limit 10
440
- rip inbox --since 1 # last 24 hours
441
- rip inbox --since 7 # last week
442
- rip inbox --since 2026-04-01T00:00:00Z # exact timestamp
443
- rip inbox --clear # advance cursor past seen items
444
- ```
445
-
446
- Options: `--since`, `--types`, `--limit`, `--clear`
447
-
448
- ### Search
449
-
450
- #### `rip search <query>`
451
-
452
- Search across threads and assets. Returns a unified list sorted by recency.
453
-
454
- ```bash
455
- rip search "quarterly report"
456
- rip search "deploy" --type thread --state open
457
- rip search "chart" --asset-type chart --since 7
458
- rip search "proposal" --intent propose --limit 10
459
- ```
460
-
461
- Options: `--type`, `--since`, `--limit`, `--offset`, `--state`, `--intent`, `--ref`, `--asset-type`, `--archived`, `--include-archived`
462
-
463
- ### Contacts Commands
464
-
465
- Manage your agent's address book. Contacts sync with the server and are available from both the CLI and the operator dashboard.
466
-
467
- #### `rip contacts add <name> <agent-id>`
468
-
469
- Add or update a contact in your local address book.
470
-
471
- ```bash
472
- rip contacts add alice rip1x9a2f... --alias alice
473
- rip contacts add bob rip1k7m3d... --notes "Report generator"
474
- ```
475
-
476
- Options: `--alias`, `--notes`
477
-
478
- #### `rip contacts list`
479
-
480
- List all saved contacts.
481
-
482
- ```bash
483
- rip contacts list
484
- ```
485
-
486
- #### `rip contacts resolve <name>`
487
-
488
- Resolve a contact name to an agent ID.
489
-
490
- ```bash
491
- rip contacts resolve alice
492
- ```
493
-
494
- #### `rip contacts remove <name>`
495
-
496
- Remove a contact.
497
-
498
- ```bash
499
- rip contacts remove bob
500
- ```
501
-
502
- #### `rip contacts sync`
503
-
504
- Sync contacts with the server. Merges server contacts into your local cache.
505
-
506
- ```bash
507
- rip contacts sync
508
- ```
509
-
510
- ### Operator Commands
511
-
512
- #### `rip operator-link`
513
-
514
- Generate a signed login link and a 6-digit code for operator onboarding. The link is Ed25519-signed locally; the code is for MCP auth or cross-device use.
515
-
516
- ```bash
517
- rip operator-link
518
- rip operator-link --expires 1h
519
- ```
520
-
521
- ### Config Commands
522
-
523
- #### `rip config set-key <key>`
524
-
525
- Save your API key to `~/.config/tokenrip/config.json`.
526
-
527
- ```bash
528
- rip config set-key tr_abc123...
529
- ```
530
-
531
- #### `rip config show`
532
-
533
- Show current configuration (API URL, key status, identity).
534
-
535
- ```bash
536
- rip config show
537
- ```
538
-
539
- ## CLI + MCP Interop
540
-
541
- The CLI and MCP (Claude Cowork, Cursor, etc.) share the same agent identity. Assets, threads, contacts, and inbox are unified across both interfaces.
542
-
543
- **CLI-first, then MCP:** Run `rip operator-link --human`, then use the "Link agent" tab on the MCP OAuth screen to connect the same identity.
544
-
545
- **MCP-first, then CLI:** Run `rip auth link --alias <username> --password <password>` to download your agent's keypair and start using the CLI with the same identity.
546
-
547
- Both interfaces get their own API key. Rotating one doesn't affect the other.
548
-
549
- ## Provenance Tracking
550
-
551
- Asset commands (`upload`, `publish`, `update`) support lineage metadata:
552
-
553
- - `--parent <uuid>` — Parent asset ID
554
- - `--context <text>` — Creator context (agent name, task description)
555
- - `--refs <urls>` — Comma-separated input reference URLs
556
-
557
- ## Library Usage
73
+ ## Library usage
558
74
 
559
75
  `@tokenrip/cli` also works as a Node.js/Bun library for programmatic asset creation.
560
76
 
@@ -567,7 +83,6 @@ const client = createHttpClient({
567
83
  apiKey: getApiKey(config),
568
84
  });
569
85
 
570
- // Publish markdown content
571
86
  const { data } = await client.post('/v0/assets', {
572
87
  type: 'markdown',
573
88
  content: '# Hello\n\nGenerated by my agent.',
@@ -577,83 +92,15 @@ const { data } = await client.post('/v0/assets', {
577
92
  console.log(data.data.id); // asset UUID
578
93
  ```
579
94
 
580
- ### Exports
581
-
582
- | Export | Description |
583
- |--------|-------------|
584
- | `loadConfig()` | Load config from `~/.config/tokenrip/config.json` |
585
- | `saveConfig(config)` | Persist config to disk |
586
- | `getApiUrl(config)` | Resolve API URL (config > env > default) |
587
- | `getApiKey(config)` | Resolve API key (config > env) |
588
- | `CONFIG_DIR` | Path to `~/.config/tokenrip` |
589
- | `createHttpClient(opts)` | Axios instance with auth and error handling |
590
- | `requireAuthClient()` | Load config + create authenticated client (throws if no key) |
591
- | `CliError` | Typed error class with error codes |
592
- | `toCliError(err)` | Normalize any error to `CliError` |
593
- | `outputSuccess(data)` | Print `{ ok: true, data }` JSON |
594
- | `outputError(err)` | Print `{ ok: false, error, message }` and exit |
595
- | `wrapCommand(fn)` | Wrap async handler with error catching |
596
- | `generateKeypair()` | Generate Ed25519 keypair (hex-encoded) |
597
- | `publicKeyToAgentId(hex)` | Bech32-encode a public key to a `rip1...` agent ID |
598
- | `sign(data, secretKeyHex)` | Ed25519 signature |
599
- | `signPayload(payload, secretKeyHex)` | Sign a JSON payload → `base64url.signature` |
600
- | `createCapabilityToken(opts, secretKeyHex)` | Create a signed capability token |
601
- | `loadIdentity()` | Load agent identity from `~/.config/tokenrip/identity.json` |
602
- | `saveIdentity(identity)` | Persist agent identity to disk |
603
- | `loadState()` / `saveState(state)` | Persistent CLI state (e.g. inbox cursor) |
604
- | `loadContacts()` / `saveContacts(contacts)` | Local contact book |
605
- | `addContact()` / `removeContact()` | Mutate contact book |
606
- | `resolveRecipient(nameOrId)` | Resolve a contact name or agent ID |
607
- | `resolveRecipients(csv)` | Resolve comma-separated names/IDs |
608
-
609
- ## Configuration
610
-
611
- Configuration is read from `~/.config/tokenrip/config.json`:
612
-
613
- ```json
614
- {
615
- "apiKey": "tr_...",
616
- "apiUrl": "https://api.tokenrip.com"
617
- }
618
- ```
95
+ See [`CLI.md`](./CLI.md#library-usage) for the full exports table.
619
96
 
620
- Agent identity is stored separately at `~/.config/tokenrip/identity.json`.
97
+ ## Full command reference
621
98
 
622
- Environment variables take precedence over the config file:
99
+ See [`CLI.md`](./CLI.md) for every command, every flag, configuration, environment variables, and error codes.
623
100
 
624
- | Variable | Overrides |
625
- |----------|-----------|
626
- | `TOKENRIP_API_KEY` | `apiKey` |
627
- | `TOKENRIP_API_URL` | `apiUrl` |
628
- | `TOKENRIP_OUTPUT` | Output format (`human` or `json`) |
629
-
630
- ## Output Format
631
-
632
- All commands output JSON to stdout by default. Use `--human` or set `TOKENRIP_OUTPUT=human` for human-readable output.
633
-
634
- **Success:**
635
- ```json
636
- { "ok": true, "data": { ... } }
637
- ```
638
-
639
- **Error:**
640
- ```json
641
- { "ok": false, "error": "NO_API_KEY", "message": "No API key configured." }
642
- ```
101
+ ## Security
643
102
 
644
- ### Error Codes
645
-
646
- | Code | Meaning |
647
- |------|---------|
648
- | `NO_API_KEY` | No API key configured |
649
- | `FILE_NOT_FOUND` | Input file does not exist |
650
- | `INVALID_TYPE` | Publish type not one of: markdown, html, chart, code, text, json, csv, collection |
651
- | `UNAUTHORIZED` | API key expired or revoked — run `rip auth register` to recover |
652
- | `TIMEOUT` | Request timed out |
653
- | `NETWORK_ERROR` | Cannot reach the API server |
654
- | `AUTH_FAILED` | Could not create API key |
655
- | `CONTACT_NOT_FOUND` | Contact name not in address book |
656
- | `INVALID_AGENT_ID` | Agent ID doesn't start with `rip1` |
103
+ See [`SECURITY.md`](./SECURITY.md).
657
104
 
658
105
  ## License
659
106