patchcord 0.5.11 → 0.5.12
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/.claude-plugin/plugin.json +1 -1
- package/bin/patchcord.mjs +40 -14
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -300,23 +300,45 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
300
300
|
apiUrl = serverUrl;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
// --tool=<slug> — pre-select client type. The dashboard's
|
|
304
|
+
// /console/connect/<platform> tile pages emit `--tool=<slug>` in the
|
|
305
|
+
// displayed npx command so the user picks the agent type ONCE on the
|
|
306
|
+
// web UI; the installer skips its terminal picker, and the
|
|
307
|
+
// `&tool=<slug>` query param appended to the browser connectUrl below
|
|
308
|
+
// makes the web /connect page skip its picker too.
|
|
309
|
+
// Unknown slugs (incl. `replit`, `unknown`) silently fall through —
|
|
310
|
+
// the existing interactive flow takes over.
|
|
311
|
+
const toolFlag = flags.find(f => f.startsWith("--tool="))?.split("=")[1]
|
|
312
|
+
|| (flags.includes("--tool") ? flags[flags.indexOf("--tool") + 1] : "");
|
|
313
|
+
let toolSlug = "";
|
|
314
|
+
if (toolFlag) {
|
|
315
|
+
const normalized = toolFlag.replace(/-/g, "_");
|
|
316
|
+
if (CLIENT_TYPE_MAP[normalized]) {
|
|
317
|
+
choice = CLIENT_TYPE_MAP[normalized];
|
|
318
|
+
}
|
|
319
|
+
toolSlug = toolFlag; // preserved as-is for the URL param
|
|
320
|
+
}
|
|
321
|
+
|
|
303
322
|
// --token bypass for power users / CI / self-hosters
|
|
304
323
|
const tokenFlag = flags.find(f => f.startsWith("--token="))?.split("=")[1]
|
|
305
324
|
|| (flags.includes("--token") ? flags[flags.indexOf("--token") + 1] : "");
|
|
306
325
|
|
|
307
326
|
if (tokenFlag) {
|
|
308
|
-
// --token bypass: need tool picker in terminal
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
327
|
+
// --token bypass: need tool picker in terminal — unless --tool=<slug>
|
|
328
|
+
// already pre-selected one for us.
|
|
329
|
+
if (!choice) {
|
|
330
|
+
console.log(`\n${bold}Which tool are you setting up?${r}\n`);
|
|
331
|
+
console.log(` ${cyan}1.${r} Claude Code ${cyan}5.${r} Gemini CLI`);
|
|
332
|
+
console.log(` ${cyan}2.${r} Codex CLI ${cyan}6.${r} VS Code`);
|
|
333
|
+
console.log(` ${cyan}3.${r} Cursor ${cyan}7.${r} Zed`);
|
|
334
|
+
console.log(` ${cyan}4.${r} Windsurf ${cyan}8.${r} OpenCode`);
|
|
335
|
+
console.log(` ${cyan}11.${r} Cline ${cyan}9.${r} OpenClaw\n`);
|
|
336
|
+
choice = (await ask(`${dim}Choose (1-9, 11):${r} `)).trim();
|
|
337
|
+
if (!["1","2","3","4","5","6","7","8","9","11"].includes(choice)) {
|
|
338
|
+
console.error("Invalid choice.");
|
|
339
|
+
rl.close();
|
|
340
|
+
process.exit(1);
|
|
341
|
+
}
|
|
320
342
|
}
|
|
321
343
|
token = tokenFlag.trim();
|
|
322
344
|
if (!isSafeToken(token)) {
|
|
@@ -481,8 +503,12 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
481
503
|
process.exit(1);
|
|
482
504
|
}
|
|
483
505
|
} else {
|
|
484
|
-
// Open browser or show URL
|
|
485
|
-
|
|
506
|
+
// Open browser or show URL.
|
|
507
|
+
// Append &tool=<slug> when --tool was passed so the web /connect
|
|
508
|
+
// page skips its type picker (the user already chose on the
|
|
509
|
+
// dashboard tile).
|
|
510
|
+
const toolParam = toolSlug ? `&tool=${encodeURIComponent(toolSlug)}` : "";
|
|
511
|
+
const connectUrl = `https://patchcord.dev/connect?session=${sessionId}${toolParam}`;
|
|
486
512
|
|
|
487
513
|
if (canOpenBrowser()) {
|
|
488
514
|
const opened = openBrowser(connectUrl);
|