patchcord 0.5.11 → 0.5.13

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "patchcord",
3
3
  "description": "Cross-machine agent messaging with push delivery. Messages from other agents arrive as native channel notifications.",
4
- "version": "0.5.11",
4
+ "version": "0.5.13",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/bin/patchcord.mjs CHANGED
@@ -77,7 +77,11 @@ if (cmd === "plugin-path") {
77
77
  }
78
78
 
79
79
  // ── main flow: global setup + project setup (or just install/agent for back-compat) ──
80
- if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd === "--no-browser" || cmd === "--server") {
80
+ // Any --flag enters this branch so equals-form (--token=foo, --tool=foo, --server=foo)
81
+ // works the same as the space-form (--token foo). The internal flag parsing below
82
+ // supports both. Non-flag commands (channel, init, skill, help, plugin-path) have
83
+ // their own branches above and below.
84
+ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
81
85
  const flags = cmd?.startsWith("--") ? process.argv.slice(2) : process.argv.slice(3);
82
86
  const fullStatusline = flags.includes("--full");
83
87
  let wasPluginInstalled = false;
@@ -300,23 +304,45 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
300
304
  apiUrl = serverUrl;
301
305
  }
302
306
 
307
+ // --tool=<slug> — pre-select client type. The dashboard's
308
+ // /console/connect/<platform> tile pages emit `--tool=<slug>` in the
309
+ // displayed npx command so the user picks the agent type ONCE on the
310
+ // web UI; the installer skips its terminal picker, and the
311
+ // `&tool=<slug>` query param appended to the browser connectUrl below
312
+ // makes the web /connect page skip its picker too.
313
+ // Unknown slugs (incl. `replit`, `unknown`) silently fall through —
314
+ // the existing interactive flow takes over.
315
+ const toolFlag = flags.find(f => f.startsWith("--tool="))?.split("=")[1]
316
+ || (flags.includes("--tool") ? flags[flags.indexOf("--tool") + 1] : "");
317
+ let toolSlug = "";
318
+ if (toolFlag) {
319
+ const normalized = toolFlag.replace(/-/g, "_");
320
+ if (CLIENT_TYPE_MAP[normalized]) {
321
+ choice = CLIENT_TYPE_MAP[normalized];
322
+ }
323
+ toolSlug = toolFlag; // preserved as-is for the URL param
324
+ }
325
+
303
326
  // --token bypass for power users / CI / self-hosters
304
327
  const tokenFlag = flags.find(f => f.startsWith("--token="))?.split("=")[1]
305
328
  || (flags.includes("--token") ? flags[flags.indexOf("--token") + 1] : "");
306
329
 
307
330
  if (tokenFlag) {
308
- // --token bypass: need tool picker in terminal
309
- console.log(`\n${bold}Which tool are you setting up?${r}\n`);
310
- console.log(` ${cyan}1.${r} Claude Code ${cyan}5.${r} Gemini CLI`);
311
- console.log(` ${cyan}2.${r} Codex CLI ${cyan}6.${r} VS Code`);
312
- console.log(` ${cyan}3.${r} Cursor ${cyan}7.${r} Zed`);
313
- console.log(` ${cyan}4.${r} Windsurf ${cyan}8.${r} OpenCode`);
314
- console.log(` ${cyan}11.${r} Cline ${cyan}9.${r} OpenClaw\n`);
315
- choice = (await ask(`${dim}Choose (1-9, 11):${r} `)).trim();
316
- if (!["1","2","3","4","5","6","7","8","9","11"].includes(choice)) {
317
- console.error("Invalid choice.");
318
- rl.close();
319
- process.exit(1);
331
+ // --token bypass: need tool picker in terminal — unless --tool=<slug>
332
+ // already pre-selected one for us.
333
+ if (!choice) {
334
+ console.log(`\n${bold}Which tool are you setting up?${r}\n`);
335
+ console.log(` ${cyan}1.${r} Claude Code ${cyan}5.${r} Gemini CLI`);
336
+ console.log(` ${cyan}2.${r} Codex CLI ${cyan}6.${r} VS Code`);
337
+ console.log(` ${cyan}3.${r} Cursor ${cyan}7.${r} Zed`);
338
+ console.log(` ${cyan}4.${r} Windsurf ${cyan}8.${r} OpenCode`);
339
+ console.log(` ${cyan}11.${r} Cline ${cyan}9.${r} OpenClaw\n`);
340
+ choice = (await ask(`${dim}Choose (1-9, 11):${r} `)).trim();
341
+ if (!["1","2","3","4","5","6","7","8","9","11"].includes(choice)) {
342
+ console.error("Invalid choice.");
343
+ rl.close();
344
+ process.exit(1);
345
+ }
320
346
  }
321
347
  token = tokenFlag.trim();
322
348
  if (!isSafeToken(token)) {
@@ -481,8 +507,12 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
481
507
  process.exit(1);
482
508
  }
483
509
  } else {
484
- // Open browser or show URL
485
- const connectUrl = `https://patchcord.dev/connect?session=${sessionId}`;
510
+ // Open browser or show URL.
511
+ // Append &tool=<slug> when --tool was passed so the web /connect
512
+ // page skips its type picker (the user already chose on the
513
+ // dashboard tile).
514
+ const toolParam = toolSlug ? `&tool=${encodeURIComponent(toolSlug)}` : "";
515
+ const connectUrl = `https://patchcord.dev/connect?session=${sessionId}${toolParam}`;
486
516
 
487
517
  if (canOpenBrowser()) {
488
518
  const opened = openBrowser(connectUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",