@fluidgrids/cli 2026.1114.3 → 2026.1115.1

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 (3) hide show
  1. package/README.md +5 -0
  2. package/dist/cli.js +38 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -336,6 +336,7 @@ fluidgrids runs describe --workflow-id order-7 --key approvals --pending
336
336
  fluidgrids signal approve --workflow-id order-7 --key approvals --payload '{"by":"ana"}'
337
337
  fluidgrids runs result --workflow-id order-7 --key approvals --follow-runs
338
338
  fluidgrids runs count --key approvals --group-by status,task-queue
339
+ fluidgrids runs count --key approvals --group-by status --group-by-attribute customerId
339
340
  fluidgrids runs stack <runId> --metadata # also the run's __metadata
340
341
  fluidgrids versions rollout approvals --to v4 --percent 10
341
342
  fluidgrids versions rollout delete approvals
@@ -343,6 +344,10 @@ fluidgrids versions drainage approvals v3 # ACTIVE, DRAINING or DRAINED
343
344
  fluidgrids versions override <runId> --pin v3 # or --auto-upgrade, --clear
344
345
  ```
345
346
 
347
+ - `runs count --group-by-attribute <names>` groups by search attributes (KEYWORD,
348
+ INT, DOUBLE, BOOL or DATETIME) after the `--group-by` columns, two columns in
349
+ all. A run without the attribute counts in the `(none)` group. It needs
350
+ `fluidgrids.search-attributes`.
346
351
  - `--workflow-id <id> --key <workflowKey>` (with an optional `--first-run-id`)
347
352
  works on `runs describe|history|signal|cancel|terminate|stack|result`,
348
353
  `history`, `signal` and `versions override`, and reaches the latest run of
package/dist/cli.js CHANGED
@@ -1008,6 +1008,22 @@ var DURABLE_RUN_FIELDS2 = `
1008
1008
  groupsTruncated
1009
1009
  }
1010
1010
  }
1011
+ `, CF_RUNS_COUNT_BY_ATTRIBUTE = `
1012
+ query FluidgridsCodeRunsCountByAttribute(
1013
+ $filter: ListWorkflowRunsInput
1014
+ $groupBy: [RunGroupBy!]
1015
+ $groupBySearchAttributes: [String!]
1016
+ ) {
1017
+ workflowRunsCount(
1018
+ filter: $filter
1019
+ groupBy: $groupBy
1020
+ groupBySearchAttributes: $groupBySearchAttributes
1021
+ ) {
1022
+ total
1023
+ groups { key values count }
1024
+ groupsTruncated
1025
+ }
1026
+ }
1011
1027
  `, CF_SIGNAL_RUN_BY_TARGET = `
1012
1028
  mutation FluidgridsCodeSignalRunByTarget(
1013
1029
  $target: RunTargetInput!
@@ -1548,10 +1564,15 @@ function createCodeFirstApi(ctx) {
1548
1564
  throw new CliUserError8(`Run ${runId} not found (NOT_FOUND)`);
1549
1565
  return data.workflowRun;
1550
1566
  },
1551
- async countRuns(filter, groupBy) {
1552
- const data = await request(CF_RUNS_COUNT, {
1567
+ async countRuns(filter, groupBy, groupBySearchAttributes = []) {
1568
+ const columns = groupBy.length > 0 ? groupBy : null;
1569
+ const data = groupBySearchAttributes.length > 0 ? await request(CF_RUNS_COUNT_BY_ATTRIBUTE, {
1553
1570
  filter,
1554
- groupBy: groupBy.length > 0 ? groupBy : null
1571
+ groupBy: columns,
1572
+ groupBySearchAttributes
1573
+ }) : await request(CF_RUNS_COUNT, {
1574
+ filter,
1575
+ groupBy: columns
1555
1576
  });
1556
1577
  return data.workflowRunsCount;
1557
1578
  },
@@ -5402,6 +5423,17 @@ function parseGroupBy(raw) {
5402
5423
  throw new CliUserError30("--group-by takes at most two columns.");
5403
5424
  return distinct;
5404
5425
  }
5426
+ function parseGroupByAttributes(raw, columns) {
5427
+ if (raw === undefined)
5428
+ return [];
5429
+ const names = [...new Set(raw.split(",").map((part) => part.trim()))].filter((name) => name !== "");
5430
+ if (names.length === 0)
5431
+ throw new CliUserError30("--group-by-attribute needs a search attribute name.");
5432
+ if (names.length + columns > 2) {
5433
+ throw new CliUserError30("--group-by and --group-by-attribute take at most two columns together.");
5434
+ }
5435
+ return names;
5436
+ }
5405
5437
  function parseDuration(raw, flag) {
5406
5438
  if (raw === undefined)
5407
5439
  return;
@@ -6003,7 +6035,8 @@ async function runCount(env, options) {
6003
6035
  if (memo)
6004
6036
  filter.memo = memo;
6005
6037
  const groupBy = parseGroupBy(options.groupBy);
6006
- const counted = await env.api.countRuns(filter, groupBy);
6038
+ const attributes = parseGroupByAttributes(options.groupByAttribute, groupBy.length);
6039
+ const counted = attributes.length > 0 ? await env.api.countRuns(filter, groupBy, attributes) : await env.api.countRuns(filter, groupBy);
6007
6040
  const details = [`Total: ${counted.total}`];
6008
6041
  if (counted.groupsTruncated)
6009
6042
  details.push("More than 1000 groups: the smallest were left out.");
@@ -10967,7 +11000,7 @@ function registerDurable(program, env) {
10967
11000
  await Promise.resolve().then(() => init_runs());
10968
11001
  await runResult(env, runId, withGlobalFormat(options, command));
10969
11002
  });
10970
- runs.command("count").description("How many runs match, in total and per group (durable-function parity)").option("--key <workflowKey>", "Only runs of this workflow key").option("--status <status>", "Only runs with this status").option("--kind <kind>", "Only GRAPH or DURABLE_FN runs").option("--workflow-id <id>", "Only runs with this workflow id").option("--first-run-id <id>", "Only the chain that started with this run").option("--root-run-id <id>", "Only runs under this root run").option("--memo <json>", "Only runs whose memo contains this JSON object").option("--group-by <columns>", "Up to two of status, workflow-key, execution-kind, task-queue (comma separated)").option(...OUTPUT_OPTION).action(async (options, command) => {
11003
+ runs.command("count").description("How many runs match, in total and per group (durable-function parity)").option("--key <workflowKey>", "Only runs of this workflow key").option("--status <status>", "Only runs with this status").option("--kind <kind>", "Only GRAPH or DURABLE_FN runs").option("--workflow-id <id>", "Only runs with this workflow id").option("--first-run-id <id>", "Only the chain that started with this run").option("--root-run-id <id>", "Only runs under this root run").option("--memo <json>", "Only runs whose memo contains this JSON object").option("--group-by <columns>", "Up to two of status, workflow-key, execution-kind, task-queue (comma separated)").option("--group-by-attribute <names>", "Search attributes to group by after --group-by, two columns in all (needs fluidgrids.search-attributes)").option(...OUTPUT_OPTION).action(async (options, command) => {
10971
11004
  await Promise.resolve().then(() => init_runs());
10972
11005
  await runCount(env, withGlobalFormat(options, command));
10973
11006
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidgrids/cli",
3
- "version": "2026.1114.3",
3
+ "version": "2026.1115.1",
4
4
  "description": "CLI tool for FluidGrids — workflow automation management (thin shell over @burdenoff/cli-sdk)",
5
5
  "type": "module",
6
6
  "private": false,