@moda-ai/cli 1.55.31 → 1.55.32

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/README.md CHANGED
@@ -143,7 +143,9 @@ Flag aliases: `moda context --message-index=N` = `--msg-index=N`, and
143
143
  `moda users --limit=N` = `--page-size=N`. Each command rejects a flag it does
144
144
  not take, and time windows differ by command: `--days-back=N` (a whole number,
145
145
  1-90) on the overview, Problem and detection commands, `--time-range` on
146
- `traces`, `search` and `clusters`. Boolean flags accept `true`/`false`, `1`/`0`,
146
+ `traces`, `search` and `clusters`. The other window spelling is rewritten when
147
+ it names the same span (`--days-back=7` is `--time-range=7d`, `--time-range=30d`
148
+ is `--days-back=30`); one with no exact match fails. Boolean flags accept `true`/`false`, `1`/`0`,
147
149
  `yes`/`no` and `on`/`off`.
148
150
 
149
151
  Prompt management:
package/dist/cli.js CHANGED
@@ -7352,6 +7352,56 @@ function assertRoutedFlags(route, flags) {
7352
7352
  const args = Object.fromEntries(Object.keys(flags).filter((flag) => !aliases.has(flag.replace(/_/g, "-"))).map((flag) => [flag.replace(/-/g, "_"), true]));
7353
7353
  parseCommandFlags(shape.passthrough(), args, route.label, route.flagAliases ? { flagAliases: route.flagAliases } : {});
7354
7354
  }
7355
+ var DAYS_TO_TIME_RANGE = { 1: "24h", 3: "3d", 7: "7d", 30: "30d", 90: "90d" };
7356
+ function timeRangeAsDays(value) {
7357
+ if (value === "24h")
7358
+ return 1;
7359
+ const match = /^(\d+)d$/.exec(value.trim());
7360
+ const days = match ? Number(match[1]) : NaN;
7361
+ return Number.isInteger(days) && days >= 1 && days <= 90 ? days : undefined;
7362
+ }
7363
+ function daysBackAcceptsAll(handler) {
7364
+ return specsOf(handler).some((spec) => {
7365
+ return schemaShape(spec.schema).days_back?.safeParse("all").success === true;
7366
+ });
7367
+ }
7368
+ function foldWindowFlag(handler, route, ...targets) {
7369
+ const flags = targets[0];
7370
+ const accepted = new Set([
7371
+ ...specsOf(handler).flatMap((spec) => specFlagNames(spec)),
7372
+ ...route?.allowedFlags ?? []
7373
+ ]);
7374
+ const takesDays = accepted.has("days-back");
7375
+ const takesRange = accepted.has("time-range");
7376
+ if (takesDays === takesRange)
7377
+ return;
7378
+ const [from, to] = takesRange ? ["days-back", "time-range"] : ["time-range", "days-back"];
7379
+ const raw = flags[from];
7380
+ if (raw === undefined || raw === "true" || raw.trim() === "")
7381
+ return;
7382
+ const shown = canonicalCommandText(`moda ${route?.leaf.path ?? handler}`);
7383
+ if (flags[to] !== undefined) {
7384
+ throw new CliInputError(`Pass one time window: --${to} or --${from}, not both.`, `'${shown}' takes --${to}. See '${shown} --help'.`, `conflicting_window:${from}`, { field: `--${from}`, suggestedCommands: [`${shown} --help`] });
7385
+ }
7386
+ let value;
7387
+ if (takesRange) {
7388
+ value = /^\d+$/.test(raw.trim()) ? DAYS_TO_TIME_RANGE[Number(raw.trim())] : undefined;
7389
+ } else if (raw.trim() === "all" && daysBackAcceptsAll(handler)) {
7390
+ value = "all";
7391
+ } else {
7392
+ const days = timeRangeAsDays(raw);
7393
+ value = days === undefined ? undefined : String(days);
7394
+ }
7395
+ if (value === undefined) {
7396
+ const allowed = takesRange ? Object.values(DAYS_TO_TIME_RANGE).map((range) => `--time-range=${range}`) : ["--days-back=N (1-90)"];
7397
+ throw new CliInputError(`--${from}=${raw} has no exact --${to} equivalent for '${shown}', so nothing was run.`, takesRange ? `'${shown}' takes --time-range=1h|24h|3d|7d|30d|90d|all; --days-back maps only to 1, 3, 7, 30 or 90 days.` : `'${shown}' takes --days-back=N (1-90); --time-range maps only to 24h or a whole number of days up to 90d.`, `unknown_flag:${from}`, { field: `--${from}`, allowed, suggestedCommands: [`${shown} --help`] });
7398
+ }
7399
+ for (const target of new Set(targets)) {
7400
+ delete target[from];
7401
+ target[to] = value;
7402
+ }
7403
+ return from;
7404
+ }
7355
7405
  var EMPTY_VALUE_ALLOWED = {
7356
7406
  context: new Set(["msg-index", "message-index"])
7357
7407
  };
@@ -7416,6 +7466,8 @@ async function dispatchParsedCommandInner(typedParsed, startedAt) {
7416
7466
  canonicalizeFlagKeys(flags, typedParsed.bareFlags);
7417
7467
  const switchError = normalizeBooleanFlags(flags);
7418
7468
  const typedFlags = stripUpdateCheckFlag(stripTelemetryFlag(flags));
7469
+ const reportedFlags = { ...typedFlags };
7470
+ let foldedWindowFlag;
7419
7471
  const telemetryDisabled = isTelemetryDisabled(flags);
7420
7472
  if (telemetryDisabled)
7421
7473
  discardSpoolOnEnvOptOut();
@@ -7506,7 +7558,7 @@ async function dispatchParsedCommandInner(typedParsed, startedAt) {
7506
7558
  apiKey: input.apiKey ?? resolveApiKey({ profile: telemetryProfile }),
7507
7559
  profile: telemetryProfile,
7508
7560
  command: identity2?.command ?? handlerTelemetry,
7509
- flags: typedFlags,
7561
+ flags: reportedFlags,
7510
7562
  status: input.status,
7511
7563
  ...input.error !== undefined ? { errorType: classifyCliError(input.error), validationReason: cliValidationReason(input.error) } : {},
7512
7564
  exitCode: input.exitCode,
@@ -7514,7 +7566,7 @@ async function dispatchParsedCommandInner(typedParsed, startedAt) {
7514
7566
  apiRequestCount: input.apiRequestCount,
7515
7567
  adoption,
7516
7568
  ...identity2?.legacyAlias ? { legacyAlias: identity2.legacyAlias } : {},
7517
- acceptedFlags: telemetryAcceptedFlags(definition2, route),
7569
+ acceptedFlags: new Set([...telemetryAcceptedFlags(definition2, route), ...foldedWindowFlag ? [foldedWindowFlag] : []]),
7518
7570
  knownFlags: telemetryKnownFlags()
7519
7571
  });
7520
7572
  };
@@ -7556,6 +7608,7 @@ async function dispatchParsedCommandInner(typedParsed, startedAt) {
7556
7608
  if (switchError)
7557
7609
  return failEarly(switchError, definition, identity);
7558
7610
  try {
7611
+ foldedWindowFlag = foldWindowFlag(route?.handler ?? definition.name, route, typedFlags, commandFlags);
7559
7612
  if (route)
7560
7613
  assertRoutedFlags(route, typedFlags);
7561
7614
  assertFlagValues(definition.name, parsed.positionals, typedFlags, typedParsed.bareFlags, route);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda-ai/cli",
3
- "version": "1.55.31",
3
+ "version": "1.55.32",
4
4
  "description": "CLI for Moda: production monitoring and evals for AI agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": "moda.skill_index.v1",
3
- "bundled_at": "2026-10-17T00:31:13.506Z",
4
- "cli_version": "1.55.31",
3
+ "bundled_at": "2026-10-17T02:32:13.042Z",
4
+ "cli_version": "1.55.32",
5
5
  "skills": [
6
6
  {
7
7
  "id": "integration-cloudflare-think",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: moda-cli
3
- version: 3.0.0
3
+ version: 3.0.1
4
4
  description: Investigate a production AI agent with the Moda CLI (`moda`) - find where something happened in real traces (traces search, then traces get), check agent health, rank what to fix (investigate, problems), and dig into tool failures, user frustration, and hallucinations. Also prompt registry sync/promote, replays, custom signals, and false-positive marking. Use when the user mentions Moda, production traces or conversations of their agent, agent failures, or asks what to fix.
5
5
  ---
6
6
 
@@ -74,7 +74,9 @@ Details: `references/output-protocol.md`.
74
74
 
75
75
  Time windows differ by command: `--days-back=N` (1-90) on overview,
76
76
  investigate, problems, and detection commands; `--time-range=1h|24h|3d|7d|30d|90d|all`
77
- on search, traces, and clusters. `moda <noun> <verb> --help` shows which.
77
+ on search, traces, and clusters. The other spelling works when it names the
78
+ same span (`--days-back=7` is `--time-range=7d`); anything else fails and
79
+ names the closest values. `moda <noun> <verb> --help` shows which.
78
80
 
79
81
  ## Fixing a Problem
80
82
 
@@ -237,8 +237,12 @@ Treat an answer as degraded if **any** of these hold:
237
237
 
238
238
  #### Time-window flags by command
239
239
 
240
- A command rejects the window flag it doesn't take, and out-of-range values
241
- fail instead of being clamped.
240
+ A command takes one window flag. The other spelling is rewritten when it names
241
+ the same span: `--days-back=1|3|7|30|90` is `--time-range=24h|3d|7d|30d|90d`,
242
+ and `--time-range=24h` or `Nd` (up to 90d) is `--days-back`. A value with no
243
+ exact match (`--days-back=14` on `traces search`, `--time-range=all` or `1h`
244
+ on a detection command) fails, as does passing both. Out-of-range values fail
245
+ instead of being clamped.
242
246
 
243
247
  | Flag | Commands | Allowed values | Default |
244
248
  | --- | --- | --- | --- |