patchcord 0.3.40 → 0.3.41

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 +26 -23
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -4,6 +4,9 @@ import { existsSync, mkdirSync, cpSync } from "fs";
4
4
  import { join, dirname } from "path";
5
5
  import { fileURLToPath } from "url";
6
6
  import { execSync } from "child_process";
7
+ import { homedir } from "os";
8
+
9
+ const HOME = homedir();
7
10
 
8
11
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
12
  const pluginRoot = join(__dirname, "..");
@@ -71,7 +74,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
71
74
  globalChanges.push("Claude Code plugin installed");
72
75
  }
73
76
 
74
- const claudeSettings = join(process.env.HOME || "", ".claude", "settings.json");
77
+ const claudeSettings = join(HOME, ".claude", "settings.json");
75
78
  if (existsSync(claudeSettings)) {
76
79
  try {
77
80
  const settings = JSON.parse(readFileSync(claudeSettings, "utf-8"));
@@ -109,7 +112,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
109
112
  }
110
113
 
111
114
  // Cursor
112
- const cursorSkillsRoot = join(process.env.HOME || "", ".cursor", "skills-cursor");
115
+ const cursorSkillsRoot = join(HOME, ".cursor", "skills-cursor");
113
116
  if (existsSync(cursorSkillsRoot)) {
114
117
  const cursorSkillDir = join(cursorSkillsRoot, "patchcord");
115
118
  const cursorWaitDir = join(cursorSkillsRoot, "patchcord-wait");
@@ -128,9 +131,9 @@ if (!cmd || cmd === "install" || cmd === "agent") {
128
131
  }
129
132
 
130
133
  // Windsurf
131
- if (existsSync(join(process.env.HOME || "", ".codeium", "windsurf"))) {
132
- const windsurfSkillDir = join(process.env.HOME || "", ".codeium", "windsurf", "skills", "patchcord");
133
- const windsurfWaitDir = join(process.env.HOME || "", ".codeium", "windsurf", "skills", "patchcord-wait");
134
+ if (existsSync(join(HOME, ".codeium", "windsurf"))) {
135
+ const windsurfSkillDir = join(HOME, ".codeium", "windsurf", "skills", "patchcord");
136
+ const windsurfWaitDir = join(HOME, ".codeium", "windsurf", "skills", "patchcord-wait");
134
137
  let windsurfChanged = false;
135
138
  if (!existsSync(windsurfSkillDir)) {
136
139
  mkdirSync(windsurfSkillDir, { recursive: true });
@@ -146,10 +149,10 @@ if (!cmd || cmd === "install" || cmd === "agent") {
146
149
  }
147
150
 
148
151
  // Gemini CLI
149
- if (existsSync(join(process.env.HOME || "", ".gemini"))) {
150
- const geminiSkillDir = join(process.env.HOME || "", ".gemini", "skills", "patchcord");
151
- const geminiWaitDir = join(process.env.HOME || "", ".gemini", "skills", "patchcord-wait");
152
- const geminiCmdDir = join(process.env.HOME || "", ".gemini", "commands");
152
+ if (existsSync(join(HOME, ".gemini"))) {
153
+ const geminiSkillDir = join(HOME, ".gemini", "skills", "patchcord");
154
+ const geminiWaitDir = join(HOME, ".gemini", "skills", "patchcord-wait");
155
+ const geminiCmdDir = join(HOME, ".gemini", "commands");
153
156
  let geminiChanged = false;
154
157
  if (!existsSync(geminiSkillDir)) {
155
158
  mkdirSync(geminiSkillDir, { recursive: true });
@@ -171,7 +174,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
171
174
  }
172
175
 
173
176
  // Codex CLI
174
- const codexConfig = join(process.env.HOME || "", ".codex", "config.toml");
177
+ const codexConfig = join(HOME, ".codex", "config.toml");
175
178
  if (existsSync(codexConfig)) {
176
179
  const content = readFileSync(codexConfig, "utf-8");
177
180
  if (!content.includes("[apps.patchcord]")) {
@@ -273,7 +276,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
273
276
  } catch {}
274
277
  }
275
278
  // Warn about global config conflict
276
- const globalCursor = join(process.env.HOME || "", ".cursor", "mcp.json");
279
+ const globalCursor = join(HOME, ".cursor", "mcp.json");
277
280
  if (existsSync(globalCursor)) {
278
281
  try {
279
282
  const global = JSON.parse(readFileSync(globalCursor, "utf-8"));
@@ -286,7 +289,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
286
289
  } catch {}
287
290
  }
288
291
  } else if (isWindsurf) {
289
- const wsPath = join(process.env.HOME || "", ".codeium", "windsurf", "mcp_config.json");
292
+ const wsPath = join(HOME, ".codeium", "windsurf", "mcp_config.json");
290
293
  if (existsSync(wsPath)) {
291
294
  try {
292
295
  const content = readFileSync(wsPath, "utf-8").trim();
@@ -304,7 +307,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
304
307
  } catch {}
305
308
  }
306
309
  } else if (isGemini) {
307
- const geminiPath = join(process.env.HOME || "", ".gemini", "settings.json");
310
+ const geminiPath = join(HOME, ".gemini", "settings.json");
308
311
  if (existsSync(geminiPath)) {
309
312
  try {
310
313
  const existing = JSON.parse(readFileSync(geminiPath, "utf-8"));
@@ -339,8 +342,8 @@ if (!cmd || cmd === "install" || cmd === "agent") {
339
342
  }
340
343
  } else if (isZed) {
341
344
  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");
345
+ ? join(HOME, "Library", "Application Support", "Zed", "settings.json")
346
+ : join(HOME, ".config", "zed", "settings.json");
344
347
  if (existsSync(zedPath)) {
345
348
  try {
346
349
  const existing = JSON.parse(readFileSync(zedPath, "utf-8"));
@@ -468,7 +471,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
468
471
  console.log(` ${dim}Per-project only — other projects won't see this agent.${r}`);
469
472
  } else if (isWindsurf) {
470
473
  // Windsurf: global only (~/.codeium/windsurf/mcp_config.json)
471
- const wsPath = join(process.env.HOME || "", ".codeium", "windsurf", "mcp_config.json");
474
+ const wsPath = join(HOME, ".codeium", "windsurf", "mcp_config.json");
472
475
  const wsConfig = {
473
476
  mcpServers: {
474
477
  patchcord: {
@@ -496,7 +499,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
496
499
  writeFileSync(wsPath, JSON.stringify(wsConfig, null, 2) + "\n");
497
500
  }
498
501
  } else {
499
- mkdirSync(join(process.env.HOME || "", ".codeium", "windsurf"), { recursive: true });
502
+ mkdirSync(join(HOME, ".codeium", "windsurf"), { recursive: true });
500
503
  writeFileSync(wsPath, JSON.stringify(wsConfig, null, 2) + "\n");
501
504
  }
502
505
  // Install workflows as slash commands (.windsurf/workflows/) — per-project
@@ -509,7 +512,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
509
512
  console.log(` ${yellow}MCP config is global — all Windsurf projects share this agent.${r}`);
510
513
  } else if (isGemini) {
511
514
  // Gemini CLI: global only (~/.gemini/settings.json)
512
- const geminiPath = join(process.env.HOME || "", ".gemini", "settings.json");
515
+ const geminiPath = join(HOME, ".gemini", "settings.json");
513
516
  let geminiSettings = {};
514
517
  if (existsSync(geminiPath)) {
515
518
  try {
@@ -529,15 +532,15 @@ if (!cmd || cmd === "install" || cmd === "agent") {
529
532
  geminiSettings.tools.allowed = geminiSettings.tools.allowed.filter(t => !t.startsWith("mcp_patchcord_"));
530
533
  if (geminiSettings.tools.allowed.length === 0) delete geminiSettings.tools;
531
534
  }
532
- mkdirSync(join(process.env.HOME || "", ".gemini"), { recursive: true });
535
+ mkdirSync(join(HOME, ".gemini"), { recursive: true });
533
536
  writeFileSync(geminiPath, JSON.stringify(geminiSettings, null, 2) + "\n");
534
537
  console.log(`\n ${green}✓${r} Gemini CLI configured: ${dim}${geminiPath}${r}`);
535
538
  console.log(` ${yellow}Global config — all Gemini CLI projects share this agent.${r}`);
536
539
  } else if (isZed) {
537
540
  // Zed: global settings.json → context_servers
538
541
  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");
542
+ ? join(HOME, "Library", "Application Support", "Zed", "settings.json")
543
+ : join(HOME, ".config", "zed", "settings.json");
541
544
  let zedSettings = {};
542
545
  if (existsSync(zedPath)) {
543
546
  try {
@@ -553,8 +556,8 @@ if (!cmd || cmd === "install" || cmd === "agent") {
553
556
  },
554
557
  };
555
558
  const zedDir = process.platform === "darwin"
556
- ? join(process.env.HOME || "", "Library", "Application Support", "Zed")
557
- : join(process.env.HOME || "", ".config", "zed");
559
+ ? join(HOME, "Library", "Application Support", "Zed")
560
+ : join(HOME, ".config", "zed");
558
561
  mkdirSync(zedDir, { recursive: true });
559
562
  writeFileSync(zedPath, JSON.stringify(zedSettings, null, 2) + "\n");
560
563
  console.log(`\n ${green}✓${r} Zed configured: ${dim}${zedPath}${r}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.40",
3
+ "version": "0.3.41",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",