patchcord 0.3.35 → 0.3.36
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 +54 -4
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -205,15 +205,17 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
205
205
|
console.log(` ${cyan}2.${r} Codex CLI`);
|
|
206
206
|
console.log(` ${cyan}3.${r} Cursor`);
|
|
207
207
|
console.log(` ${cyan}4.${r} Windsurf`);
|
|
208
|
-
console.log(` ${cyan}5.${r} Gemini CLI
|
|
208
|
+
console.log(` ${cyan}5.${r} Gemini CLI`);
|
|
209
|
+
console.log(` ${cyan}6.${r} VS Code (Copilot)\n`);
|
|
209
210
|
|
|
210
|
-
const choice = (await ask(`${dim}Choose (1
|
|
211
|
+
const choice = (await ask(`${dim}Choose (1-6):${r} `)).trim();
|
|
211
212
|
const isCodex = choice === "2";
|
|
212
213
|
const isCursor = choice === "3";
|
|
213
214
|
const isWindsurf = choice === "4";
|
|
214
215
|
const isGemini = choice === "5";
|
|
216
|
+
const isVSCode = choice === "6";
|
|
215
217
|
|
|
216
|
-
if (!["1", "2", "3", "4", "5"].includes(choice)) {
|
|
218
|
+
if (!["1", "2", "3", "4", "5", "6"].includes(choice)) {
|
|
217
219
|
console.error("Invalid choice.");
|
|
218
220
|
rl.close();
|
|
219
221
|
process.exit(1);
|
|
@@ -316,6 +318,23 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
316
318
|
}
|
|
317
319
|
} catch {}
|
|
318
320
|
}
|
|
321
|
+
} else if (isVSCode) {
|
|
322
|
+
const vscodePath = join(cwd, ".vscode", "mcp.json");
|
|
323
|
+
if (existsSync(vscodePath)) {
|
|
324
|
+
try {
|
|
325
|
+
const existing = JSON.parse(readFileSync(vscodePath, "utf-8"));
|
|
326
|
+
if (existing.servers?.patchcord) {
|
|
327
|
+
console.log(`\n ${yellow}⚠ VS Code already configured in this project${r}`);
|
|
328
|
+
console.log(` ${dim}${vscodePath}${r}`);
|
|
329
|
+
const replace = (await ask(` ${dim}Replace? (y/N):${r} `)).trim().toLowerCase();
|
|
330
|
+
if (replace !== "y" && replace !== "yes") {
|
|
331
|
+
console.log("Keeping existing config.");
|
|
332
|
+
rl.close();
|
|
333
|
+
process.exit(0);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
} catch {}
|
|
337
|
+
}
|
|
319
338
|
} else if (isCodex) {
|
|
320
339
|
const configPath = join(cwd, ".codex", "config.toml");
|
|
321
340
|
if (existsSync(configPath)) {
|
|
@@ -486,6 +505,37 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
486
505
|
writeFileSync(geminiPath, JSON.stringify(geminiSettings, null, 2) + "\n");
|
|
487
506
|
console.log(`\n ${green}✓${r} Gemini CLI configured: ${dim}${geminiPath}${r}`);
|
|
488
507
|
console.log(` ${yellow}Global config — all Gemini CLI projects share this agent.${r}`);
|
|
508
|
+
} else if (isVSCode) {
|
|
509
|
+
// VS Code: write .vscode/mcp.json (per-project)
|
|
510
|
+
const vscodeDir = join(cwd, ".vscode");
|
|
511
|
+
mkdirSync(vscodeDir, { recursive: true });
|
|
512
|
+
const vscodePath = join(vscodeDir, "mcp.json");
|
|
513
|
+
const vscodeConfig = {
|
|
514
|
+
servers: {
|
|
515
|
+
patchcord: {
|
|
516
|
+
type: "http",
|
|
517
|
+
url: `${serverUrl}/mcp`,
|
|
518
|
+
headers: {
|
|
519
|
+
Authorization: `Bearer ${token}`,
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
if (existsSync(vscodePath)) {
|
|
526
|
+
try {
|
|
527
|
+
const existing = JSON.parse(readFileSync(vscodePath, "utf-8"));
|
|
528
|
+
existing.servers = existing.servers || {};
|
|
529
|
+
existing.servers.patchcord = vscodeConfig.servers.patchcord;
|
|
530
|
+
writeFileSync(vscodePath, JSON.stringify(existing, null, 2) + "\n");
|
|
531
|
+
} catch {
|
|
532
|
+
writeFileSync(vscodePath, JSON.stringify(vscodeConfig, null, 2) + "\n");
|
|
533
|
+
}
|
|
534
|
+
} else {
|
|
535
|
+
writeFileSync(vscodePath, JSON.stringify(vscodeConfig, null, 2) + "\n");
|
|
536
|
+
}
|
|
537
|
+
console.log(`\n ${green}✓${r} VS Code configured: ${dim}${vscodePath}${r}`);
|
|
538
|
+
console.log(` ${dim}Requires GitHub Copilot extension with agent mode enabled.${r}`);
|
|
489
539
|
} else if (isCodex) {
|
|
490
540
|
// Codex: copy skill + write config + install slash commands
|
|
491
541
|
const dest = join(cwd, ".agents", "skills", "patchcord");
|
|
@@ -537,7 +587,7 @@ if (!cmd || cmd === "install" || cmd === "agent") {
|
|
|
537
587
|
console.log(`\n ${green}✓${r} Claude Code configured: ${dim}${mcpPath}${r}`);
|
|
538
588
|
}
|
|
539
589
|
|
|
540
|
-
const toolName = isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
|
|
590
|
+
const toolName = isVSCode ? "VS Code" : isGemini ? "Gemini CLI" : isWindsurf ? "Windsurf" : isCursor ? "Cursor" : isCodex ? "Codex" : "Claude Code";
|
|
541
591
|
console.log(`\n${dim}Restart your ${toolName} session, then run:${r} ${bold}inbox()${r}`);
|
|
542
592
|
process.exit(0);
|
|
543
593
|
}
|