anywhere-ai 0.0.5 → 0.0.7
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/cli.js +15 -39
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -57,50 +57,26 @@ async function ensureClaudeAuth() {
|
|
|
57
57
|
console.error("Then run: claude auth login");
|
|
58
58
|
process.exit(1);
|
|
59
59
|
}
|
|
60
|
-
if (isClaudeAuthed()) {
|
|
61
|
-
console.log("Claude Code authenticated");
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (process.env.CLAUDE_CODE_OAUTH_TOKEN) {
|
|
65
|
-
console.log("Claude Code authenticated (env token)");
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
60
|
const config2 = JSON.parse(readFileSync(CONFIG_PATH, "utf-8"));
|
|
69
|
-
if (config2.claudeOAuthToken) {
|
|
61
|
+
if (config2.claudeOAuthToken && !process.env.CLAUDE_CODE_OAUTH_TOKEN) {
|
|
70
62
|
process.env.CLAUDE_CODE_OAUTH_TOKEN = config2.claudeOAuthToken;
|
|
71
|
-
|
|
63
|
+
}
|
|
64
|
+
if (isClaudeAuthed()) {
|
|
65
|
+
console.log("Claude Code authenticated");
|
|
72
66
|
return;
|
|
73
67
|
}
|
|
74
|
-
console.log("\nClaude Code not authenticated.
|
|
75
|
-
|
|
76
|
-
console.log(
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
console.
|
|
80
|
-
|
|
81
|
-
console.log("Follow the instructions, then paste the token below.\n");
|
|
82
|
-
const token = await ask("Paste your CLAUDE_CODE_OAUTH_TOKEN: ");
|
|
83
|
-
if (!token) {
|
|
84
|
-
console.error("No token provided.");
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
config2.claudeOAuthToken = token;
|
|
88
|
-
await fs.writeFile(CONFIG_PATH, JSON.stringify(config2, null, 2));
|
|
89
|
-
process.env.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
90
|
-
console.log("Token saved to ~/.anywhere/config.json");
|
|
91
|
-
} else {
|
|
92
|
-
const result = spawnSync("claude", ["auth", "login"], {
|
|
93
|
-
stdio: "inherit"
|
|
94
|
-
});
|
|
95
|
-
if (result.status !== 0) {
|
|
96
|
-
console.error("Claude auth login failed");
|
|
97
|
-
process.exit(1);
|
|
98
|
-
}
|
|
99
|
-
if (!isClaudeAuthed()) {
|
|
100
|
-
console.error("Claude Code still not authenticated after login.");
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
68
|
+
console.log("\nClaude Code not authenticated. Running setup-token...\n");
|
|
69
|
+
spawnSync("claude", ["setup-token"], { stdio: "inherit" });
|
|
70
|
+
console.log();
|
|
71
|
+
const token = await ask("Paste the token from above (sk-ant-...): ");
|
|
72
|
+
if (!token || !token.startsWith("sk-ant-")) {
|
|
73
|
+
console.error("Invalid token. Run `claude setup-token` manually and set CLAUDE_CODE_OAUTH_TOKEN.");
|
|
74
|
+
process.exit(1);
|
|
103
75
|
}
|
|
76
|
+
config2.claudeOAuthToken = token;
|
|
77
|
+
await fs.writeFile(CONFIG_PATH, JSON.stringify(config2, null, 2));
|
|
78
|
+
process.env.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
79
|
+
console.log("Claude Code authenticated (token saved)");
|
|
104
80
|
}
|
|
105
81
|
function isGhInstalled() {
|
|
106
82
|
try {
|