Просмотр исходного кода

fix: read CLI version from package.json instead of hardcoding

Version was hardcoded as "0.3.6" in index.ts while package.json was
at 0.4.3. Now uses createRequire to read package.json at runtime.

Closes #24
Ma 7 месяцев назад
Родитель
Сommit
6a5afeed1a
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      packages/cli/src/index.ts

+ 5 - 1
packages/cli/src/index.ts

@@ -1,5 +1,6 @@
 #!/usr/bin/env node
 
+import { createRequire } from "node:module";
 import { Command } from "commander";
 import { initCommand } from "./commands/init.js";
 import { configCommand } from "./commands/config.js";
@@ -22,12 +23,15 @@ import { styleCommand } from "./commands/style.js";
 import { analyticsCommand } from "./commands/analytics.js";
 import { importCommand } from "./commands/import.js";
 
+const require = createRequire(import.meta.url);
+const { version } = require("../package.json") as { version: string };
+
 const program = new Command();
 
 program
   .name("inkos")
   .description("InkOS — Multi-agent novel production system")
-  .version("0.3.6");
+  .version(version);
 
 program.addCommand(initCommand);
 program.addCommand(configCommand);