@cleocode/cleo 2026.9.4 → 2026.9.6

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 (78) hide show
  1. package/dist/cli/index.js +93 -21
  2. package/dist/cli/index.js.map +1 -1
  3. package/package.json +13 -13
  4. package/studio-dist/client/_app/immutable/chunks/{CfaaCiec.js → B4pbMhWh.js} +1 -1
  5. package/studio-dist/client/_app/immutable/chunks/Cq8SkApb.js +3 -0
  6. package/studio-dist/client/_app/immutable/chunks/{wIquQ8oS.js → DQE2lHpR.js} +1 -1
  7. package/studio-dist/client/_app/immutable/chunks/Dw--1J0g.js +1 -0
  8. package/studio-dist/client/_app/immutable/entry/{app.DmCNBm9N.js → app.AO-dq23l.js} +2 -2
  9. package/studio-dist/client/_app/immutable/entry/start.DyU3_ZJI.js +1 -0
  10. package/studio-dist/client/_app/immutable/nodes/{0.CgZmurcA.js → 0.pcHH7cls.js} +1 -1
  11. package/studio-dist/client/_app/immutable/nodes/{1.1dbkrilf.js → 1.BZ_6sEg7.js} +1 -1
  12. package/studio-dist/client/_app/immutable/nodes/{15.Bz_Nz80F.js → 15.C49XuRDg.js} +1 -1
  13. package/studio-dist/client/_app/immutable/nodes/{16.D6pij0yb.js → 16.D_IEqgU8.js} +1 -1
  14. package/studio-dist/client/_app/immutable/nodes/{17.DJb8ywg2.js → 17.DMmmyyKw.js} +1 -1
  15. package/studio-dist/client/_app/immutable/nodes/{18.D3v2MpXF.js → 18.BeHgL2ha.js} +1 -1
  16. package/studio-dist/client/_app/immutable/nodes/{20.KY914NXe.js → 20.ByQCOFEK.js} +1 -1
  17. package/studio-dist/client/_app/immutable/nodes/{24.CZxqm68e.js → 24.DKhWVVfG.js} +1 -1
  18. package/studio-dist/client/_app/immutable/nodes/{25.olJPvxdc.js → 25.BS4Qyw38.js} +1 -1
  19. package/studio-dist/client/_app/immutable/nodes/{26.e4ryC6oN.js → 26.CZ-vCPq6.js} +1 -1
  20. package/studio-dist/client/_app/immutable/nodes/{3.DywBpwr0.js → 3.B1Ua25St.js} +1 -1
  21. package/studio-dist/client/_app/version.json +1 -1
  22. package/studio-dist/server/chunks/{0-DwFPJnkU.js → 0-BkBuauLU.js} +3 -3
  23. package/studio-dist/server/chunks/{0-DwFPJnkU.js.map → 0-BkBuauLU.js.map} +1 -1
  24. package/studio-dist/server/chunks/{1-CG5_Q8zX.js → 1-C-FPVHUW.js} +3 -3
  25. package/studio-dist/server/chunks/{1-CG5_Q8zX.js.map → 1-C-FPVHUW.js.map} +1 -1
  26. package/studio-dist/server/chunks/{15-CZZGY2wS.js → 15-BEk78EBu.js} +3 -3
  27. package/studio-dist/server/chunks/{15-CZZGY2wS.js.map → 15-BEk78EBu.js.map} +1 -1
  28. package/studio-dist/server/chunks/{16-i0yNeXoO.js → 16-BzISLvSG.js} +3 -3
  29. package/studio-dist/server/chunks/{16-i0yNeXoO.js.map → 16-BzISLvSG.js.map} +1 -1
  30. package/studio-dist/server/chunks/{17-DpnTEz3y.js → 17-DGt4P3nJ.js} +3 -3
  31. package/studio-dist/server/chunks/{17-DpnTEz3y.js.map → 17-DGt4P3nJ.js.map} +1 -1
  32. package/studio-dist/server/chunks/{18-BlVCh80I.js → 18-DLGcIwmV.js} +3 -3
  33. package/studio-dist/server/chunks/{18-BlVCh80I.js.map → 18-DLGcIwmV.js.map} +1 -1
  34. package/studio-dist/server/chunks/{20-DuPsaTgc.js → 20-BvcOxe5q.js} +3 -3
  35. package/studio-dist/server/chunks/{20-DuPsaTgc.js.map → 20-BvcOxe5q.js.map} +1 -1
  36. package/studio-dist/server/chunks/{24-NxmS9Pgy.js → 24-DlzL0G3_.js} +3 -3
  37. package/studio-dist/server/chunks/{24-NxmS9Pgy.js.map → 24-DlzL0G3_.js.map} +1 -1
  38. package/studio-dist/server/chunks/{25-mYlhGw4v.js → 25-BkcpAlfJ.js} +3 -3
  39. package/studio-dist/server/chunks/{25-mYlhGw4v.js.map → 25-BkcpAlfJ.js.map} +1 -1
  40. package/studio-dist/server/chunks/{26-HWQ-Ern5.js → 26-CY_OLXcd.js} +3 -3
  41. package/studio-dist/server/chunks/{26-HWQ-Ern5.js.map → 26-CY_OLXcd.js.map} +1 -1
  42. package/studio-dist/server/chunks/{3-ByOeP3Gf.js → 3-CbodebGY.js} +3 -3
  43. package/studio-dist/server/chunks/{3-ByOeP3Gf.js.map → 3-CbodebGY.js.map} +1 -1
  44. package/studio-dist/server/chunks/{_layout.svelte-DHjtdIgc.js → _layout.svelte-B31p5awD.js} +4 -4
  45. package/studio-dist/server/chunks/{_layout.svelte-DHjtdIgc.js.map → _layout.svelte-B31p5awD.js.map} +1 -1
  46. package/studio-dist/server/chunks/{_page.svelte-BDSxuyHW.js → _page.svelte-BIIvdH13.js} +3 -3
  47. package/studio-dist/server/chunks/{_page.svelte-BDSxuyHW.js.map → _page.svelte-BIIvdH13.js.map} +1 -1
  48. package/studio-dist/server/chunks/{_page.svelte-94NcV7tl.js → _page.svelte-BdTlq0Gh.js} +4 -4
  49. package/studio-dist/server/chunks/{_page.svelte-94NcV7tl.js.map → _page.svelte-BdTlq0Gh.js.map} +1 -1
  50. package/studio-dist/server/chunks/{_page.svelte-CBAVKefr.js → _page.svelte-BuVX3kf2.js} +3 -3
  51. package/studio-dist/server/chunks/{_page.svelte-CBAVKefr.js.map → _page.svelte-BuVX3kf2.js.map} +1 -1
  52. package/studio-dist/server/chunks/{_page.svelte-CGOmwPIU.js → _page.svelte-C6P8rRvk.js} +3 -3
  53. package/studio-dist/server/chunks/{_page.svelte-CGOmwPIU.js.map → _page.svelte-C6P8rRvk.js.map} +1 -1
  54. package/studio-dist/server/chunks/{_page.svelte-JjbfOpHp.js → _page.svelte-CFnkQk35.js} +3 -3
  55. package/studio-dist/server/chunks/{_page.svelte-JjbfOpHp.js.map → _page.svelte-CFnkQk35.js.map} +1 -1
  56. package/studio-dist/server/chunks/{_page.svelte-huH3MwZ_.js → _page.svelte-CfjdIh3A.js} +3 -3
  57. package/studio-dist/server/chunks/{_page.svelte-huH3MwZ_.js.map → _page.svelte-CfjdIh3A.js.map} +1 -1
  58. package/studio-dist/server/chunks/{_page.svelte-Bts_IhOg.js → _page.svelte-DR0AY_gZ.js} +3 -3
  59. package/studio-dist/server/chunks/{_page.svelte-Bts_IhOg.js.map → _page.svelte-DR0AY_gZ.js.map} +1 -1
  60. package/studio-dist/server/chunks/{_page.svelte-CvTF_ebH.js → _page.svelte-EWYHbzl0.js} +4 -4
  61. package/studio-dist/server/chunks/{_page.svelte-CvTF_ebH.js.map → _page.svelte-EWYHbzl0.js.map} +1 -1
  62. package/studio-dist/server/chunks/{_page.svelte-veJzLVtt.js → _page.svelte-h0JOhZab.js} +3 -3
  63. package/studio-dist/server/chunks/{_page.svelte-veJzLVtt.js.map → _page.svelte-h0JOhZab.js.map} +1 -1
  64. package/studio-dist/server/chunks/{client-CnSSIJRB.js → client-2rpcRzcr.js} +2 -2
  65. package/studio-dist/server/chunks/{client-CnSSIJRB.js.map → client-2rpcRzcr.js.map} +1 -1
  66. package/studio-dist/server/chunks/{error.svelte-BLSLV0aG.js → error.svelte-CpckcxW6.js} +3 -3
  67. package/studio-dist/server/chunks/{error.svelte-BLSLV0aG.js.map → error.svelte-CpckcxW6.js.map} +1 -1
  68. package/studio-dist/server/chunks/{internal-Cs1b0-2z.js → internal-xyE_opYp.js} +2 -2
  69. package/studio-dist/server/chunks/{internal-Cs1b0-2z.js.map → internal-xyE_opYp.js.map} +1 -1
  70. package/studio-dist/server/chunks/{stores-ye7Cop_n.js → stores-BcV2X8z1.js} +2 -2
  71. package/studio-dist/server/chunks/{stores-ye7Cop_n.js.map → stores-BcV2X8z1.js.map} +1 -1
  72. package/studio-dist/server/index.js +1 -1
  73. package/studio-dist/server/index.js.map +1 -1
  74. package/studio-dist/server/manifest.js +12 -12
  75. package/studio-dist/server/manifest.js.map +1 -1
  76. package/studio-dist/client/_app/immutable/chunks/BKR-sjxJ.js +0 -3
  77. package/studio-dist/client/_app/immutable/chunks/CifRJkIA.js +0 -1
  78. package/studio-dist/client/_app/immutable/entry/start.znBlkFx8.js +0 -1
package/dist/cli/index.js CHANGED
@@ -20948,11 +20948,30 @@ var init_caamp_markers = __esm({
20948
20948
  });
20949
20949
 
20950
20950
  // packages/contracts/src/collection-keys.ts
20951
- var COLLECTION_KEYS;
20951
+ var COLLECTION_KEYS, COLLECTION_IDENTITY_FIELDS, DEFAULT_IDENTITY_FIELD;
20952
20952
  var init_collection_keys = __esm({
20953
20953
  "packages/contracts/src/collection-keys.ts"() {
20954
20954
  "use strict";
20955
- COLLECTION_KEYS = ["tasks", "items", "results", "suggestions"];
20955
+ COLLECTION_KEYS = [
20956
+ "tasks",
20957
+ "items",
20958
+ "results",
20959
+ "suggestions",
20960
+ // gh#1402 / gh#1405 — instances 4, 5 and 6 of the defect this file documents.
20961
+ // `saga list` emits `sagas` and `--output id` returned an EMPTY STREAM against
20962
+ // 58 rows; `backup list` emits `backups`; `worktree list` emits `worktrees`
20963
+ // and, carrying no `total`/`count` sibling, reported `--output count` = 0
20964
+ // against 9 records — so both projection modes agreed on a wrong answer and
20965
+ // the cross-check that caught the other two was absent.
20966
+ "sagas",
20967
+ "backups",
20968
+ "worktrees"
20969
+ ];
20970
+ COLLECTION_IDENTITY_FIELDS = {
20971
+ worktrees: "path",
20972
+ backups: "backupId"
20973
+ };
20974
+ DEFAULT_IDENTITY_FIELD = "id";
20956
20975
  }
20957
20976
  });
20958
20977
 
@@ -21022,6 +21041,7 @@ __export(src_exports, {
21022
21041
  CHANNEL_BOUNDARY_REGISTRY: () => CHANNEL_BOUNDARY_REGISTRY,
21023
21042
  CLEO_CONFIG_MANIFEST: () => CLEO_CONFIG_MANIFEST,
21024
21043
  CLI_CATEGORY_ORDER: () => CLI_CATEGORY_ORDER,
21044
+ COLLECTION_IDENTITY_FIELDS: () => COLLECTION_IDENTITY_FIELDS,
21025
21045
  COLLECTION_KEYS: () => COLLECTION_KEYS,
21026
21046
  CONFIG_MANIFEST_ENTRIES: () => CONFIG_MANIFEST_ENTRIES,
21027
21047
  ChangesetEntrySchema: () => ChangesetEntrySchema,
@@ -21032,6 +21052,7 @@ __export(src_exports, {
21032
21052
  ClassifierUnregisteredAgentError: () => ClassifierUnregisteredAgentError,
21033
21053
  DAEMON_IPC_PROTOCOL_VERSION: () => SUPERVISOR_IPC_PROTOCOL_VERSION,
21034
21054
  DB_INVENTORY: () => DB_INVENTORY,
21055
+ DEFAULT_IDENTITY_FIELD: () => DEFAULT_IDENTITY_FIELD,
21035
21056
  DEFAULT_RESOURCE_RETRY_AFTER_MS: () => DEFAULT_RESOURCE_RETRY_AFTER_MS,
21036
21057
  DOCS_LIFECYCLE_STATUSES: () => DOCS_LIFECYCLE_STATUSES,
21037
21058
  DOC_LIFECYCLE_STATUSES: () => DOC_LIFECYCLE_STATUSES,
@@ -21738,13 +21759,31 @@ var init_normalizer = __esm({
21738
21759
 
21739
21760
  // packages/cleo/src/cli/renderers/output-mode.ts
21740
21761
  import { truncateString } from "@cleocode/core";
21741
- function pickCollection(rec) {
21762
+ function pickCollectionEntry(rec) {
21742
21763
  for (const key of COLLECTION_KEYS2) {
21743
21764
  const value = rec[key];
21744
- if (Array.isArray(value)) return value;
21765
+ if (Array.isArray(value)) return { key, rows: value };
21766
+ }
21767
+ const candidates = Object.entries(rec).filter(
21768
+ ([, value]) => Array.isArray(value) && value.length > 0 && value.every((row) => row !== null && typeof row === "object" && !Array.isArray(row))
21769
+ );
21770
+ if (candidates.length === 1) {
21771
+ const [key, value] = candidates[0];
21772
+ return { key, rows: value };
21745
21773
  }
21746
21774
  return void 0;
21747
21775
  }
21776
+ function pickCollection(rec) {
21777
+ return pickCollectionEntry(rec)?.rows;
21778
+ }
21779
+ function identityFieldFor(key) {
21780
+ return COLLECTION_IDENTITY_FIELDS[key] ?? DEFAULT_IDENTITY_FIELD;
21781
+ }
21782
+ function identityOf(row, key) {
21783
+ if (row === null || typeof row !== "object") return void 0;
21784
+ const value = row[identityFieldFor(key)];
21785
+ return typeof value === "string" ? value : void 0;
21786
+ }
21748
21787
  function extractIds(data) {
21749
21788
  if (data === null || typeof data !== "object") return [];
21750
21789
  const rec = data;
@@ -21753,9 +21792,9 @@ function extractIds(data) {
21753
21792
  const id2 = task["id"];
21754
21793
  if (typeof id2 === "string") return [id2];
21755
21794
  }
21756
- const collection = pickCollection(rec);
21757
- if (collection) {
21758
- return collection.map((t) => t && typeof t === "object" ? t["id"] : void 0).filter((id2) => typeof id2 === "string");
21795
+ const entry = pickCollectionEntry(rec);
21796
+ if (entry) {
21797
+ return entry.rows.map((row) => identityOf(row, entry.key)).filter((id2) => id2 !== void 0);
21759
21798
  }
21760
21799
  const id = rec["id"];
21761
21800
  if (typeof id === "string") return [id];
@@ -21776,11 +21815,11 @@ function extractCount(data) {
21776
21815
  if (typeof rec["id"] === "string") return 1;
21777
21816
  return 0;
21778
21817
  }
21779
- function renderTableList(tasks) {
21818
+ function renderTableList(tasks, identityField = DEFAULT_IDENTITY_FIELD) {
21780
21819
  if (tasks.length === 0) return "";
21781
21820
  const COL_TITLE_MAX = 60;
21782
21821
  const rows = tasks.map((t) => ({
21783
- id: typeof t["id"] === "string" ? t["id"] : "",
21822
+ id: typeof t[identityField] === "string" ? t[identityField] : "",
21784
21823
  status: typeof t["status"] === "string" ? t["status"] : "",
21785
21824
  priority: typeof t["priority"] === "string" ? t["priority"] : "",
21786
21825
  title: truncateString(typeof t["title"] === "string" ? t["title"] : "", COL_TITLE_MAX)
@@ -21835,9 +21874,9 @@ function renderSummary2(data) {
21835
21874
  return { text: "", emptyReason: "no-renderable-records" };
21836
21875
  }
21837
21876
  const rec = data;
21838
- const collection = pickCollection(rec);
21839
- if (collection) {
21840
- return renderSummaryList(collection);
21877
+ const entry = pickCollectionEntry(rec);
21878
+ if (entry) {
21879
+ return renderSummaryList(entry.rows, identityFieldFor(entry.key));
21841
21880
  }
21842
21881
  const task = rec["task"];
21843
21882
  if (task && typeof task === "object") {
@@ -21848,20 +21887,20 @@ function renderSummary2(data) {
21848
21887
  }
21849
21888
  return { text: "", emptyReason: "no-renderable-records" };
21850
21889
  }
21851
- function renderSummaryRow(record) {
21852
- const id = typeof record["id"] === "string" ? record["id"] : "";
21890
+ function renderSummaryRow(record, identityField = DEFAULT_IDENTITY_FIELD) {
21891
+ const id = typeof record[identityField] === "string" ? record[identityField] : "";
21853
21892
  const status = typeof record["status"] === "string" ? record["status"] : "";
21854
21893
  const title = truncateString(typeof record["title"] === "string" ? record["title"] : "", 60);
21855
21894
  return `${id} [${status}] ${title}`;
21856
21895
  }
21857
- function renderSummaryList(rows) {
21896
+ function renderSummaryList(rows, identityField = DEFAULT_IDENTITY_FIELD) {
21858
21897
  if (rows.length === 0) return { text: "", emptyReason: "no-renderable-records" };
21859
21898
  const lines = [];
21860
21899
  for (const row of rows) {
21861
21900
  if (!row || typeof row !== "object") continue;
21862
21901
  const rec = row;
21863
- if (typeof rec["id"] !== "string") continue;
21864
- lines.push(renderSummaryRow(rec));
21902
+ if (typeof rec[identityField] !== "string") continue;
21903
+ lines.push(renderSummaryRow(rec, identityField));
21865
21904
  }
21866
21905
  return lines.length === 0 ? { text: "", emptyReason: "no-renderable-records" } : { text: lines.join("\n") };
21867
21906
  }
@@ -21900,7 +21939,19 @@ function renderOutputMode(mode, data) {
21900
21939
  switch (mode) {
21901
21940
  case "id": {
21902
21941
  const ids = extractIds(data);
21903
- return ids.length === 0 ? { text: "", emptyReason: "no-renderable-ids" } : { text: ids.join("\n") };
21942
+ if (ids.length > 0) return { text: ids.join("\n") };
21943
+ const entry = data && typeof data === "object" ? pickCollectionEntry(data) : void 0;
21944
+ if (entry && entry.rows.length > 0) {
21945
+ return {
21946
+ text: null,
21947
+ refusal: {
21948
+ code: "E_OUTPUT_IDENTITY_UNDECLARED",
21949
+ message: `--output id cannot project the ${entry.rows.length} record(s) under "${entry.key}": no record carries "${identityFieldFor(entry.key)}". Refusing to emit an empty stream, which would be indistinguishable from a result set with no rows.`,
21950
+ fix: `Declare the identity for "${entry.key}" in COLLECTION_IDENTITY_FIELDS (packages/contracts/src/collection-keys.ts), or use --field /data/${entry.key} to project the field you need.`
21951
+ }
21952
+ };
21953
+ }
21954
+ return { text: "", emptyReason: "no-renderable-ids" };
21904
21955
  }
21905
21956
  case "count": {
21906
21957
  return { text: String(extractCount(data)) };
@@ -21908,9 +21959,12 @@ function renderOutputMode(mode, data) {
21908
21959
  case "table": {
21909
21960
  if (data && typeof data === "object") {
21910
21961
  const rec = data;
21911
- const collection = pickCollection(rec);
21912
- if (collection) {
21913
- const text = renderTableList(collection);
21962
+ const entry = pickCollectionEntry(rec);
21963
+ if (entry) {
21964
+ const text = renderTableList(
21965
+ entry.rows,
21966
+ identityFieldFor(entry.key)
21967
+ );
21914
21968
  return text.length === 0 ? { text: "", emptyReason: "no-renderable-records" } : { text };
21915
21969
  }
21916
21970
  return { text: renderTableGeneric(rec) };
@@ -22088,6 +22142,17 @@ function cliOutput(data, opts) {
22088
22142
  const summary = getSummaryMode();
22089
22143
  if (outputMode !== "envelope" && !fieldCtx.field) {
22090
22144
  const out = renderOutputMode(outputMode, data);
22145
+ if (out.refusal) {
22146
+ cliError(
22147
+ out.refusal.message,
22148
+ 2,
22149
+ { name: out.refusal.code, fix: out.refusal.fix },
22150
+ {
22151
+ operation: opts.operation ?? opts.command
22152
+ }
22153
+ );
22154
+ process.exit(2);
22155
+ }
22091
22156
  if (out.text !== null) {
22092
22157
  writeMachineOutput(out.text, out.emptyReason);
22093
22158
  }
@@ -22122,6 +22187,13 @@ function cliOutput(data, opts) {
22122
22187
  action: `extract ${pointer2}`,
22123
22188
  command: `cleo ${opts.command} --field ${pointer2}`
22124
22189
  })) : void 0;
22190
+ if (opts.responseMeta?.gateway === "mutate") {
22191
+ process.stderr.write(
22192
+ `E_FIELD_NOT_FOUND: pointer "${fieldCtx.field}" did not resolve. The ${opts.operation ?? "operation"} itself SUCCEEDED \u2014 do not retry it. ${fix}
22193
+ `
22194
+ );
22195
+ return;
22196
+ }
22125
22197
  cliError(`Pointer "${fieldCtx.field}" did not resolve`, 4, {
22126
22198
  name: "E_FIELD_NOT_FOUND",
22127
22199
  fix,