patchcord 0.3.58 → 0.3.60

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 +38 -11
  2. package/package.json +1 -1
package/bin/patchcord.mjs CHANGED
@@ -63,11 +63,11 @@ if (cmd === "help" || cmd === "--help" || cmd === "-h") {
63
63
  console.log(`patchcord — agent messaging for AI coding agents
64
64
 
65
65
  Usage:
66
- npx patchcord@latest Full setup (global + project) — run in your project folder
67
- npx patchcord@latest --full Same + full statusline (model, context%, git)
68
- npx patchcord@latest skill apply Fetch custom skill from web console
69
-
70
- That's it. One command does everything.`);
66
+ npx patchcord@latest Setup via browser (patchcord.dev)
67
+ npx patchcord@latest --token <token> Self-hosted / CI setup
68
+ npx patchcord@latest --token <token> --server <url> Self-hosted with custom server
69
+ npx patchcord@latest --full Same + full statusline
70
+ npx patchcord@latest skill apply Fetch custom skill from web console`);
71
71
  process.exit(0);
72
72
  }
73
73
 
@@ -77,7 +77,7 @@ 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") {
80
+ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd === "--no-browser" || cmd === "--server") {
81
81
  const flags = cmd?.startsWith("--") ? process.argv.slice(2) : process.argv.slice(3);
82
82
  const fullStatusline = flags.includes("--full");
83
83
  const { readFileSync, writeFileSync } = await import("fs");
@@ -268,7 +268,20 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
268
268
  let apiUrl = "https://api.patchcord.dev";
269
269
  let clientType = "";
270
270
 
271
- // --token bypass for power users / CI
271
+ // --server flag for self-hosters
272
+ const serverFlag = flags.find(f => f.startsWith("--server="))?.split("=")[1]
273
+ || (flags.includes("--server") ? flags[flags.indexOf("--server") + 1] : "");
274
+ if (serverFlag) {
275
+ if (!isSafeUrl(serverFlag)) {
276
+ console.error("Invalid server URL. Must start with https:// or http://");
277
+ rl.close();
278
+ process.exit(1);
279
+ }
280
+ serverUrl = serverFlag.replace(/\/+$/, "");
281
+ apiUrl = serverUrl;
282
+ }
283
+
284
+ // --token bypass for power users / CI / self-hosters
272
285
  const tokenFlag = flags.find(f => f.startsWith("--token="))?.split("=")[1]
273
286
  || (flags.includes("--token") ? flags[flags.indexOf("--token") + 1] : "");
274
287
 
@@ -439,13 +452,27 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
439
452
 
440
453
  token = sseResult.token;
441
454
  identity = `${sseResult.agent_id}@${sseResult.namespace_id}`;
442
- clientType = sseResult.client_type || "";
455
+ clientType = sseResult.client_type || sseResult.tool || "";
443
456
  choice = CLIENT_TYPE_MAP[clientType] || "";
457
+ console.log(` ${green}✓${r} ${bold}${identity}${r} connected.`);
458
+
444
459
  if (!choice) {
445
- console.error(`Unknown tool type: ${clientType}`);
446
- process.exit(1);
460
+ // Backend didn't send tool type — ask in terminal
461
+ const { createInterface: createRL3 } = await import("readline");
462
+ const rl3 = createRL3({ input: process.stdin, output: process.stdout });
463
+ const ask3 = (q) => new Promise((resolve) => rl3.question(q, resolve));
464
+ console.log(`\n${bold}Which tool are you setting up?${r}\n`);
465
+ console.log(` ${cyan}1.${r} Claude Code ${cyan}5.${r} Gemini CLI`);
466
+ console.log(` ${cyan}2.${r} Codex CLI ${cyan}6.${r} VS Code`);
467
+ console.log(` ${cyan}3.${r} Cursor ${cyan}7.${r} Zed`);
468
+ console.log(` ${cyan}4.${r} Windsurf ${cyan}8.${r} OpenCode\n`);
469
+ choice = (await ask3(`${dim}Choose (1-8):${r} `)).trim();
470
+ rl3.close();
471
+ if (!["1","2","3","4","5","6","7","8"].includes(choice)) {
472
+ console.error("Invalid choice.");
473
+ process.exit(1);
474
+ }
447
475
  }
448
- console.log(` ${green}✓${r} ${bold}${identity}${r} connected.`);
449
476
  }
450
477
  }
451
478
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.58",
3
+ "version": "0.3.60",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",