@tryarcanist/cli 0.1.31 → 0.1.33
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/dist/index.js +185 -73
- 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", {
|
|
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(
|
|
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
|
}
|
|
@@ -994,6 +999,7 @@ var ERROR_CODES = [
|
|
|
994
999
|
"opencode_api_readiness_timeout",
|
|
995
1000
|
"opencode_session_create_timeout",
|
|
996
1001
|
"opencode_prompt_dispatch_timeout",
|
|
1002
|
+
"opencode_not_ready",
|
|
997
1003
|
"opencode_unrecoverable",
|
|
998
1004
|
"unknown"
|
|
999
1005
|
];
|
|
@@ -1023,6 +1029,7 @@ var ERROR_CODE_LABELS = {
|
|
|
1023
1029
|
opencode_api_readiness_timeout: "OpenCode API readiness timed out",
|
|
1024
1030
|
opencode_session_create_timeout: "OpenCode session creation timed out",
|
|
1025
1031
|
opencode_prompt_dispatch_timeout: "OpenCode prompt dispatch timed out",
|
|
1032
|
+
opencode_not_ready: "OpenCode did not become ready",
|
|
1026
1033
|
opencode_unrecoverable: "OpenCode unrecoverable failure",
|
|
1027
1034
|
unknown: "Unknown failure"
|
|
1028
1035
|
};
|
|
@@ -1125,7 +1132,9 @@ function renderSessionTranscript(exportData) {
|
|
|
1125
1132
|
lines.push(`**Session:** ${exportData.session.id.slice(0, 8)} `);
|
|
1126
1133
|
lines.push(`**Created:** ${formatDate(exportData.session.createdAt)} `);
|
|
1127
1134
|
lines.push(`**Status:** ${exportData.session.status} `);
|
|
1128
|
-
lines.push(
|
|
1135
|
+
lines.push(
|
|
1136
|
+
`**Tokens:** ${formatNumber(exportData.tokens.inputTokens)} in / ${formatNumber(exportData.tokens.outputTokens)} out / ${formatNumber(exportData.tokens.totalTokens)} total`
|
|
1137
|
+
);
|
|
1129
1138
|
if (exportData.pr?.url) {
|
|
1130
1139
|
lines.push(`**PR:** ${exportData.pr.url}${exportData.pr.branch ? ` (${exportData.pr.branch})` : ""}`);
|
|
1131
1140
|
}
|
|
@@ -1258,11 +1267,17 @@ function renderWatchEvent(event, state) {
|
|
|
1258
1267
|
return { kind: "text", text: String(data.text ?? "") };
|
|
1259
1268
|
case "prompt_enqueued": {
|
|
1260
1269
|
const promptId = typeof data.promptId === "string" ? data.promptId : void 0;
|
|
1261
|
-
return {
|
|
1270
|
+
return {
|
|
1271
|
+
kind: "line",
|
|
1272
|
+
line: `[queued] ${promptId ?? "unknown"}${formatPromptLabel(promptId, state.promptLabels)}`
|
|
1273
|
+
};
|
|
1262
1274
|
}
|
|
1263
1275
|
case "prompt_processing": {
|
|
1264
1276
|
const promptId = typeof data.promptId === "string" ? data.promptId : void 0;
|
|
1265
|
-
return {
|
|
1277
|
+
return {
|
|
1278
|
+
kind: "line",
|
|
1279
|
+
line: `[prompt] ${promptId ?? "unknown"} started${formatPromptLabel(promptId, state.promptLabels)}`
|
|
1280
|
+
};
|
|
1266
1281
|
}
|
|
1267
1282
|
case "prompt_completed": {
|
|
1268
1283
|
const promptId = typeof data.promptId === "string" ? data.promptId : void 0;
|
|
@@ -1297,7 +1312,10 @@ function renderWatchEvent(event, state) {
|
|
|
1297
1312
|
case "branch_changed":
|
|
1298
1313
|
return { kind: "line", line: `[branch] ${String(data.branch ?? "")}` };
|
|
1299
1314
|
case "session_error":
|
|
1300
|
-
return {
|
|
1315
|
+
return {
|
|
1316
|
+
kind: "line",
|
|
1317
|
+
line: `[error] ${formatSessionErrorMessage(String(data.error ?? "Unknown error"), typeof data.code === "string" ? data.code : null)}`
|
|
1318
|
+
};
|
|
1301
1319
|
case "pr_created":
|
|
1302
1320
|
case "pr_updated":
|
|
1303
1321
|
return { kind: "line", line: `[pr] ${String(data.prUrl ?? "")}` };
|
|
@@ -1372,7 +1390,9 @@ async function watchCommand(sessionId, options, command) {
|
|
|
1372
1390
|
try {
|
|
1373
1391
|
promptLabels = await fetchPromptLabels(config, sessionId);
|
|
1374
1392
|
} catch (err) {
|
|
1375
|
-
console.error(
|
|
1393
|
+
console.error(
|
|
1394
|
+
`Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
1395
|
+
);
|
|
1376
1396
|
}
|
|
1377
1397
|
}
|
|
1378
1398
|
const renderState = {
|
|
@@ -1479,9 +1499,13 @@ async function waitForCreatedPrompt(sessionId, promptId, sessionUrl, pollInterva
|
|
|
1479
1499
|
throw buildPromptFailureError(sessionId, createdPrompt, sessionUrl);
|
|
1480
1500
|
}
|
|
1481
1501
|
if (createdPrompt.status !== "completed") {
|
|
1482
|
-
throw new CliError(
|
|
1483
|
-
|
|
1484
|
-
|
|
1502
|
+
throw new CliError(
|
|
1503
|
+
"server",
|
|
1504
|
+
`Prompt ${createdPrompt.promptId} did not reach a terminal success state before session ${sessionId} became idle (status: ${createdPrompt.status}).`,
|
|
1505
|
+
{
|
|
1506
|
+
hint: `Inspect with: arcanist sessions transcript ${sessionId}`
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1485
1509
|
}
|
|
1486
1510
|
}
|
|
1487
1511
|
async function createCommand(repoUrl, promptArg, options, command) {
|
|
@@ -1507,18 +1531,26 @@ async function createCommand(repoUrl, promptArg, options, command) {
|
|
|
1507
1531
|
const sessionId = sessionData.sessionId;
|
|
1508
1532
|
let promptId;
|
|
1509
1533
|
try {
|
|
1510
|
-
const promptData = await apiFetch(
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1534
|
+
const promptData = await apiFetch(
|
|
1535
|
+
config,
|
|
1536
|
+
`/api/sessions/${sessionId}/prompts`,
|
|
1537
|
+
{
|
|
1538
|
+
method: "POST",
|
|
1539
|
+
headers: { "Idempotency-Key": promptIdempotencyKey },
|
|
1540
|
+
body: JSON.stringify({ prompt })
|
|
1541
|
+
}
|
|
1542
|
+
);
|
|
1515
1543
|
promptId = promptData.prompt?.promptId ?? promptData.prompt?.id;
|
|
1516
1544
|
} catch (err) {
|
|
1517
|
-
throw new CliError(
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1545
|
+
throw new CliError(
|
|
1546
|
+
err instanceof CliError ? err.code : "server",
|
|
1547
|
+
`Session created (${sessionId}) but prompt failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
1548
|
+
{
|
|
1549
|
+
exitCode: err instanceof CliError ? err.exitCode : void 0,
|
|
1550
|
+
hint: `Retry with: arcanist sessions send ${sessionId} --prompt-stdin`,
|
|
1551
|
+
requestId: err instanceof CliError ? err.requestId : void 0
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1522
1554
|
}
|
|
1523
1555
|
if (options.wait) {
|
|
1524
1556
|
if (!isJson(command, options)) {
|
|
@@ -1591,11 +1623,15 @@ async function messageCommand(sessionId, promptArg, options = {}, command) {
|
|
|
1591
1623
|
const runtime = getRuntimeOptions(command, options);
|
|
1592
1624
|
const config = requireConfig(runtime);
|
|
1593
1625
|
const prompt = await resolvePromptInput(promptArg, options);
|
|
1594
|
-
const response = await apiFetch(
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1626
|
+
const response = await apiFetch(
|
|
1627
|
+
config,
|
|
1628
|
+
`/api/sessions/${sessionId}/prompts`,
|
|
1629
|
+
{
|
|
1630
|
+
method: "POST",
|
|
1631
|
+
headers: { "Idempotency-Key": options.idempotencyKey ?? randomIdempotencyKey() },
|
|
1632
|
+
body: JSON.stringify({ prompt })
|
|
1633
|
+
}
|
|
1634
|
+
);
|
|
1599
1635
|
const promptId = response.prompt?.promptId ?? response.prompt?.id;
|
|
1600
1636
|
if (isJson(command, options)) {
|
|
1601
1637
|
writeJson({ sessionId, ...promptId ? { promptId } : {} });
|
|
@@ -1653,9 +1689,16 @@ async function sessionEventsCommand(sessionId, options, command) {
|
|
|
1653
1689
|
throw new CliError("user", "--before-sequence cannot be used with --follow.");
|
|
1654
1690
|
}
|
|
1655
1691
|
if (options.promptId) {
|
|
1656
|
-
throw new CliError(
|
|
1692
|
+
throw new CliError(
|
|
1693
|
+
"user",
|
|
1694
|
+
"--prompt-id cannot be used with --follow because the follow endpoint does not support prompt filtering."
|
|
1695
|
+
);
|
|
1657
1696
|
}
|
|
1658
|
-
await watchCommand(
|
|
1697
|
+
await watchCommand(
|
|
1698
|
+
sessionId,
|
|
1699
|
+
{ ...options, pollInterval: options.pollInterval, afterSequence: options.afterSequence, limit: options.limit },
|
|
1700
|
+
command
|
|
1701
|
+
);
|
|
1659
1702
|
return;
|
|
1660
1703
|
}
|
|
1661
1704
|
const runtime = getRuntimeOptions(command, options);
|
|
@@ -1674,10 +1717,13 @@ async function sessionEventsCommand(sessionId, options, command) {
|
|
|
1674
1717
|
const state = { promptLabels, toolCalls: /* @__PURE__ */ new Map() };
|
|
1675
1718
|
let textOpen = false;
|
|
1676
1719
|
for (const event of payload.events) {
|
|
1677
|
-
const rendered = renderWatchEvent(
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1720
|
+
const rendered = renderWatchEvent(
|
|
1721
|
+
{
|
|
1722
|
+
type: getRawSessionEventKind(event),
|
|
1723
|
+
data: getRawSessionEventData(event) ?? {}
|
|
1724
|
+
},
|
|
1725
|
+
state
|
|
1726
|
+
);
|
|
1681
1727
|
if (rendered?.kind === "line") {
|
|
1682
1728
|
if (textOpen) {
|
|
1683
1729
|
process.stdout.write("\n");
|
|
@@ -1719,7 +1765,9 @@ async function stopCommand(sessionId, options = {}, command) {
|
|
|
1719
1765
|
writeJson({ sessionId, status });
|
|
1720
1766
|
return;
|
|
1721
1767
|
}
|
|
1722
|
-
console.log(
|
|
1768
|
+
console.log(
|
|
1769
|
+
status === "already_stopped" ? `Session ${sessionId} is already stopped.` : `Stop requested for session ${sessionId}.`
|
|
1770
|
+
);
|
|
1723
1771
|
}
|
|
1724
1772
|
|
|
1725
1773
|
// src/commands/tokens.ts
|
|
@@ -1729,7 +1777,10 @@ async function listTokensCommand(options, command) {
|
|
|
1729
1777
|
const query = new URLSearchParams();
|
|
1730
1778
|
if (options.limit) query.set("limit", options.limit);
|
|
1731
1779
|
if (options.cursor) query.set("cursor", options.cursor);
|
|
1732
|
-
const payload = await apiFetch(
|
|
1780
|
+
const payload = await apiFetch(
|
|
1781
|
+
config,
|
|
1782
|
+
`/api/cli-tokens${query.size ? `?${query.toString()}` : ""}`
|
|
1783
|
+
);
|
|
1733
1784
|
if (isJson(command, options)) {
|
|
1734
1785
|
writeJson(payload);
|
|
1735
1786
|
return;
|
|
@@ -1739,7 +1790,9 @@ async function listTokensCommand(options, command) {
|
|
|
1739
1790
|
return;
|
|
1740
1791
|
}
|
|
1741
1792
|
for (const token of payload.data) {
|
|
1742
|
-
console.log(
|
|
1793
|
+
console.log(
|
|
1794
|
+
`${String(token.id)} ${String(token.scope)} ${String(token.tokenPrefix)} ${String(token.revokedAt ? "revoked" : "active")}`
|
|
1795
|
+
);
|
|
1743
1796
|
}
|
|
1744
1797
|
if (payload.nextCursor) console.log(`Next cursor: ${payload.nextCursor}`);
|
|
1745
1798
|
}
|
|
@@ -1774,7 +1827,9 @@ async function revokeTokenCommand(tokenId, options, command) {
|
|
|
1774
1827
|
}
|
|
1775
1828
|
const runtime = getRuntimeOptions(command, options);
|
|
1776
1829
|
const config = requireConfig(runtime);
|
|
1777
|
-
const payload = await apiFetch(config, `/api/cli-tokens/${tokenId}/revoke`, {
|
|
1830
|
+
const payload = await apiFetch(config, `/api/cli-tokens/${tokenId}/revoke`, {
|
|
1831
|
+
method: "POST"
|
|
1832
|
+
});
|
|
1778
1833
|
if (isJson(command, options)) {
|
|
1779
1834
|
writeJson(payload);
|
|
1780
1835
|
return;
|
|
@@ -1797,7 +1852,12 @@ async function transcriptCommand(sessionId, options, command) {
|
|
|
1797
1852
|
// src/index.ts
|
|
1798
1853
|
var require3 = createRequire2(import.meta.url);
|
|
1799
1854
|
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(
|
|
1855
|
+
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(
|
|
1856
|
+
"--token <token>",
|
|
1857
|
+
"Override API token. Prefer ARCANIST_TOKEN because flags can be visible in shell history and process lists"
|
|
1858
|
+
).option("--no-color", "Disable color output").exitOverride().addHelpText(
|
|
1859
|
+
"after",
|
|
1860
|
+
`
|
|
1801
1861
|
Examples:
|
|
1802
1862
|
arcanist auth login --token-stdin
|
|
1803
1863
|
arcanist sessions create https://github.com/org/repo "fix bug" --json | jq -r .sessionId
|
|
@@ -1806,7 +1866,8 @@ Examples:
|
|
|
1806
1866
|
|
|
1807
1867
|
Exit codes:
|
|
1808
1868
|
0 ok, 1 user/input, 2 auth, 3 not found, 4 conflict, 10 server/network, 130 interrupted
|
|
1809
|
-
`
|
|
1869
|
+
`
|
|
1870
|
+
);
|
|
1810
1871
|
program.configureOutput({
|
|
1811
1872
|
writeErr: (str) => process.stderr.write(str)
|
|
1812
1873
|
});
|
|
@@ -1814,95 +1875,146 @@ program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
|
1814
1875
|
applyColorEnvironment(getRuntimeOptions(actionCommand));
|
|
1815
1876
|
});
|
|
1816
1877
|
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(
|
|
1878
|
+
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(
|
|
1879
|
+
"--poll-interval <ms>",
|
|
1880
|
+
"Polling interval in milliseconds while waiting",
|
|
1881
|
+
String(DEFAULT_WATCH_POLL_INTERVAL_MS)
|
|
1882
|
+
).option("--idempotency-key <uuid>", "Request idempotency key for safe manual retries").addHelpText(
|
|
1883
|
+
"after",
|
|
1884
|
+
`
|
|
1818
1885
|
Examples:
|
|
1819
1886
|
arcanist sessions create https://github.com/org/repo "fix bug"
|
|
1820
1887
|
printf "fix bug" | arcanist sessions create https://github.com/org/repo --prompt-stdin --json
|
|
1821
1888
|
printf "fix bug" | arcanist sessions create https://github.com/org/repo --prompt-stdin --wait
|
|
1822
1889
|
arcanist sessions create https://github.com/org/repo - --json | jq -r .sessionId | xargs -I{} arcanist sessions events {} --follow --json
|
|
1823
|
-
`
|
|
1890
|
+
`
|
|
1891
|
+
);
|
|
1824
1892
|
}
|
|
1825
1893
|
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(
|
|
1894
|
+
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(
|
|
1895
|
+
"after",
|
|
1896
|
+
`
|
|
1827
1897
|
Examples:
|
|
1828
1898
|
arcanist sessions send <session-id> "also update tests"
|
|
1829
1899
|
printf "also update tests" | arcanist sessions send <session-id> --prompt-stdin --json
|
|
1830
|
-
`
|
|
1900
|
+
`
|
|
1901
|
+
);
|
|
1831
1902
|
}
|
|
1832
1903
|
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(
|
|
1904
|
+
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(
|
|
1905
|
+
"after",
|
|
1906
|
+
`
|
|
1834
1907
|
Examples:
|
|
1835
1908
|
arcanist auth login
|
|
1836
1909
|
printf "arc_..." | arcanist auth login --token-stdin
|
|
1837
1910
|
ARCANIST_TOKEN=arc_... arcanist auth whoami --json
|
|
1838
|
-
`
|
|
1839
|
-
|
|
1911
|
+
`
|
|
1912
|
+
).action((options, command) => loginCommand(options, command));
|
|
1913
|
+
auth.command("whoami").description("Print the authenticated user and token scope").addHelpText(
|
|
1914
|
+
"after",
|
|
1915
|
+
`
|
|
1840
1916
|
Examples:
|
|
1841
1917
|
arcanist auth whoami
|
|
1842
1918
|
ARCANIST_TOKEN=arc_... arcanist auth whoami --json
|
|
1843
|
-
`
|
|
1919
|
+
`
|
|
1920
|
+
).action((options, command) => whoamiCommand(options, command));
|
|
1844
1921
|
var sessions = program.command("sessions").description("Session commands");
|
|
1845
|
-
addCreateOptions(sessions.command("create").description("Create a session and send a prompt")).action(
|
|
1846
|
-
|
|
1847
|
-
|
|
1922
|
+
addCreateOptions(sessions.command("create").description("Create a session and send a prompt")).action(
|
|
1923
|
+
(repoUrl, prompt, options, command) => createCommand(repoUrl, prompt, options, command)
|
|
1924
|
+
);
|
|
1925
|
+
addSendOptions(sessions.command("send").description("Send a message to an existing session")).action(
|
|
1926
|
+
(sessionId, prompt, options, command) => messageCommand(sessionId, prompt, options, command)
|
|
1927
|
+
);
|
|
1928
|
+
sessions.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").addHelpText(
|
|
1929
|
+
"after",
|
|
1930
|
+
`
|
|
1848
1931
|
Examples:
|
|
1849
1932
|
arcanist sessions stop <session-id>
|
|
1850
1933
|
arcanist sessions stop <session-id> --json
|
|
1851
|
-
`
|
|
1852
|
-
|
|
1934
|
+
`
|
|
1935
|
+
).action((sessionId, options, command) => stopCommand(sessionId, options, command));
|
|
1936
|
+
sessions.command("get").description("Get session details").argument("<session-id>", "Session ID").addHelpText(
|
|
1937
|
+
"after",
|
|
1938
|
+
`
|
|
1853
1939
|
Examples:
|
|
1854
1940
|
arcanist sessions get <session-id>
|
|
1855
1941
|
arcanist sessions get <session-id> --json
|
|
1856
|
-
`
|
|
1857
|
-
|
|
1942
|
+
`
|
|
1943
|
+
).action((sessionId, options, command) => getSessionCommand(sessionId, options, command));
|
|
1944
|
+
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(
|
|
1945
|
+
"after",
|
|
1946
|
+
`
|
|
1858
1947
|
Examples:
|
|
1859
1948
|
arcanist sessions list
|
|
1860
1949
|
arcanist sessions list --status idle --json
|
|
1861
|
-
`
|
|
1862
|
-
|
|
1950
|
+
`
|
|
1951
|
+
).action((options, command) => listSessionsCommand(options, command));
|
|
1952
|
+
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(
|
|
1953
|
+
"after",
|
|
1954
|
+
`
|
|
1863
1955
|
Examples:
|
|
1864
1956
|
arcanist sessions events <session-id> --json
|
|
1865
1957
|
arcanist sessions events <session-id> --follow --json
|
|
1866
|
-
`
|
|
1867
|
-
|
|
1958
|
+
`
|
|
1959
|
+
).action((sessionId, options, command) => sessionEventsCommand(sessionId, options, command));
|
|
1960
|
+
sessions.command("transcript").description("Render a session transcript").argument("<session-id>", "Session ID").addHelpText(
|
|
1961
|
+
"after",
|
|
1962
|
+
`
|
|
1868
1963
|
Examples:
|
|
1869
1964
|
arcanist sessions transcript <session-id>
|
|
1870
1965
|
arcanist sessions transcript <session-id> --json
|
|
1871
|
-
`
|
|
1872
|
-
|
|
1966
|
+
`
|
|
1967
|
+
).action((sessionId, options, command) => transcriptCommand(sessionId, options, command));
|
|
1968
|
+
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(
|
|
1969
|
+
"after",
|
|
1970
|
+
`
|
|
1873
1971
|
Examples:
|
|
1874
1972
|
arcanist sessions watch <session-id>
|
|
1875
1973
|
arcanist sessions watch <session-id> --json
|
|
1876
|
-
`
|
|
1877
|
-
|
|
1974
|
+
`
|
|
1975
|
+
).action((sessionId, options, command) => watchCommand(sessionId, options, command));
|
|
1976
|
+
sessions.command("usage").description("Get token usage for a session").argument("<session-id>", "Session ID").addHelpText(
|
|
1977
|
+
"after",
|
|
1978
|
+
`
|
|
1878
1979
|
Examples:
|
|
1879
1980
|
arcanist sessions usage <session-id>
|
|
1880
1981
|
arcanist sessions usage <session-id> --json
|
|
1881
|
-
`
|
|
1982
|
+
`
|
|
1983
|
+
).action((sessionId, options, command) => usageCommand(sessionId, options, command));
|
|
1882
1984
|
var tokens = program.command("tokens").description("CLI token commands");
|
|
1883
1985
|
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(
|
|
1986
|
+
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(
|
|
1987
|
+
"after",
|
|
1988
|
+
`
|
|
1885
1989
|
Examples:
|
|
1886
1990
|
arcanist tokens create --scope read
|
|
1887
1991
|
arcanist tokens create --scope read --json
|
|
1888
|
-
`
|
|
1889
|
-
|
|
1992
|
+
`
|
|
1993
|
+
).action((options, command) => createTokenCommand(options, command));
|
|
1994
|
+
tokens.command("revoke").description("Revoke a CLI token").argument("<id>", "Token ID").option("--yes", "Confirm revocation without prompting").addHelpText(
|
|
1995
|
+
"after",
|
|
1996
|
+
`
|
|
1890
1997
|
Examples:
|
|
1891
1998
|
arcanist tokens revoke 42
|
|
1892
1999
|
arcanist tokens revoke 42 --yes --json
|
|
1893
|
-
`
|
|
2000
|
+
`
|
|
2001
|
+
).action((id, options, command) => revokeTokenCommand(id, options, command));
|
|
1894
2002
|
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
2003
|
printDeprecatedAlias("login", "auth login", command);
|
|
1896
2004
|
return loginCommand(options, command);
|
|
1897
2005
|
});
|
|
1898
|
-
addCreateOptions(program.command("create").description("Create a session and send a prompt")).action(
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
2006
|
+
addCreateOptions(program.command("create").description("Create a session and send a prompt")).action(
|
|
2007
|
+
(repoUrl, prompt, options, command) => {
|
|
2008
|
+
printDeprecatedAlias("create", "sessions create", command);
|
|
2009
|
+
return createCommand(repoUrl, prompt, options, command);
|
|
2010
|
+
}
|
|
2011
|
+
);
|
|
2012
|
+
addSendOptions(program.command("message").description("Send a message to an existing session")).action(
|
|
2013
|
+
(sessionId, prompt, options, command) => {
|
|
2014
|
+
printDeprecatedAlias("message", "sessions send", command);
|
|
2015
|
+
return messageCommand(sessionId, prompt, options, command);
|
|
2016
|
+
}
|
|
2017
|
+
);
|
|
1906
2018
|
program.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").action((sessionId, options, command) => {
|
|
1907
2019
|
printDeprecatedAlias("stop", "sessions stop", command);
|
|
1908
2020
|
return stopCommand(sessionId, options, command);
|