@arbiterhq/cli 0.1.0 → 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,22 @@
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
+
9
+ ## 0.1.1 — 2026-07-08
10
+
11
+ ### Changed
12
+
13
+ - Scaffolded / discovered permissions in manifests use **`defaultDecision: hold`** instead of legacy posture `status`
14
+ - Depends on `@arbiterhq/sdk@^0.2.1`
15
+
16
+ ### Compatibility
17
+
18
+ - Manifest validation still accepts deprecated permission `status` posture aliases via the SDK
19
+
3
20
  ## 0.1.0 — 2026-06-28
4
21
 
5
22
  First public npm release under **`@arbiterhq/cli`**. The CLI binary remains **`arbiter`**; only the npm scope changed from the previously planned `@arbiter` org.
@@ -17,4 +34,4 @@ First public npm release under **`@arbiterhq/cli`**. The CLI binary remains **`a
17
34
 
18
35
  ### Dependencies
19
36
 
20
- - Requires `@arbiterhq/sdk@^0.2.0` (publish SDK before CLI)
37
+ - Requires `@arbiterhq/sdk@^0.2.1` (publish SDK before CLI)
package/dist/index.js CHANGED
@@ -109,6 +109,13 @@ var PERMISSION_STATUSES = [
109
109
  "denied",
110
110
  "approval_required"
111
111
  ];
112
+ var PERMISSION_DEFAULT_DECISIONS = ["allow", "hold", "deny"];
113
+ var LEGACY_STATUS_TO_DEFAULT_DECISION = {
114
+ pending_review: null,
115
+ allowed: "allow",
116
+ denied: "deny",
117
+ approval_required: "hold"
118
+ };
112
119
  var AGENT_STATUSES = [
113
120
  "pending_review",
114
121
  "active",
@@ -172,7 +179,9 @@ var ManifestAgentSchema = z.object({
172
179
  var ManifestPermissionSchema = z.object({
173
180
  action: z.string().min(1).regex(SNAKE_CASE_ACTION, "Action must be snake_case"),
174
181
  description: z.string().optional(),
182
+ /** @deprecated Prefer defaultDecision. Legacy posture alias. */
175
183
  status: z.enum(PERMISSION_STATUSES).optional(),
184
+ defaultDecision: z.enum(PERMISSION_DEFAULT_DECISIONS).optional(),
176
185
  source: z.enum(RESOURCE_SOURCES).optional(),
177
186
  management: z.enum(RESOURCE_MANAGEMENTS).optional(),
178
187
  assignedAgents: z.array(z.string().min(1)).optional(),
@@ -181,6 +190,21 @@ var ManifestPermissionSchema = z.object({
181
190
  documentation: z.string().nullable().optional(),
182
191
  tags: z.array(z.string()).nullable().optional(),
183
192
  metadata: z.record(z.unknown()).nullable().optional()
193
+ }).transform((permission) => {
194
+ if (permission.defaultDecision !== void 0) {
195
+ return permission;
196
+ }
197
+ if (permission.status === void 0) {
198
+ return permission;
199
+ }
200
+ const mapped = LEGACY_STATUS_TO_DEFAULT_DECISION[permission.status];
201
+ if (mapped === null) {
202
+ return permission;
203
+ }
204
+ return {
205
+ ...permission,
206
+ defaultDecision: mapped
207
+ };
184
208
  });
185
209
  var PolicyConditionSchema = z.object({
186
210
  field: z.string().min(1).max(256),
@@ -379,7 +403,7 @@ function starterManifestTemplate() {
379
403
  permissions: [
380
404
  {
381
405
  action: "send_payment",
382
- status: "approval_required"
406
+ defaultDecision: "hold"
383
407
  }
384
408
  ],
385
409
  policies: [
@@ -727,7 +751,7 @@ function buildWorkspaceFromDrift(suggestions, records) {
727
751
  if (suggestion.type === "permission" && suggestion.action && !seenPermissions.has(suggestion.action)) {
728
752
  workspace.permissions.push({
729
753
  action: suggestion.action,
730
- status: "pending_review"
754
+ defaultDecision: "hold"
731
755
  });
732
756
  seenPermissions.add(suggestion.action);
733
757
  }
@@ -754,7 +778,7 @@ function buildWorkspaceFromDrift(suggestions, records) {
754
778
  if (record.type === "permission" && record.action && !seenPermissions.has(record.action)) {
755
779
  workspace.permissions.push({
756
780
  action: record.action,
757
- status: "pending_review"
781
+ defaultDecision: "hold"
758
782
  });
759
783
  seenPermissions.add(record.action);
760
784
  }
@@ -925,10 +949,35 @@ function runWhoami() {
925
949
  }
926
950
  }
927
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
+
928
977
  // src/cli.ts
929
978
  function buildCli() {
930
979
  const program2 = new Command();
931
- 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());
932
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) => {
933
982
  await runLogin({
934
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.0",
3
+ "version": "0.1.2",
4
4
  "description": "Official Arbiter command line interface",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,10 +20,11 @@
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": {
26
- "@arbiterhq/sdk": "^0.2.0",
27
+ "@arbiterhq/sdk": "^0.2.1",
27
28
  "commander": "^13.1.0",
28
29
  "yaml": "^2.8.0",
29
30
  "zod": "^3.25.76"
@@ -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": [