@unbrained/pm-cli 2026.5.29 → 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 (274) hide show
  1. package/CHANGELOG.md +54 -12
  2. package/dist/cli/bootstrap-args.d.ts +1 -1
  3. package/dist/cli/bootstrap-args.js +59 -9
  4. package/dist/cli/bootstrap-args.js.map +1 -1
  5. package/dist/cli/commands/activity.js +4 -4
  6. package/dist/cli/commands/activity.js.map +1 -1
  7. package/dist/cli/commands/calendar.js +83 -11
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/close.js +4 -4
  10. package/dist/cli/commands/close.js.map +1 -1
  11. package/dist/cli/commands/completion.js +4 -4
  12. package/dist/cli/commands/completion.js.map +1 -1
  13. package/dist/cli/commands/create.js +50 -7
  14. package/dist/cli/commands/create.js.map +1 -1
  15. package/dist/cli/commands/deps.js +4 -4
  16. package/dist/cli/commands/deps.js.map +1 -1
  17. package/dist/cli/commands/extension/install-sources.d.ts +3 -0
  18. package/dist/cli/commands/extension/install-sources.js +29 -4
  19. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  20. package/dist/cli/commands/extension.js +26 -5
  21. package/dist/cli/commands/extension.js.map +1 -1
  22. package/dist/cli/commands/get.js +6 -3
  23. package/dist/cli/commands/get.js.map +1 -1
  24. package/dist/cli/commands/list.js +25 -6
  25. package/dist/cli/commands/list.js.map +1 -1
  26. package/dist/cli/commands/reindex.js +3 -3
  27. package/dist/cli/commands/reindex.js.map +1 -1
  28. package/dist/cli/commands/search.d.ts +17 -0
  29. package/dist/cli/commands/search.js +40 -10
  30. package/dist/cli/commands/search.js.map +1 -1
  31. package/dist/cli/commands/stats.js +4 -4
  32. package/dist/cli/commands/stats.js.map +1 -1
  33. package/dist/cli/commands/test-all.js +4 -4
  34. package/dist/cli/commands/test-all.js.map +1 -1
  35. package/dist/cli/main.d.ts +2 -0
  36. package/dist/cli/main.js +39 -11
  37. package/dist/cli/main.js.map +1 -1
  38. package/dist/cli/register-list-query.js +10 -12
  39. package/dist/cli/register-list-query.js.map +1 -1
  40. package/dist/cli/register-mutation.js +20 -22
  41. package/dist/cli/register-mutation.js.map +1 -1
  42. package/dist/cli/register-operations.js +32 -25
  43. package/dist/cli/register-operations.js.map +1 -1
  44. package/dist/cli/register-setup.js +7 -9
  45. package/dist/cli/register-setup.js.map +1 -1
  46. package/dist/cli/registration-helpers.js +6 -3
  47. package/dist/cli/registration-helpers.js.map +1 -1
  48. package/dist/cli/search-refresh.d.ts +2 -0
  49. package/dist/cli/search-refresh.js +13 -0
  50. package/dist/cli/search-refresh.js.map +1 -0
  51. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +17 -0
  52. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js.map +7 -0
  53. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js +209 -0
  54. package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js.map +7 -0
  55. package/dist/cli-bundle/chunks/append-JD2DETU7.js +73 -0
  56. package/dist/cli-bundle/chunks/append-JD2DETU7.js.map +7 -0
  57. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  58. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  59. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js +1636 -0
  60. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +7 -0
  61. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +189 -0
  62. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +7 -0
  63. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js +330 -0
  64. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +7 -0
  65. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js +1770 -0
  66. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +7 -0
  67. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js +552 -0
  68. package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js.map +7 -0
  69. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js +202 -0
  70. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +7 -0
  71. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js +157 -0
  72. package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js.map +7 -0
  73. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js +90 -0
  74. package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js.map +7 -0
  75. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js +950 -0
  76. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +7 -0
  77. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js +79 -0
  78. package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js.map +7 -0
  79. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js +349 -0
  80. package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js.map +7 -0
  81. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  82. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  83. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +47 -0
  84. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +56 -0
  86. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +7 -0
  87. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js +435 -0
  88. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +7 -0
  89. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js +185 -0
  90. package/dist/cli-bundle/chunks/chunk-G57E5D7T.js.map +7 -0
  91. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js +3621 -0
  92. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +7 -0
  93. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js +233 -0
  94. package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js.map +7 -0
  95. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js +1861 -0
  96. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +7 -0
  97. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js +648 -0
  98. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +7 -0
  99. package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js +122 -0
  100. package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js.map +7 -0
  101. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js +185 -0
  102. package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js.map +7 -0
  103. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js +189 -0
  104. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +7 -0
  105. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js +5153 -0
  106. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +7 -0
  107. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js +1345 -0
  108. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +7 -0
  109. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js +341 -0
  110. package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js.map +7 -0
  111. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  112. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  113. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js +2929 -0
  114. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +7 -0
  115. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js +674 -0
  116. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +7 -0
  117. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js +176 -0
  118. package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js.map +7 -0
  119. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js +1680 -0
  120. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +7 -0
  121. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  122. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  123. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js +60 -0
  124. package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js.map +7 -0
  125. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js +362 -0
  126. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +7 -0
  127. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +141 -0
  128. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +7 -0
  129. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js +632 -0
  130. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +7 -0
  131. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js +252 -0
  132. package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js.map +7 -0
  133. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js +133 -0
  134. package/dist/cli-bundle/chunks/claim-EE4TKKCV.js.map +7 -0
  135. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +14 -0
  136. package/dist/cli-bundle/chunks/close-XY4CSAYF.js.map +7 -0
  137. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js +104 -0
  138. package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js.map +7 -0
  139. package/dist/cli-bundle/chunks/config-V3FZOKLI.js +1577 -0
  140. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +7 -0
  141. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js +1458 -0
  142. package/dist/cli-bundle/chunks/context-RZ5QPNJB.js.map +7 -0
  143. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js +1245 -0
  144. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +7 -0
  145. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +28 -0
  146. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js.map +7 -0
  147. package/dist/cli-bundle/chunks/delete-RHCTEORS.js +59 -0
  148. package/dist/cli-bundle/chunks/delete-RHCTEORS.js.map +7 -0
  149. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js +229 -0
  150. package/dist/cli-bundle/chunks/deps-MZYCMLAO.js.map +7 -0
  151. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js +35 -0
  152. package/dist/cli-bundle/chunks/docs-FXXUCZYU.js.map +7 -0
  153. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js +25 -0
  154. package/dist/cli-bundle/chunks/extension-B4WL7BQU.js.map +7 -0
  155. package/dist/cli-bundle/chunks/files-WVOX67PE.js +286 -0
  156. package/dist/cli-bundle/chunks/files-WVOX67PE.js.map +7 -0
  157. package/dist/cli-bundle/chunks/gc-JWNF66EC.js +181 -0
  158. package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +7 -0
  159. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js +198 -0
  160. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +7 -0
  161. package/dist/cli-bundle/chunks/health-TCWL55KM.js +1233 -0
  162. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +7 -0
  163. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +21 -0
  164. package/dist/cli-bundle/chunks/history-A2JUDXUE.js.map +7 -0
  165. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +20 -0
  166. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js.map +7 -0
  167. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js +198 -0
  168. package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js.map +7 -0
  169. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +16 -0
  170. package/dist/cli-bundle/chunks/init-M2WUB4YH.js.map +7 -0
  171. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js +48 -0
  172. package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js.map +7 -0
  173. package/dist/cli-bundle/chunks/list-OGWQPC26.js +20 -0
  174. package/dist/cli-bundle/chunks/list-OGWQPC26.js.map +7 -0
  175. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js +48 -0
  176. package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js.map +7 -0
  177. package/dist/cli-bundle/chunks/plan-67AB2PLM.js +1175 -0
  178. package/dist/cli-bundle/chunks/plan-67AB2PLM.js.map +7 -0
  179. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js +232 -0
  180. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +7 -0
  181. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js +712 -0
  182. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +7 -0
  183. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js +374 -0
  184. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +7 -0
  185. package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js +246 -0
  186. package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js.map +7 -0
  187. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +18 -0
  188. package/dist/cli-bundle/chunks/restore-MB2ISME7.js.map +7 -0
  189. package/dist/cli-bundle/chunks/schema-Q622KC46.js +119 -0
  190. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +7 -0
  191. package/dist/cli-bundle/chunks/search-HENBL456.js +1135 -0
  192. package/dist/cli-bundle/chunks/search-HENBL456.js.map +7 -0
  193. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +124 -0
  194. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +7 -0
  195. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +32 -0
  196. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js.map +7 -0
  197. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js +332 -0
  198. package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js.map +7 -0
  199. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js +939 -0
  200. package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js.map +7 -0
  201. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +22 -0
  202. package/dist/cli-bundle/chunks/update-H6SCWNMA.js.map +7 -0
  203. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js +676 -0
  204. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +7 -0
  205. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js +271 -0
  206. package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js.map +7 -0
  207. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js +1110 -0
  208. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +7 -0
  209. package/dist/cli-bundle/main.js +6952 -0
  210. package/dist/cli-bundle/main.js.map +7 -0
  211. package/dist/cli.js +1 -1
  212. package/dist/core/config/nested-settings.d.ts +2 -0
  213. package/dist/core/config/nested-settings.js +17 -2
  214. package/dist/core/config/nested-settings.js.map +1 -1
  215. package/dist/core/item/item-type-definition.js +6 -2
  216. package/dist/core/item/item-type-definition.js.map +1 -1
  217. package/dist/core/item/type-registry.d.ts +4 -0
  218. package/dist/core/item/type-registry.js +10 -2
  219. package/dist/core/item/type-registry.js.map +1 -1
  220. package/dist/core/item/type-synonyms.d.ts +20 -0
  221. package/dist/core/item/type-synonyms.js +42 -0
  222. package/dist/core/item/type-synonyms.js.map +1 -0
  223. package/dist/core/search/background-refresh.d.ts +53 -0
  224. package/dist/core/search/background-refresh.js +286 -0
  225. package/dist/core/search/background-refresh.js.map +1 -0
  226. package/dist/core/search/cache.d.ts +20 -1
  227. package/dist/core/search/cache.js +76 -5
  228. package/dist/core/search/cache.js.map +1 -1
  229. package/dist/core/search/semantic-defaults.js +73 -32
  230. package/dist/core/search/semantic-defaults.js.map +1 -1
  231. package/dist/core/search/vector-stores.js +7 -3
  232. package/dist/core/search/vector-stores.js.map +1 -1
  233. package/dist/core/sentry/helpers.d.ts +1 -1
  234. package/dist/core/sentry/helpers.js +4 -4
  235. package/dist/core/sentry/helpers.js.map +1 -1
  236. package/dist/core/shared/constants.d.ts +2 -2
  237. package/dist/core/shared/constants.js +3 -3
  238. package/dist/core/shared/constants.js.map +1 -1
  239. package/dist/core/shared/html-entity-decode.d.ts +2 -1
  240. package/dist/core/shared/html-entity-decode.js +14 -9
  241. package/dist/core/shared/html-entity-decode.js.map +1 -1
  242. package/dist/core/shared/time.js +52 -2
  243. package/dist/core/shared/time.js.map +1 -1
  244. package/dist/core/store/front-matter-cache.d.ts +24 -0
  245. package/dist/core/store/front-matter-cache.js +119 -8
  246. package/dist/core/store/front-matter-cache.js.map +1 -1
  247. package/dist/core/store/item-format-migration.js +25 -15
  248. package/dist/core/store/item-format-migration.js.map +1 -1
  249. package/dist/core/store/item-store.d.ts +7 -0
  250. package/dist/core/store/item-store.js +13 -3
  251. package/dist/core/store/item-store.js.map +1 -1
  252. package/dist/core/store/settings-validator.d.ts +1 -0
  253. package/dist/core/store/settings-validator.js +7 -2
  254. package/dist/core/store/settings-validator.js.map +1 -1
  255. package/dist/core/store/settings.js +19 -3
  256. package/dist/core/store/settings.js.map +1 -1
  257. package/dist/core/telemetry/runtime.d.ts +10 -0
  258. package/dist/core/telemetry/runtime.js +86 -2
  259. package/dist/core/telemetry/runtime.js.map +1 -1
  260. package/dist/mcp/server.js +3 -3
  261. package/dist/mcp/server.js.map +1 -1
  262. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  263. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  264. package/dist/sdk/cli-contracts.js +29 -8
  265. package/dist/sdk/cli-contracts.js.map +1 -1
  266. package/dist/types.d.ts +9 -1
  267. package/dist/types.js +2 -2
  268. package/dist/types.js.map +1 -1
  269. package/docs/CONFIGURATION.md +11 -0
  270. package/docs/RELEASING.md +1 -1
  271. package/package.json +7 -5
  272. package/packages/pm-calendar/extensions/calendar/index.js +27 -2
  273. package/packages/pm-calendar/extensions/calendar/index.ts +28 -2
  274. package/scripts/bundle-cli.mjs +39 -0
@@ -0,0 +1,674 @@
1
+ import {
2
+ ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,
3
+ CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,
4
+ CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
5
+ CREATE_COMMANDER_STRING_OPTION_CONTRACTS,
6
+ LIST_COMMANDER_STRING_OPTION_CONTRACTS,
7
+ SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,
8
+ UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
9
+ UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,
10
+ readFirstStringFromCommanderOptions,
11
+ readStringArrayFromCommanderOptions
12
+ } from "./chunk-GN7IJPCD.js";
13
+ import {
14
+ refreshSearchArtifactsForMutation,
15
+ shouldRunSearchRefreshInForeground
16
+ } from "./chunk-6HT2F4TK.js";
17
+ import {
18
+ printError,
19
+ writeStdout
20
+ } from "./chunk-5HSEP75M.js";
21
+ import {
22
+ EXIT_CODE,
23
+ PmCliError,
24
+ getSettingsPath,
25
+ pathExists,
26
+ readSettings,
27
+ resolvePmRoot,
28
+ setActiveCommandResult
29
+ } from "./chunk-LSXGH6NE.js";
30
+
31
+ // dist/cli/registration-helpers.js
32
+ !(function() {
33
+ try {
34
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
35
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "04b7017e-0276-58fe-a000-5744fc740226");
36
+ } catch (e2) {
37
+ }
38
+ })();
39
+ var RESOLVED_GLOBAL_OPTIONS = /* @__PURE__ */ Symbol("pm.resolvedGlobalOptions");
40
+ function commandOptionsReader(command) {
41
+ return typeof command === "object" && command !== null ? command : {};
42
+ }
43
+ function setResolvedGlobalOptions(command, globalOptions) {
44
+ command[RESOLVED_GLOBAL_OPTIONS] = { ...globalOptions };
45
+ }
46
+ function clearResolvedGlobalOptions(command) {
47
+ delete command[RESOLVED_GLOBAL_OPTIONS];
48
+ }
49
+ function getGlobalOptions(command) {
50
+ const resolved = command[RESOLVED_GLOBAL_OPTIONS];
51
+ if (resolved) {
52
+ return { ...resolved };
53
+ }
54
+ const reader = commandOptionsReader(command);
55
+ const opts = typeof reader.optsWithGlobals === "function" ? reader.optsWithGlobals() : typeof reader.opts === "function" ? reader.opts() : {};
56
+ return {
57
+ json: opts.json === true ? true : void 0,
58
+ quiet: Boolean(opts.quiet),
59
+ noChangedFields: opts.changedFields === false,
60
+ path: typeof opts.path === "string" ? opts.path : void 0,
61
+ noExtensions: opts.extensions === false,
62
+ noPager: Boolean(opts.noPager),
63
+ profile: Boolean(opts.profile)
64
+ };
65
+ }
66
+ function getCommandPath(command) {
67
+ const parts = [];
68
+ let current = command;
69
+ while (current?.parent) {
70
+ parts.unshift(current.name());
71
+ current = current.parent;
72
+ }
73
+ return parts.join(" ");
74
+ }
75
+ async function applyDefaultOutputFormat(globalOptions) {
76
+ if (globalOptions.json === true) {
77
+ return globalOptions;
78
+ }
79
+ const pmRoot = resolvePmRoot(process.cwd(), globalOptions.path);
80
+ if (!await pathExists(getSettingsPath(pmRoot))) {
81
+ return globalOptions;
82
+ }
83
+ const settings = await readSettings(pmRoot);
84
+ return {
85
+ ...globalOptions,
86
+ defaultOutputFormat: settings.output.default_format
87
+ };
88
+ }
89
+ function collect(value, previous) {
90
+ const next = previous ?? [];
91
+ next.push(value);
92
+ return next;
93
+ }
94
+ function pushOptionalValueFlag(args, flag, value) {
95
+ if (typeof value !== "string") {
96
+ return;
97
+ }
98
+ const trimmed = value.trim();
99
+ if (trimmed.length === 0) {
100
+ return;
101
+ }
102
+ args.push(flag, trimmed);
103
+ }
104
+ function pushOptionalBooleanFlag(args, flag, value) {
105
+ if (value === true) {
106
+ args.push(flag);
107
+ }
108
+ }
109
+ function pushRepeatableValueFlag(args, flag, values) {
110
+ if (!Array.isArray(values)) {
111
+ return;
112
+ }
113
+ for (const value of values) {
114
+ if (typeof value !== "string") {
115
+ continue;
116
+ }
117
+ const trimmed = value.trim();
118
+ if (trimmed.length === 0) {
119
+ continue;
120
+ }
121
+ args.push(flag, trimmed);
122
+ }
123
+ }
124
+ function buildBackgroundTestCommandArgs(id, options) {
125
+ const args = ["test", id, "--run", "--json", "--progress"];
126
+ pushRepeatableValueFlag(args, "--add", options.add);
127
+ pushRepeatableValueFlag(args, "--remove", options.remove);
128
+ pushOptionalValueFlag(args, "--timeout", options.timeout);
129
+ pushRepeatableValueFlag(args, "--env-set", options.envSet);
130
+ pushRepeatableValueFlag(args, "--env-clear", options.envClear);
131
+ pushOptionalBooleanFlag(args, "--shared-host-safe", options.sharedHostSafe);
132
+ pushOptionalValueFlag(args, "--pm-context", options.pmContext);
133
+ pushOptionalBooleanFlag(args, "--override-linked-pm-context", options.overrideLinkedPmContext);
134
+ pushOptionalBooleanFlag(args, "--fail-on-context-mismatch", options.failOnContextMismatch);
135
+ pushOptionalBooleanFlag(args, "--fail-on-skipped", options.failOnSkipped);
136
+ pushOptionalBooleanFlag(args, "--fail-on-empty-test-run", options.failOnEmptyTestRun);
137
+ pushOptionalBooleanFlag(args, "--require-assertions-for-pm", options.requireAssertionsForPm);
138
+ pushOptionalBooleanFlag(args, "--check-context", options.checkContext);
139
+ pushOptionalBooleanFlag(args, "--auto-pm-context", options.autoPmContext);
140
+ pushOptionalValueFlag(args, "--author", options.author);
141
+ pushOptionalValueFlag(args, "--message", options.message);
142
+ pushOptionalBooleanFlag(args, "--force", options.force);
143
+ return args;
144
+ }
145
+ function buildBackgroundTestAllCommandArgs(options) {
146
+ const args = ["test-all", "--json", "--progress"];
147
+ pushOptionalValueFlag(args, "--status", options.status);
148
+ pushOptionalValueFlag(args, "--limit", options.limit);
149
+ pushOptionalValueFlag(args, "--offset", options.offset);
150
+ pushOptionalValueFlag(args, "--timeout", options.timeout);
151
+ pushRepeatableValueFlag(args, "--env-set", options.envSet);
152
+ pushRepeatableValueFlag(args, "--env-clear", options.envClear);
153
+ pushOptionalBooleanFlag(args, "--shared-host-safe", options.sharedHostSafe);
154
+ pushOptionalValueFlag(args, "--pm-context", options.pmContext);
155
+ pushOptionalBooleanFlag(args, "--override-linked-pm-context", options.overrideLinkedPmContext);
156
+ pushOptionalBooleanFlag(args, "--fail-on-context-mismatch", options.failOnContextMismatch);
157
+ pushOptionalBooleanFlag(args, "--fail-on-skipped", options.failOnSkipped);
158
+ pushOptionalBooleanFlag(args, "--fail-on-empty-test-run", options.failOnEmptyTestRun);
159
+ pushOptionalBooleanFlag(args, "--require-assertions-for-pm", options.requireAssertionsForPm);
160
+ pushOptionalBooleanFlag(args, "--check-context", options.checkContext);
161
+ pushOptionalBooleanFlag(args, "--auto-pm-context", options.autoPmContext);
162
+ return args;
163
+ }
164
+ function formatHookWarnings(warnings) {
165
+ return warnings.join(",");
166
+ }
167
+ function normalizeCreateOptions(commandOptions, options = {}) {
168
+ const readCreateString = (target) => readFirstStringFromCommanderOptions(commandOptions, CREATE_COMMANDER_STRING_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
169
+ target,
170
+ keys: [target]
171
+ });
172
+ const readCreateList = (target) => readStringArrayFromCommanderOptions(commandOptions, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
173
+ target,
174
+ keys: [target]
175
+ });
176
+ const type = readCreateString("type");
177
+ if (options.requireType !== false && type === void 0) {
178
+ throw new PmCliError("Missing required option --type <value>. Why required: create resolves runtime schema fields/workflow from item type. Retry: add --type <built-in or configured custom type> (example: --type Task).", EXIT_CODE.USAGE);
179
+ }
180
+ const normalized = {
181
+ title: readCreateString("title"),
182
+ description: readCreateString("description"),
183
+ type,
184
+ template: readCreateString("template"),
185
+ createMode: readCreateString("createMode"),
186
+ schedulePreset: readCreateString("schedulePreset"),
187
+ status: readCreateString("status"),
188
+ priority: readCreateString("priority"),
189
+ tags: readCreateString("tags"),
190
+ addTags: readCreateList("addTags"),
191
+ body: readCreateString("body"),
192
+ deadline: readCreateString("deadline"),
193
+ estimatedMinutes: readCreateString("estimatedMinutes"),
194
+ acceptanceCriteria: readCreateString("acceptanceCriteria"),
195
+ definitionOfReady: readCreateString("definitionOfReady"),
196
+ order: readCreateString("order"),
197
+ rank: readCreateString("rank"),
198
+ goal: readCreateString("goal"),
199
+ objective: readCreateString("objective"),
200
+ value: readCreateString("value"),
201
+ impact: readCreateString("impact"),
202
+ outcome: readCreateString("outcome"),
203
+ whyNow: readCreateString("whyNow"),
204
+ author: readCreateString("author"),
205
+ message: readCreateString("message"),
206
+ assignee: readCreateString("assignee"),
207
+ parent: readCreateString("parent"),
208
+ reviewer: readCreateString("reviewer"),
209
+ risk: readCreateString("risk"),
210
+ confidence: readCreateString("confidence"),
211
+ sprint: readCreateString("sprint"),
212
+ release: readCreateString("release"),
213
+ blockedBy: readCreateString("blockedBy"),
214
+ blockedReason: readCreateString("blockedReason"),
215
+ unblockNote: readCreateString("unblockNote"),
216
+ reporter: readCreateString("reporter"),
217
+ severity: readCreateString("severity"),
218
+ environment: readCreateString("environment"),
219
+ reproSteps: readCreateString("reproSteps"),
220
+ resolution: readCreateString("resolution"),
221
+ expectedResult: readCreateString("expectedResult"),
222
+ actualResult: readCreateString("actualResult"),
223
+ affectedVersion: readCreateString("affectedVersion"),
224
+ fixedVersion: readCreateString("fixedVersion"),
225
+ component: readCreateString("component"),
226
+ regression: readCreateString("regression"),
227
+ customerImpact: readCreateString("customerImpact"),
228
+ dep: readCreateList("dep"),
229
+ comment: readCreateList("comment"),
230
+ note: readCreateList("note"),
231
+ learning: readCreateList("learning"),
232
+ file: readCreateList("file"),
233
+ test: readCreateList("test"),
234
+ doc: readCreateList("doc"),
235
+ reminder: readCreateList("reminder"),
236
+ event: readCreateList("event"),
237
+ typeOption: readCreateList("typeOption"),
238
+ unset: readCreateList("unset"),
239
+ clearDeps: commandOptions.clearDeps === true ? true : void 0,
240
+ clearComments: commandOptions.clearComments === true ? true : void 0,
241
+ clearNotes: commandOptions.clearNotes === true ? true : void 0,
242
+ clearLearnings: commandOptions.clearLearnings === true ? true : void 0,
243
+ clearFiles: commandOptions.clearFiles === true ? true : void 0,
244
+ clearTests: commandOptions.clearTests === true ? true : void 0,
245
+ clearDocs: commandOptions.clearDocs === true ? true : void 0,
246
+ clearReminders: commandOptions.clearReminders === true ? true : void 0,
247
+ clearEvents: commandOptions.clearEvents === true ? true : void 0,
248
+ clearTypeOptions: commandOptions.clearTypeOptions === true ? true : void 0
249
+ };
250
+ for (const [key, value] of Object.entries(commandOptions)) {
251
+ if (Object.hasOwn(normalized, key)) {
252
+ continue;
253
+ }
254
+ normalized[key] = value;
255
+ }
256
+ return normalized;
257
+ }
258
+ function normalizeUpdateOptions(commandOptions) {
259
+ const readUpdateString = (target) => readFirstStringFromCommanderOptions(commandOptions, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
260
+ target,
261
+ keys: [target]
262
+ });
263
+ const readUpdateList = (target) => readStringArrayFromCommanderOptions(commandOptions, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
264
+ target,
265
+ keys: [target]
266
+ });
267
+ const normalized = {
268
+ title: readUpdateString("title"),
269
+ description: readUpdateString("description"),
270
+ body: readUpdateString("body"),
271
+ status: readUpdateString("status"),
272
+ closeReason: readUpdateString("closeReason"),
273
+ priority: readUpdateString("priority"),
274
+ type: readUpdateString("type"),
275
+ tags: readUpdateString("tags"),
276
+ addTags: readUpdateList("addTags"),
277
+ removeTags: readUpdateList("removeTags"),
278
+ deadline: readUpdateString("deadline"),
279
+ estimatedMinutes: readUpdateString("estimatedMinutes"),
280
+ acceptanceCriteria: readUpdateString("acceptanceCriteria"),
281
+ definitionOfReady: readUpdateString("definitionOfReady"),
282
+ order: readUpdateString("order"),
283
+ rank: readUpdateString("rank"),
284
+ goal: readUpdateString("goal"),
285
+ objective: readUpdateString("objective"),
286
+ value: readUpdateString("value"),
287
+ impact: readUpdateString("impact"),
288
+ outcome: readUpdateString("outcome"),
289
+ whyNow: readUpdateString("whyNow"),
290
+ author: readUpdateString("author"),
291
+ message: readUpdateString("message"),
292
+ force: Boolean(commandOptions.force),
293
+ allowAuditUpdate: commandOptions.allowAuditUpdate === true || commandOptions.allow_audit_update === true ? true : void 0,
294
+ allowAuditDepUpdate: commandOptions.allowAuditDepUpdate === true || commandOptions.allow_audit_dep_update === true ? true : void 0,
295
+ assignee: readUpdateString("assignee"),
296
+ parent: readUpdateString("parent"),
297
+ reviewer: readUpdateString("reviewer"),
298
+ risk: readUpdateString("risk"),
299
+ confidence: readUpdateString("confidence"),
300
+ sprint: readUpdateString("sprint"),
301
+ release: readUpdateString("release"),
302
+ blockedBy: readUpdateString("blockedBy"),
303
+ blockedReason: readUpdateString("blockedReason"),
304
+ unblockNote: readUpdateString("unblockNote"),
305
+ reporter: readUpdateString("reporter"),
306
+ severity: readUpdateString("severity"),
307
+ environment: readUpdateString("environment"),
308
+ reproSteps: readUpdateString("reproSteps"),
309
+ resolution: readUpdateString("resolution"),
310
+ expectedResult: readUpdateString("expectedResult"),
311
+ actualResult: readUpdateString("actualResult"),
312
+ affectedVersion: readUpdateString("affectedVersion"),
313
+ fixedVersion: readUpdateString("fixedVersion"),
314
+ component: readUpdateString("component"),
315
+ regression: readUpdateString("regression"),
316
+ customerImpact: readUpdateString("customerImpact"),
317
+ dep: readUpdateList("dep"),
318
+ depRemove: readUpdateList("depRemove"),
319
+ replaceDeps: commandOptions.replaceDeps === true ? true : void 0,
320
+ replaceTests: commandOptions.replaceTests === true ? true : void 0,
321
+ comment: readUpdateList("comment"),
322
+ note: readUpdateList("note"),
323
+ learning: readUpdateList("learning"),
324
+ file: readUpdateList("file"),
325
+ test: readUpdateList("test"),
326
+ doc: readUpdateList("doc"),
327
+ reminder: readUpdateList("reminder"),
328
+ event: readUpdateList("event"),
329
+ typeOption: readUpdateList("typeOption"),
330
+ unset: readUpdateList("unset"),
331
+ clearDeps: commandOptions.clearDeps === true ? true : void 0,
332
+ clearComments: commandOptions.clearComments === true ? true : void 0,
333
+ clearNotes: commandOptions.clearNotes === true ? true : void 0,
334
+ clearLearnings: commandOptions.clearLearnings === true ? true : void 0,
335
+ clearFiles: commandOptions.clearFiles === true ? true : void 0,
336
+ clearTests: commandOptions.clearTests === true ? true : void 0,
337
+ clearDocs: commandOptions.clearDocs === true ? true : void 0,
338
+ clearReminders: commandOptions.clearReminders === true ? true : void 0,
339
+ clearEvents: commandOptions.clearEvents === true ? true : void 0,
340
+ clearTypeOptions: commandOptions.clearTypeOptions === true ? true : void 0
341
+ };
342
+ for (const [key, value] of Object.entries(commandOptions)) {
343
+ if (Object.hasOwn(normalized, key)) {
344
+ continue;
345
+ }
346
+ normalized[key] = value;
347
+ }
348
+ return normalized;
349
+ }
350
+ var UPDATE_MANY_CONTROL_OPTION_KEYS = /* @__PURE__ */ new Set([
351
+ "filterStatus",
352
+ "filterType",
353
+ "filterTag",
354
+ "filterPriority",
355
+ "filterDeadlineBefore",
356
+ "filterDeadlineAfter",
357
+ "filterAssignee",
358
+ "filterAssigneeFilter",
359
+ "filterAssignee_filter",
360
+ "filterParent",
361
+ "filterSprint",
362
+ "filterRelease",
363
+ "limit",
364
+ "offset",
365
+ "dryRun",
366
+ "rollback",
367
+ "checkpoint"
368
+ ]);
369
+ function extractUpdateManyMutationOptionSource(commandOptions) {
370
+ const mutationOptions = {};
371
+ for (const [key, value] of Object.entries(commandOptions)) {
372
+ if (UPDATE_MANY_CONTROL_OPTION_KEYS.has(key)) {
373
+ continue;
374
+ }
375
+ mutationOptions[key] = value;
376
+ }
377
+ return mutationOptions;
378
+ }
379
+ function readListOptionString(options, target) {
380
+ return readFirstStringFromCommanderOptions(options, LIST_COMMANDER_STRING_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
381
+ target,
382
+ keys: [target]
383
+ });
384
+ }
385
+ function normalizeListOptions(options) {
386
+ const normalized = {
387
+ status: readListOptionString(options, "status"),
388
+ type: readListOptionString(options, "type"),
389
+ tag: readListOptionString(options, "tag"),
390
+ priority: readListOptionString(options, "priority"),
391
+ deadlineBefore: readListOptionString(options, "deadlineBefore"),
392
+ deadlineAfter: readListOptionString(options, "deadlineAfter"),
393
+ assignee: readListOptionString(options, "assignee"),
394
+ assigneeFilter: readListOptionString(options, "assigneeFilter"),
395
+ parent: readListOptionString(options, "parent"),
396
+ sprint: readListOptionString(options, "sprint"),
397
+ release: readListOptionString(options, "release"),
398
+ limit: readListOptionString(options, "limit"),
399
+ offset: readListOptionString(options, "offset"),
400
+ includeBody: options.includeBody === true ? true : void 0,
401
+ compact: options.compact === true ? true : void 0,
402
+ brief: options.brief === true ? true : void 0,
403
+ full: options.full === true ? true : void 0,
404
+ fields: readListOptionString(options, "fields"),
405
+ sort: readListOptionString(options, "sort"),
406
+ order: readListOptionString(options, "order")
407
+ };
408
+ for (const [key, value] of Object.entries(options)) {
409
+ if (Object.hasOwn(normalized, key)) {
410
+ continue;
411
+ }
412
+ normalized[key] = value;
413
+ }
414
+ return normalized;
415
+ }
416
+ function normalizeAggregateOptions(options) {
417
+ return {
418
+ groupBy: typeof options.groupBy === "string" ? options.groupBy : void 0,
419
+ count: options.count === true ? true : void 0,
420
+ includeUnparented: options.includeUnparented === true || options.include_unparented === true,
421
+ status: typeof options.status === "string" ? options.status : void 0,
422
+ type: readListOptionString(options, "type"),
423
+ tag: readListOptionString(options, "tag"),
424
+ priority: readListOptionString(options, "priority"),
425
+ deadlineBefore: readListOptionString(options, "deadlineBefore"),
426
+ deadlineAfter: readListOptionString(options, "deadlineAfter"),
427
+ assignee: readListOptionString(options, "assignee"),
428
+ assigneeFilter: readListOptionString(options, "assigneeFilter"),
429
+ parent: readListOptionString(options, "parent"),
430
+ sprint: readListOptionString(options, "sprint"),
431
+ release: readListOptionString(options, "release")
432
+ };
433
+ }
434
+ function printListJsonStream(commandName, result, globalOptions) {
435
+ setActiveCommandResult(result);
436
+ if (globalOptions.quiet) {
437
+ return;
438
+ }
439
+ const warnings = Array.isArray(result.warnings) ? result.warnings : [];
440
+ const metaPayload = {
441
+ type: "meta",
442
+ command: commandName,
443
+ count: result.count,
444
+ now: result.now,
445
+ filters: result.filters
446
+ };
447
+ if (warnings.length > 0) {
448
+ metaPayload.warnings = warnings;
449
+ }
450
+ if (!writeStdout(`${JSON.stringify(metaPayload)}
451
+ `)) {
452
+ return;
453
+ }
454
+ for (const item of result.items) {
455
+ if (!writeStdout(`${JSON.stringify({ type: "item", command: commandName, item })}
456
+ `)) {
457
+ return;
458
+ }
459
+ }
460
+ writeStdout(`${JSON.stringify({ type: "end", command: commandName, count: result.count })}
461
+ `);
462
+ }
463
+ function printActivityJsonStream(result, options, globalOptions) {
464
+ setActiveCommandResult(result);
465
+ if (globalOptions.quiet) {
466
+ return;
467
+ }
468
+ const metaPayload = {
469
+ type: "meta",
470
+ command: "activity",
471
+ count: result.count,
472
+ filters: {
473
+ id: options.id ?? null,
474
+ op: options.op ?? null,
475
+ author: options.author ?? null,
476
+ from: options.from ?? null,
477
+ to: options.to ?? null,
478
+ limit: options.limit ?? null
479
+ }
480
+ };
481
+ if (!writeStdout(`${JSON.stringify(metaPayload)}
482
+ `)) {
483
+ return;
484
+ }
485
+ const entries = result.compact && result.compact_activity ? result.compact_activity : result.activity;
486
+ for (const entry of entries) {
487
+ if (!writeStdout(`${JSON.stringify({ type: "entry", command: "activity", entry })}
488
+ `)) {
489
+ return;
490
+ }
491
+ }
492
+ writeStdout(`${JSON.stringify({ type: "end", command: "activity", count: result.count })}
493
+ `);
494
+ }
495
+ function normalizeSearchOptions(options) {
496
+ const readSearchString = (target) => readFirstStringFromCommanderOptions(options, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
497
+ target,
498
+ keys: [target]
499
+ });
500
+ const fields = readSearchString("fields");
501
+ const compactRequested = options.compact === true;
502
+ const fullRequested = options.full === true;
503
+ const defaultCompact = !compactRequested && !fullRequested && fields === void 0;
504
+ const mode = options.semantic === true ? "semantic" : options.hybrid === true ? "hybrid" : readSearchString("mode");
505
+ const normalized = {
506
+ mode,
507
+ includeLinked: options.includeLinked === true ? true : void 0,
508
+ titleExact: options.titleExact === true ? true : void 0,
509
+ phraseExact: options.phraseExact === true ? true : void 0,
510
+ type: readSearchString("type"),
511
+ tag: readSearchString("tag"),
512
+ priority: readSearchString("priority"),
513
+ deadlineBefore: readSearchString("deadlineBefore"),
514
+ deadlineAfter: readSearchString("deadlineAfter"),
515
+ limit: readSearchString("limit"),
516
+ fields,
517
+ compact: compactRequested || defaultCompact ? true : void 0,
518
+ full: fullRequested ? true : void 0
519
+ };
520
+ for (const [key, value] of Object.entries(options)) {
521
+ if (Object.hasOwn(normalized, key)) {
522
+ continue;
523
+ }
524
+ normalized[key] = value;
525
+ }
526
+ return normalized;
527
+ }
528
+ function normalizeSearchKeywordsInput(keywords) {
529
+ const query = keywords.map((entry) => entry.trim()).filter((entry) => entry.length > 0).join(" ");
530
+ if (query.length === 0) {
531
+ throw new PmCliError("Search query must not be empty", EXIT_CODE.USAGE);
532
+ }
533
+ return query;
534
+ }
535
+ function normalizeActivityOptions(options) {
536
+ const readActivityString = (target) => readFirstStringFromCommanderOptions(options, ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
537
+ target,
538
+ keys: [target]
539
+ });
540
+ return {
541
+ id: readActivityString("id"),
542
+ op: readActivityString("op"),
543
+ author: readActivityString("author"),
544
+ from: readActivityString("from"),
545
+ to: readActivityString("to"),
546
+ limit: readActivityString("limit"),
547
+ compact: options.full === true ? false : options.compact === false ? false : true
548
+ };
549
+ }
550
+ function resolveActivityStreamMode(raw) {
551
+ if (raw === true) {
552
+ return true;
553
+ }
554
+ if (raw === false || raw === void 0 || raw === null) {
555
+ return false;
556
+ }
557
+ if (typeof raw === "string") {
558
+ const normalized = raw.trim().toLowerCase();
559
+ if (normalized.length === 0 || normalized === "rows" || normalized === "ndjson" || normalized === "jsonl" || normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on") {
560
+ return true;
561
+ }
562
+ if (normalized === "false" || normalized === "off" || normalized === "none" || normalized === "0") {
563
+ return false;
564
+ }
565
+ }
566
+ throw new PmCliError("Activity --stream accepts rows|ndjson|jsonl (or no value)", EXIT_CODE.USAGE);
567
+ }
568
+ function normalizeContextOptions(options) {
569
+ const readContextString = (target) => readFirstStringFromCommanderOptions(options, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS.find((entry) => entry.target === target) ?? {
570
+ target,
571
+ keys: [target]
572
+ });
573
+ const sectionRaw = options.section;
574
+ const section = Array.isArray(sectionRaw) ? sectionRaw.filter((v) => typeof v === "string" && v.trim().length > 0) : typeof sectionRaw === "string" && sectionRaw.trim().length > 0 ? [sectionRaw] : void 0;
575
+ const normalized = {
576
+ date: readContextString("date"),
577
+ from: readContextString("from"),
578
+ to: readContextString("to"),
579
+ past: options.past === true ? true : void 0,
580
+ type: readContextString("type"),
581
+ tag: readContextString("tag"),
582
+ priority: readContextString("priority"),
583
+ assignee: readContextString("assignee"),
584
+ assigneeFilter: readContextString("assigneeFilter"),
585
+ sprint: readContextString("sprint"),
586
+ release: readContextString("release"),
587
+ limit: readContextString("limit"),
588
+ format: readContextString("format"),
589
+ depth: readContextString("depth"),
590
+ section: section && section.length > 0 ? section : void 0,
591
+ activityLimit: readContextString("activityLimit"),
592
+ staleThreshold: readContextString("staleThreshold")
593
+ };
594
+ for (const [key, value] of Object.entries(options)) {
595
+ if (Object.hasOwn(normalized, key)) {
596
+ continue;
597
+ }
598
+ normalized[key] = value;
599
+ }
600
+ return normalized;
601
+ }
602
+ function collectMutationItemIds(result) {
603
+ if (!result || typeof result !== "object") {
604
+ return [];
605
+ }
606
+ const record = result;
607
+ const ids = /* @__PURE__ */ new Set();
608
+ const pushId = (value) => {
609
+ if (typeof value !== "string") {
610
+ return;
611
+ }
612
+ const normalized = value.trim();
613
+ if (normalized.length === 0) {
614
+ return;
615
+ }
616
+ ids.add(normalized);
617
+ };
618
+ pushId(record.id);
619
+ const item = record.item;
620
+ if (item && typeof item === "object") {
621
+ pushId(item.id);
622
+ }
623
+ const explicitIds = record.ids;
624
+ if (Array.isArray(explicitIds)) {
625
+ for (const candidate of explicitIds) {
626
+ pushId(candidate);
627
+ }
628
+ }
629
+ const items = record.items;
630
+ if (Array.isArray(items)) {
631
+ for (const candidate of items) {
632
+ if (!candidate || typeof candidate !== "object") {
633
+ continue;
634
+ }
635
+ pushId(candidate.id);
636
+ }
637
+ }
638
+ return [...ids].sort((left, right) => left.localeCompare(right));
639
+ }
640
+ async function invalidateSearchCachesForMutation(globalOptions, result) {
641
+ const pmRoot = resolvePmRoot(process.cwd(), globalOptions.path);
642
+ const refreshResult = await refreshSearchArtifactsForMutation(pmRoot, collectMutationItemIds(result), {
643
+ background: !shouldRunSearchRefreshInForeground()
644
+ });
645
+ if (globalOptions.profile && refreshResult.warnings.length > 0) {
646
+ printError(`profile:search_refresh_warnings=${formatHookWarnings(refreshResult.warnings)}`);
647
+ }
648
+ }
649
+
650
+ export {
651
+ setResolvedGlobalOptions,
652
+ clearResolvedGlobalOptions,
653
+ getGlobalOptions,
654
+ getCommandPath,
655
+ applyDefaultOutputFormat,
656
+ collect,
657
+ buildBackgroundTestCommandArgs,
658
+ buildBackgroundTestAllCommandArgs,
659
+ formatHookWarnings,
660
+ normalizeCreateOptions,
661
+ normalizeUpdateOptions,
662
+ extractUpdateManyMutationOptionSource,
663
+ normalizeListOptions,
664
+ normalizeAggregateOptions,
665
+ printListJsonStream,
666
+ printActivityJsonStream,
667
+ normalizeSearchOptions,
668
+ normalizeSearchKeywordsInput,
669
+ normalizeActivityOptions,
670
+ resolveActivityStreamMode,
671
+ normalizeContextOptions,
672
+ invalidateSearchCachesForMutation
673
+ };
674
+ //# sourceMappingURL=chunk-P53TN6IA.js.map