@unbrained/pm-cli 2026.5.30 → 2026.5.31

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 (228) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cli/commands/calendar.js +81 -9
  3. package/dist/cli/commands/calendar.js.map +1 -1
  4. package/dist/cli/commands/create.js +34 -4
  5. package/dist/cli/commands/create.js.map +1 -1
  6. package/dist/cli/commands/extension/install-sources.d.ts +2 -0
  7. package/dist/cli/commands/extension/install-sources.js +11 -4
  8. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  9. package/dist/cli/commands/reindex.js +3 -3
  10. package/dist/cli/commands/reindex.js.map +1 -1
  11. package/dist/cli/commands/search.d.ts +17 -0
  12. package/dist/cli/commands/search.js +40 -10
  13. package/dist/cli/commands/search.js.map +1 -1
  14. package/dist/cli/register-list-query.js +9 -11
  15. package/dist/cli/register-list-query.js.map +1 -1
  16. package/dist/cli/register-mutation.js +20 -22
  17. package/dist/cli/register-mutation.js.map +1 -1
  18. package/dist/cli/register-operations.js +32 -25
  19. package/dist/cli/register-operations.js.map +1 -1
  20. package/dist/cli/register-setup.js +6 -8
  21. package/dist/cli/register-setup.js.map +1 -1
  22. package/dist/cli/registration-helpers.js +6 -3
  23. package/dist/cli/registration-helpers.js.map +1 -1
  24. package/dist/cli/search-refresh.d.ts +2 -0
  25. package/dist/cli/search-refresh.js +13 -0
  26. package/dist/cli/search-refresh.js.map +1 -0
  27. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +17 -0
  28. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js.map +7 -0
  29. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js +209 -0
  30. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js.map +7 -0
  31. package/dist/cli-bundle/chunks/append-JD2DETU7.js +73 -0
  32. package/dist/cli-bundle/chunks/append-JD2DETU7.js.map +7 -0
  33. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  34. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  35. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js +1636 -0
  36. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +7 -0
  37. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +189 -0
  38. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +7 -0
  39. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js +330 -0
  40. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +7 -0
  41. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js +1770 -0
  42. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +7 -0
  43. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js +552 -0
  44. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js.map +7 -0
  45. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js +202 -0
  46. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +7 -0
  47. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js +157 -0
  48. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js.map +7 -0
  49. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js +90 -0
  50. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js.map +7 -0
  51. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js +950 -0
  52. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +7 -0
  53. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js +79 -0
  54. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js.map +7 -0
  55. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js +349 -0
  56. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js.map +7 -0
  57. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  58. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  59. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +47 -0
  60. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +7 -0
  61. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +56 -0
  62. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +7 -0
  63. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js +435 -0
  64. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +7 -0
  65. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js +185 -0
  66. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js.map +7 -0
  67. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js +3621 -0
  68. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +7 -0
  69. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js +233 -0
  70. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js.map +7 -0
  71. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js +1861 -0
  72. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +7 -0
  73. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js +648 -0
  74. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-KBQY3YG5.js} +28 -70
  76. package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js.map +7 -0
  77. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js +185 -0
  78. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js.map +7 -0
  79. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js +189 -0
  80. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +7 -0
  81. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js +5153 -0
  82. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +7 -0
  83. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js +1345 -0
  84. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js +341 -0
  86. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js.map +7 -0
  87. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  88. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  89. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js +2929 -0
  90. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +7 -0
  91. package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-P53TN6IA.js} +22 -30
  92. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +7 -0
  93. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js +176 -0
  94. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js.map +7 -0
  95. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js +1680 -0
  96. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +7 -0
  97. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  98. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  99. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js +60 -0
  100. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js.map +7 -0
  101. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js +362 -0
  102. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +7 -0
  103. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +141 -0
  104. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +7 -0
  105. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js +632 -0
  106. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +7 -0
  107. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js +252 -0
  108. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js.map +7 -0
  109. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js +133 -0
  110. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js.map +7 -0
  111. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +14 -0
  112. package/dist/cli-bundle/chunks/close-XY4CSAYF.js.map +7 -0
  113. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js +104 -0
  114. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js.map +7 -0
  115. package/dist/cli-bundle/chunks/config-V3FZOKLI.js +1577 -0
  116. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +7 -0
  117. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js +1458 -0
  118. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js.map +7 -0
  119. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js +1245 -0
  120. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +7 -0
  121. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +28 -0
  122. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js.map +7 -0
  123. package/dist/cli-bundle/chunks/delete-RHCTEORS.js +59 -0
  124. package/dist/cli-bundle/chunks/delete-RHCTEORS.js.map +7 -0
  125. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js +229 -0
  126. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js.map +7 -0
  127. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js +35 -0
  128. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js.map +7 -0
  129. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js +25 -0
  130. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js.map +7 -0
  131. package/dist/cli-bundle/chunks/files-WVOX67PE.js +286 -0
  132. package/dist/cli-bundle/chunks/files-WVOX67PE.js.map +7 -0
  133. package/dist/cli-bundle/chunks/gc-JWNF66EC.js +181 -0
  134. package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +7 -0
  135. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js +198 -0
  136. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +7 -0
  137. package/dist/cli-bundle/chunks/health-TCWL55KM.js +1233 -0
  138. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +7 -0
  139. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +21 -0
  140. package/dist/cli-bundle/chunks/history-A2JUDXUE.js.map +7 -0
  141. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +20 -0
  142. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js.map +7 -0
  143. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js +198 -0
  144. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js.map +7 -0
  145. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +16 -0
  146. package/dist/cli-bundle/chunks/init-M2WUB4YH.js.map +7 -0
  147. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js +48 -0
  148. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js.map +7 -0
  149. package/dist/cli-bundle/chunks/list-OGWQPC26.js +20 -0
  150. package/dist/cli-bundle/chunks/list-OGWQPC26.js.map +7 -0
  151. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js +48 -0
  152. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js.map +7 -0
  153. package/dist/cli-bundle/chunks/plan-67AB2PLM.js +1175 -0
  154. package/dist/cli-bundle/chunks/plan-67AB2PLM.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-UP3VRUFS.js} +24 -15
  156. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +7 -0
  157. package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-YWSBF545.js} +38 -28
  158. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-3BDTGSDH.js} +49 -30
  160. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +7 -0
  161. package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-V56GDRUS.js} +21 -12
  162. package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js.map +7 -0
  163. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +18 -0
  164. package/dist/cli-bundle/chunks/restore-MB2ISME7.js.map +7 -0
  165. package/dist/cli-bundle/chunks/schema-Q622KC46.js +119 -0
  166. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +7 -0
  167. package/dist/cli-bundle/chunks/search-HENBL456.js +1135 -0
  168. package/dist/cli-bundle/chunks/search-HENBL456.js.map +7 -0
  169. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +124 -0
  170. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +7 -0
  171. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +32 -0
  172. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js.map +7 -0
  173. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js +332 -0
  174. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js.map +7 -0
  175. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js +939 -0
  176. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js.map +7 -0
  177. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +22 -0
  178. package/dist/cli-bundle/chunks/update-H6SCWNMA.js.map +7 -0
  179. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js +676 -0
  180. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +7 -0
  181. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js +271 -0
  182. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js.map +7 -0
  183. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js +1110 -0
  184. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +7 -0
  185. package/dist/cli-bundle/main.js +146 -90
  186. package/dist/cli-bundle/main.js.map +4 -4
  187. package/dist/core/item/item-type-definition.js +6 -2
  188. package/dist/core/item/item-type-definition.js.map +1 -1
  189. package/dist/core/item/type-registry.d.ts +4 -0
  190. package/dist/core/item/type-registry.js +10 -2
  191. package/dist/core/item/type-registry.js.map +1 -1
  192. package/dist/core/search/background-refresh.d.ts +53 -0
  193. package/dist/core/search/background-refresh.js +286 -0
  194. package/dist/core/search/background-refresh.js.map +1 -0
  195. package/dist/core/search/cache.d.ts +20 -1
  196. package/dist/core/search/cache.js +33 -4
  197. package/dist/core/search/cache.js.map +1 -1
  198. package/dist/core/search/vector-stores.js +7 -3
  199. package/dist/core/search/vector-stores.js.map +1 -1
  200. package/dist/core/shared/constants.d.ts +2 -2
  201. package/dist/core/shared/constants.js +2 -3
  202. package/dist/core/shared/constants.js.map +1 -1
  203. package/dist/core/store/item-format-migration.js +25 -15
  204. package/dist/core/store/item-format-migration.js.map +1 -1
  205. package/dist/core/store/settings-validator.js +6 -2
  206. package/dist/core/store/settings-validator.js.map +1 -1
  207. package/dist/core/telemetry/runtime.d.ts +10 -0
  208. package/dist/core/telemetry/runtime.js +86 -2
  209. package/dist/core/telemetry/runtime.js.map +1 -1
  210. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  211. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  212. package/dist/sdk/cli-contracts.js +26 -5
  213. package/dist/sdk/cli-contracts.js.map +1 -1
  214. package/dist/types.d.ts +7 -1
  215. package/dist/types.js +2 -2
  216. package/dist/types.js.map +1 -1
  217. package/docs/RELEASING.md +1 -1
  218. package/package.json +1 -2
  219. package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
  220. package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
  221. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
  222. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
  223. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
  224. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
  225. package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
  226. package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
  227. package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
  228. package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
@@ -0,0 +1,209 @@
1
+ import {
2
+ splitCommaList
3
+ } from "./chunk-3HUE7XOF.js";
4
+ import {
5
+ runList
6
+ } from "./chunk-FQE6XZDB.js";
7
+ import "./chunk-FM26RGSU.js";
8
+ import "./chunk-SEXQN4KL.js";
9
+ import "./chunk-BUPWJ3IJ.js";
10
+ import "./chunk-4AEZR5EJ.js";
11
+ import "./chunk-CEFIVZPG.js";
12
+ import {
13
+ normalizeStatusInput
14
+ } from "./chunk-MD7K4JYF.js";
15
+ import "./chunk-WDPXDQFG.js";
16
+ import {
17
+ nowIso
18
+ } from "./chunk-PVNQLCIS.js";
19
+ import {
20
+ EXIT_CODE,
21
+ PmCliError,
22
+ readSettings,
23
+ resolvePmRoot,
24
+ resolveRuntimeStatusRegistry
25
+ } from "./chunk-LSXGH6NE.js";
26
+
27
+ // dist/cli/commands/aggregate.js
28
+ !(function() {
29
+ try {
30
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
31
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "0c8f06f7-0f97-5ae3-ab61-12c1a053d751");
32
+ } catch (e2) {
33
+ }
34
+ })();
35
+ var AGGREGATE_GROUP_FIELDS = [
36
+ "parent",
37
+ "type",
38
+ "priority",
39
+ "status",
40
+ "assignee",
41
+ "tags",
42
+ "sprint",
43
+ "release"
44
+ ];
45
+ function parseStatus(raw, statusRegistry) {
46
+ if (raw === void 0) {
47
+ return void 0;
48
+ }
49
+ const normalized = normalizeStatusInput(raw, statusRegistry);
50
+ if (!normalized) {
51
+ throw new PmCliError(`Status filter must be one of ${statusRegistry.definitions.map((definition) => definition.id).join("|")}`, EXIT_CODE.USAGE);
52
+ }
53
+ return normalized;
54
+ }
55
+ function parseGroupBy(raw) {
56
+ const value = raw?.trim() ?? "status";
57
+ if (value.length === 0) {
58
+ throw new PmCliError("--group-by requires at least one field name", EXIT_CODE.USAGE);
59
+ }
60
+ const requested = splitCommaList(value);
61
+ if (requested.length === 0) {
62
+ throw new PmCliError("--group-by requires a comma-separated list of fields", EXIT_CODE.USAGE);
63
+ }
64
+ for (const field of requested) {
65
+ if (!AGGREGATE_GROUP_FIELDS.includes(field)) {
66
+ throw new PmCliError(`Aggregate group fields must be one of ${AGGREGATE_GROUP_FIELDS.join("|")}; received "${field}"`, EXIT_CODE.USAGE);
67
+ }
68
+ }
69
+ return requested;
70
+ }
71
+ function normalizeTagGroupValue(tags) {
72
+ const normalized = [...new Set(tags.map((tag) => tag.trim().toLowerCase()).filter((tag) => tag.length > 0))].sort((left, right) => left.localeCompare(right));
73
+ if (normalized.length === 0) {
74
+ return null;
75
+ }
76
+ return normalized.join(",");
77
+ }
78
+ function resolveGroupValue(field, item) {
79
+ switch (field) {
80
+ case "parent":
81
+ return item.parent ?? null;
82
+ case "type":
83
+ return item.type;
84
+ case "priority":
85
+ return item.priority;
86
+ case "status":
87
+ return item.status;
88
+ case "assignee":
89
+ return item.assignee ?? null;
90
+ case "tags":
91
+ return normalizeTagGroupValue(item.tags);
92
+ case "sprint":
93
+ return item.sprint ?? null;
94
+ case "release":
95
+ return item.release ?? null;
96
+ default:
97
+ return null;
98
+ }
99
+ }
100
+ function compareNullableGroupValue(left, right) {
101
+ const leftValue = left ?? null;
102
+ const rightValue = right ?? null;
103
+ if (leftValue === rightValue) {
104
+ return 0;
105
+ }
106
+ if (leftValue === null) {
107
+ return 1;
108
+ }
109
+ if (rightValue === null) {
110
+ return -1;
111
+ }
112
+ if (typeof leftValue === "number" && typeof rightValue === "number") {
113
+ return leftValue - rightValue;
114
+ }
115
+ return String(leftValue).localeCompare(String(rightValue));
116
+ }
117
+ function buildGroupKey(groupBy, group) {
118
+ return groupBy.map((field) => `${field}:${JSON.stringify(group[field] ?? null)}`).join("|");
119
+ }
120
+ function compareAggregateRows(left, right, groupBy) {
121
+ for (const field of groupBy) {
122
+ const byField = compareNullableGroupValue(left.group[field], right.group[field]);
123
+ if (byField !== 0) {
124
+ return byField;
125
+ }
126
+ }
127
+ return 0;
128
+ }
129
+ async function runAggregate(options, global2) {
130
+ if (options.count === false) {
131
+ throw new PmCliError("Aggregate currently supports grouped counts only. Pass --count.", EXIT_CODE.USAGE);
132
+ }
133
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
134
+ const settings = await readSettings(pmRoot);
135
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
136
+ const groupBy = parseGroupBy(options.groupBy);
137
+ const status = parseStatus(options.status, statusRegistry);
138
+ const includeUnparented = options.includeUnparented === true;
139
+ const listed = await runList(status, {
140
+ type: options.type,
141
+ tag: options.tag,
142
+ priority: options.priority,
143
+ deadlineBefore: options.deadlineBefore,
144
+ deadlineAfter: options.deadlineAfter,
145
+ assignee: options.assignee,
146
+ assigneeFilter: options.assigneeFilter,
147
+ parent: options.parent,
148
+ sprint: options.sprint,
149
+ release: options.release
150
+ }, global2);
151
+ const grouped = /* @__PURE__ */ new Map();
152
+ let skippedUnparented = 0;
153
+ let groupedItemCount = 0;
154
+ for (const listedItem of listed.items) {
155
+ const item = listedItem;
156
+ const group = {};
157
+ for (const field of groupBy) {
158
+ group[field] = resolveGroupValue(field, item);
159
+ }
160
+ if (groupBy.includes("parent") && group.parent === null && !includeUnparented) {
161
+ skippedUnparented += 1;
162
+ continue;
163
+ }
164
+ const key = buildGroupKey(groupBy, group);
165
+ const existing = grouped.get(key);
166
+ if (existing) {
167
+ existing.count += 1;
168
+ } else {
169
+ grouped.set(key, {
170
+ group,
171
+ count: 1
172
+ });
173
+ }
174
+ groupedItemCount += 1;
175
+ }
176
+ const groups = [...grouped.values()].sort((left, right) => compareAggregateRows(left, right, groupBy));
177
+ const warnings = listed.warnings && listed.warnings.length > 0 ? listed.warnings : void 0;
178
+ return {
179
+ groups,
180
+ count: groups.length,
181
+ totals: {
182
+ items_considered: listed.items.length,
183
+ items_grouped: groupedItemCount,
184
+ items_skipped_unparented: skippedUnparented
185
+ },
186
+ filters: {
187
+ group_by: groupBy,
188
+ count: true,
189
+ include_unparented: includeUnparented,
190
+ status: status ?? null,
191
+ type: options.type ?? null,
192
+ tag: options.tag ?? null,
193
+ priority: options.priority ?? null,
194
+ deadline_before: options.deadlineBefore ?? null,
195
+ deadline_after: options.deadlineAfter ?? null,
196
+ assignee: options.assignee ?? null,
197
+ assignee_filter: options.assigneeFilter ?? null,
198
+ parent: options.parent ?? null,
199
+ sprint: options.sprint ?? null,
200
+ release: options.release ?? null
201
+ },
202
+ now: nowIso(),
203
+ ...warnings ? { warnings } : {}
204
+ };
205
+ }
206
+ export {
207
+ runAggregate
208
+ };
209
+ //# sourceMappingURL=aggregate-ADUOSFRO.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../cli/commands/aggregate.ts"],
4
+ "sourcesContent": ["import { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { splitCommaList } from \"../../core/shared/split-comma-list.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { normalizeStatusInput } from \"../../core/item/status.js\";\nimport { resolveRuntimeStatusRegistry, type RuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { type ItemStatus } from \"../../types/index.js\";\nimport { runList } from \"./list.js\";\n\ntype AggregateGroupField = \"parent\" | \"type\" | \"priority\" | \"status\" | \"assignee\" | \"tags\" | \"sprint\" | \"release\";\ntype AggregateGroupValue = string | number | null;\ntype AggregateGroupRecord = Partial<Record<AggregateGroupField, AggregateGroupValue>>;\ntype AggregateListedItem = {\n type: string;\n status: ItemStatus;\n priority: number;\n parent?: string;\n assignee?: string;\n tags: string[];\n sprint?: string;\n release?: string;\n};\n\nconst AGGREGATE_GROUP_FIELDS: AggregateGroupField[] = [\n \"parent\",\n \"type\",\n \"priority\",\n \"status\",\n \"assignee\",\n \"tags\",\n \"sprint\",\n \"release\",\n];\n\nexport interface AggregateOptions {\n groupBy?: string;\n count?: boolean;\n includeUnparented?: boolean;\n status?: string;\n type?: string;\n tag?: string;\n priority?: string;\n deadlineBefore?: string;\n deadlineAfter?: string;\n assignee?: string;\n assigneeFilter?: string;\n parent?: string;\n sprint?: string;\n release?: string;\n}\n\nexport interface AggregateRow {\n group: AggregateGroupRecord;\n count: number;\n}\n\nexport interface AggregateResult {\n groups: AggregateRow[];\n count: number;\n totals: {\n items_considered: number;\n items_grouped: number;\n items_skipped_unparented: number;\n };\n filters: {\n group_by: AggregateGroupField[];\n count: boolean;\n include_unparented: boolean;\n status: ItemStatus | null;\n type: string | null;\n tag: string | null;\n priority: string | null;\n deadline_before: string | null;\n deadline_after: string | null;\n assignee: string | null;\n assignee_filter: string | null;\n parent: string | null;\n sprint: string | null;\n release: string | null;\n };\n now: string;\n warnings?: string[];\n}\n\nfunction parseStatus(raw: string | undefined, statusRegistry: RuntimeStatusRegistry): ItemStatus | undefined {\n if (raw === undefined) {\n return undefined;\n }\n const normalized = normalizeStatusInput(raw, statusRegistry);\n if (!normalized) {\n throw new PmCliError(\n `Status filter must be one of ${statusRegistry.definitions.map((definition) => definition.id).join(\"|\")}`,\n EXIT_CODE.USAGE,\n );\n }\n return normalized;\n}\n\nfunction parseGroupBy(raw: string | undefined): AggregateGroupField[] {\n const value = raw?.trim() ?? \"status\";\n if (value.length === 0) {\n throw new PmCliError(\"--group-by requires at least one field name\", EXIT_CODE.USAGE);\n }\n const requested = splitCommaList(value);\n if (requested.length === 0) {\n throw new PmCliError(\"--group-by requires a comma-separated list of fields\", EXIT_CODE.USAGE);\n }\n for (const field of requested) {\n if (!AGGREGATE_GROUP_FIELDS.includes(field as AggregateGroupField)) {\n throw new PmCliError(\n `Aggregate group fields must be one of ${AGGREGATE_GROUP_FIELDS.join(\"|\")}; received \"${field}\"`,\n EXIT_CODE.USAGE,\n );\n }\n }\n return requested as AggregateGroupField[];\n}\n\nfunction normalizeTagGroupValue(tags: string[]): string | null {\n const normalized = [...new Set(tags.map((tag) => tag.trim().toLowerCase()).filter((tag) => tag.length > 0))].sort((left, right) =>\n left.localeCompare(right),\n );\n if (normalized.length === 0) {\n return null;\n }\n return normalized.join(\",\");\n}\n\nfunction resolveGroupValue(field: AggregateGroupField, item: AggregateListedItem): AggregateGroupValue {\n switch (field) {\n case \"parent\":\n return item.parent ?? null;\n case \"type\":\n return item.type;\n case \"priority\":\n return item.priority;\n case \"status\":\n return item.status;\n case \"assignee\":\n return item.assignee ?? null;\n case \"tags\":\n return normalizeTagGroupValue(item.tags);\n case \"sprint\":\n return item.sprint ?? null;\n case \"release\":\n return item.release ?? null;\n default:\n return null;\n }\n}\n\nfunction compareNullableGroupValue(left: AggregateGroupValue | undefined, right: AggregateGroupValue | undefined): number {\n const leftValue = left ?? null;\n const rightValue = right ?? null;\n if (leftValue === rightValue) {\n return 0;\n }\n if (leftValue === null) {\n return 1;\n }\n if (rightValue === null) {\n return -1;\n }\n if (typeof leftValue === \"number\" && typeof rightValue === \"number\") {\n return leftValue - rightValue;\n }\n return String(leftValue).localeCompare(String(rightValue));\n}\n\nfunction buildGroupKey(groupBy: AggregateGroupField[], group: AggregateGroupRecord): string {\n return groupBy.map((field) => `${field}:${JSON.stringify(group[field] ?? null)}`).join(\"|\");\n}\n\nfunction compareAggregateRows(\n left: AggregateRow,\n right: AggregateRow,\n groupBy: AggregateGroupField[],\n): number {\n for (const field of groupBy) {\n const byField = compareNullableGroupValue(left.group[field], right.group[field]);\n if (byField !== 0) {\n return byField;\n }\n }\n return 0;\n}\n\nexport async function runAggregate(options: AggregateOptions, global: GlobalOptions): Promise<AggregateResult> {\n if (options.count === false) {\n throw new PmCliError(\"Aggregate currently supports grouped counts only. Pass --count.\", EXIT_CODE.USAGE);\n }\n\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n const settings = await readSettings(pmRoot);\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const groupBy = parseGroupBy(options.groupBy);\n const status = parseStatus(options.status, statusRegistry);\n const includeUnparented = options.includeUnparented === true;\n\n const listed = await runList(\n status,\n {\n type: options.type,\n tag: options.tag,\n priority: options.priority,\n deadlineBefore: options.deadlineBefore,\n deadlineAfter: options.deadlineAfter,\n assignee: options.assignee,\n assigneeFilter: options.assigneeFilter,\n parent: options.parent,\n sprint: options.sprint,\n release: options.release,\n },\n global,\n );\n\n const grouped = new Map<string, AggregateRow>();\n let skippedUnparented = 0;\n let groupedItemCount = 0;\n\n for (const listedItem of listed.items) {\n const item = listedItem as AggregateListedItem;\n const group: AggregateGroupRecord = {};\n for (const field of groupBy) {\n group[field] = resolveGroupValue(field, item);\n }\n if (groupBy.includes(\"parent\") && group.parent === null && !includeUnparented) {\n skippedUnparented += 1;\n continue;\n }\n const key = buildGroupKey(groupBy, group);\n const existing = grouped.get(key);\n if (existing) {\n existing.count += 1;\n } else {\n grouped.set(key, {\n group,\n count: 1,\n });\n }\n groupedItemCount += 1;\n }\n\n const groups = [...grouped.values()].sort((left, right) => compareAggregateRows(left, right, groupBy));\n const warnings = listed.warnings && listed.warnings.length > 0 ? listed.warnings : undefined;\n\n return {\n groups,\n count: groups.length,\n totals: {\n items_considered: listed.items.length,\n items_grouped: groupedItemCount,\n items_skipped_unparented: skippedUnparented,\n },\n filters: {\n group_by: groupBy,\n count: true,\n include_unparented: includeUnparented,\n status: status ?? null,\n type: options.type ?? null,\n tag: options.tag ?? null,\n priority: options.priority ?? null,\n deadline_before: options.deadlineBefore ?? null,\n deadline_after: options.deadlineAfter ?? null,\n assignee: options.assignee ?? null,\n assignee_filter: options.assigneeFilter ?? null,\n parent: options.parent ?? null,\n sprint: options.sprint ?? null,\n release: options.release ?? null,\n },\n now: nowIso(),\n ...(warnings ? { warnings } : {}),\n };\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["global"]
7
+ }
@@ -0,0 +1,73 @@
1
+ import {
2
+ resolveAuthor
3
+ } from "./chunk-O7IWB35H.js";
4
+ import {
5
+ createStdinTokenResolver
6
+ } from "./chunk-NGN7UV5K.js";
7
+ import {
8
+ mutateItem,
9
+ toItemRecord
10
+ } from "./chunk-BUPWJ3IJ.js";
11
+ import "./chunk-4AEZR5EJ.js";
12
+ import "./chunk-CEFIVZPG.js";
13
+ import "./chunk-MD7K4JYF.js";
14
+ import "./chunk-WDPXDQFG.js";
15
+ import "./chunk-PVNQLCIS.js";
16
+ import {
17
+ EXIT_CODE,
18
+ PmCliError,
19
+ getSettingsPath,
20
+ pathExists,
21
+ readSettings,
22
+ resolvePmRoot
23
+ } from "./chunk-LSXGH6NE.js";
24
+
25
+ // dist/cli/commands/append.js
26
+ !(function() {
27
+ try {
28
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
29
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "14238d29-d4c8-5988-afde-c4d3b52c450d");
30
+ } catch (e2) {
31
+ }
32
+ })();
33
+ async function runAppend(id, options, global2) {
34
+ if (options.body === void 0) {
35
+ throw new PmCliError("Missing required --body text", EXIT_CODE.USAGE);
36
+ }
37
+ const stdinResolver = createStdinTokenResolver();
38
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
39
+ if (!await pathExists(getSettingsPath(pmRoot))) {
40
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
41
+ }
42
+ const settings = await readSettings(pmRoot);
43
+ const author = resolveAuthor(options.author, settings.author_default);
44
+ const bodyInput = await stdinResolver.resolveValue(options.body, "--body");
45
+ const appended = (bodyInput ?? "").trim();
46
+ const result = await mutateItem({
47
+ pmRoot,
48
+ settings,
49
+ id,
50
+ op: "append",
51
+ author,
52
+ message: options.message,
53
+ force: options.force,
54
+ mutate(document) {
55
+ if (appended.length === 0) {
56
+ return { changedFields: [] };
57
+ }
58
+ const spacer = document.body.trim().length > 0 ? "\n\n" : "";
59
+ document.body = `${document.body.replace(/\s+$/, "")}${spacer}${appended}
60
+ `;
61
+ return { changedFields: ["body"] };
62
+ }
63
+ });
64
+ return {
65
+ item: toItemRecord(result.item),
66
+ appended: appended.length > 0 ? appended : "",
67
+ changed_fields: result.changedFields
68
+ };
69
+ }
70
+ export {
71
+ runAppend
72
+ };
73
+ //# sourceMappingURL=append-JD2DETU7.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../cli/commands/append.ts"],
4
+ "sourcesContent": ["import { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport { toItemRecord } from \"../../core/item/item-record.js\";\nimport { createStdinTokenResolver } from \"../../core/item/parse.js\";\nimport { mutateItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\n\nexport interface AppendCommandOptions {\n body: string;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\nexport interface AppendResult {\n item: Record<string, unknown>;\n appended: string;\n changed_fields: string[];\n}\n\n\nexport async function runAppend(id: string, options: AppendCommandOptions, global: GlobalOptions): Promise<AppendResult> {\n if (options.body === undefined) {\n throw new PmCliError(\"Missing required --body text\", EXIT_CODE.USAGE);\n }\n const stdinResolver = createStdinTokenResolver();\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n const settings = await readSettings(pmRoot);\n const author = resolveAuthor(options.author, settings.author_default);\n const bodyInput = await stdinResolver.resolveValue(options.body, \"--body\");\n const appended = (bodyInput ?? \"\").trim();\n\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: \"append\",\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n if (appended.length === 0) {\n return { changedFields: [] };\n }\n const spacer = document.body.trim().length > 0 ? \"\\n\\n\" : \"\";\n document.body = `${document.body.replace(/\\s+$/, \"\")}${spacer}${appended}\\n`;\n return { changedFields: [\"body\"] };\n },\n });\n\n return {\n item: toItemRecord(result.item),\n appended: appended.length > 0 ? appended : \"\",\n changed_fields: result.changedFields,\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,eAAsB,UAAU,IAAY,SAA+BA,SAAqB;AAC9F,MAAI,QAAQ,SAAS,QAAW;AAC9B,UAAM,IAAI,WAAW,gCAAgC,UAAU,KAAK;EACtE;AACA,QAAM,gBAAgB,yBAAwB;AAC9C,QAAM,SAAS,cAAc,QAAQ,IAAG,GAAIA,QAAO,IAAI;AACvD,MAAI,CAAE,MAAM,WAAW,gBAAgB,MAAM,CAAC,GAAI;AAChD,UAAM,IAAI,WAAW,iCAAiC,MAAM,wBAAwB,UAAU,SAAS;EACzG;AACA,QAAM,WAAW,MAAM,aAAa,MAAM;AAC1C,QAAM,SAAS,cAAc,QAAQ,QAAQ,SAAS,cAAc;AACpE,QAAM,YAAY,MAAM,cAAc,aAAa,QAAQ,MAAM,QAAQ;AACzE,QAAM,YAAY,aAAa,IAAI,KAAI;AAEvC,QAAM,SAAS,MAAM,WAAW;IAC9B;IACA;IACA;IACA,IAAI;IACJ;IACA,SAAS,QAAQ;IACjB,OAAO,QAAQ;IACf,OAAO,UAAQ;AACb,UAAI,SAAS,WAAW,GAAG;AACzB,eAAO,EAAE,eAAe,CAAA,EAAE;MAC5B;AACA,YAAM,SAAS,SAAS,KAAK,KAAI,EAAG,SAAS,IAAI,SAAS;AAC1D,eAAS,OAAO,GAAG,SAAS,KAAK,QAAQ,QAAQ,EAAE,CAAC,GAAG,MAAM,GAAG,QAAQ;;AACxE,aAAO,EAAE,eAAe,CAAC,MAAM,EAAC;IAClC;GACD;AAED,SAAO;IACL,MAAM,aAAa,OAAO,IAAI;IAC9B,UAAU,SAAS,SAAS,IAAI,WAAW;IAC3C,gBAAgB,OAAO;;AAE3B;",
6
+ "names": ["global"]
7
+ }
@@ -0,0 +1,27 @@
1
+ // dist/core/shared/split-comma-list.js
2
+ !(function() {
3
+ try {
4
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
5
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e5a31927-2a55-5d1d-97e4-b6190988caa1");
6
+ } catch (e2) {
7
+ }
8
+ })();
9
+ function splitCommaList(raw, options) {
10
+ if (raw === void 0 || raw === null) {
11
+ return [];
12
+ }
13
+ const separators = options?.separators ?? /,/;
14
+ const parts = raw.split(separators);
15
+ const trimmed = parts.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
16
+ const unique = options?.unique !== false;
17
+ const deduped = unique ? Array.from(new Set(trimmed)) : trimmed;
18
+ if (options?.sort === true) {
19
+ return [...deduped].sort();
20
+ }
21
+ return deduped;
22
+ }
23
+
24
+ export {
25
+ splitCommaList
26
+ };
27
+ //# sourceMappingURL=chunk-3HUE7XOF.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../core/shared/split-comma-list.ts"],
4
+ "sourcesContent": ["export interface SplitCommaListOptions {\n /** Separator pattern. Defaults to `/,/`. */\n separators?: RegExp | string;\n /** De-duplicate entries while preserving first-seen order. Defaults to `true`. */\n unique?: boolean;\n /** Sort entries lexicographically (default JS string sort). Defaults to `false`. */\n sort?: boolean;\n}\n\n/**\n * Split a comma-separated (or custom-separator) string into trimmed, non-empty entries.\n *\n * Default behaviour:\n * - Splits on `,`.\n * - Trims each entry and discards empty results (collapsing leading/trailing/duplicate separators).\n * - De-duplicates while preserving first-seen order.\n * - Does not sort.\n *\n * Returns `[]` for `undefined`/`null` input. Pure, dependency-free.\n */\nexport function splitCommaList(raw: string | undefined | null, options?: SplitCommaListOptions): string[] {\n if (raw === undefined || raw === null) {\n return [];\n }\n const separators = options?.separators ?? /,/;\n const parts = raw.split(separators as never);\n const trimmed = parts.map((entry) => entry.trim()).filter((entry) => entry.length > 0);\n const unique = options?.unique !== false;\n const deduped = unique ? Array.from(new Set(trimmed)) : trimmed;\n if (options?.sort === true) {\n return [...deduped].sort();\n }\n return deduped;\n}\n"],
5
+ "mappings": ";;;;;;;;AAoBM,SAAU,eAAe,KAAgC,SAA+B;AAC5F,MAAI,QAAQ,UAAa,QAAQ,MAAM;AACrC,WAAO,CAAA;EACT;AACA,QAAM,aAAa,SAAS,cAAc;AAC1C,QAAM,QAAQ,IAAI,MAAM,UAAmB;AAC3C,QAAM,UAAU,MAAM,IAAI,CAAC,UAAU,MAAM,KAAI,CAAE,EAAE,OAAO,CAAC,UAAU,MAAM,SAAS,CAAC;AACrF,QAAM,SAAS,SAAS,WAAW;AACnC,QAAM,UAAU,SAAS,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI;AACxD,MAAI,SAAS,SAAS,MAAM;AAC1B,WAAO,CAAC,GAAG,OAAO,EAAE,KAAI;EAC1B;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }