@foir/cli 0.62.0 → 0.63.0

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/cli.js +71 -52
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -10013,6 +10013,7 @@ function registerOperationsCommands(program2, globalOpts) {
10013
10013
  }
10014
10014
 
10015
10015
  // src/commands/context-dimensions.ts
10016
+ import chalk10 from "chalk";
10016
10017
  function registerContextDimensionsCommands(program2, globalOpts) {
10017
10018
  const dims = program2.command("context-dimensions").alias("context-dims").description("Manage context dimensions (segments + customer-context sources)");
10018
10019
  dims.command("list").description("List context dimensions").option("--first <n>", "Max results", "50").action(
@@ -10082,6 +10083,24 @@ function registerContextDimensionsCommands(program2, globalOpts) {
10082
10083
  }
10083
10084
  )
10084
10085
  );
10086
+ dims.command("publish <id>").description("Promote a context dimension draft to the published channel").action(
10087
+ withErrorHandler(globalOpts, async (id) => {
10088
+ const opts = globalOpts();
10089
+ const client = await createPlatformClient(opts);
10090
+ const resp = await client.settings.publishContextDimension(id);
10091
+ if (opts.json || opts.jsonl) {
10092
+ formatOutputProto(ContextDimensionSchema, resp.dimension, opts);
10093
+ return;
10094
+ }
10095
+ success(`Published context dimension ${resp.dimension?.key ?? id}`);
10096
+ if (resp.breakingChanges.length > 0) {
10097
+ console.log(chalk10.yellow("\nBreaking changes:"));
10098
+ for (const c of resp.breakingChanges) {
10099
+ console.log(` ${c.severity} ${c.path}: ${c.description}`);
10100
+ }
10101
+ }
10102
+ })
10103
+ );
10085
10104
  dims.command("delete <id>").description("Delete a context dimension").option("--confirm", "Skip confirmation prompt").action(
10086
10105
  withErrorHandler(
10087
10106
  globalOpts,
@@ -10255,7 +10274,7 @@ function registerSchedulesCommands(program2, globalOpts) {
10255
10274
  }
10256
10275
 
10257
10276
  // src/commands/api-keys.ts
10258
- import chalk10 from "chalk";
10277
+ import chalk11 from "chalk";
10259
10278
  import { toJson as toJson4 } from "@bufbuild/protobuf";
10260
10279
  function registerApiKeysCommands(program2, globalOpts) {
10261
10280
  const apiKeys = program2.command("api-keys").description("Manage API keys");
@@ -10317,9 +10336,9 @@ function registerApiKeysCommands(program2, globalOpts) {
10317
10336
  success(`Created API key: ${result.apiKey?.name}`);
10318
10337
  console.log("");
10319
10338
  console.log(
10320
- chalk10.yellow(" Save this key now \u2014 it cannot be retrieved later:")
10339
+ chalk11.yellow(" Save this key now \u2014 it cannot be retrieved later:")
10321
10340
  );
10322
- console.log(chalk10.bold(` ${result.apiKey?.rawKey}`));
10341
+ console.log(chalk11.bold(` ${result.apiKey?.rawKey}`));
10323
10342
  }
10324
10343
  })
10325
10344
  );
@@ -10349,11 +10368,11 @@ function registerApiKeysCommands(program2, globalOpts) {
10349
10368
  success(`Rotated API key: ${result.apiKey?.name}`);
10350
10369
  console.log("");
10351
10370
  console.log(
10352
- chalk10.yellow(
10371
+ chalk11.yellow(
10353
10372
  " Save this key now \u2014 it cannot be retrieved later:"
10354
10373
  )
10355
10374
  );
10356
- console.log(chalk10.bold(` ${result.apiKey?.rawKey}`));
10375
+ console.log(chalk11.bold(` ${result.apiKey?.rawKey}`));
10357
10376
  }
10358
10377
  }
10359
10378
  )
@@ -10384,7 +10403,7 @@ function registerApiKeysCommands(program2, globalOpts) {
10384
10403
  }
10385
10404
 
10386
10405
  // src/commands/auth-providers.ts
10387
- import chalk11 from "chalk";
10406
+ import chalk12 from "chalk";
10388
10407
  var VALID_TYPES = [
10389
10408
  "OAUTH2",
10390
10409
  "TOKEN_SSO",
@@ -10437,7 +10456,7 @@ function registerAuthProvidersCommands(program2, globalOpts) {
10437
10456
  formatOutputProto(AuthProviderSchema, provider, opts);
10438
10457
  } else {
10439
10458
  const p = provider;
10440
- console.log(chalk11.bold(`${p.name}`) + chalk11.gray(` (${p.key})`));
10459
+ console.log(chalk12.bold(`${p.name}`) + chalk12.gray(` (${p.key})`));
10441
10460
  console.log(` Type: ${p.type}`);
10442
10461
  console.log(` Enabled: ${p.enabled ? "yes" : "no"}`);
10443
10462
  console.log(` Default: ${p.isDefault ? "yes" : "no"}`);
@@ -10451,13 +10470,13 @@ function registerAuthProvidersCommands(program2, globalOpts) {
10451
10470
  if (p.configDisplay) {
10452
10471
  console.log(` Config:`);
10453
10472
  console.log(
10454
- chalk11.gray(
10473
+ chalk12.gray(
10455
10474
  JSON.stringify(p.configDisplay, null, 2).replace(/^/gm, " ")
10456
10475
  )
10457
10476
  );
10458
10477
  }
10459
- console.log(chalk11.gray(` Created: ${p.createdAt}`));
10460
- console.log(chalk11.gray(` Updated: ${p.updatedAt}`));
10478
+ console.log(chalk12.gray(` Created: ${p.createdAt}`));
10479
+ console.log(chalk12.gray(` Updated: ${p.updatedAt}`));
10461
10480
  }
10462
10481
  })
10463
10482
  );
@@ -10568,7 +10587,7 @@ function registerAuthProvidersCommands(program2, globalOpts) {
10568
10587
  }
10569
10588
 
10570
10589
  // src/commands/embeddings.ts
10571
- import chalk12 from "chalk";
10590
+ import chalk13 from "chalk";
10572
10591
  function registerEmbeddingsCommands(program2, globalOpts) {
10573
10592
  const embeddings = program2.command("embeddings").description("Manage vector embeddings for semantic search");
10574
10593
  embeddings.command("write").description("Write an embedding vector for a record").option("-d, --data <json>", "Embedding input as JSON string").option("--file <path>", "Embedding input from JSON file").action(
@@ -10654,13 +10673,13 @@ function registerEmbeddingsCommands(program2, globalOpts) {
10654
10673
  return;
10655
10674
  }
10656
10675
  if (results.length === 0) {
10657
- console.log(chalk12.dim("No matches."));
10676
+ console.log(chalk13.dim("No matches."));
10658
10677
  return;
10659
10678
  }
10660
10679
  for (const r of results) {
10661
10680
  const score = typeof r.similarity === "number" ? r.similarity.toFixed(4) : "\u2014";
10662
10681
  console.log(
10663
- ` ${chalk12.cyan(r.id)} ${chalk12.dim(r.modelKey ?? "")} ${chalk12.gray(`sim=${score}`)}`
10682
+ ` ${chalk13.cyan(r.id)} ${chalk13.dim(r.modelKey ?? "")} ${chalk13.gray(`sim=${score}`)}`
10664
10683
  );
10665
10684
  }
10666
10685
  })
@@ -10683,12 +10702,12 @@ function registerEmbeddingsCommands(program2, globalOpts) {
10683
10702
  return;
10684
10703
  }
10685
10704
  if (stats.length === 0) {
10686
- console.log(chalk12.dim("No embeddings yet."));
10705
+ console.log(chalk13.dim("No embeddings yet."));
10687
10706
  return;
10688
10707
  }
10689
10708
  for (const s of stats) {
10690
10709
  console.log(
10691
- ` ${chalk12.cyan(s.modelKey)} ${chalk12.dim(`embedded=${s.embeddedRecords}/${s.totalRecords} pending=${s.pendingRecords}`)}`
10710
+ ` ${chalk13.cyan(s.modelKey)} ${chalk13.dim(`embedded=${s.embeddedRecords}/${s.totalRecords} pending=${s.pendingRecords}`)}`
10692
10711
  );
10693
10712
  }
10694
10713
  })
@@ -10709,13 +10728,13 @@ function registerEmbeddingsCommands(program2, globalOpts) {
10709
10728
  return;
10710
10729
  }
10711
10730
  if (results.length === 0) {
10712
- console.log(chalk12.dim("No similar records."));
10731
+ console.log(chalk13.dim("No similar records."));
10713
10732
  return;
10714
10733
  }
10715
10734
  for (const r of results) {
10716
10735
  const score = typeof r.similarity === "number" ? r.similarity.toFixed(4) : "\u2014";
10717
10736
  console.log(
10718
- ` ${chalk12.cyan(r.id)} ${chalk12.dim(r.modelKey ?? "")} ${chalk12.gray(`sim=${score}`)}`
10737
+ ` ${chalk13.cyan(r.id)} ${chalk13.dim(r.modelKey ?? "")} ${chalk13.gray(`sim=${score}`)}`
10719
10738
  );
10720
10739
  }
10721
10740
  }
@@ -10724,7 +10743,7 @@ function registerEmbeddingsCommands(program2, globalOpts) {
10724
10743
  }
10725
10744
 
10726
10745
  // src/commands/geometry.ts
10727
- import chalk13 from "chalk";
10746
+ import chalk14 from "chalk";
10728
10747
  function requireNumber(raw, flag) {
10729
10748
  const n = Number(raw);
10730
10749
  if (raw === void 0 || raw === "" || Number.isNaN(n)) {
@@ -10758,13 +10777,13 @@ function registerGeometryCommands(program2, globalOpts) {
10758
10777
  return;
10759
10778
  }
10760
10779
  if (results.length === 0) {
10761
- console.log(chalk13.dim("No nearby records."));
10780
+ console.log(chalk14.dim("No nearby records."));
10762
10781
  return;
10763
10782
  }
10764
10783
  for (const r of results) {
10765
10784
  const dist = typeof r.distanceMeters === "number" ? `${r.distanceMeters.toFixed(1)}m` : "\u2014";
10766
10785
  console.log(
10767
- ` ${chalk13.cyan(r.id)} ${chalk13.dim(r.modelKey ?? "")} ${chalk13.gray(`dist=${dist}`)}`
10786
+ ` ${chalk14.cyan(r.id)} ${chalk14.dim(r.modelKey ?? "")} ${chalk14.gray(`dist=${dist}`)}`
10768
10787
  );
10769
10788
  }
10770
10789
  })
@@ -10786,13 +10805,13 @@ function registerGeometryCommands(program2, globalOpts) {
10786
10805
  return;
10787
10806
  }
10788
10807
  if (results.length === 0) {
10789
- console.log(chalk13.dim("No nearby records."));
10808
+ console.log(chalk14.dim("No nearby records."));
10790
10809
  return;
10791
10810
  }
10792
10811
  for (const r of results) {
10793
10812
  const dist = typeof r.distanceMeters === "number" ? `${r.distanceMeters.toFixed(1)}m` : "\u2014";
10794
10813
  console.log(
10795
- ` ${chalk13.cyan(r.id)} ${chalk13.dim(r.modelKey ?? "")} ${chalk13.gray(`dist=${dist}`)}`
10814
+ ` ${chalk14.cyan(r.id)} ${chalk14.dim(r.modelKey ?? "")} ${chalk14.gray(`dist=${dist}`)}`
10796
10815
  );
10797
10816
  }
10798
10817
  }
@@ -10815,13 +10834,13 @@ function registerGeometryCommands(program2, globalOpts) {
10815
10834
  return;
10816
10835
  }
10817
10836
  console.log(
10818
- chalk13.dim(
10837
+ chalk14.dim(
10819
10838
  `${res.total} record(s) missing geometry in ${modelKey}`
10820
10839
  )
10821
10840
  );
10822
10841
  for (const r of res.records) {
10823
10842
  console.log(
10824
- ` ${chalk13.cyan(r.recordId)} ${chalk13.dim(r.naturalKey ?? "")}`
10843
+ ` ${chalk14.cyan(r.recordId)} ${chalk14.dim(r.naturalKey ?? "")}`
10825
10844
  );
10826
10845
  }
10827
10846
  }
@@ -11046,7 +11065,7 @@ function registerHooksCommands(program2, globalOpts) {
11046
11065
  }
11047
11066
 
11048
11067
  // src/commands/rollouts.ts
11049
- import chalk14 from "chalk";
11068
+ import chalk15 from "chalk";
11050
11069
  function parseScheduledAt(value) {
11051
11070
  const date = new Date(value);
11052
11071
  if (Number.isNaN(date.getTime())) {
@@ -11093,10 +11112,10 @@ function registerRolloutsCommands(program2, globalOpts) {
11093
11112
  formatOutputProto(PublishBatchSchema, batch, opts);
11094
11113
  if (items.length > 0) {
11095
11114
  console.log();
11096
- console.log(chalk14.bold(`Items (${items.length}):`));
11115
+ console.log(chalk15.bold(`Items (${items.length}):`));
11097
11116
  for (const it of items) {
11098
11117
  console.log(
11099
- ` ${chalk14.cyan(it.id)} ${chalk14.dim(it.targetKind)} ${chalk14.gray(it.status ?? "")}`
11118
+ ` ${chalk15.cyan(it.id)} ${chalk15.dim(it.targetKind)} ${chalk15.gray(it.status ?? "")}`
11100
11119
  );
11101
11120
  }
11102
11121
  }
@@ -11517,7 +11536,7 @@ function registerSettingsCommands(program2, globalOpts) {
11517
11536
  // src/commands/design-tokens.ts
11518
11537
  import { existsSync as existsSync6, readFileSync as readFileSync2 } from "fs";
11519
11538
  import { resolve as resolve6 } from "path";
11520
- import chalk15 from "chalk";
11539
+ import chalk16 from "chalk";
11521
11540
  function registerDesignTokensCommands(program2, globalOpts) {
11522
11541
  const tokens = program2.command("design-tokens").description("Manage project design tokens (W3C-formatted)");
11523
11542
  tokens.command("get").description("Print the current design tokens document").option("--channel <channel>", "draft | published", "draft").option(
@@ -11565,7 +11584,7 @@ function registerDesignTokensCommands(program2, globalOpts) {
11565
11584
  const resp = await client.settings.publishDesignTokens();
11566
11585
  success("Design tokens published");
11567
11586
  if (resp.breakingChanges && resp.breakingChanges.length > 0) {
11568
- console.log(chalk15.yellow("\nBreaking changes:"));
11587
+ console.log(chalk16.yellow("\nBreaking changes:"));
11569
11588
  for (const c of resp.breakingChanges) {
11570
11589
  console.log(` ${c.severity} ${c.path}: ${c.description}`);
11571
11590
  }
@@ -11581,7 +11600,7 @@ function registerDesignTokensCommands(program2, globalOpts) {
11581
11600
  const resp = await client.settings.publishDesignTokens();
11582
11601
  success("Design tokens published");
11583
11602
  if (resp.breakingChanges && resp.breakingChanges.length > 0) {
11584
- console.log(chalk15.yellow("\nBreaking changes:"));
11603
+ console.log(chalk16.yellow("\nBreaking changes:"));
11585
11604
  for (const c of resp.breakingChanges) {
11586
11605
  console.log(` ${c.severity} ${c.path}: ${c.description}`);
11587
11606
  }
@@ -11606,12 +11625,12 @@ function registerDesignTokensCommands(program2, globalOpts) {
11606
11625
  return;
11607
11626
  }
11608
11627
  if (status.hasPendingChanges) {
11609
- console.log(chalk15.yellow("\u25CF Pending changes"));
11628
+ console.log(chalk16.yellow("\u25CF Pending changes"));
11610
11629
  } else {
11611
- console.log(chalk15.green("\u25CF Up to date"));
11630
+ console.log(chalk16.green("\u25CF Up to date"));
11612
11631
  }
11613
11632
  if (status.breakingChanges && status.breakingChanges.length > 0) {
11614
- console.log(chalk15.yellow("\nPending changes:"));
11633
+ console.log(chalk16.yellow("\nPending changes:"));
11615
11634
  for (const c of status.breakingChanges) {
11616
11635
  console.log(` ${c.severity} ${c.path}: ${c.description}`);
11617
11636
  }
@@ -12217,7 +12236,7 @@ function registerConfigsCommands(program2, globalOpts) {
12217
12236
  }
12218
12237
 
12219
12238
  // src/commands/apps.ts
12220
- import chalk17 from "chalk";
12239
+ import chalk18 from "chalk";
12221
12240
  import { spawn as spawn2 } from "child_process";
12222
12241
  import { existsSync as existsSync8, watch as fsWatch } from "fs";
12223
12242
  import { resolve as resolvePath } from "path";
@@ -12225,7 +12244,7 @@ import { resolve as resolvePath } from "path";
12225
12244
  // src/lib/tunnel.ts
12226
12245
  import { spawn } from "child_process";
12227
12246
  import { once } from "events";
12228
- import chalk16 from "chalk";
12247
+ import chalk17 from "chalk";
12229
12248
  async function startTunnel(opts) {
12230
12249
  const host = opts.host ?? "localhost";
12231
12250
  if (opts.kind === "cloudflared") return startCloudflared(host, opts.port, opts.logs ?? true);
@@ -12261,7 +12280,7 @@ function startCloudflared(host, port, logs) {
12261
12280
  let buffered = "";
12262
12281
  const onData = (chunk) => {
12263
12282
  const text = chunk.toString("utf-8");
12264
- if (logs) process.stderr.write(chalk16.dim(text));
12283
+ if (logs) process.stderr.write(chalk17.dim(text));
12265
12284
  buffered += text;
12266
12285
  const match = buffered.match(CLOUDFLARED_URL_RE);
12267
12286
  if (match && !resolved) {
@@ -12309,8 +12328,8 @@ function startNgrok(port, logs) {
12309
12328
  return;
12310
12329
  }
12311
12330
  if (logs) {
12312
- child.stdout.on("data", (c) => process.stderr.write(chalk16.dim(c.toString("utf-8"))));
12313
- child.stderr.on("data", (c) => process.stderr.write(chalk16.dim(c.toString("utf-8"))));
12331
+ child.stdout.on("data", (c) => process.stderr.write(chalk17.dim(c.toString("utf-8"))));
12332
+ child.stderr.on("data", (c) => process.stderr.write(chalk17.dim(c.toString("utf-8"))));
12314
12333
  }
12315
12334
  let resolved = false;
12316
12335
  child.once("error", (err) => {
@@ -12652,7 +12671,7 @@ function registerAppsCommands(program2, globalOpts) {
12652
12671
  return;
12653
12672
  }
12654
12673
  if (!opts.json) {
12655
- console.error(chalk17.dim(`Starting ${kind} tunnel \u2192 http://${cmdOpts.host}:${port}\u2026`));
12674
+ console.error(chalk18.dim(`Starting ${kind} tunnel \u2192 http://${cmdOpts.host}:${port}\u2026`));
12656
12675
  }
12657
12676
  const handle = await startTunnel({
12658
12677
  kind,
@@ -12708,20 +12727,20 @@ function runDevSession(info) {
12708
12727
  }
12709
12728
  const host = hostOf(info.publicUrl);
12710
12729
  console.log();
12711
- console.log(chalk17.bold.green(" Tunnel ready"));
12712
- console.log(` ${chalk17.bold(info.publicUrl)} ${chalk17.dim("\u2192")} http://${info.localHost ?? "localhost"}:${info.port}`);
12730
+ console.log(chalk18.bold.green(" Tunnel ready"));
12731
+ console.log(` ${chalk18.bold(info.publicUrl)} ${chalk18.dim("\u2192")} http://${info.localHost ?? "localhost"}:${info.port}`);
12713
12732
  console.log();
12714
- console.log(chalk17.dim(" Point `foir push` at the tunnel so app manifests resolve here."));
12715
- console.log(chalk17.dim(" If your foir.config.ts uses an env-gated source (recommended):"));
12716
- console.log(chalk17.dim(` FOIR_APPS_HOST=${host} foir push`));
12717
- console.log(chalk17.dim(" Otherwise: update apps.<name>.source in foir.config.ts to a URL on"));
12718
- console.log(chalk17.dim(` ${host} and run foir push.`));
12733
+ console.log(chalk18.dim(" Point `foir push` at the tunnel so app manifests resolve here."));
12734
+ console.log(chalk18.dim(" If your foir.config.ts uses an env-gated source (recommended):"));
12735
+ console.log(chalk18.dim(` FOIR_APPS_HOST=${host} foir push`));
12736
+ console.log(chalk18.dim(" Otherwise: update apps.<name>.source in foir.config.ts to a URL on"));
12737
+ console.log(chalk18.dim(` ${host} and run foir push.`));
12719
12738
  console.log();
12720
12739
  if (info.kind === "byo") {
12721
- console.log(chalk17.dim(" (BYO tunnel \u2014 leaving lifecycle to you.)"));
12740
+ console.log(chalk18.dim(" (BYO tunnel \u2014 leaving lifecycle to you.)"));
12722
12741
  return Promise.resolve();
12723
12742
  }
12724
- console.log(chalk17.dim(" Press Ctrl+C to stop the tunnel."));
12743
+ console.log(chalk18.dim(" Press Ctrl+C to stop the tunnel."));
12725
12744
  return Promise.resolve();
12726
12745
  }
12727
12746
  function hostOf(url) {
@@ -12735,7 +12754,7 @@ function runPush(host, jsonMode) {
12735
12754
  return new Promise((resolve9, reject) => {
12736
12755
  if (!jsonMode) {
12737
12756
  console.log();
12738
- console.log(chalk17.dim(`\u2192 foir push (${FOIR_APPS_HOST_ENV}=${host})`));
12757
+ console.log(chalk18.dim(`\u2192 foir push (${FOIR_APPS_HOST_ENV}=${host})`));
12739
12758
  }
12740
12759
  const entry = process.argv[1];
12741
12760
  if (!entry) {
@@ -12758,12 +12777,12 @@ function startWatchLoop(host, jsonMode) {
12758
12777
  const target = WATCH_FILES.map((n) => resolvePath(cwd, n)).find((p) => existsSync8(p));
12759
12778
  if (!target) {
12760
12779
  if (!jsonMode) {
12761
- console.error(chalk17.yellow(`! --watch: no foir.config.* in ${cwd}; skipping watch loop.`));
12780
+ console.error(chalk18.yellow(`! --watch: no foir.config.* in ${cwd}; skipping watch loop.`));
12762
12781
  }
12763
12782
  return null;
12764
12783
  }
12765
12784
  if (!jsonMode) {
12766
- console.log(chalk17.dim(`Watching ${target} \u2014 saving triggers foir push.`));
12785
+ console.log(chalk18.dim(`Watching ${target} \u2014 saving triggers foir push.`));
12767
12786
  }
12768
12787
  let pending = false;
12769
12788
  let running = false;
@@ -12776,7 +12795,7 @@ function startWatchLoop(host, jsonMode) {
12776
12795
  running = true;
12777
12796
  pending = false;
12778
12797
  runPush(host, jsonMode).catch((err) => {
12779
- if (!jsonMode) console.error(chalk17.red(`push failed: ${err.message}`));
12798
+ if (!jsonMode) console.error(chalk18.red(`push failed: ${err.message}`));
12780
12799
  }).finally(() => {
12781
12800
  running = false;
12782
12801
  if (pending) tick();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foir/cli",
3
- "version": "0.62.0",
3
+ "version": "0.63.0",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {