@tryarcanist/cli 0.1.343 → 0.1.345

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
@@ -128,7 +128,7 @@ arcanist environments prepare --wait --json
128
128
  arcanist environments prepare owner/repo --wait --poll-interval 5000 --json
129
129
  ```
130
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.
131
+ Agents should follow `repository.nextAction` and `repository.command`. Request a Zeus review only when `nextAction` is `review`. When `command` is `null`, do not invent an API call; surface `question` / `secretRequest` to a human. `--wait` waits through internal handoffs until setup is ready or there is a real action for the user or Arcanist.
132
132
 
133
133
  ### `arcanist environments status`
134
134
 
@@ -139,7 +139,7 @@ arcanist environments status owner/repo --json
139
139
  arcanist environments status owner/repo --wait --poll-interval 5000 --json
140
140
  ```
141
141
 
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.
142
+ Agents should follow `repository.nextAction` and `repository.command`. Request a Zeus review only when `nextAction` is `review`. When `command` is `null`, do not invent an API call; surface `question` / `secretRequest` to a human. `--wait` waits through internal handoffs until setup is ready or there is a real action for the user or Arcanist.
143
143
 
144
144
  ### `arcanist environments retry`
145
145
 
@@ -171,7 +171,7 @@ printf "arc_..." | arcanist auth login --token-stdin
171
171
  arcanist auth login --api-url https://api.tryarcanist.com
172
172
  ```
173
173
 
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.
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`, `--token`, or `ARCANIST_TOKEN` persists a token for later use.
175
175
 
176
176
  ### `arcanist auth whoami`
177
177
 
package/dist/index.js CHANGED
@@ -7409,7 +7409,7 @@ function isTerminalPhase(phase, _sessionKind) {
7409
7409
  // package.json
7410
7410
  var package_default = {
7411
7411
  name: "@tryarcanist/cli",
7412
- version: "0.1.343",
7412
+ version: "0.1.345",
7413
7413
  description: "Command-line interface for Arcanist: inspect sessions, prepare Zeus environments, and trigger reviews",
7414
7414
  type: "module",
7415
7415
  bin: {
@@ -23149,11 +23149,33 @@ async function fetchSetupState(config2, fullName) {
23149
23149
  status: "not_started",
23150
23150
  stage: null
23151
23151
  };
23152
- return { ...state, nextAction: nextAction(state) };
23152
+ const action = nextAction(state);
23153
+ return { ...state, nextAction: action, command: commandForNextAction(action, state.fullName) };
23153
23154
  }
23154
23155
  function isActive(state) {
23155
23156
  return state.nextAction === "wait";
23156
23157
  }
23158
+ function commandForNextAction(action, fullName) {
23159
+ switch (action) {
23160
+ case "prepare":
23161
+ return `arcanist environments prepare ${fullName}`;
23162
+ case "wait":
23163
+ return `arcanist environments status ${fullName} --wait`;
23164
+ case "retry":
23165
+ return `arcanist environments retry ${fullName}`;
23166
+ case "review":
23167
+ return null;
23168
+ case "add_credentials":
23169
+ case "answer_question":
23170
+ case "authorize_github":
23171
+ case "wait_for_arcanist":
23172
+ return null;
23173
+ default: {
23174
+ const _exhaustive = action;
23175
+ return _exhaustive;
23176
+ }
23177
+ }
23178
+ }
23157
23179
  function nextAction(state) {
23158
23180
  if (state.status === "not_started") return "prepare";
23159
23181
  if (state.status === "ready") return "review";
@@ -23219,11 +23241,13 @@ async function environmentPrepareCommand(repoArg, options = {}, command) {
23219
23241
  emit(command, options, { repository: state2 }, ({ repository }) => printState(repository));
23220
23242
  return;
23221
23243
  }
23244
+ const action = result.status === "already_ready" ? "review" : "wait";
23222
23245
  const state = {
23223
23246
  fullName: result.fullName,
23224
23247
  status: result.status === "already_ready" ? "ready" : "pending",
23225
23248
  stage: null,
23226
- nextAction: result.status === "already_ready" ? "review" : "wait"
23249
+ nextAction: action,
23250
+ command: commandForNextAction(action, result.fullName)
23227
23251
  };
23228
23252
  emit(command, options, { repository: state }, ({ repository }) => printState(repository));
23229
23253
  }
@@ -23259,11 +23283,12 @@ var DEVICE_AUTH_TOKEN_PATH = "/api/auth/cli/device/token";
23259
23283
  async function loginCommand(options, command) {
23260
23284
  const runtime = getRuntimeOptions(command, options);
23261
23285
  const apiUrl = resolveLoginApiUrl(runtime.apiUrl);
23286
+ const envOrFlag = resolveEnvOrFlagConfig(runtime, false);
23262
23287
  let token = null;
23263
23288
  if (options.tokenStdin) {
23264
23289
  token = await readStdinTrimmed();
23265
- } else if (runtime.token) {
23266
- token = runtime.token;
23290
+ } else if (envOrFlag?.token) {
23291
+ token = envOrFlag.token;
23267
23292
  } else {
23268
23293
  token = await loginWithDeviceAuthorization(apiUrl, runtime);
23269
23294
  }
@@ -23873,6 +23898,19 @@ async function reviewCommand(prUrl, options = {}, command) {
23873
23898
  config2,
23874
23899
  `/api/pr-reviews/status?prUrl=${encodeURIComponent(prUrl)}`
23875
23900
  );
23901
+ if (status.status === "cancelled" || status.status === "admission_rejected") {
23902
+ assertSameAttempt(triggeredSessionId, status.sessionId, "PR review");
23903
+ if (status.status === "cancelled") {
23904
+ throw new CliError(
23905
+ "conflict",
23906
+ status.terminalReason ? `Zeus review was cancelled: ${status.terminalReason}` : "Zeus review was cancelled."
23907
+ );
23908
+ }
23909
+ throw new CliError(
23910
+ "user",
23911
+ status.terminalReason ? `Zeus review was rejected at admission: ${status.terminalReason}` : "Zeus review was rejected at admission."
23912
+ );
23913
+ }
23876
23914
  if (status.status !== "completed") return null;
23877
23915
  assertSameAttempt(triggeredSessionId, status.sessionId, "PR review");
23878
23916
  return {
@@ -27021,7 +27059,13 @@ async function setupCommand(repoArgs = [], options = {}, command) {
27021
27059
  }
27022
27060
  const runtime = getRuntimeOptions(command, options);
27023
27061
  let config2 = loadConfig(runtime);
27024
- if (!config2) config2 = await loginCommand({ ...runtime, emitResult: false }, command);
27062
+ if (!config2) {
27063
+ const envOrFlag = resolveEnvOrFlagConfig(runtime, false);
27064
+ if ((process.stdin.isTTY !== true || process.stdout.isTTY !== true) && !envOrFlag?.token) {
27065
+ throw new CliError("auth", "Not logged in.", { hint: "Run `arcanist auth login` or set `ARCANIST_TOKEN`." });
27066
+ }
27067
+ config2 = await loginCommand({ ...runtime, emitResult: false }, command);
27068
+ }
27025
27069
  const requested = repoArgs.map((value) => {
27026
27070
  const repo = parseRepoArg(value);
27027
27071
  return `${repo.owner}/${repo.repo}`;
@@ -27163,7 +27207,7 @@ function emitSetupAction(runtime, action) {
27163
27207
  `);
27164
27208
  }
27165
27209
  function trackingCommands(repositories) {
27166
- return repositories.map((repository) => `Track later: arcanist environments status ${repository} --wait`);
27210
+ return repositories.map((repository) => `Track later: ${commandForNextAction("wait", repository)}`);
27167
27211
  }
27168
27212
 
27169
27213
  // src/commands/stop.ts
@@ -27461,7 +27505,7 @@ codex.command("use <state>").description("Turn using your saved Codex subscripti
27461
27505
  codex.command("status").description("Show Codex subscription availability and whether auth is saved").action((options, command) => codexStatusCommand(options, command));
27462
27506
  codex.command("logout").description("Deactivate the selector and remove the stored Codex subscription auth for your user").action((options, command) => codexLogoutCommand(options, command));
27463
27507
  var sessions = program.command("sessions").description("Session commands");
27464
- program.command("review <pr-url>").description("Run a Zeus review for a GitHub pull request").option("--focus <text>", "Ignored. Zeus always reviews the full pull request").option("--model <model>", "Pin the reviewer model (Arcanist members only); defaults to the Codex reviewer").option("--sandbox-runtime <runtime>", "Force the sandbox runtime (Arcanist members only): modal, e2b, or sailbox").option("--wait", "Wait for the review and print its verdict and findings").option("--poll-interval <ms>", "Polling interval in milliseconds while waiting (default 10000)").addHelpText(
27508
+ program.command("review <pr-url>").description("Run a Zeus review for a GitHub pull request").option("--focus <text>", "Ignored. Zeus always reviews the full pull request").option("--model <model>", "Pin the reviewer model (Arcanist members only); defaults to the Codex reviewer").option("--sandbox-runtime <runtime>", "Force the sandbox runtime (Arcanist members only): modal, e2b, or sailbox").option("--wait", "Wait until the review is published, cancelled, or admission-rejected").option("--poll-interval <ms>", "Polling interval in milliseconds while waiting (default 10000)").addHelpText(
27465
27509
  "after",
27466
27510
  `
27467
27511
  Examples:
@@ -27469,6 +27513,7 @@ Examples:
27469
27513
  arcanist review https://github.com/org/repo/pull/123 --model gpt-5.5 --wait
27470
27514
  arcanist review https://github.com/org/repo/pull/123 --sandbox-runtime sailbox --wait
27471
27515
 
27516
+ --wait returns when the review is published, cancelled, or admission-rejected. The 30-minute timeout applies only while status is in_flight.
27472
27517
  Zeus reviews with a pinned Codex reviewer model. --model pins a different reviewer model
27473
27518
  instead (members only).
27474
27519
  Zeus review is currently available to Arcanist members only.
@@ -27603,7 +27648,8 @@ environments.command("status").description("Show repository environment setup st
27603
27648
  "after",
27604
27649
  `
27605
27650
  JSON:
27606
- Returns {repository: {fullName, status, stage, nextAction, buildStatus?, failureReason?, secretRequest?, question?}}.
27651
+ Returns {repository: {fullName, status, stage, nextAction, command, buildStatus?, failureReason?, secretRequest?, question?}}.
27652
+ command is the CLI argv to run, or null when the next step is the web UI or Arcanist.
27607
27653
  The stable status values are not_started, pending, running, escalated, succeeded, failed, and ready.
27608
27654
  `
27609
27655
  ).action((repo, options, command) => environmentStatusCommand(repo, options, command));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.343",
3
+ "version": "0.1.345",
4
4
  "description": "Command-line interface for Arcanist: inspect sessions, prepare Zeus environments, and trigger reviews",
5
5
  "type": "module",
6
6
  "bin": {