@arbiterhq/cli 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2 — 2026-07-08
4
+
5
+ ### Fixed
6
+
7
+ - `arbiter --version` now reads the installed package version from `package.json` via `resolveCliPackageVersion()` instead of a hardcoded Commander string (0.1.1 published with a stale `0.1.0` in dist)
8
+
3
9
  ## 0.1.1 — 2026-07-08
4
10
 
5
11
  ### Changed
package/dist/index.js CHANGED
@@ -949,10 +949,35 @@ function runWhoami() {
949
949
  }
950
950
  }
951
951
 
952
+ // src/version.ts
953
+ import { readFileSync } from "fs";
954
+ import { dirname, join } from "path";
955
+ import { fileURLToPath } from "url";
956
+ function resolveCliPackageVersion(fromUrl = import.meta.url) {
957
+ const startDir = dirname(fileURLToPath(fromUrl));
958
+ let dir = startDir;
959
+ for (let depth = 0; depth < 6; depth += 1) {
960
+ const candidate = join(dir, "package.json");
961
+ try {
962
+ const parsed = JSON.parse(readFileSync(candidate, "utf8"));
963
+ if (parsed.name === "@arbiterhq/cli" && typeof parsed.version === "string" && parsed.version.length > 0) {
964
+ return parsed.version;
965
+ }
966
+ } catch {
967
+ }
968
+ const parent = dirname(dir);
969
+ if (parent === dir) {
970
+ break;
971
+ }
972
+ dir = parent;
973
+ }
974
+ throw new Error("Unable to resolve @arbiterhq/cli version from package.json");
975
+ }
976
+
952
977
  // src/cli.ts
953
978
  function buildCli() {
954
979
  const program2 = new Command();
955
- program2.name("arbiter").description("Arbiter governance control plane CLI").version("0.1.0");
980
+ program2.name("arbiter").description("Arbiter governance control plane CLI").version(resolveCliPackageVersion());
956
981
  program2.command("login").description("Store API credentials locally (no network validation)").option("--api-key <key>", "API key value").option("--workspace <name>", "Workspace label").option("--environment <name>", "Environment label").option("--base-url <url>", "API base URL").action(async (options) => {
957
982
  await runLogin({
958
983
  ...options.apiKey !== void 0 ? { apiKey: options.apiKey } : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbiterhq/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Official Arbiter command line interface",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,6 +20,7 @@
20
20
  "scripts": {
21
21
  "build": "tsup src/index.ts --format esm --dts --clean",
22
22
  "typecheck": "tsc --noEmit",
23
+ "test": "tsx --test 'src/**/*.test.ts'",
23
24
  "prepublishOnly": "npm run build"
24
25
  },
25
26
  "dependencies": {
@@ -31,6 +32,7 @@
31
32
  "devDependencies": {
32
33
  "@types/node": "^22.15.21",
33
34
  "tsup": "^8.5.0",
35
+ "tsx": "^4.23.0",
34
36
  "typescript": "^5.8.3"
35
37
  },
36
38
  "keywords": [