@primeinc/swarm 0.57.16 → 0.57.18

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/swarm.ts CHANGED
@@ -56,6 +56,7 @@ import {
56
56
  migrateCellsToHive,
57
57
  } from "../dist/hive.js";
58
58
  import { formatCoordinatorPrompt } from "../dist/swarm-prompts.js";
59
+ import packageJson from "../package.json" with { type: "json" };
59
60
  import {
60
61
  getEpicList,
61
62
  getFileLocks,
@@ -115,14 +116,13 @@ import { session } from "./commands/session.js";
115
116
  import { tree } from "./commands/tree.js";
116
117
 
117
118
  const __dirname = dirname(fileURLToPath(import.meta.url));
118
- // When running from bin/swarm.ts, go up one level to find package.json
119
- // When bundled to dist/bin/swarm.js, go up two levels
120
- const pkgPath = existsSync(join(__dirname, "..", "package.json"))
121
- ? join(__dirname, "..", "package.json")
122
- : join(__dirname, "..", "..", "package.json");
123
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
124
- const VERSION: string = pkg.version;
125
- const PACKAGE_ROOT = dirname(pkgPath);
119
+ // PACKAGE_ROOT detection that works for both dev (bin/swarm.ts) and bundled (dist/bin/swarm.js)
120
+ const PACKAGE_ROOT =
121
+ basename(__dirname) === "bin" && dirname(__dirname).endsWith("dist")
122
+ ? resolve(__dirname, "..", "..") // dist/bin -> root
123
+ : resolve(__dirname, ".."); // bin -> root
124
+
125
+ const VERSION: string = packageJson.version;
126
126
  const CLAUDE_PLUGIN_NAME = "swarm";
127
127
 
128
128
  // ============================================================================