patchcord 0.6.15 → 0.6.16
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.
package/bin/patchcord.mjs
CHANGED
|
@@ -1966,6 +1966,30 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1966
1966
|
} else if (allowlistChanged) {
|
|
1967
1967
|
globalChanges.push("Cursor MCP allowlist configured");
|
|
1968
1968
|
}
|
|
1969
|
+
|
|
1970
|
+
// cursor-agent v2026.07+ also reads ~/.cursor/cli-config.json permissions.allow
|
|
1971
|
+
// for MCP tool approval — permissions.json alone leaves patchcord at
|
|
1972
|
+
// "not loaded (needs approval)" even with --yolo.
|
|
1973
|
+
const cliConfigPath = join(HOME, ".cursor", "cli-config.json");
|
|
1974
|
+
let cliAllowChanged = false;
|
|
1975
|
+
const cliOk = updateJsonConfig(cliConfigPath, (obj) => {
|
|
1976
|
+
obj.permissions = obj.permissions || {};
|
|
1977
|
+
if (!obj.permissions.allow) obj.permissions.allow = [];
|
|
1978
|
+
if (!Array.isArray(obj.permissions.allow)) {
|
|
1979
|
+
console.log(`\n ${yellow}⚠${r} Skipped Cursor CLI MCP allow — ${cliConfigPath} permissions.allow is not an array.`);
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
const pat = "Mcp(patchcord:*)";
|
|
1983
|
+
if (!obj.permissions.allow.includes(pat)) {
|
|
1984
|
+
obj.permissions.allow.push(pat);
|
|
1985
|
+
cliAllowChanged = true;
|
|
1986
|
+
}
|
|
1987
|
+
});
|
|
1988
|
+
if (!cliOk) {
|
|
1989
|
+
globalChanges.push("✗ Cursor CLI permissions error");
|
|
1990
|
+
} else if (cliAllowChanged) {
|
|
1991
|
+
globalChanges.push("Cursor CLI MCP allowlist configured");
|
|
1992
|
+
}
|
|
1969
1993
|
}
|
|
1970
1994
|
}
|
|
1971
1995
|
|
|
@@ -2403,6 +2427,13 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
2403
2427
|
}
|
|
2404
2428
|
toolSlug = toolFlag; // preserved as-is for the URL param
|
|
2405
2429
|
}
|
|
2430
|
+
// cursor-agent --yolo runs `npx patchcord` without --tool=cursor. Without
|
|
2431
|
+
// this, browser connect defaults to Claude and writes .mcp.json instead of
|
|
2432
|
+
// .cursor/mcp.json — MCP never loads in cursor-agent.
|
|
2433
|
+
if (!choice && process.env.CURSOR_AGENT) {
|
|
2434
|
+
choice = CLIENT_TYPE_MAP.cursor;
|
|
2435
|
+
toolSlug = toolSlug || "cursor";
|
|
2436
|
+
}
|
|
2406
2437
|
|
|
2407
2438
|
// --token bypass for power users / CI / self-hosters
|
|
2408
2439
|
const tokenFlag = flags.find(f => f.startsWith("--token="))?.split("=")[1]
|
|
@@ -2453,12 +2484,14 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
2453
2484
|
let existingToken = "";
|
|
2454
2485
|
let existingConfigFile = "";
|
|
2455
2486
|
const mcpJsonPath = join(cwd, ".mcp.json");
|
|
2487
|
+
const cursorMcpPath = join(cwd, ".cursor", "mcp.json");
|
|
2456
2488
|
const codexTomlPath = join(cwd, ".codex", "config.toml");
|
|
2457
2489
|
const grokTomlPath = join(cwd, ".grok", "config.toml");
|
|
2458
2490
|
const kimiJsonPath = join(cwd, ".kimi", "mcp.json");
|
|
2459
2491
|
|
|
2460
|
-
const slugForCheck = toolSlug ? toolSlug.replace(/-/g, "_") : "";
|
|
2492
|
+
const slugForCheck = toolSlug ? toolSlug.replace(/-/g, "_") : (process.env.CURSOR_AGENT ? "cursor" : "");
|
|
2461
2493
|
const checkMcpJson = !slugForCheck || slugForCheck === "claude_code";
|
|
2494
|
+
const checkCursorJson = !slugForCheck || slugForCheck === "cursor";
|
|
2462
2495
|
const checkCodexToml = !slugForCheck || slugForCheck === "codex";
|
|
2463
2496
|
const checkGrokToml = !slugForCheck || ["grok", "grok_cli", "grok_build"].includes(slugForCheck);
|
|
2464
2497
|
const checkKimiJson = !slugForCheck || slugForCheck === "kimi";
|
|
@@ -2473,6 +2506,16 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
2473
2506
|
}
|
|
2474
2507
|
} catch {}
|
|
2475
2508
|
}
|
|
2509
|
+
if (!existingToken && checkCursorJson && existsSync(cursorMcpPath)) {
|
|
2510
|
+
try {
|
|
2511
|
+
const existing = JSON.parse(readFileSync(cursorMcpPath, "utf-8"));
|
|
2512
|
+
const pt = existing?.mcpServers?.patchcord;
|
|
2513
|
+
if (pt?.headers?.Authorization) {
|
|
2514
|
+
existingToken = pt.headers.Authorization.replace(/^Bearer\s+/i, "");
|
|
2515
|
+
existingConfigFile = cursorMcpPath;
|
|
2516
|
+
}
|
|
2517
|
+
} catch {}
|
|
2518
|
+
}
|
|
2476
2519
|
if (!existingToken && checkCodexToml && existsSync(codexTomlPath)) {
|
|
2477
2520
|
try {
|
|
2478
2521
|
const content = readFileSync(codexTomlPath, "utf-8");
|
|
@@ -3452,6 +3495,9 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
3452
3495
|
console.log(`\n ${green}→${r} ${bold}Restart ${cyan}kimi${r}${bold} in this project (or run ${cyan}/reload${r}${bold}), then say: ${cyan}${bold}check inbox${r}`);
|
|
3453
3496
|
} else if (isKimi) {
|
|
3454
3497
|
console.log(`\n ${green}→${r} ${bold}Restart your ${toolName} session with ${cyan}kimi-pc${r}${bold}, then say: ${cyan}${bold}check inbox${r}`);
|
|
3498
|
+
} else if (isCursor && hasCursorAgent) {
|
|
3499
|
+
console.log(`\n ${green}→${r} ${bold}Exit and start a new ${cyan}cursor-agent${r}${bold} session${r} ${dim}(MCP loads at session start — not mid-session)${r}`);
|
|
3500
|
+
console.log(` ${dim}Then:${r} ${cyan}${bold}check inbox${r} ${dim}before${r} ${cyan}${bold}/patchcord-subscribe${r}`);
|
|
3455
3501
|
} else {
|
|
3456
3502
|
console.log(`\n ${green}→${r} ${bold}Restart your ${toolName} session${r}, then say: ${cyan}${bold}check inbox${r}`);
|
|
3457
3503
|
}
|
package/package.json
CHANGED
|
@@ -15,12 +15,21 @@ Start the persistent listener in a background Shell.
|
|
|
15
15
|
expose it as `mcp_patchcord_inbox`). Process every pending message according
|
|
16
16
|
to the patchcord inbox skill before starting the listener.
|
|
17
17
|
|
|
18
|
+
**Just provisioned in this same session?** Cursor/`cursor-agent` loads MCP
|
|
19
|
+
servers at session start only — `inbox()` will not exist until the user
|
|
20
|
+
starts a **new** session after connect. Do not spin on missing MCP tools.
|
|
21
|
+
Skip inbox drain, start the listener (step 3), and say one line: *MCP inbox
|
|
22
|
+
needs a fresh cursor-agent session after connect; listener is running — restart
|
|
23
|
+
once, then say check inbox.*
|
|
24
|
+
|
|
18
25
|
2. **Find the absolute project root.** Use the current session's git root or
|
|
19
26
|
agent worktree. Do not rely on the ambient Shell cwd: the listener must read
|
|
20
27
|
the `.cursor/mcp.json` for this project and therefore needs an explicit
|
|
21
28
|
`cd`.
|
|
22
29
|
|
|
23
|
-
3. **Spawn the background listener** with Cursor's Shell tool
|
|
30
|
+
3. **Spawn the background listener** with Cursor's Shell tool. **Always**
|
|
31
|
+
`block_until_ms: 0` — never run subscribe in the foreground (that yields
|
|
32
|
+
"Wait skipped" and no wake notifications):
|
|
24
33
|
|
|
25
34
|
```text
|
|
26
35
|
Shell(
|