klyro 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12,11 +12,28 @@
12
12
  * Configure via env: KLYRO_BASE_URL, KLYRO_API_KEY, KLYRO_MODEL.
13
13
  */
14
14
  import { Command } from 'commander';
15
+ import { readFileSync } from 'node:fs';
16
+ import { fileURLToPath } from 'node:url';
17
+ import { dirname, resolve } from 'node:path';
15
18
  import { chat } from './chat.js';
16
19
  import { repl } from './repl.js';
17
20
  import { runOnce } from './cli/run.js';
18
21
  import { runEval } from './cli/eval.js';
19
- const VERSION = '0.1.0';
22
+ // Read version from package.json so `klyro --version` always matches the
23
+ // published version. Walks up from this file (src/index.ts) to find the
24
+ // nearest package.json.
25
+ function readVersion() {
26
+ try {
27
+ const here = dirname(fileURLToPath(import.meta.url));
28
+ const pkgPath = resolve(here, '..', 'package.json');
29
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
30
+ return pkg.version ?? '0.0.0';
31
+ }
32
+ catch {
33
+ return '0.0.0';
34
+ }
35
+ }
36
+ const VERSION = readVersion();
20
37
  function parsePositiveInt(name, v) {
21
38
  const n = Number(v);
22
39
  if (!Number.isFinite(n) || n <= 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klyro",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Klyro — autonomous coding harness CLI that streams from any OpenAI-compatible or Anthropic LLM endpoint.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",