fluncle 0.210.0 → 0.212.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/bin/fluncle.mjs +158 -2
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -610,7 +610,7 @@ function parseVersion(version) {
610
610
  var currentVersion;
611
611
  var init_version = __esm(() => {
612
612
  init_output();
613
- currentVersion = "0.210.0".trim() ? "0.210.0".trim() : "0.1.0";
613
+ currentVersion = "0.212.0".trim() ? "0.212.0".trim() : "0.1.0";
614
614
  });
615
615
 
616
616
  // src/update-notifier.ts
@@ -2452,7 +2452,7 @@ function parseVersion2(version) {
2452
2452
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2453
2453
  var init_version2 = __esm(() => {
2454
2454
  init_output();
2455
- currentVersion2 = "0.210.0".trim() ? "0.210.0".trim() : "0.1.0";
2455
+ currentVersion2 = "0.212.0".trim() ? "0.212.0".trim() : "0.1.0";
2456
2456
  });
2457
2457
 
2458
2458
  // ../../packages/registry/src/index.ts
@@ -4455,6 +4455,7 @@ var init_admin_attention = __esm(() => {
4455
4455
  "anchor-review": "version check",
4456
4456
  "artist-review": "artist links",
4457
4457
  "attach-cues": "cues",
4458
+ "bio-review": "bio gate",
4458
4459
  "capture-suspect": "capture check",
4459
4460
  distribute: "distribute",
4460
4461
  "drip-empty": "clip drip",
@@ -4469,6 +4470,101 @@ var init_admin_attention = __esm(() => {
4469
4470
  };
4470
4471
  });
4471
4472
 
4473
+ // src/commands/admin-telemetry.ts
4474
+ var exports_admin_telemetry = {};
4475
+ __export(exports_admin_telemetry, {
4476
+ telemetryLines: () => telemetryLines,
4477
+ telemetryCommand: () => telemetryCommand
4478
+ });
4479
+ async function telemetryCommand(options) {
4480
+ const params = new URLSearchParams({ limit: String(options.limit) });
4481
+ if (options.cursor !== undefined) {
4482
+ params.set("cursor", options.cursor);
4483
+ }
4484
+ if (options.ok !== undefined) {
4485
+ params.set("ok", String(options.ok));
4486
+ }
4487
+ if (options.since !== undefined) {
4488
+ params.set("since", options.since);
4489
+ }
4490
+ if (options.unit !== undefined) {
4491
+ params.set("unit", options.unit);
4492
+ }
4493
+ if (options.until !== undefined) {
4494
+ params.set("until", options.until);
4495
+ }
4496
+ return adminApiGet(`/api/v1/admin/telemetry/runs?${params.toString()}`);
4497
+ }
4498
+ function cell(value) {
4499
+ if (value === null) {
4500
+ return "-";
4501
+ }
4502
+ if (typeof value === "boolean") {
4503
+ return value ? "1" : "0";
4504
+ }
4505
+ return String(value);
4506
+ }
4507
+ function padded(columns, widths) {
4508
+ return columns.map((column, index) => column.padEnd(widths[index] ?? 0)).join(" ").trimEnd();
4509
+ }
4510
+ function telemetryLines(page) {
4511
+ if (!page.available) {
4512
+ return ["Telemetry database is not configured."];
4513
+ }
4514
+ if (page.rows.length === 0) {
4515
+ return ["No run events matched."];
4516
+ }
4517
+ const rollupHeader = ["UNIT", "RUNS", "LAST", "OK=0", "LIAR", "BLIND"];
4518
+ const rollupRows = page.rollups.map((rollup) => [
4519
+ rollup.unit,
4520
+ String(rollup.runCount),
4521
+ rollup.lastOccurredAt,
4522
+ String(rollup.failedCount),
4523
+ String(rollup.liarCount),
4524
+ String(rollup.blindCount)
4525
+ ]);
4526
+ const rollupWidths = rollupHeader.map((header, index) => Math.max(header.length, ...rollupRows.map((row) => row[index]?.length ?? 0)));
4527
+ const runHeader = [
4528
+ "OCCURRED",
4529
+ "UNIT",
4530
+ "OK",
4531
+ "SELF",
4532
+ "CHECKED",
4533
+ "PRODUCED",
4534
+ "QUEUE",
4535
+ "EXIT",
4536
+ "SUMMARY"
4537
+ ];
4538
+ const runRows = page.rows.map((row) => [
4539
+ row.occurredAt,
4540
+ row.unit,
4541
+ cell(row.ok),
4542
+ cell(row.selfAssertedOk),
4543
+ cell(row.checked),
4544
+ cell(row.produced),
4545
+ cell(row.queueDepth),
4546
+ String(row.exitCode),
4547
+ row.summaryStatus
4548
+ ]);
4549
+ const runWidths = runHeader.map((header, index) => Math.max(header.length, ...runRows.map((row) => row[index]?.length ?? 0)));
4550
+ const lines = [
4551
+ `Unit rollups (${page.totalCount} matching runs)`,
4552
+ padded(rollupHeader, rollupWidths),
4553
+ ...rollupRows.map((row) => padded(row, rollupWidths)),
4554
+ "",
4555
+ `Runs (${page.rows.length} on this page)`,
4556
+ padded(runHeader, runWidths),
4557
+ ...runRows.map((row) => padded(row, runWidths))
4558
+ ];
4559
+ if (page.nextCursor !== null) {
4560
+ lines.push("", `Next cursor: ${page.nextCursor}`);
4561
+ }
4562
+ return lines;
4563
+ }
4564
+ var init_admin_telemetry = __esm(() => {
4565
+ init_api();
4566
+ });
4567
+
4472
4568
  // src/commands/add.ts
4473
4569
  var exports_add = {};
4474
4570
  __export(exports_add, {
@@ -9660,6 +9756,14 @@ function addAdminCommands(program2) {
9660
9756
  const { attentionQueueCommand: attentionQueueCommand2 } = await Promise.resolve().then(() => (init_admin_attention(), exports_admin_attention));
9661
9757
  await runAdminAttention(options, attentionQueueCommand2);
9662
9758
  });
9759
+ const adminTelemetry = configureCommand(admin.command("telemetry").description("Run-ledger telemetry"));
9760
+ adminTelemetry.action(() => {
9761
+ adminTelemetry.outputHelp();
9762
+ });
9763
+ adminTelemetry.command("read").description("Run-ledger rows plus per-unit rollups").option("--unit <unit>", "Only this systemd unit").option("--since <iso>", "Only runs at or after this occurred-at instant").option("--until <iso>", "Only runs at or before this occurred-at instant").option("--ok <true|false>", "Filter by the Worker's derived run verdict").option("--limit <limit>", "Rows to show (1-100)", "50").option("--cursor <cursor>", "Opaque cursor from the previous page").option("--json", "Print the lossless 20-column rows as JSON", false).action(async (options) => {
9764
+ const { telemetryCommand: telemetryCommand2 } = await Promise.resolve().then(() => (init_admin_telemetry(), exports_admin_telemetry));
9765
+ await runAdminTelemetry(options, telemetryCommand2);
9766
+ });
9663
9767
  const adminTracks = configureCommand(admin.command("tracks").description("Track admin commands"));
9664
9768
  adminTracks.action(() => {
9665
9769
  adminTracks.outputHelp();
@@ -12485,6 +12589,32 @@ function parseListLimit(value) {
12485
12589
  }
12486
12590
  return limit;
12487
12591
  }
12592
+ function parseTelemetryLimit(value) {
12593
+ const limit = Number.parseInt(value ?? "50", 10);
12594
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
12595
+ throw new Error("Limit must be an integer between 1 and 100");
12596
+ }
12597
+ return limit;
12598
+ }
12599
+ function parseTelemetryOk(value) {
12600
+ if (value === undefined) {
12601
+ return;
12602
+ }
12603
+ if (value !== "true" && value !== "false") {
12604
+ throw new Error("--ok must be true or false");
12605
+ }
12606
+ return value === "true";
12607
+ }
12608
+ function parseTelemetryTimestamp(value, flag) {
12609
+ if (value === undefined) {
12610
+ return;
12611
+ }
12612
+ const timestamp = new Date(value);
12613
+ if (Number.isNaN(timestamp.getTime())) {
12614
+ throw new Error(`${flag} must be an ISO-8601 timestamp`);
12615
+ }
12616
+ return timestamp.toISOString();
12617
+ }
12488
12618
  function parsePage(value) {
12489
12619
  const page = Number.parseInt(value ?? "1", 10);
12490
12620
  if (!Number.isInteger(page) || page < 1) {
@@ -12552,6 +12682,28 @@ async function runAdminAttention(options, attentionQueueCommand2) {
12552
12682
  console.log(attentionQueueLines2(queue).join(`
12553
12683
  `));
12554
12684
  }
12685
+ async function runAdminTelemetry(options, telemetryCommand2) {
12686
+ const since = parseTelemetryTimestamp(options.since, "--since");
12687
+ const until = parseTelemetryTimestamp(options.until, "--until");
12688
+ if (since !== undefined && until !== undefined && since > until) {
12689
+ throw new Error("--since must be before or equal to --until");
12690
+ }
12691
+ const page = await telemetryCommand2({
12692
+ cursor: options.cursor,
12693
+ limit: parseTelemetryLimit(options.limit),
12694
+ ok: parseTelemetryOk(options.ok),
12695
+ since,
12696
+ unit: options.unit,
12697
+ until
12698
+ });
12699
+ if (options.json) {
12700
+ printJson({ ok: true, ...page });
12701
+ return;
12702
+ }
12703
+ const { telemetryLines: telemetryLines2 } = await Promise.resolve().then(() => (init_admin_telemetry(), exports_admin_telemetry));
12704
+ console.log(telemetryLines2(page).join(`
12705
+ `));
12706
+ }
12555
12707
  async function runAdminQueue(options, queueCommand2) {
12556
12708
  const limit = parseListLimit(options.limit);
12557
12709
  const tracks = await queueCommand2(limit, {
@@ -13020,6 +13172,7 @@ var stringOptions = new Set([
13020
13172
  "--min-phrase-words",
13021
13173
  "--model",
13022
13174
  "--note",
13175
+ "--ok",
13023
13176
  "--order",
13024
13177
  "--page",
13025
13178
  "--parent-id",
@@ -13041,6 +13194,7 @@ var stringOptions = new Set([
13041
13194
  "--script-file",
13042
13195
  "--seed",
13043
13196
  "--seed-state",
13197
+ "--since",
13044
13198
  "--soundcloud-url",
13045
13199
  "--source",
13046
13200
  "--status",
@@ -13049,6 +13203,8 @@ var stringOptions = new Set([
13049
13203
  "--token",
13050
13204
  "--tracklist-file",
13051
13205
  "--tracks",
13206
+ "--unit",
13207
+ "--until",
13052
13208
  "--url",
13053
13209
  "--verdict",
13054
13210
  "--verdict-file",
package/package.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "url": "git+https://github.com/mauricekleine/fluncle.git"
32
32
  },
33
33
  "type": "module",
34
- "version": "0.210.0"
34
+ "version": "0.212.0"
35
35
  }