@matthesketh/utopia-cli 0.7.2 → 0.7.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/dist/index.js +19 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -218,17 +218,32 @@ async function mcpServe() {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
+
function findClaude() {
|
|
222
|
+
const candidates = [
|
|
223
|
+
"claude",
|
|
224
|
+
resolve(process.env.HOME ?? "~", ".local/bin/claude"),
|
|
225
|
+
resolve(process.env.HOME ?? "~", ".npm-global/bin/claude"),
|
|
226
|
+
"/usr/local/bin/claude"
|
|
227
|
+
];
|
|
228
|
+
for (const bin of candidates) {
|
|
229
|
+
try {
|
|
230
|
+
execSync(`${bin} --version`, { stdio: "ignore" });
|
|
231
|
+
return bin;
|
|
232
|
+
} catch {
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
221
237
|
function mcpInstall() {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
} catch {
|
|
238
|
+
const claude = findClaude();
|
|
239
|
+
if (!claude) {
|
|
225
240
|
console.error(
|
|
226
241
|
"Claude Code CLI not found. Install it first: npm i -g @anthropic-ai/claude-code"
|
|
227
242
|
);
|
|
228
243
|
process.exit(1);
|
|
229
244
|
}
|
|
230
245
|
try {
|
|
231
|
-
execSync(
|
|
246
|
+
execSync(`${claude} mcp add utopia-content -s project -- npx utopia mcp serve`, {
|
|
232
247
|
stdio: "inherit",
|
|
233
248
|
cwd: process.cwd()
|
|
234
249
|
});
|