@ast-ai-model-router/cli 2.0.1 → 2.0.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.
package/README.md CHANGED
@@ -29,6 +29,7 @@ Run without installing:
29
29
 
30
30
  ```bash
31
31
  npx --yes --package @ast-ai-model-router/cli ast-ai-model-router --help
32
+ npx --yes @ast-ai-model-router/cli --version
32
33
  ```
33
34
 
34
35
  ## Quick Start
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process";
3
3
  import { access, writeFile } from "node:fs/promises";
4
+ import { readFileSync } from "node:fs";
4
5
  import path from "node:path";
5
6
  import { parseArgs } from "node:util";
6
7
  import { CONFIG_TEMPLATE, loadConfig, validateTier } from "../lib/config.js";
@@ -35,12 +36,22 @@ Options:
35
36
  const EXIT_INVALID = 2;
36
37
  const EXIT_POLICY = 3;
37
38
 
39
+ function readPackageVersion() {
40
+ const packageJsonUrl = new URL("../package.json", import.meta.url);
41
+ const packageJson = JSON.parse(readFileSync(packageJsonUrl, "utf8"));
42
+ return packageJson.version ?? "0.0.0";
43
+ }
44
+
38
45
  async function main() {
39
46
  const [command, maybeAgent, ...rest] = process.argv.slice(2);
40
47
  if (!command || command === "--help" || command === "-h") {
41
48
  process.stdout.write(HELP);
42
49
  return;
43
50
  }
51
+ if (command === "version" || command === "--version" || command === "-v") {
52
+ process.stdout.write(`${readPackageVersion()}\n`);
53
+ return;
54
+ }
44
55
 
45
56
  if (command === "init") {
46
57
  const { values } = parseArgs({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ast-ai-model-router/cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "AST-based Claude Code and Codex model router with token-cost estimates, CI policy checks, and explainable AI coding-agent model selection.",
5
5
  "type": "module",
6
6
  "bin": {