Skip to content

Commit 132f47c

Browse files
fix(setup): read plugin version from package.json, not hardcoded 1.0.0 (#122)
registerClaudeCodePlugin stamped marketplace + installed_plugins + the cache leaf dir as '1.0.0' regardless of actual version. Now reads package.json so the plugin registers under its real version.
1 parent 61ee44e commit 132f47c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/internal/setup-hyperstack.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ export function registerClaudeCodePlugin(pluginRoot: string): void {
390390
const home = os.homedir();
391391
const claudeDir = path.join(home, ".claude");
392392
const settingsPath = path.join(claudeDir, "settings.json");
393+
const pkgVersion: string = (() => {
394+
try { return JSON.parse(fs.readFileSync(path.join(pluginRoot, "package.json"), "utf8")).version; }
395+
catch { return "0.0.0"; }
396+
})();
393397

394398
if (!fs.existsSync(settingsPath)) {
395399
console.log("ℹ️ Claude Code not detected (no ~/.claude/settings.json). Skipping plugin registration.");
@@ -412,14 +416,14 @@ export function registerClaudeCodePlugin(pluginRoot: string): void {
412416
},
413417
metadata: {
414418
description: "Disciplined MCP server + skill system. Iron Laws, 1% Rule, rationalization tables, SessionStart hook injection.",
415-
version: "1.0.0",
419+
version: pkgVersion,
416420
},
417421
plugins: [
418422
{
419423
name: "hyperstack",
420424
source: "./",
421425
description: "Disciplined MCP server + skill system with adversarial enforcement gates.",
422-
version: "1.0.0",
426+
version: pkgVersion,
423427
category: "productivity",
424428
strict: true,
425429
},
@@ -432,7 +436,7 @@ export function registerClaudeCodePlugin(pluginRoot: string): void {
432436

433437
// 2-3. Create symlinks (or directory copies on Windows if symlink fails)
434438
// installPath must point to the versioned leaf so Claude Code can find skills/ at <installPath>/skills/
435-
const version = "1.0.0";
439+
const version = pkgVersion;
436440
const marketplaceLink = path.join(claudeDir, "plugins", "marketplaces", "hyperstack");
437441
const cachePackageDir = path.join(claudeDir, "plugins", "cache", "hyperstack", "hyperstack");
438442
const cacheLink = path.join(cachePackageDir, version);
@@ -476,7 +480,7 @@ export function registerClaudeCodePlugin(pluginRoot: string): void {
476480
{
477481
scope: "user",
478482
installPath: cacheLink,
479-
version: "1.0.0",
483+
version: pkgVersion,
480484
installedAt: now,
481485
lastUpdated: now,
482486
},

0 commit comments

Comments
 (0)