@wave-ai-os/wave-cli 0.1.62 → 0.1.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wave-ai-os/wave-cli",
3
- "version": "0.1.62",
3
+ "version": "0.1.65",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"
@@ -2,6 +2,7 @@
2
2
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
4
  import { spawnSync } from "node:child_process";
5
+ import { REQUIRED_WAVE_RUNTIME_INPUTS } from "./cli-token-scope.mjs";
5
6
 
6
7
  const DEFAULTS = {
7
8
  runs: 10,
@@ -479,7 +480,7 @@ function main() {
479
480
  };
480
481
 
481
482
  const waveEntryAbs = resolve(cwd, options.waveEntry);
482
- const waveMissing = ["WAVE_API_BASE_URL", "WAVE_API_TOKEN", "WAVE_ORGANIZATION_ID"].filter((key) => !baseEnv[key]);
483
+ const waveMissing = REQUIRED_WAVE_RUNTIME_INPUTS.filter((key) => !baseEnv[key]);
483
484
  const waveReady = existsSync(waveEntryAbs) && waveMissing.length === 0;
484
485
 
485
486
  const obsidian = resolveObsidianBinary(options.obsidianBin);
@@ -0,0 +1,10 @@
1
+ export const REQUIRED_WAVE_RUNTIME_INPUTS = ["WAVE_API_BASE_URL", "WAVE_API_TOKEN"];
2
+
3
+ export function organizationIdFromAuthenticatedStatus(envelope) {
4
+ if (!envelope || envelope.ok !== true) return undefined;
5
+ if (envelope.data?.authenticated !== true) return undefined;
6
+ const organizationId = envelope.data?.organization?.id;
7
+ return typeof organizationId === "string" && organizationId.trim() !== ""
8
+ ? organizationId
9
+ : undefined;
10
+ }
@@ -2,6 +2,7 @@
2
2
  import { readFileSync } from "node:fs";
3
3
  import { spawnSync } from "node:child_process";
4
4
  import { resolve } from "node:path";
5
+ import { organizationIdFromAuthenticatedStatus } from "./cli-token-scope.mjs";
5
6
 
6
7
  function loadDotEnv(filePath) {
7
8
  const raw = readFileSync(filePath, "utf8");
@@ -348,12 +349,18 @@ const dot = loadDotEnv(envFile);
348
349
  const env = {
349
350
  WAVE_API_BASE_URL: dot.WAVE_API_BASE_URL,
350
351
  WAVE_API_TOKEN: dot.WAVE_API_TOKEN,
351
- WAVE_ORGANIZATION_ID: dot.WAVE_ORGANIZATION_ID,
352
352
  WAVE_AGENT_NAME: dot.WAVE_AGENT_NAME || "cli-verifier",
353
353
  WAVE_AGENT_RUN_ID: `verify-${Date.now()}`,
354
354
  WAVE_TIMEOUT_MS: dot.WAVE_TIMEOUT_MS || "10000"
355
355
  };
356
356
 
357
+ const authStatus = runWave(["auth", "status"], env);
358
+ const orgId = organizationIdFromAuthenticatedStatus(authStatus.parsed);
359
+ if (!orgId) {
360
+ console.error("verify-dev-api failed: authenticated CLI token status did not return an organization id.");
361
+ process.exit(1);
362
+ }
363
+
357
364
  const idLookup = {};
358
365
  const listSeeds = [
359
366
  ["projects", ["projects", "list", "--page", "1", "--per", "2"]],
@@ -386,7 +393,7 @@ const listSeeds = [
386
393
  ["quarterlyObjectives", ["foundation", "quarterly-objectives", "list", "--page", "1", "--per", "2"]]
387
394
  ];
388
395
 
389
- const results = [];
396
+ const results = [authStatus];
390
397
  for (const [key, args] of listSeeds) {
391
398
  const res = runWave(args, env);
392
399
  results.push(res);
@@ -413,7 +420,6 @@ for (const [key, args] of listSeeds) {
413
420
  }
414
421
  }
415
422
 
416
- const orgId = env.WAVE_ORGANIZATION_ID;
417
423
  const projectId = idLookup.projects;
418
424
  const taskId = idLookup.tasks;
419
425
  const rockId = idLookup.rocks;