voicecc 1.1.2 → 1.1.4

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 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,21 +119,23 @@ async function runSetupWizard() {
104
119
  await ask(rl, "Have you saved the password? Press Enter to continue. ");
105
120
  }
106
121
 
107
- // Tunnel
108
- console.log("");
109
- console.log("Would you like to enable a public tunnel (via Cloudflare)?");
110
- console.log("This is required if you want to access VoiceCC on a remote");
111
- console.log("server, and/or want to make use of phone calling.");
112
- console.log("");
113
- console.log(" 1) Yes, enable tunnel (recommended)");
114
- console.log(" 2) No, local only");
115
- console.log("");
116
- const tunnelChoice = await ask(rl, "Choose [1/2]: ");
117
- const tunnelEnabled = tunnelChoice !== "2";
118
- if (tunnelEnabled) {
119
- console.log("Tunnel will start automatically on boot.");
120
- } else {
121
- console.log("Tunnel disabled. You can enable it later from Settings.");
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
+ }
122
139
  }
123
140
 
124
141
  rl.close();
@@ -127,7 +144,6 @@ async function runSetupWizard() {
127
144
  const lines = [];
128
145
  if (apiKey) lines.push(`ELEVENLABS_API_KEY=${apiKey}`);
129
146
  if (password) lines.push(`DASHBOARD_PASSWORD=${password}`);
130
- lines.push(`TUNNEL_ENABLED=${tunnelEnabled}`);
131
147
  await writeFile(ENV_PATH, lines.join("\n") + "\n", "utf-8");
132
148
 
133
149
  console.log("All done! Starting VoiceCC...");