@unbrained/pm-cli 2026.5.30 → 2026.6.5

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 (578) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/dist/cli/argv-utils.js +7 -3
  3. package/dist/cli/argv-utils.js.map +1 -1
  4. package/dist/cli/bootstrap-args.d.ts +1 -0
  5. package/dist/cli/bootstrap-args.js +23 -3
  6. package/dist/cli/bootstrap-args.js.map +1 -1
  7. package/dist/cli/commands/calendar.js +96 -10
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/close-many.d.ts +63 -0
  10. package/dist/cli/commands/close-many.js +302 -0
  11. package/dist/cli/commands/close-many.js.map +1 -0
  12. package/dist/cli/commands/completion.d.ts +1 -0
  13. package/dist/cli/commands/completion.js +241 -27
  14. package/dist/cli/commands/completion.js.map +1 -1
  15. package/dist/cli/commands/config.d.ts +4 -4
  16. package/dist/cli/commands/config.js +115 -3
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/contracts.js +191 -162
  19. package/dist/cli/commands/contracts.js.map +1 -1
  20. package/dist/cli/commands/create.d.ts +1 -0
  21. package/dist/cli/commands/create.js +109 -116
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/extension/doctor.d.ts +12 -0
  24. package/dist/cli/commands/extension/doctor.js +97 -2
  25. package/dist/cli/commands/extension/doctor.js.map +1 -1
  26. package/dist/cli/commands/extension/install-sources.d.ts +2 -0
  27. package/dist/cli/commands/extension/install-sources.js +11 -4
  28. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  29. package/dist/cli/commands/extension/scaffold.js +49 -48
  30. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  31. package/dist/cli/commands/extension.js +51 -23
  32. package/dist/cli/commands/extension.js.map +1 -1
  33. package/dist/cli/commands/get.js +7 -7
  34. package/dist/cli/commands/get.js.map +1 -1
  35. package/dist/cli/commands/health.js +38 -3
  36. package/dist/cli/commands/health.js.map +1 -1
  37. package/dist/cli/commands/index.d.ts +2 -1
  38. package/dist/cli/commands/index.js +4 -3
  39. package/dist/cli/commands/index.js.map +1 -1
  40. package/dist/cli/commands/init.d.ts +10 -0
  41. package/dist/cli/commands/init.js +107 -4
  42. package/dist/cli/commands/init.js.map +1 -1
  43. package/dist/cli/commands/list.d.ts +5 -0
  44. package/dist/cli/commands/list.js +58 -26
  45. package/dist/cli/commands/list.js.map +1 -1
  46. package/dist/cli/commands/reindex.js +164 -48
  47. package/dist/cli/commands/reindex.js.map +1 -1
  48. package/dist/cli/commands/repeatable-metadata-parsers.d.ts +15 -0
  49. package/dist/cli/commands/repeatable-metadata-parsers.js +120 -0
  50. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -0
  51. package/dist/cli/commands/restore.js +25 -4
  52. package/dist/cli/commands/restore.js.map +1 -1
  53. package/dist/cli/commands/schema.d.ts +122 -1
  54. package/dist/cli/commands/schema.js +536 -6
  55. package/dist/cli/commands/schema.js.map +1 -1
  56. package/dist/cli/commands/search.d.ts +18 -0
  57. package/dist/cli/commands/search.js +56 -12
  58. package/dist/cli/commands/search.js.map +1 -1
  59. package/dist/cli/commands/test.js +4 -3
  60. package/dist/cli/commands/test.js.map +1 -1
  61. package/dist/cli/commands/update-many.js +69 -140
  62. package/dist/cli/commands/update-many.js.map +1 -1
  63. package/dist/cli/commands/update.d.ts +2 -0
  64. package/dist/cli/commands/update.js +138 -119
  65. package/dist/cli/commands/update.js.map +1 -1
  66. package/dist/cli/commands/validate.d.ts +1 -0
  67. package/dist/cli/commands/validate.js +63 -33
  68. package/dist/cli/commands/validate.js.map +1 -1
  69. package/dist/cli/error-guidance.js +26 -3
  70. package/dist/cli/error-guidance.js.map +1 -1
  71. package/dist/cli/help-content.js +82 -3
  72. package/dist/cli/help-content.js.map +1 -1
  73. package/dist/cli/main.js +377 -23
  74. package/dist/cli/main.js.map +1 -1
  75. package/dist/cli/register-list-query.js +16 -12
  76. package/dist/cli/register-list-query.js.map +1 -1
  77. package/dist/cli/register-mutation.js +217 -47
  78. package/dist/cli/register-mutation.js.map +1 -1
  79. package/dist/cli/register-operations.js +34 -25
  80. package/dist/cli/register-operations.js.map +1 -1
  81. package/dist/cli/register-setup.js +8 -8
  82. package/dist/cli/register-setup.js.map +1 -1
  83. package/dist/cli/registration-helpers.js +35 -5
  84. package/dist/cli/registration-helpers.js.map +1 -1
  85. package/dist/cli/search-refresh.d.ts +2 -0
  86. package/dist/cli/search-refresh.js +13 -0
  87. package/dist/cli/search-refresh.js.map +1 -0
  88. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js +20 -0
  89. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js.map +1 -0
  90. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js +16 -0
  91. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js.map +7 -0
  92. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js +206 -0
  93. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js.map +1 -0
  94. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js +209 -0
  95. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js.map +7 -0
  96. package/dist/cli-bundle/chunks/append-5JE3YGXU.js +72 -0
  97. package/dist/cli-bundle/chunks/append-5JE3YGXU.js.map +7 -0
  98. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js +69 -0
  99. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js.map +1 -0
  100. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js +218 -0
  101. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js.map +1 -0
  102. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  103. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  104. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js +761 -0
  105. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js.map +7 -0
  106. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js +5553 -0
  107. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js.map +1 -0
  108. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js +634 -0
  109. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js.map +7 -0
  110. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js +1832 -0
  111. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js +1891 -0
  113. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js.map +7 -0
  114. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js +412 -0
  115. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js.map +1 -0
  116. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js +182 -0
  117. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js.map +1 -0
  118. package/dist/cli-bundle/chunks/chunk-7K24QB23.js +698 -0
  119. package/dist/cli-bundle/chunks/chunk-7K24QB23.js.map +1 -0
  120. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js +380 -0
  121. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js.map +1 -0
  122. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js +230 -0
  123. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js.map +1 -0
  124. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js +185 -0
  125. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js.map +7 -0
  126. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js +332 -0
  127. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js.map +1 -0
  128. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js +1681 -0
  129. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js.map +7 -0
  130. package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-BNL6S7QH.js} +28 -70
  131. package/dist/cli-bundle/chunks/chunk-BNL6S7QH.js.map +7 -0
  132. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js +154 -0
  133. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js.map +1 -0
  134. package/dist/cli-bundle/chunks/chunk-CJDQB2ED.js +341 -0
  135. package/dist/cli-bundle/chunks/chunk-CJDQB2ED.js.map +7 -0
  136. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js +1340 -0
  137. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js.map +1 -0
  138. package/dist/cli-bundle/chunks/chunk-D3WUNETC.js +349 -0
  139. package/dist/cli-bundle/chunks/chunk-D3WUNETC.js.map +7 -0
  140. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js +1714 -0
  141. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js.map +7 -0
  142. package/dist/cli-bundle/chunks/chunk-DFIZGAI5.js +550 -0
  143. package/dist/cli-bundle/chunks/chunk-DFIZGAI5.js.map +7 -0
  144. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js +1704 -0
  145. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js.map +1 -0
  146. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  147. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  148. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js +2988 -0
  149. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js.map +1 -0
  150. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js +128 -0
  151. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js.map +1 -0
  152. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js +454 -0
  153. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js.map +1 -0
  154. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js +383 -0
  155. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js.map +7 -0
  156. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js +57 -0
  157. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js.map +1 -0
  158. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js +3860 -0
  159. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js.map +1 -0
  160. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js +346 -0
  161. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js.map +1 -0
  162. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js +1356 -0
  163. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js.map +7 -0
  164. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js +342 -0
  165. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js.map +7 -0
  166. package/dist/cli-bundle/chunks/chunk-IUV734HF.js +17 -0
  167. package/dist/cli-bundle/chunks/chunk-IUV734HF.js.map +1 -0
  168. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js +15 -0
  169. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js.map +1 -0
  170. package/dist/cli-bundle/chunks/chunk-JB4RGL4V.js +185 -0
  171. package/dist/cli-bundle/chunks/chunk-JB4RGL4V.js.map +7 -0
  172. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js +130 -0
  173. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js.map +1 -0
  174. package/dist/cli-bundle/chunks/chunk-K47WAYQV.js +60 -0
  175. package/dist/cli-bundle/chunks/chunk-K47WAYQV.js.map +7 -0
  176. package/dist/cli-bundle/chunks/chunk-KA24HME7.js +79 -0
  177. package/dist/cli-bundle/chunks/chunk-KA24HME7.js.map +7 -0
  178. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js +1325 -0
  179. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js.map +1 -0
  180. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js +242 -0
  181. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js.map +1 -0
  182. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js +221 -0
  183. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js.map +7 -0
  184. package/dist/cli-bundle/chunks/chunk-LDJK7SHN.js +157 -0
  185. package/dist/cli-bundle/chunks/chunk-LDJK7SHN.js.map +7 -0
  186. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js +24 -0
  187. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js.map +1 -0
  188. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js +80 -0
  189. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js.map +1 -0
  190. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js +457 -0
  191. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js.map +7 -0
  192. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js +173 -0
  193. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js.map +1 -0
  194. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js +338 -0
  195. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js.map +1 -0
  196. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  197. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  198. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js +3040 -0
  199. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js.map +7 -0
  200. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js +751 -0
  201. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js.map +1 -0
  202. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js +1861 -0
  203. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js.map +7 -0
  204. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  205. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  206. package/dist/cli-bundle/chunks/chunk-RANZIID5.js +176 -0
  207. package/dist/cli-bundle/chunks/chunk-RANZIID5.js.map +7 -0
  208. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js +140 -0
  209. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js.map +7 -0
  210. package/dist/cli-bundle/chunks/chunk-S3CV7JGJ.js +233 -0
  211. package/dist/cli-bundle/chunks/chunk-S3CV7JGJ.js.map +7 -0
  212. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js +5705 -0
  213. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js.map +7 -0
  214. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js +76 -0
  215. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js.map +1 -0
  216. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js +631 -0
  217. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js.map +1 -0
  218. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js +540 -0
  219. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js.map +1 -0
  220. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js +422 -0
  221. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js.map +7 -0
  222. package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-TK633IVD.js} +51 -32
  223. package/dist/cli-bundle/chunks/chunk-TK633IVD.js.map +7 -0
  224. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js +131 -0
  225. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js.map +7 -0
  226. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js +119 -0
  227. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js.map +1 -0
  228. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js +1664 -0
  229. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js.map +1 -0
  230. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js +186 -0
  231. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js.map +1 -0
  232. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js +182 -0
  233. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js.map +1 -0
  234. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js +189 -0
  235. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js.map +7 -0
  236. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js +1385 -0
  237. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js.map +7 -0
  238. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +53 -0
  239. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +1 -0
  240. package/dist/cli-bundle/chunks/chunk-XX5LRINW.js +90 -0
  241. package/dist/cli-bundle/chunks/chunk-XX5LRINW.js.map +7 -0
  242. package/dist/cli-bundle/chunks/chunk-Y2AKE2HS.js +252 -0
  243. package/dist/cli-bundle/chunks/chunk-Y2AKE2HS.js.map +7 -0
  244. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js +3898 -0
  245. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js.map +7 -0
  246. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js +1809 -0
  247. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js.map +1 -0
  248. package/dist/cli-bundle/chunks/claim-AZLP7YFO.js +132 -0
  249. package/dist/cli-bundle/chunks/claim-AZLP7YFO.js.map +7 -0
  250. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js +129 -0
  251. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js.map +1 -0
  252. package/dist/cli-bundle/chunks/close-65DFYAVS.js +17 -0
  253. package/dist/cli-bundle/chunks/close-65DFYAVS.js.map +1 -0
  254. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js +13 -0
  255. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js.map +7 -0
  256. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js +311 -0
  257. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js.map +1 -0
  258. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js +314 -0
  259. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js.map +7 -0
  260. package/dist/cli-bundle/chunks/comments-AGBNSJJH.js +103 -0
  261. package/dist/cli-bundle/chunks/comments-AGBNSJJH.js.map +7 -0
  262. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js +100 -0
  263. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js.map +1 -0
  264. package/dist/cli-bundle/chunks/config-5ON3ADRH.js +1688 -0
  265. package/dist/cli-bundle/chunks/config-5ON3ADRH.js.map +7 -0
  266. package/dist/cli-bundle/chunks/config-DDPYIA6J.js +1671 -0
  267. package/dist/cli-bundle/chunks/config-DDPYIA6J.js.map +1 -0
  268. package/dist/cli-bundle/chunks/context-E6U3DWVM.js +1471 -0
  269. package/dist/cli-bundle/chunks/context-E6U3DWVM.js.map +7 -0
  270. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js +1461 -0
  271. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js.map +1 -0
  272. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js +1277 -0
  273. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js.map +7 -0
  274. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js +1274 -0
  275. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js.map +1 -0
  276. package/dist/cli-bundle/chunks/create-ATONSAZW.js +27 -0
  277. package/dist/cli-bundle/chunks/create-ATONSAZW.js.map +7 -0
  278. package/dist/cli-bundle/chunks/create-WYFKN2U4.js +31 -0
  279. package/dist/cli-bundle/chunks/create-WYFKN2U4.js.map +1 -0
  280. package/dist/cli-bundle/chunks/delete-RONNH4F4.js +58 -0
  281. package/dist/cli-bundle/chunks/delete-RONNH4F4.js.map +7 -0
  282. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js +55 -0
  283. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js.map +1 -0
  284. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js +225 -0
  285. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js.map +1 -0
  286. package/dist/cli-bundle/chunks/deps-WII3O4HB.js +228 -0
  287. package/dist/cli-bundle/chunks/deps-WII3O4HB.js.map +7 -0
  288. package/dist/cli-bundle/chunks/docs-JMVCFNHH.js +34 -0
  289. package/dist/cli-bundle/chunks/docs-JMVCFNHH.js.map +7 -0
  290. package/dist/cli-bundle/chunks/docs-PDREIMLS.js +31 -0
  291. package/dist/cli-bundle/chunks/docs-PDREIMLS.js.map +1 -0
  292. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js +28 -0
  293. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js.map +1 -0
  294. package/dist/cli-bundle/chunks/extension-G6UXSM5S.js +24 -0
  295. package/dist/cli-bundle/chunks/extension-G6UXSM5S.js.map +7 -0
  296. package/dist/cli-bundle/chunks/files-2PN7UM2D.js +282 -0
  297. package/dist/cli-bundle/chunks/files-2PN7UM2D.js.map +1 -0
  298. package/dist/cli-bundle/chunks/files-MXYS5W4M.js +285 -0
  299. package/dist/cli-bundle/chunks/files-MXYS5W4M.js.map +7 -0
  300. package/dist/cli-bundle/chunks/gc-GT552UJH.js +178 -0
  301. package/dist/cli-bundle/chunks/gc-GT552UJH.js.map +1 -0
  302. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js +181 -0
  303. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js.map +7 -0
  304. package/dist/cli-bundle/chunks/get-CINFEUIY.js +197 -0
  305. package/dist/cli-bundle/chunks/get-CINFEUIY.js.map +7 -0
  306. package/dist/cli-bundle/chunks/get-WXMLRG7M.js +194 -0
  307. package/dist/cli-bundle/chunks/get-WXMLRG7M.js.map +1 -0
  308. package/dist/cli-bundle/chunks/health-5VPOJQ53.js +1258 -0
  309. package/dist/cli-bundle/chunks/health-5VPOJQ53.js.map +1 -0
  310. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js +1261 -0
  311. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js.map +7 -0
  312. package/dist/cli-bundle/chunks/history-6FC4H6HI.js +20 -0
  313. package/dist/cli-bundle/chunks/history-6FC4H6HI.js.map +7 -0
  314. package/dist/cli-bundle/chunks/history-FLZIP7PM.js +24 -0
  315. package/dist/cli-bundle/chunks/history-FLZIP7PM.js.map +1 -0
  316. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js +23 -0
  317. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js.map +1 -0
  318. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js +19 -0
  319. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js.map +7 -0
  320. package/dist/cli-bundle/chunks/history-repair-KC5ZOJRZ.js +196 -0
  321. package/dist/cli-bundle/chunks/history-repair-KC5ZOJRZ.js.map +7 -0
  322. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js +193 -0
  323. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js.map +1 -0
  324. package/dist/cli-bundle/chunks/init-6MRFVOLH.js +20 -0
  325. package/dist/cli-bundle/chunks/init-6MRFVOLH.js.map +1 -0
  326. package/dist/cli-bundle/chunks/init-KHX3FEEM.js +16 -0
  327. package/dist/cli-bundle/chunks/init-KHX3FEEM.js.map +7 -0
  328. package/dist/cli-bundle/chunks/learnings-A3CLB5CO.js +47 -0
  329. package/dist/cli-bundle/chunks/learnings-A3CLB5CO.js.map +7 -0
  330. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js +44 -0
  331. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js.map +1 -0
  332. package/dist/cli-bundle/chunks/list-53LZ2AEO.js +20 -0
  333. package/dist/cli-bundle/chunks/list-53LZ2AEO.js.map +7 -0
  334. package/dist/cli-bundle/chunks/list-DBRECOG4.js +24 -0
  335. package/dist/cli-bundle/chunks/list-DBRECOG4.js.map +1 -0
  336. package/dist/cli-bundle/chunks/notes-42LIC3UE.js +47 -0
  337. package/dist/cli-bundle/chunks/notes-42LIC3UE.js.map +7 -0
  338. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js +44 -0
  339. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js.map +1 -0
  340. package/dist/cli-bundle/chunks/plan-HDQXEUKD.js +1174 -0
  341. package/dist/cli-bundle/chunks/plan-HDQXEUKD.js.map +7 -0
  342. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js +1171 -0
  343. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js.map +1 -0
  344. package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-AG3XKXWL.js} +25 -18
  345. package/dist/cli-bundle/chunks/register-list-query-AG3XKXWL.js.map +7 -0
  346. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js +227 -0
  347. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js.map +1 -0
  348. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js +813 -0
  349. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js.map +1 -0
  350. package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-RSMT6DPK.js} +160 -39
  351. package/dist/cli-bundle/chunks/register-mutation-RSMT6DPK.js.map +7 -0
  352. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js +370 -0
  353. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js.map +1 -0
  354. package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-Q54JQZUN.js} +50 -32
  355. package/dist/cli-bundle/chunks/register-operations-Q54JQZUN.js.map +7 -0
  356. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js +242 -0
  357. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js.map +1 -0
  358. package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-YJKIQRKA.js} +21 -13
  359. package/dist/cli-bundle/chunks/register-setup-YJKIQRKA.js.map +7 -0
  360. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js +21 -0
  361. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js.map +1 -0
  362. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js +17 -0
  363. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js.map +7 -0
  364. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js +770 -0
  365. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js.map +1 -0
  366. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js +780 -0
  367. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js.map +7 -0
  368. package/dist/cli-bundle/chunks/search-5A3BMFA7.js +1144 -0
  369. package/dist/cli-bundle/chunks/search-5A3BMFA7.js.map +7 -0
  370. package/dist/cli-bundle/chunks/search-C7NPB7G7.js +1127 -0
  371. package/dist/cli-bundle/chunks/search-C7NPB7G7.js.map +1 -0
  372. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js +120 -0
  373. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js.map +1 -0
  374. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js +123 -0
  375. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js.map +7 -0
  376. package/dist/cli-bundle/chunks/test-OFYONO3C.js +35 -0
  377. package/dist/cli-bundle/chunks/test-OFYONO3C.js.map +1 -0
  378. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js +31 -0
  379. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js.map +7 -0
  380. package/dist/cli-bundle/chunks/test-all-EEMKNTGU.js +331 -0
  381. package/dist/cli-bundle/chunks/test-all-EEMKNTGU.js.map +7 -0
  382. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js +328 -0
  383. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js.map +1 -0
  384. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js +929 -0
  385. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js.map +1 -0
  386. package/dist/cli-bundle/chunks/test-runs-L2M7WKH7.js +939 -0
  387. package/dist/cli-bundle/chunks/test-runs-L2M7WKH7.js.map +7 -0
  388. package/dist/cli-bundle/chunks/update-6YEHPVXH.js +25 -0
  389. package/dist/cli-bundle/chunks/update-6YEHPVXH.js.map +1 -0
  390. package/dist/cli-bundle/chunks/update-PYLVHMRD.js +21 -0
  391. package/dist/cli-bundle/chunks/update-PYLVHMRD.js.map +7 -0
  392. package/dist/cli-bundle/chunks/update-many-322CCH2L.js +608 -0
  393. package/dist/cli-bundle/chunks/update-many-322CCH2L.js.map +7 -0
  394. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js +605 -0
  395. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js.map +1 -0
  396. package/dist/cli-bundle/chunks/upgrade-2U727SAM.js +269 -0
  397. package/dist/cli-bundle/chunks/upgrade-2U727SAM.js.map +7 -0
  398. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js +266 -0
  399. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js.map +1 -0
  400. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js +1120 -0
  401. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js.map +1 -0
  402. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js +1123 -0
  403. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js.map +7 -0
  404. package/dist/cli-bundle/main.js +615 -121
  405. package/dist/cli-bundle/main.js.map +4 -4
  406. package/dist/core/checkpoint/mutation-checkpoint.d.ts +44 -0
  407. package/dist/core/checkpoint/mutation-checkpoint.js +119 -0
  408. package/dist/core/checkpoint/mutation-checkpoint.js.map +1 -0
  409. package/dist/core/config/positional-value.js +4 -2
  410. package/dist/core/config/positional-value.js.map +1 -1
  411. package/dist/core/diagnostics/remediation.d.ts +73 -0
  412. package/dist/core/diagnostics/remediation.js +328 -0
  413. package/dist/core/diagnostics/remediation.js.map +1 -0
  414. package/dist/core/extensions/extension-hook-runtime.js +9 -2
  415. package/dist/core/extensions/extension-hook-runtime.js.map +1 -1
  416. package/dist/core/extensions/extension-types.d.ts +60 -4
  417. package/dist/core/extensions/extension-types.js +2 -2
  418. package/dist/core/extensions/extension-types.js.map +1 -1
  419. package/dist/core/extensions/index.d.ts +5 -1
  420. package/dist/core/extensions/index.js +61 -2
  421. package/dist/core/extensions/index.js.map +1 -1
  422. package/dist/core/extensions/item-fields.d.ts +5 -1
  423. package/dist/core/extensions/item-fields.js +126 -4
  424. package/dist/core/extensions/item-fields.js.map +1 -1
  425. package/dist/core/extensions/loader.js +283 -8
  426. package/dist/core/extensions/loader.js.map +1 -1
  427. package/dist/core/item/item-format.d.ts +3 -2
  428. package/dist/core/item/item-format.js +15 -10
  429. package/dist/core/item/item-format.js.map +1 -1
  430. package/dist/core/item/item-type-definition.js +6 -2
  431. package/dist/core/item/item-type-definition.js.map +1 -1
  432. package/dist/core/item/status-filter.d.ts +29 -0
  433. package/dist/core/item/status-filter.js +97 -0
  434. package/dist/core/item/status-filter.js.map +1 -0
  435. package/dist/core/item/type-registry.d.ts +4 -0
  436. package/dist/core/item/type-registry.js +12 -2
  437. package/dist/core/item/type-registry.js.map +1 -1
  438. package/dist/core/output/output.js +17 -5
  439. package/dist/core/output/output.js.map +1 -1
  440. package/dist/core/schema/item-types-file.d.ts +15 -0
  441. package/dist/core/schema/item-types-file.js +27 -2
  442. package/dist/core/schema/item-types-file.js.map +1 -1
  443. package/dist/core/schema/runtime-field-filters.js +4 -3
  444. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  445. package/dist/core/schema/runtime-field-values.d.ts +1 -1
  446. package/dist/core/schema/runtime-field-values.js +10 -4
  447. package/dist/core/schema/runtime-field-values.js.map +1 -1
  448. package/dist/core/schema/runtime-schema.js +75 -2
  449. package/dist/core/schema/runtime-schema.js.map +1 -1
  450. package/dist/core/schema/status-defs-file.d.ts +113 -0
  451. package/dist/core/schema/status-defs-file.js +260 -0
  452. package/dist/core/schema/status-defs-file.js.map +1 -0
  453. package/dist/core/schema/type-workflows.d.ts +64 -0
  454. package/dist/core/schema/type-workflows.js +98 -0
  455. package/dist/core/schema/type-workflows.js.map +1 -0
  456. package/dist/core/search/background-refresh.d.ts +53 -0
  457. package/dist/core/search/background-refresh.js +286 -0
  458. package/dist/core/search/background-refresh.js.map +1 -0
  459. package/dist/core/search/cache.d.ts +23 -2
  460. package/dist/core/search/cache.js +135 -30
  461. package/dist/core/search/cache.js.map +1 -1
  462. package/dist/core/search/http-client.d.ts +2 -2
  463. package/dist/core/search/http-client.js +2 -2
  464. package/dist/core/search/http-client.js.map +1 -1
  465. package/dist/core/search/vector-stores.d.ts +1 -0
  466. package/dist/core/search/vector-stores.js +69 -15
  467. package/dist/core/search/vector-stores.js.map +1 -1
  468. package/dist/core/search/vectorization-metadata.d.ts +13 -0
  469. package/dist/core/search/vectorization-metadata.js +65 -0
  470. package/dist/core/search/vectorization-metadata.js.map +1 -0
  471. package/dist/core/shared/constants.d.ts +2 -2
  472. package/dist/core/shared/constants.js +2 -3
  473. package/dist/core/shared/constants.js.map +1 -1
  474. package/dist/core/shared/serialization.d.ts +1 -0
  475. package/dist/core/shared/serialization.js +86 -2
  476. package/dist/core/shared/serialization.js.map +1 -1
  477. package/dist/core/store/front-matter-cache.js +14 -5
  478. package/dist/core/store/front-matter-cache.js.map +1 -1
  479. package/dist/core/store/item-format-migration.js +25 -15
  480. package/dist/core/store/item-format-migration.js.map +1 -1
  481. package/dist/core/store/item-store.d.ts +2 -0
  482. package/dist/core/store/item-store.js +61 -6
  483. package/dist/core/store/item-store.js.map +1 -1
  484. package/dist/core/store/settings-validator.js +22 -2
  485. package/dist/core/store/settings-validator.js.map +1 -1
  486. package/dist/core/store/settings.js +40 -5
  487. package/dist/core/store/settings.js.map +1 -1
  488. package/dist/core/telemetry/consent.js +3 -3
  489. package/dist/core/telemetry/consent.js.map +1 -1
  490. package/dist/core/telemetry/observability.js +4 -3
  491. package/dist/core/telemetry/observability.js.map +1 -1
  492. package/dist/core/telemetry/runtime.d.ts +10 -0
  493. package/dist/core/telemetry/runtime.js +86 -2
  494. package/dist/core/telemetry/runtime.js.map +1 -1
  495. package/dist/mcp/server.js +221 -12
  496. package/dist/mcp/server.js.map +1 -1
  497. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -2
  498. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  499. package/dist/sdk/cli-contracts/commander-types.js +7 -2
  500. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  501. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  502. package/dist/sdk/cli-contracts/enum-contracts.js +4 -2
  503. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  504. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -0
  505. package/dist/sdk/cli-contracts/tool-option-contracts.js +53 -3
  506. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  507. package/dist/sdk/cli-contracts/tool-parameter-tables.js +37 -8
  508. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  509. package/dist/sdk/cli-contracts.d.ts +19 -1
  510. package/dist/sdk/cli-contracts.js +211 -18
  511. package/dist/sdk/cli-contracts.js.map +1 -1
  512. package/dist/sdk/errors.d.ts +22 -0
  513. package/dist/sdk/errors.js +46 -0
  514. package/dist/sdk/errors.js.map +1 -0
  515. package/dist/sdk/index.d.ts +2 -1
  516. package/dist/sdk/index.js +3 -2
  517. package/dist/sdk/index.js.map +1 -1
  518. package/dist/sdk/package-import-adapters.js +14 -3
  519. package/dist/sdk/package-import-adapters.js.map +1 -1
  520. package/dist/sdk/runtime.d.ts +1 -0
  521. package/dist/sdk/runtime.js +3 -2
  522. package/dist/sdk/runtime.js.map +1 -1
  523. package/dist/sdk/testing.d.ts +77 -0
  524. package/dist/sdk/testing.js +239 -0
  525. package/dist/sdk/testing.js.map +1 -0
  526. package/dist/types.d.ts +26 -1
  527. package/dist/types.js +3 -2
  528. package/dist/types.js.map +1 -1
  529. package/docs/AGENT_GUIDE.md +21 -2
  530. package/docs/COMMANDS.md +85 -5
  531. package/docs/CONFIGURATION.md +49 -2
  532. package/docs/EXTENSIONS.md +118 -6
  533. package/docs/QUICKSTART.md +2 -0
  534. package/docs/RELEASING.md +3 -3
  535. package/docs/SDK.md +273 -1
  536. package/docs/TESTING.md +17 -0
  537. package/docs/examples/policy-restricted-extension/manifest.json +1 -0
  538. package/docs/examples/starter-extension/index.js +9 -1
  539. package/docs/examples/starter-extension/manifest.json +1 -0
  540. package/package.json +12 -7
  541. package/packages/pm-beads/extensions/beads/index.js +2 -4
  542. package/packages/pm-beads/extensions/beads/index.ts +43 -33
  543. package/packages/pm-beads/extensions/beads/manifest.json +12 -1
  544. package/packages/pm-calendar/README.md +6 -0
  545. package/packages/pm-calendar/extensions/calendar/index.js +6 -1
  546. package/packages/pm-calendar/extensions/calendar/index.ts +6 -1
  547. package/packages/pm-calendar/extensions/calendar/manifest.json +6 -1
  548. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +6 -1
  549. package/packages/pm-guide-shell/README.md +4 -0
  550. package/packages/pm-guide-shell/extensions/guide-shell/index.js +22 -0
  551. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +22 -0
  552. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +6 -1
  553. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +74 -3
  554. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +84 -4
  555. package/packages/pm-lifecycle-hooks/README.md +29 -0
  556. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +18 -0
  557. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +20 -0
  558. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +9 -0
  559. package/packages/pm-lifecycle-hooks/package.json +52 -0
  560. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +13 -1
  561. package/packages/pm-search-advanced/extensions/search-advanced/index.js +69 -1
  562. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +91 -2
  563. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +13 -1
  564. package/packages/pm-templates/extensions/templates/manifest.json +6 -1
  565. package/packages/pm-todos/extensions/todos/index.js +3 -7
  566. package/packages/pm-todos/extensions/todos/index.ts +55 -42
  567. package/packages/pm-todos/extensions/todos/manifest.json +13 -1
  568. package/scripts/bundle-cli.mjs +121 -17
  569. package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
  570. package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
  571. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
  572. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
  573. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
  574. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
  575. package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
  576. package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
  577. package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
  578. package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
@@ -0,0 +1,1714 @@
1
+ import {
2
+ assertNoLegacyNoneToken,
3
+ assertNoLegacyNoneTokens,
4
+ ensureEnumValue,
5
+ isLegacyNoneToken,
6
+ normalizeRiskInput,
7
+ normalizeSeverityInput,
8
+ parseConfidenceInput,
9
+ parseDocs,
10
+ parseEventEntries,
11
+ parseFiles,
12
+ parseLogSeed,
13
+ parseRegressionInput,
14
+ parseReminderEntries,
15
+ parseTests,
16
+ parseTypeOptionEntries,
17
+ resolvePriority
18
+ } from "./chunk-OUF3ARDX.js";
19
+ import {
20
+ applyTagRemovals,
21
+ createStdinTokenResolver,
22
+ mergeAdditiveTags,
23
+ parseCsvKv,
24
+ parseOptionalNumber,
25
+ parseTags
26
+ } from "./chunk-CJDQB2ED.js";
27
+ import {
28
+ runClose
29
+ } from "./chunk-ATBVS6WW.js";
30
+ import {
31
+ normalizeParentReferenceValue,
32
+ validateMissingParentReference,
33
+ validateSprintOrReleaseValue
34
+ } from "./chunk-XX5LRINW.js";
35
+ import {
36
+ buildInvalidTypeError
37
+ } from "./chunk-KK6YPGH3.js";
38
+ import {
39
+ applyRegisteredItemFieldDefaultsAndValidation,
40
+ buildItemNotFoundError,
41
+ collectRegisteredItemFieldNames,
42
+ locateItem,
43
+ mutateItem,
44
+ parseRegisteredItemFieldAssignments,
45
+ readLocatedItem,
46
+ toItemRecord
47
+ } from "./chunk-XG7RJYHV.js";
48
+ import {
49
+ normalizeItemId
50
+ } from "./chunk-KA24HME7.js";
51
+ import {
52
+ collectRuntimeUpdateFieldValues,
53
+ normalizeStatusInput
54
+ } from "./chunk-HPH6X4ZZ.js";
55
+ import {
56
+ canonicalizeCommandOptionKey,
57
+ commandOptionFlagLabel,
58
+ resolveCommandOptionPolicyState,
59
+ resolveItemTypeRegistry,
60
+ resolveTypeDefinition,
61
+ resolveTypeName,
62
+ validateTypeOptions
63
+ } from "./chunk-4PJQSECJ.js";
64
+ import {
65
+ resolveIsoOrRelative
66
+ } from "./chunk-RANZIID5.js";
67
+ import {
68
+ DEPENDENCY_KIND_VALUES,
69
+ EXIT_CODE,
70
+ ISSUE_SEVERITY_VALUES,
71
+ PmCliError,
72
+ RISK_VALUES,
73
+ getActiveExtensionRegistrations,
74
+ getSettingsPath,
75
+ pathExists,
76
+ readSettings,
77
+ resolvePmRoot,
78
+ resolveRuntimeFieldRegistry,
79
+ resolveRuntimeStatusRegistry,
80
+ stableValueEquals
81
+ } from "./chunk-SRVKTWPR.js";
82
+
83
+ // dist/core/schema/type-workflows.js
84
+ !(function() {
85
+ try {
86
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
87
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "70ab7197-566b-52de-8a82-e432b324ad8d");
88
+ } catch (e2) {
89
+ }
90
+ })();
91
+ function normalizeStatusToken(value) {
92
+ return typeof value === "string" ? value.trim().toLowerCase().replaceAll(/[\s-]+/g, "_") : "";
93
+ }
94
+ function normalizeTypeName(value) {
95
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
96
+ }
97
+ function resolveStatusId(value, statusRegistry) {
98
+ const token = normalizeStatusToken(value);
99
+ if (token.length === 0) {
100
+ return "";
101
+ }
102
+ return statusRegistry?.alias_to_id?.get(token) ?? token;
103
+ }
104
+ function resolveTypeWorkflows(schema) {
105
+ const rawWorkflows = Array.isArray(schema?.type_workflows) ? schema.type_workflows : [];
106
+ const byType = /* @__PURE__ */ new Map();
107
+ for (const entry of rawWorkflows) {
108
+ const type = normalizeTypeName(entry?.type);
109
+ if (type.length === 0) {
110
+ continue;
111
+ }
112
+ if (!Array.isArray(entry?.allowed_transitions)) {
113
+ continue;
114
+ }
115
+ const pairs = entry.allowed_transitions;
116
+ const record = byType.get(type) ?? { pairs: [], denyAll: false };
117
+ if (pairs.length === 0) {
118
+ record.denyAll = true;
119
+ }
120
+ for (const pair of pairs) {
121
+ if (!Array.isArray(pair) || pair.length !== 2) {
122
+ continue;
123
+ }
124
+ const from = normalizeStatusToken(pair[0]);
125
+ const to = normalizeStatusToken(pair[1]);
126
+ if (from.length === 0 || to.length === 0) {
127
+ continue;
128
+ }
129
+ if (record.pairs.some((candidate) => candidate[0] === from && candidate[1] === to)) {
130
+ continue;
131
+ }
132
+ record.pairs.push([from, to]);
133
+ }
134
+ byType.set(type, record);
135
+ }
136
+ return [...byType.entries()].filter(([, record]) => record.pairs.length > 0 || record.denyAll).map(([type, record]) => ({ type, allowed_transitions: record.pairs })).sort((left, right) => left.type.localeCompare(right.type));
137
+ }
138
+ function evaluateTransition(input) {
139
+ const typeName = normalizeTypeName(input.typeName);
140
+ const matched = input.typeWorkflows.find((workflow) => workflow.type === typeName);
141
+ if (!matched) {
142
+ return { allowed: true, hasRule: false, allowedTransitions: [] };
143
+ }
144
+ const from = resolveStatusId(input.fromStatus, input.statusRegistry);
145
+ const to = resolveStatusId(input.toStatus, input.statusRegistry);
146
+ if (from.length > 0 && from === to) {
147
+ return { allowed: true, hasRule: true, allowedTransitions: matched.allowed_transitions };
148
+ }
149
+ const allowed = matched.allowed_transitions.some((pair) => {
150
+ const ruleFrom = resolveStatusId(pair[0], input.statusRegistry);
151
+ const ruleTo = resolveStatusId(pair[1], input.statusRegistry);
152
+ return ruleFrom === from && ruleTo === to;
153
+ });
154
+ return { allowed, hasRule: true, allowedTransitions: matched.allowed_transitions };
155
+ }
156
+ function describeAllowedTransitions(allowedTransitions) {
157
+ if (allowedTransitions.length === 0) {
158
+ return "(no transitions allowed)";
159
+ }
160
+ return allowedTransitions.map((pair) => `${pair[0]} -> ${pair[1]}`).join(", ");
161
+ }
162
+
163
+ // dist/cli/commands/update.js
164
+ !(function() {
165
+ try {
166
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
167
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "74fefeac-195a-595c-aa23-d38e5b855b84");
168
+ } catch (e2) {
169
+ }
170
+ })();
171
+ var UPDATE_UNSET_FIELD_DEFINITIONS = [
172
+ { canonical: "tags", aliases: ["tags"], optionKey: "tags", frontMatterKey: "tags" },
173
+ { canonical: "close-reason", aliases: ["close_reason", "close-reason"], optionKey: "closeReason", frontMatterKey: "close_reason" },
174
+ { canonical: "deadline", aliases: ["deadline"], optionKey: "deadline", frontMatterKey: "deadline" },
175
+ {
176
+ canonical: "estimate",
177
+ aliases: ["estimate", "estimated_minutes", "estimated-minutes"],
178
+ optionKey: "estimatedMinutes",
179
+ frontMatterKey: "estimated_minutes"
180
+ },
181
+ {
182
+ canonical: "acceptance-criteria",
183
+ aliases: ["acceptance_criteria", "acceptance-criteria", "ac"],
184
+ optionKey: "acceptanceCriteria",
185
+ frontMatterKey: "acceptance_criteria"
186
+ },
187
+ {
188
+ canonical: "definition-of-ready",
189
+ aliases: ["definition_of_ready", "definition-of-ready"],
190
+ optionKey: "definitionOfReady",
191
+ frontMatterKey: "definition_of_ready"
192
+ },
193
+ { canonical: "order", aliases: ["order", "rank"], optionKey: "order", frontMatterKey: "order" },
194
+ { canonical: "goal", aliases: ["goal"], optionKey: "goal", frontMatterKey: "goal" },
195
+ { canonical: "objective", aliases: ["objective"], optionKey: "objective", frontMatterKey: "objective" },
196
+ { canonical: "value", aliases: ["value"], optionKey: "value", frontMatterKey: "value" },
197
+ { canonical: "impact", aliases: ["impact"], optionKey: "impact", frontMatterKey: "impact" },
198
+ { canonical: "outcome", aliases: ["outcome"], optionKey: "outcome", frontMatterKey: "outcome" },
199
+ { canonical: "why-now", aliases: ["why_now", "why-now"], optionKey: "whyNow", frontMatterKey: "why_now" },
200
+ { canonical: "assignee", aliases: ["assignee"], optionKey: "assignee", frontMatterKey: "assignee" },
201
+ { canonical: "parent", aliases: ["parent"], optionKey: "parent", frontMatterKey: "parent" },
202
+ { canonical: "reviewer", aliases: ["reviewer"], optionKey: "reviewer", frontMatterKey: "reviewer" },
203
+ { canonical: "risk", aliases: ["risk"], optionKey: "risk", frontMatterKey: "risk" },
204
+ { canonical: "confidence", aliases: ["confidence"], optionKey: "confidence", frontMatterKey: "confidence" },
205
+ { canonical: "sprint", aliases: ["sprint"], optionKey: "sprint", frontMatterKey: "sprint" },
206
+ { canonical: "release", aliases: ["release"], optionKey: "release", frontMatterKey: "release" },
207
+ {
208
+ canonical: "blocked-by",
209
+ aliases: ["blocked_by", "blocked-by"],
210
+ optionKey: "blockedBy",
211
+ frontMatterKey: "blocked_by"
212
+ },
213
+ {
214
+ canonical: "blocked-reason",
215
+ aliases: ["blocked_reason", "blocked-reason"],
216
+ optionKey: "blockedReason",
217
+ frontMatterKey: "blocked_reason"
218
+ },
219
+ {
220
+ canonical: "unblock-note",
221
+ aliases: ["unblock_note", "unblock-note"],
222
+ optionKey: "unblockNote",
223
+ frontMatterKey: "unblock_note"
224
+ },
225
+ { canonical: "reporter", aliases: ["reporter"], optionKey: "reporter", frontMatterKey: "reporter" },
226
+ { canonical: "severity", aliases: ["severity"], optionKey: "severity", frontMatterKey: "severity" },
227
+ {
228
+ canonical: "environment",
229
+ aliases: ["environment"],
230
+ optionKey: "environment",
231
+ frontMatterKey: "environment"
232
+ },
233
+ {
234
+ canonical: "repro-steps",
235
+ aliases: ["repro_steps", "repro-steps"],
236
+ optionKey: "reproSteps",
237
+ frontMatterKey: "repro_steps"
238
+ },
239
+ {
240
+ canonical: "resolution",
241
+ aliases: ["resolution"],
242
+ optionKey: "resolution",
243
+ frontMatterKey: "resolution"
244
+ },
245
+ {
246
+ canonical: "expected-result",
247
+ aliases: ["expected_result", "expected-result"],
248
+ optionKey: "expectedResult",
249
+ frontMatterKey: "expected_result"
250
+ },
251
+ {
252
+ canonical: "actual-result",
253
+ aliases: ["actual_result", "actual-result"],
254
+ optionKey: "actualResult",
255
+ frontMatterKey: "actual_result"
256
+ },
257
+ {
258
+ canonical: "affected-version",
259
+ aliases: ["affected_version", "affected-version"],
260
+ optionKey: "affectedVersion",
261
+ frontMatterKey: "affected_version"
262
+ },
263
+ {
264
+ canonical: "fixed-version",
265
+ aliases: ["fixed_version", "fixed-version"],
266
+ optionKey: "fixedVersion",
267
+ frontMatterKey: "fixed_version"
268
+ },
269
+ { canonical: "component", aliases: ["component"], optionKey: "component", frontMatterKey: "component" },
270
+ { canonical: "regression", aliases: ["regression"], optionKey: "regression", frontMatterKey: "regression" },
271
+ {
272
+ canonical: "customer-impact",
273
+ aliases: ["customer_impact", "customer-impact"],
274
+ optionKey: "customerImpact",
275
+ frontMatterKey: "customer_impact"
276
+ }
277
+ ];
278
+ var UPDATE_UNSET_ALIAS_MAP = (() => {
279
+ const map = /* @__PURE__ */ new Map();
280
+ for (const definition of UPDATE_UNSET_FIELD_DEFINITIONS) {
281
+ for (const alias of definition.aliases) {
282
+ map.set(alias, {
283
+ optionKey: definition.optionKey,
284
+ frontMatterKey: definition.frontMatterKey
285
+ });
286
+ }
287
+ }
288
+ return map;
289
+ })();
290
+ var UPDATE_OPTION_KEY_TO_UNSET_CANONICAL = new Map(UPDATE_UNSET_FIELD_DEFINITIONS.map((definition) => [definition.optionKey, definition.canonical]));
291
+ var UPDATE_UNSET_SUPPORTED_CANONICAL_FIELDS = UPDATE_UNSET_FIELD_DEFINITIONS.map((definition) => definition.canonical).sort((left, right) => left.localeCompare(right)).join(", ");
292
+ var AUDIT_UPDATE_DISALLOWED_UNSET_FRONT_MATTER_KEYS = /* @__PURE__ */ new Set([
293
+ "close_reason",
294
+ "assignee",
295
+ "parent",
296
+ "blocked_by",
297
+ "blocked_reason",
298
+ "unblock_note",
299
+ "dependencies",
300
+ "comments",
301
+ "notes",
302
+ "learnings",
303
+ "files",
304
+ "tests",
305
+ "docs",
306
+ "reminders",
307
+ "events"
308
+ ]);
309
+ function toAuthor(candidate, defaultAuthor) {
310
+ const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;
311
+ const trimmed = resolved.trim();
312
+ return trimmed || "unknown";
313
+ }
314
+ var UPDATE_LEGACY_NONE_COLLECTION_NORMALIZERS = [
315
+ { optionKey: "dep", clearFlagKey: "clearDeps", valueFlag: "--dep", clearFlag: "--clear-deps", disableReplaceFlagKey: "replaceDeps" },
316
+ { optionKey: "comment", clearFlagKey: "clearComments", valueFlag: "--comment", clearFlag: "--clear-comments" },
317
+ { optionKey: "note", clearFlagKey: "clearNotes", valueFlag: "--note", clearFlag: "--clear-notes" },
318
+ { optionKey: "learning", clearFlagKey: "clearLearnings", valueFlag: "--learning", clearFlag: "--clear-learnings" },
319
+ { optionKey: "file", clearFlagKey: "clearFiles", valueFlag: "--file", clearFlag: "--clear-files" },
320
+ { optionKey: "test", clearFlagKey: "clearTests", valueFlag: "--test", clearFlag: "--clear-tests", disableReplaceFlagKey: "replaceTests" },
321
+ { optionKey: "doc", clearFlagKey: "clearDocs", valueFlag: "--doc", clearFlag: "--clear-docs" },
322
+ { optionKey: "reminder", clearFlagKey: "clearReminders", valueFlag: "--reminder", clearFlag: "--clear-reminders" },
323
+ { optionKey: "event", clearFlagKey: "clearEvents", valueFlag: "--event", clearFlag: "--clear-events" },
324
+ { optionKey: "typeOption", clearFlagKey: "clearTypeOptions", valueFlag: "--type-option", clearFlag: "--clear-type-options" }
325
+ ];
326
+ function normalizeLegacyNoneUpdateOptions(options) {
327
+ const normalized = {
328
+ ...options,
329
+ unset: options.unset ? [...options.unset] : void 0
330
+ };
331
+ const appendUnsetTarget = (value) => {
332
+ const current = normalized.unset ? [...normalized.unset] : [];
333
+ if (!current.includes(value)) {
334
+ current.push(value);
335
+ }
336
+ normalized.unset = current;
337
+ };
338
+ const scalarOptionKeys = /* @__PURE__ */ new Set([...UPDATE_OPTION_KEY_TO_UNSET_CANONICAL.keys(), "rank"]);
339
+ for (const optionKey of scalarOptionKeys) {
340
+ const candidate = normalized[optionKey];
341
+ if (typeof candidate !== "string" || !isLegacyNoneToken(candidate)) {
342
+ continue;
343
+ }
344
+ const canonicalUnset = optionKey === "rank" ? "order" : UPDATE_OPTION_KEY_TO_UNSET_CANONICAL.get(optionKey) ?? optionKey;
345
+ appendUnsetTarget(canonicalUnset);
346
+ normalized[optionKey] = void 0;
347
+ }
348
+ for (const definition of UPDATE_LEGACY_NONE_COLLECTION_NORMALIZERS) {
349
+ const entries = normalized[definition.optionKey];
350
+ if (!Array.isArray(entries) || entries.length === 0) {
351
+ continue;
352
+ }
353
+ const hasLegacy = entries.some((entry) => isLegacyNoneToken(entry));
354
+ if (!hasLegacy) {
355
+ continue;
356
+ }
357
+ const concreteEntries = entries.filter((entry) => !isLegacyNoneToken(entry));
358
+ if (concreteEntries.length > 0) {
359
+ throw new PmCliError(`Cannot mix legacy clear token "none"/"null" with concrete ${definition.valueFlag} entries. Use ${definition.clearFlag} to clear or provide explicit entries.`, EXIT_CODE.USAGE);
360
+ }
361
+ normalized[definition.optionKey] = void 0;
362
+ normalized[definition.clearFlagKey] = true;
363
+ if (definition.disableReplaceFlagKey) {
364
+ normalized[definition.disableReplaceFlagKey] = false;
365
+ }
366
+ }
367
+ return normalized;
368
+ }
369
+ function resolveRuntimeUnsetDefinition(token, runtimeFieldRegistry) {
370
+ if (!runtimeFieldRegistry) {
371
+ return void 0;
372
+ }
373
+ for (const definition of runtimeFieldRegistry.definitions) {
374
+ if (definition.allow_unset === false) {
375
+ continue;
376
+ }
377
+ const candidates = /* @__PURE__ */ new Set([
378
+ definition.key,
379
+ definition.metadata_key,
380
+ definition.cli_flag.replaceAll("-", "_"),
381
+ definition.cli_flag,
382
+ ...definition.cli_aliases.map((alias) => alias.replaceAll("-", "_")),
383
+ ...definition.cli_aliases
384
+ ]);
385
+ if (!candidates.has(token)) {
386
+ continue;
387
+ }
388
+ return {
389
+ optionKey: definition.key,
390
+ frontMatterKey: definition.metadata_key
391
+ };
392
+ }
393
+ return void 0;
394
+ }
395
+ function parseUpdateUnsetTargets(raw, runtimeFieldRegistry, extensionFieldNames = []) {
396
+ const frontMatterKeys = /* @__PURE__ */ new Set();
397
+ const optionKeys = /* @__PURE__ */ new Set();
398
+ if (!raw || raw.length === 0) {
399
+ return { frontMatterKeys, optionKeys };
400
+ }
401
+ for (const entry of raw) {
402
+ const trimmed = entry.trim().toLowerCase();
403
+ if (!trimmed) {
404
+ throw new PmCliError("--unset values must not be empty", EXIT_CODE.USAGE);
405
+ }
406
+ if (isLegacyNoneToken(trimmed)) {
407
+ throw new PmCliError('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline', EXIT_CODE.USAGE);
408
+ }
409
+ const extensionFieldName = extensionFieldNames.find((fieldName) => {
410
+ const normalizedFieldName = fieldName.toLowerCase();
411
+ return normalizedFieldName === trimmed || normalizedFieldName.replaceAll("_", "-") === trimmed || normalizedFieldName.replaceAll("-", "_") === trimmed;
412
+ });
413
+ const definition = UPDATE_UNSET_ALIAS_MAP.get(trimmed) ?? resolveRuntimeUnsetDefinition(trimmed, runtimeFieldRegistry) ?? (extensionFieldName ? { optionKey: "field", frontMatterKey: extensionFieldName } : void 0);
414
+ if (!definition) {
415
+ throw new PmCliError(`Unsupported --unset field "${entry}". Supported fields: ${UPDATE_UNSET_SUPPORTED_CANONICAL_FIELDS}`, EXIT_CODE.USAGE);
416
+ }
417
+ frontMatterKeys.add(definition.frontMatterKey);
418
+ optionKeys.add(definition.optionKey);
419
+ }
420
+ return { frontMatterKeys, optionKeys };
421
+ }
422
+ function enforceAllowAuditUpdateScope(options, clearFrontMatterKeys) {
423
+ const allowAuditUpdate = options.allowAuditUpdate === true;
424
+ const allowAuditDepUpdate = options.allowAuditDepUpdate === true;
425
+ if (!allowAuditUpdate && !allowAuditDepUpdate) {
426
+ return;
427
+ }
428
+ if (allowAuditUpdate && allowAuditDepUpdate) {
429
+ throw new PmCliError("Choose either --allow-audit-update or --allow-audit-dep-update; these override modes are mutually exclusive.", EXIT_CODE.USAGE);
430
+ }
431
+ const pushIf = (condition, flag, list) => {
432
+ if (condition) {
433
+ list.push(flag);
434
+ }
435
+ };
436
+ if (allowAuditDepUpdate) {
437
+ const disallowedFlags2 = [];
438
+ pushIf(options.title !== void 0, "--title", disallowedFlags2);
439
+ pushIf(options.description !== void 0, "--description", disallowedFlags2);
440
+ pushIf(options.body !== void 0, "--body", disallowedFlags2);
441
+ pushIf(options.status !== void 0, "--status", disallowedFlags2);
442
+ pushIf(options.closeReason !== void 0, "--close-reason", disallowedFlags2);
443
+ pushIf(options.priority !== void 0, "--priority", disallowedFlags2);
444
+ pushIf(options.type !== void 0, "--type", disallowedFlags2);
445
+ pushIf(options.tags !== void 0, "--tags", disallowedFlags2);
446
+ pushIf(Array.isArray(options.addTags) && options.addTags.length > 0, "--add-tags", disallowedFlags2);
447
+ pushIf(Array.isArray(options.removeTags) && options.removeTags.length > 0, "--remove-tags", disallowedFlags2);
448
+ pushIf(options.deadline !== void 0, "--deadline", disallowedFlags2);
449
+ pushIf(options.estimatedMinutes !== void 0, "--estimate", disallowedFlags2);
450
+ pushIf(options.acceptanceCriteria !== void 0, "--acceptance-criteria", disallowedFlags2);
451
+ pushIf(options.definitionOfReady !== void 0, "--definition-of-ready", disallowedFlags2);
452
+ pushIf(options.order !== void 0 || options.rank !== void 0, "--order/--rank", disallowedFlags2);
453
+ pushIf(options.goal !== void 0, "--goal", disallowedFlags2);
454
+ pushIf(options.objective !== void 0, "--objective", disallowedFlags2);
455
+ pushIf(options.value !== void 0, "--value", disallowedFlags2);
456
+ pushIf(options.impact !== void 0, "--impact", disallowedFlags2);
457
+ pushIf(options.outcome !== void 0, "--outcome", disallowedFlags2);
458
+ pushIf(options.whyNow !== void 0, "--why-now", disallowedFlags2);
459
+ pushIf(options.assignee !== void 0, "--assignee", disallowedFlags2);
460
+ pushIf(options.parent !== void 0, "--parent", disallowedFlags2);
461
+ pushIf(options.reviewer !== void 0, "--reviewer", disallowedFlags2);
462
+ pushIf(options.risk !== void 0, "--risk", disallowedFlags2);
463
+ pushIf(options.confidence !== void 0, "--confidence", disallowedFlags2);
464
+ pushIf(options.sprint !== void 0, "--sprint", disallowedFlags2);
465
+ pushIf(options.release !== void 0, "--release", disallowedFlags2);
466
+ pushIf(options.blockedBy !== void 0, "--blocked-by", disallowedFlags2);
467
+ pushIf(options.blockedReason !== void 0, "--blocked-reason", disallowedFlags2);
468
+ pushIf(options.unblockNote !== void 0, "--unblock-note", disallowedFlags2);
469
+ pushIf(options.reporter !== void 0, "--reporter", disallowedFlags2);
470
+ pushIf(options.severity !== void 0, "--severity", disallowedFlags2);
471
+ pushIf(options.environment !== void 0, "--environment", disallowedFlags2);
472
+ pushIf(options.reproSteps !== void 0, "--repro-steps", disallowedFlags2);
473
+ pushIf(options.resolution !== void 0, "--resolution", disallowedFlags2);
474
+ pushIf(options.expectedResult !== void 0, "--expected-result", disallowedFlags2);
475
+ pushIf(options.actualResult !== void 0, "--actual-result", disallowedFlags2);
476
+ pushIf(options.affectedVersion !== void 0, "--affected-version", disallowedFlags2);
477
+ pushIf(options.fixedVersion !== void 0, "--fixed-version", disallowedFlags2);
478
+ pushIf(options.component !== void 0, "--component", disallowedFlags2);
479
+ pushIf(options.regression !== void 0, "--regression", disallowedFlags2);
480
+ pushIf(options.customerImpact !== void 0, "--customer-impact", disallowedFlags2);
481
+ pushIf(options.depRemove !== void 0, "--dep-remove", disallowedFlags2);
482
+ pushIf(options.replaceDeps === true, "--replace-deps", disallowedFlags2);
483
+ pushIf(options.replaceTests === true, "--replace-tests", disallowedFlags2);
484
+ pushIf(options.comment !== void 0, "--comment", disallowedFlags2);
485
+ pushIf(options.note !== void 0, "--note", disallowedFlags2);
486
+ pushIf(options.learning !== void 0, "--learning", disallowedFlags2);
487
+ pushIf(options.file !== void 0, "--file", disallowedFlags2);
488
+ pushIf(options.test !== void 0, "--test", disallowedFlags2);
489
+ pushIf(options.doc !== void 0, "--doc", disallowedFlags2);
490
+ pushIf(options.reminder !== void 0, "--reminder", disallowedFlags2);
491
+ pushIf(options.event !== void 0, "--event", disallowedFlags2);
492
+ pushIf(options.typeOption !== void 0, "--type-option", disallowedFlags2);
493
+ pushIf(options.clearDeps === true, "--clear-deps", disallowedFlags2);
494
+ pushIf(options.clearComments === true, "--clear-comments", disallowedFlags2);
495
+ pushIf(options.clearNotes === true, "--clear-notes", disallowedFlags2);
496
+ pushIf(options.clearLearnings === true, "--clear-learnings", disallowedFlags2);
497
+ pushIf(options.clearFiles === true, "--clear-files", disallowedFlags2);
498
+ pushIf(options.clearTests === true, "--clear-tests", disallowedFlags2);
499
+ pushIf(options.clearDocs === true, "--clear-docs", disallowedFlags2);
500
+ pushIf(options.clearReminders === true, "--clear-reminders", disallowedFlags2);
501
+ pushIf(options.clearEvents === true, "--clear-events", disallowedFlags2);
502
+ pushIf(options.clearTypeOptions === true, "--clear-type-options", disallowedFlags2);
503
+ pushIf(options.force === true, "--force", disallowedFlags2);
504
+ pushIf(clearFrontMatterKeys.size > 0, "--unset", disallowedFlags2);
505
+ if (options.dep === void 0 || options.dep.length === 0) {
506
+ throw new PmCliError("--allow-audit-dep-update requires at least one --dep value", EXIT_CODE.USAGE);
507
+ }
508
+ if (disallowedFlags2.length > 0) {
509
+ throw new PmCliError(`--allow-audit-dep-update supports append-only dependency additions via --dep. Remove restricted options: ${disallowedFlags2.join(", ")}`, EXIT_CODE.USAGE);
510
+ }
511
+ return;
512
+ }
513
+ const disallowedFlags = [];
514
+ if (options.status !== void 0) {
515
+ disallowedFlags.push("--status");
516
+ }
517
+ if (options.closeReason !== void 0) {
518
+ disallowedFlags.push("--close-reason");
519
+ }
520
+ if (options.assignee !== void 0) {
521
+ disallowedFlags.push("--assignee");
522
+ }
523
+ if (options.parent !== void 0) {
524
+ disallowedFlags.push("--parent");
525
+ }
526
+ if (options.blockedBy !== void 0) {
527
+ disallowedFlags.push("--blocked-by");
528
+ }
529
+ if (options.blockedReason !== void 0) {
530
+ disallowedFlags.push("--blocked-reason");
531
+ }
532
+ if (options.unblockNote !== void 0) {
533
+ disallowedFlags.push("--unblock-note");
534
+ }
535
+ if (options.dep !== void 0) {
536
+ disallowedFlags.push("--dep");
537
+ }
538
+ if (options.depRemove !== void 0) {
539
+ disallowedFlags.push("--dep-remove");
540
+ }
541
+ if (options.replaceDeps === true) {
542
+ disallowedFlags.push("--replace-deps");
543
+ }
544
+ if (options.replaceTests === true) {
545
+ disallowedFlags.push("--replace-tests");
546
+ }
547
+ if (options.comment !== void 0) {
548
+ disallowedFlags.push("--comment");
549
+ }
550
+ if (options.note !== void 0) {
551
+ disallowedFlags.push("--note");
552
+ }
553
+ if (options.learning !== void 0) {
554
+ disallowedFlags.push("--learning");
555
+ }
556
+ if (options.file !== void 0) {
557
+ disallowedFlags.push("--file");
558
+ }
559
+ if (options.test !== void 0) {
560
+ disallowedFlags.push("--test");
561
+ }
562
+ if (options.doc !== void 0) {
563
+ disallowedFlags.push("--doc");
564
+ }
565
+ if (options.reminder !== void 0) {
566
+ disallowedFlags.push("--reminder");
567
+ }
568
+ if (options.event !== void 0) {
569
+ disallowedFlags.push("--event");
570
+ }
571
+ if (options.clearDeps === true) {
572
+ disallowedFlags.push("--clear-deps");
573
+ }
574
+ if (options.clearComments === true) {
575
+ disallowedFlags.push("--clear-comments");
576
+ }
577
+ if (options.clearNotes === true) {
578
+ disallowedFlags.push("--clear-notes");
579
+ }
580
+ if (options.clearLearnings === true) {
581
+ disallowedFlags.push("--clear-learnings");
582
+ }
583
+ if (options.clearFiles === true) {
584
+ disallowedFlags.push("--clear-files");
585
+ }
586
+ if (options.clearTests === true) {
587
+ disallowedFlags.push("--clear-tests");
588
+ }
589
+ if (options.clearDocs === true) {
590
+ disallowedFlags.push("--clear-docs");
591
+ }
592
+ if (options.clearReminders === true) {
593
+ disallowedFlags.push("--clear-reminders");
594
+ }
595
+ if (options.clearEvents === true) {
596
+ disallowedFlags.push("--clear-events");
597
+ }
598
+ const disallowedUnset = [...clearFrontMatterKeys].filter((field) => AUDIT_UPDATE_DISALLOWED_UNSET_FRONT_MATTER_KEYS.has(field)).sort((left, right) => left.localeCompare(right)).map((field) => `--unset ${field.replaceAll("_", "-")}`);
599
+ disallowedFlags.push(...disallowedUnset);
600
+ if (disallowedFlags.length > 0) {
601
+ throw new PmCliError(`--allow-audit-update only supports non-lifecycle metadata fields. Remove restricted options: ${disallowedFlags.join(", ")}`, EXIT_CODE.USAGE);
602
+ }
603
+ }
604
+ function parseStatus(value, statusRegistry) {
605
+ const normalized = normalizeStatusInput(value, statusRegistry);
606
+ if (!normalized) {
607
+ const allowedStatuses = statusRegistry.definitions.map((definition) => definition.id);
608
+ throw new PmCliError(`Invalid --status value "${value}". Allowed: ${allowedStatuses.join(", ")}`, EXIT_CODE.USAGE);
609
+ }
610
+ return normalized;
611
+ }
612
+ function enforceTypeWorkflowTransition(params) {
613
+ if (params.enforcement === "off" || params.typeWorkflows.length === 0) {
614
+ return void 0;
615
+ }
616
+ const result = evaluateTransition({
617
+ typeName: params.typeName,
618
+ fromStatus: params.fromStatus,
619
+ toStatus: params.toStatus,
620
+ typeWorkflows: params.typeWorkflows,
621
+ statusRegistry: params.statusRegistry
622
+ });
623
+ if (!result.hasRule || result.allowed) {
624
+ return void 0;
625
+ }
626
+ const normalizedFrom = normalizeStatusInput(params.fromStatus, params.statusRegistry) ?? params.fromStatus;
627
+ const normalizedTo = normalizeStatusInput(params.toStatus, params.statusRegistry) ?? params.toStatus;
628
+ const message = `Disallowed transition for type "${params.typeName}": ${normalizedFrom} -> ${normalizedTo}. Allowed transitions: ${describeAllowedTransitions(result.allowedTransitions)}.`;
629
+ if (params.enforcement === "strict") {
630
+ throw new PmCliError(message, EXIT_CODE.USAGE);
631
+ }
632
+ return `workflow_transition_not_allowed: ${message}`;
633
+ }
634
+ function parseDependencyCreatedAt(value, currentIso) {
635
+ if (!value || value.trim() === "" || value.trim().toLowerCase() === "now") {
636
+ return currentIso;
637
+ }
638
+ const parsed = Date.parse(value);
639
+ if (!Number.isFinite(parsed)) {
640
+ throw new PmCliError(`Invalid dependency created_at timestamp "${value}"`, EXIT_CODE.USAGE);
641
+ }
642
+ return new Date(parsed).toISOString();
643
+ }
644
+ function parseOptionalDependencyString(value) {
645
+ if (value === void 0)
646
+ return void 0;
647
+ const trimmed = value.trim();
648
+ return trimmed.length > 0 ? trimmed : void 0;
649
+ }
650
+ function looksLikeStructuredDependencyEntry(raw) {
651
+ if (raw.startsWith("```") || raw.includes("\n")) {
652
+ return true;
653
+ }
654
+ return /^(?:[-*+]\s+)?(?:id|kind|type|author|created_at|source_kind)\s*[:=]/i.test(raw);
655
+ }
656
+ var DEPENDENCY_KIND_INPUT_ALIASES = {
657
+ "blocked-by": "blocked_by",
658
+ depends_on: "blocked_by",
659
+ "depends-on": "blocked_by"
660
+ };
661
+ function normalizeDependencyKindInput(raw) {
662
+ if (typeof raw !== "string") {
663
+ return raw;
664
+ }
665
+ const trimmed = raw.trim();
666
+ const alias = DEPENDENCY_KIND_INPUT_ALIASES[trimmed.toLowerCase()];
667
+ return alias ?? trimmed;
668
+ }
669
+ function parseDependencyAdditions(raw, prefix, nowIso) {
670
+ if (!raw) {
671
+ return { additions: [] };
672
+ }
673
+ assertNoLegacyNoneTokens(raw, "--dep", "Use --clear-deps to clear dependencies.");
674
+ const additions = raw.map((entry) => {
675
+ const trimmedEntry = entry.trim();
676
+ const kv = looksLikeStructuredDependencyEntry(trimmedEntry) ? parseCsvKv(entry, "--dep") : { id: trimmedEntry, kind: "related" };
677
+ const id = kv.id?.trim();
678
+ const kind = normalizeDependencyKindInput((kv.kind ?? kv.type)?.trim());
679
+ if (!id || !kind) {
680
+ throw new PmCliError("--dep requires id and kind, or a bare item id to add a related dependency", EXIT_CODE.USAGE);
681
+ }
682
+ if (id.toLowerCase() === "undefined") {
683
+ throw new PmCliError(`--dep id must not use placeholder token "${id}". Use --clear-deps to clear dependencies.`, EXIT_CODE.USAGE);
684
+ }
685
+ const sourceKind = parseOptionalDependencyString(kv.source_kind);
686
+ return {
687
+ id: normalizeItemId(id, prefix),
688
+ kind: ensureEnumValue(kind, DEPENDENCY_KIND_VALUES, "dependency kind"),
689
+ created_at: parseDependencyCreatedAt(kv.created_at, nowIso),
690
+ author: parseOptionalDependencyString(kv.author),
691
+ source_kind: sourceKind
692
+ };
693
+ });
694
+ return { additions };
695
+ }
696
+ function parseDependencyRemovals(raw, prefix) {
697
+ if (!raw) {
698
+ return [];
699
+ }
700
+ assertNoLegacyNoneTokens(raw, "--dep-remove");
701
+ return raw.map((entry) => {
702
+ const trimmed = entry.trim();
703
+ if (!trimmed) {
704
+ throw new PmCliError("--dep-remove requires id or key/value selectors", EXIT_CODE.USAGE);
705
+ }
706
+ if (trimmed.includes("=") || /^(?:[-*+]\s+)?(?:id|kind|type|source_kind)\s*[:=]/i.test(trimmed) || trimmed.startsWith("```")) {
707
+ const kv = parseCsvKv(trimmed, "--dep-remove");
708
+ const idRaw = kv.id?.trim();
709
+ if (!idRaw) {
710
+ throw new PmCliError("--dep-remove key/value form requires id=<value>", EXIT_CODE.USAGE);
711
+ }
712
+ if (idRaw.toLowerCase() === "undefined") {
713
+ throw new PmCliError(`--dep-remove id must not use placeholder token "${idRaw}"`, EXIT_CODE.USAGE);
714
+ }
715
+ const kindRaw = normalizeDependencyKindInput(parseOptionalDependencyString(kv.kind ?? kv.type));
716
+ const sourceKind = parseOptionalDependencyString(kv.source_kind);
717
+ return {
718
+ id: normalizeItemId(idRaw, prefix),
719
+ kind: kindRaw ? ensureEnumValue(kindRaw, DEPENDENCY_KIND_VALUES, "dependency kind") : void 0,
720
+ source_kind: sourceKind
721
+ };
722
+ }
723
+ if (trimmed.toLowerCase() === "undefined") {
724
+ throw new PmCliError(`--dep-remove id must not use placeholder token "${trimmed}"`, EXIT_CODE.USAGE);
725
+ }
726
+ return {
727
+ id: normalizeItemId(trimmed, prefix)
728
+ };
729
+ });
730
+ }
731
+ function dependencyKey(value) {
732
+ return `${value.id}::${value.kind}::${value.source_kind ?? ""}`;
733
+ }
734
+ function reconcileBlockedByDependency(current, nextBlockedById, nowIsoValue, author) {
735
+ let next = [...current ?? []];
736
+ let changed = false;
737
+ const filtered = next.filter((dep) => dep.kind !== "blocked_by" || dep.id === nextBlockedById);
738
+ if (filtered.length !== next.length) {
739
+ next = filtered;
740
+ changed = true;
741
+ }
742
+ if (nextBlockedById && !next.some((dep) => dep.kind === "blocked_by" && dep.id === nextBlockedById)) {
743
+ next.push({ id: nextBlockedById, kind: "blocked_by", created_at: nowIsoValue, author });
744
+ changed = true;
745
+ }
746
+ if (!changed) {
747
+ return { dependencies: current, changed: false };
748
+ }
749
+ return { dependencies: next.length > 0 ? next : void 0, changed: true };
750
+ }
751
+ async function resolveBlockedByDependencyTarget(blockedByOption, blockedByCleared, pmRoot, idPrefix, itemFormat, typeToFolder) {
752
+ if (blockedByOption === void 0 || blockedByCleared) {
753
+ return {};
754
+ }
755
+ const blockedByValue = blockedByOption.trim();
756
+ if (blockedByValue.length === 0) {
757
+ return {};
758
+ }
759
+ const located = await locateItem(pmRoot, normalizeItemId(blockedByValue, idPrefix), idPrefix, itemFormat, typeToFolder);
760
+ return located ? { id: located.id } : { unresolved: blockedByValue };
761
+ }
762
+ function applyBlockedByDependencyEdge(metadata, resolvedBlockedById, nowIsoValue, author, changedFields) {
763
+ const reconciled = reconcileBlockedByDependency(metadata.dependencies, resolvedBlockedById, nowIsoValue, author);
764
+ if (!reconciled.changed) {
765
+ return;
766
+ }
767
+ if (reconciled.dependencies === void 0) {
768
+ delete metadata.dependencies;
769
+ } else {
770
+ metadata.dependencies = reconciled.dependencies;
771
+ }
772
+ if (!changedFields.includes("dependencies")) {
773
+ changedFields.push("dependencies");
774
+ }
775
+ }
776
+ function fileKey(value) {
777
+ return `${value.path}::${value.scope}`;
778
+ }
779
+ function docKey(value) {
780
+ return `${value.path}::${value.scope}`;
781
+ }
782
+ function testKey(value) {
783
+ return `${value.command}::${value.path ?? ""}::${value.scope}::${value.pm_context_mode ?? ""}`;
784
+ }
785
+ function matchesDependencySelector(value, selector) {
786
+ if (value.id !== selector.id) {
787
+ return false;
788
+ }
789
+ if (selector.kind && value.kind !== selector.kind) {
790
+ return false;
791
+ }
792
+ if (selector.source_kind !== void 0 && (value.source_kind ?? void 0) !== selector.source_kind) {
793
+ return false;
794
+ }
795
+ return true;
796
+ }
797
+ function ensurePriority(raw) {
798
+ return resolvePriority(raw);
799
+ }
800
+ function normalizeUpdatePolicyOptionKey(raw, typeName) {
801
+ const canonical = canonicalizeCommandOptionKey("update", raw);
802
+ if (!canonical) {
803
+ throw new PmCliError(`Unsupported command_option_policies option "${raw}" for update command on type "${typeName}"`, EXIT_CODE.CONFLICT);
804
+ }
805
+ return canonical;
806
+ }
807
+ function collectProvidedUpdatePolicyOptions(options, extensionFieldNames) {
808
+ const provided = /* @__PURE__ */ new Set();
809
+ const mark = (optionKey, isProvided) => {
810
+ if (isProvided) {
811
+ provided.add(optionKey);
812
+ }
813
+ };
814
+ mark("title", options.title !== void 0);
815
+ mark("description", options.description !== void 0);
816
+ mark("body", options.body !== void 0);
817
+ mark("status", options.status !== void 0);
818
+ mark("closeReason", options.closeReason !== void 0);
819
+ mark("priority", options.priority !== void 0);
820
+ mark("type", options.type !== void 0);
821
+ mark("tags", options.tags !== void 0 || Array.isArray(options.addTags) && options.addTags.length > 0 || Array.isArray(options.removeTags) && options.removeTags.length > 0);
822
+ mark("deadline", options.deadline !== void 0);
823
+ mark("estimatedMinutes", options.estimatedMinutes !== void 0);
824
+ mark("acceptanceCriteria", options.acceptanceCriteria !== void 0);
825
+ mark("definitionOfReady", options.definitionOfReady !== void 0);
826
+ mark("order", options.order !== void 0 || options.rank !== void 0);
827
+ mark("goal", options.goal !== void 0);
828
+ mark("objective", options.objective !== void 0);
829
+ mark("value", options.value !== void 0);
830
+ mark("impact", options.impact !== void 0);
831
+ mark("outcome", options.outcome !== void 0);
832
+ mark("whyNow", options.whyNow !== void 0);
833
+ mark("author", options.author !== void 0);
834
+ mark("message", options.message !== void 0);
835
+ mark("assignee", options.assignee !== void 0);
836
+ mark("parent", options.parent !== void 0);
837
+ mark("reviewer", options.reviewer !== void 0);
838
+ mark("risk", options.risk !== void 0);
839
+ mark("confidence", options.confidence !== void 0);
840
+ mark("sprint", options.sprint !== void 0);
841
+ mark("release", options.release !== void 0);
842
+ mark("blockedBy", options.blockedBy !== void 0);
843
+ mark("blockedReason", options.blockedReason !== void 0);
844
+ mark("unblockNote", options.unblockNote !== void 0);
845
+ mark("reporter", options.reporter !== void 0);
846
+ mark("severity", options.severity !== void 0);
847
+ mark("environment", options.environment !== void 0);
848
+ mark("reproSteps", options.reproSteps !== void 0);
849
+ mark("resolution", options.resolution !== void 0);
850
+ mark("expectedResult", options.expectedResult !== void 0);
851
+ mark("actualResult", options.actualResult !== void 0);
852
+ mark("affectedVersion", options.affectedVersion !== void 0);
853
+ mark("fixedVersion", options.fixedVersion !== void 0);
854
+ mark("component", options.component !== void 0);
855
+ mark("regression", options.regression !== void 0);
856
+ mark("customerImpact", options.customerImpact !== void 0);
857
+ mark("dep", options.dep !== void 0);
858
+ mark("depRemove", options.depRemove !== void 0);
859
+ mark("dep", options.replaceDeps === true);
860
+ mark("comment", options.comment !== void 0);
861
+ mark("note", options.note !== void 0);
862
+ mark("learning", options.learning !== void 0);
863
+ mark("file", options.file !== void 0);
864
+ mark("test", options.test !== void 0);
865
+ mark("test", options.replaceTests === true);
866
+ mark("doc", options.doc !== void 0);
867
+ mark("reminder", options.reminder !== void 0);
868
+ mark("event", options.event !== void 0);
869
+ mark("typeOption", options.typeOption !== void 0);
870
+ mark("field", options.field !== void 0);
871
+ mark("force", options.force === true);
872
+ mark("allowAuditUpdate", options.allowAuditUpdate === true);
873
+ mark("dep", options.clearDeps === true);
874
+ mark("comment", options.clearComments === true);
875
+ mark("note", options.clearNotes === true);
876
+ mark("learning", options.clearLearnings === true);
877
+ mark("file", options.clearFiles === true);
878
+ mark("test", options.clearTests === true);
879
+ mark("doc", options.clearDocs === true);
880
+ mark("reminder", options.clearReminders === true);
881
+ mark("event", options.clearEvents === true);
882
+ mark("typeOption", options.clearTypeOptions === true);
883
+ if (options.unset && options.unset.length > 0) {
884
+ const unsetTargets = parseUpdateUnsetTargets(options.unset, void 0, extensionFieldNames);
885
+ for (const optionKey of unsetTargets.optionKeys) {
886
+ mark(optionKey, true);
887
+ }
888
+ }
889
+ return provided;
890
+ }
891
+ function enforceUpdateOptionsByType(typeName, options, typeRegistry, extensionFieldNames) {
892
+ const typeDefinition = resolveTypeDefinition(typeName, typeRegistry);
893
+ if (!typeDefinition) {
894
+ throw new PmCliError(`Invalid type value "${typeName}"`, EXIT_CODE.USAGE);
895
+ }
896
+ const policyState = resolveCommandOptionPolicyState(typeDefinition, "update", []);
897
+ if (policyState.errors.length > 0) {
898
+ throw new PmCliError(policyState.errors.join("; "), EXIT_CODE.CONFLICT);
899
+ }
900
+ const provided = collectProvidedUpdatePolicyOptions(options, extensionFieldNames);
901
+ for (const disabled of policyState.disabled) {
902
+ if (provided.has(normalizeUpdatePolicyOptionKey(disabled, typeName))) {
903
+ throw new PmCliError(`Option ${commandOptionFlagLabel("update", disabled)} is disabled for type "${typeName}" by command_option_policies`, EXIT_CODE.USAGE);
904
+ }
905
+ }
906
+ for (const required of policyState.required) {
907
+ if (!provided.has(normalizeUpdatePolicyOptionKey(required, typeName))) {
908
+ throw new PmCliError(`Missing required option ${commandOptionFlagLabel("update", required)} for type "${typeName}"`, EXIT_CODE.USAGE);
909
+ }
910
+ }
911
+ }
912
+ async function runUpdate(id, options, global2) {
913
+ const stdinResolver = createStdinTokenResolver();
914
+ options = normalizeLegacyNoneUpdateOptions({
915
+ ...options,
916
+ body: await stdinResolver.resolveValue(options.body, "--body"),
917
+ dep: await stdinResolver.resolveList(options.dep, "--dep"),
918
+ depRemove: await stdinResolver.resolveList(options.depRemove, "--dep-remove"),
919
+ comment: await stdinResolver.resolveList(options.comment, "--comment"),
920
+ note: await stdinResolver.resolveList(options.note, "--note"),
921
+ learning: await stdinResolver.resolveList(options.learning, "--learning"),
922
+ file: await stdinResolver.resolveList(options.file, "--file"),
923
+ test: await stdinResolver.resolveList(options.test, "--test"),
924
+ doc: await stdinResolver.resolveList(options.doc, "--doc"),
925
+ reminder: await stdinResolver.resolveList(options.reminder, "--reminder"),
926
+ event: await stdinResolver.resolveList(options.event, "--event"),
927
+ typeOption: await stdinResolver.resolveList(options.typeOption, "--type-option"),
928
+ field: await stdinResolver.resolveList(options.field, "--field")
929
+ });
930
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
931
+ if (!await pathExists(getSettingsPath(pmRoot))) {
932
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
933
+ }
934
+ const settings = await readSettings(pmRoot);
935
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
936
+ const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
937
+ const extensionRegistrations = getActiveExtensionRegistrations();
938
+ const extensionFieldNames = collectRegisteredItemFieldNames(extensionRegistrations);
939
+ const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);
940
+ const workflowEnforcement = settings.governance.workflow_enforcement ?? "off";
941
+ const typeWorkflows = workflowEnforcement === "off" ? [] : resolveTypeWorkflows(settings.schema);
942
+ const parentReferencePolicy = settings.validation.parent_reference;
943
+ const sprintReleasePolicy = settings.validation.sprint_release_format;
944
+ const unsetTargets = parseUpdateUnsetTargets(options.unset, runtimeFieldRegistry, extensionFieldNames);
945
+ const clearOptionKeys = new Set(unsetTargets.optionKeys);
946
+ const clearFrontMatterKeys = new Set(unsetTargets.frontMatterKeys);
947
+ const clearCollectionDefinitions = [
948
+ {
949
+ enabled: options.clearDeps || options.replaceDeps,
950
+ optionKey: "dep",
951
+ clearFlag: "--clear-deps",
952
+ valueFlag: "--dep",
953
+ values: options.dep,
954
+ frontMatterKey: "dependencies"
955
+ },
956
+ {
957
+ enabled: options.clearComments,
958
+ optionKey: "comment",
959
+ clearFlag: "--clear-comments",
960
+ valueFlag: "--comment",
961
+ values: options.comment,
962
+ frontMatterKey: "comments"
963
+ },
964
+ {
965
+ enabled: options.clearNotes,
966
+ optionKey: "note",
967
+ clearFlag: "--clear-notes",
968
+ valueFlag: "--note",
969
+ values: options.note,
970
+ frontMatterKey: "notes"
971
+ },
972
+ {
973
+ enabled: options.clearLearnings,
974
+ optionKey: "learning",
975
+ clearFlag: "--clear-learnings",
976
+ valueFlag: "--learning",
977
+ values: options.learning,
978
+ frontMatterKey: "learnings"
979
+ },
980
+ {
981
+ enabled: options.clearFiles,
982
+ optionKey: "file",
983
+ clearFlag: "--clear-files",
984
+ valueFlag: "--file",
985
+ values: options.file,
986
+ frontMatterKey: "files"
987
+ },
988
+ {
989
+ enabled: options.clearTests || options.replaceTests,
990
+ optionKey: "test",
991
+ clearFlag: "--clear-tests",
992
+ valueFlag: "--test",
993
+ values: options.test,
994
+ frontMatterKey: "tests"
995
+ },
996
+ {
997
+ enabled: options.clearDocs,
998
+ optionKey: "doc",
999
+ clearFlag: "--clear-docs",
1000
+ valueFlag: "--doc",
1001
+ values: options.doc,
1002
+ frontMatterKey: "docs"
1003
+ },
1004
+ {
1005
+ enabled: options.clearReminders,
1006
+ optionKey: "reminder",
1007
+ clearFlag: "--clear-reminders",
1008
+ valueFlag: "--reminder",
1009
+ values: options.reminder,
1010
+ frontMatterKey: "reminders"
1011
+ },
1012
+ {
1013
+ enabled: options.clearEvents,
1014
+ optionKey: "event",
1015
+ clearFlag: "--clear-events",
1016
+ valueFlag: "--event",
1017
+ values: options.event,
1018
+ frontMatterKey: "events"
1019
+ },
1020
+ {
1021
+ enabled: options.clearTypeOptions,
1022
+ optionKey: "typeOption",
1023
+ clearFlag: "--clear-type-options",
1024
+ valueFlag: "--type-option",
1025
+ values: options.typeOption,
1026
+ frontMatterKey: "type_options"
1027
+ }
1028
+ ];
1029
+ if (options.replaceDeps === true && (options.dep === void 0 || options.dep.length === 0)) {
1030
+ throw new PmCliError("--replace-deps requires at least one --dep entry", EXIT_CODE.USAGE);
1031
+ }
1032
+ if (options.replaceDeps === true && options.depRemove !== void 0 && options.depRemove.length > 0) {
1033
+ throw new PmCliError("--replace-deps cannot be combined with --dep-remove", EXIT_CODE.USAGE);
1034
+ }
1035
+ if (options.replaceTests === true && (options.test === void 0 || options.test.length === 0)) {
1036
+ throw new PmCliError("--replace-tests requires at least one --test entry", EXIT_CODE.USAGE);
1037
+ }
1038
+ if (options.replaceTests === true && options.clearTests === true) {
1039
+ throw new PmCliError("--replace-tests cannot be combined with --clear-tests", EXIT_CODE.USAGE);
1040
+ }
1041
+ for (const definition of clearCollectionDefinitions) {
1042
+ if (!definition.enabled) {
1043
+ continue;
1044
+ }
1045
+ if (definition.values && definition.values.length > 0 && !(definition.optionKey === "dep" && options.replaceDeps === true || definition.optionKey === "test" && options.replaceTests === true)) {
1046
+ throw new PmCliError(`Cannot combine ${definition.clearFlag} with ${definition.valueFlag}`, EXIT_CODE.USAGE);
1047
+ }
1048
+ clearOptionKeys.add(definition.optionKey);
1049
+ clearFrontMatterKeys.add(definition.frontMatterKey);
1050
+ }
1051
+ enforceAllowAuditUpdateScope(options, clearFrontMatterKeys);
1052
+ const scalarOptionPresence = {
1053
+ tags: options.tags !== void 0,
1054
+ closeReason: options.closeReason !== void 0,
1055
+ deadline: options.deadline !== void 0,
1056
+ estimatedMinutes: options.estimatedMinutes !== void 0,
1057
+ acceptanceCriteria: options.acceptanceCriteria !== void 0,
1058
+ definitionOfReady: options.definitionOfReady !== void 0,
1059
+ order: options.order !== void 0 || options.rank !== void 0,
1060
+ goal: options.goal !== void 0,
1061
+ objective: options.objective !== void 0,
1062
+ value: options.value !== void 0,
1063
+ impact: options.impact !== void 0,
1064
+ outcome: options.outcome !== void 0,
1065
+ whyNow: options.whyNow !== void 0,
1066
+ assignee: options.assignee !== void 0,
1067
+ parent: options.parent !== void 0,
1068
+ reviewer: options.reviewer !== void 0,
1069
+ risk: options.risk !== void 0,
1070
+ confidence: options.confidence !== void 0,
1071
+ sprint: options.sprint !== void 0,
1072
+ release: options.release !== void 0,
1073
+ blockedBy: options.blockedBy !== void 0,
1074
+ blockedReason: options.blockedReason !== void 0,
1075
+ unblockNote: options.unblockNote !== void 0,
1076
+ reporter: options.reporter !== void 0,
1077
+ severity: options.severity !== void 0,
1078
+ environment: options.environment !== void 0,
1079
+ reproSteps: options.reproSteps !== void 0,
1080
+ resolution: options.resolution !== void 0,
1081
+ expectedResult: options.expectedResult !== void 0,
1082
+ actualResult: options.actualResult !== void 0,
1083
+ affectedVersion: options.affectedVersion !== void 0,
1084
+ fixedVersion: options.fixedVersion !== void 0,
1085
+ component: options.component !== void 0,
1086
+ regression: options.regression !== void 0,
1087
+ customerImpact: options.customerImpact !== void 0
1088
+ };
1089
+ for (const [optionKey, hasValue] of Object.entries(scalarOptionPresence)) {
1090
+ if (!hasValue || !unsetTargets.optionKeys.has(optionKey)) {
1091
+ continue;
1092
+ }
1093
+ const unsetField = UPDATE_OPTION_KEY_TO_UNSET_CANONICAL.get(optionKey) ?? optionKey;
1094
+ throw new PmCliError(`Cannot combine --unset ${unsetField} with ${commandOptionFlagLabel("update", optionKey)}`, EXIT_CODE.USAGE);
1095
+ }
1096
+ if (clearFrontMatterKeys.has("tags")) {
1097
+ if (Array.isArray(options.addTags) && options.addTags.length > 0) {
1098
+ throw new PmCliError("Cannot combine --unset tags with --add-tags", EXIT_CODE.USAGE);
1099
+ }
1100
+ if (Array.isArray(options.removeTags) && options.removeTags.length > 0) {
1101
+ throw new PmCliError("Cannot combine --unset tags with --remove-tags", EXIT_CODE.USAGE);
1102
+ }
1103
+ }
1104
+ const assertNoLegacyScalarToken = (value, optionKey) => {
1105
+ const unsetField = UPDATE_OPTION_KEY_TO_UNSET_CANONICAL.get(optionKey);
1106
+ const hint = unsetField ? `Use --unset ${unsetField} to clear this field.` : void 0;
1107
+ assertNoLegacyNoneToken(value, commandOptionFlagLabel("update", optionKey), hint);
1108
+ };
1109
+ assertNoLegacyScalarToken(options.tags, "tags");
1110
+ assertNoLegacyScalarToken(options.closeReason, "closeReason");
1111
+ assertNoLegacyScalarToken(options.deadline, "deadline");
1112
+ assertNoLegacyScalarToken(options.estimatedMinutes, "estimatedMinutes");
1113
+ assertNoLegacyScalarToken(options.acceptanceCriteria, "acceptanceCriteria");
1114
+ assertNoLegacyScalarToken(options.definitionOfReady, "definitionOfReady");
1115
+ assertNoLegacyScalarToken(options.order ?? options.rank, "order");
1116
+ assertNoLegacyScalarToken(options.goal, "goal");
1117
+ assertNoLegacyScalarToken(options.objective, "objective");
1118
+ assertNoLegacyScalarToken(options.value, "value");
1119
+ assertNoLegacyScalarToken(options.impact, "impact");
1120
+ assertNoLegacyScalarToken(options.outcome, "outcome");
1121
+ assertNoLegacyScalarToken(options.whyNow, "whyNow");
1122
+ assertNoLegacyScalarToken(options.assignee, "assignee");
1123
+ assertNoLegacyScalarToken(options.parent, "parent");
1124
+ assertNoLegacyScalarToken(options.reviewer, "reviewer");
1125
+ assertNoLegacyScalarToken(options.risk, "risk");
1126
+ assertNoLegacyScalarToken(options.confidence, "confidence");
1127
+ assertNoLegacyScalarToken(options.sprint, "sprint");
1128
+ assertNoLegacyScalarToken(options.release, "release");
1129
+ assertNoLegacyScalarToken(options.blockedBy, "blockedBy");
1130
+ assertNoLegacyScalarToken(options.blockedReason, "blockedReason");
1131
+ assertNoLegacyScalarToken(options.unblockNote, "unblockNote");
1132
+ assertNoLegacyScalarToken(options.reporter, "reporter");
1133
+ assertNoLegacyScalarToken(options.severity, "severity");
1134
+ assertNoLegacyScalarToken(options.environment, "environment");
1135
+ assertNoLegacyScalarToken(options.reproSteps, "reproSteps");
1136
+ assertNoLegacyScalarToken(options.resolution, "resolution");
1137
+ assertNoLegacyScalarToken(options.expectedResult, "expectedResult");
1138
+ assertNoLegacyScalarToken(options.actualResult, "actualResult");
1139
+ assertNoLegacyScalarToken(options.affectedVersion, "affectedVersion");
1140
+ assertNoLegacyScalarToken(options.fixedVersion, "fixedVersion");
1141
+ assertNoLegacyScalarToken(options.component, "component");
1142
+ assertNoLegacyScalarToken(options.regression, "regression");
1143
+ assertNoLegacyScalarToken(options.customerImpact, "customerImpact");
1144
+ assertNoLegacyNoneTokens(options.reminder, "--reminder", "Use --clear-reminders to clear reminders.");
1145
+ assertNoLegacyNoneTokens(options.event, "--event", "Use --clear-events to clear linked events.");
1146
+ const author = toAuthor(options.author, settings.author_default);
1147
+ const nowValue = /* @__PURE__ */ new Date();
1148
+ const nowIso = nowValue.toISOString();
1149
+ const dependencyUpdates = parseDependencyAdditions(options.dep, settings.id_prefix, nowIso);
1150
+ const dependencyRemovals = parseDependencyRemovals(options.depRemove, settings.id_prefix);
1151
+ const commentUpdates = parseLogSeed("--comment", options.comment, nowIso, author);
1152
+ const noteUpdates = parseLogSeed("--note", options.note, nowIso, author);
1153
+ const learningUpdates = parseLogSeed("--learning", options.learning, nowIso, author);
1154
+ const fileUpdates = parseFiles(options.file);
1155
+ const testUpdates = parseTests(options.test);
1156
+ const docUpdates = parseDocs(options.doc);
1157
+ const parentReferenceWarnings = [];
1158
+ const workflowTransitionWarnings = [];
1159
+ let resolvedParentValue;
1160
+ if (options.parent !== void 0 && !unsetTargets.frontMatterKeys.has("parent")) {
1161
+ resolvedParentValue = normalizeParentReferenceValue(options.parent);
1162
+ const parentLocated = await locateItem(pmRoot, resolvedParentValue, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1163
+ if (!parentLocated) {
1164
+ const normalizedParentId = normalizeItemId(resolvedParentValue, settings.id_prefix);
1165
+ parentReferenceWarnings.push(...validateMissingParentReference(normalizedParentId, parentReferencePolicy).warnings);
1166
+ }
1167
+ }
1168
+ const blockedByResolution = await resolveBlockedByDependencyTarget(options.blockedBy, clearFrontMatterKeys.has("blocked_by"), pmRoot, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1169
+ const resolvedBlockedByDependencyId = blockedByResolution.id;
1170
+ if (blockedByResolution.unresolved !== void 0) {
1171
+ parentReferenceWarnings.push(`blocked_by_unresolved:${blockedByResolution.unresolved}`);
1172
+ }
1173
+ const runtimeFieldUpdates = collectRuntimeUpdateFieldValues(options, runtimeFieldRegistry, options.runtimeFieldCommands);
1174
+ const fieldFlags = {
1175
+ title: options.title !== void 0,
1176
+ description: options.description !== void 0,
1177
+ body: options.body !== void 0,
1178
+ status: options.status !== void 0,
1179
+ closeReason: options.closeReason !== void 0,
1180
+ priority: options.priority !== void 0,
1181
+ type: options.type !== void 0,
1182
+ tags: options.tags !== void 0,
1183
+ addTags: Array.isArray(options.addTags) && options.addTags.length > 0,
1184
+ removeTags: Array.isArray(options.removeTags) && options.removeTags.length > 0,
1185
+ deadline: options.deadline !== void 0,
1186
+ estimatedMinutes: options.estimatedMinutes !== void 0,
1187
+ acceptanceCriteria: options.acceptanceCriteria !== void 0,
1188
+ definitionOfReady: options.definitionOfReady !== void 0,
1189
+ order: options.order !== void 0,
1190
+ rank: options.rank !== void 0,
1191
+ goal: options.goal !== void 0,
1192
+ objective: options.objective !== void 0,
1193
+ value: options.value !== void 0,
1194
+ impact: options.impact !== void 0,
1195
+ outcome: options.outcome !== void 0,
1196
+ whyNow: options.whyNow !== void 0,
1197
+ assignee: options.assignee !== void 0,
1198
+ parent: options.parent !== void 0,
1199
+ reviewer: options.reviewer !== void 0,
1200
+ risk: options.risk !== void 0,
1201
+ confidence: options.confidence !== void 0,
1202
+ sprint: options.sprint !== void 0,
1203
+ release: options.release !== void 0,
1204
+ blockedBy: options.blockedBy !== void 0,
1205
+ blockedReason: options.blockedReason !== void 0,
1206
+ unblockNote: options.unblockNote !== void 0,
1207
+ reporter: options.reporter !== void 0,
1208
+ severity: options.severity !== void 0,
1209
+ environment: options.environment !== void 0,
1210
+ reproSteps: options.reproSteps !== void 0,
1211
+ resolution: options.resolution !== void 0,
1212
+ expectedResult: options.expectedResult !== void 0,
1213
+ actualResult: options.actualResult !== void 0,
1214
+ affectedVersion: options.affectedVersion !== void 0,
1215
+ fixedVersion: options.fixedVersion !== void 0,
1216
+ component: options.component !== void 0,
1217
+ regression: options.regression !== void 0,
1218
+ customerImpact: options.customerImpact !== void 0,
1219
+ dep: options.dep !== void 0,
1220
+ depRemove: options.depRemove !== void 0,
1221
+ replaceDeps: options.replaceDeps === true,
1222
+ comment: options.comment !== void 0,
1223
+ note: options.note !== void 0,
1224
+ learning: options.learning !== void 0,
1225
+ file: options.file !== void 0,
1226
+ test: options.test !== void 0,
1227
+ replaceTests: options.replaceTests === true,
1228
+ doc: options.doc !== void 0,
1229
+ reminder: options.reminder !== void 0,
1230
+ event: options.event !== void 0,
1231
+ typeOption: options.typeOption !== void 0,
1232
+ field: options.field !== void 0,
1233
+ unset: options.unset !== void 0 && options.unset.length > 0,
1234
+ clearDeps: options.clearDeps === true,
1235
+ clearComments: options.clearComments === true,
1236
+ clearNotes: options.clearNotes === true,
1237
+ clearLearnings: options.clearLearnings === true,
1238
+ clearFiles: options.clearFiles === true,
1239
+ clearTests: options.clearTests === true,
1240
+ clearDocs: options.clearDocs === true,
1241
+ clearReminders: options.clearReminders === true,
1242
+ clearEvents: options.clearEvents === true,
1243
+ clearTypeOptions: options.clearTypeOptions === true,
1244
+ runtimeFields: Object.keys(runtimeFieldUpdates).length > 0
1245
+ };
1246
+ const changedFlags = Object.values(fieldFlags).some(Boolean);
1247
+ if (!changedFlags) {
1248
+ const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1249
+ if (!located) {
1250
+ throw await buildItemNotFoundError(pmRoot, id, settings.id_prefix, typeRegistry.type_to_folder);
1251
+ }
1252
+ const { document } = await readLocatedItem(located, { schema: settings.schema });
1253
+ return {
1254
+ item: toItemRecord(document.metadata),
1255
+ changed_fields: [],
1256
+ warnings: ["noop_no_update_fields"]
1257
+ };
1258
+ }
1259
+ if (workflowEnforcement !== "off" && typeWorkflows.length > 0 && fieldFlags.status && options.status !== void 0) {
1260
+ const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1261
+ if (!located) {
1262
+ throw await buildItemNotFoundError(pmRoot, id, settings.id_prefix, typeRegistry.type_to_folder);
1263
+ }
1264
+ const { document } = await readLocatedItem(located, { schema: settings.schema });
1265
+ const effectiveType = options.type !== void 0 ? resolveTypeName(options.type, typeRegistry) ?? options.type : document.metadata?.type ?? "";
1266
+ const warning = enforceTypeWorkflowTransition({
1267
+ enforcement: workflowEnforcement,
1268
+ typeWorkflows,
1269
+ statusRegistry,
1270
+ typeName: effectiveType,
1271
+ fromStatus: document.metadata?.status ?? "",
1272
+ toStatus: options.status ?? ""
1273
+ });
1274
+ if (warning) {
1275
+ workflowTransitionWarnings.push(warning);
1276
+ }
1277
+ }
1278
+ if (fieldFlags.status) {
1279
+ const targetStatus = normalizeStatusInput(options.status, statusRegistry);
1280
+ if (targetStatus === statusRegistry.close_status) {
1281
+ const otherFieldKeys = Object.entries(fieldFlags).filter(([key, value]) => value && key !== "status" && key !== "closeReason").map(([key]) => key);
1282
+ const routeWarnings = [];
1283
+ let preChangedFields = [];
1284
+ if (otherFieldKeys.length > 0) {
1285
+ const preUpdate = await runUpdate(id, { ...options, status: void 0, closeReason: void 0, message: void 0 }, global2);
1286
+ preChangedFields = preUpdate.changed_fields;
1287
+ routeWarnings.push(...preUpdate.warnings);
1288
+ }
1289
+ const explicitReason = typeof options.closeReason === "string" ? options.closeReason.trim() : "";
1290
+ const fallbackMessage = typeof options.message === "string" ? options.message.trim() : "";
1291
+ const closeReason = explicitReason || fallbackMessage || "Closed via pm update";
1292
+ const reasonDefaulted = explicitReason.length === 0 && fallbackMessage.length === 0;
1293
+ const closeResult = await runClose(id, closeReason, {
1294
+ author: options.author,
1295
+ message: options.message,
1296
+ force: options.force
1297
+ }, global2);
1298
+ const warnings = [
1299
+ ...workflowTransitionWarnings,
1300
+ ...routeWarnings,
1301
+ ...closeResult.warnings,
1302
+ "auto_routed_from_update_to_close"
1303
+ ];
1304
+ if (reasonDefaulted) {
1305
+ warnings.push("close_reason_defaulted");
1306
+ }
1307
+ return {
1308
+ item: closeResult.item,
1309
+ changed_fields: [...preChangedFields, ...closeResult.changed_fields],
1310
+ warnings
1311
+ };
1312
+ }
1313
+ }
1314
+ if (options.order !== void 0 && options.rank !== void 0 && options.order !== options.rank) {
1315
+ throw new PmCliError("--order and --rank must match when both are provided", EXIT_CODE.USAGE);
1316
+ }
1317
+ const result = await mutateItem({
1318
+ pmRoot,
1319
+ settings,
1320
+ typeToFolder: typeRegistry.type_to_folder,
1321
+ id,
1322
+ op: options.allowAuditUpdate === true || options.allowAuditDepUpdate === true ? "update_audit" : "update",
1323
+ author,
1324
+ message: options.message,
1325
+ force: options.force,
1326
+ bypassAssigneeConflict: options.allowAuditUpdate === true || options.allowAuditDepUpdate === true,
1327
+ extensionFieldNames,
1328
+ mutate(document) {
1329
+ const changedFields = [];
1330
+ const warnings = [];
1331
+ let activeTypeName = resolveTypeName(document.metadata.type, typeRegistry) ?? document.metadata.type;
1332
+ const metadataRecord = toItemRecord(document.metadata);
1333
+ const setOrClearScalar = (optionValue, metadataKey, transform) => {
1334
+ if (optionValue === void 0 && !clearFrontMatterKeys.has(metadataKey)) {
1335
+ return;
1336
+ }
1337
+ if (clearFrontMatterKeys.has(metadataKey)) {
1338
+ delete metadataRecord[metadataKey];
1339
+ } else {
1340
+ metadataRecord[metadataKey] = transform(optionValue);
1341
+ }
1342
+ changedFields.push(metadataKey);
1343
+ };
1344
+ const setOrClearTrimScalar = (optionValue, metadataKey) => {
1345
+ setOrClearScalar(optionValue, metadataKey, (value) => value.trim());
1346
+ };
1347
+ if (options.title !== void 0) {
1348
+ document.metadata.title = options.title;
1349
+ changedFields.push("title");
1350
+ }
1351
+ if (options.description !== void 0) {
1352
+ document.metadata.description = options.description;
1353
+ changedFields.push("description");
1354
+ }
1355
+ if (options.body !== void 0) {
1356
+ document.body = options.body;
1357
+ changedFields.push("body");
1358
+ }
1359
+ const previousStatus = document.metadata.status;
1360
+ const previousStatusNormalized = normalizeStatusInput(previousStatus, statusRegistry) ?? previousStatus;
1361
+ if (options.status !== void 0) {
1362
+ const status = parseStatus(options.status, statusRegistry);
1363
+ document.metadata.status = status;
1364
+ if (status === statusRegistry.canceled_status) {
1365
+ delete document.metadata.assignee;
1366
+ }
1367
+ changedFields.push("status");
1368
+ }
1369
+ if (options.closeReason !== void 0 || clearFrontMatterKeys.has("close_reason")) {
1370
+ if (clearFrontMatterKeys.has("close_reason")) {
1371
+ delete document.metadata.close_reason;
1372
+ } else {
1373
+ const closeReason = options.closeReason.trim();
1374
+ if (closeReason.length === 0) {
1375
+ throw new PmCliError("--close-reason must not be empty", EXIT_CODE.USAGE);
1376
+ }
1377
+ document.metadata.close_reason = closeReason;
1378
+ }
1379
+ changedFields.push("close_reason");
1380
+ } else if (options.status !== void 0 && previousStatusNormalized === statusRegistry.close_status && document.metadata.status !== statusRegistry.canceled_status && document.metadata.close_reason !== void 0) {
1381
+ delete document.metadata.close_reason;
1382
+ changedFields.push("close_reason");
1383
+ }
1384
+ if (options.priority !== void 0) {
1385
+ document.metadata.priority = ensurePriority(options.priority);
1386
+ changedFields.push("priority");
1387
+ }
1388
+ if (options.type !== void 0) {
1389
+ const resolvedTypeName = resolveTypeName(options.type, typeRegistry);
1390
+ if (!resolvedTypeName) {
1391
+ throw new PmCliError(buildInvalidTypeError(options.type, typeRegistry.types), EXIT_CODE.USAGE);
1392
+ }
1393
+ document.metadata.type = resolvedTypeName;
1394
+ activeTypeName = resolvedTypeName;
1395
+ changedFields.push("type");
1396
+ }
1397
+ enforceUpdateOptionsByType(activeTypeName, options, typeRegistry, extensionFieldNames);
1398
+ if (options.typeOption !== void 0 || clearFrontMatterKeys.has("type_options")) {
1399
+ if (clearFrontMatterKeys.has("type_options")) {
1400
+ delete document.metadata.type_options;
1401
+ } else {
1402
+ const parsedTypeOptions = parseTypeOptionEntries(options.typeOption);
1403
+ const validation = validateTypeOptions(activeTypeName, parsedTypeOptions, typeRegistry);
1404
+ if (validation.errors.length > 0) {
1405
+ throw new PmCliError(validation.errors.join("; "), EXIT_CODE.USAGE);
1406
+ }
1407
+ document.metadata.type_options = validation.normalized;
1408
+ }
1409
+ changedFields.push("type_options");
1410
+ } else if (options.type !== void 0 && document.metadata.type_options !== void 0) {
1411
+ const validation = validateTypeOptions(activeTypeName, document.metadata.type_options, typeRegistry);
1412
+ if (validation.errors.length > 0) {
1413
+ throw new PmCliError(`Current type options are incompatible with type "${activeTypeName}". ${validation.errors.join("; ")}. Use --clear-type-options to clear them.`, EXIT_CODE.USAGE);
1414
+ }
1415
+ document.metadata.type_options = validation.normalized;
1416
+ }
1417
+ if (options.dep !== void 0 || options.depRemove !== void 0 || clearFrontMatterKeys.has("dependencies")) {
1418
+ let nextDependencies = clearFrontMatterKeys.has("dependencies") ? [] : [...document.metadata.dependencies ?? []];
1419
+ if (dependencyUpdates.additions.length > 0) {
1420
+ const seen = new Set(nextDependencies.map((entry) => dependencyKey(entry)));
1421
+ for (const addition of dependencyUpdates.additions) {
1422
+ const key = dependencyKey(addition);
1423
+ if (seen.has(key)) {
1424
+ continue;
1425
+ }
1426
+ nextDependencies.push(addition);
1427
+ seen.add(key);
1428
+ }
1429
+ }
1430
+ if (dependencyRemovals.length > 0) {
1431
+ nextDependencies = nextDependencies.filter((entry) => !dependencyRemovals.some((selector) => matchesDependencySelector(entry, selector)));
1432
+ }
1433
+ if (nextDependencies.length === 0) {
1434
+ delete document.metadata.dependencies;
1435
+ } else {
1436
+ document.metadata.dependencies = nextDependencies;
1437
+ }
1438
+ changedFields.push("dependencies");
1439
+ }
1440
+ if (options.comment !== void 0 || clearFrontMatterKeys.has("comments")) {
1441
+ if (clearFrontMatterKeys.has("comments") || !commentUpdates.values || commentUpdates.values.length === 0) {
1442
+ delete document.metadata.comments;
1443
+ } else {
1444
+ document.metadata.comments = [...document.metadata.comments ?? [], ...commentUpdates.values];
1445
+ }
1446
+ changedFields.push("comments");
1447
+ }
1448
+ if (options.note !== void 0 || clearFrontMatterKeys.has("notes")) {
1449
+ if (clearFrontMatterKeys.has("notes") || !noteUpdates.values || noteUpdates.values.length === 0) {
1450
+ delete document.metadata.notes;
1451
+ } else {
1452
+ document.metadata.notes = [...document.metadata.notes ?? [], ...noteUpdates.values];
1453
+ }
1454
+ changedFields.push("notes");
1455
+ }
1456
+ if (options.learning !== void 0 || clearFrontMatterKeys.has("learnings")) {
1457
+ if (clearFrontMatterKeys.has("learnings") || !learningUpdates.values || learningUpdates.values.length === 0) {
1458
+ delete document.metadata.learnings;
1459
+ } else {
1460
+ document.metadata.learnings = [...document.metadata.learnings ?? [], ...learningUpdates.values];
1461
+ }
1462
+ changedFields.push("learnings");
1463
+ }
1464
+ if (options.file !== void 0 || clearFrontMatterKeys.has("files")) {
1465
+ if (clearFrontMatterKeys.has("files") || !fileUpdates.values || fileUpdates.values.length === 0) {
1466
+ delete document.metadata.files;
1467
+ } else {
1468
+ const nextFiles = [...document.metadata.files ?? []];
1469
+ const seen = new Set(nextFiles.map((entry) => fileKey(entry)));
1470
+ for (const entry of fileUpdates.values) {
1471
+ const key = fileKey(entry);
1472
+ if (seen.has(key)) {
1473
+ continue;
1474
+ }
1475
+ nextFiles.push(entry);
1476
+ seen.add(key);
1477
+ }
1478
+ document.metadata.files = nextFiles;
1479
+ }
1480
+ changedFields.push("files");
1481
+ }
1482
+ if (options.test !== void 0 || clearFrontMatterKeys.has("tests")) {
1483
+ if (clearFrontMatterKeys.has("tests") && options.replaceTests === true) {
1484
+ if (!testUpdates.values || testUpdates.values.length === 0) {
1485
+ delete document.metadata.tests;
1486
+ } else {
1487
+ const replacementTests = [];
1488
+ const seen = /* @__PURE__ */ new Set();
1489
+ for (const entry of testUpdates.values) {
1490
+ const key = testKey(entry);
1491
+ if (seen.has(key)) {
1492
+ continue;
1493
+ }
1494
+ replacementTests.push(entry);
1495
+ seen.add(key);
1496
+ }
1497
+ document.metadata.tests = replacementTests;
1498
+ }
1499
+ } else if (clearFrontMatterKeys.has("tests") || !testUpdates.values || testUpdates.values.length === 0) {
1500
+ delete document.metadata.tests;
1501
+ } else {
1502
+ const nextTests = [...document.metadata.tests ?? []];
1503
+ const seen = new Set(nextTests.map((entry) => testKey(entry)));
1504
+ for (const entry of testUpdates.values) {
1505
+ const key = testKey(entry);
1506
+ if (seen.has(key)) {
1507
+ continue;
1508
+ }
1509
+ nextTests.push(entry);
1510
+ seen.add(key);
1511
+ }
1512
+ document.metadata.tests = nextTests;
1513
+ }
1514
+ changedFields.push("tests");
1515
+ }
1516
+ if (options.doc !== void 0 || clearFrontMatterKeys.has("docs")) {
1517
+ if (clearFrontMatterKeys.has("docs") || !docUpdates.values || docUpdates.values.length === 0) {
1518
+ delete document.metadata.docs;
1519
+ } else {
1520
+ const nextDocs = [...document.metadata.docs ?? []];
1521
+ const seen = new Set(nextDocs.map((entry) => docKey(entry)));
1522
+ for (const entry of docUpdates.values) {
1523
+ const key = docKey(entry);
1524
+ if (seen.has(key)) {
1525
+ continue;
1526
+ }
1527
+ nextDocs.push(entry);
1528
+ seen.add(key);
1529
+ }
1530
+ document.metadata.docs = nextDocs;
1531
+ }
1532
+ changedFields.push("docs");
1533
+ }
1534
+ const addTagsValues = options.addTags;
1535
+ const removeTagsValues = options.removeTags;
1536
+ const hasAdditiveTagMutation = Array.isArray(addTagsValues) && addTagsValues.length > 0 || Array.isArray(removeTagsValues) && removeTagsValues.length > 0;
1537
+ if (options.tags !== void 0 || clearFrontMatterKeys.has("tags") || hasAdditiveTagMutation) {
1538
+ const baseTags = clearFrontMatterKeys.has("tags") ? [] : options.tags !== void 0 ? parseTags(options.tags) : Array.isArray(document.metadata.tags) ? [...document.metadata.tags] : [];
1539
+ const withAdditions = mergeAdditiveTags(baseTags, addTagsValues);
1540
+ const finalTags = applyTagRemovals(withAdditions, removeTagsValues);
1541
+ document.metadata.tags = finalTags;
1542
+ changedFields.push("tags");
1543
+ }
1544
+ setOrClearScalar(options.deadline, "deadline", (value) => resolveIsoOrRelative(value, nowValue, "deadline"));
1545
+ setOrClearScalar(options.estimatedMinutes, "estimated_minutes", (value) => parseOptionalNumber(value, "estimated-minutes"));
1546
+ setOrClearScalar(options.acceptanceCriteria, "acceptance_criteria", (value) => value);
1547
+ setOrClearTrimScalar(options.definitionOfReady, "definition_of_ready");
1548
+ const orderRaw = options.order ?? options.rank;
1549
+ if (orderRaw !== void 0 || clearFrontMatterKeys.has("order")) {
1550
+ if (clearFrontMatterKeys.has("order")) {
1551
+ delete document.metadata.order;
1552
+ } else {
1553
+ const parsedOrder = parseOptionalNumber(orderRaw, "order");
1554
+ if (!Number.isInteger(parsedOrder)) {
1555
+ throw new PmCliError("Order must be an integer", EXIT_CODE.USAGE);
1556
+ }
1557
+ document.metadata.order = parsedOrder;
1558
+ }
1559
+ changedFields.push("order");
1560
+ }
1561
+ setOrClearTrimScalar(options.goal, "goal");
1562
+ setOrClearTrimScalar(options.objective, "objective");
1563
+ setOrClearTrimScalar(options.value, "value");
1564
+ setOrClearTrimScalar(options.impact, "impact");
1565
+ setOrClearTrimScalar(options.outcome, "outcome");
1566
+ setOrClearTrimScalar(options.whyNow, "why_now");
1567
+ if (options.assignee !== void 0 || clearFrontMatterKeys.has("assignee")) {
1568
+ if (clearFrontMatterKeys.has("assignee")) {
1569
+ delete document.metadata.assignee;
1570
+ } else {
1571
+ if (options.assignee.trim() === "") {
1572
+ throw new PmCliError("--assignee must not be empty. Use --unset assignee to clear it.", EXIT_CODE.USAGE);
1573
+ }
1574
+ document.metadata.assignee = options.assignee.trim();
1575
+ }
1576
+ changedFields.push("assignee");
1577
+ }
1578
+ if (options.parent !== void 0 || clearFrontMatterKeys.has("parent")) {
1579
+ if (clearFrontMatterKeys.has("parent")) {
1580
+ delete document.metadata.parent;
1581
+ } else {
1582
+ document.metadata.parent = resolvedParentValue;
1583
+ }
1584
+ changedFields.push("parent");
1585
+ }
1586
+ setOrClearTrimScalar(options.reviewer, "reviewer");
1587
+ setOrClearScalar(options.risk, "risk", (value) => ensureEnumValue(normalizeRiskInput(value), RISK_VALUES, "risk"));
1588
+ setOrClearScalar(options.confidence, "confidence", (value) => parseConfidenceInput(value));
1589
+ if (options.sprint !== void 0 || clearFrontMatterKeys.has("sprint")) {
1590
+ if (clearFrontMatterKeys.has("sprint")) {
1591
+ delete document.metadata.sprint;
1592
+ } else {
1593
+ const sprintValidation = validateSprintOrReleaseValue("sprint", options.sprint, sprintReleasePolicy);
1594
+ document.metadata.sprint = sprintValidation.value;
1595
+ warnings.push(...sprintValidation.warnings);
1596
+ }
1597
+ changedFields.push("sprint");
1598
+ }
1599
+ if (options.release !== void 0 || clearFrontMatterKeys.has("release")) {
1600
+ if (clearFrontMatterKeys.has("release")) {
1601
+ delete document.metadata.release;
1602
+ } else {
1603
+ const releaseValidation = validateSprintOrReleaseValue("release", options.release, sprintReleasePolicy);
1604
+ document.metadata.release = releaseValidation.value;
1605
+ warnings.push(...releaseValidation.warnings);
1606
+ }
1607
+ changedFields.push("release");
1608
+ }
1609
+ if (options.blockedBy !== void 0 || clearFrontMatterKeys.has("blocked_by")) {
1610
+ if (clearFrontMatterKeys.has("blocked_by")) {
1611
+ delete document.metadata.blocked_by;
1612
+ } else {
1613
+ document.metadata.blocked_by = options.blockedBy.trim();
1614
+ }
1615
+ changedFields.push("blocked_by");
1616
+ applyBlockedByDependencyEdge(document.metadata, resolvedBlockedByDependencyId, nowIso, author, changedFields);
1617
+ }
1618
+ setOrClearTrimScalar(options.blockedReason, "blocked_reason");
1619
+ setOrClearTrimScalar(options.unblockNote, "unblock_note");
1620
+ setOrClearTrimScalar(options.reporter, "reporter");
1621
+ setOrClearScalar(options.severity, "severity", (value) => ensureEnumValue(normalizeSeverityInput(value), ISSUE_SEVERITY_VALUES, "severity"));
1622
+ setOrClearTrimScalar(options.environment, "environment");
1623
+ setOrClearTrimScalar(options.reproSteps, "repro_steps");
1624
+ setOrClearTrimScalar(options.resolution, "resolution");
1625
+ setOrClearTrimScalar(options.expectedResult, "expected_result");
1626
+ setOrClearTrimScalar(options.actualResult, "actual_result");
1627
+ setOrClearTrimScalar(options.affectedVersion, "affected_version");
1628
+ setOrClearTrimScalar(options.fixedVersion, "fixed_version");
1629
+ setOrClearTrimScalar(options.component, "component");
1630
+ setOrClearScalar(options.regression, "regression", (value) => parseRegressionInput(value));
1631
+ setOrClearTrimScalar(options.customerImpact, "customer_impact");
1632
+ if (options.reminder !== void 0 || clearFrontMatterKeys.has("reminders")) {
1633
+ if (clearFrontMatterKeys.has("reminders")) {
1634
+ delete document.metadata.reminders;
1635
+ } else {
1636
+ document.metadata.reminders = parseReminderEntries(options.reminder, nowValue, { valueMode: "trimmed" });
1637
+ }
1638
+ changedFields.push("reminders");
1639
+ }
1640
+ if (options.event !== void 0 || clearFrontMatterKeys.has("events")) {
1641
+ if (clearFrontMatterKeys.has("events")) {
1642
+ delete document.metadata.events;
1643
+ } else {
1644
+ document.metadata.events = parseEventEntries(options.event, nowValue, {
1645
+ allDayEmptyGuard: "truthy",
1646
+ recurrenceEmptyNumericGuard: "truthy"
1647
+ });
1648
+ }
1649
+ changedFields.push("events");
1650
+ }
1651
+ for (const definition of runtimeFieldRegistry.definitions) {
1652
+ if (!clearFrontMatterKeys.has(definition.metadata_key)) {
1653
+ continue;
1654
+ }
1655
+ if (metadataRecord[definition.metadata_key] === void 0) {
1656
+ continue;
1657
+ }
1658
+ delete metadataRecord[definition.metadata_key];
1659
+ changedFields.push(definition.metadata_key);
1660
+ }
1661
+ for (const fieldKey of extensionFieldNames) {
1662
+ if (!clearFrontMatterKeys.has(fieldKey)) {
1663
+ continue;
1664
+ }
1665
+ if (metadataRecord[fieldKey] === void 0) {
1666
+ continue;
1667
+ }
1668
+ delete metadataRecord[fieldKey];
1669
+ changedFields.push(fieldKey);
1670
+ }
1671
+ for (const [fieldKey, fieldValue] of Object.entries(runtimeFieldUpdates)) {
1672
+ if (clearFrontMatterKeys.has(fieldKey)) {
1673
+ continue;
1674
+ }
1675
+ if (stableValueEquals(metadataRecord[fieldKey], fieldValue)) {
1676
+ continue;
1677
+ }
1678
+ metadataRecord[fieldKey] = fieldValue;
1679
+ changedFields.push(fieldKey);
1680
+ }
1681
+ const registeredItemFieldUpdates = parseRegisteredItemFieldAssignments(options.field, extensionRegistrations);
1682
+ for (const fieldKey of Object.keys(registeredItemFieldUpdates)) {
1683
+ if (!clearFrontMatterKeys.has(fieldKey)) {
1684
+ continue;
1685
+ }
1686
+ throw new PmCliError(`Cannot combine --unset ${fieldKey.replaceAll("_", "-")} with --field ${fieldKey}=...`, EXIT_CODE.USAGE);
1687
+ }
1688
+ for (const [fieldKey, fieldValue] of Object.entries(registeredItemFieldUpdates)) {
1689
+ if (stableValueEquals(metadataRecord[fieldKey], fieldValue)) {
1690
+ continue;
1691
+ }
1692
+ metadataRecord[fieldKey] = fieldValue;
1693
+ changedFields.push(fieldKey);
1694
+ }
1695
+ try {
1696
+ applyRegisteredItemFieldDefaultsAndValidation(metadataRecord, extensionRegistrations, { skipDefaultFields: clearFrontMatterKeys });
1697
+ } catch (error) {
1698
+ throw new PmCliError(error instanceof Error ? error.message : "Invalid extension item field values", EXIT_CODE.USAGE);
1699
+ }
1700
+ return { changedFields, warnings };
1701
+ }
1702
+ });
1703
+ return {
1704
+ item: toItemRecord(result.item),
1705
+ changed_fields: result.changedFields,
1706
+ warnings: [...workflowTransitionWarnings, ...parentReferenceWarnings, ...result.warnings],
1707
+ ...options.allowAuditUpdate === true || options.allowAuditDepUpdate === true ? { audit_update: true } : {}
1708
+ };
1709
+ }
1710
+
1711
+ export {
1712
+ runUpdate
1713
+ };
1714
+ //# sourceMappingURL=chunk-D5X7N6FI.js.map