@moda-ai/cli 1.55.40 → 1.55.42

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 (28) hide show
  1. package/dist/{agent-ck6y31n2.js → agent-86hghww1.js} +4 -4
  2. package/dist/{cli-f1jfrqgf.js → cli-4sy4tytm.js} +218 -15
  3. package/dist/{cli-4tg0hkbz.js → cli-he8csgsr.js} +6 -6
  4. package/dist/{cli-ypqwcf9n.js → cli-hjm9151g.js} +2 -2
  5. package/dist/{cli-7bn406mt.js → cli-mxfyq5nq.js} +1 -1
  6. package/dist/{cli-a8nxbtpk.js → cli-srwzar82.js} +2 -2
  7. package/dist/{cli-azage7s0.js → cli-vwpbspr5.js} +2 -2
  8. package/dist/cli.js +172 -37
  9. package/dist/{doctor-p8sp6cbk.js → doctor-c05njdv8.js} +3 -3
  10. package/dist/{fix-0r974yge.js → fix-aghp304m.js} +1 -1
  11. package/dist/{harness-github-actions-2qc4gg2w.js → harness-github-actions-112503xs.js} +2 -2
  12. package/dist/{harness-72ejenza.js → harness-vabp33ak.js} +2 -2
  13. package/dist/{index-w7v472w4.js → index-dtxvvcq2.js} +5 -5
  14. package/dist/{production-intelligence-hs2sm8t5.js → production-intelligence-e5vsc6cw.js} +140 -27
  15. package/dist/{prompt-attribution-3987hhqz.js → prompt-attribution-pbns1ya3.js} +2 -2
  16. package/dist/prompt-source-mcp.js +2 -2
  17. package/dist/{prompts-ab-gmd10n5d.js → prompts-ab-f5qrvpkt.js} +3 -3
  18. package/dist/{prompts-propose-q626zmm4.js → prompts-propose-jg2j41wx.js} +3 -3
  19. package/dist/{prompts-ysm9ra72.js → prompts-qppk0mhp.js} +2 -2
  20. package/dist/{registry-7xz09ry0.js → registry-8a1940sr.js} +1 -1
  21. package/dist/{skills-x6yszxxn.js → skills-sh93b156.js} +2 -2
  22. package/dist/{sync-trjzvam9.js → sync-0pp1c8hs.js} +4 -4
  23. package/package.json +1 -1
  24. package/skills/integration/index.json +2 -2
  25. package/skills/moda-cli/SKILL.md +4 -3
  26. package/skills/moda-cli/references/commands.md +4 -1
  27. package/skills/moda-cli/references/dashboard-parity.md +4 -2
  28. package/skills/moda-cli/references/production-intelligence.md +5 -1
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-a8nxbtpk.js";
3
+ } from "./cli-srwzar82.js";
4
4
  import"./cli-pmzh2qjy.js";
5
- import"./cli-4tg0hkbz.js";
5
+ import"./cli-he8csgsr.js";
6
6
  import"./cli-mm48br00.js";
7
7
  import {
8
8
  readHarnessSyncState
@@ -16,7 +16,7 @@ import {
16
16
  validateHarnessReport
17
17
  } from "./cli-cesds766.js";
18
18
  import"./cli-xddtv3yn.js";
19
- import"./cli-f1jfrqgf.js";
19
+ import"./cli-4sy4tytm.js";
20
20
  import"./cli-0xc5htv7.js";
21
21
  import {
22
22
  resolveApiKey,
@@ -94,7 +94,7 @@ async function buildAgentContext(context) {
94
94
  const graph = readHarnessGraphIfPresent(context.cwd);
95
95
  const reportState = readHarnessReportState(context.cwd);
96
96
  const syncState = readHarnessSyncState(context.cwd);
97
- const harness = graph ? await import("./harness-72ejenza.js") : undefined;
97
+ const harness = graph ? await import("./harness-vabp33ak.js") : undefined;
98
98
  const topFindings = doctor.checks.filter((check) => check.status === "fail" || check.status === "warning").slice(0, 12).map(checkToFinding);
99
99
  const evidenceRefs = [
100
100
  ...doctor.checks.map(checkToEvidenceRef),
@@ -36,6 +36,10 @@ var daysBackFlag = (fallback) => {
36
36
  var ISO_BOUND_MESSAGE = "must be an ISO 8601 date (2026-10-07) or datetime (2026-10-07T14:30:00Z)";
37
37
  var ISO_BOUND = /^\d{4}-\d{2}-\d{2}(?:[Tt ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:[Zz]|[+-]\d{2}:?\d{2})?)?$/;
38
38
  var isoBoundFlag = () => z.string().trim().regex(ISO_BOUND, ISO_BOUND_MESSAGE).optional();
39
+ var COHORT_REF = /^(all|builtin:[a-z_]{1,64}|[a-z_]{1,64}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
40
+ var COHORT_REF_MESSAGE = "must be builtin:<key> or a saved cohort id (see moda cohorts list)";
41
+ var cohortFlag = (description) => z.string().regex(COHORT_REF, COHORT_REF_MESSAGE).optional().describe(description);
42
+ var CLUSTER_COHORT_TIME_RANGES = ["all", "3d", "7d", "30d"];
39
43
  var OverviewSchema = z.object({
40
44
  days_back: daysBackFlag(7)
41
45
  });
@@ -45,7 +49,8 @@ var ClustersSchema = z.object({
45
49
  search: z.string().min(2).max(200).optional().describe("Find clusters by name or meaning"),
46
50
  node_id: z.string().min(1).max(512).optional().describe("Resolve one cluster node by id (deep link)"),
47
51
  mode: z.enum(["fuzzy", "semantic", "hybrid"]).optional().describe("Cluster search mode (server default hybrid)"),
48
- limit: z.number().int().min(1).max(50).optional().describe("Maximum clusters to return (with --search/--node-id)")
52
+ limit: z.number().int().min(1).max(50).optional().describe("Maximum clusters to return (with --search/--node-id)"),
53
+ cohort: cohortFlag("Only the clusters this cohort's users reach, with its segment counts (builtin:<key> or a saved cohort id); --time-range all|3d|7d|30d")
49
54
  });
50
55
  var ClusterConversationsSchema = z.object({
51
56
  node_id: z.string().describe("Cluster node id (from moda clusters)"),
@@ -64,6 +69,7 @@ var ConversationsSchema = z.object({
64
69
  outcome: z.enum(["any", "positive", "negative"]).default("any").optional().describe("Filter by trace outcome (trajectory + frustration)"),
65
70
  include_world_state: boolFlag().describe("Attach each result's world-state summary"),
66
71
  sort: z.enum(["recent", "longest", "slowest"]).optional().describe("recent = newest activity, longest = most messages, slowest = longest span"),
72
+ cohort: cohortFlag("Only traces of this cohort's current members (builtin:<key> or a saved cohort id)"),
67
73
  limit: z.number().int().min(1).max(100).default(20).optional().describe("Maximum traces to return"),
68
74
  offset: z.number().int().min(0).default(0).optional().describe("Number of traces to skip")
69
75
  });
@@ -124,12 +130,13 @@ var emotionTraceFilters = {
124
130
  trajectory: z.enum(EMOTION_TRAJECTORIES).optional().describe("How the emotion moved over the trace; needs --group-by=trace"),
125
131
  signal: emotionSignalsFlag(),
126
132
  sort: z.enum(EMOTION_TRACE_SORTS).optional().describe("Trace order (default score); needs --group-by=trace"),
127
- order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc); needs --group-by=trace")
133
+ order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc); needs --group-by=trace"),
134
+ cohort: cohortFlag("Only traces of this cohort's members, summary included (builtin:<key> or a saved cohort id); implies --group-by=trace")
128
135
  };
129
136
  var TRACE_GRAIN_FLAGS = {
130
- emotions: ["search", "status", "elicitor", "trajectory", "signal", "sort", "order"],
131
- frustrations: ["search", "status", "elicitor", "trajectory", "signal", "sort", "order"],
132
- hallucinations: ["search", "status", "rule", "source", "sort", "order"]
137
+ emotions: ["search", "status", "elicitor", "trajectory", "signal", "sort", "order", "cohort"],
138
+ frustrations: ["search", "status", "elicitor", "trajectory", "signal", "sort", "order", "cohort"],
139
+ hallucinations: ["search", "status", "rule", "source", "sort", "order", "cohort"]
133
140
  };
134
141
  var MAX_CONVERSATION_IDS_FILTER = 50;
135
142
  var conversationIdsFlag = () => z.string().min(1).max(MAX_CONVERSATION_IDS_FILTER * 257).optional().describe(`Scope everything to several trace IDs, comma-separated (up to ${MAX_CONVERSATION_IDS_FILTER}; or --ids-from)`);
@@ -147,14 +154,14 @@ var FrustrationsSchema = z.object({
147
154
  ids_from: idsFromFilterFlag()
148
155
  });
149
156
  var ToolFailuresSchema = z.object({
150
- days_back: daysBackFlag(7)
157
+ days_back: daysBackFlag(7),
158
+ cohort: cohortFlag("The dashboard Tool Failures leaderboard for this cohort's traces (builtin:<key> or a saved cohort id)")
151
159
  });
152
160
  var PROBLEM_LIST_VIEWS = ["auto", "book", "dream"];
153
161
  var BOOK_PROBLEM_SORTS = ["rank", "users", "signals", "problems"];
154
162
  var DREAM_PROBLEM_SORTS = ["severity", "users", "silent"];
155
163
  var PROBLEMS_MAX_LIMIT = 200;
156
164
  var PROBLEMS_DEFAULT_LIMIT = 10;
157
- var COHORT_REF = /^(all|builtin:[a-z_]{1,64}|[a-z_]{1,64}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
158
165
  var ProblemsSchema = z.object({
159
166
  view: z.enum(PROBLEM_LIST_VIEWS).default("auto").optional().describe("auto: what the dashboard shows (the dream grouping when published, else the Book); book or dream to force one"),
160
167
  days_back: daysBackFlag().describe("Whole days to look back (Book default 30; the dream view defaults to its run window)"),
@@ -163,7 +170,7 @@ var ProblemsSchema = z.object({
163
170
  list_version: z.string().regex(/^[0-9a-f]{1,64}$/, "must be the list_version of a previous page").optional().describe("list_version of the first page, passed with every later --offset"),
164
171
  sort: z.string().regex(/^(rank|severity|users|signals|problems|silent|signal:[a-z_]{1,64})$/, "must be rank, severity, users, silent (dream), signals, problems or signal:<family> (Book)").optional().describe("Order: rank (default), users; dream: severity, silent; Book: signals, problems, signal:<family>"),
165
172
  dir: z.enum(["desc", "asc"]).optional().describe("Sort direction (default desc)"),
166
- cohort: z.string().regex(COHORT_REF, "must be builtin:<key> or a saved cohort id").optional().describe("Only the Problems this cohort hit (builtin:<key> or a saved cohort id), with its counts")
173
+ cohort: cohortFlag("Only the Problems this cohort hit (builtin:<key> or a saved cohort id), with its counts")
167
174
  });
168
175
  var REMAINDER_FAMILIES = [
169
176
  "tool_failure",
@@ -248,7 +255,8 @@ var SignalSchema = z.object({
248
255
  detections: boolFlag().describe("List recent hits instead of the summary"),
249
256
  days_back: daysBackFlag(),
250
257
  limit: z.number().int().min(1).max(20).optional().describe("Hits page size (server default 10)"),
251
- offset: z.number().int().min(0).max(1e4).optional().describe("Number of hits to skip")
258
+ offset: z.number().int().min(0).max(1e4).optional().describe("Number of hits to skip"),
259
+ cohort: cohortFlag("Only hits on traces of this cohort's members (builtin:<key> or a saved cohort id); with --detections")
252
260
  });
253
261
  var SIGNAL_LABELS = ["fits", "does_not_fit"];
254
262
  var SignalLabelSchema = z.object({
@@ -342,7 +350,8 @@ var HallucinationsSchema = z.object({
342
350
  rule: z.string().trim().min(1).max(200).optional().describe("One rule_id from summary.rule_breakdown; scopes the summary too; needs --group-by=trace"),
343
351
  source: z.enum(HALLUCINATION_SOURCES).optional().describe("Only detections from this source; needs --group-by=trace"),
344
352
  sort: z.enum(HALLUCINATION_TRACE_SORTS).optional().describe("Trace order (default contradicted_count); needs --group-by=trace"),
345
- order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc); needs --group-by=trace")
353
+ order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc); needs --group-by=trace"),
354
+ cohort: cohortFlag("Only traces of this cohort's members, summary included (builtin:<key> or a saved cohort id); implies --group-by=trace")
346
355
  });
347
356
  var LAZINESS_FAMILIES = [
348
357
  "omission_comment",
@@ -377,7 +386,8 @@ var LazinessSchema = z.object({
377
386
  search: z.string().trim().min(1).max(200).optional().describe("Trace ID substring"),
378
387
  status: z.enum(["all", "strong"]).optional().describe("all (default), or strong: traces with a high-confidence detection"),
379
388
  sort: z.enum(LAZINESS_TRACE_SORTS).optional().describe("Trace order (default detections_count)"),
380
- order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc)")
389
+ order: z.enum(SORT_ORDERS).optional().describe("Sort direction (default desc)"),
390
+ cohort: cohortFlag("Only traces of this cohort's members (builtin:<key> or a saved cohort id); not with --conversation-id")
381
391
  });
382
392
  var StepScoresSchema = z.object({
383
393
  conversation_id: z.string().min(1).describe("Trace ID")
@@ -489,7 +499,7 @@ var UsersSchema = z.object({
489
499
  page_size: z.number().int().min(1).optional().describe("Users per page"),
490
500
  limit: z.number().int().min(1).optional().describe("Alias of --page-size"),
491
501
  search: z.string().optional().describe("Match user id or name"),
492
- cohort: z.enum(USER_COHORTS).optional().describe("Only users in this cohort"),
502
+ cohort: cohortFlag(`Only users in this cohort: builtin:<key>, a saved cohort id, or a built-in key (${USER_COHORTS.filter((key) => key !== "all").join(", ")})`),
493
503
  sort: z.enum(USER_SORTS).optional().describe("Sort field"),
494
504
  order: z.enum(["asc", "desc"]).optional().describe("Sort order"),
495
505
  health_status: z.string().optional().describe(`Comma-separated health states (${USER_HEALTH.join(", ")})`),
@@ -510,6 +520,52 @@ var ProblemReopenSchema = z.object({
510
520
  reason: z.string().max(500).optional().describe("Why it is being reopened"),
511
521
  dry_run: boolFlag().describe("Print the request and send nothing")
512
522
  });
523
+ var COHORT_COLORS = ["neutral", "blue", "green", "amber", "red", "violet"];
524
+ var COHORT_COMPARE_DAYS = ["7", "30", "90"];
525
+ var cohortTenant = () => z.string().optional().describe("Tenant to read; must match the API key's tenant");
526
+ var cohortRef = (description) => z.string().regex(COHORT_REF, COHORT_REF_MESSAGE).describe(description);
527
+ var cohortDefinitionFlags = {
528
+ definition: z.string().optional().describe("Cohort definition (DSL v1) as inline JSON; see moda cohorts fields"),
529
+ file: z.string().optional().describe("JSON file with the definition, or a body with a definition key")
530
+ };
531
+ var CohortsListSchema = z.object({
532
+ include_archived: boolFlag().describe("Also list archived saved cohorts"),
533
+ tenant_id: cohortTenant()
534
+ });
535
+ var CohortGetSchema = z.object({
536
+ ref: cohortRef("builtin:<key> or a saved cohort id"),
537
+ tenant_id: cohortTenant()
538
+ });
539
+ var CohortFieldsSchema = z.object({
540
+ tenant_id: cohortTenant()
541
+ });
542
+ var CohortPreviewSchema = z.object({
543
+ ...cohortDefinitionFlags,
544
+ tenant_id: cohortTenant()
545
+ });
546
+ var CohortCompareSchema = z.object({
547
+ a: cohortRef("First cohort: builtin:<key> or a saved cohort id"),
548
+ b: cohortRef("Second cohort: builtin:<key> or a saved cohort id"),
549
+ days: z.enum(COHORT_COMPARE_DAYS).optional().describe("Window for top topics and failure mix (server default 30)"),
550
+ tenant_id: cohortTenant()
551
+ });
552
+ var cohortFieldFlags = {
553
+ name: z.string().max(120).optional().describe("Cohort name"),
554
+ description: z.string().max(2000).optional().describe("Cohort description"),
555
+ ...cohortDefinitionFlags,
556
+ pinned: boolFlag().describe("Pin the cohort on the Users page"),
557
+ color: z.enum(COHORT_COLORS).optional().describe("Pill color")
558
+ };
559
+ var CohortCreateSchema = z.object({
560
+ ...cohortFieldFlags,
561
+ tenant_id: cohortTenant()
562
+ });
563
+ var CohortUpdateSchema = z.object({
564
+ id: z.string().regex(UUID_RE, "must be a saved cohort id (UUID); built-in cohorts cannot be edited").describe("Saved cohort id"),
565
+ ...cohortFieldFlags,
566
+ note: z.string().max(500).optional().describe("Why it changed (kept with the revision)"),
567
+ tenant_id: cohortTenant()
568
+ });
513
569
 
514
570
  // ../../packages/database/src/agent-feedback.ts
515
571
  var FEEDBACK_CATEGORIES = [
@@ -716,7 +772,18 @@ var COMMAND_FLAG_SPECS = {
716
772
  positionals: [{ name: "note", key: "note", required: true, variadic: true, alsoFlag: true }]
717
773
  },
718
774
  users: { schema: UsersSchema, handParsed: true },
719
- user: { schema: UserSchema, handParsed: true, positionals: [{ name: "user_id", key: "user_id", required: true }] }
775
+ user: { schema: UserSchema, handParsed: true, positionals: [{ name: "user_id", key: "user_id", required: true }] },
776
+ "cohort-list": { schema: CohortsListSchema, handParsed: true },
777
+ "cohort-get": { schema: CohortGetSchema, handParsed: true, positionals: [{ name: "ref", key: "ref", required: true }] },
778
+ "cohort-fields": { schema: CohortFieldsSchema, handParsed: true },
779
+ "cohort-preview": { schema: CohortPreviewSchema, handParsed: true },
780
+ "cohort-compare": {
781
+ schema: CohortCompareSchema,
782
+ handParsed: true,
783
+ positionals: [{ name: "cohort_a", key: "a", required: true }, { name: "cohort_b", key: "b", required: true }]
784
+ },
785
+ "cohort-create": { schema: CohortCreateSchema, extra: DRY_RUN, handParsed: true },
786
+ "cohort-update": { schema: CohortUpdateSchema, extra: DRY_RUN, handParsed: true, positionals: [{ name: "cohort_id", key: "id", required: true }] }
720
787
  };
721
788
  function flagSpecFor(command) {
722
789
  return Object.hasOwn(COMMAND_FLAG_SPECS, command) ? COMMAND_FLAG_SPECS[command] : undefined;
@@ -1063,6 +1130,14 @@ function oneOf(name, value, allowed) {
1063
1130
  }
1064
1131
  return value;
1065
1132
  }
1133
+ function cohortRefFlag(value) {
1134
+ if (value === undefined)
1135
+ return;
1136
+ if (!COHORT_REF.test(value)) {
1137
+ throw new CliInputError(`--cohort must be builtin:<key> or a saved cohort id (got '${value}').`, "List the refs with `moda cohorts list`.");
1138
+ }
1139
+ return value;
1140
+ }
1066
1141
  function csv(value) {
1067
1142
  if (value === undefined)
1068
1143
  return;
@@ -1116,7 +1191,7 @@ async function runUsersCommand(context) {
1116
1191
  page: flags.page,
1117
1192
  pageSize: flags["page-size"] ?? flags.limit,
1118
1193
  search: flags.search,
1119
- cohort: oneOf("cohort", flags.cohort, USER_COHORTS),
1194
+ cohort: cohortRefFlag(flags.cohort),
1120
1195
  sortBy: oneOf("sort", flags.sort, USER_SORTS),
1121
1196
  sortOrder: oneOf("order", flags.order, ["asc", "desc"]),
1122
1197
  healthStatus: csv(flags["health-status"])?.map((value) => oneOf("health-status", value, HEALTH)).join(","),
@@ -1146,6 +1221,134 @@ async function runUserCommand(context) {
1146
1221
  await send(context, "control", "GET", `/tenants/${encodeURIComponent(tenantId)}/users/${encodeURIComponent(userId)}${suffix}`);
1147
1222
  return { exitCode: 0 };
1148
1223
  }
1224
+ var COHORT_DEFINITION_HINT = 'A definition is {"version":1,"window":"24h|7d|30d|90d","where":{...}}; `moda cohorts fields` lists the fields and operators.';
1225
+ function cohortsBase(context) {
1226
+ return `/tenants/${encodeURIComponent(requireTenant(context))}/cohorts`;
1227
+ }
1228
+ function cohortRefArg(value, what, usage) {
1229
+ if (!value)
1230
+ throw new CliInputError(`${what} is required.`, `Usage: ${usage}`);
1231
+ if (!COHORT_REF.test(value)) {
1232
+ throw new CliInputError(`${what} must be builtin:<key> or a saved cohort id (got '${value}').`, "List the refs with `moda cohorts list`.");
1233
+ }
1234
+ return value;
1235
+ }
1236
+ function cohortBodyInput(flags, cwd) {
1237
+ const fromFile = readBodyFile(flags, cwd);
1238
+ const body = Object.keys(fromFile).length === 0 ? {} : ("definition" in fromFile) ? fromFile : { definition: fromFile };
1239
+ if (flags.definition !== undefined) {
1240
+ let parsed;
1241
+ try {
1242
+ parsed = JSON.parse(flags.definition);
1243
+ } catch (error) {
1244
+ throw new CliInputError(`--definition is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, COHORT_DEFINITION_HINT);
1245
+ }
1246
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
1247
+ throw new CliInputError("--definition must be a JSON object.", COHORT_DEFINITION_HINT);
1248
+ body.definition = parsed;
1249
+ }
1250
+ if (body.definition !== undefined && (!body.definition || typeof body.definition !== "object" || Array.isArray(body.definition))) {
1251
+ throw new CliInputError("The cohort definition must be a JSON object.", COHORT_DEFINITION_HINT);
1252
+ }
1253
+ return body;
1254
+ }
1255
+ function cohortFieldBody(flags, cwd) {
1256
+ const pinned = flags.pinned === undefined ? undefined : oneOf("pinned", flags.pinned, ["true", "false", "1", "0", "yes", "no"]);
1257
+ return {
1258
+ ...cohortBodyInput(flags, cwd),
1259
+ ...compact({
1260
+ name: flags.name,
1261
+ description: flags.description,
1262
+ pinned: pinned === undefined ? undefined : ["true", "1", "yes"].includes(pinned),
1263
+ color: oneOf("color", flags.color, COHORT_COLORS)
1264
+ })
1265
+ };
1266
+ }
1267
+ var COHORT_COMMANDS = {
1268
+ "cohort-list": { path: "cohorts list", usage: "moda cohorts list [--include-archived]" },
1269
+ "cohort-get": { path: "cohorts get", usage: "moda cohorts get <ref>" },
1270
+ "cohort-fields": { path: "cohorts fields", usage: "moda cohorts fields" },
1271
+ "cohort-preview": { path: "cohorts preview", usage: "moda cohorts preview --file=<path> | --definition=<json>" },
1272
+ "cohort-compare": { path: "cohorts compare", usage: "moda cohorts compare <cohort_a> <cohort_b> [--days=7|30|90]" },
1273
+ "cohort-create": { path: "cohorts create", usage: "moda cohorts create --name=NAME --file=<path>|--definition=<json> [--description --pinned --color] [--dry-run]" },
1274
+ "cohort-update": { path: "cohorts update", usage: "moda cohorts update <cohort_id> [--name --description --file|--definition --pinned --color --note] [--dry-run]" }
1275
+ };
1276
+ async function runCohortCommand(context) {
1277
+ const flags = context.flags;
1278
+ const command = COHORT_COMMANDS[context.command];
1279
+ if (!command)
1280
+ throw new CliInputError(`Unknown cohorts command '${context.command}'.`, "Run 'moda cohorts --help'.");
1281
+ const spec = flagSpecFor(context.command);
1282
+ assertFlags(command.path, flags, spec ? specFlagNames(spec) : []);
1283
+ assertPositionals(command.path, context.positionals, spec?.positionals?.length ?? 0, command.usage);
1284
+ const [first, second] = context.positionals;
1285
+ switch (context.command) {
1286
+ case "cohort-list": {
1287
+ requireKey(context);
1288
+ const archived = flags["include-archived"];
1289
+ const query = archived !== undefined && archived !== "false" && archived !== "0" ? "?includeArchived=1" : "";
1290
+ await send(context, "control", "GET", `${cohortsBase(context)}${query}`);
1291
+ return { exitCode: 0 };
1292
+ }
1293
+ case "cohort-get": {
1294
+ const ref = cohortRefArg(first, "<ref>", "moda cohorts get <ref>");
1295
+ requireKey(context);
1296
+ await send(context, "control", "GET", `${cohortsBase(context)}/${encodeURIComponent(ref)}`);
1297
+ return { exitCode: 0 };
1298
+ }
1299
+ case "cohort-fields": {
1300
+ requireKey(context);
1301
+ await send(context, "control", "GET", `${cohortsBase(context)}/fields`);
1302
+ return { exitCode: 0 };
1303
+ }
1304
+ case "cohort-preview": {
1305
+ const { definition } = cohortBodyInput(flags, context.cwd);
1306
+ if (definition === undefined)
1307
+ throw new CliInputError("Pass the definition with --file=<path> or --definition=<json>.", COHORT_DEFINITION_HINT);
1308
+ requireKey(context);
1309
+ const data = await callControlAPI(`${cohortsBase(context)}/preview`, { method: "POST", body: JSON.stringify({ definition }) }, profileOptions(context));
1310
+ context.output.writeData(data ?? {});
1311
+ return { exitCode: 0 };
1312
+ }
1313
+ case "cohort-compare": {
1314
+ const usage = "moda cohorts compare <cohort_a> <cohort_b> [--days=7|30|90]";
1315
+ const a = cohortRefArg(first, "<cohort_a>", usage);
1316
+ const b = cohortRefArg(second, "<cohort_b>", usage);
1317
+ const days = oneOf("days", flags.days, COHORT_COMPARE_DAYS);
1318
+ requireKey(context);
1319
+ const query = new URLSearchParams(compact({ a, b, days }));
1320
+ await send(context, "control", "GET", `${cohortsBase(context)}/compare?${query.toString()}`);
1321
+ return { exitCode: 0 };
1322
+ }
1323
+ case "cohort-create": {
1324
+ const body = cohortFieldBody(flags, context.cwd);
1325
+ const missing = ["name", "definition"].filter((field) => body[field] === undefined);
1326
+ if (missing.length > 0) {
1327
+ throw new CliInputError(`Missing ${missing.join(" and ")} for cohorts create, so nothing was sent.`, `Pass --name and --file=<definition.json> (or --definition=<json>). ${COHORT_DEFINITION_HINT} Check the members first with \`moda cohorts preview\`.`);
1328
+ }
1329
+ requireKey(context);
1330
+ await send(context, "control", "POST", cohortsBase(context), body);
1331
+ return { exitCode: 0 };
1332
+ }
1333
+ case "cohort-update": {
1334
+ const usage = "moda cohorts update <cohort_id> [--name --description --file|--definition --pinned --color --note] [--dry-run]";
1335
+ if (!first)
1336
+ throw new CliInputError("<cohort_id> is required.", `Usage: ${usage}`);
1337
+ if (!UUID_RE2.test(first)) {
1338
+ throw new CliInputError(`<cohort_id> must be a saved cohort id (UUID), got '${first}'. Built-in cohorts cannot be edited.`, "List saved cohorts with `moda cohorts list`.");
1339
+ }
1340
+ const body = { ...cohortFieldBody(flags, context.cwd), ...compact({ note: flags.note }) };
1341
+ if (Object.keys(body).filter((key) => key !== "note").length === 0) {
1342
+ throw new CliInputError("Nothing to update, so nothing was sent: pass at least one of --name, --description, --file/--definition, --pinned or --color.", `Usage: ${usage}`);
1343
+ }
1344
+ requireKey(context);
1345
+ await send(context, "control", "PATCH", `${cohortsBase(context)}/${encodeURIComponent(first)}`, body);
1346
+ return { exitCode: 0 };
1347
+ }
1348
+ default:
1349
+ throw new CliInputError(`Unknown cohorts command '${context.command}'.`, "Run 'moda cohorts --help'.");
1350
+ }
1351
+ }
1149
1352
  async function runProblemReopenCommand(context) {
1150
1353
  assertFlags("problem-reopen", context.flags, specFlagNames(COMMAND_FLAG_SPECS["problem-reopen"]));
1151
1354
  assertPositionals("problem-reopen", context.positionals, 1, "moda problems reopen <problem_id> [--reason=TEXT]");
@@ -1447,4 +1650,4 @@ function unknownSignalsSubcommandError(sub, args = []) {
1447
1650
  ${SIGNAL_USAGE}`);
1448
1651
  }
1449
1652
 
1450
- export { TRACE_GRAIN_FLAGS, MAX_CONVERSATION_IDS_FILTER, BOOK_PROBLEM_SORTS, DREAM_PROBLEM_SORTS, PROBLEMS_MAX_LIMIT, PROBLEMS_DEFAULT_LIMIT, ProblemsRemainderSchema, UUID_RE, ProblemImpactSchema, PROBLEM_FEEDBACK_ACTIONS, ProblemFeedbackSchema, ProblemLinearFileSchema, SignalLabelSchema, DETECTION_VERDICTS, DetectionReviewSchema, FALSE_POSITIVE_KINDS, FalsePositiveSchema, EMOTION_FAMILIES, LAZINESS_FAMILIES, StepScoresSchema, AuditSchema, TraceFindingsSchema, FEEDBACK_USAGE, isFeedbackRefFlag, buildFeedbackRequest, writeDryRun, COMMAND_FLAG_SPECS, flagSpecFor, kebabFlag, schemaShape, describeField, specFlagKeys, specFlagNames, describeSpecFlags, closestMatches, usageLine, renderFlagHelp, subcommandHelpFlags, manifestFlagFields, requireTenant, assertFlags, assertPositionals, runUsersCommand, runUserCommand, runProblemReopenCommand, runSignalsManagementCommand, SIGNALS_MANAGEMENT_SUBCOMMANDS, unknownSignalsSubcommandError };
1653
+ export { CLUSTER_COHORT_TIME_RANGES, TRACE_GRAIN_FLAGS, MAX_CONVERSATION_IDS_FILTER, BOOK_PROBLEM_SORTS, DREAM_PROBLEM_SORTS, PROBLEMS_MAX_LIMIT, PROBLEMS_DEFAULT_LIMIT, ProblemsRemainderSchema, UUID_RE, ProblemImpactSchema, PROBLEM_FEEDBACK_ACTIONS, ProblemFeedbackSchema, ProblemLinearFileSchema, SignalLabelSchema, DETECTION_VERDICTS, DetectionReviewSchema, FALSE_POSITIVE_KINDS, FalsePositiveSchema, EMOTION_FAMILIES, LAZINESS_FAMILIES, StepScoresSchema, AuditSchema, TraceFindingsSchema, FEEDBACK_USAGE, isFeedbackRefFlag, buildFeedbackRequest, writeDryRun, COMMAND_FLAG_SPECS, flagSpecFor, kebabFlag, schemaShape, describeField, specFlagKeys, specFlagNames, describeSpecFlags, closestMatches, usageLine, renderFlagHelp, subcommandHelpFlags, manifestFlagFields, requireTenant, assertFlags, assertPositionals, runUsersCommand, runUserCommand, runCohortCommand, runProblemReopenCommand, runSignalsManagementCommand, SIGNALS_MANAGEMENT_SUBCOMMANDS, unknownSignalsSubcommandError };
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  assertFlags,
10
10
  assertPositionals
11
- } from "./cli-f1jfrqgf.js";
11
+ } from "./cli-4sy4tytm.js";
12
12
  import {
13
13
  callControlAPI
14
14
  } from "./cli-0xc5htv7.js";
@@ -5725,9 +5725,9 @@ async function runPromptsCommand(input, legacyFlags, legacyProfileOptions) {
5725
5725
  await promotePrompt(positionals, flags, profileOptions, context);
5726
5726
  break;
5727
5727
  case "ab":
5728
- return (await import("./prompts-ab-gmd10n5d.js")).runPromptAb(flags, profileOptions, context);
5728
+ return (await import("./prompts-ab-f5qrvpkt.js")).runPromptAb(flags, profileOptions, context);
5729
5729
  case "propose":
5730
- await (await import("./prompts-propose-q626zmm4.js")).runPromptPropose(positionals, flags, profileOptions, context);
5730
+ await (await import("./prompts-propose-jg2j41wx.js")).runPromptPropose(positionals, flags, profileOptions, context);
5731
5731
  break;
5732
5732
  case "list":
5733
5733
  case "show":
@@ -5830,7 +5830,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
5830
5830
  const analyzedDefinitions = new Map;
5831
5831
  if (flags["no-analyze"] !== "true") {
5832
5832
  options.onProgress?.("Analyzing prompt sources before sync.");
5833
- const { analyzeHarnessPrompts } = await import("./harness-72ejenza.js");
5833
+ const { analyzeHarnessPrompts } = await import("./harness-vabp33ak.js");
5834
5834
  const result = await analyzeHarnessPrompts({
5835
5835
  rootDir: process.cwd(),
5836
5836
  existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
@@ -5858,7 +5858,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
5858
5858
  const mergedSources = mergePromptSources(manifest.sources, extraSources);
5859
5859
  const manifestUpdate = stableJson(mergedSources) === stableJson(mergePromptSources(manifest.sources, [])) ? undefined : $stringify({ version: 2, prompt_paths: manifest.promptPaths, sources: mergedSources });
5860
5860
  const prompts = await discoverPrompts(extraSources);
5861
- const { checkPromptAttribution } = await import("./prompt-attribution-3987hhqz.js");
5861
+ const { checkPromptAttribution } = await import("./prompt-attribution-pbns1ya3.js");
5862
5862
  const attribution = checkPromptAttribution(process.cwd(), prompts.map((prompt) => prompt.key));
5863
5863
  const brokenAttribution = attribution.references.filter((reference) => reference.status === "missing");
5864
5864
  if (brokenAttribution.length) {
@@ -6164,7 +6164,7 @@ async function migratePromptManifest(options = {}) {
6164
6164
  let addedSources = [];
6165
6165
  let pendingSources = [];
6166
6166
  if (options.discover) {
6167
- const { analyzeHarnessPrompts } = await import("./harness-72ejenza.js");
6167
+ const { analyzeHarnessPrompts } = await import("./harness-vabp33ak.js");
6168
6168
  const result = await analyzeHarnessPrompts({
6169
6169
  rootDir: root,
6170
6170
  existing: manifest.sources,
@@ -4,7 +4,7 @@ import {
4
4
  parsePromptFileForAb,
5
5
  readPromptLock,
6
6
  runPromptSync
7
- } from "./cli-4tg0hkbz.js";
7
+ } from "./cli-he8csgsr.js";
8
8
  import {
9
9
  DEFAULT_POLL_INTERVAL_MS,
10
10
  DEFAULT_WAIT_TIMEOUT_MS,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./cli-daqkdnm1.js";
13
13
  import {
14
14
  UUID_RE
15
- } from "./cli-f1jfrqgf.js";
15
+ } from "./cli-4sy4tytm.js";
16
16
  import {
17
17
  callControlAPI,
18
18
  callDataAPI
@@ -18,7 +18,7 @@ import {
18
18
  assertFlags,
19
19
  assertPositionals,
20
20
  writeDryRun
21
- } from "./cli-f1jfrqgf.js";
21
+ } from "./cli-4sy4tytm.js";
22
22
  import {
23
23
  callControlAPI
24
24
  } from "./cli-0xc5htv7.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./cli-pmzh2qjy.js";
5
5
  import {
6
6
  inspectPromptManifest
7
- } from "./cli-4tg0hkbz.js";
7
+ } from "./cli-he8csgsr.js";
8
8
  import {
9
9
  readHarnessSyncState,
10
10
  renderDoctorHuman,
@@ -376,7 +376,7 @@ async function harnessCurrentCheck(cwd, manifestPath, manifestExists, tenantId)
376
376
  };
377
377
  }
378
378
  try {
379
- const { scanHarness } = await import("./harness-72ejenza.js");
379
+ const { scanHarness } = await import("./harness-vabp33ak.js");
380
380
  const current = scanHarness({
381
381
  rootDir: cwd,
382
382
  scannerVersion: "doctor",
@@ -49,7 +49,7 @@ import {
49
49
  assertFlags,
50
50
  assertPositionals,
51
51
  requireTenant
52
- } from "./cli-f1jfrqgf.js";
52
+ } from "./cli-4sy4tytm.js";
53
53
  import {
54
54
  ApiError,
55
55
  callControlAPI
@@ -14048,7 +14048,7 @@ async function runHarnessCommand(context) {
14048
14048
  throw new CliInputError("Focused remote prompt analysis is not supported yet.", "Use local --analyst=claude|codex|cursor|local-scan, or drop --concern for a full remote report.");
14049
14049
  }
14050
14050
  if (context.flags["github-actions"] === "true") {
14051
- const { runGithubActionsAnalyze } = await import("./harness-github-actions-2qc4gg2w.js");
14051
+ const { runGithubActionsAnalyze } = await import("./harness-github-actions-112503xs.js");
14052
14052
  const result = await runGithubActionsAnalyze(rootDir, {
14053
14053
  writeReport: (report2) => {
14054
14054
  const normalized = normalizeHarnessReport(report2);