@vocoder/cli 0.16.1 → 0.16.2
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/bin.mjs +50 -51
- package/dist/bin.mjs.map +1 -1
- package/package.json +3 -3
package/dist/bin.mjs
CHANGED
|
@@ -25,54 +25,6 @@ import * as p12 from "@clack/prompts";
|
|
|
25
25
|
import * as p from "@clack/prompts";
|
|
26
26
|
import chalk from "chalk";
|
|
27
27
|
|
|
28
|
-
// src/utils/browser.ts
|
|
29
|
-
import { spawn } from "child_process";
|
|
30
|
-
async function tryOpenBrowser(url) {
|
|
31
|
-
if (!process.stdout.isTTY || process.env.CI === "true") {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
let command;
|
|
35
|
-
let args;
|
|
36
|
-
if (process.platform === "darwin") {
|
|
37
|
-
command = "open";
|
|
38
|
-
args = [url];
|
|
39
|
-
} else if (process.platform === "win32") {
|
|
40
|
-
command = "rundll32";
|
|
41
|
-
args = ["url.dll,FileProtocolHandler", url];
|
|
42
|
-
} else {
|
|
43
|
-
command = "xdg-open";
|
|
44
|
-
args = [url];
|
|
45
|
-
}
|
|
46
|
-
return new Promise((resolve3) => {
|
|
47
|
-
try {
|
|
48
|
-
const child = spawn(command, args, {
|
|
49
|
-
detached: true,
|
|
50
|
-
stdio: "ignore",
|
|
51
|
-
windowsHide: true
|
|
52
|
-
});
|
|
53
|
-
let settled = false;
|
|
54
|
-
child.once("spawn", () => {
|
|
55
|
-
if (settled) return;
|
|
56
|
-
settled = true;
|
|
57
|
-
child.unref();
|
|
58
|
-
resolve3(true);
|
|
59
|
-
});
|
|
60
|
-
child.once("error", () => {
|
|
61
|
-
if (settled) return;
|
|
62
|
-
settled = true;
|
|
63
|
-
resolve3(false);
|
|
64
|
-
});
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
if (settled) return;
|
|
67
|
-
settled = true;
|
|
68
|
-
resolve3(false);
|
|
69
|
-
}, 300);
|
|
70
|
-
} catch {
|
|
71
|
-
resolve3(false);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
28
|
// src/utils/local-server.ts
|
|
77
29
|
import { createServer } from "http";
|
|
78
30
|
import { URL as URL2 } from "url";
|
|
@@ -137,6 +89,54 @@ function startCallbackServer() {
|
|
|
137
89
|
});
|
|
138
90
|
}
|
|
139
91
|
|
|
92
|
+
// src/utils/browser.ts
|
|
93
|
+
import { spawn } from "child_process";
|
|
94
|
+
async function tryOpenBrowser(url) {
|
|
95
|
+
if (!process.stdout.isTTY || process.env.CI === "true") {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
let command;
|
|
99
|
+
let args;
|
|
100
|
+
if (process.platform === "darwin") {
|
|
101
|
+
command = "open";
|
|
102
|
+
args = [url];
|
|
103
|
+
} else if (process.platform === "win32") {
|
|
104
|
+
command = "rundll32";
|
|
105
|
+
args = ["url.dll,FileProtocolHandler", url];
|
|
106
|
+
} else {
|
|
107
|
+
command = "xdg-open";
|
|
108
|
+
args = [url];
|
|
109
|
+
}
|
|
110
|
+
return new Promise((resolve3) => {
|
|
111
|
+
try {
|
|
112
|
+
const child = spawn(command, args, {
|
|
113
|
+
detached: true,
|
|
114
|
+
stdio: "ignore",
|
|
115
|
+
windowsHide: true
|
|
116
|
+
});
|
|
117
|
+
let settled = false;
|
|
118
|
+
child.once("spawn", () => {
|
|
119
|
+
if (settled) return;
|
|
120
|
+
settled = true;
|
|
121
|
+
child.unref();
|
|
122
|
+
resolve3(true);
|
|
123
|
+
});
|
|
124
|
+
child.once("error", () => {
|
|
125
|
+
if (settled) return;
|
|
126
|
+
settled = true;
|
|
127
|
+
resolve3(false);
|
|
128
|
+
});
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
if (settled) return;
|
|
131
|
+
settled = true;
|
|
132
|
+
resolve3(false);
|
|
133
|
+
}, 300);
|
|
134
|
+
} catch {
|
|
135
|
+
resolve3(false);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
140
|
// src/utils/auth-flow.ts
|
|
141
141
|
async function sleep(ms) {
|
|
142
142
|
await new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
@@ -152,7 +152,6 @@ async function runAuthFlow(api, options, reauth = false, repoCanonical) {
|
|
|
152
152
|
const session = await api.startCliAuthSession(server?.port, repoCanonical);
|
|
153
153
|
const browserUrl = reauth ? session.verificationUrl : session.installUrl ?? session.verificationUrl;
|
|
154
154
|
const expiresAt = new Date(session.expiresAt).getTime();
|
|
155
|
-
p.log.info(browserUrl);
|
|
156
155
|
if (options.ci) {
|
|
157
156
|
process.stdout.write(`VOCODER_AUTH_URL: ${browserUrl}
|
|
158
157
|
`);
|
|
@@ -559,14 +558,14 @@ async function runMcpSetup(apiKey) {
|
|
|
559
558
|
if (tool === "claude") {
|
|
560
559
|
try {
|
|
561
560
|
execSync3(
|
|
562
|
-
`claude mcp add --scope user --transport stdio
|
|
561
|
+
`claude mcp add --scope user --transport stdio -e VOCODER_API_KEY=${apiKey} vocoder -- npx -y @vocoder/mcp`,
|
|
563
562
|
{ stdio: "pipe" }
|
|
564
563
|
);
|
|
565
564
|
p4.log.success("Vocoder MCP server registered in Claude Code.");
|
|
566
565
|
} catch {
|
|
567
566
|
p4.log.message("Run this to register the MCP server:");
|
|
568
567
|
printCommand(
|
|
569
|
-
`claude mcp add --scope user --transport stdio
|
|
568
|
+
`claude mcp add --scope user --transport stdio -e VOCODER_API_KEY=${apiKey} vocoder -- npx -y @vocoder/mcp`
|
|
570
569
|
);
|
|
571
570
|
p4.log.message(info(` Docs: ${MCP_DOCS_URL}`));
|
|
572
571
|
}
|