arisa 2.3.43 → 2.3.44
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/package.json +1 -1
- package/src/daemon/setup.ts +18 -52
package/package.json
CHANGED
package/src/daemon/setup.ts
CHANGED
|
@@ -320,30 +320,12 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
|
|
|
320
320
|
console.log(`Starting ${cli} login...`);
|
|
321
321
|
|
|
322
322
|
try {
|
|
323
|
-
const isClaudeSetupToken = cli === "claude";
|
|
324
|
-
|
|
325
|
-
// For claude setup-token: pipe stdout to capture token while echoing to terminal.
|
|
326
|
-
// For others (codex): inherit stdout for full native rendering.
|
|
327
323
|
const proc = Bun.spawn(buildBunWrappedAgentCliCommand(cli, args, { skipPreload: true }), {
|
|
328
324
|
stdin: "inherit",
|
|
329
|
-
stdout:
|
|
325
|
+
stdout: "inherit",
|
|
330
326
|
stderr: "inherit",
|
|
331
|
-
env: isClaudeSetupToken ? { ...process.env, NO_COLOR: "1" } : undefined,
|
|
332
327
|
});
|
|
333
328
|
|
|
334
|
-
let output = "";
|
|
335
|
-
if (isClaudeSetupToken) {
|
|
336
|
-
const reader = (proc.stdout as ReadableStream<Uint8Array>).getReader();
|
|
337
|
-
const decoder = new TextDecoder();
|
|
338
|
-
while (true) {
|
|
339
|
-
const { done, value } = await reader.read();
|
|
340
|
-
if (done) break;
|
|
341
|
-
const chunk = decoder.decode(value, { stream: true });
|
|
342
|
-
process.stdout.write(chunk);
|
|
343
|
-
output += chunk;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
329
|
const exitCode = await proc.exited;
|
|
348
330
|
|
|
349
331
|
if (exitCode !== 0) {
|
|
@@ -353,40 +335,24 @@ async function runInteractiveLogin(cli: AgentCliName, vars: Record<string, strin
|
|
|
353
335
|
|
|
354
336
|
console.log(` ✓ ${cli} login successful`);
|
|
355
337
|
|
|
356
|
-
// `claude setup-token` prints a
|
|
357
|
-
//
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
.
|
|
363
|
-
.
|
|
364
|
-
|
|
365
|
-
.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
for (const line of lines) {
|
|
373
|
-
const trimmed = line.trim();
|
|
374
|
-
if (trimmed && /^[A-Za-z0-9_-]+$/.test(trimmed)) {
|
|
375
|
-
token += trimmed;
|
|
376
|
-
} else {
|
|
377
|
-
break;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
if (token.startsWith("sk-ant-") && token.length > 80) {
|
|
381
|
-
vars.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
382
|
-
process.env.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
383
|
-
saveEnv(vars);
|
|
384
|
-
console.log(` ✓ token saved to .env (${token.length} chars)`);
|
|
385
|
-
} else {
|
|
386
|
-
console.log(` ⚠ token looks invalid (${token.length} chars) — set CLAUDE_CODE_OAUTH_TOKEN manually in ~/.arisa/.env`);
|
|
387
|
-
}
|
|
338
|
+
// `claude setup-token` prints a token but does NOT store it.
|
|
339
|
+
// Ask the user to paste it.
|
|
340
|
+
if (cli === "claude") {
|
|
341
|
+
console.log("\n Paste the token shown above (starts with sk-ant-):");
|
|
342
|
+
const token = (await readLine(" > ")).trim();
|
|
343
|
+
if (token.startsWith("sk-ant-") && token.length > 80) {
|
|
344
|
+
vars.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
345
|
+
process.env.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
346
|
+
saveEnv(vars);
|
|
347
|
+
console.log(` ✓ token saved to .env (${token.length} chars)`);
|
|
348
|
+
} else if (token) {
|
|
349
|
+
// Save it anyway, user knows best
|
|
350
|
+
vars.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
351
|
+
process.env.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
352
|
+
saveEnv(vars);
|
|
353
|
+
console.log(` ⚠ token saved (${token.length} chars) — verify it works`);
|
|
388
354
|
} else {
|
|
389
|
-
console.log(" ⚠
|
|
355
|
+
console.log(" ⚠ no token — set CLAUDE_CODE_OAUTH_TOKEN in ~/.arisa/.env");
|
|
390
356
|
}
|
|
391
357
|
}
|
|
392
358
|
|