patchcord 0.5.9 → 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 +36 -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) {
|