@matthesketh/utopia-cli 0.7.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +25 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -134,7 +134,9 @@ async function mcpServe() {
134
134
  const content = await server.ssrLoadModule("@matthesketh/utopia-content");
135
135
  const names = content.listCollections();
136
136
  if (names.length === 0) {
137
- process.stderr.write("No collections defined. Add defineCollection() calls to your config.\n");
137
+ process.stderr.write(
138
+ "No collections defined. Add defineCollection() calls to your config.\n"
139
+ );
138
140
  process.exit(1);
139
141
  }
140
142
  const contentMcp = await server.ssrLoadModule("@matthesketh/utopia-content/mcp");
@@ -216,15 +218,32 @@ async function mcpServe() {
216
218
  }
217
219
  }
218
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
+ }
219
237
  function mcpInstall() {
220
- try {
221
- execSync("claude --version", { stdio: "ignore" });
222
- } catch {
223
- console.error("Claude Code CLI not found. Install it first: npm i -g @anthropic-ai/claude-code");
238
+ const claude = findClaude();
239
+ if (!claude) {
240
+ console.error(
241
+ "Claude Code CLI not found. Install it first: npm i -g @anthropic-ai/claude-code"
242
+ );
224
243
  process.exit(1);
225
244
  }
226
245
  try {
227
- execSync("claude mcp add utopia-content -s project -- npx utopia mcp serve", {
246
+ execSync(`${claude} mcp add utopia-content -s project -- npx utopia mcp serve`, {
228
247
  stdio: "inherit",
229
248
  cwd: process.cwd()
230
249
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matthesketh/utopia-cli",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "CLI for the UtopiaJS framework",
5
5
  "type": "module",
6
6
  "license": "MIT",