@tryarcanist/cli 0.1.98 → 0.1.100
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 +295 -0
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Arcanist CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for [Arcanist](https://www.tryarcanist.com): create coding agent sessions, follow their output, and manage access tokens from your terminal or automation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @tryarcanist/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node.js 22 or newer.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
arcanist auth login # paste a token from Settings > CLI Tokens
|
|
17
|
+
arcanist sessions create https://github.com/your-org/your-repo "fix the login bug"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
export ARCANIST_TOKEN=arc_... # write-scoped for create/send/stop
|
|
22
|
+
SESSION_ID=$(arcanist sessions create your-org/your-repo "add tests for the auth module" --json | jq -r .sessionId)
|
|
23
|
+
arcanist sessions events "$SESSION_ID" --follow --json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Authentication
|
|
27
|
+
|
|
28
|
+
Generate a CLI token in the Arcanist UI at **Settings > CLI Tokens**, then:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
arcanist auth login
|
|
32
|
+
# paste your arc_... token when prompted; input is masked
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Token config is stored at `~/.arcanist/config.json`. Multiple active tokens per user are supported; revoke tokens independently when a device or workflow no longer needs access.
|
|
36
|
+
|
|
37
|
+
Use a read-scoped token for inspection and debugging; use a write-scoped token only to create sessions, send prompts, or stop runs.
|
|
38
|
+
|
|
39
|
+
You can also pipe the token via stdin:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
printf "arc_..." | arcanist auth login --token-stdin
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Auth and API URL precedence:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
flag > environment > ~/.arcanist/config.json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Supported environment variables:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
export ARCANIST_TOKEN=arc_...
|
|
55
|
+
export ARCANIST_API_URL=https://app.tryarcanist.com
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`--token` and `--api-url` are available for one-off invocations. Prefer `ARCANIST_TOKEN` over `--token` for persistent use; CLI flags can appear in shell history and process lists.
|
|
59
|
+
|
|
60
|
+
Non-local API URLs must use HTTPS and must not embed credentials.
|
|
61
|
+
|
|
62
|
+
## Global flags
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
arcanist --json
|
|
66
|
+
arcanist --quiet
|
|
67
|
+
arcanist --api-url https://app.tryarcanist.com
|
|
68
|
+
arcanist --token arc_...
|
|
69
|
+
arcanist --no-color
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## JSON output, errors, and exit codes
|
|
73
|
+
|
|
74
|
+
With `--json`, successful command output is machine-readable and newline-terminated. Errors are written to stderr as:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"error": { "code": "auth", "message": "Not logged in.", "hint": "Run `arcanist auth login` or set `ARCANIST_TOKEN`." }
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Exit codes:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
0 ok
|
|
86
|
+
1 user/input error
|
|
87
|
+
2 auth error (401/403)
|
|
88
|
+
3 not found (404)
|
|
89
|
+
4 conflict (409)
|
|
90
|
+
10 server or network error
|
|
91
|
+
130 interrupted
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Mutation commands send an `Idempotency-Key` header. The CLI does not auto-retry mutation endpoints; retry explicitly with the same `--idempotency-key` when a request may have already reached the server. `--idempotency-key` is available on `sessions create` and `sessions send`.
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
### `arcanist auth login`
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
arcanist auth login
|
|
102
|
+
printf "arc_..." | arcanist auth login --token-stdin
|
|
103
|
+
arcanist auth login --api-url https://app.tryarcanist.com
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `arcanist auth whoami`
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
arcanist auth whoami
|
|
110
|
+
ARCANIST_TOKEN=arc_... arcanist auth whoami --json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
JSON mode prints the raw `/api/auth/whoami` API response. Fields currently include `userId`, `email`, `tokenId`, `tokenScope`, and `authMode`.
|
|
114
|
+
|
|
115
|
+
### `arcanist sessions create <repo-url> [prompt]`
|
|
116
|
+
|
|
117
|
+
Creates a new session and sends the initial prompt.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
arcanist sessions create https://github.com/your-org/your-repo "fix the login bug"
|
|
121
|
+
printf "add tests" | arcanist sessions create your-org/your-repo --prompt-stdin --json
|
|
122
|
+
printf "add tests" | arcanist sessions create your-org/your-repo --prompt-stdin --wait
|
|
123
|
+
arcanist sessions create your-org/your-repo - --model gpt-5.5
|
|
124
|
+
arcanist sessions create your-org/your-repo "port to claude" --backend claude_code --model claude-opus-4-8
|
|
125
|
+
arcanist sessions create your-org/your-repo "refactor auth" --reasoning-effort xhigh
|
|
126
|
+
arcanist sessions create your-org/your-repo "review the trace" --uploaded-file trace.txt
|
|
127
|
+
arcanist sessions create your-org/your-repo "verify the deployed change" --cold
|
|
128
|
+
arcanist sessions create your-org/your-repo "retry-safe create" --idempotency-key 1f0e6f1a-...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`--backend` picks the agent runtime backend: `codex` (default) or `claude_code`. `--model` must be valid for the chosen backend — codex runs OpenAI models (`gpt-5.5` default, `gpt-5.4`), `claude_code` runs Anthropic models (`claude-opus-4-8` default, `claude-sonnet-4-6`) — and the CLI rejects a mismatch before any network call. `claude_code` sessions require an Anthropic API key configured in Settings.
|
|
132
|
+
|
|
133
|
+
`--wait` blocks until the created prompt finishes and exits non-zero if the prompt finishes with `status: failed`, making it suitable for cron or other schedulers that alert on command failure. `--poll-interval <ms>` tunes the completion check frequency.
|
|
134
|
+
|
|
135
|
+
Repeatable `--uploaded-file <path>` flags attach local UTF-8 text files to the prompt. Uploaded file names come from the local basename; directory components are not sent.
|
|
136
|
+
|
|
137
|
+
`--cold` forces a fresh sandbox and skips the warm pool — useful for verifying freshly deployed code when a pre-warmed sandbox may predate the deploy.
|
|
138
|
+
|
|
139
|
+
`--idempotency-key <uuid>` is for manually retrying a create request that may have reached the server. The CLI derives separate session and prompt idempotency keys from the provided value.
|
|
140
|
+
|
|
141
|
+
JSON mode returns `{sessionId, sessionUrl?, repoUrl, model?, agentRuntimeBackend?, reasoningEffort?, promptId?}`. `sessionUrl` is emitted only when the server returns it; `agentRuntimeBackend` only when `--backend` is passed.
|
|
142
|
+
|
|
143
|
+
### `arcanist sessions send <session-id> [prompt]`
|
|
144
|
+
|
|
145
|
+
Sends a follow-up message to an existing session.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
arcanist sessions send abc123 "also update the tests"
|
|
149
|
+
arcanist sessions send abc123 "use this failure log" --uploaded-file failure.log
|
|
150
|
+
printf "summarize current status" | arcanist sessions send abc123 --prompt-stdin --json
|
|
151
|
+
arcanist sessions send abc123 "retry-safe send" --idempotency-key 1f0e6f1a-...
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
JSON mode returns `{sessionId, promptId?}`.
|
|
155
|
+
|
|
156
|
+
### `arcanist sessions stop <session-id>`
|
|
157
|
+
|
|
158
|
+
Stops the active run for a session. Idempotent: if no sandbox is active, the server returns `already_stopped`.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
arcanist sessions stop abc123
|
|
162
|
+
arcanist sessions stop abc123 --json
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
JSON mode returns `{sessionId, status}` where status is `stopping` or `already_stopped`.
|
|
166
|
+
|
|
167
|
+
### `arcanist sessions get <session-id>`
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
arcanist sessions get abc123
|
|
171
|
+
arcanist sessions get abc123 --json
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### `arcanist sessions list`
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
arcanist sessions list
|
|
178
|
+
arcanist sessions list --status idle --limit 20 --json
|
|
179
|
+
arcanist sessions list --search "architect agent" --repo your-org/your-repo
|
|
180
|
+
arcanist sessions list --scope business --cursor <cursor>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
JSON mode returns `{sessions, nextCursor}`. Search is metadata-only: generated titles and repo metadata.
|
|
184
|
+
|
|
185
|
+
### `arcanist sessions search <query>`
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
arcanist sessions search "architect agent"
|
|
189
|
+
arcanist sessions search "mcp debugging" --repo your-org/your-repo --json
|
|
190
|
+
arcanist sessions search "repo access" --status idle --scope business --limit 20 --cursor <cursor>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Uses the same metadata-only index and filters as `sessions list`: `--status`, `--scope`, `--repo`, `--limit`, and `--cursor`.
|
|
194
|
+
|
|
195
|
+
### `arcanist sessions events <session-id>`
|
|
196
|
+
|
|
197
|
+
Reads canonical session replay events. Cursors are sequence-based.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
arcanist sessions events abc123 --json
|
|
201
|
+
arcanist sessions events abc123 --after-sequence 50 --limit 250 --json
|
|
202
|
+
arcanist sessions events abc123 --before-sequence 100 --poll-interval 500 --json
|
|
203
|
+
arcanist sessions events abc123 --prompt-id p-123 --json
|
|
204
|
+
arcanist sessions events abc123 --follow --json
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`--after` and `--before` are aliases for `--after-sequence` and `--before-sequence`.
|
|
208
|
+
|
|
209
|
+
Follow mode emits NDJSON, one replay event per line, until the session becomes idle.
|
|
210
|
+
|
|
211
|
+
### `arcanist sessions transcript <session-id>`
|
|
212
|
+
|
|
213
|
+
Renders a session transcript from the stored session export.
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
arcanist sessions transcript abc123
|
|
217
|
+
arcanist sessions transcript abc123 --json
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### `arcanist sessions watch <session-id>`
|
|
221
|
+
|
|
222
|
+
Watches session activity until the session becomes idle. For machine-readable streaming, prefer `arcanist sessions events --follow --json`.
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
arcanist sessions watch abc123
|
|
226
|
+
arcanist sessions watch abc123 --poll-interval 500
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### `arcanist sessions usage <session-id>`
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
arcanist sessions usage abc123
|
|
233
|
+
arcanist sessions usage abc123 --json
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `arcanist tokens list`
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
arcanist tokens list
|
|
240
|
+
arcanist tokens list --limit 10 --json
|
|
241
|
+
arcanist tokens list --cursor <cursor> --json
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### `arcanist tokens create`
|
|
245
|
+
|
|
246
|
+
Creates a CLI token and prints the plaintext token exactly once.
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
arcanist tokens create --scope read
|
|
250
|
+
arcanist tokens create --scope read --expires-in-days 30 --json
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Read-scoped tokens cannot create write-scoped tokens; the server enforces that and returns 403.
|
|
254
|
+
|
|
255
|
+
### `arcanist tokens revoke <id>`
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
arcanist tokens revoke 42
|
|
259
|
+
arcanist tokens revoke 42 --yes --json
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Under `--json`, `--yes` is required.
|
|
263
|
+
|
|
264
|
+
## Automation recipes
|
|
265
|
+
|
|
266
|
+
Run a prompt on a schedule and alert only when the prompt itself fails — `sessions create --wait` makes the exit code reflect the prompt outcome:
|
|
267
|
+
|
|
268
|
+
```cron
|
|
269
|
+
*/15 * * * * printf 'summarize new error-tracker regressions' | \
|
|
270
|
+
ARCANIST_TOKEN=arc_... \
|
|
271
|
+
arcanist sessions create your-org/your-repo --prompt-stdin --wait \
|
|
272
|
+
|| notify-send "Arcanist scheduled run failed"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Chain commands with `--json` and `jq`:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
SESSION_ID=$(arcanist sessions create your-org/your-repo "audit dependency licenses" --json | jq -r .sessionId)
|
|
279
|
+
arcanist sessions events "$SESSION_ID" --follow --json | jq -r 'select(.type == "assistant_message")'
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Verify a freshly deployed change with a guaranteed-fresh sandbox:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
arcanist sessions create your-org/your-repo "verify the new rate limiter is active" --cold --wait
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
For cron, prefer `ARCANIST_TOKEN` or a logged-in `~/.arcanist/config.json` over passing `--token` on the command line.
|
|
289
|
+
|
|
290
|
+
## Troubleshooting
|
|
291
|
+
|
|
292
|
+
- **401 on login verification**: token may be invalid or expired. Regenerate in **Settings > CLI Tokens**.
|
|
293
|
+
- **401 on a previously working token**: the token may have expired or been revoked in Settings. Regenerate and log in again.
|
|
294
|
+
- **`You do not have access to this repository on GitHub`**: the token's user lacks repo access; fix the GitHub connection or use an accessible repo.
|
|
295
|
+
- **`command not found`**: run `npm install -g @tryarcanist/cli`.
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryarcanist/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.100",
|
|
4
4
|
"description": "CLI for Arcanist — create and manage coding agent sessions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"arcanist": "dist/index.js"
|
|
8
8
|
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22"
|
|
11
|
+
},
|
|
9
12
|
"files": [
|
|
10
13
|
"dist"
|
|
11
14
|
],
|