patchcord 0.6.17 → 0.6.19
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/.claude-plugin/plugin.json +1 -1
- package/bin/patchcord.mjs +33 -2
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -43,6 +43,18 @@ function isSafeId(s) {
|
|
|
43
43
|
return /^[A-Za-z0-9_\-]+$/.test(s) && s.length < 100;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/** cursor-agent --yolo often spawns `npx patchcord` without CURSOR_AGENT in env. */
|
|
47
|
+
function _runningUnderCursorAgent() {
|
|
48
|
+
if (process.env.CURSOR_AGENT) return true;
|
|
49
|
+
if (process.platform === "linux") {
|
|
50
|
+
try {
|
|
51
|
+
const cmdline = readFileSync(`/proc/${process.ppid}/cmdline`, "utf-8").replace(/\0/g, " ");
|
|
52
|
+
if (/cursor-agent|\bcursor agent\b/i.test(cmdline)) return true;
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
46
58
|
/** Undo 0.6.14 mistake: Claude Code uses /mcp (not /mcp/bearer). */
|
|
47
59
|
function revertClaudeMcpBearerUrl(mcpPath) {
|
|
48
60
|
if (!existsSync(mcpPath)) return false;
|
|
@@ -1671,6 +1683,11 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1671
1683
|
const flags = cmd?.startsWith("--") ? process.argv.slice(2) : process.argv.slice(3);
|
|
1672
1684
|
const fullStatusline = flags.includes("--full");
|
|
1673
1685
|
const updateOnly = flags.includes("--update-only");
|
|
1686
|
+
const toolFlagEarly = flags.find((f) => f.startsWith("--tool="))?.split("=")[1]
|
|
1687
|
+
|| (flags.includes("--tool") ? flags[flags.indexOf("--tool") + 1] : "");
|
|
1688
|
+
const skipClaudePluginForCursor =
|
|
1689
|
+
_runningUnderCursorAgent()
|
|
1690
|
+
|| toolFlagEarly.replace(/-/g, "_") === "cursor";
|
|
1674
1691
|
let wasPluginInstalled = false;
|
|
1675
1692
|
const { readFileSync, writeFileSync, unlinkSync, rmSync, chmodSync, copyFileSync } = await import("fs");
|
|
1676
1693
|
|
|
@@ -1850,9 +1867,11 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1850
1867
|
let globalChanges = [];
|
|
1851
1868
|
if (globalCliInstalled) globalChanges.push("Patchcord CLI installed globally");
|
|
1852
1869
|
|
|
1853
|
-
// Claude Code
|
|
1870
|
+
// Claude Code — skip when install runs inside cursor-agent: Claude's plugin
|
|
1871
|
+
// MCP registers as "plugin-patchcord-marketplace-patchcord", which cursor-agent
|
|
1872
|
+
// tries instead of project .cursor/mcp.json → "MCP server not found".
|
|
1854
1873
|
const hasClaude = run("which claude");
|
|
1855
|
-
if (hasClaude) {
|
|
1874
|
+
if (hasClaude && !skipClaudePluginForCursor) {
|
|
1856
1875
|
// Remove legacy npm-cache install (pre-marketplace era) — causes duplicate /patchcord commands.
|
|
1857
1876
|
const npmCachePatchcord = join(HOME, ".claude", "plugins", "npm-cache", "node_modules", "patchcord");
|
|
1858
1877
|
if (existsSync(npmCachePatchcord)) {
|
|
@@ -2838,6 +2857,18 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
2838
2857
|
console.log(`\n ${green}✓${r} Cursor configured: ${dim}${cursorPath}${r}`);
|
|
2839
2858
|
console.log(` ${dim}Per-project only — other projects won't see this agent.${r}`);
|
|
2840
2859
|
}
|
|
2860
|
+
// Project-layer CLI permissions (cursor-agent merges .cursor/cli.json from git root).
|
|
2861
|
+
const cursorCliPath = join(cursorDir, "cli.json");
|
|
2862
|
+
const cursorCliOk = updateJsonConfig(cursorCliPath, (obj) => {
|
|
2863
|
+
obj.permissions = obj.permissions || {};
|
|
2864
|
+
if (!obj.permissions.allow) obj.permissions.allow = [];
|
|
2865
|
+
if (!Array.isArray(obj.permissions.allow)) return;
|
|
2866
|
+
const pat = "Mcp(patchcord:*)";
|
|
2867
|
+
if (!obj.permissions.allow.includes(pat)) obj.permissions.allow.push(pat);
|
|
2868
|
+
});
|
|
2869
|
+
if (cursorCliOk) {
|
|
2870
|
+
console.log(` ${green}✓${r} Cursor CLI permissions: ${dim}${cursorCliPath}${r}`);
|
|
2871
|
+
}
|
|
2841
2872
|
} else if (isGrok) {
|
|
2842
2873
|
// Grok CLI: project-scoped .grok/config.toml. Grok loads this file from
|
|
2843
2874
|
// the current directory up through the git root, so the bearer remains
|
package/package.json
CHANGED