patchcord 0.5.8 → 0.5.10
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 +56 -1
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -122,10 +122,45 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
122
122
|
try { rmSync(npmCachePatchcord, { recursive: true, force: true }); } catch {}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
// Stable plugin location: copy plugin files out of the bunx/npx temp
|
|
126
|
+
// dir into a path under HOME that won't get reused across npx
|
|
127
|
+
// invocations. Without this, `claude plugin marketplace add` points at
|
|
128
|
+
// /tmp/bunx-1000-patchcord@latest/... which bunx aggressively caches
|
|
129
|
+
// and may not re-download for "@latest" — so the marketplace can stay
|
|
130
|
+
// pinned to a stale tarball, and `claude plugin update` resolves the
|
|
131
|
+
// wrong (sometimes very old) version.
|
|
132
|
+
let marketplaceSource = pluginRoot;
|
|
133
|
+
try {
|
|
134
|
+
const stableDir = join(HOME, ".patchcord", "plugin");
|
|
135
|
+
if (existsSync(stableDir)) {
|
|
136
|
+
rmSync(stableDir, { recursive: true, force: true });
|
|
137
|
+
}
|
|
138
|
+
mkdirSync(stableDir, { recursive: true });
|
|
139
|
+
cpSync(pluginRoot, stableDir, { recursive: true });
|
|
140
|
+
marketplaceSource = stableDir;
|
|
141
|
+
|
|
142
|
+
// Some Claude Code versions silently keep the existing source path
|
|
143
|
+
// on re-add for a marketplace name that's already registered. Wipe
|
|
144
|
+
// any old patchcord-marketplace entry so the next `marketplace add`
|
|
145
|
+
// is forced to write the new stable path.
|
|
146
|
+
const kmpPath = join(HOME, ".claude", "plugins", "known_marketplaces.json");
|
|
147
|
+
if (existsSync(kmpPath)) {
|
|
148
|
+
try {
|
|
149
|
+
const kmp = JSON.parse(readFileSync(kmpPath, "utf-8"));
|
|
150
|
+
if (kmp["patchcord-marketplace"]) {
|
|
151
|
+
delete kmp["patchcord-marketplace"];
|
|
152
|
+
writeFileSync(kmpPath, JSON.stringify(kmp, null, 2) + "\n");
|
|
153
|
+
}
|
|
154
|
+
} catch {}
|
|
155
|
+
}
|
|
156
|
+
} catch (e) {
|
|
157
|
+
globalChanges.push(`✗ Stable plugin path setup failed (${e.message}), falling back to bunx temp dir`);
|
|
158
|
+
}
|
|
159
|
+
|
|
125
160
|
// Always re-add marketplace (copies fresh files from this npx package)
|
|
126
161
|
// and install/update plugin. Claude Code's built-in plugin update
|
|
127
162
|
// doesn't detect new versions from local sources (#37252).
|
|
128
|
-
run(`claude plugin marketplace add "${
|
|
163
|
+
run(`claude plugin marketplace add "${marketplaceSource}"`);
|
|
129
164
|
const installed = run(`claude plugin list`)?.includes("patchcord");
|
|
130
165
|
wasPluginInstalled = !!installed;
|
|
131
166
|
if (installed) {
|
|
@@ -570,6 +605,26 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
570
605
|
} // end connect flow
|
|
571
606
|
} // end if (!token)
|
|
572
607
|
|
|
608
|
+
// Tell the server where this agent is installed on disk.
|
|
609
|
+
// Universal: works for every client (Claude Code, Codex, Cursor, Gemini,
|
|
610
|
+
// Windsurf, etc.) because the installer runs once per install regardless
|
|
611
|
+
// of which tool is being wired up. Re-running on existing setups also
|
|
612
|
+
// fires this, which is how we backfill install_path for users who
|
|
613
|
+
// installed before the column existed.
|
|
614
|
+
// Best-effort: a network failure here doesn't block the install.
|
|
615
|
+
if (token) {
|
|
616
|
+
const pathPayload = JSON.stringify({ install_path: cwd });
|
|
617
|
+
// Single quotes in the payload could break shell escaping; encode them.
|
|
618
|
+
const safePayload = pathPayload.replace(/'/g, `'\\''`);
|
|
619
|
+
run(
|
|
620
|
+
`curl -sf -X POST --max-time 5 ` +
|
|
621
|
+
`-H "Authorization: Bearer ${token}" ` +
|
|
622
|
+
`-H "Content-Type: application/json" ` +
|
|
623
|
+
`-d '${safePayload}' ` +
|
|
624
|
+
`"${serverUrl}/api/agent/install-path" >/dev/null 2>&1 || true`
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
|
|
573
628
|
const isCodex = choice === "2";
|
|
574
629
|
const isCursor = choice === "3";
|
|
575
630
|
const isWindsurf = choice === "4";
|