voicecc 1.1.1 → 1.1.3
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/bin/voicecc.js +35 -1
- package/dashboard/routes/auth.ts +4 -2
- package/package.json +1 -1
package/bin/voicecc.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Spawns the dashboard server
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { spawn } from "node:child_process";
|
|
11
|
+
import { spawn, execSync } from "node:child_process";
|
|
12
12
|
import { copyFileSync, existsSync } from "node:fs";
|
|
13
13
|
import { writeFile, readFile } from "node:fs/promises";
|
|
14
14
|
import { createInterface } from "node:readline";
|
|
@@ -40,6 +40,21 @@ function ask(rl, question) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Check if a command exists on the system PATH.
|
|
45
|
+
*
|
|
46
|
+
* @param cmd - the command name to look up
|
|
47
|
+
* @returns true if the command is found
|
|
48
|
+
*/
|
|
49
|
+
function commandExists(cmd) {
|
|
50
|
+
try {
|
|
51
|
+
execSync(`which ${cmd}`, { stdio: "ignore" });
|
|
52
|
+
return true;
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
43
58
|
/**
|
|
44
59
|
* Generate a cryptographically random password (24 URL-safe characters).
|
|
45
60
|
*
|
|
@@ -104,6 +119,25 @@ async function runSetupWizard() {
|
|
|
104
119
|
await ask(rl, "Have you saved the password? Press Enter to continue. ");
|
|
105
120
|
}
|
|
106
121
|
|
|
122
|
+
// Claude CLI
|
|
123
|
+
if (!commandExists("claude")) {
|
|
124
|
+
console.log("");
|
|
125
|
+
console.log("Claude Code CLI not found. It will be installed globally now.");
|
|
126
|
+
await ask(rl, "Press Enter to continue. ");
|
|
127
|
+
console.log("Installing @anthropic-ai/claude-code globally...");
|
|
128
|
+
try {
|
|
129
|
+
execSync("npm install -g @anthropic-ai/claude-code", { stdio: "inherit" });
|
|
130
|
+
console.log("Claude CLI installed.");
|
|
131
|
+
} catch {
|
|
132
|
+
console.log("");
|
|
133
|
+
console.log("Failed to install Claude CLI. Install it manually:");
|
|
134
|
+
console.log(" npm install -g @anthropic-ai/claude-code");
|
|
135
|
+
console.log("");
|
|
136
|
+
rl.close();
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
107
141
|
rl.close();
|
|
108
142
|
|
|
109
143
|
// Build .env content
|
package/dashboard/routes/auth.ts
CHANGED
|
@@ -110,8 +110,10 @@ export function authRoutes(): Hono {
|
|
|
110
110
|
return c.json({ error: "Token is required" }, 400);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
const cleanToken = token.replace(/[\n\r\s]/g, "");
|
|
114
|
+
|
|
115
|
+
await writeEnvKey("CLAUDE_CODE_OAUTH_TOKEN", cleanToken);
|
|
116
|
+
process.env.CLAUDE_CODE_OAUTH_TOKEN = cleanToken;
|
|
115
117
|
|
|
116
118
|
const authenticated = await probeClaudeAuth();
|
|
117
119
|
return c.json({ authenticated });
|