patchcord 0.3.7 → 0.3.8

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.7",
4
+ "version": "0.3.8",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/bin/patchcord.mjs CHANGED
@@ -117,47 +117,76 @@ Then run: npx patchcord@latest install`);
117
117
  process.exit(0);
118
118
  }
119
119
 
120
- // ── agent: per-project MCP setup (auto-detects tool) ──────────
120
+ // ── agent: per-project MCP setup (interactive, auto-detects tool) ──
121
121
  if (cmd === "agent") {
122
122
  const cwd = process.cwd();
123
+ const { readFileSync, writeFileSync } = await import("fs");
124
+ const { createInterface } = await import("readline");
125
+
126
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
127
+ const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
128
+
129
+ // Ask for server URL with default
130
+ const serverUrl = (await ask("Server URL [https://mcp.patchcord.dev]: ")).trim() || "https://mcp.patchcord.dev";
131
+
132
+ // Ask for token
133
+ const token = (await ask("Paste your agent token: ")).trim();
134
+ rl.close();
135
+
136
+ if (!token) {
137
+ console.error("Token is required. Get one from your patchcord dashboard.");
138
+ process.exit(1);
139
+ }
123
140
 
124
141
  // Auto-detect: Codex project has .agents folder or .codex folder
125
142
  const isCodex = existsSync(join(cwd, ".agents")) || existsSync(join(cwd, ".codex"));
126
143
 
127
144
  if (isCodex) {
128
- // Codex: copy skill
145
+ // Codex: copy skill + write config
129
146
  const dest = join(cwd, ".agents", "skills", "patchcord");
130
147
  mkdirSync(dest, { recursive: true });
131
148
  cpSync(join(pluginRoot, "codex", "SKILL.md"), join(dest, "SKILL.md"));
132
- console.log(`✓ Codex skill installed: ${dest}/SKILL.md
133
149
 
134
- Add to .codex/config.toml in this project:
135
-
136
- [mcp_servers.patchcord]
137
- url = "https://YOUR_SERVER/mcp/bearer"
138
- http_headers = { "Authorization" = "Bearer YOUR_TOKEN", "X-Patchcord-Client-Type" = "codex" }`);
150
+ const codexDir = join(cwd, ".codex");
151
+ mkdirSync(codexDir, { recursive: true });
152
+ const configPath = join(codexDir, "config.toml");
153
+ let existing = existsSync(configPath) ? readFileSync(configPath, "utf-8") : "";
154
+ if (!existing.includes("[mcp_servers.patchcord]")) {
155
+ existing = existing.trimEnd() + `\n\n[mcp_servers.patchcord]\nurl = "${serverUrl}/mcp/bearer"\nhttp_headers = { "Authorization" = "Bearer ${token}", "X-Patchcord-Client-Type" = "codex" }\n`;
156
+ writeFileSync(configPath, existing);
157
+ }
158
+ console.log(`✓ Codex configured: ${configPath}\n✓ Skill installed: ${dest}/SKILL.md`);
139
159
  } else {
140
- // Claude Code: print .mcp.json template
141
- console.log(`Add .mcp.json to this project:
142
-
143
- {
144
- "mcpServers": {
145
- "patchcord": {
146
- "type": "http",
147
- "url": "https://YOUR_SERVER/mcp",
148
- "headers": {
149
- "Authorization": "Bearer YOUR_TOKEN"
150
- }
160
+ // Claude Code: write .mcp.json
161
+ const mcpPath = join(cwd, ".mcp.json");
162
+ const mcpConfig = {
163
+ mcpServers: {
164
+ patchcord: {
165
+ type: "http",
166
+ url: `${serverUrl}/mcp`,
167
+ headers: {
168
+ Authorization: `Bearer ${token}`,
169
+ },
170
+ },
171
+ },
172
+ };
173
+
174
+ if (existsSync(mcpPath)) {
175
+ try {
176
+ const existing = JSON.parse(readFileSync(mcpPath, "utf-8"));
177
+ existing.mcpServers = existing.mcpServers || {};
178
+ existing.mcpServers.patchcord = mcpConfig.mcpServers.patchcord;
179
+ writeFileSync(mcpPath, JSON.stringify(existing, null, 2) + "\n");
180
+ } catch {
181
+ writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n");
151
182
  }
183
+ } else {
184
+ writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n");
152
185
  }
186
+ console.log(`✓ Claude Code configured: ${mcpPath}`);
153
187
  }
154
188
 
155
- Or use the CLI:
156
-
157
- claude mcp add patchcord "https://YOUR_SERVER/mcp" \\
158
- --transport http -s project \\
159
- -H "Authorization: Bearer YOUR_TOKEN"`);
160
- }
189
+ console.log("\nRestart your session, then run: inbox()");
161
190
  process.exit(0);
162
191
  }
163
192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",