patchcord 0.3.41 → 0.3.42
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/bin/patchcord.mjs +43 -4
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -210,17 +210,19 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
210
210
|
console.log(` ${cyan}4.${r} Windsurf`);
|
|
211
211
|
console.log(` ${cyan}5.${r} Gemini CLI`);
|
|
212
212
|
console.log(` ${cyan}6.${r} VS Code (Copilot)`);
|
|
213
|
-
console.log(` ${cyan}7.${r} Zed
|
|
213
|
+
console.log(` ${cyan}7.${r} Zed`);
|
|
214
|
+
console.log(` ${cyan}8.${r} OpenCode\n`);
|
|
214
215
|
|
|
215
|
-
const choice = (await ask(`${dim}Choose (1-
|
|
216
|
+
const choice = (await ask(`${dim}Choose (1-8):${r} `)).trim();
|
|
216
217
|
const isCodex = choice === "2";
|
|
217
218
|
const isCursor = choice === "3";
|
|
218
219
|
const isWindsurf = choice === "4";
|
|
219
220
|
const isGemini = choice === "5";
|
|
220
221
|
const isVSCode = choice === "6";
|
|
221
222
|
const isZed = choice === "7";
|
|
223
|
+
const isOpenCode = choice === "8";
|
|
222
224
|
|
|
223
|
-
if (!["1", "2", "3", "4", "5", "6", "7"].includes(choice)) {
|
|
225
|
+
if (!["1", "2", "3", "4", "5", "6", "7", "8"].includes(choice)) {
|
|
224
226
|
console.error("Invalid choice.");
|
|
225
227
|
rl.close();
|
|
226
228
|
process.exit(1);
|
|
@@ -359,6 +361,23 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
359
361
|
}
|
|
360
362
|
} catch {}
|
|
361
363
|
}
|
|
364
|
+
} else if (isOpenCode) {
|
|
365
|
+
const ocPath = join(cwd, "opencode.json");
|
|
366
|
+
if (existsSync(ocPath)) {
|
|
367
|
+
try {
|
|
368
|
+
const existing = JSON.parse(readFileSync(ocPath, "utf-8"));
|
|
369
|
+
if (existing.mcp?.patchcord) {
|
|
370
|
+
console.log(`\n ${yellow}⚠ OpenCode already configured in this project${r}`);
|
|
371
|
+
console.log(` ${dim}${ocPath}${r}`);
|
|
372
|
+
const replace = (await ask(` ${dim}Replace? (y/N):${r} `)).trim().toLowerCase();
|
|
373
|
+
if (replace !== "y" && replace !== "yes") {
|
|
374
|
+
console.log("Keeping existing config.");
|
|
375
|
+
rl.close();
|
|
376
|
+
process.exit(0);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
} catch {}
|
|
380
|
+
}
|
|
362
381
|
} else if (isCodex) {
|
|
363
382
|
const configPath = join(cwd, ".codex", "config.toml");
|
|
364
383
|
if (existsSync(configPath)) {
|
|
@@ -562,6 +581,26 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
562
581
|
writeFileSync(zedPath, JSON.stringify(zedSettings, null, 2) + "\n");
|
|
563
582
|
console.log(`\n ${green}✓${r} Zed configured: ${dim}${zedPath}${r}`);
|
|
564
583
|
console.log(` ${yellow}Global config — all Zed projects share this agent.${r}`);
|
|
584
|
+
} else if (isOpenCode) {
|
|
585
|
+
// OpenCode: per-project opencode.json → mcp
|
|
586
|
+
const ocPath = join(cwd, "opencode.json");
|
|
587
|
+
let ocConfig = {};
|
|
588
|
+
if (existsSync(ocPath)) {
|
|
589
|
+
try {
|
|
590
|
+
ocConfig = JSON.parse(readFileSync(ocPath, "utf-8"));
|
|
591
|
+
} catch {}
|
|
592
|
+
}
|
|
593
|
+
if (!ocConfig.mcp) ocConfig.mcp = {};
|
|
594
|
+
ocConfig.mcp.patchcord = {
|
|
595
|
+
type: "remote",
|
|
596
|
+
url: `${serverUrl}/mcp`,
|
|
597
|
+
headers: {
|
|
598
|
+
Authorization: `Bearer ${token}`,
|
|
599
|
+
"X-Patchcord-Machine": hostname,
|
|
600
|
+
},
|
|
601
|
+
};
|
|
602
|
+
writeFileSync(ocPath, JSON.stringify(ocConfig, null, 2) + "\n");
|
|
603
|
+
console.log(`\n ${green}✓${r} OpenCode configured: ${dim}${ocPath}${r}`);
|
|
565
604
|
} else if (isVSCode) {
|
|
566
605
|
// VS Code: write .vscode/mcp.json (per-project)
|
|
567
606
|
const vscodeDir = join(cwd, ".vscode");
|
|
@@ -657,7 +696,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
657
696
|
console.log(`\n ${green}✓${r} Claude Code configured: ${dim}${mcpPath}${r}`);
|
|
658
697
|
}
|
|
659
698
|
|
|
660
|
-
const toolName = isZed ? "Zed" : isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
|
|
699
|
+
const toolName = isOpenCode ? "OpenCode" : isZed ? "Zed" : isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
|
|
661
700
|
console.log(`\n${dim}Restart your ${toolName} session, then run:${r} ${bold}inbox()${r}`);
|
|
662
701
|
process.exit(0);
|
|
663
702
|
}
|