patchcord 0.3.15 → 0.3.17

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.15",
4
+ "version": "0.3.17",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/bin/patchcord.mjs CHANGED
@@ -150,11 +150,19 @@ if (cmd === "agent") {
150
150
  const rl = createInterface({ input: process.stdin, output: process.stdout });
151
151
  const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
152
152
 
153
- console.log(`\nWhich tool are you setting up?\n`);
154
- console.log(` 1. Claude Code`);
155
- console.log(` 2. Codex CLI\n`);
156
-
157
- const choice = (await ask("Choose (1/2): ")).trim();
153
+ const dim = "\x1b[2m";
154
+ const green = "\x1b[32m";
155
+ const red = "\x1b[31m";
156
+ const cyan = "\x1b[36m";
157
+ const white = "\x1b[37m";
158
+ const bold = "\x1b[1m";
159
+ const r = "\x1b[0m";
160
+
161
+ console.log(`\n${bold}Which tool are you setting up?${r}\n`);
162
+ console.log(` ${cyan}1.${r} Claude Code`);
163
+ console.log(` ${cyan}2.${r} Codex CLI\n`);
164
+
165
+ const choice = (await ask(`${dim}Choose (1/2):${r} `)).trim();
158
166
  const isCodex = choice === "2";
159
167
 
160
168
  if (choice !== "1" && choice !== "2") {
@@ -163,31 +171,39 @@ if (cmd === "agent") {
163
171
  process.exit(1);
164
172
  }
165
173
 
166
- const token = (await ask("\nPaste your agent token: ")).trim();
174
+ let token = "";
175
+ let identity = "";
176
+ let serverUrl = "https://mcp.patchcord.dev";
167
177
 
168
- if (!token) {
169
- console.error("Token is required. Get one from your patchcord dashboard.");
170
- rl.close();
171
- process.exit(1);
172
- }
178
+ while (!identity) {
179
+ token = (await ask(`\n${bold}Paste your agent token:${r} `)).trim();
173
180
 
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");
181
+ if (!token) {
182
+ console.error("Token is required. Get one from your patchcord dashboard.");
183
+ rl.close();
184
+ process.exit(1);
185
+ }
186
+
187
+ console.log("Validating...");
188
+ const validateResp = run(`curl -sf --max-time 5 -H "Authorization: Bearer ${token}" "${serverUrl}/api/inbox?limit=0"`);
189
+ if (validateResp) {
190
+ try {
191
+ const data = JSON.parse(validateResp);
192
+ identity = `${data.agent_id}@${data.namespace_id}`;
193
+ console.log(` ${green}✓${r} ${bold}${identity}${r}`);
194
+ } catch {}
195
+ }
196
+ if (!identity) {
197
+ console.log(` ${red}✗${r} Token not recognized`);
198
+ const retry = (await ask(`${dim}Try again? (Y/n):${r} `)).trim().toLowerCase();
199
+ if (retry === "n" || retry === "no") {
200
+ rl.close();
201
+ process.exit(1);
202
+ }
203
+ }
188
204
  }
189
205
 
190
- const customUrl = (await ask("\nCustom server URL? (y/N): ")).trim().toLowerCase();
206
+ const customUrl = (await ask(`\n${dim}Custom server URL? (y/N):${r} `)).trim().toLowerCase();
191
207
  if (customUrl === "y" || customUrl === "yes") {
192
208
  const url = (await ask("Server URL: ")).trim();
193
209
  if (url) serverUrl = url;
@@ -200,7 +216,7 @@ if (cmd === "agent") {
200
216
  try {
201
217
  const data = JSON.parse(resp2);
202
218
  identity = `${data.agent_id}@${data.namespace_id}`;
203
- console.log(` ${identity}`);
219
+ console.log(` ${green}✓${r} ${bold}${identity}${r}`);
204
220
  } catch {}
205
221
  }
206
222
  }
@@ -222,8 +238,8 @@ if (cmd === "agent") {
222
238
  existing = existing.trimEnd() + `\n\n[mcp_servers.patchcord]\nurl = "${serverUrl}/mcp/bearer"\nhttp_headers = { "Authorization" = "Bearer ${token}", "X-Patchcord-Client-Type" = "codex" }\n`;
223
239
  writeFileSync(configPath, existing);
224
240
  }
225
- console.log(`\n Codex configured: ${configPath}`);
226
- console.log(` Skill installed`);
241
+ console.log(`\n ${green}✓${r} Codex configured: ${dim}${configPath}${r}`);
242
+ console.log(` ${green}✓${r} Skill installed`);
227
243
  } else {
228
244
  // Claude Code: write .mcp.json
229
245
  const mcpPath = join(cwd, ".mcp.json");
@@ -251,10 +267,11 @@ if (cmd === "agent") {
251
267
  } else {
252
268
  writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n");
253
269
  }
254
- console.log(`\n Claude Code configured: ${mcpPath}`);
270
+ console.log(`\n ${green}✓${r} Claude Code configured: ${dim}${mcpPath}${r}`);
255
271
  }
256
272
 
257
- console.log(`\nRestart your session, then run: inbox()`);
273
+ const toolName = isCodex ? "Codex" : "Claude Code";
274
+ console.log(`\n${dim}Restart your ${toolName} session, then run:${r} ${bold}inbox()${r}`);
258
275
  process.exit(0);
259
276
  }
260
277
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",