patchcord 0.3.13 → 0.3.15

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 auto-inbox checking. Agents automatically respond to messages from other agents without human intervention.",
4
- "version": "0.3.13",
4
+ "version": "0.3.15",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/bin/patchcord.mjs CHANGED
@@ -41,7 +41,13 @@ if (cmd === "install") {
41
41
  const fullStatusline = flags.includes("--full");
42
42
  const { readFileSync, writeFileSync } = await import("fs");
43
43
 
44
- console.log("Patchcord — setting up agent messaging\n");
44
+ console.log(`
45
+ ___ ____ ___ ____ _ _ ____ ____ ____ ___
46
+ |__] |__| | | |__| | | | |__/ | \\
47
+ | | | | |___ | | |___ |__| | \\ |__/
48
+
49
+ Messenger for AI agents.
50
+ `);
45
51
 
46
52
  let installedSomething = false;
47
53
 
@@ -135,7 +141,7 @@ Then run: npx patchcord@latest install`);
135
141
  process.exit(0);
136
142
  }
137
143
 
138
- // ── agent: per-project MCP setup (interactive, auto-detects tool) ──
144
+ // ── agent: per-project interactive setup ──────────────────────
139
145
  if (cmd === "agent") {
140
146
  const cwd = process.cwd();
141
147
  const { readFileSync, writeFileSync } = await import("fs");
@@ -144,20 +150,63 @@ if (cmd === "agent") {
144
150
  const rl = createInterface({ input: process.stdin, output: process.stdout });
145
151
  const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
146
152
 
147
- // Ask for server URL with default
148
- const serverUrl = (await ask("Server URL [https://mcp.patchcord.dev]: ")).trim() || "https://mcp.patchcord.dev";
153
+ console.log(`\nWhich tool are you setting up?\n`);
154
+ console.log(` 1. Claude Code`);
155
+ console.log(` 2. Codex CLI\n`);
149
156
 
150
- // Ask for token
151
- const token = (await ask("Paste your agent token: ")).trim();
152
- rl.close();
157
+ const choice = (await ask("Choose (1/2): ")).trim();
158
+ const isCodex = choice === "2";
159
+
160
+ if (choice !== "1" && choice !== "2") {
161
+ console.error("Invalid choice.");
162
+ rl.close();
163
+ process.exit(1);
164
+ }
165
+
166
+ const token = (await ask("\nPaste your agent token: ")).trim();
153
167
 
154
168
  if (!token) {
155
169
  console.error("Token is required. Get one from your patchcord dashboard.");
170
+ rl.close();
156
171
  process.exit(1);
157
172
  }
158
173
 
159
- // Auto-detect: Codex project has .agents folder or .codex folder
160
- const isCodex = existsSync(join(cwd, ".agents")) || existsSync(join(cwd, ".codex"));
174
+ // Validate token
175
+ let serverUrl = "https://mcp.patchcord.dev";
176
+ console.log("\nValidating token...");
177
+ const validateResp = run(`curl -sf --max-time 5 -H "Authorization: Bearer ${token}" "${serverUrl}/api/inbox?limit=0"`);
178
+ let identity = "";
179
+ if (validateResp) {
180
+ try {
181
+ const data = JSON.parse(validateResp);
182
+ identity = `${data.agent_id}@${data.namespace_id}`;
183
+ console.log(` ✓ ${identity}`);
184
+ } catch {}
185
+ }
186
+ if (!identity) {
187
+ console.log(" ✗ Could not validate token against mcp.patchcord.dev");
188
+ }
189
+
190
+ const customUrl = (await ask("\nCustom server URL? (y/N): ")).trim().toLowerCase();
191
+ if (customUrl === "y" || customUrl === "yes") {
192
+ const url = (await ask("Server URL: ")).trim();
193
+ if (url) serverUrl = url;
194
+
195
+ // Re-validate against custom server if identity wasn't found
196
+ if (!identity) {
197
+ console.log("Validating token...");
198
+ const resp2 = run(`curl -sf --max-time 5 -H "Authorization: Bearer ${token}" "${serverUrl}/api/inbox?limit=0"`);
199
+ if (resp2) {
200
+ try {
201
+ const data = JSON.parse(resp2);
202
+ identity = `${data.agent_id}@${data.namespace_id}`;
203
+ console.log(` ✓ ${identity}`);
204
+ } catch {}
205
+ }
206
+ }
207
+ }
208
+
209
+ rl.close();
161
210
 
162
211
  if (isCodex) {
163
212
  // Codex: copy skill + write config
@@ -173,7 +222,8 @@ if (cmd === "agent") {
173
222
  existing = existing.trimEnd() + `\n\n[mcp_servers.patchcord]\nurl = "${serverUrl}/mcp/bearer"\nhttp_headers = { "Authorization" = "Bearer ${token}", "X-Patchcord-Client-Type" = "codex" }\n`;
174
223
  writeFileSync(configPath, existing);
175
224
  }
176
- console.log(`✓ Codex configured: ${configPath}\n✓ Skill installed: ${dest}/SKILL.md`);
225
+ console.log(`\n ✓ Codex configured: ${configPath}`);
226
+ console.log(` ✓ Skill installed`);
177
227
  } else {
178
228
  // Claude Code: write .mcp.json
179
229
  const mcpPath = join(cwd, ".mcp.json");
@@ -201,10 +251,10 @@ if (cmd === "agent") {
201
251
  } else {
202
252
  writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n");
203
253
  }
204
- console.log(`✓ Claude Code configured: ${mcpPath}`);
254
+ console.log(`\n ✓ Claude Code configured: ${mcpPath}`);
205
255
  }
206
256
 
207
- console.log("\nRestart your session, then run: inbox()");
257
+ console.log(`\nRestart your session, then run: inbox()`);
208
258
  process.exit(0);
209
259
  }
210
260
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",