@tryarcanist/cli 0.1.32 → 0.1.34

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/dist/index.js +191 -73
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -165,7 +165,9 @@ function saveConfig(config) {
165
165
  const urlError = validateApiUrl(config.apiUrl);
166
166
  if (urlError) throw new CliError("user", urlError);
167
167
  mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
168
- writeFileSync(CONFIG_FILE, JSON.stringify({ ...config, apiUrl: normalizeBaseUrl(config.apiUrl) }, null, 2) + "\n", { mode: 384 });
168
+ writeFileSync(CONFIG_FILE, JSON.stringify({ ...config, apiUrl: normalizeBaseUrl(config.apiUrl) }, null, 2) + "\n", {
169
+ mode: 384
170
+ });
169
171
  }
170
172
  function requireConfig(overrides = {}) {
171
173
  const config = loadConfig(overrides);
@@ -228,7 +230,10 @@ async function resolvePromptInput(promptArg, options) {
228
230
  const shouldReadStdin = options.promptStdin === true || promptArg === "-";
229
231
  const prompt = shouldReadStdin ? await readStdin() : promptArg;
230
232
  if (!prompt || prompt.trim().length === 0) {
231
- throw new CliError("user", "Missing prompt. Pass a prompt argument, use '-' to read stdin, or pass --prompt-stdin.");
233
+ throw new CliError(
234
+ "user",
235
+ "Missing prompt. Pass a prompt argument, use '-' to read stdin, or pass --prompt-stdin."
236
+ );
232
237
  }
233
238
  return prompt;
234
239
  }
@@ -986,6 +991,9 @@ var ERROR_CODES = [
986
991
  "stale_prompt",
987
992
  "max_duration_exceeded",
988
993
  "spawn_timeout",
994
+ "spawn_modal_error",
995
+ "spawn_deadline_no_object",
996
+ "spawn_deadline_no_bridge",
989
997
  "spawn_preconnect",
990
998
  "sandbox_terminated",
991
999
  "sandbox_disconnected",
@@ -994,6 +1002,7 @@ var ERROR_CODES = [
994
1002
  "opencode_api_readiness_timeout",
995
1003
  "opencode_session_create_timeout",
996
1004
  "opencode_prompt_dispatch_timeout",
1005
+ "opencode_not_ready",
997
1006
  "opencode_unrecoverable",
998
1007
  "unknown"
999
1008
  ];
@@ -1015,6 +1024,9 @@ var ERROR_CODE_LABELS = {
1015
1024
  stale_prompt: "Prompt became inactive",
1016
1025
  max_duration_exceeded: "Prompt exceeded maximum duration",
1017
1026
  spawn_timeout: "Sandbox spawn timed out",
1027
+ spawn_modal_error: "Sandbox spawn failed (Modal API error)",
1028
+ spawn_deadline_no_object: "Sandbox spawn timed out before Modal responded",
1029
+ spawn_deadline_no_bridge: "Sandbox spawn timed out before bridge connected",
1018
1030
  spawn_preconnect: "Sandbox failed before connecting",
1019
1031
  sandbox_terminated: "Sandbox terminated",
1020
1032
  sandbox_disconnected: "Sandbox disconnected",
@@ -1023,6 +1035,7 @@ var ERROR_CODE_LABELS = {
1023
1035
  opencode_api_readiness_timeout: "OpenCode API readiness timed out",
1024
1036
  opencode_session_create_timeout: "OpenCode session creation timed out",
1025
1037
  opencode_prompt_dispatch_timeout: "OpenCode prompt dispatch timed out",
1038
+ opencode_not_ready: "OpenCode did not become ready",
1026
1039
  opencode_unrecoverable: "OpenCode unrecoverable failure",
1027
1040
  unknown: "Unknown failure"
1028
1041
  };
@@ -1125,7 +1138,9 @@ function renderSessionTranscript(exportData) {
1125
1138
  lines.push(`**Session:** ${exportData.session.id.slice(0, 8)} `);
1126
1139
  lines.push(`**Created:** ${formatDate(exportData.session.createdAt)} `);
1127
1140
  lines.push(`**Status:** ${exportData.session.status} `);
1128
- lines.push(`**Tokens:** ${formatNumber(exportData.tokens.inputTokens)} in / ${formatNumber(exportData.tokens.outputTokens)} out / ${formatNumber(exportData.tokens.totalTokens)} total`);
1141
+ lines.push(
1142
+ `**Tokens:** ${formatNumber(exportData.tokens.inputTokens)} in / ${formatNumber(exportData.tokens.outputTokens)} out / ${formatNumber(exportData.tokens.totalTokens)} total`
1143
+ );
1129
1144
  if (exportData.pr?.url) {
1130
1145
  lines.push(`**PR:** ${exportData.pr.url}${exportData.pr.branch ? ` (${exportData.pr.branch})` : ""}`);
1131
1146
  }
@@ -1258,11 +1273,17 @@ function renderWatchEvent(event, state) {
1258
1273
  return { kind: "text", text: String(data.text ?? "") };
1259
1274
  case "prompt_enqueued": {
1260
1275
  const promptId = typeof data.promptId === "string" ? data.promptId : void 0;
1261
- return { kind: "line", line: `[queued] ${promptId ?? "unknown"}${formatPromptLabel(promptId, state.promptLabels)}` };
1276
+ return {
1277
+ kind: "line",
1278
+ line: `[queued] ${promptId ?? "unknown"}${formatPromptLabel(promptId, state.promptLabels)}`
1279
+ };
1262
1280
  }
1263
1281
  case "prompt_processing": {
1264
1282
  const promptId = typeof data.promptId === "string" ? data.promptId : void 0;
1265
- return { kind: "line", line: `[prompt] ${promptId ?? "unknown"} started${formatPromptLabel(promptId, state.promptLabels)}` };
1283
+ return {
1284
+ kind: "line",
1285
+ line: `[prompt] ${promptId ?? "unknown"} started${formatPromptLabel(promptId, state.promptLabels)}`
1286
+ };
1266
1287
  }
1267
1288
  case "prompt_completed": {
1268
1289
  const promptId = typeof data.promptId === "string" ? data.promptId : void 0;
@@ -1297,7 +1318,10 @@ function renderWatchEvent(event, state) {
1297
1318
  case "branch_changed":
1298
1319
  return { kind: "line", line: `[branch] ${String(data.branch ?? "")}` };
1299
1320
  case "session_error":
1300
- return { kind: "line", line: `[error] ${formatSessionErrorMessage(String(data.error ?? "Unknown error"), typeof data.code === "string" ? data.code : null)}` };
1321
+ return {
1322
+ kind: "line",
1323
+ line: `[error] ${formatSessionErrorMessage(String(data.error ?? "Unknown error"), typeof data.code === "string" ? data.code : null)}`
1324
+ };
1301
1325
  case "pr_created":
1302
1326
  case "pr_updated":
1303
1327
  return { kind: "line", line: `[pr] ${String(data.prUrl ?? "")}` };
@@ -1372,7 +1396,9 @@ async function watchCommand(sessionId, options, command) {
1372
1396
  try {
1373
1397
  promptLabels = await fetchPromptLabels(config, sessionId);
1374
1398
  } catch (err) {
1375
- console.error(`Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`);
1399
+ console.error(
1400
+ `Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
1401
+ );
1376
1402
  }
1377
1403
  }
1378
1404
  const renderState = {
@@ -1479,9 +1505,13 @@ async function waitForCreatedPrompt(sessionId, promptId, sessionUrl, pollInterva
1479
1505
  throw buildPromptFailureError(sessionId, createdPrompt, sessionUrl);
1480
1506
  }
1481
1507
  if (createdPrompt.status !== "completed") {
1482
- throw new CliError("server", `Prompt ${createdPrompt.promptId} did not reach a terminal success state before session ${sessionId} became idle (status: ${createdPrompt.status}).`, {
1483
- hint: `Inspect with: arcanist sessions transcript ${sessionId}`
1484
- });
1508
+ throw new CliError(
1509
+ "server",
1510
+ `Prompt ${createdPrompt.promptId} did not reach a terminal success state before session ${sessionId} became idle (status: ${createdPrompt.status}).`,
1511
+ {
1512
+ hint: `Inspect with: arcanist sessions transcript ${sessionId}`
1513
+ }
1514
+ );
1485
1515
  }
1486
1516
  }
1487
1517
  async function createCommand(repoUrl, promptArg, options, command) {
@@ -1507,18 +1537,26 @@ async function createCommand(repoUrl, promptArg, options, command) {
1507
1537
  const sessionId = sessionData.sessionId;
1508
1538
  let promptId;
1509
1539
  try {
1510
- const promptData = await apiFetch(config, `/api/sessions/${sessionId}/prompts`, {
1511
- method: "POST",
1512
- headers: { "Idempotency-Key": promptIdempotencyKey },
1513
- body: JSON.stringify({ prompt })
1514
- });
1540
+ const promptData = await apiFetch(
1541
+ config,
1542
+ `/api/sessions/${sessionId}/prompts`,
1543
+ {
1544
+ method: "POST",
1545
+ headers: { "Idempotency-Key": promptIdempotencyKey },
1546
+ body: JSON.stringify({ prompt })
1547
+ }
1548
+ );
1515
1549
  promptId = promptData.prompt?.promptId ?? promptData.prompt?.id;
1516
1550
  } catch (err) {
1517
- throw new CliError(err instanceof CliError ? err.code : "server", `Session created (${sessionId}) but prompt failed: ${err instanceof Error ? err.message : String(err)}`, {
1518
- exitCode: err instanceof CliError ? err.exitCode : void 0,
1519
- hint: `Retry with: arcanist sessions send ${sessionId} --prompt-stdin`,
1520
- requestId: err instanceof CliError ? err.requestId : void 0
1521
- });
1551
+ throw new CliError(
1552
+ err instanceof CliError ? err.code : "server",
1553
+ `Session created (${sessionId}) but prompt failed: ${err instanceof Error ? err.message : String(err)}`,
1554
+ {
1555
+ exitCode: err instanceof CliError ? err.exitCode : void 0,
1556
+ hint: `Retry with: arcanist sessions send ${sessionId} --prompt-stdin`,
1557
+ requestId: err instanceof CliError ? err.requestId : void 0
1558
+ }
1559
+ );
1522
1560
  }
1523
1561
  if (options.wait) {
1524
1562
  if (!isJson(command, options)) {
@@ -1591,11 +1629,15 @@ async function messageCommand(sessionId, promptArg, options = {}, command) {
1591
1629
  const runtime = getRuntimeOptions(command, options);
1592
1630
  const config = requireConfig(runtime);
1593
1631
  const prompt = await resolvePromptInput(promptArg, options);
1594
- const response = await apiFetch(config, `/api/sessions/${sessionId}/prompts`, {
1595
- method: "POST",
1596
- headers: { "Idempotency-Key": options.idempotencyKey ?? randomIdempotencyKey() },
1597
- body: JSON.stringify({ prompt })
1598
- });
1632
+ const response = await apiFetch(
1633
+ config,
1634
+ `/api/sessions/${sessionId}/prompts`,
1635
+ {
1636
+ method: "POST",
1637
+ headers: { "Idempotency-Key": options.idempotencyKey ?? randomIdempotencyKey() },
1638
+ body: JSON.stringify({ prompt })
1639
+ }
1640
+ );
1599
1641
  const promptId = response.prompt?.promptId ?? response.prompt?.id;
1600
1642
  if (isJson(command, options)) {
1601
1643
  writeJson({ sessionId, ...promptId ? { promptId } : {} });
@@ -1653,9 +1695,16 @@ async function sessionEventsCommand(sessionId, options, command) {
1653
1695
  throw new CliError("user", "--before-sequence cannot be used with --follow.");
1654
1696
  }
1655
1697
  if (options.promptId) {
1656
- throw new CliError("user", "--prompt-id cannot be used with --follow because the follow endpoint does not support prompt filtering.");
1698
+ throw new CliError(
1699
+ "user",
1700
+ "--prompt-id cannot be used with --follow because the follow endpoint does not support prompt filtering."
1701
+ );
1657
1702
  }
1658
- await watchCommand(sessionId, { ...options, pollInterval: options.pollInterval, afterSequence: options.afterSequence, limit: options.limit }, command);
1703
+ await watchCommand(
1704
+ sessionId,
1705
+ { ...options, pollInterval: options.pollInterval, afterSequence: options.afterSequence, limit: options.limit },
1706
+ command
1707
+ );
1659
1708
  return;
1660
1709
  }
1661
1710
  const runtime = getRuntimeOptions(command, options);
@@ -1674,10 +1723,13 @@ async function sessionEventsCommand(sessionId, options, command) {
1674
1723
  const state = { promptLabels, toolCalls: /* @__PURE__ */ new Map() };
1675
1724
  let textOpen = false;
1676
1725
  for (const event of payload.events) {
1677
- const rendered = renderWatchEvent({
1678
- type: getRawSessionEventKind(event),
1679
- data: getRawSessionEventData(event) ?? {}
1680
- }, state);
1726
+ const rendered = renderWatchEvent(
1727
+ {
1728
+ type: getRawSessionEventKind(event),
1729
+ data: getRawSessionEventData(event) ?? {}
1730
+ },
1731
+ state
1732
+ );
1681
1733
  if (rendered?.kind === "line") {
1682
1734
  if (textOpen) {
1683
1735
  process.stdout.write("\n");
@@ -1719,7 +1771,9 @@ async function stopCommand(sessionId, options = {}, command) {
1719
1771
  writeJson({ sessionId, status });
1720
1772
  return;
1721
1773
  }
1722
- console.log(status === "already_stopped" ? `Session ${sessionId} is already stopped.` : `Stop requested for session ${sessionId}.`);
1774
+ console.log(
1775
+ status === "already_stopped" ? `Session ${sessionId} is already stopped.` : `Stop requested for session ${sessionId}.`
1776
+ );
1723
1777
  }
1724
1778
 
1725
1779
  // src/commands/tokens.ts
@@ -1729,7 +1783,10 @@ async function listTokensCommand(options, command) {
1729
1783
  const query = new URLSearchParams();
1730
1784
  if (options.limit) query.set("limit", options.limit);
1731
1785
  if (options.cursor) query.set("cursor", options.cursor);
1732
- const payload = await apiFetch(config, `/api/cli-tokens${query.size ? `?${query.toString()}` : ""}`);
1786
+ const payload = await apiFetch(
1787
+ config,
1788
+ `/api/cli-tokens${query.size ? `?${query.toString()}` : ""}`
1789
+ );
1733
1790
  if (isJson(command, options)) {
1734
1791
  writeJson(payload);
1735
1792
  return;
@@ -1739,7 +1796,9 @@ async function listTokensCommand(options, command) {
1739
1796
  return;
1740
1797
  }
1741
1798
  for (const token of payload.data) {
1742
- console.log(`${String(token.id)} ${String(token.scope)} ${String(token.tokenPrefix)} ${String(token.revokedAt ? "revoked" : "active")}`);
1799
+ console.log(
1800
+ `${String(token.id)} ${String(token.scope)} ${String(token.tokenPrefix)} ${String(token.revokedAt ? "revoked" : "active")}`
1801
+ );
1743
1802
  }
1744
1803
  if (payload.nextCursor) console.log(`Next cursor: ${payload.nextCursor}`);
1745
1804
  }
@@ -1774,7 +1833,9 @@ async function revokeTokenCommand(tokenId, options, command) {
1774
1833
  }
1775
1834
  const runtime = getRuntimeOptions(command, options);
1776
1835
  const config = requireConfig(runtime);
1777
- const payload = await apiFetch(config, `/api/cli-tokens/${tokenId}/revoke`, { method: "POST" });
1836
+ const payload = await apiFetch(config, `/api/cli-tokens/${tokenId}/revoke`, {
1837
+ method: "POST"
1838
+ });
1778
1839
  if (isJson(command, options)) {
1779
1840
  writeJson(payload);
1780
1841
  return;
@@ -1797,7 +1858,12 @@ async function transcriptCommand(sessionId, options, command) {
1797
1858
  // src/index.ts
1798
1859
  var require3 = createRequire2(import.meta.url);
1799
1860
  var { version: version2 } = require3("../package.json");
1800
- var program = new Command().name("arcanist").description("Arcanist CLI").version(version2).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("--token <token>", "Override API token. Prefer ARCANIST_TOKEN because flags can be visible in shell history and process lists").option("--no-color", "Disable color output").exitOverride().addHelpText("after", `
1861
+ var program = new Command().name("arcanist").description("Arcanist CLI").version(version2).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(
1862
+ "--token <token>",
1863
+ "Override API token. Prefer ARCANIST_TOKEN because flags can be visible in shell history and process lists"
1864
+ ).option("--no-color", "Disable color output").exitOverride().addHelpText(
1865
+ "after",
1866
+ `
1801
1867
  Examples:
1802
1868
  arcanist auth login --token-stdin
1803
1869
  arcanist sessions create https://github.com/org/repo "fix bug" --json | jq -r .sessionId
@@ -1806,7 +1872,8 @@ Examples:
1806
1872
 
1807
1873
  Exit codes:
1808
1874
  0 ok, 1 user/input, 2 auth, 3 not found, 4 conflict, 10 server/network, 130 interrupted
1809
- `);
1875
+ `
1876
+ );
1810
1877
  program.configureOutput({
1811
1878
  writeErr: (str) => process.stderr.write(str)
1812
1879
  });
@@ -1814,95 +1881,146 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
1814
1881
  applyColorEnvironment(getRuntimeOptions(actionCommand));
1815
1882
  });
1816
1883
  function addCreateOptions(cmd) {
1817
- return cmd.argument("<repo-url>", "Repository URL").argument("[prompt]", "Prompt to send, or '-' to read stdin").option("--model <model>", "Model to use").option("--prompt-stdin", "Read prompt from stdin").option("--wait", "Wait for the created prompt to finish and exit non-zero if it fails").option("--poll-interval <ms>", "Polling interval in milliseconds while waiting", String(DEFAULT_WATCH_POLL_INTERVAL_MS)).option("--idempotency-key <uuid>", "Request idempotency key for safe manual retries").addHelpText("after", `
1884
+ return cmd.argument("<repo-url>", "Repository URL").argument("[prompt]", "Prompt to send, or '-' to read stdin").option("--model <model>", "Model to use").option("--prompt-stdin", "Read prompt from stdin").option("--wait", "Wait for the created prompt to finish and exit non-zero if it fails").option(
1885
+ "--poll-interval <ms>",
1886
+ "Polling interval in milliseconds while waiting",
1887
+ String(DEFAULT_WATCH_POLL_INTERVAL_MS)
1888
+ ).option("--idempotency-key <uuid>", "Request idempotency key for safe manual retries").addHelpText(
1889
+ "after",
1890
+ `
1818
1891
  Examples:
1819
1892
  arcanist sessions create https://github.com/org/repo "fix bug"
1820
1893
  printf "fix bug" | arcanist sessions create https://github.com/org/repo --prompt-stdin --json
1821
1894
  printf "fix bug" | arcanist sessions create https://github.com/org/repo --prompt-stdin --wait
1822
1895
  arcanist sessions create https://github.com/org/repo - --json | jq -r .sessionId | xargs -I{} arcanist sessions events {} --follow --json
1823
- `);
1896
+ `
1897
+ );
1824
1898
  }
1825
1899
  function addSendOptions(cmd) {
1826
- return cmd.argument("<session-id>", "Session ID").argument("[prompt]", "Prompt to send, or '-' to read stdin").option("--prompt-stdin", "Read prompt from stdin").option("--idempotency-key <uuid>", "Request idempotency key for safe manual retries").addHelpText("after", `
1900
+ return cmd.argument("<session-id>", "Session ID").argument("[prompt]", "Prompt to send, or '-' to read stdin").option("--prompt-stdin", "Read prompt from stdin").option("--idempotency-key <uuid>", "Request idempotency key for safe manual retries").addHelpText(
1901
+ "after",
1902
+ `
1827
1903
  Examples:
1828
1904
  arcanist sessions send <session-id> "also update tests"
1829
1905
  printf "also update tests" | arcanist sessions send <session-id> --prompt-stdin --json
1830
- `);
1906
+ `
1907
+ );
1831
1908
  }
1832
1909
  var auth = program.command("auth").description("Authentication commands");
1833
- auth.command("login").description("Authenticate with a personal access token").option("--token-stdin", "Read token from stdin instead of interactive prompt").option("--api-url <url>", "Set custom API URL").addHelpText("after", `
1910
+ auth.command("login").description("Authenticate with a personal access token").option("--token-stdin", "Read token from stdin instead of interactive prompt").option("--api-url <url>", "Set custom API URL").addHelpText(
1911
+ "after",
1912
+ `
1834
1913
  Examples:
1835
1914
  arcanist auth login
1836
1915
  printf "arc_..." | arcanist auth login --token-stdin
1837
1916
  ARCANIST_TOKEN=arc_... arcanist auth whoami --json
1838
- `).action((options, command) => loginCommand(options, command));
1839
- auth.command("whoami").description("Print the authenticated user and token scope").addHelpText("after", `
1917
+ `
1918
+ ).action((options, command) => loginCommand(options, command));
1919
+ auth.command("whoami").description("Print the authenticated user and token scope").addHelpText(
1920
+ "after",
1921
+ `
1840
1922
  Examples:
1841
1923
  arcanist auth whoami
1842
1924
  ARCANIST_TOKEN=arc_... arcanist auth whoami --json
1843
- `).action((options, command) => whoamiCommand(options, command));
1925
+ `
1926
+ ).action((options, command) => whoamiCommand(options, command));
1844
1927
  var sessions = program.command("sessions").description("Session commands");
1845
- addCreateOptions(sessions.command("create").description("Create a session and send a prompt")).action((repoUrl, prompt, options, command) => createCommand(repoUrl, prompt, options, command));
1846
- addSendOptions(sessions.command("send").description("Send a message to an existing session")).action((sessionId, prompt, options, command) => messageCommand(sessionId, prompt, options, command));
1847
- sessions.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").addHelpText("after", `
1928
+ addCreateOptions(sessions.command("create").description("Create a session and send a prompt")).action(
1929
+ (repoUrl, prompt, options, command) => createCommand(repoUrl, prompt, options, command)
1930
+ );
1931
+ addSendOptions(sessions.command("send").description("Send a message to an existing session")).action(
1932
+ (sessionId, prompt, options, command) => messageCommand(sessionId, prompt, options, command)
1933
+ );
1934
+ sessions.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").addHelpText(
1935
+ "after",
1936
+ `
1848
1937
  Examples:
1849
1938
  arcanist sessions stop <session-id>
1850
1939
  arcanist sessions stop <session-id> --json
1851
- `).action((sessionId, options, command) => stopCommand(sessionId, options, command));
1852
- sessions.command("get").description("Get session details").argument("<session-id>", "Session ID").addHelpText("after", `
1940
+ `
1941
+ ).action((sessionId, options, command) => stopCommand(sessionId, options, command));
1942
+ sessions.command("get").description("Get session details").argument("<session-id>", "Session ID").addHelpText(
1943
+ "after",
1944
+ `
1853
1945
  Examples:
1854
1946
  arcanist sessions get <session-id>
1855
1947
  arcanist sessions get <session-id> --json
1856
- `).action((sessionId, options, command) => getSessionCommand(sessionId, options, command));
1857
- sessions.command("list").description("List sessions").option("--status <status>", "Filter by session status").option("--scope <scope>", "Session scope: mine or business").option("--limit <n>", "Maximum sessions to return").option("--cursor <cursor>", "Pagination cursor").addHelpText("after", `
1948
+ `
1949
+ ).action((sessionId, options, command) => getSessionCommand(sessionId, options, command));
1950
+ sessions.command("list").description("List sessions").option("--status <status>", "Filter by session status").option("--scope <scope>", "Session scope: mine or business").option("--limit <n>", "Maximum sessions to return").option("--cursor <cursor>", "Pagination cursor").addHelpText(
1951
+ "after",
1952
+ `
1858
1953
  Examples:
1859
1954
  arcanist sessions list
1860
1955
  arcanist sessions list --status idle --json
1861
- `).action((options, command) => listSessionsCommand(options, command));
1862
- 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("--before-sequence <n>", "Return events before this 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("after", `
1956
+ `
1957
+ ).action((options, command) => listSessionsCommand(options, command));
1958
+ 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("--before-sequence <n>", "Return events before this 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(
1959
+ "after",
1960
+ `
1863
1961
  Examples:
1864
1962
  arcanist sessions events <session-id> --json
1865
1963
  arcanist sessions events <session-id> --follow --json
1866
- `).action((sessionId, options, command) => sessionEventsCommand(sessionId, options, command));
1867
- sessions.command("transcript").description("Render a session transcript").argument("<session-id>", "Session ID").addHelpText("after", `
1964
+ `
1965
+ ).action((sessionId, options, command) => sessionEventsCommand(sessionId, options, command));
1966
+ sessions.command("transcript").description("Render a session transcript").argument("<session-id>", "Session ID").addHelpText(
1967
+ "after",
1968
+ `
1868
1969
  Examples:
1869
1970
  arcanist sessions transcript <session-id>
1870
1971
  arcanist sessions transcript <session-id> --json
1871
- `).action((sessionId, options, command) => transcriptCommand(sessionId, options, command));
1872
- sessions.command("watch").description("Watch session activity until it becomes idle").argument("<session-id>", "Session ID").option("--poll-interval <ms>", "Polling interval in milliseconds", String(DEFAULT_WATCH_POLL_INTERVAL_MS)).addHelpText("after", `
1972
+ `
1973
+ ).action((sessionId, options, command) => transcriptCommand(sessionId, options, command));
1974
+ sessions.command("watch").description("Watch session activity until it becomes idle").argument("<session-id>", "Session ID").option("--poll-interval <ms>", "Polling interval in milliseconds", String(DEFAULT_WATCH_POLL_INTERVAL_MS)).addHelpText(
1975
+ "after",
1976
+ `
1873
1977
  Examples:
1874
1978
  arcanist sessions watch <session-id>
1875
1979
  arcanist sessions watch <session-id> --json
1876
- `).action((sessionId, options, command) => watchCommand(sessionId, options, command));
1877
- sessions.command("usage").description("Get token usage for a session").argument("<session-id>", "Session ID").addHelpText("after", `
1980
+ `
1981
+ ).action((sessionId, options, command) => watchCommand(sessionId, options, command));
1982
+ sessions.command("usage").description("Get token usage for a session").argument("<session-id>", "Session ID").addHelpText(
1983
+ "after",
1984
+ `
1878
1985
  Examples:
1879
1986
  arcanist sessions usage <session-id>
1880
1987
  arcanist sessions usage <session-id> --json
1881
- `).action((sessionId, options, command) => usageCommand(sessionId, options, command));
1988
+ `
1989
+ ).action((sessionId, options, command) => usageCommand(sessionId, options, command));
1882
1990
  var tokens = program.command("tokens").description("CLI token commands");
1883
1991
  tokens.command("list").description("List CLI tokens").option("--limit <n>", "Maximum tokens to return").option("--cursor <cursor>", "Pagination cursor").action((options, command) => listTokensCommand(options, command));
1884
- tokens.command("create").description("Create a CLI token and print it once").option("--scope <scope>", "Token scope: read or write", "read").option("--expires-in-days <days>", "Token expiry in days").addHelpText("after", `
1992
+ tokens.command("create").description("Create a CLI token and print it once").option("--scope <scope>", "Token scope: read or write", "read").option("--expires-in-days <days>", "Token expiry in days").addHelpText(
1993
+ "after",
1994
+ `
1885
1995
  Examples:
1886
1996
  arcanist tokens create --scope read
1887
1997
  arcanist tokens create --scope read --json
1888
- `).action((options, command) => createTokenCommand(options, command));
1889
- tokens.command("revoke").description("Revoke a CLI token").argument("<id>", "Token ID").option("--yes", "Confirm revocation without prompting").addHelpText("after", `
1998
+ `
1999
+ ).action((options, command) => createTokenCommand(options, command));
2000
+ tokens.command("revoke").description("Revoke a CLI token").argument("<id>", "Token ID").option("--yes", "Confirm revocation without prompting").addHelpText(
2001
+ "after",
2002
+ `
1890
2003
  Examples:
1891
2004
  arcanist tokens revoke 42
1892
2005
  arcanist tokens revoke 42 --yes --json
1893
- `).action((id, options, command) => revokeTokenCommand(id, options, command));
2006
+ `
2007
+ ).action((id, options, command) => revokeTokenCommand(id, options, command));
1894
2008
  program.command("login").description("Authenticate with a personal access token").option("--token-stdin", "Read token from stdin instead of interactive prompt").option("--api-url <url>", "Set custom API URL").action((options, command) => {
1895
2009
  printDeprecatedAlias("login", "auth login", command);
1896
2010
  return loginCommand(options, command);
1897
2011
  });
1898
- addCreateOptions(program.command("create").description("Create a session and send a prompt")).action((repoUrl, prompt, options, command) => {
1899
- printDeprecatedAlias("create", "sessions create", command);
1900
- return createCommand(repoUrl, prompt, options, command);
1901
- });
1902
- addSendOptions(program.command("message").description("Send a message to an existing session")).action((sessionId, prompt, options, command) => {
1903
- printDeprecatedAlias("message", "sessions send", command);
1904
- return messageCommand(sessionId, prompt, options, command);
1905
- });
2012
+ addCreateOptions(program.command("create").description("Create a session and send a prompt")).action(
2013
+ (repoUrl, prompt, options, command) => {
2014
+ printDeprecatedAlias("create", "sessions create", command);
2015
+ return createCommand(repoUrl, prompt, options, command);
2016
+ }
2017
+ );
2018
+ addSendOptions(program.command("message").description("Send a message to an existing session")).action(
2019
+ (sessionId, prompt, options, command) => {
2020
+ printDeprecatedAlias("message", "sessions send", command);
2021
+ return messageCommand(sessionId, prompt, options, command);
2022
+ }
2023
+ );
1906
2024
  program.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").action((sessionId, options, command) => {
1907
2025
  printDeprecatedAlias("stop", "sessions stop", command);
1908
2026
  return stopCommand(sessionId, options, command);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {