patchcord 0.3.39 → 0.3.40

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/bin/patchcord.mjs +53 -6
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -206,23 +206,25 @@ if (!cmd || cmd === "install" || cmd === "agent") {
206
206
  console.log(` ${cyan}3.${r} Cursor`);
207
207
  console.log(` ${cyan}4.${r} Windsurf`);
208
208
  console.log(` ${cyan}5.${r} Gemini CLI`);
209
- console.log(` ${cyan}6.${r} VS Code (Copilot)\n`);
209
+ console.log(` ${cyan}6.${r} VS Code (Copilot)`);
210
+ console.log(` ${cyan}7.${r} Zed\n`);
210
211
 
211
- const choice = (await ask(`${dim}Choose (1-6):${r} `)).trim();
212
+ const choice = (await ask(`${dim}Choose (1-7):${r} `)).trim();
212
213
  const isCodex = choice === "2";
213
214
  const isCursor = choice === "3";
214
215
  const isWindsurf = choice === "4";
215
216
  const isGemini = choice === "5";
216
217
  const isVSCode = choice === "6";
218
+ const isZed = choice === "7";
217
219
 
218
- if (!["1", "2", "3", "4", "5", "6"].includes(choice)) {
220
+ if (!["1", "2", "3", "4", "5", "6", "7"].includes(choice)) {
219
221
  console.error("Invalid choice.");
220
222
  rl.close();
221
223
  process.exit(1);
222
224
  }
223
225
 
224
- if (isWindsurf || isGemini) {
225
- const toolLabel = isWindsurf ? "Windsurf" : "Gemini CLI";
226
+ if (isWindsurf || isGemini || isZed) {
227
+ const toolLabel = isZed ? "Zed" : isWindsurf ? "Windsurf" : "Gemini CLI";
226
228
  console.log(`\n ${yellow}Note: ${toolLabel} uses global config — applies to all projects.${r}`);
227
229
  } else {
228
230
  console.log(`\n${dim}Project folder:${r} ${bold}${cwd}${r}`);
@@ -335,6 +337,25 @@ if (!cmd || cmd === "install" || cmd === "agent") {
335
337
  }
336
338
  } catch {}
337
339
  }
340
+ } else if (isZed) {
341
+ const zedPath = process.platform === "darwin"
342
+ ? join(process.env.HOME || "", "Library", "Application Support", "Zed", "settings.json")
343
+ : join(process.env.HOME || "", ".config", "zed", "settings.json");
344
+ if (existsSync(zedPath)) {
345
+ try {
346
+ const existing = JSON.parse(readFileSync(zedPath, "utf-8"));
347
+ if (existing.context_servers?.patchcord) {
348
+ console.log(`\n ${yellow}⚠ Zed already configured${r}`);
349
+ console.log(` ${dim}${zedPath}${r}`);
350
+ const replace = (await ask(` ${dim}Replace? (y/N):${r} `)).trim().toLowerCase();
351
+ if (replace !== "y" && replace !== "yes") {
352
+ console.log("Keeping existing config.");
353
+ rl.close();
354
+ process.exit(0);
355
+ }
356
+ }
357
+ } catch {}
358
+ }
338
359
  } else if (isCodex) {
339
360
  const configPath = join(cwd, ".codex", "config.toml");
340
361
  if (existsSync(configPath)) {
@@ -512,6 +533,32 @@ if (!cmd || cmd === "install" || cmd === "agent") {
512
533
  writeFileSync(geminiPath, JSON.stringify(geminiSettings, null, 2) + "\n");
513
534
  console.log(`\n ${green}✓${r} Gemini CLI configured: ${dim}${geminiPath}${r}`);
514
535
  console.log(` ${yellow}Global config — all Gemini CLI projects share this agent.${r}`);
536
+ } else if (isZed) {
537
+ // Zed: global settings.json → context_servers
538
+ const zedPath = process.platform === "darwin"
539
+ ? join(process.env.HOME || "", "Library", "Application Support", "Zed", "settings.json")
540
+ : join(process.env.HOME || "", ".config", "zed", "settings.json");
541
+ let zedSettings = {};
542
+ if (existsSync(zedPath)) {
543
+ try {
544
+ zedSettings = JSON.parse(readFileSync(zedPath, "utf-8"));
545
+ } catch {}
546
+ }
547
+ if (!zedSettings.context_servers) zedSettings.context_servers = {};
548
+ zedSettings.context_servers.patchcord = {
549
+ url: `${serverUrl}/mcp`,
550
+ headers: {
551
+ Authorization: `Bearer ${token}`,
552
+ "X-Patchcord-Machine": hostname,
553
+ },
554
+ };
555
+ const zedDir = process.platform === "darwin"
556
+ ? join(process.env.HOME || "", "Library", "Application Support", "Zed")
557
+ : join(process.env.HOME || "", ".config", "zed");
558
+ mkdirSync(zedDir, { recursive: true });
559
+ writeFileSync(zedPath, JSON.stringify(zedSettings, null, 2) + "\n");
560
+ console.log(`\n ${green}✓${r} Zed configured: ${dim}${zedPath}${r}`);
561
+ console.log(` ${yellow}Global config — all Zed projects share this agent.${r}`);
515
562
  } else if (isVSCode) {
516
563
  // VS Code: write .vscode/mcp.json (per-project)
517
564
  const vscodeDir = join(cwd, ".vscode");
@@ -607,7 +654,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
607
654
  console.log(`\n ${green}✓${r} Claude Code configured: ${dim}${mcpPath}${r}`);
608
655
  }
609
656
 
610
- const toolName = isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
657
+ const toolName = isZed ? "Zed" : isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
611
658
  console.log(`\n${dim}Restart your ${toolName} session, then run:${r} ${bold}inbox()${r}`);
612
659
  process.exit(0);
613
660
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.39",
3
+ "version": "0.3.40",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",