@tryarcanist/cli 0.1.342 → 0.1.343

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 (3) hide show
  1. package/README.md +34 -15
  2. package/dist/index.js +70 -49
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -18,7 +18,7 @@ arcanist sessions list --json
18
18
  ```
19
19
 
20
20
  ```bash
21
- export ARCANIST_TOKEN=arc_... # write-scoped for session mutations
21
+ export ARCANIST_TOKEN=arc_... # write-scoped for prepare, review, and stop
22
22
  SESSION_ID=$(arcanist sessions list --json | jq -r '.sessions[0].id')
23
23
  arcanist sessions events "$SESSION_ID" --follow --json
24
24
  ```
@@ -34,7 +34,7 @@ arcanist auth login
34
34
 
35
35
  Token config is stored at `~/.arcanist/config.json`. Existing automation can still provide a token through `ARCANIST_TOKEN` or `--token-stdin`. Multiple active tokens per user are supported; revoke tokens independently when a device or workflow no longer needs access.
36
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.
37
+ Use a read-scoped token for inspection and debugging; use a write-scoped token to prepare or retry environments, trigger a Zeus review, stop a session, or manage tokens.
38
38
 
39
39
  You can also pipe the token via stdin:
40
40
 
@@ -95,14 +95,13 @@ With `--json`, successful command output is machine-readable and newline-termina
95
95
  "error": {
96
96
  "code": "auth",
97
97
  "message": "Not logged in.",
98
- "hint": "Run `arcanist auth login` or set `ARCANIST_TOKEN`.",
99
- "data": { "serverCode": "token_revoked" }
98
+ "hint": "Run `arcanist auth login` or set `ARCANIST_TOKEN`."
100
99
  }
101
100
  }
102
101
  ```
103
102
 
104
103
  `error.data` is omitted when there is no structured recovery data.
105
- Stable fields are `serverCode` for server-provided error codes and `sessionId` when the server started a session before the request failed.
104
+ Stable fields are `serverCode` for server-provided error codes, `repository`, and `environmentsUrl`.
106
105
 
107
106
  Exit codes:
108
107
 
@@ -116,21 +115,40 @@ Exit codes:
116
115
  130 interrupted
117
116
  ```
118
117
 
119
- 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 `tokens create` and `sandbox build`. Both use auto-random keys by default, so only an explicit key makes cross-invocation retries safe.
118
+ `tokens create` and `sandbox build` send an `Idempotency-Key` header. The CLI does not auto-retry those endpoints; retry explicitly with the same `--idempotency-key` when a request may have already reached the server. Both use auto-random keys by default, so only an explicit key makes cross-invocation retries safe.
120
119
 
121
120
  ## Commands
122
121
 
123
- ### `arcanist environments prepare|status`
122
+ ### `arcanist environments prepare`
124
123
 
125
- Prepare the current repository for Zeus, or inspect its machine-readable setup state. Pass `owner/repo` outside a checkout. A write-scoped token is required to prepare; read-scoped tokens can inspect status.
124
+ Prepare the current repository for Zeus. Pass `owner/repo` outside a checkout. A write-scoped token is required.
126
125
 
127
126
  ```bash
128
127
  arcanist environments prepare --wait --json
128
+ arcanist environments prepare owner/repo --wait --poll-interval 5000 --json
129
+ ```
130
+
131
+ Agents should follow `repository.nextAction` and request a Zeus review only when it is `review`. `--wait` waits through internal handoffs until setup is ready or there is a real action for the user or Arcanist.
132
+
133
+ ### `arcanist environments status`
134
+
135
+ Inspect machine-readable setup state. Read-scoped tokens can inspect status. Pass `owner/repo` outside a checkout.
136
+
137
+ ```bash
129
138
  arcanist environments status owner/repo --json
130
- arcanist environments retry owner/repo --wait --json
139
+ arcanist environments status owner/repo --wait --poll-interval 5000 --json
131
140
  ```
132
141
 
133
- Agents should follow `repository.nextAction` and request a Zeus review only when it is `review`. The command waits through internal handoffs until setup is ready or there is a real action for the user or Arcanist.
142
+ Agents should follow `repository.nextAction` and request a Zeus review only when it is `review`. `--wait` waits through internal handoffs until setup is ready or there is a real action for the user or Arcanist.
143
+
144
+ ### `arcanist environments retry`
145
+
146
+ Retry a failed repository environment setup. A write-scoped token is required. Pass `owner/repo` outside a checkout.
147
+
148
+ ```bash
149
+ arcanist environments retry owner/repo --wait --json
150
+ arcanist environments retry owner/repo --wait --poll-interval 5000 --json
151
+ ```
134
152
 
135
153
  ### `arcanist setup`
136
154
 
@@ -140,9 +158,10 @@ Connect Arcanist and prepare one or more repository environments. The command st
140
158
  arcanist setup
141
159
  arcanist setup acme/web
142
160
  arcanist setup acme/web acme/api --json
161
+ arcanist setup acme/web acme/api --workspace
143
162
  ```
144
163
 
145
- With no repository arguments, the command returns the eligible repositories and `selection_required`. Rerun with the repositories to prepare. Builds continue after the command exits. The command prints an `arcanist environments status owner/repo --wait` command for each build so agents can track progress or leave it running.
164
+ With no repository arguments, the command returns the eligible repositories and `selection_required`. Rerun with the repositories to prepare. `--workspace` prepares them as one multi-repository workspace. Builds continue after the command exits. The command prints an `arcanist environments status owner/repo --wait` command for each build so agents can track progress or leave it running.
146
165
 
147
166
  ### `arcanist auth login`
148
167
 
@@ -152,7 +171,7 @@ printf "arc_..." | arcanist auth login --token-stdin
152
171
  arcanist auth login --api-url https://api.tryarcanist.com
153
172
  ```
154
173
 
155
- The default flow prints a browser authorization URL and waits for approval. `--json` writes the action immediately as JSONL on stderr and writes one final result to stdout. `--token-stdin` and `ARCANIST_TOKEN` remain available for automation that already has a token.
174
+ The default flow prints a browser authorization URL and waits for human approval. `--json` writes the action immediately as JSONL on stderr and writes one final result to stdout. `ARCANIST_TOKEN` authenticates later commands through the same config loader as `~/.arcanist/config.json`. `arcanist auth login --token-stdin` or `--token` persists a token for later use.
156
175
 
157
176
  ### `arcanist auth whoami`
158
177
 
@@ -253,11 +272,11 @@ arcanist sessions events abc123 --follow --json
253
272
 
254
273
  JSON mode without `--follow` returns one JSON object from `/events/history`: `{events: [...], ...}`. Canonical events carry `phase`.
255
274
 
256
- Follow mode emits NDJSON, one `{sequence, type, data}` object per line, until the session becomes idle. Actionable follow-mode signals:
275
+ Follow mode emits NDJSON, one `{sequence, type, data}` object per line, until the session reaches a terminal phase: `completed`, `superseded`, `needs_you`, `blocked`, `failed`, `stopped`, or `archived`. JSON follow still suppresses lifecycle `status` frames. Actionable follow-mode signals:
257
276
 
258
277
  - PR opened or updated: `pr_created` / `pr_updated`; URL at `data.prUrl`.
259
278
  - Waiting for human input: `question`; question text at `data.question`.
260
- - Terminal: `prompt_completed`, `prompt_failed`, and `session_idle`. Follow JSON mode suppresses lifecycle `status` frames, so key on these event names rather than `waiting_for_input`.
279
+ - Prompt or idle signals: `prompt_completed`, `prompt_failed`, and `session_idle`. Key on these event names rather than `waiting_for_input`. `session_idle` does not exit the process.
261
280
 
262
281
  ### `arcanist sessions transcript <session-id>`
263
282
 
@@ -371,7 +390,7 @@ Chain commands with `--json` and `jq`:
371
390
 
372
391
  ```bash
373
392
  SESSION_ID=$(arcanist sessions list --json | jq -r '.sessions[0].id')
374
- arcanist sessions events "$SESSION_ID" --follow --json | jq -r 'select(.type == "assistant_message")'
393
+ arcanist sessions events "$SESSION_ID" --follow --json | jq -r 'select(.type == "text")'
375
394
  ```
376
395
 
377
396
  For cron, prefer `ARCANIST_TOKEN` or a logged-in `~/.arcanist/config.json` over passing `--token` on the command line.
package/dist/index.js CHANGED
@@ -7367,11 +7367,50 @@ var require_dist = __commonJS({
7367
7367
  // src/index.ts
7368
7368
  import { Command } from "commander";
7369
7369
 
7370
+ // ../../shared/session/phase.ts
7371
+ var PHASES = [
7372
+ "idle",
7373
+ "running",
7374
+ "review_starting",
7375
+ "waiting_for_input",
7376
+ "finalizing",
7377
+ "review_listening",
7378
+ "completed",
7379
+ "superseded",
7380
+ "needs_you",
7381
+ "blocked",
7382
+ "failed",
7383
+ "stopped",
7384
+ "archived"
7385
+ ];
7386
+ var TERMINAL_PHASES_ARRAY = [
7387
+ "completed",
7388
+ "superseded",
7389
+ "needs_you",
7390
+ "blocked",
7391
+ "failed",
7392
+ "stopped",
7393
+ "archived"
7394
+ ];
7395
+ var TERMINAL_PHASES = new Set(TERMINAL_PHASES_ARRAY);
7396
+ var TERMINAL_FOR_FALLBACK_POLLING_PHASES = new Set(
7397
+ TERMINAL_PHASES_ARRAY.filter((phase) => phase !== "completed")
7398
+ );
7399
+ var CHILD_SLOT_RELEASE_PHASES = new Set(
7400
+ TERMINAL_PHASES_ARRAY.filter((phase) => phase !== "stopped")
7401
+ );
7402
+ var ARCHIVABLE_STALE_TERMINAL_PHASES_ARRAY = TERMINAL_PHASES_ARRAY.filter(
7403
+ (phase) => phase !== "archived" && phase !== "needs_you" && phase !== "blocked" && phase !== "stopped"
7404
+ );
7405
+ function isTerminalPhase(phase, _sessionKind) {
7406
+ return TERMINAL_PHASES.has(phase);
7407
+ }
7408
+
7370
7409
  // package.json
7371
7410
  var package_default = {
7372
7411
  name: "@tryarcanist/cli",
7373
- version: "0.1.342",
7374
- description: "CLI for Arcanist - create and manage coding agent sessions",
7412
+ version: "0.1.343",
7413
+ description: "Command-line interface for Arcanist: inspect sessions, prepare Zeus environments, and trigger reviews",
7375
7414
  type: "module",
7376
7415
  bin: {
7377
7416
  arcanist: "dist/index.js"
@@ -23070,45 +23109,6 @@ function assertSameAttempt(triggeredSessionId, settledSessionId, label) {
23070
23109
  }
23071
23110
  }
23072
23111
 
23073
- // ../../shared/session/phase.ts
23074
- var PHASES = [
23075
- "idle",
23076
- "running",
23077
- "review_starting",
23078
- "waiting_for_input",
23079
- "finalizing",
23080
- "review_listening",
23081
- "completed",
23082
- "superseded",
23083
- "needs_you",
23084
- "blocked",
23085
- "failed",
23086
- "stopped",
23087
- "archived"
23088
- ];
23089
- var TERMINAL_PHASES_ARRAY = [
23090
- "completed",
23091
- "superseded",
23092
- "needs_you",
23093
- "blocked",
23094
- "failed",
23095
- "stopped",
23096
- "archived"
23097
- ];
23098
- var TERMINAL_PHASES = new Set(TERMINAL_PHASES_ARRAY);
23099
- var TERMINAL_FOR_FALLBACK_POLLING_PHASES = new Set(
23100
- TERMINAL_PHASES_ARRAY.filter((phase) => phase !== "completed")
23101
- );
23102
- var CHILD_SLOT_RELEASE_PHASES = new Set(
23103
- TERMINAL_PHASES_ARRAY.filter((phase) => phase !== "stopped")
23104
- );
23105
- var ARCHIVABLE_STALE_TERMINAL_PHASES_ARRAY = TERMINAL_PHASES_ARRAY.filter(
23106
- (phase) => phase !== "archived" && phase !== "needs_you" && phase !== "blocked" && phase !== "stopped"
23107
- );
23108
- function isTerminalPhase(phase, _sessionKind) {
23109
- return TERMINAL_PHASES.has(phase);
23110
- }
23111
-
23112
23112
  // src/constants/watch.ts
23113
23113
  var MIN_WATCH_POLL_INTERVAL_MS = 250;
23114
23114
  var DEFAULT_WATCH_POLL_INTERVAL_MS = 1e3;
@@ -27391,7 +27391,7 @@ var { version: version3 } = package_default;
27391
27391
  var program = new Command().name("arcanist").description("Arcanist CLI").version(version3).option("--json", "Output machine-readable JSON").option("--quiet", "Suppress non-essential stderr output").option("--api-url <url>", "Override API URL. Prefer ARCANIST_API_URL for persistent use").option(
27392
27392
  "--token <token>",
27393
27393
  "Override API token. Prefer ARCANIST_TOKEN because flags can be visible in shell history and process lists"
27394
- ).option("--no-color", "Disable color output").exitOverride().addHelpText(
27394
+ ).option("--no-color", "Disable color output").configureHelp({ showGlobalOptions: true }).addHelpCommand(false).exitOverride().addHelpText(
27395
27395
  "after",
27396
27396
  `
27397
27397
  Examples:
@@ -27410,7 +27410,7 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
27410
27410
  applyColorEnvironment(getRuntimeOptions(actionCommand));
27411
27411
  });
27412
27412
  var auth = program.command("auth").description("Authentication commands");
27413
- auth.command("login").description("Authenticate through your browser").option("--token-stdin", "Read token from stdin instead of interactive prompt").option("--api-url <url>", "Set custom API URL").addHelpText(
27413
+ auth.command("login").description("Authenticate through your browser").option("--token-stdin", "Read token from stdin instead of interactive prompt").addHelpText(
27414
27414
  "after",
27415
27415
  `
27416
27416
  Examples:
@@ -27520,7 +27520,7 @@ JSON:
27520
27520
  JSON mode returns {sessions, nextCursor}. --all follows cursors until nextCursor is null.
27521
27521
  `
27522
27522
  ).action((options, command) => listSessionsCommand(options, command));
27523
- sessions.command("events").description("Read or follow session replay events").argument("<session-id>", "Session ID").option("--after-sequence <n>", "Return events after this sequence").option("--after <n>", "Alias for --after-sequence").option("--before-sequence <n>", "Return events before this sequence").option("--before <n>", "Alias for --before-sequence").option("--prompt-id <id>", "Filter events by prompt ID").option("--limit <n>", "Maximum events to return").option("--follow", "Follow events until the session is idle").option("--poll-interval <ms>", "Polling interval in milliseconds", String(DEFAULT_WATCH_POLL_INTERVAL_MS)).addHelpText(
27523
+ sessions.command("events").description("Read or follow session replay events").argument("<session-id>", "Session ID").option("--after-sequence <n>", "Return events after this sequence").option("--after <n>", "Alias for --after-sequence").option("--before-sequence <n>", "Return events before this sequence").option("--before <n>", "Alias for --before-sequence").option("--prompt-id <id>", "Filter events by prompt ID").option("--limit <n>", "Maximum events to return").option("--follow", "Follow events until a terminal phase").option("--poll-interval <ms>", "Polling interval in milliseconds", String(DEFAULT_WATCH_POLL_INTERVAL_MS)).addHelpText(
27524
27524
  "after",
27525
27525
  `
27526
27526
  Examples:
@@ -27531,8 +27531,8 @@ Examples:
27531
27531
 
27532
27532
  JSON:
27533
27533
  JSON mode without --follow returns one JSON object from /events/history: {events: [...], ...}; canonical events carry phase.
27534
- --follow --json emits NDJSON, one {sequence, type, data} object per line.
27535
- Actionable follow types: pr_created/pr_updated use data.prUrl; question uses data.question; terminal types are prompt_completed, prompt_failed, and session_idle.
27534
+ --follow --json emits NDJSON, one {sequence, type, data} object per line, until a terminal phase: ${formatTerminalPhaseHelpList(TERMINAL_PHASES_ARRAY)}.
27535
+ Actionable follow types are NDJSON signals, not process-exit conditions: pr_created/pr_updated use data.prUrl; question uses data.question; prompt_completed, prompt_failed, and session_idle do not exit the process.
27536
27536
  `
27537
27537
  ).action((sessionId, options, command) => sessionEventsCommand(sessionId, options, command));
27538
27538
  sessions.command("transcript").description("Render a session transcript").argument("<session-id>", "Session ID").option("--last <n>", "Render only the last n transcript entries").addHelpText(
@@ -27685,6 +27685,9 @@ Examples:
27685
27685
  `
27686
27686
  ).action((repo, name, options, command) => setTestCredentialCommand(repo, name, options, command));
27687
27687
  testCreds.command("delete").description("Delete a test credential").argument("<repo>", "Repository in 'owner/name' form").argument("<name>", "Credential name").requiredOption("--business <id>", "Business ID that owns the repo").option("--yes", "Confirm deletion without prompting").action((repo, name, options, command) => deleteTestCredentialCommand(repo, name, options, command));
27688
+ program.command("help").description("display help for command").argument("[path...]", "Command path to explain").action((path) => {
27689
+ commandForHelpPath(program, path).help({ error: false });
27690
+ });
27688
27691
  async function main() {
27689
27692
  try {
27690
27693
  await program.parseAsync(process.argv);
@@ -27708,9 +27711,27 @@ async function main() {
27708
27711
  }
27709
27712
  }
27710
27713
  function isCommanderHelpOrVersion(err) {
27711
- if (!err || typeof err !== "object") return false;
27712
- const code = err.code;
27713
- return code === "commander.helpDisplayed" || code === "commander.version";
27714
+ if (!err || typeof err !== "object" || !("code" in err)) return false;
27715
+ const { code } = err;
27716
+ if (code === "commander.helpDisplayed" || code === "commander.version") return true;
27717
+ return code === "commander.help" && "exitCode" in err && err.exitCode === 0;
27718
+ }
27719
+ function formatTerminalPhaseHelpList(phases) {
27720
+ const last = phases.at(-1);
27721
+ if (last === void 0) return "";
27722
+ if (phases.length === 1) return last;
27723
+ return `${phases.slice(0, -1).join(", ")}, or ${last}`;
27724
+ }
27725
+ function commandForHelpPath(root, path) {
27726
+ let current = root;
27727
+ for (const name of path) {
27728
+ const next = current.commands.find((candidate) => candidate.name() === name || candidate.aliases().includes(name));
27729
+ if (!next) {
27730
+ throw new CliError("user", `Unknown help topic: ${path.join(" ")}`);
27731
+ }
27732
+ current = next;
27733
+ }
27734
+ return current;
27714
27735
  }
27715
27736
  function restoreTerminal() {
27716
27737
  if (process.stdin.isTTY) process.stdin.setRawMode(false);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.342",
4
- "description": "CLI for Arcanist - create and manage coding agent sessions",
3
+ "version": "0.1.343",
4
+ "description": "Command-line interface for Arcanist: inspect sessions, prepare Zeus environments, and trigger reviews",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "arcanist": "dist/index.js"