@unbrained/pm-cli 2026.6.30 → 2026.7.2

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 (628) hide show
  1. package/AGENTS.md +2 -0
  2. package/CHANGELOG.md +26 -0
  3. package/dist/cli/bootstrap-args.js +89 -79
  4. package/dist/cli/bootstrap-args.js.map +1 -1
  5. package/dist/cli/commander-usage.d.ts +2 -0
  6. package/dist/cli/commander-usage.js +58 -47
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/aggregate.js +102 -79
  9. package/dist/cli/commands/aggregate.js.map +1 -1
  10. package/dist/cli/commands/calendar.js +339 -303
  11. package/dist/cli/commands/calendar.js.map +1 -1
  12. package/dist/cli/commands/close-many.js +89 -68
  13. package/dist/cli/commands/close-many.js.map +1 -1
  14. package/dist/cli/commands/close.js +157 -129
  15. package/dist/cli/commands/close.js.map +1 -1
  16. package/dist/cli/commands/comments-audit.js +50 -42
  17. package/dist/cli/commands/comments-audit.js.map +1 -1
  18. package/dist/cli/commands/config.d.ts +2 -0
  19. package/dist/cli/commands/config.js +443 -879
  20. package/dist/cli/commands/config.js.map +1 -1
  21. package/dist/cli/commands/context.js +365 -287
  22. package/dist/cli/commands/context.js.map +1 -1
  23. package/dist/cli/commands/contracts.js +352 -238
  24. package/dist/cli/commands/contracts.js.map +1 -1
  25. package/dist/cli/commands/create.js +483 -434
  26. package/dist/cli/commands/create.js.map +1 -1
  27. package/dist/cli/commands/dedupe-audit.js +46 -39
  28. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  29. package/dist/cli/commands/dedupe-merge.js +88 -69
  30. package/dist/cli/commands/dedupe-merge.js.map +1 -1
  31. package/dist/cli/commands/extension/bundled-catalog.js +59 -46
  32. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
  33. package/dist/cli/commands/extension/doctor.js +129 -78
  34. package/dist/cli/commands/extension/doctor.js.map +1 -1
  35. package/dist/cli/commands/extension/managed-state.js +101 -57
  36. package/dist/cli/commands/extension/managed-state.js.map +1 -1
  37. package/dist/cli/commands/extension/scaffold.d.ts +7 -0
  38. package/dist/cli/commands/extension/scaffold.js +214 -186
  39. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  40. package/dist/cli/commands/extension.d.ts +6 -1
  41. package/dist/cli/commands/extension.js +1034 -902
  42. package/dist/cli/commands/extension.js.map +1 -1
  43. package/dist/cli/commands/get.js +114 -81
  44. package/dist/cli/commands/get.js.map +1 -1
  45. package/dist/cli/commands/health.d.ts +17 -0
  46. package/dist/cli/commands/health.js +446 -307
  47. package/dist/cli/commands/health.js.map +1 -1
  48. package/dist/cli/commands/history-compact.js +209 -140
  49. package/dist/cli/commands/history-compact.js.map +1 -1
  50. package/dist/cli/commands/history-redact.js +162 -119
  51. package/dist/cli/commands/history-redact.js.map +1 -1
  52. package/dist/cli/commands/history-repair.js +120 -85
  53. package/dist/cli/commands/history-repair.js.map +1 -1
  54. package/dist/cli/commands/init.d.ts +8 -2
  55. package/dist/cli/commands/init.js +263 -162
  56. package/dist/cli/commands/init.js.map +1 -1
  57. package/dist/cli/commands/list-filter-shared.js +55 -48
  58. package/dist/cli/commands/list-filter-shared.js.map +1 -1
  59. package/dist/cli/commands/list.js +152 -102
  60. package/dist/cli/commands/list.js.map +1 -1
  61. package/dist/cli/commands/next.js +49 -32
  62. package/dist/cli/commands/next.js.map +1 -1
  63. package/dist/cli/commands/plan.js +373 -298
  64. package/dist/cli/commands/plan.js.map +1 -1
  65. package/dist/cli/commands/recurrence-parsers.js +43 -25
  66. package/dist/cli/commands/recurrence-parsers.js.map +1 -1
  67. package/dist/cli/commands/reindex.d.ts +21 -5
  68. package/dist/cli/commands/reindex.js +345 -205
  69. package/dist/cli/commands/reindex.js.map +1 -1
  70. package/dist/cli/commands/restore.d.ts +8 -7
  71. package/dist/cli/commands/restore.js +105 -69
  72. package/dist/cli/commands/restore.js.map +1 -1
  73. package/dist/cli/commands/schema.js +33 -30
  74. package/dist/cli/commands/schema.js.map +1 -1
  75. package/dist/cli/commands/search.d.ts +10 -2
  76. package/dist/cli/commands/search.js +595 -536
  77. package/dist/cli/commands/search.js.map +1 -1
  78. package/dist/cli/commands/telemetry.js +98 -87
  79. package/dist/cli/commands/telemetry.js.map +1 -1
  80. package/dist/cli/commands/test-all.js +237 -168
  81. package/dist/cli/commands/test-all.js.map +1 -1
  82. package/dist/cli/commands/test.d.ts +6 -5
  83. package/dist/cli/commands/test.js +530 -464
  84. package/dist/cli/commands/test.js.map +1 -1
  85. package/dist/cli/commands/update-many.js +57 -42
  86. package/dist/cli/commands/update-many.js.map +1 -1
  87. package/dist/cli/commands/update.d.ts +1 -1
  88. package/dist/cli/commands/update.js +764 -747
  89. package/dist/cli/commands/update.js.map +1 -1
  90. package/dist/cli/commands/validate.d.ts +18 -1
  91. package/dist/cli/commands/validate.js +466 -343
  92. package/dist/cli/commands/validate.js.map +1 -1
  93. package/dist/cli/error-guidance.js +399 -357
  94. package/dist/cli/error-guidance.js.map +1 -1
  95. package/dist/cli/extension-command-options.js +48 -21
  96. package/dist/cli/extension-command-options.js.map +1 -1
  97. package/dist/cli/main.d.ts +47 -0
  98. package/dist/cli/main.js +428 -341
  99. package/dist/cli/main.js.map +1 -1
  100. package/dist/cli/migration-gates.js +22 -45
  101. package/dist/cli/migration-gates.js.map +1 -1
  102. package/dist/cli/register-list-query.js +94 -105
  103. package/dist/cli/register-list-query.js.map +1 -1
  104. package/dist/cli/register-mutation.js +400 -416
  105. package/dist/cli/register-mutation.js.map +1 -1
  106. package/dist/cli/register-operations.js +86 -66
  107. package/dist/cli/register-operations.js.map +1 -1
  108. package/dist/cli/register-setup.js +120 -101
  109. package/dist/cli/register-setup.js.map +1 -1
  110. package/dist/cli/registration-helpers.js +117 -122
  111. package/dist/cli/registration-helpers.js.map +1 -1
  112. package/dist/cli-bundle/chunks/{activity-MVSEND6D.js → activity-CUC4JY3U.js} +9 -9
  113. package/dist/cli-bundle/chunks/activity-WEIEMM73.js +16 -0
  114. package/dist/cli-bundle/chunks/{aggregate-MOC4TR2G.js → aggregate-DKUTRY6R.js} +109 -85
  115. package/dist/cli-bundle/chunks/aggregate-DKUTRY6R.js.map +1 -0
  116. package/dist/cli-bundle/chunks/{aggregate-XJHLZQ5X.js → aggregate-SW5PNGCS.js} +108 -84
  117. package/dist/cli-bundle/chunks/{aggregate-XJHLZQ5X.js.map → aggregate-SW5PNGCS.js.map} +2 -2
  118. package/dist/cli-bundle/chunks/{append-KDHT4GHI.js → append-H32VOR2Y.js} +6 -6
  119. package/dist/cli-bundle/chunks/{append-LEDBAM3K.js → append-UBM632FK.js} +6 -6
  120. package/dist/cli-bundle/chunks/{chunk-Z55WX4IQ.js → chunk-2227673O.js} +158 -114
  121. package/dist/cli-bundle/chunks/chunk-2227673O.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-SJZTPVFT.js → chunk-2ASNV4DH.js} +4 -4
  123. package/dist/cli-bundle/chunks/{chunk-JVQ7UOYC.js → chunk-2CHRYUXL.js} +2 -2
  124. package/dist/cli-bundle/chunks/{chunk-QE5UFCCO.js → chunk-2KWL5NPW.js} +42 -27
  125. package/dist/cli-bundle/chunks/chunk-2KWL5NPW.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-ZEATCVAC.js → chunk-36UGKF4O.js} +21 -29
  127. package/dist/cli-bundle/chunks/chunk-36UGKF4O.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-JZG5ADVE.js → chunk-3AZUFQK6.js} +1103 -963
  129. package/dist/cli-bundle/chunks/chunk-3AZUFQK6.js.map +1 -0
  130. package/dist/cli-bundle/chunks/{chunk-DRPF274X.js → chunk-3LCUASYG.js} +2 -2
  131. package/dist/cli-bundle/chunks/{chunk-JJ4SG243.js → chunk-3Q2HBMTI.js} +2 -2
  132. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js +87 -0
  133. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{chunk-GF7EAR22.js → chunk-4NUOWFBT.js} +109 -72
  135. package/dist/cli-bundle/chunks/chunk-4NUOWFBT.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-TQ6E76BE.js → chunk-55XRYWEG.js} +6 -6
  137. package/dist/cli-bundle/chunks/{chunk-5IRVSKPS.js → chunk-5GVTFFTC.js} +150 -224
  138. package/dist/cli-bundle/chunks/chunk-5GVTFFTC.js.map +1 -0
  139. package/dist/cli-bundle/chunks/{chunk-CHRNYKNI.js → chunk-5PGBHRY3.js} +41 -26
  140. package/dist/cli-bundle/chunks/chunk-5PGBHRY3.js.map +7 -0
  141. package/dist/cli-bundle/chunks/{chunk-53ARXF2O.js → chunk-66Z3X7ZG.js} +261 -161
  142. package/dist/cli-bundle/chunks/chunk-66Z3X7ZG.js.map +7 -0
  143. package/dist/cli-bundle/chunks/{chunk-A3UNLXNJ.js → chunk-6ITZLD4T.js} +738 -688
  144. package/dist/cli-bundle/chunks/chunk-6ITZLD4T.js.map +7 -0
  145. package/dist/cli-bundle/chunks/{chunk-JTRKME24.js → chunk-6YCYF2AI.js} +262 -162
  146. package/dist/cli-bundle/chunks/chunk-6YCYF2AI.js.map +1 -0
  147. package/dist/cli-bundle/chunks/{chunk-RM6MHL6A.js → chunk-6ZMBJRDJ.js} +580 -467
  148. package/dist/cli-bundle/chunks/chunk-6ZMBJRDJ.js.map +7 -0
  149. package/dist/cli-bundle/chunks/{chunk-RPRW26NG.js → chunk-7MYWF4ZX.js} +110 -73
  150. package/dist/cli-bundle/chunks/chunk-7MYWF4ZX.js.map +1 -0
  151. package/dist/cli-bundle/chunks/{chunk-SNUK7H5J.js → chunk-7NSPKJUS.js} +716 -606
  152. package/dist/cli-bundle/chunks/chunk-7NSPKJUS.js.map +7 -0
  153. package/dist/cli-bundle/chunks/{chunk-KYDYQMNW.js → chunk-7TH5NMVB.js} +95 -53
  154. package/dist/cli-bundle/chunks/chunk-7TH5NMVB.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{chunk-VD3LKZFX.js → chunk-7W4H4K26.js} +739 -689
  156. package/dist/cli-bundle/chunks/chunk-7W4H4K26.js.map +1 -0
  157. package/dist/cli-bundle/chunks/{chunk-IBU2LLWM.js → chunk-A6VOGKBA.js} +6 -6
  158. package/dist/cli-bundle/chunks/{chunk-MLHX6DN5.js → chunk-AIAIXG7I.js} +2 -2
  159. package/dist/cli-bundle/chunks/{chunk-NIBP3I7A.js → chunk-AJEBCRIY.js} +128 -126
  160. package/dist/cli-bundle/chunks/chunk-AJEBCRIY.js.map +1 -0
  161. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js → chunk-B4O5S7I3.js} +79 -57
  162. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js.map → chunk-B4O5S7I3.js.map} +2 -2
  163. package/dist/cli-bundle/chunks/{chunk-5ABGFWR4.js → chunk-BTX5MIQF.js} +2 -2
  164. package/dist/cli-bundle/chunks/chunk-BVZZN2LH.js +809 -0
  165. package/dist/cli-bundle/chunks/chunk-BVZZN2LH.js.map +7 -0
  166. package/dist/cli-bundle/chunks/{chunk-3JWQCLR5.js → chunk-CYBDUHNO.js} +3 -3
  167. package/dist/cli-bundle/chunks/{chunk-WFJZDUM7.js → chunk-CZPVDLD2.js} +4 -4
  168. package/dist/cli-bundle/chunks/{chunk-FDEVKXC4.js → chunk-EMPGXBUF.js} +22 -30
  169. package/dist/cli-bundle/chunks/chunk-EMPGXBUF.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{chunk-HUYYMTGW.js → chunk-EUKTMRN3.js} +2 -2
  171. package/dist/cli-bundle/chunks/{chunk-EVWYAG46.js → chunk-FFOQHGNH.js} +6 -6
  172. package/dist/cli-bundle/chunks/{chunk-IF4ERU6A.js → chunk-GFMSLORL.js} +6 -6
  173. package/dist/cli-bundle/chunks/{chunk-IZQOJR2B.js → chunk-GRRG3MCT.js} +198 -189
  174. package/dist/cli-bundle/chunks/chunk-GRRG3MCT.js.map +7 -0
  175. package/dist/cli-bundle/chunks/{chunk-IDYCAK35.js → chunk-H4GRLYJS.js} +3 -3
  176. package/dist/cli-bundle/chunks/{chunk-VMY7MZEM.js → chunk-HQTPRV4D.js} +6 -6
  177. package/dist/cli-bundle/chunks/{chunk-CY5IJMUM.js → chunk-I66WE2HE.js} +712 -602
  178. package/dist/cli-bundle/chunks/chunk-I66WE2HE.js.map +1 -0
  179. package/dist/cli-bundle/chunks/{chunk-ZFIEEDTJ.js → chunk-IEEJQCZ4.js} +509 -363
  180. package/dist/cli-bundle/chunks/chunk-IEEJQCZ4.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{chunk-DU66JUGT.js → chunk-IG5JYZGU.js} +488 -420
  182. package/dist/cli-bundle/chunks/chunk-IG5JYZGU.js.map +7 -0
  183. package/dist/cli-bundle/chunks/{chunk-7L6TXOOC.js → chunk-JMK5GCK2.js} +2 -2
  184. package/dist/cli-bundle/chunks/{chunk-LBH7UYKY.js → chunk-JXAUVO6X.js} +258 -169
  185. package/dist/cli-bundle/chunks/{chunk-LBH7UYKY.js.map → chunk-JXAUVO6X.js.map} +2 -2
  186. package/dist/cli-bundle/chunks/{chunk-KRASIL6M.js → chunk-K2VYLVX4.js} +2 -2
  187. package/dist/cli-bundle/chunks/{chunk-4YIMPANT.js → chunk-KCO2EAN5.js} +3 -3
  188. package/dist/cli-bundle/chunks/{chunk-T7ZMQI4J.js → chunk-KIYCOJ63.js} +198 -189
  189. package/dist/cli-bundle/chunks/chunk-KIYCOJ63.js.map +1 -0
  190. package/dist/cli-bundle/chunks/{chunk-D6USKAMA.js → chunk-KLXF7NCC.js} +2 -2
  191. package/dist/cli-bundle/chunks/{chunk-V3KLX7U7.js → chunk-KN3URLKS.js} +510 -364
  192. package/dist/cli-bundle/chunks/chunk-KN3URLKS.js.map +1 -0
  193. package/dist/cli-bundle/chunks/{chunk-OB3RJV5F.js → chunk-LRKMWUUV.js} +2 -2
  194. package/dist/cli-bundle/chunks/{chunk-74PUWBGN.js → chunk-LTRAF2D7.js} +3 -3
  195. package/dist/cli-bundle/chunks/{chunk-5T6WPLRO.js → chunk-MNBPX5JS.js} +394 -354
  196. package/dist/cli-bundle/chunks/chunk-MNBPX5JS.js.map +7 -0
  197. package/dist/cli-bundle/chunks/{chunk-4TXTVZL3.js → chunk-MRD4T5LF.js} +2 -2
  198. package/dist/cli-bundle/chunks/{chunk-E2Q2ULMR.js → chunk-N2JSWVWG.js} +4 -4
  199. package/dist/cli-bundle/chunks/{chunk-7WDETKGP.js → chunk-N3QCJS4M.js} +1105 -965
  200. package/dist/cli-bundle/chunks/chunk-N3QCJS4M.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{chunk-KGQ3W65B.js → chunk-NRZS637N.js} +258 -169
  202. package/dist/cli-bundle/chunks/chunk-NRZS637N.js.map +1 -0
  203. package/dist/cli-bundle/chunks/chunk-OTUJZKGI.js +799 -0
  204. package/dist/cli-bundle/chunks/chunk-OTUJZKGI.js.map +1 -0
  205. package/dist/cli-bundle/chunks/{chunk-ZIE6WXJ2.js → chunk-Q6K2OACU.js} +153 -90
  206. package/dist/cli-bundle/chunks/chunk-Q6K2OACU.js.map +1 -0
  207. package/dist/cli-bundle/chunks/{chunk-K46GQ265.js → chunk-Q6NXOHS6.js} +489 -421
  208. package/dist/cli-bundle/chunks/chunk-Q6NXOHS6.js.map +1 -0
  209. package/dist/cli-bundle/chunks/{chunk-7RIJGN4R.js → chunk-QH3FSKRJ.js} +2 -2
  210. package/dist/cli-bundle/chunks/{chunk-UB3V5WUI.js → chunk-RM37OPYK.js} +394 -354
  211. package/dist/cli-bundle/chunks/chunk-RM37OPYK.js.map +1 -0
  212. package/dist/cli-bundle/chunks/{chunk-OUQ5JEFM.js → chunk-S62UANU7.js} +3 -3
  213. package/dist/cli-bundle/chunks/{chunk-NO6Y6FB2.js → chunk-SPM2XLWI.js} +37 -28
  214. package/dist/cli-bundle/chunks/chunk-SPM2XLWI.js.map +7 -0
  215. package/dist/cli-bundle/chunks/{chunk-DORJSBGJ.js → chunk-SYNKD3ZG.js} +127 -125
  216. package/dist/cli-bundle/chunks/chunk-SYNKD3ZG.js.map +7 -0
  217. package/dist/cli-bundle/chunks/{chunk-6YRAMXRS.js → chunk-SYVUU7EK.js} +581 -468
  218. package/dist/cli-bundle/chunks/chunk-SYVUU7EK.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{chunk-D5LYZVGB.js → chunk-TPOFWBMY.js} +95 -53
  220. package/dist/cli-bundle/chunks/chunk-TPOFWBMY.js.map +1 -0
  221. package/dist/cli-bundle/chunks/{chunk-IHXXUIXS.js → chunk-TTHCEV5Q.js} +92 -77
  222. package/dist/cli-bundle/chunks/chunk-TTHCEV5Q.js.map +1 -0
  223. package/dist/cli-bundle/chunks/{chunk-DLDCPF5X.js → chunk-U2BEEM2X.js} +3 -3
  224. package/dist/cli-bundle/chunks/{chunk-Z5BM2FKQ.js → chunk-UGLU6Q2I.js} +91 -76
  225. package/dist/cli-bundle/chunks/chunk-UGLU6Q2I.js.map +7 -0
  226. package/dist/cli-bundle/chunks/{chunk-73PTKMAE.js → chunk-UT73HUPC.js} +3 -3
  227. package/dist/cli-bundle/chunks/{chunk-F7G53BOA.js → chunk-UTSH5GWX.js} +4 -4
  228. package/dist/cli-bundle/chunks/{chunk-AWN4PPH5.js → chunk-UWKEJMZU.js} +157 -113
  229. package/dist/cli-bundle/chunks/chunk-UWKEJMZU.js.map +7 -0
  230. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js +84 -0
  231. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js.map +1 -0
  232. package/dist/cli-bundle/chunks/{chunk-KTMMTOIP.js → chunk-W47SML5B.js} +152 -89
  233. package/dist/cli-bundle/chunks/chunk-W47SML5B.js.map +7 -0
  234. package/dist/cli-bundle/chunks/{chunk-UFKNF23C.js → chunk-WJAMWAHZ.js} +157 -118
  235. package/dist/cli-bundle/chunks/chunk-WJAMWAHZ.js.map +7 -0
  236. package/dist/cli-bundle/chunks/{chunk-HIBK6H4S.js → chunk-XCHUVHKU.js} +685 -544
  237. package/dist/cli-bundle/chunks/chunk-XCHUVHKU.js.map +1 -0
  238. package/dist/cli-bundle/chunks/{chunk-DJDXAU74.js → chunk-XEWQKDYZ.js} +685 -544
  239. package/dist/cli-bundle/chunks/chunk-XEWQKDYZ.js.map +7 -0
  240. package/dist/cli-bundle/chunks/{chunk-BOWQWXLI.js → chunk-XTHQWXVC.js} +158 -119
  241. package/dist/cli-bundle/chunks/chunk-XTHQWXVC.js.map +1 -0
  242. package/dist/cli-bundle/chunks/{chunk-6T5ZIWBS.js → chunk-XWGEMNBR.js} +150 -224
  243. package/dist/cli-bundle/chunks/chunk-XWGEMNBR.js.map +7 -0
  244. package/dist/cli-bundle/chunks/{chunk-JIP67N2K.js → chunk-Y4NRKBFW.js} +3 -3
  245. package/dist/cli-bundle/chunks/{chunk-WTRUDJ3R.js → chunk-YLZZ6T54.js} +38 -29
  246. package/dist/cli-bundle/chunks/chunk-YLZZ6T54.js.map +1 -0
  247. package/dist/cli-bundle/chunks/{chunk-FBZ5XAAF.js → chunk-YPKFV2JR.js} +6 -6
  248. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js → chunk-Z4DGFQDH.js} +80 -58
  249. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js.map → chunk-Z4DGFQDH.js.map} +1 -1
  250. package/dist/cli-bundle/chunks/{chunk-BN3CWK6G.js → chunk-ZNHEYCDD.js} +2 -2
  251. package/dist/cli-bundle/chunks/{chunk-YEDFE4DC.js → chunk-ZNT7KEWE.js} +2 -2
  252. package/dist/cli-bundle/chunks/{claim-HMCLSLUE.js → claim-SENTPZBN.js} +8 -8
  253. package/dist/cli-bundle/chunks/{claim-6NINZYB3.js → claim-Z7MEQCBT.js} +8 -8
  254. package/dist/cli-bundle/chunks/{close-OP3LK7Z2.js → close-424MX4CU.js} +7 -7
  255. package/dist/cli-bundle/chunks/close-YCWQQPDS.js +14 -0
  256. package/dist/cli-bundle/chunks/{close-many-CXJBOWWY.js → close-many-2IV4J2TR.js} +103 -82
  257. package/dist/cli-bundle/chunks/close-many-2IV4J2TR.js.map +1 -0
  258. package/dist/cli-bundle/chunks/{close-many-BFMP6HHK.js → close-many-SWY34BII.js} +102 -81
  259. package/dist/cli-bundle/chunks/close-many-SWY34BII.js.map +7 -0
  260. package/dist/cli-bundle/chunks/{comments-ETHABIY6.js → comments-4FGNTSNV.js} +8 -8
  261. package/dist/cli-bundle/chunks/{comments-MU2WMBUY.js → comments-7YS5MY5X.js} +8 -8
  262. package/dist/cli-bundle/chunks/config-BZJKK7FZ.js +1062 -0
  263. package/dist/cli-bundle/chunks/config-BZJKK7FZ.js.map +1 -0
  264. package/dist/cli-bundle/chunks/config-G74GISC4.js +1072 -0
  265. package/dist/cli-bundle/chunks/config-G74GISC4.js.map +7 -0
  266. package/dist/cli-bundle/chunks/{context-7ZEZV3BV.js → context-LHVKJSPJ.js} +12 -12
  267. package/dist/cli-bundle/chunks/{context-XDI4DKKT.js → context-ZQY54JNS.js} +12 -12
  268. package/dist/cli-bundle/chunks/{contracts-SMOAN5NF.js → contracts-CP2EZJC7.js} +320 -199
  269. package/dist/cli-bundle/chunks/contracts-CP2EZJC7.js.map +7 -0
  270. package/dist/cli-bundle/chunks/{contracts-KP4QAGVW.js → contracts-FIZLMP7O.js} +321 -200
  271. package/dist/cli-bundle/chunks/contracts-FIZLMP7O.js.map +1 -0
  272. package/dist/cli-bundle/chunks/{copy-JJ3KOQW2.js → copy-GYNQQPW2.js} +5 -5
  273. package/dist/cli-bundle/chunks/{copy-CWM6SBY6.js → copy-TLW7JTQT.js} +5 -5
  274. package/dist/cli-bundle/chunks/{create-J5Q2ELZT.js → create-VSKYSOCD.js} +12 -12
  275. package/dist/cli-bundle/chunks/create-XTMAPS7I.js +28 -0
  276. package/dist/cli-bundle/chunks/{delete-2GZLQEUQ.js → delete-4W5JYCEG.js} +5 -5
  277. package/dist/cli-bundle/chunks/{delete-OOQS4KVD.js → delete-ANTOTI2I.js} +5 -5
  278. package/dist/cli-bundle/chunks/{deps-IF4IGL4R.js → deps-HPPE6MJN.js} +5 -5
  279. package/dist/cli-bundle/chunks/{deps-ZVGGCRR6.js → deps-ZQZN54EZ.js} +5 -5
  280. package/dist/cli-bundle/chunks/{docs-NFTBCQQC.js → docs-RPOVFMP3.js} +7 -7
  281. package/dist/cli-bundle/chunks/{docs-2TIFR62T.js → docs-XJNYBJGE.js} +7 -7
  282. package/dist/cli-bundle/chunks/{eval-2F6EH4XN.js → eval-DM6JBZTS.js} +10 -10
  283. package/dist/cli-bundle/chunks/{eval-PFKXQR3B.js → eval-RFBI5FGS.js} +10 -10
  284. package/dist/cli-bundle/chunks/{extension-GMVOIP4O.js → extension-B3YY4WY5.js} +11 -10
  285. package/dist/cli-bundle/chunks/{extension-3LRYX7SW.js → extension-TTSEFQTS.js} +11 -10
  286. package/dist/cli-bundle/chunks/{files-DF3HO6XK.js → files-5D65CHGE.js} +7 -7
  287. package/dist/cli-bundle/chunks/{files-T5ODMETM.js → files-GPIG77EN.js} +7 -7
  288. package/dist/cli-bundle/chunks/{focus-MY5ARIEK.js → focus-C3PEJV2C.js} +6 -6
  289. package/dist/cli-bundle/chunks/{focus-DLXKK4AH.js → focus-ZHN7WIGX.js} +6 -6
  290. package/dist/cli-bundle/chunks/{gc-MDGRR2SU.js → gc-D4JQ6OWN.js} +3 -3
  291. package/dist/cli-bundle/chunks/{gc-FULIVYR4.js → gc-VZIXDL32.js} +3 -3
  292. package/dist/cli-bundle/chunks/{get-VYPIICPC.js → get-GIBRUUOP.js} +121 -81
  293. package/dist/cli-bundle/chunks/get-GIBRUUOP.js.map +1 -0
  294. package/dist/cli-bundle/chunks/{get-AWK324RS.js → get-IOVAN6RU.js} +120 -80
  295. package/dist/cli-bundle/chunks/get-IOVAN6RU.js.map +7 -0
  296. package/dist/cli-bundle/chunks/{health-Q66C43GN.js → health-L2U3AFKV.js} +437 -264
  297. package/dist/cli-bundle/chunks/health-L2U3AFKV.js.map +1 -0
  298. package/dist/cli-bundle/chunks/{health-FBCVZGSX.js → health-MM7AWXYF.js} +436 -263
  299. package/dist/cli-bundle/chunks/health-MM7AWXYF.js.map +7 -0
  300. package/dist/cli-bundle/chunks/history-DD7L7BNL.js +18 -0
  301. package/dist/cli-bundle/chunks/{history-X4OSES6K.js → history-IL7XCEX2.js} +8 -8
  302. package/dist/cli-bundle/chunks/{history-compact-2GHT32UX.js → history-compact-HALOTOU7.js} +214 -135
  303. package/dist/cli-bundle/chunks/history-compact-HALOTOU7.js.map +1 -0
  304. package/dist/cli-bundle/chunks/{history-compact-WLCQEKXS.js → history-compact-MV25P7DM.js} +213 -134
  305. package/dist/cli-bundle/chunks/history-compact-MV25P7DM.js.map +7 -0
  306. package/dist/cli-bundle/chunks/history-redact-IX4YEWMY.js +19 -0
  307. package/dist/cli-bundle/chunks/{history-redact-45YW65BK.js → history-redact-VYCWQFK7.js} +9 -9
  308. package/dist/cli-bundle/chunks/{history-repair-FY75IC26.js → history-repair-44MODPQF.js} +124 -84
  309. package/dist/cli-bundle/chunks/history-repair-44MODPQF.js.map +1 -0
  310. package/dist/cli-bundle/chunks/{history-repair-GABSDSVD.js → history-repair-CPNAOCNF.js} +123 -83
  311. package/dist/cli-bundle/chunks/history-repair-CPNAOCNF.js.map +7 -0
  312. package/dist/cli-bundle/chunks/{init-KO7CGIRQ.js → init-F27NHENZ.js} +12 -11
  313. package/dist/cli-bundle/chunks/init-HHVQQP6C.js +22 -0
  314. package/dist/cli-bundle/chunks/{learnings-LHZT5BHW.js → learnings-HJVDQIGY.js} +8 -8
  315. package/dist/cli-bundle/chunks/{learnings-3F7YLI45.js → learnings-XSFSUUWK.js} +8 -8
  316. package/dist/cli-bundle/chunks/{list-Y6AU5BJS.js → list-HPMEKCAA.js} +8 -8
  317. package/dist/cli-bundle/chunks/{list-ROT7JF62.js → list-VMPWTURB.js} +8 -8
  318. package/dist/cli-bundle/chunks/{next-66BJB4N2.js → next-ETXF2ZCN.js} +59 -37
  319. package/dist/cli-bundle/chunks/next-ETXF2ZCN.js.map +7 -0
  320. package/dist/cli-bundle/chunks/{next-N5MWJTBY.js → next-QM6YJIIS.js} +60 -38
  321. package/dist/cli-bundle/chunks/next-QM6YJIIS.js.map +1 -0
  322. package/dist/cli-bundle/chunks/{notes-FW6YFLND.js → notes-GDZIKGR6.js} +8 -8
  323. package/dist/cli-bundle/chunks/{notes-EVJZ3VAB.js → notes-WDDBPC4D.js} +8 -8
  324. package/dist/cli-bundle/chunks/{plan-ZHKZ7JVF.js → plan-BGDR73Z6.js} +373 -279
  325. package/dist/cli-bundle/chunks/plan-BGDR73Z6.js.map +1 -0
  326. package/dist/cli-bundle/chunks/{plan-DQ7G4EDC.js → plan-C5IMM335.js} +372 -278
  327. package/dist/cli-bundle/chunks/plan-C5IMM335.js.map +7 -0
  328. package/dist/cli-bundle/chunks/{profile-CHAW6SEA.js → profile-CCOKZ2IQ.js} +9 -9
  329. package/dist/cli-bundle/chunks/{profile-UPZGCDOG.js → profile-HUCENIEQ.js} +9 -9
  330. package/dist/cli-bundle/chunks/{register-list-query-Y2VRHPCL.js → register-list-query-ROSNIL52.js} +80 -83
  331. package/dist/cli-bundle/chunks/register-list-query-ROSNIL52.js.map +1 -0
  332. package/dist/cli-bundle/chunks/{register-list-query-KY6Z6WV7.js → register-list-query-XN4ZRHSV.js} +79 -82
  333. package/dist/cli-bundle/chunks/register-list-query-XN4ZRHSV.js.map +7 -0
  334. package/dist/cli-bundle/chunks/{register-mutation-PCARIGZS.js → register-mutation-CFSB2MS3.js} +406 -385
  335. package/dist/cli-bundle/chunks/register-mutation-CFSB2MS3.js.map +1 -0
  336. package/dist/cli-bundle/chunks/{register-mutation-N6AYSKPM.js → register-mutation-KRLAHEL2.js} +405 -384
  337. package/dist/cli-bundle/chunks/register-mutation-KRLAHEL2.js.map +7 -0
  338. package/dist/cli-bundle/chunks/{register-operations-L6CYTOIH.js → register-operations-4PASGJDB.js} +112 -93
  339. package/dist/cli-bundle/chunks/register-operations-4PASGJDB.js.map +7 -0
  340. package/dist/cli-bundle/chunks/{register-operations-YAT6FUUB.js → register-operations-MBN4KGUM.js} +113 -94
  341. package/dist/cli-bundle/chunks/register-operations-MBN4KGUM.js.map +1 -0
  342. package/dist/cli-bundle/chunks/{register-setup-N7UGXYJC.js → register-setup-VIAWYFP5.js} +129 -104
  343. package/dist/cli-bundle/chunks/register-setup-VIAWYFP5.js.map +1 -0
  344. package/dist/cli-bundle/chunks/{register-setup-MPANILQF.js → register-setup-ZCGKHDKL.js} +128 -103
  345. package/dist/cli-bundle/chunks/register-setup-ZCGKHDKL.js.map +7 -0
  346. package/dist/cli-bundle/chunks/{restore-DKMCLPI5.js → restore-4CBWUMCX.js} +9 -9
  347. package/dist/cli-bundle/chunks/restore-5UEAGG3W.js +17 -0
  348. package/dist/cli-bundle/chunks/{scheduling-shortcuts-3F4QUEDH.js → scheduling-shortcuts-6VFKNKCM.js} +12 -12
  349. package/dist/cli-bundle/chunks/{scheduling-shortcuts-BNZLQK36.js → scheduling-shortcuts-ERHCVTEM.js} +12 -12
  350. package/dist/cli-bundle/chunks/{schema-OLT6LVKH.js → schema-TDGK6N3I.js} +7 -7
  351. package/dist/cli-bundle/chunks/{schema-XJXKJQF5.js → schema-UE5KKAUX.js} +7 -7
  352. package/dist/cli-bundle/chunks/{search-KP6H7COV.js → search-FP7MEU4S.js} +10 -10
  353. package/dist/cli-bundle/chunks/{search-CX5UMV4H.js → search-K4CFLQ5S.js} +10 -10
  354. package/dist/cli-bundle/chunks/{stats-QZUG6MX5.js → stats-NJJCALEZ.js} +6 -6
  355. package/dist/cli-bundle/chunks/{stats-7XW4OEMK.js → stats-XT6QRKQY.js} +6 -6
  356. package/dist/cli-bundle/chunks/{telemetry-DIFPXCAT.js → telemetry-5SQ5UDXC.js} +84 -70
  357. package/dist/cli-bundle/chunks/telemetry-5SQ5UDXC.js.map +7 -0
  358. package/dist/cli-bundle/chunks/{telemetry-WTYFUPRL.js → telemetry-HVXFZA2U.js} +85 -71
  359. package/dist/cli-bundle/chunks/telemetry-HVXFZA2U.js.map +1 -0
  360. package/dist/cli-bundle/chunks/{test-QNDXZQCW.js → test-UFSJ5YIO.js} +15 -14
  361. package/dist/cli-bundle/chunks/{test-HU2BS7EY.js → test-YCDAUBWF.js} +15 -14
  362. package/dist/cli-bundle/chunks/test-all-2BWKY3GQ.js +427 -0
  363. package/dist/cli-bundle/chunks/test-all-2BWKY3GQ.js.map +1 -0
  364. package/dist/cli-bundle/chunks/test-all-PM7UYN42.js +430 -0
  365. package/dist/cli-bundle/chunks/test-all-PM7UYN42.js.map +7 -0
  366. package/dist/cli-bundle/chunks/{test-runs-CA6K32RD.js → test-runs-FK5E75AA.js} +185 -147
  367. package/dist/cli-bundle/chunks/test-runs-FK5E75AA.js.map +1 -0
  368. package/dist/cli-bundle/chunks/{test-runs-LANLLPVO.js → test-runs-H4TGWGRN.js} +184 -146
  369. package/dist/cli-bundle/chunks/test-runs-H4TGWGRN.js.map +7 -0
  370. package/dist/cli-bundle/chunks/update-MTCFES6X.js +24 -0
  371. package/dist/cli-bundle/chunks/{update-DJKWLBWJ.js → update-Y5WQVT5O.js} +15 -15
  372. package/dist/cli-bundle/chunks/{update-many-LU3SCNK5.js → update-many-6YAYYRLE.js} +83 -68
  373. package/dist/cli-bundle/chunks/{update-many-LU3SCNK5.js.map → update-many-6YAYYRLE.js.map} +2 -2
  374. package/dist/cli-bundle/chunks/{update-many-VW5DGF3S.js → update-many-JTKKSA7Y.js} +84 -69
  375. package/dist/cli-bundle/chunks/{update-many-VW5DGF3S.js.map → update-many-JTKKSA7Y.js.map} +1 -1
  376. package/dist/cli-bundle/chunks/{upgrade-ICXY244R.js → upgrade-DTAHZ236.js} +11 -10
  377. package/dist/cli-bundle/chunks/{upgrade-ICXY244R.js.map → upgrade-DTAHZ236.js.map} +1 -1
  378. package/dist/cli-bundle/chunks/{upgrade-77FRUAXN.js → upgrade-JUDU7YL4.js} +13 -12
  379. package/dist/cli-bundle/chunks/{upgrade-77FRUAXN.js.map → upgrade-JUDU7YL4.js.map} +1 -1
  380. package/dist/cli-bundle/chunks/{validate-2G566PKQ.js → validate-732RWS5W.js} +440 -319
  381. package/dist/cli-bundle/chunks/validate-732RWS5W.js.map +7 -0
  382. package/dist/cli-bundle/chunks/{validate-BDPVXHHH.js → validate-W7H5TEDC.js} +441 -320
  383. package/dist/cli-bundle/chunks/validate-W7H5TEDC.js.map +1 -0
  384. package/dist/cli-bundle/main.js +986 -1500
  385. package/dist/cli-bundle/main.js.map +4 -4
  386. package/dist/core/config/nested-settings.js +89 -67
  387. package/dist/core/config/nested-settings.js.map +1 -1
  388. package/dist/core/extensions/activation-summary-markdown.js +23 -12
  389. package/dist/core/extensions/activation-summary-markdown.js.map +1 -1
  390. package/dist/core/extensions/extension-policy.d.ts +18 -3
  391. package/dist/core/extensions/extension-policy.js +116 -106
  392. package/dist/core/extensions/extension-policy.js.map +1 -1
  393. package/dist/core/extensions/loader.js +310 -232
  394. package/dist/core/extensions/loader.js.map +1 -1
  395. package/dist/core/governance/metadata-coverage.js +20 -28
  396. package/dist/core/governance/metadata-coverage.js.map +1 -1
  397. package/dist/core/history/drift-scan.js +93 -81
  398. package/dist/core/history/drift-scan.js.map +1 -1
  399. package/dist/core/item/item-format.js +523 -410
  400. package/dist/core/item/item-format.js.map +1 -1
  401. package/dist/core/item/item-type-definition.js +14 -14
  402. package/dist/core/item/item-type-definition.js.map +1 -1
  403. package/dist/core/item/type-registry.js +87 -82
  404. package/dist/core/item/type-registry.js.map +1 -1
  405. package/dist/core/output/mutation-projection.js +42 -26
  406. package/dist/core/output/mutation-projection.js.map +1 -1
  407. package/dist/core/schema/runtime-schema.js +34 -28
  408. package/dist/core/schema/runtime-schema.js.map +1 -1
  409. package/dist/core/search/semantic-defaults.js +64 -37
  410. package/dist/core/search/semantic-defaults.js.map +1 -1
  411. package/dist/core/search/vector-stores.js +32 -17
  412. package/dist/core/search/vector-stores.js.map +1 -1
  413. package/dist/core/sentry/helpers.js +31 -28
  414. package/dist/core/sentry/helpers.js.map +1 -1
  415. package/dist/core/sentry/instrument.js +54 -43
  416. package/dist/core/sentry/instrument.js.map +1 -1
  417. package/dist/core/store/front-matter-cache.js +239 -153
  418. package/dist/core/store/front-matter-cache.js.map +1 -1
  419. package/dist/core/store/item-store.js +33 -26
  420. package/dist/core/store/item-store.js.map +1 -1
  421. package/dist/core/store/settings.js +247 -203
  422. package/dist/core/store/settings.js.map +1 -1
  423. package/dist/core/test/background-runs.js +189 -160
  424. package/dist/core/test/background-runs.js.map +1 -1
  425. package/dist/mcp/server.js +387 -367
  426. package/dist/mcp/server.js.map +1 -1
  427. package/dist/sdk/cli-contracts/flag-contracts.js +111 -180
  428. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  429. package/dist/sdk/cli-contracts/tool-schema.js +76 -45
  430. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  431. package/dist/sdk/compose.d.ts +4 -1
  432. package/dist/sdk/compose.js +181 -115
  433. package/dist/sdk/compose.js.map +1 -1
  434. package/docs/RELEASING.md +2 -3
  435. package/package.json +2 -2
  436. package/packages/pm-beads/extensions/beads/runtime.ts +240 -167
  437. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +65 -58
  438. package/packages/pm-todos/extensions/todos/runtime.ts +65 -42
  439. package/dist/cli-bundle/chunks/activity-EJBMXUBH.js +0 -16
  440. package/dist/cli-bundle/chunks/aggregate-MOC4TR2G.js.map +0 -1
  441. package/dist/cli-bundle/chunks/chunk-53ARXF2O.js.map +0 -7
  442. package/dist/cli-bundle/chunks/chunk-5IRVSKPS.js.map +0 -1
  443. package/dist/cli-bundle/chunks/chunk-5T6WPLRO.js.map +0 -7
  444. package/dist/cli-bundle/chunks/chunk-6T5ZIWBS.js.map +0 -7
  445. package/dist/cli-bundle/chunks/chunk-6YRAMXRS.js.map +0 -1
  446. package/dist/cli-bundle/chunks/chunk-7WDETKGP.js.map +0 -7
  447. package/dist/cli-bundle/chunks/chunk-A3UNLXNJ.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-AWN4PPH5.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-BOWQWXLI.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-C2KCIZKZ.js +0 -115
  451. package/dist/cli-bundle/chunks/chunk-C2KCIZKZ.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-CHRNYKNI.js.map +0 -7
  453. package/dist/cli-bundle/chunks/chunk-CY5IJMUM.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-D5LYZVGB.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-DJDXAU74.js.map +0 -7
  456. package/dist/cli-bundle/chunks/chunk-DORJSBGJ.js.map +0 -7
  457. package/dist/cli-bundle/chunks/chunk-DU66JUGT.js.map +0 -7
  458. package/dist/cli-bundle/chunks/chunk-F6VH3LFC.js +0 -118
  459. package/dist/cli-bundle/chunks/chunk-F6VH3LFC.js.map +0 -7
  460. package/dist/cli-bundle/chunks/chunk-FDEVKXC4.js.map +0 -1
  461. package/dist/cli-bundle/chunks/chunk-GF7EAR22.js.map +0 -7
  462. package/dist/cli-bundle/chunks/chunk-HIBK6H4S.js.map +0 -1
  463. package/dist/cli-bundle/chunks/chunk-IHXXUIXS.js.map +0 -1
  464. package/dist/cli-bundle/chunks/chunk-ISEKN64V.js +0 -35
  465. package/dist/cli-bundle/chunks/chunk-ISEKN64V.js.map +0 -7
  466. package/dist/cli-bundle/chunks/chunk-IZQOJR2B.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-JTRKME24.js.map +0 -1
  468. package/dist/cli-bundle/chunks/chunk-JZG5ADVE.js.map +0 -1
  469. package/dist/cli-bundle/chunks/chunk-K46GQ265.js.map +0 -1
  470. package/dist/cli-bundle/chunks/chunk-KGQ3W65B.js.map +0 -1
  471. package/dist/cli-bundle/chunks/chunk-KTMMTOIP.js.map +0 -7
  472. package/dist/cli-bundle/chunks/chunk-KYDYQMNW.js.map +0 -7
  473. package/dist/cli-bundle/chunks/chunk-NIBP3I7A.js.map +0 -1
  474. package/dist/cli-bundle/chunks/chunk-NO6Y6FB2.js.map +0 -7
  475. package/dist/cli-bundle/chunks/chunk-QE5UFCCO.js.map +0 -1
  476. package/dist/cli-bundle/chunks/chunk-RM6MHL6A.js.map +0 -7
  477. package/dist/cli-bundle/chunks/chunk-RPRW26NG.js.map +0 -1
  478. package/dist/cli-bundle/chunks/chunk-SNUK7H5J.js.map +0 -7
  479. package/dist/cli-bundle/chunks/chunk-T7ZMQI4J.js.map +0 -1
  480. package/dist/cli-bundle/chunks/chunk-UB3V5WUI.js.map +0 -1
  481. package/dist/cli-bundle/chunks/chunk-UFKNF23C.js.map +0 -7
  482. package/dist/cli-bundle/chunks/chunk-V3KLX7U7.js.map +0 -1
  483. package/dist/cli-bundle/chunks/chunk-VD3LKZFX.js.map +0 -1
  484. package/dist/cli-bundle/chunks/chunk-W2VMLL5S.js +0 -32
  485. package/dist/cli-bundle/chunks/chunk-W2VMLL5S.js.map +0 -1
  486. package/dist/cli-bundle/chunks/chunk-WTRUDJ3R.js.map +0 -1
  487. package/dist/cli-bundle/chunks/chunk-Z55WX4IQ.js.map +0 -1
  488. package/dist/cli-bundle/chunks/chunk-Z5BM2FKQ.js.map +0 -7
  489. package/dist/cli-bundle/chunks/chunk-ZEATCVAC.js.map +0 -7
  490. package/dist/cli-bundle/chunks/chunk-ZFIEEDTJ.js.map +0 -7
  491. package/dist/cli-bundle/chunks/chunk-ZIE6WXJ2.js.map +0 -1
  492. package/dist/cli-bundle/chunks/close-37KEHLYM.js +0 -14
  493. package/dist/cli-bundle/chunks/close-many-BFMP6HHK.js.map +0 -7
  494. package/dist/cli-bundle/chunks/close-many-CXJBOWWY.js.map +0 -1
  495. package/dist/cli-bundle/chunks/config-FIXJZEQK.js +0 -1541
  496. package/dist/cli-bundle/chunks/config-FIXJZEQK.js.map +0 -7
  497. package/dist/cli-bundle/chunks/config-X3ZVCUUG.js +0 -1531
  498. package/dist/cli-bundle/chunks/config-X3ZVCUUG.js.map +0 -1
  499. package/dist/cli-bundle/chunks/contracts-KP4QAGVW.js.map +0 -1
  500. package/dist/cli-bundle/chunks/contracts-SMOAN5NF.js.map +0 -7
  501. package/dist/cli-bundle/chunks/create-DFMNBKBS.js +0 -28
  502. package/dist/cli-bundle/chunks/get-AWK324RS.js.map +0 -7
  503. package/dist/cli-bundle/chunks/get-VYPIICPC.js.map +0 -1
  504. package/dist/cli-bundle/chunks/health-FBCVZGSX.js.map +0 -7
  505. package/dist/cli-bundle/chunks/health-Q66C43GN.js.map +0 -1
  506. package/dist/cli-bundle/chunks/history-5XUSLAJA.js +0 -18
  507. package/dist/cli-bundle/chunks/history-compact-2GHT32UX.js.map +0 -1
  508. package/dist/cli-bundle/chunks/history-compact-WLCQEKXS.js.map +0 -7
  509. package/dist/cli-bundle/chunks/history-redact-BVHWDXPR.js +0 -19
  510. package/dist/cli-bundle/chunks/history-repair-FY75IC26.js.map +0 -1
  511. package/dist/cli-bundle/chunks/history-repair-GABSDSVD.js.map +0 -7
  512. package/dist/cli-bundle/chunks/init-TRYJELH4.js +0 -21
  513. package/dist/cli-bundle/chunks/next-66BJB4N2.js.map +0 -7
  514. package/dist/cli-bundle/chunks/next-N5MWJTBY.js.map +0 -1
  515. package/dist/cli-bundle/chunks/plan-DQ7G4EDC.js.map +0 -7
  516. package/dist/cli-bundle/chunks/plan-ZHKZ7JVF.js.map +0 -1
  517. package/dist/cli-bundle/chunks/register-list-query-KY6Z6WV7.js.map +0 -7
  518. package/dist/cli-bundle/chunks/register-list-query-Y2VRHPCL.js.map +0 -1
  519. package/dist/cli-bundle/chunks/register-mutation-N6AYSKPM.js.map +0 -7
  520. package/dist/cli-bundle/chunks/register-mutation-PCARIGZS.js.map +0 -1
  521. package/dist/cli-bundle/chunks/register-operations-L6CYTOIH.js.map +0 -7
  522. package/dist/cli-bundle/chunks/register-operations-YAT6FUUB.js.map +0 -1
  523. package/dist/cli-bundle/chunks/register-setup-MPANILQF.js.map +0 -7
  524. package/dist/cli-bundle/chunks/register-setup-N7UGXYJC.js.map +0 -1
  525. package/dist/cli-bundle/chunks/restore-IRAKSWIW.js +0 -17
  526. package/dist/cli-bundle/chunks/telemetry-DIFPXCAT.js.map +0 -7
  527. package/dist/cli-bundle/chunks/telemetry-WTYFUPRL.js.map +0 -1
  528. package/dist/cli-bundle/chunks/test-all-PZTBLLQ6.js +0 -360
  529. package/dist/cli-bundle/chunks/test-all-PZTBLLQ6.js.map +0 -7
  530. package/dist/cli-bundle/chunks/test-all-XLPI4USF.js +0 -357
  531. package/dist/cli-bundle/chunks/test-all-XLPI4USF.js.map +0 -1
  532. package/dist/cli-bundle/chunks/test-runs-CA6K32RD.js.map +0 -1
  533. package/dist/cli-bundle/chunks/test-runs-LANLLPVO.js.map +0 -7
  534. package/dist/cli-bundle/chunks/update-UXDLTEOZ.js +0 -24
  535. package/dist/cli-bundle/chunks/validate-2G566PKQ.js.map +0 -7
  536. package/dist/cli-bundle/chunks/validate-BDPVXHHH.js.map +0 -1
  537. /package/dist/cli-bundle/chunks/{activity-MVSEND6D.js.map → activity-CUC4JY3U.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{activity-EJBMXUBH.js.map → activity-WEIEMM73.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{append-KDHT4GHI.js.map → append-H32VOR2Y.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{append-LEDBAM3K.js.map → append-UBM632FK.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-SJZTPVFT.js.map → chunk-2ASNV4DH.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-JVQ7UOYC.js.map → chunk-2CHRYUXL.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-DRPF274X.js.map → chunk-3LCUASYG.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-JJ4SG243.js.map → chunk-3Q2HBMTI.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-TQ6E76BE.js.map → chunk-55XRYWEG.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-IBU2LLWM.js.map → chunk-A6VOGKBA.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-MLHX6DN5.js.map → chunk-AIAIXG7I.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-5ABGFWR4.js.map → chunk-BTX5MIQF.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-3JWQCLR5.js.map → chunk-CYBDUHNO.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-WFJZDUM7.js.map → chunk-CZPVDLD2.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-HUYYMTGW.js.map → chunk-EUKTMRN3.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-EVWYAG46.js.map → chunk-FFOQHGNH.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-IF4ERU6A.js.map → chunk-GFMSLORL.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-IDYCAK35.js.map → chunk-H4GRLYJS.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-VMY7MZEM.js.map → chunk-HQTPRV4D.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-7L6TXOOC.js.map → chunk-JMK5GCK2.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-KRASIL6M.js.map → chunk-K2VYLVX4.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-4YIMPANT.js.map → chunk-KCO2EAN5.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-D6USKAMA.js.map → chunk-KLXF7NCC.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-OB3RJV5F.js.map → chunk-LRKMWUUV.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-74PUWBGN.js.map → chunk-LTRAF2D7.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-4TXTVZL3.js.map → chunk-MRD4T5LF.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-E2Q2ULMR.js.map → chunk-N2JSWVWG.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-7RIJGN4R.js.map → chunk-QH3FSKRJ.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-OUQ5JEFM.js.map → chunk-S62UANU7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-DLDCPF5X.js.map → chunk-U2BEEM2X.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-73PTKMAE.js.map → chunk-UT73HUPC.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{chunk-F7G53BOA.js.map → chunk-UTSH5GWX.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{chunk-JIP67N2K.js.map → chunk-Y4NRKBFW.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{chunk-FBZ5XAAF.js.map → chunk-YPKFV2JR.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{chunk-BN3CWK6G.js.map → chunk-ZNHEYCDD.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{chunk-YEDFE4DC.js.map → chunk-ZNT7KEWE.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{claim-HMCLSLUE.js.map → claim-SENTPZBN.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{claim-6NINZYB3.js.map → claim-Z7MEQCBT.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{close-OP3LK7Z2.js.map → close-424MX4CU.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{close-37KEHLYM.js.map → close-YCWQQPDS.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{comments-ETHABIY6.js.map → comments-4FGNTSNV.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{comments-MU2WMBUY.js.map → comments-7YS5MY5X.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{context-7ZEZV3BV.js.map → context-LHVKJSPJ.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{context-XDI4DKKT.js.map → context-ZQY54JNS.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{copy-JJ3KOQW2.js.map → copy-GYNQQPW2.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{copy-CWM6SBY6.js.map → copy-TLW7JTQT.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{create-J5Q2ELZT.js.map → create-VSKYSOCD.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{create-DFMNBKBS.js.map → create-XTMAPS7I.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{delete-2GZLQEUQ.js.map → delete-4W5JYCEG.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{delete-OOQS4KVD.js.map → delete-ANTOTI2I.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{deps-IF4IGL4R.js.map → deps-HPPE6MJN.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{deps-ZVGGCRR6.js.map → deps-ZQZN54EZ.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{docs-NFTBCQQC.js.map → docs-RPOVFMP3.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{docs-2TIFR62T.js.map → docs-XJNYBJGE.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{eval-2F6EH4XN.js.map → eval-DM6JBZTS.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{eval-PFKXQR3B.js.map → eval-RFBI5FGS.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{extension-GMVOIP4O.js.map → extension-B3YY4WY5.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{extension-3LRYX7SW.js.map → extension-TTSEFQTS.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{files-DF3HO6XK.js.map → files-5D65CHGE.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{files-T5ODMETM.js.map → files-GPIG77EN.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{focus-MY5ARIEK.js.map → focus-C3PEJV2C.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{focus-DLXKK4AH.js.map → focus-ZHN7WIGX.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{gc-MDGRR2SU.js.map → gc-D4JQ6OWN.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{gc-FULIVYR4.js.map → gc-VZIXDL32.js.map} +0 -0
  601. /package/dist/cli-bundle/chunks/{history-5XUSLAJA.js.map → history-DD7L7BNL.js.map} +0 -0
  602. /package/dist/cli-bundle/chunks/{history-X4OSES6K.js.map → history-IL7XCEX2.js.map} +0 -0
  603. /package/dist/cli-bundle/chunks/{history-redact-BVHWDXPR.js.map → history-redact-IX4YEWMY.js.map} +0 -0
  604. /package/dist/cli-bundle/chunks/{history-redact-45YW65BK.js.map → history-redact-VYCWQFK7.js.map} +0 -0
  605. /package/dist/cli-bundle/chunks/{init-KO7CGIRQ.js.map → init-F27NHENZ.js.map} +0 -0
  606. /package/dist/cli-bundle/chunks/{init-TRYJELH4.js.map → init-HHVQQP6C.js.map} +0 -0
  607. /package/dist/cli-bundle/chunks/{learnings-LHZT5BHW.js.map → learnings-HJVDQIGY.js.map} +0 -0
  608. /package/dist/cli-bundle/chunks/{learnings-3F7YLI45.js.map → learnings-XSFSUUWK.js.map} +0 -0
  609. /package/dist/cli-bundle/chunks/{list-Y6AU5BJS.js.map → list-HPMEKCAA.js.map} +0 -0
  610. /package/dist/cli-bundle/chunks/{list-ROT7JF62.js.map → list-VMPWTURB.js.map} +0 -0
  611. /package/dist/cli-bundle/chunks/{notes-FW6YFLND.js.map → notes-GDZIKGR6.js.map} +0 -0
  612. /package/dist/cli-bundle/chunks/{notes-EVJZ3VAB.js.map → notes-WDDBPC4D.js.map} +0 -0
  613. /package/dist/cli-bundle/chunks/{profile-CHAW6SEA.js.map → profile-CCOKZ2IQ.js.map} +0 -0
  614. /package/dist/cli-bundle/chunks/{profile-UPZGCDOG.js.map → profile-HUCENIEQ.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{restore-DKMCLPI5.js.map → restore-4CBWUMCX.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{restore-IRAKSWIW.js.map → restore-5UEAGG3W.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-3F4QUEDH.js.map → scheduling-shortcuts-6VFKNKCM.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-BNZLQK36.js.map → scheduling-shortcuts-ERHCVTEM.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{schema-OLT6LVKH.js.map → schema-TDGK6N3I.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{schema-XJXKJQF5.js.map → schema-UE5KKAUX.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{search-KP6H7COV.js.map → search-FP7MEU4S.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{search-CX5UMV4H.js.map → search-K4CFLQ5S.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{stats-QZUG6MX5.js.map → stats-NJJCALEZ.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{stats-7XW4OEMK.js.map → stats-XT6QRKQY.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{test-QNDXZQCW.js.map → test-UFSJ5YIO.js.map} +0 -0
  626. /package/dist/cli-bundle/chunks/{test-HU2BS7EY.js.map → test-YCDAUBWF.js.map} +0 -0
  627. /package/dist/cli-bundle/chunks/{update-UXDLTEOZ.js.map → update-MTCFES6X.js.map} +0 -0
  628. /package/dist/cli-bundle/chunks/{update-DJKWLBWJ.js.map → update-Y5WQVT5O.js.map} +0 -0
@@ -4,7 +4,7 @@
4
4
  * Implements the pm update command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="87aa6b2c-8735-58a6-b263-b310f37494b9")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6156dbbd-29ea-58f5-ba6e-c9ae989e23e3")}catch(e){}}();
8
8
  import { pathExists } from "../../core/fs/fs-utils.js";
9
9
  import { canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, } from "../../core/item/type-registry.js";
10
10
  import { normalizeItemId } from "../../core/item/id.js";
@@ -283,81 +283,31 @@ function enforceAllowAuditUpdateScope(id, options, clearFrontMatterKeys) {
283
283
  return;
284
284
  }
285
285
  const disallowedFlags = [];
286
- if (options.status !== undefined) {
287
- disallowedFlags.push("--status");
288
- }
289
- if (options.closeReason !== undefined) {
290
- disallowedFlags.push("--close-reason");
291
- }
292
- if (options.assignee !== undefined) {
293
- disallowedFlags.push("--assignee");
294
- }
295
- if (options.parent !== undefined) {
296
- disallowedFlags.push("--parent");
297
- }
298
- if (options.blockedBy !== undefined) {
299
- disallowedFlags.push("--blocked-by");
300
- }
301
- if (options.blockedReason !== undefined) {
302
- disallowedFlags.push("--blocked-reason");
303
- }
304
- if (options.unblockNote !== undefined) {
305
- disallowedFlags.push("--unblock-note");
306
- }
307
- if (options.dep !== undefined) {
308
- disallowedFlags.push("--dep");
309
- }
310
- if (options.depRemove !== undefined) {
311
- disallowedFlags.push("--dep-remove");
312
- }
313
- if (options.replaceDeps === true) {
314
- disallowedFlags.push("--replace-deps");
315
- }
316
- if (options.replaceTests === true) {
317
- disallowedFlags.push("--replace-tests");
318
- }
319
- if (options.note !== undefined) {
320
- disallowedFlags.push("--note");
321
- }
322
- if (options.learning !== undefined) {
323
- disallowedFlags.push("--learning");
324
- }
325
- if (options.test !== undefined) {
326
- disallowedFlags.push("--test");
327
- }
328
- if (options.reminder !== undefined) {
329
- disallowedFlags.push("--reminder");
330
- }
331
- if (options.event !== undefined) {
332
- disallowedFlags.push("--event");
333
- }
334
- if (options.clearDeps === true) {
335
- disallowedFlags.push("--clear-deps");
336
- }
337
- if (options.clearComments === true) {
338
- disallowedFlags.push("--clear-comments");
339
- }
340
- if (options.clearNotes === true) {
341
- disallowedFlags.push("--clear-notes");
342
- }
343
- if (options.clearLearnings === true) {
344
- disallowedFlags.push("--clear-learnings");
345
- }
346
- if (options.clearFiles === true) {
347
- disallowedFlags.push("--clear-files");
348
- }
349
- if (options.clearTests === true) {
350
- disallowedFlags.push("--clear-tests");
351
- }
352
- if (options.clearDocs === true) {
353
- disallowedFlags.push("--clear-docs");
354
- }
355
- if (options.clearReminders === true) {
356
- disallowedFlags.push("--clear-reminders");
357
- }
358
- if (options.clearEvents === true) {
359
- disallowedFlags.push("--clear-events");
360
- }
286
+ pushIf(options.status !== undefined, "--status", disallowedFlags);
287
+ pushIf(options.closeReason !== undefined, "--close-reason", disallowedFlags);
288
+ pushIf(options.assignee !== undefined, "--assignee", disallowedFlags);
289
+ pushIf(options.parent !== undefined, "--parent", disallowedFlags);
290
+ pushIf(options.blockedBy !== undefined, "--blocked-by", disallowedFlags);
291
+ pushIf(options.blockedReason !== undefined, "--blocked-reason", disallowedFlags);
292
+ pushIf(options.unblockNote !== undefined, "--unblock-note", disallowedFlags);
293
+ pushIf(options.dep !== undefined, "--dep", disallowedFlags);
294
+ pushIf(options.depRemove !== undefined, "--dep-remove", disallowedFlags);
295
+ pushIf(options.replaceDeps === true, "--replace-deps", disallowedFlags);
296
+ pushIf(options.replaceTests === true, "--replace-tests", disallowedFlags);
297
+ pushIf(options.note !== undefined, "--note", disallowedFlags);
298
+ pushIf(options.learning !== undefined, "--learning", disallowedFlags);
299
+ pushIf(options.test !== undefined, "--test", disallowedFlags);
300
+ pushIf(options.reminder !== undefined, "--reminder", disallowedFlags);
301
+ pushIf(options.event !== undefined, "--event", disallowedFlags);
302
+ pushIf(options.clearDeps === true, "--clear-deps", disallowedFlags);
303
+ pushIf(options.clearComments === true, "--clear-comments", disallowedFlags);
304
+ pushIf(options.clearNotes === true, "--clear-notes", disallowedFlags);
305
+ pushIf(options.clearLearnings === true, "--clear-learnings", disallowedFlags);
306
+ pushIf(options.clearFiles === true, "--clear-files", disallowedFlags);
307
+ pushIf(options.clearTests === true, "--clear-tests", disallowedFlags);
308
+ pushIf(options.clearDocs === true, "--clear-docs", disallowedFlags);
309
+ pushIf(options.clearReminders === true, "--clear-reminders", disallowedFlags);
310
+ pushIf(options.clearEvents === true, "--clear-events", disallowedFlags);
361
311
  /* c8 ignore start -- audit unset ordering fallback is validated by audit-governance integration coverage. */
362
312
  const disallowedUnset = [...clearFrontMatterKeys]
363
313
  .filter((field) => AUDIT_UPDATE_DISALLOWED_UNSET_FRONT_MATTER_KEYS.has(field))
@@ -624,7 +574,7 @@ function normalizeUpdatePolicyOptionKey(raw, typeName) {
624
574
  }
625
575
  return canonical;
626
576
  }
627
- function collectProvidedUpdatePolicyOptions(options, extensionFieldNames) {
577
+ function collectProvidedUpdatePolicyOptions(options, runtimeFieldRegistry, extensionFieldNames) {
628
578
  const provided = new Set();
629
579
  const mark = (optionKey, isProvided) => {
630
580
  if (isProvided) {
@@ -705,14 +655,14 @@ function collectProvidedUpdatePolicyOptions(options, extensionFieldNames) {
705
655
  mark("event", options.clearEvents === true);
706
656
  mark("typeOption", options.clearTypeOptions === true);
707
657
  if (options.unset && options.unset.length > 0) {
708
- const unsetTargets = parseUpdateUnsetTargets(options.unset, undefined, extensionFieldNames);
658
+ const unsetTargets = parseUpdateUnsetTargets(options.unset, runtimeFieldRegistry, extensionFieldNames);
709
659
  for (const optionKey of unsetTargets.optionKeys) {
710
660
  mark(optionKey, true);
711
661
  }
712
662
  }
713
663
  return provided;
714
664
  }
715
- function enforceUpdateOptionsByType(typeName, options, typeRegistry, extensionFieldNames) {
665
+ function enforceUpdateOptionsByType(typeName, options, typeRegistry, runtimeFieldRegistry, extensionFieldNames) {
716
666
  const typeDefinition = resolveTypeDefinition(typeName, typeRegistry);
717
667
  if (!typeDefinition) {
718
668
  throw new PmCliError(`Invalid type value "${typeName}"`, EXIT_CODE.USAGE);
@@ -721,7 +671,7 @@ function enforceUpdateOptionsByType(typeName, options, typeRegistry, extensionFi
721
671
  if (policyState.errors.length > 0) {
722
672
  throw new PmCliError(policyState.errors.join("; "), EXIT_CODE.CONFLICT);
723
673
  }
724
- const provided = collectProvidedUpdatePolicyOptions(options, extensionFieldNames);
674
+ const provided = collectProvidedUpdatePolicyOptions(options, runtimeFieldRegistry, extensionFieldNames);
725
675
  for (const disabled of policyState.disabled) {
726
676
  if (provided.has(normalizeUpdatePolicyOptionKey(disabled, typeName))) {
727
677
  throw new PmCliError(`Option ${commandOptionFlagLabel("update", disabled)} is disabled for type "${typeName}" by command_option_policies`, EXIT_CODE.USAGE);
@@ -733,6 +683,95 @@ function enforceUpdateOptionsByType(typeName, options, typeRegistry, extensionFi
733
683
  }
734
684
  }
735
685
  }
686
+ const UPDATE_LEGACY_SCALAR_OPTION_KEYS = [
687
+ "tags",
688
+ "closeReason",
689
+ "deadline",
690
+ "estimatedMinutes",
691
+ "acceptanceCriteria",
692
+ "definitionOfReady",
693
+ "goal",
694
+ "objective",
695
+ "value",
696
+ "impact",
697
+ "outcome",
698
+ "whyNow",
699
+ "assignee",
700
+ "parent",
701
+ "reviewer",
702
+ "risk",
703
+ "confidence",
704
+ "sprint",
705
+ "release",
706
+ "blockedBy",
707
+ "blockedReason",
708
+ "unblockNote",
709
+ "reporter",
710
+ "severity",
711
+ "environment",
712
+ "reproSteps",
713
+ "resolution",
714
+ "expectedResult",
715
+ "actualResult",
716
+ "affectedVersion",
717
+ "fixedVersion",
718
+ "component",
719
+ "regression",
720
+ "customerImpact",
721
+ ];
722
+ const UPDATE_SIMPLE_FIELD_FLAG_KEYS = [
723
+ "title",
724
+ "description",
725
+ "body",
726
+ "status",
727
+ "closeReason",
728
+ "priority",
729
+ "type",
730
+ "deadline",
731
+ "estimatedMinutes",
732
+ "acceptanceCriteria",
733
+ "definitionOfReady",
734
+ "goal",
735
+ "objective",
736
+ "value",
737
+ "impact",
738
+ "outcome",
739
+ "whyNow",
740
+ "assignee",
741
+ "parent",
742
+ "reviewer",
743
+ "risk",
744
+ "confidence",
745
+ "sprint",
746
+ "release",
747
+ "blockedBy",
748
+ "blockedReason",
749
+ "unblockNote",
750
+ "reporter",
751
+ "severity",
752
+ "environment",
753
+ "reproSteps",
754
+ "resolution",
755
+ "expectedResult",
756
+ "actualResult",
757
+ "affectedVersion",
758
+ "fixedVersion",
759
+ "component",
760
+ "regression",
761
+ "customerImpact",
762
+ "dep",
763
+ "depRemove",
764
+ "comment",
765
+ "note",
766
+ "learning",
767
+ "file",
768
+ "test",
769
+ "doc",
770
+ "reminder",
771
+ "event",
772
+ "typeOption",
773
+ "field",
774
+ ];
736
775
  const UPDATE_POST_TAG_SCALAR_MUTATIONS = [
737
776
  {
738
777
  optionKey: "deadline",
@@ -799,12 +838,9 @@ function applyUpdateScalarMutations(definitions, options, context) {
799
838
  context.changedFields.push(definition.metadataKey);
800
839
  }
801
840
  }
802
- /**
803
- * Implements run update for the public runtime surface of this module.
804
- */
805
- export async function runUpdate(id, options, global) {
841
+ async function resolveStdinUpdateOptions(options) {
806
842
  const stdinResolver = createStdinTokenResolver();
807
- options = normalizeLegacyNoneUpdateOptions({
843
+ return normalizeLegacyNoneUpdateOptions({
808
844
  ...options,
809
845
  body: await stdinResolver.resolveValue(options.body, "--body"),
810
846
  dep: await stdinResolver.resolveList(options.dep, "--dep"),
@@ -820,26 +856,9 @@ export async function runUpdate(id, options, global) {
820
856
  typeOption: await stdinResolver.resolveList(options.typeOption, "--type-option"),
821
857
  field: await stdinResolver.resolveList(options.field, "--field"),
822
858
  });
823
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
824
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
825
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
826
- }
827
- const settings = await readSettings(pmRoot);
828
- const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
829
- const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
830
- const extensionRegistrations = getActiveExtensionRegistrations();
831
- const extensionFieldNames = collectRegisteredItemFieldNames(extensionRegistrations);
832
- const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);
833
- // Per-type allowed-transition enforcement is read RAW (not preset-derived) so
834
- // existing projects are unaffected when unset; defaults to "off".
835
- const workflowEnforcement = settings.governance.workflow_enforcement ?? "off";
836
- const typeWorkflows = workflowEnforcement === "off" ? [] : resolveTypeWorkflows(settings.schema);
837
- const parentReferencePolicy = settings.validation.parent_reference;
838
- const sprintReleasePolicy = settings.validation.sprint_release_format;
839
- const unsetTargets = parseUpdateUnsetTargets(options.unset, runtimeFieldRegistry, extensionFieldNames);
840
- const clearOptionKeys = new Set(unsetTargets.optionKeys);
841
- const clearFrontMatterKeys = new Set(unsetTargets.frontMatterKeys);
842
- const clearCollectionDefinitions = [
859
+ }
860
+ function buildClearCollectionDefinitions(options) {
861
+ return [
843
862
  {
844
863
  enabled: options.clearDeps || options.replaceDeps,
845
864
  optionKey: "dep",
@@ -921,6 +940,8 @@ export async function runUpdate(id, options, global) {
921
940
  frontMatterKey: "type_options",
922
941
  },
923
942
  ];
943
+ }
944
+ function validateReplaceOptions(options) {
924
945
  if (options.replaceDeps === true && (options.dep === undefined || options.dep.length === 0)) {
925
946
  throw new PmCliError("--replace-deps requires at least one --dep entry", EXIT_CODE.USAGE);
926
947
  }
@@ -933,57 +954,31 @@ export async function runUpdate(id, options, global) {
933
954
  if (options.replaceTests === true && options.clearTests === true) {
934
955
  throw new PmCliError("--replace-tests cannot be combined with --clear-tests", EXIT_CODE.USAGE);
935
956
  }
936
- for (const definition of clearCollectionDefinitions) {
957
+ }
958
+ function applyClearCollectionDefinitions(params) {
959
+ for (const definition of params.definitions) {
937
960
  if (!definition.enabled) {
938
961
  continue;
939
962
  }
940
- if (definition.values &&
941
- definition.values.length > 0 &&
942
- !((definition.optionKey === "dep" && options.replaceDeps === true) ||
943
- (definition.optionKey === "test" && options.replaceTests === true))) {
963
+ const isReplacement = (definition.optionKey === "dep" && params.options.replaceDeps === true) ||
964
+ (definition.optionKey === "test" && params.options.replaceTests === true);
965
+ if (definition.values && definition.values.length > 0 && !isReplacement) {
944
966
  throw new PmCliError(`Cannot combine ${definition.clearFlag} with ${definition.valueFlag}`, EXIT_CODE.USAGE);
945
967
  }
946
- clearOptionKeys.add(definition.optionKey);
947
- clearFrontMatterKeys.add(definition.frontMatterKey);
968
+ params.clearOptionKeys.add(definition.optionKey);
969
+ params.clearFrontMatterKeys.add(definition.frontMatterKey);
948
970
  }
949
- enforceAllowAuditUpdateScope(id, options, clearFrontMatterKeys);
950
- const scalarOptionPresence = {
951
- tags: options.tags !== undefined,
952
- closeReason: options.closeReason !== undefined,
953
- deadline: options.deadline !== undefined,
954
- estimatedMinutes: options.estimatedMinutes !== undefined,
955
- acceptanceCriteria: options.acceptanceCriteria !== undefined,
956
- definitionOfReady: options.definitionOfReady !== undefined,
957
- order: options.order !== undefined || options.rank !== undefined,
958
- goal: options.goal !== undefined,
959
- objective: options.objective !== undefined,
960
- value: options.value !== undefined,
961
- impact: options.impact !== undefined,
962
- outcome: options.outcome !== undefined,
963
- whyNow: options.whyNow !== undefined,
964
- assignee: options.assignee !== undefined,
965
- parent: options.parent !== undefined,
966
- reviewer: options.reviewer !== undefined,
967
- risk: options.risk !== undefined,
968
- confidence: options.confidence !== undefined,
969
- sprint: options.sprint !== undefined,
970
- release: options.release !== undefined,
971
- blockedBy: options.blockedBy !== undefined,
972
- blockedReason: options.blockedReason !== undefined,
973
- unblockNote: options.unblockNote !== undefined,
974
- reporter: options.reporter !== undefined,
975
- severity: options.severity !== undefined,
976
- environment: options.environment !== undefined,
977
- reproSteps: options.reproSteps !== undefined,
978
- resolution: options.resolution !== undefined,
979
- expectedResult: options.expectedResult !== undefined,
980
- actualResult: options.actualResult !== undefined,
981
- affectedVersion: options.affectedVersion !== undefined,
982
- fixedVersion: options.fixedVersion !== undefined,
983
- component: options.component !== undefined,
984
- regression: options.regression !== undefined,
985
- customerImpact: options.customerImpact !== undefined,
986
- };
971
+ }
972
+ function buildScalarOptionPresence(options) {
973
+ const presence = {};
974
+ for (const key of UPDATE_LEGACY_SCALAR_OPTION_KEYS) {
975
+ presence[String(key)] = options[key] !== undefined;
976
+ }
977
+ presence.order = options.order !== undefined || options.rank !== undefined;
978
+ return presence;
979
+ }
980
+ function rejectUnsetScalarConflicts(options, unsetTargets) {
981
+ const scalarOptionPresence = buildScalarOptionPresence(options);
987
982
  for (const [optionKey, hasValue] of Object.entries(scalarOptionPresence)) {
988
983
  if (!hasValue || !unsetTargets.optionKeys.has(optionKey)) {
989
984
  continue;
@@ -991,59 +986,576 @@ export async function runUpdate(id, options, global) {
991
986
  const unsetField = UPDATE_OPTION_KEY_TO_UNSET_CANONICAL.get(optionKey) ?? optionKey;
992
987
  throw new PmCliError(`Cannot combine --unset ${unsetField} with ${commandOptionFlagLabel("update", optionKey)}`, EXIT_CODE.USAGE);
993
988
  }
994
- // `--add-tags`/`--remove-tags` aren't in the scalar presence map above (they
995
- // are repeatable), but combining them with `--unset tags` is the same
996
- // contradiction as `--unset tags --tags ...`, so reject it explicitly.
997
- if (clearFrontMatterKeys.has("tags")) {
998
- if (Array.isArray(options.addTags) && options.addTags.length > 0) {
999
- throw new PmCliError("Cannot combine --unset tags with --add-tags", EXIT_CODE.USAGE);
1000
- }
1001
- if (Array.isArray(options.removeTags) && options.removeTags.length > 0) {
1002
- throw new PmCliError("Cannot combine --unset tags with --remove-tags", EXIT_CODE.USAGE);
1003
- }
989
+ if (!unsetTargets.frontMatterKeys.has("tags")) {
990
+ return;
1004
991
  }
992
+ if (Array.isArray(options.addTags) && options.addTags.length > 0) {
993
+ throw new PmCliError("Cannot combine --unset tags with --add-tags", EXIT_CODE.USAGE);
994
+ }
995
+ if (Array.isArray(options.removeTags) && options.removeTags.length > 0) {
996
+ throw new PmCliError("Cannot combine --unset tags with --remove-tags", EXIT_CODE.USAGE);
997
+ }
998
+ }
999
+ function rejectLegacyScalarTokens(options) {
1005
1000
  const assertNoLegacyScalarToken = (value, optionKey) => {
1006
1001
  const unsetField = UPDATE_OPTION_KEY_TO_UNSET_CANONICAL.get(optionKey);
1007
1002
  const hint = unsetField ? `Use --unset ${unsetField} to clear this field.` : undefined;
1008
1003
  assertNoLegacyNoneToken(value, commandOptionFlagLabel("update", optionKey), hint);
1009
1004
  };
1010
- assertNoLegacyScalarToken(options.tags, "tags");
1011
- assertNoLegacyScalarToken(options.closeReason, "closeReason");
1012
- assertNoLegacyScalarToken(options.deadline, "deadline");
1013
- assertNoLegacyScalarToken(options.estimatedMinutes, "estimatedMinutes");
1014
- assertNoLegacyScalarToken(options.acceptanceCriteria, "acceptanceCriteria");
1015
- assertNoLegacyScalarToken(options.definitionOfReady, "definitionOfReady");
1005
+ for (const key of UPDATE_LEGACY_SCALAR_OPTION_KEYS) {
1006
+ assertNoLegacyScalarToken(options[key], String(key));
1007
+ }
1016
1008
  assertNoLegacyScalarToken(options.order ?? options.rank, "order");
1017
- assertNoLegacyScalarToken(options.goal, "goal");
1018
- assertNoLegacyScalarToken(options.objective, "objective");
1019
- assertNoLegacyScalarToken(options.value, "value");
1020
- assertNoLegacyScalarToken(options.impact, "impact");
1021
- assertNoLegacyScalarToken(options.outcome, "outcome");
1022
- assertNoLegacyScalarToken(options.whyNow, "whyNow");
1023
- assertNoLegacyScalarToken(options.assignee, "assignee");
1024
- assertNoLegacyScalarToken(options.parent, "parent");
1025
- assertNoLegacyScalarToken(options.reviewer, "reviewer");
1026
- assertNoLegacyScalarToken(options.risk, "risk");
1027
- assertNoLegacyScalarToken(options.confidence, "confidence");
1028
- assertNoLegacyScalarToken(options.sprint, "sprint");
1029
- assertNoLegacyScalarToken(options.release, "release");
1030
- assertNoLegacyScalarToken(options.blockedBy, "blockedBy");
1031
- assertNoLegacyScalarToken(options.blockedReason, "blockedReason");
1032
- assertNoLegacyScalarToken(options.unblockNote, "unblockNote");
1033
- assertNoLegacyScalarToken(options.reporter, "reporter");
1034
- assertNoLegacyScalarToken(options.severity, "severity");
1035
- assertNoLegacyScalarToken(options.environment, "environment");
1036
- assertNoLegacyScalarToken(options.reproSteps, "reproSteps");
1037
- assertNoLegacyScalarToken(options.resolution, "resolution");
1038
- assertNoLegacyScalarToken(options.expectedResult, "expectedResult");
1039
- assertNoLegacyScalarToken(options.actualResult, "actualResult");
1040
- assertNoLegacyScalarToken(options.affectedVersion, "affectedVersion");
1041
- assertNoLegacyScalarToken(options.fixedVersion, "fixedVersion");
1042
- assertNoLegacyScalarToken(options.component, "component");
1043
- assertNoLegacyScalarToken(options.regression, "regression");
1044
- assertNoLegacyScalarToken(options.customerImpact, "customerImpact");
1045
1009
  assertNoLegacyNoneTokens(options.reminder, "--reminder", "Use --clear-reminders to clear reminders.");
1046
1010
  assertNoLegacyNoneTokens(options.event, "--event", "Use --clear-events to clear linked events.");
1011
+ }
1012
+ function buildUpdateFieldFlags(options, runtimeFieldUpdates) {
1013
+ const flags = {};
1014
+ for (const key of UPDATE_SIMPLE_FIELD_FLAG_KEYS) {
1015
+ flags[String(key)] = options[key] !== undefined;
1016
+ }
1017
+ flags.tags = options.tags !== undefined;
1018
+ flags.addTags = Array.isArray(options.addTags) && options.addTags.length > 0;
1019
+ flags.removeTags = Array.isArray(options.removeTags) && options.removeTags.length > 0;
1020
+ flags.order = options.order !== undefined;
1021
+ flags.rank = options.rank !== undefined;
1022
+ flags.replaceDeps = options.replaceDeps === true;
1023
+ flags.replaceTests = options.replaceTests === true;
1024
+ flags.unset = options.unset !== undefined && options.unset.length > 0;
1025
+ flags.clearDeps = options.clearDeps === true;
1026
+ flags.clearComments = options.clearComments === true;
1027
+ flags.clearNotes = options.clearNotes === true;
1028
+ flags.clearLearnings = options.clearLearnings === true;
1029
+ flags.clearFiles = options.clearFiles === true;
1030
+ flags.clearTests = options.clearTests === true;
1031
+ flags.clearDocs = options.clearDocs === true;
1032
+ flags.clearReminders = options.clearReminders === true;
1033
+ flags.clearEvents = options.clearEvents === true;
1034
+ flags.clearTypeOptions = options.clearTypeOptions === true;
1035
+ flags.runtimeFields = Object.keys(runtimeFieldUpdates).length > 0;
1036
+ return flags;
1037
+ }
1038
+ async function buildNoopUpdateResult(params) {
1039
+ const located = await locateItem(params.pmRoot, params.id, params.settings.id_prefix, params.settings.item_format, params.typeRegistry.type_to_folder);
1040
+ if (!located) {
1041
+ throw await buildItemNotFoundError(params.pmRoot, params.id, params.settings.id_prefix, params.typeRegistry.type_to_folder);
1042
+ }
1043
+ const { document } = await readLocatedItem(located, { schema: params.settings.schema });
1044
+ return {
1045
+ item: toItemRecord(document.metadata),
1046
+ changed_fields: [],
1047
+ warnings: ["noop_no_update_fields"],
1048
+ };
1049
+ }
1050
+ async function assertUpdateTrackerInitialized(pmRoot) {
1051
+ if (!(await pathExists(getSettingsPath(pmRoot)))) {
1052
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
1053
+ }
1054
+ }
1055
+ function assertMatchingOrderRank(options) {
1056
+ if (options.order !== undefined && options.rank !== undefined && options.order !== options.rank) {
1057
+ throw new PmCliError("--order and --rank must match when both are provided", EXIT_CODE.USAGE);
1058
+ }
1059
+ }
1060
+ async function resolveParentReferenceForUpdate(params) {
1061
+ if (params.options.parent === undefined || params.unsetTargets.frontMatterKeys.has("parent")) {
1062
+ return { resolvedParentValue: undefined, warnings: [] };
1063
+ }
1064
+ const resolvedParentValue = normalizeParentReferenceValue(params.options.parent);
1065
+ const parentLocated = await locateItem(params.pmRoot, resolvedParentValue, params.settings.id_prefix, params.settings.item_format, params.typeRegistry.type_to_folder);
1066
+ if (parentLocated) {
1067
+ return { resolvedParentValue, warnings: [] };
1068
+ }
1069
+ const normalizedParentId = normalizeItemId(resolvedParentValue, params.settings.id_prefix);
1070
+ return {
1071
+ resolvedParentValue,
1072
+ warnings: validateMissingParentReference(normalizedParentId, params.parentReferencePolicy).warnings,
1073
+ };
1074
+ }
1075
+ function blockedByResolutionWarnings(resolution) {
1076
+ return resolution.unresolved === undefined ? [] : [`blocked_by_unresolved:${resolution.unresolved}`];
1077
+ }
1078
+ async function collectWorkflowTransitionWarnings(params) {
1079
+ if (params.workflowEnforcement === "off" || params.typeWorkflows.length === 0 || !params.fieldFlags.status || params.options.status === undefined) {
1080
+ return [];
1081
+ }
1082
+ const located = await locateItem(params.pmRoot, params.id, params.settings.id_prefix, params.settings.item_format, params.typeRegistry.type_to_folder);
1083
+ if (!located) {
1084
+ throw await buildItemNotFoundError(params.pmRoot, params.id, params.settings.id_prefix, params.typeRegistry.type_to_folder);
1085
+ }
1086
+ const { document } = await readLocatedItem(located, { schema: params.settings.schema });
1087
+ const effectiveType = params.options.type !== undefined
1088
+ ? (resolveTypeName(params.options.type, params.typeRegistry) ?? params.options.type)
1089
+ : (document.metadata?.type ?? "");
1090
+ const warning = enforceTypeWorkflowTransition({
1091
+ enforcement: params.workflowEnforcement,
1092
+ typeWorkflows: params.typeWorkflows,
1093
+ statusRegistry: params.statusRegistry,
1094
+ typeName: effectiveType,
1095
+ fromStatus: document.metadata?.status ?? "",
1096
+ toStatus: params.options.status,
1097
+ });
1098
+ return warning ? [warning] : [];
1099
+ }
1100
+ async function routeCloseStatusUpdate(context) {
1101
+ if (!context.fieldFlags.status) {
1102
+ return undefined;
1103
+ }
1104
+ const targetStatus = normalizeStatusInput(context.options.status, context.statusRegistry);
1105
+ if (targetStatus !== context.statusRegistry.close_status) {
1106
+ return undefined;
1107
+ }
1108
+ const otherFieldKeys = Object.entries(context.fieldFlags)
1109
+ .filter(([key, value]) => value && key !== "status" && key !== "closeReason")
1110
+ .map(([key]) => key);
1111
+ const routeWarnings = [];
1112
+ let preChangedFields = [];
1113
+ if (otherFieldKeys.length > 0) {
1114
+ const preUpdate = await runUpdate(context.id, { ...context.options, status: undefined, closeReason: undefined, message: undefined }, context.global);
1115
+ preChangedFields = preUpdate.changed_fields;
1116
+ routeWarnings.push(...preUpdate.warnings);
1117
+ }
1118
+ const explicitReason = typeof context.options.closeReason === "string" ? context.options.closeReason.trim() : "";
1119
+ const fallbackMessage = typeof context.options.message === "string" ? context.options.message.trim() : "";
1120
+ const closeReason = explicitReason || fallbackMessage || "Closed via pm update";
1121
+ const closeResult = await runClose(context.id, closeReason, {
1122
+ author: context.options.author,
1123
+ message: context.options.message,
1124
+ force: context.options.force,
1125
+ }, context.global);
1126
+ const warnings = [
1127
+ ...context.workflowTransitionWarnings,
1128
+ ...routeWarnings,
1129
+ ...closeResult.warnings,
1130
+ "auto_routed_from_update_to_close",
1131
+ ];
1132
+ if (explicitReason.length === 0 && fallbackMessage.length === 0) {
1133
+ warnings.push("close_reason_defaulted");
1134
+ }
1135
+ return {
1136
+ item: closeResult.item,
1137
+ changed_fields: [...preChangedFields, ...closeResult.changed_fields],
1138
+ warnings,
1139
+ };
1140
+ }
1141
+ function applySimpleItemMutations(document, options, statusRegistry, changedFields) {
1142
+ if (options.title !== undefined) {
1143
+ document.metadata.title = options.title;
1144
+ changedFields.push("title");
1145
+ }
1146
+ if (options.description !== undefined) {
1147
+ document.metadata.description = options.description;
1148
+ changedFields.push("description");
1149
+ }
1150
+ if (options.body !== undefined) {
1151
+ document.body = options.body;
1152
+ changedFields.push("body");
1153
+ }
1154
+ return normalizeStatusInput(document.metadata.status, statusRegistry) ?? document.metadata.status;
1155
+ }
1156
+ function applyStatusAndCloseReasonMutations(document, context, previousStatusNormalized, changedFields) {
1157
+ if (context.options.status !== undefined) {
1158
+ const status = parseStatus(context.options.status, context.statusRegistry);
1159
+ document.metadata.status = status;
1160
+ changedFields.push("status");
1161
+ }
1162
+ if (context.options.closeReason !== undefined || context.clearFrontMatterKeys.has("close_reason")) {
1163
+ if (context.clearFrontMatterKeys.has("close_reason")) {
1164
+ delete document.metadata.close_reason;
1165
+ }
1166
+ else {
1167
+ const closeReason = context.options.closeReason?.trim() ?? "";
1168
+ if (closeReason.length === 0) {
1169
+ throw new PmCliError("--close-reason must not be empty", EXIT_CODE.USAGE);
1170
+ }
1171
+ document.metadata.close_reason = closeReason;
1172
+ }
1173
+ changedFields.push("close_reason");
1174
+ return;
1175
+ }
1176
+ if (context.options.status !== undefined &&
1177
+ previousStatusNormalized === context.statusRegistry.close_status &&
1178
+ document.metadata.status !== context.statusRegistry.canceled_status &&
1179
+ document.metadata.close_reason !== undefined) {
1180
+ delete document.metadata.close_reason;
1181
+ changedFields.push("close_reason");
1182
+ }
1183
+ }
1184
+ function applyPriorityTypeAndOptions(document, context, changedFields) {
1185
+ let activeTypeName = resolveTypeName(document.metadata.type, context.typeRegistry) ?? document.metadata.type;
1186
+ if (context.options.priority !== undefined) {
1187
+ document.metadata.priority = ensurePriority(context.options.priority);
1188
+ changedFields.push("priority");
1189
+ }
1190
+ if (context.options.type !== undefined) {
1191
+ const resolvedTypeName = resolveTypeName(context.options.type, context.typeRegistry);
1192
+ if (!resolvedTypeName) {
1193
+ throw new PmCliError(buildInvalidTypeError(context.options.type, context.typeRegistry.types, resolveItemTypesFilePath(context.pmRoot, context.settings.schema)), EXIT_CODE.USAGE);
1194
+ }
1195
+ document.metadata.type = resolvedTypeName;
1196
+ activeTypeName = resolvedTypeName;
1197
+ changedFields.push("type");
1198
+ }
1199
+ enforceUpdateOptionsByType(activeTypeName, context.options, context.typeRegistry, context.runtimeFieldRegistry, context.extensionFieldNames);
1200
+ applyTypeOptionMutation(document, context, activeTypeName, changedFields);
1201
+ return activeTypeName;
1202
+ }
1203
+ function applyTypeOptionMutation(document, context, activeTypeName, changedFields) {
1204
+ if (context.options.typeOption !== undefined || context.clearFrontMatterKeys.has("type_options")) {
1205
+ if (context.clearFrontMatterKeys.has("type_options")) {
1206
+ delete document.metadata.type_options;
1207
+ }
1208
+ else {
1209
+ const parsedTypeOptions = parseTypeOptionEntries(context.options.typeOption ?? []);
1210
+ const validation = validateTypeOptions(activeTypeName, parsedTypeOptions, context.typeRegistry);
1211
+ if (validation.errors.length > 0) {
1212
+ throw new PmCliError(validation.errors.join("; "), EXIT_CODE.USAGE);
1213
+ }
1214
+ document.metadata.type_options = validation.normalized;
1215
+ }
1216
+ changedFields.push("type_options");
1217
+ return;
1218
+ }
1219
+ if (context.options.type === undefined || document.metadata.type_options === undefined) {
1220
+ return;
1221
+ }
1222
+ const validation = validateTypeOptions(activeTypeName, document.metadata.type_options, context.typeRegistry);
1223
+ if (validation.errors.length > 0) {
1224
+ throw new PmCliError(`Current type options are incompatible with type "${activeTypeName}". ${validation.errors.join("; ")}. Use --clear-type-options to clear them.`, EXIT_CODE.USAGE);
1225
+ }
1226
+ document.metadata.type_options = validation.normalized;
1227
+ }
1228
+ function applyDependencyMutations(document, context, changedFields) {
1229
+ if (context.options.dep === undefined &&
1230
+ context.options.depRemove === undefined &&
1231
+ !context.clearFrontMatterKeys.has("dependencies")) {
1232
+ return;
1233
+ }
1234
+ let nextDependencies = context.clearFrontMatterKeys.has("dependencies") ? [] : [...(document.metadata.dependencies ?? [])];
1235
+ if (context.dependencyUpdates.additions.length > 0) {
1236
+ const seen = new Set(nextDependencies.map((entry) => dependencyKey(entry)));
1237
+ for (const addition of context.dependencyUpdates.additions) {
1238
+ const key = dependencyKey(addition);
1239
+ if (!seen.has(key)) {
1240
+ nextDependencies.push(addition);
1241
+ seen.add(key);
1242
+ }
1243
+ }
1244
+ }
1245
+ if (context.dependencyRemovals.length > 0) {
1246
+ nextDependencies = nextDependencies.filter((entry) => !context.dependencyRemovals.some((selector) => matchesDependencySelector(entry, selector)));
1247
+ }
1248
+ if (nextDependencies.length === 0) {
1249
+ delete document.metadata.dependencies;
1250
+ }
1251
+ else {
1252
+ document.metadata.dependencies = nextDependencies;
1253
+ }
1254
+ changedFields.push("dependencies");
1255
+ }
1256
+ function applyLogCollectionMutations(document, context, changedFields) {
1257
+ applyLogCollectionMutation(document, "comments", context.options.comment, context.commentUpdates.values, context.clearFrontMatterKeys, changedFields);
1258
+ applyLogCollectionMutation(document, "notes", context.options.note, context.noteUpdates.values, context.clearFrontMatterKeys, changedFields);
1259
+ applyLogCollectionMutation(document, "learnings", context.options.learning, context.learningUpdates.values, context.clearFrontMatterKeys, changedFields);
1260
+ }
1261
+ function applyLogCollectionMutation(document, key, optionValue, values, clearFrontMatterKeys, changedFields) {
1262
+ if (optionValue === undefined && !clearFrontMatterKeys.has(key)) {
1263
+ return;
1264
+ }
1265
+ if (clearFrontMatterKeys.has(key) || !values || values.length === 0) {
1266
+ delete document.metadata[key];
1267
+ }
1268
+ else {
1269
+ document.metadata[key] = [...(document.metadata[key] ?? []), ...values];
1270
+ }
1271
+ changedFields.push(key);
1272
+ }
1273
+ function applyEvidenceCollectionMutations(document, context, changedFields) {
1274
+ applyUniqueLinkedCollectionMutation(document, "files", context.options.file, context.fileUpdates.values, fileKey, context.clearFrontMatterKeys, changedFields);
1275
+ applyTestCollectionMutation(document, context, changedFields);
1276
+ applyUniqueLinkedCollectionMutation(document, "docs", context.options.doc, context.docUpdates.values, docKey, context.clearFrontMatterKeys, changedFields);
1277
+ }
1278
+ function applyUniqueLinkedCollectionMutation(document, key, optionValue, values, keyOf, clearFrontMatterKeys, changedFields) {
1279
+ if (optionValue === undefined && !clearFrontMatterKeys.has(key)) {
1280
+ return;
1281
+ }
1282
+ if (clearFrontMatterKeys.has(key) || !values || values.length === 0) {
1283
+ delete document.metadata[key];
1284
+ }
1285
+ else {
1286
+ const next = [...(document.metadata[key] ?? [])];
1287
+ const seen = new Set(next.map((entry) => keyOf(entry)));
1288
+ for (const entry of values) {
1289
+ const keyValue = keyOf(entry);
1290
+ if (!seen.has(keyValue)) {
1291
+ next.push(entry);
1292
+ seen.add(keyValue);
1293
+ }
1294
+ }
1295
+ document.metadata[key] = next;
1296
+ }
1297
+ changedFields.push(key);
1298
+ }
1299
+ function applyTestCollectionMutation(document, context, changedFields) {
1300
+ if (context.options.test === undefined && !context.clearFrontMatterKeys.has("tests")) {
1301
+ return;
1302
+ }
1303
+ if (context.clearFrontMatterKeys.has("tests") && context.options.replaceTests === true) {
1304
+ document.metadata.tests = dedupeLinkedTests(context.testUpdates.values) ?? [];
1305
+ }
1306
+ else if (context.clearFrontMatterKeys.has("tests") || !context.testUpdates.values || context.testUpdates.values.length === 0) {
1307
+ delete document.metadata.tests;
1308
+ }
1309
+ else {
1310
+ document.metadata.tests = dedupeLinkedTests([...(document.metadata.tests ?? []), ...context.testUpdates.values]);
1311
+ }
1312
+ if (document.metadata.tests !== undefined && document.metadata.tests.length === 0) {
1313
+ delete document.metadata.tests;
1314
+ }
1315
+ changedFields.push("tests");
1316
+ }
1317
+ function dedupeLinkedTests(values) {
1318
+ if (!values || values.length === 0) {
1319
+ return undefined;
1320
+ }
1321
+ const next = [];
1322
+ const seen = new Set();
1323
+ for (const entry of values) {
1324
+ const key = testKey(entry);
1325
+ if (!seen.has(key)) {
1326
+ next.push(entry);
1327
+ seen.add(key);
1328
+ }
1329
+ }
1330
+ return next;
1331
+ }
1332
+ function applyTagsAndPlanningMutations(document, context, scalarMutationContext) {
1333
+ const addTagsValues = context.options.addTags;
1334
+ const removeTagsValues = context.options.removeTags;
1335
+ const hasAdditiveTagMutation = (Array.isArray(addTagsValues) && addTagsValues.length > 0) ||
1336
+ (Array.isArray(removeTagsValues) && removeTagsValues.length > 0);
1337
+ if (context.options.tags !== undefined || context.clearFrontMatterKeys.has("tags") || hasAdditiveTagMutation) {
1338
+ const baseTags = context.clearFrontMatterKeys.has("tags")
1339
+ ? []
1340
+ : context.options.tags !== undefined
1341
+ ? parseTags(context.options.tags)
1342
+ : Array.isArray(document.metadata.tags)
1343
+ ? [...document.metadata.tags]
1344
+ : [];
1345
+ document.metadata.tags = applyTagRemovals(mergeAdditiveTags(baseTags, addTagsValues), removeTagsValues);
1346
+ scalarMutationContext.changedFields.push("tags");
1347
+ }
1348
+ applyUpdateScalarMutations(UPDATE_POST_TAG_SCALAR_MUTATIONS, context.options, scalarMutationContext);
1349
+ applyOrderMutation(document, context, scalarMutationContext.changedFields);
1350
+ }
1351
+ function applyOrderMutation(document, context, changedFields) {
1352
+ const orderRaw = context.options.order ?? context.options.rank;
1353
+ if (orderRaw === undefined && !context.clearFrontMatterKeys.has("order")) {
1354
+ return;
1355
+ }
1356
+ if (context.clearFrontMatterKeys.has("order")) {
1357
+ delete document.metadata.order;
1358
+ }
1359
+ else {
1360
+ const parsedOrder = parseOptionalNumber(orderRaw ?? "", "order");
1361
+ if (!Number.isInteger(parsedOrder)) {
1362
+ throw new PmCliError("Order must be an integer", EXIT_CODE.USAGE);
1363
+ }
1364
+ document.metadata.order = parsedOrder;
1365
+ }
1366
+ changedFields.push("order");
1367
+ }
1368
+ function applyOwnershipAndIssueMutations(document, context, scalarMutationContext, warnings) {
1369
+ applyAssigneeMutation(document, context, scalarMutationContext.changedFields);
1370
+ applyParentMutation(document, context, scalarMutationContext.changedFields);
1371
+ applyUpdateScalarMutations(UPDATE_STAKEHOLDER_SCALAR_MUTATIONS, context.options, scalarMutationContext);
1372
+ applySprintReleaseMutation(document, context, "sprint", warnings, scalarMutationContext.changedFields);
1373
+ applySprintReleaseMutation(document, context, "release", warnings, scalarMutationContext.changedFields);
1374
+ applyBlockedByMutation(document, context, scalarMutationContext.changedFields);
1375
+ applyUpdateScalarMutations(UPDATE_ISSUE_SCALAR_MUTATIONS, context.options, scalarMutationContext);
1376
+ }
1377
+ function applyAssigneeMutation(document, context, changedFields) {
1378
+ if (context.options.assignee === undefined && !context.clearFrontMatterKeys.has("assignee")) {
1379
+ return;
1380
+ }
1381
+ if (context.clearFrontMatterKeys.has("assignee")) {
1382
+ delete document.metadata.assignee;
1383
+ }
1384
+ else {
1385
+ const assignee = context.options.assignee?.trim() ?? "";
1386
+ if (assignee === "") {
1387
+ throw new PmCliError("--assignee must not be empty. Use --unset assignee to clear it.", EXIT_CODE.USAGE);
1388
+ }
1389
+ document.metadata.assignee = assignee;
1390
+ }
1391
+ changedFields.push("assignee");
1392
+ }
1393
+ function applyParentMutation(document, context, changedFields) {
1394
+ if (context.options.parent === undefined && !context.clearFrontMatterKeys.has("parent")) {
1395
+ return;
1396
+ }
1397
+ if (context.clearFrontMatterKeys.has("parent")) {
1398
+ delete document.metadata.parent;
1399
+ }
1400
+ else {
1401
+ document.metadata.parent = context.resolvedParentValue ?? "";
1402
+ }
1403
+ changedFields.push("parent");
1404
+ }
1405
+ function applySprintReleaseMutation(document, context, key, warnings, changedFields) {
1406
+ if (context.options[key] === undefined && !context.clearFrontMatterKeys.has(key)) {
1407
+ return;
1408
+ }
1409
+ if (context.clearFrontMatterKeys.has(key)) {
1410
+ delete document.metadata[key];
1411
+ }
1412
+ else {
1413
+ const validation = validateSprintOrReleaseValue(key, context.options[key] ?? "", context.settings.validation.sprint_release_format);
1414
+ document.metadata[key] = validation.value;
1415
+ warnings.push(...validation.warnings);
1416
+ }
1417
+ changedFields.push(key);
1418
+ }
1419
+ function applyBlockedByMutation(document, context, changedFields) {
1420
+ if (context.options.blockedBy === undefined && !context.clearFrontMatterKeys.has("blocked_by")) {
1421
+ return;
1422
+ }
1423
+ if (context.clearFrontMatterKeys.has("blocked_by")) {
1424
+ delete document.metadata.blocked_by;
1425
+ }
1426
+ else {
1427
+ document.metadata.blocked_by = context.options.blockedBy?.trim() ?? "";
1428
+ }
1429
+ changedFields.push("blocked_by");
1430
+ applyBlockedByDependencyEdge(document.metadata, context.resolvedBlockedByDependencyId, context.nowIso, context.author, changedFields);
1431
+ }
1432
+ function applyScheduleMutations(document, context, changedFields) {
1433
+ if (context.options.reminder !== undefined || context.clearFrontMatterKeys.has("reminders")) {
1434
+ if (context.clearFrontMatterKeys.has("reminders")) {
1435
+ delete document.metadata.reminders;
1436
+ }
1437
+ else {
1438
+ document.metadata.reminders = parseReminderEntries(context.options.reminder ?? [], context.nowValue, { valueMode: "trimmed" });
1439
+ }
1440
+ changedFields.push("reminders");
1441
+ }
1442
+ if (context.options.event !== undefined || context.clearFrontMatterKeys.has("events")) {
1443
+ if (context.clearFrontMatterKeys.has("events")) {
1444
+ delete document.metadata.events;
1445
+ }
1446
+ else {
1447
+ document.metadata.events = parseEventEntries(context.options.event ?? [], context.nowValue, {
1448
+ allDayEmptyGuard: "truthy",
1449
+ recurrenceEmptyNumericGuard: "truthy",
1450
+ });
1451
+ }
1452
+ changedFields.push("events");
1453
+ }
1454
+ }
1455
+ function applyRuntimeAndRegisteredFieldMutations(metadataRecord, context, changedFields) {
1456
+ clearDynamicFields(metadataRecord, context.runtimeFieldRegistry.definitions.map((definition) => definition.metadata_key), context.clearFrontMatterKeys, changedFields);
1457
+ clearDynamicFields(metadataRecord, context.extensionFieldNames, context.clearFrontMatterKeys, changedFields);
1458
+ for (const [fieldKey, fieldValue] of Object.entries(context.runtimeFieldUpdates)) {
1459
+ if (context.clearFrontMatterKeys.has(fieldKey)) {
1460
+ const fieldFlag = fieldKey.replaceAll("_", "-");
1461
+ const definition = context.runtimeFieldRegistry.definitions.find((candidate) => candidate.metadata_key === fieldKey);
1462
+ const updateFlag = definition?.cli_flag ?? fieldFlag;
1463
+ throw new PmCliError(`Cannot combine --unset ${fieldFlag} with --${updateFlag}`, EXIT_CODE.USAGE);
1464
+ }
1465
+ if (stableValueEquals(metadataRecord[fieldKey], fieldValue)) {
1466
+ continue;
1467
+ }
1468
+ metadataRecord[fieldKey] = fieldValue;
1469
+ changedFields.push(fieldKey);
1470
+ }
1471
+ const registeredItemFieldUpdates = parseRegisteredItemFieldAssignments(context.options.field, context.extensionRegistrations);
1472
+ for (const fieldKey of Object.keys(registeredItemFieldUpdates)) {
1473
+ if (context.clearFrontMatterKeys.has(fieldKey)) {
1474
+ throw new PmCliError(`Cannot combine --unset ${fieldKey.replaceAll("_", "-")} with --field ${fieldKey}=...`, EXIT_CODE.USAGE);
1475
+ }
1476
+ }
1477
+ for (const [fieldKey, fieldValue] of Object.entries(registeredItemFieldUpdates)) {
1478
+ if (!stableValueEquals(metadataRecord[fieldKey], fieldValue)) {
1479
+ metadataRecord[fieldKey] = fieldValue;
1480
+ changedFields.push(fieldKey);
1481
+ }
1482
+ }
1483
+ }
1484
+ function clearDynamicFields(metadataRecord, fieldKeys, clearFrontMatterKeys, changedFields) {
1485
+ for (const fieldKey of fieldKeys) {
1486
+ if (!clearFrontMatterKeys.has(fieldKey) || metadataRecord[fieldKey] === undefined) {
1487
+ continue;
1488
+ }
1489
+ delete metadataRecord[fieldKey];
1490
+ changedFields.push(fieldKey);
1491
+ }
1492
+ }
1493
+ function mutateUpdateDocument(document, context) {
1494
+ const changedFields = [];
1495
+ const warnings = [];
1496
+ const previousStatusNormalized = applySimpleItemMutations(document, context.options, context.statusRegistry, changedFields);
1497
+ const metadataRecord = toItemRecord(document.metadata);
1498
+ const scalarMutationContext = {
1499
+ metadataRecord,
1500
+ clearFrontMatterKeys: context.clearFrontMatterKeys,
1501
+ changedFields,
1502
+ nowValue: context.nowValue,
1503
+ };
1504
+ applyStatusAndCloseReasonMutations(document, context, previousStatusNormalized, changedFields);
1505
+ applyPriorityTypeAndOptions(document, context, changedFields);
1506
+ applyDependencyMutations(document, context, changedFields);
1507
+ applyLogCollectionMutations(document, context, changedFields);
1508
+ applyEvidenceCollectionMutations(document, context, changedFields);
1509
+ applyTagsAndPlanningMutations(document, context, scalarMutationContext);
1510
+ applyOwnershipAndIssueMutations(document, context, scalarMutationContext, warnings);
1511
+ if (normalizeStatusInput(document.metadata.status, context.statusRegistry) === context.statusRegistry.canceled_status &&
1512
+ document.metadata.assignee !== undefined) {
1513
+ delete document.metadata.assignee;
1514
+ if (!changedFields.includes("assignee")) {
1515
+ changedFields.push("assignee");
1516
+ }
1517
+ }
1518
+ applyScheduleMutations(document, context, changedFields);
1519
+ applyRuntimeAndRegisteredFieldMutations(metadataRecord, context, changedFields);
1520
+ try {
1521
+ applyRegisteredItemFieldDefaultsAndValidation(metadataRecord, context.extensionRegistrations, { skipDefaultFields: context.clearFrontMatterKeys });
1522
+ }
1523
+ catch (error) {
1524
+ throw new PmCliError(error instanceof Error ? error.message : "Invalid extension item field values", EXIT_CODE.USAGE);
1525
+ }
1526
+ return { changedFields, warnings };
1527
+ }
1528
+ /**
1529
+ * Implements run update for the public runtime surface of this module.
1530
+ */
1531
+ export async function runUpdate(id, options, global) {
1532
+ options = await resolveStdinUpdateOptions(options);
1533
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
1534
+ await assertUpdateTrackerInitialized(pmRoot);
1535
+ const settings = await readSettings(pmRoot);
1536
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
1537
+ const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
1538
+ const extensionRegistrations = getActiveExtensionRegistrations();
1539
+ const extensionFieldNames = collectRegisteredItemFieldNames(extensionRegistrations);
1540
+ const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);
1541
+ // Per-type allowed-transition enforcement is read RAW (not preset-derived) so
1542
+ // existing projects are unaffected when unset; defaults to "off".
1543
+ const workflowEnforcement = settings.governance.workflow_enforcement ?? "off";
1544
+ const typeWorkflows = workflowEnforcement === "off" ? [] : resolveTypeWorkflows(settings.schema);
1545
+ const parentReferencePolicy = settings.validation.parent_reference;
1546
+ const unsetTargets = parseUpdateUnsetTargets(options.unset, runtimeFieldRegistry, extensionFieldNames);
1547
+ const clearOptionKeys = new Set(unsetTargets.optionKeys);
1548
+ const clearFrontMatterKeys = new Set(unsetTargets.frontMatterKeys);
1549
+ validateReplaceOptions(options);
1550
+ applyClearCollectionDefinitions({
1551
+ definitions: buildClearCollectionDefinitions(options),
1552
+ options,
1553
+ clearOptionKeys,
1554
+ clearFrontMatterKeys,
1555
+ });
1556
+ enforceAllowAuditUpdateScope(id, options, clearFrontMatterKeys);
1557
+ rejectUnsetScalarConflicts(options, unsetTargets);
1558
+ rejectLegacyScalarTokens(options);
1047
1559
  const author = toAuthor(options.author, settings.author_default);
1048
1560
  const nowValue = new Date();
1049
1561
  const nowIso = nowValue.toISOString();
@@ -1061,188 +1573,49 @@ export async function runUpdate(id, options, global) {
1061
1573
  const fileUpdates = parseFiles(options.file);
1062
1574
  const testUpdates = parseTests(options.test);
1063
1575
  const docUpdates = parseDocs(options.doc);
1064
- const parentReferenceWarnings = [];
1065
1576
  const workflowTransitionWarnings = [];
1066
- let resolvedParentValue;
1067
- if (options.parent !== undefined && !unsetTargets.frontMatterKeys.has("parent")) {
1068
- resolvedParentValue = normalizeParentReferenceValue(options.parent);
1069
- const parentLocated = await locateItem(pmRoot, resolvedParentValue, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1070
- if (!parentLocated) {
1071
- const normalizedParentId = normalizeItemId(resolvedParentValue, settings.id_prefix);
1072
- parentReferenceWarnings.push(...validateMissingParentReference(normalizedParentId, parentReferencePolicy).warnings);
1073
- }
1074
- }
1577
+ const parentReference = await resolveParentReferenceForUpdate({
1578
+ options,
1579
+ unsetTargets,
1580
+ pmRoot,
1581
+ settings,
1582
+ typeRegistry,
1583
+ parentReferencePolicy,
1584
+ });
1075
1585
  // pm-kyd6: resolve the --blocked-by target up front (async) so the sync
1076
1586
  // mutate callback can mirror create.ts and add a `blocked_by` dependency edge.
1077
1587
  const blockedByResolution = await resolveBlockedByDependencyTarget(options.blockedBy, clearFrontMatterKeys.has("blocked_by"), pmRoot, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1078
1588
  const resolvedBlockedByDependencyId = blockedByResolution.id;
1079
- if (blockedByResolution.unresolved !== undefined) {
1080
- parentReferenceWarnings.push(`blocked_by_unresolved:${blockedByResolution.unresolved}`);
1081
- }
1589
+ const parentReferenceWarnings = [...parentReference.warnings, ...blockedByResolutionWarnings(blockedByResolution)];
1082
1590
  const runtimeFieldUpdates = collectRuntimeUpdateFieldValues(options, runtimeFieldRegistry, options.runtimeFieldCommands);
1083
- const fieldFlags = {
1084
- title: options.title !== undefined,
1085
- description: options.description !== undefined,
1086
- body: options.body !== undefined,
1087
- status: options.status !== undefined,
1088
- closeReason: options.closeReason !== undefined,
1089
- priority: options.priority !== undefined,
1090
- type: options.type !== undefined,
1091
- tags: options.tags !== undefined,
1092
- addTags: Array.isArray(options.addTags) && options.addTags.length > 0,
1093
- removeTags: Array.isArray(options.removeTags) && options.removeTags.length > 0,
1094
- deadline: options.deadline !== undefined,
1095
- estimatedMinutes: options.estimatedMinutes !== undefined,
1096
- acceptanceCriteria: options.acceptanceCriteria !== undefined,
1097
- definitionOfReady: options.definitionOfReady !== undefined,
1098
- order: options.order !== undefined,
1099
- rank: options.rank !== undefined,
1100
- goal: options.goal !== undefined,
1101
- objective: options.objective !== undefined,
1102
- value: options.value !== undefined,
1103
- impact: options.impact !== undefined,
1104
- outcome: options.outcome !== undefined,
1105
- whyNow: options.whyNow !== undefined,
1106
- assignee: options.assignee !== undefined,
1107
- parent: options.parent !== undefined,
1108
- reviewer: options.reviewer !== undefined,
1109
- risk: options.risk !== undefined,
1110
- confidence: options.confidence !== undefined,
1111
- sprint: options.sprint !== undefined,
1112
- release: options.release !== undefined,
1113
- blockedBy: options.blockedBy !== undefined,
1114
- blockedReason: options.blockedReason !== undefined,
1115
- unblockNote: options.unblockNote !== undefined,
1116
- reporter: options.reporter !== undefined,
1117
- severity: options.severity !== undefined,
1118
- environment: options.environment !== undefined,
1119
- reproSteps: options.reproSteps !== undefined,
1120
- resolution: options.resolution !== undefined,
1121
- expectedResult: options.expectedResult !== undefined,
1122
- actualResult: options.actualResult !== undefined,
1123
- affectedVersion: options.affectedVersion !== undefined,
1124
- fixedVersion: options.fixedVersion !== undefined,
1125
- component: options.component !== undefined,
1126
- regression: options.regression !== undefined,
1127
- customerImpact: options.customerImpact !== undefined,
1128
- dep: options.dep !== undefined,
1129
- depRemove: options.depRemove !== undefined,
1130
- replaceDeps: options.replaceDeps === true,
1131
- comment: options.comment !== undefined,
1132
- note: options.note !== undefined,
1133
- learning: options.learning !== undefined,
1134
- file: options.file !== undefined,
1135
- test: options.test !== undefined,
1136
- replaceTests: options.replaceTests === true,
1137
- doc: options.doc !== undefined,
1138
- reminder: options.reminder !== undefined,
1139
- event: options.event !== undefined,
1140
- typeOption: options.typeOption !== undefined,
1141
- field: options.field !== undefined,
1142
- unset: options.unset !== undefined && options.unset.length > 0,
1143
- clearDeps: options.clearDeps === true,
1144
- clearComments: options.clearComments === true,
1145
- clearNotes: options.clearNotes === true,
1146
- clearLearnings: options.clearLearnings === true,
1147
- clearFiles: options.clearFiles === true,
1148
- clearTests: options.clearTests === true,
1149
- clearDocs: options.clearDocs === true,
1150
- clearReminders: options.clearReminders === true,
1151
- clearEvents: options.clearEvents === true,
1152
- clearTypeOptions: options.clearTypeOptions === true,
1153
- runtimeFields: Object.keys(runtimeFieldUpdates).length > 0,
1154
- };
1591
+ const fieldFlags = buildUpdateFieldFlags(options, runtimeFieldUpdates);
1155
1592
  const changedFlags = Object.values(fieldFlags).some(Boolean);
1156
1593
  if (!changedFlags) {
1157
- const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1158
- if (!located) {
1159
- throw await buildItemNotFoundError(pmRoot, id, settings.id_prefix, typeRegistry.type_to_folder);
1160
- }
1161
- const { document } = await readLocatedItem(located, { schema: settings.schema });
1162
- return {
1163
- item: toItemRecord(document.metadata),
1164
- changed_fields: [],
1165
- warnings: ["noop_no_update_fields"],
1166
- };
1167
- }
1168
- // Per-type allowed-transition enforcement runs BEFORE the close-reroute so a
1169
- // transition toward the close status is gated too. We read the item's current
1170
- // status + type once (only when enforcement is active and --status is set) so
1171
- // the default `off` path adds zero extra work. A `strict` violation throws; a
1172
- // `warn` violation surfaces a warning on the result.
1173
- if (workflowEnforcement !== "off" && typeWorkflows.length > 0 && fieldFlags.status && options.status !== undefined) {
1174
- const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
1175
- if (!located) {
1176
- throw await buildItemNotFoundError(pmRoot, id, settings.id_prefix, typeRegistry.type_to_folder);
1177
- }
1178
- const { document } = await readLocatedItem(located, { schema: settings.schema });
1179
- // When this update also changes --type, gate the transition against the
1180
- // EFFECTIVE (post-update) type, so a combined --type/--status change can't
1181
- // bypass a target-type rule (or be wrongly blocked by the pre-update type's
1182
- // rule that will no longer apply). Falls back to the raw value when --type is
1183
- // unresolved; the later type resolution surfaces an invalid-type error.
1184
- const effectiveType = options.type !== undefined
1185
- ? (resolveTypeName(options.type, typeRegistry) ?? options.type)
1186
- : (document.metadata?.type ?? "");
1187
- const warning = enforceTypeWorkflowTransition({
1188
- enforcement: workflowEnforcement,
1189
- typeWorkflows,
1190
- statusRegistry,
1191
- typeName: effectiveType,
1192
- fromStatus: document.metadata?.status ?? "",
1193
- toStatus: options.status ?? "",
1194
- });
1195
- if (warning) {
1196
- workflowTransitionWarnings.push(warning);
1197
- }
1198
- }
1199
- // `pm update --status <close_status>` always routes to the auditable close
1200
- // workflow so agents are never blocked by close-through-update errors. Any
1201
- // other field updates in the same call are applied first, then the item is
1202
- // closed with the supplied --close-reason (or a derived default when omitted).
1203
- if (fieldFlags.status) {
1204
- const targetStatus = normalizeStatusInput(options.status, statusRegistry);
1205
- if (targetStatus === statusRegistry.close_status) {
1206
- const otherFieldKeys = Object.entries(fieldFlags)
1207
- .filter(([key, value]) => value && key !== "status" && key !== "closeReason")
1208
- .map(([key]) => key);
1209
- const routeWarnings = [];
1210
- let preChangedFields = [];
1211
- if (otherFieldKeys.length > 0) {
1212
- const preUpdate = await runUpdate(id, { ...options, status: undefined, closeReason: undefined, message: undefined }, global);
1213
- preChangedFields = preUpdate.changed_fields;
1214
- routeWarnings.push(...preUpdate.warnings);
1215
- }
1216
- const explicitReason = typeof options.closeReason === "string" ? options.closeReason.trim() : "";
1217
- const fallbackMessage = typeof options.message === "string" ? options.message.trim() : "";
1218
- const closeReason = explicitReason || fallbackMessage || "Closed via pm update";
1219
- // Only flag a defaulted reason when neither --close-reason nor --message
1220
- // supplied any text and we had to invent the generic placeholder.
1221
- const reasonDefaulted = explicitReason.length === 0 && fallbackMessage.length === 0;
1222
- const closeResult = await runClose(id, closeReason, {
1223
- author: options.author,
1224
- message: options.message,
1225
- force: options.force,
1226
- }, global);
1227
- const warnings = [
1228
- ...workflowTransitionWarnings,
1229
- ...routeWarnings,
1230
- ...closeResult.warnings,
1231
- "auto_routed_from_update_to_close",
1232
- ];
1233
- if (reasonDefaulted) {
1234
- warnings.push("close_reason_defaulted");
1235
- }
1236
- return {
1237
- item: closeResult.item,
1238
- changed_fields: [...preChangedFields, ...closeResult.changed_fields],
1239
- warnings,
1240
- };
1241
- }
1242
- }
1243
- if (options.order !== undefined && options.rank !== undefined && options.order !== options.rank) {
1244
- throw new PmCliError("--order and --rank must match when both are provided", EXIT_CODE.USAGE);
1594
+ return buildNoopUpdateResult({ pmRoot, id, settings, typeRegistry });
1595
+ }
1596
+ workflowTransitionWarnings.push(...await collectWorkflowTransitionWarnings({
1597
+ options,
1598
+ fieldFlags,
1599
+ workflowEnforcement,
1600
+ typeWorkflows,
1601
+ statusRegistry,
1602
+ typeRegistry,
1603
+ pmRoot,
1604
+ id,
1605
+ settings,
1606
+ }));
1607
+ const routedClose = await routeCloseStatusUpdate({
1608
+ options,
1609
+ fieldFlags,
1610
+ statusRegistry,
1611
+ workflowTransitionWarnings,
1612
+ global,
1613
+ id,
1614
+ });
1615
+ if (routedClose) {
1616
+ return routedClose;
1245
1617
  }
1618
+ assertMatchingOrderRank(options);
1246
1619
  const result = await mutateItem({
1247
1620
  pmRoot,
1248
1621
  settings,
@@ -1255,387 +1628,31 @@ export async function runUpdate(id, options, global) {
1255
1628
  bypassAssigneeConflict: options.allowAuditUpdate === true || options.allowAuditDepUpdate === true,
1256
1629
  extensionFieldNames,
1257
1630
  mutate(document) {
1258
- const changedFields = [];
1259
- const warnings = [];
1260
- let activeTypeName = resolveTypeName(document.metadata.type, typeRegistry) ?? document.metadata.type;
1261
- // Declarative set-or-clear helpers for the many string scalar fields that
1262
- // share an identical shape: set from `--flag` (optionally transformed) or
1263
- // delete when `--unset <field>` was requested, then record the change.
1264
- // Each call is placed in the same position the inline block occupied so
1265
- // the order of `changedFields` is preserved exactly (pm-why9).
1266
- const metadataRecord = toItemRecord(document.metadata);
1267
- const scalarMutationContext = {
1268
- metadataRecord,
1631
+ return mutateUpdateDocument(document, {
1632
+ options,
1633
+ settings,
1634
+ typeRegistry,
1635
+ statusRegistry,
1636
+ runtimeFieldRegistry,
1637
+ extensionRegistrations,
1638
+ extensionFieldNames,
1269
1639
  clearFrontMatterKeys,
1270
- changedFields,
1640
+ dependencyUpdates,
1641
+ dependencyRemovals,
1642
+ commentUpdates,
1643
+ noteUpdates,
1644
+ learningUpdates,
1645
+ fileUpdates,
1646
+ testUpdates,
1647
+ docUpdates,
1648
+ resolvedParentValue: parentReference.resolvedParentValue,
1649
+ resolvedBlockedByDependencyId,
1650
+ runtimeFieldUpdates,
1271
1651
  nowValue,
1272
- };
1273
- if (options.title !== undefined) {
1274
- document.metadata.title = options.title;
1275
- changedFields.push("title");
1276
- }
1277
- if (options.description !== undefined) {
1278
- document.metadata.description = options.description;
1279
- changedFields.push("description");
1280
- }
1281
- if (options.body !== undefined) {
1282
- document.body = options.body;
1283
- changedFields.push("body");
1284
- }
1285
- const previousStatus = document.metadata.status;
1286
- const previousStatusNormalized = normalizeStatusInput(previousStatus, statusRegistry) ?? previousStatus;
1287
- if (options.status !== undefined) {
1288
- // Close-status routing (with reason + audit) is handled before mutateItem
1289
- // by the close gate above, so only non-close transitions reach this path.
1290
- const status = parseStatus(options.status, statusRegistry);
1291
- document.metadata.status = status;
1292
- if (status === statusRegistry.canceled_status) {
1293
- delete document.metadata.assignee;
1294
- }
1295
- changedFields.push("status");
1296
- }
1297
- if (options.closeReason !== undefined || clearFrontMatterKeys.has("close_reason")) {
1298
- if (clearFrontMatterKeys.has("close_reason")) {
1299
- delete document.metadata.close_reason;
1300
- }
1301
- else {
1302
- const closeReason = options.closeReason?.trim() ?? "";
1303
- if (closeReason.length === 0) {
1304
- throw new PmCliError("--close-reason must not be empty", EXIT_CODE.USAGE);
1305
- }
1306
- document.metadata.close_reason = closeReason;
1307
- }
1308
- changedFields.push("close_reason");
1309
- }
1310
- else if (options.status !== undefined &&
1311
- previousStatusNormalized === statusRegistry.close_status &&
1312
- document.metadata.status !== statusRegistry.canceled_status &&
1313
- document.metadata.close_reason !== undefined) {
1314
- delete document.metadata.close_reason;
1315
- changedFields.push("close_reason");
1316
- }
1317
- if (options.priority !== undefined) {
1318
- document.metadata.priority = ensurePriority(options.priority);
1319
- changedFields.push("priority");
1320
- }
1321
- if (options.type !== undefined) {
1322
- const resolvedTypeName = resolveTypeName(options.type, typeRegistry);
1323
- if (!resolvedTypeName) {
1324
- throw new PmCliError(buildInvalidTypeError(options.type, typeRegistry.types, resolveItemTypesFilePath(pmRoot, settings.schema)), EXIT_CODE.USAGE);
1325
- }
1326
- document.metadata.type = resolvedTypeName;
1327
- activeTypeName = resolvedTypeName;
1328
- changedFields.push("type");
1329
- }
1330
- enforceUpdateOptionsByType(activeTypeName, options, typeRegistry, extensionFieldNames);
1331
- if (options.typeOption !== undefined || clearFrontMatterKeys.has("type_options")) {
1332
- if (clearFrontMatterKeys.has("type_options")) {
1333
- delete document.metadata.type_options;
1334
- }
1335
- else {
1336
- const parsedTypeOptions = parseTypeOptionEntries(options.typeOption ?? []);
1337
- const validation = validateTypeOptions(activeTypeName, parsedTypeOptions, typeRegistry);
1338
- if (validation.errors.length > 0) {
1339
- throw new PmCliError(validation.errors.join("; "), EXIT_CODE.USAGE);
1340
- }
1341
- document.metadata.type_options = validation.normalized;
1342
- }
1343
- changedFields.push("type_options");
1344
- }
1345
- else if (options.type !== undefined && document.metadata.type_options !== undefined) {
1346
- const validation = validateTypeOptions(activeTypeName, document.metadata.type_options, typeRegistry);
1347
- if (validation.errors.length > 0) {
1348
- throw new PmCliError(`Current type options are incompatible with type "${activeTypeName}". ${validation.errors.join("; ")}. Use --clear-type-options to clear them.`, EXIT_CODE.USAGE);
1349
- }
1350
- document.metadata.type_options = validation.normalized;
1351
- }
1352
- if (options.dep !== undefined || options.depRemove !== undefined || clearFrontMatterKeys.has("dependencies")) {
1353
- let nextDependencies = clearFrontMatterKeys.has("dependencies") ? [] : [...(document.metadata.dependencies ?? [])];
1354
- if (dependencyUpdates.additions.length > 0) {
1355
- const seen = new Set(nextDependencies.map((entry) => dependencyKey(entry)));
1356
- for (const addition of dependencyUpdates.additions) {
1357
- const key = dependencyKey(addition);
1358
- if (seen.has(key)) {
1359
- continue;
1360
- }
1361
- nextDependencies.push(addition);
1362
- seen.add(key);
1363
- }
1364
- }
1365
- if (dependencyRemovals.length > 0) {
1366
- nextDependencies = nextDependencies.filter((entry) => !dependencyRemovals.some((selector) => matchesDependencySelector(entry, selector)));
1367
- }
1368
- if (nextDependencies.length === 0) {
1369
- delete document.metadata.dependencies;
1370
- }
1371
- else {
1372
- document.metadata.dependencies = nextDependencies;
1373
- }
1374
- changedFields.push("dependencies");
1375
- }
1376
- if (options.comment !== undefined || clearFrontMatterKeys.has("comments")) {
1377
- if (clearFrontMatterKeys.has("comments") || !commentUpdates.values || commentUpdates.values.length === 0) {
1378
- delete document.metadata.comments;
1379
- }
1380
- else {
1381
- document.metadata.comments = [...(document.metadata.comments ?? []), ...commentUpdates.values];
1382
- }
1383
- changedFields.push("comments");
1384
- }
1385
- if (options.note !== undefined || clearFrontMatterKeys.has("notes")) {
1386
- if (clearFrontMatterKeys.has("notes") || !noteUpdates.values || noteUpdates.values.length === 0) {
1387
- delete document.metadata.notes;
1388
- }
1389
- else {
1390
- document.metadata.notes = [...(document.metadata.notes ?? []), ...noteUpdates.values];
1391
- }
1392
- changedFields.push("notes");
1393
- }
1394
- if (options.learning !== undefined || clearFrontMatterKeys.has("learnings")) {
1395
- if (clearFrontMatterKeys.has("learnings") || !learningUpdates.values || learningUpdates.values.length === 0) {
1396
- delete document.metadata.learnings;
1397
- }
1398
- else {
1399
- document.metadata.learnings = [...(document.metadata.learnings ?? []), ...learningUpdates.values];
1400
- }
1401
- changedFields.push("learnings");
1402
- }
1403
- if (options.file !== undefined || clearFrontMatterKeys.has("files")) {
1404
- if (clearFrontMatterKeys.has("files") || !fileUpdates.values || fileUpdates.values.length === 0) {
1405
- delete document.metadata.files;
1406
- }
1407
- else {
1408
- const nextFiles = [...(document.metadata.files ?? [])];
1409
- const seen = new Set(nextFiles.map((entry) => fileKey(entry)));
1410
- for (const entry of fileUpdates.values) {
1411
- const key = fileKey(entry);
1412
- if (seen.has(key)) {
1413
- continue;
1414
- }
1415
- nextFiles.push(entry);
1416
- seen.add(key);
1417
- }
1418
- document.metadata.files = nextFiles;
1419
- }
1420
- changedFields.push("files");
1421
- }
1422
- if (options.test !== undefined || clearFrontMatterKeys.has("tests")) {
1423
- if (clearFrontMatterKeys.has("tests") && options.replaceTests === true) {
1424
- if (!testUpdates.values || testUpdates.values.length === 0) {
1425
- delete document.metadata.tests;
1426
- }
1427
- else {
1428
- const replacementTests = [];
1429
- const seen = new Set();
1430
- for (const entry of testUpdates.values) {
1431
- const key = testKey(entry);
1432
- if (seen.has(key)) {
1433
- continue;
1434
- }
1435
- replacementTests.push(entry);
1436
- seen.add(key);
1437
- }
1438
- document.metadata.tests = replacementTests;
1439
- }
1440
- }
1441
- else if (clearFrontMatterKeys.has("tests") || !testUpdates.values || testUpdates.values.length === 0) {
1442
- delete document.metadata.tests;
1443
- }
1444
- else {
1445
- const nextTests = [...(document.metadata.tests ?? [])];
1446
- const seen = new Set(nextTests.map((entry) => testKey(entry)));
1447
- for (const entry of testUpdates.values) {
1448
- const key = testKey(entry);
1449
- if (seen.has(key)) {
1450
- continue;
1451
- }
1452
- nextTests.push(entry);
1453
- seen.add(key);
1454
- }
1455
- document.metadata.tests = nextTests;
1456
- }
1457
- changedFields.push("tests");
1458
- }
1459
- if (options.doc !== undefined || clearFrontMatterKeys.has("docs")) {
1460
- if (clearFrontMatterKeys.has("docs") || !docUpdates.values || docUpdates.values.length === 0) {
1461
- delete document.metadata.docs;
1462
- }
1463
- else {
1464
- const nextDocs = [...(document.metadata.docs ?? [])];
1465
- const seen = new Set(nextDocs.map((entry) => docKey(entry)));
1466
- for (const entry of docUpdates.values) {
1467
- const key = docKey(entry);
1468
- if (seen.has(key)) {
1469
- continue;
1470
- }
1471
- nextDocs.push(entry);
1472
- seen.add(key);
1473
- }
1474
- document.metadata.docs = nextDocs;
1475
- }
1476
- changedFields.push("docs");
1477
- }
1478
- const addTagsValues = options.addTags;
1479
- const removeTagsValues = options.removeTags;
1480
- const hasAdditiveTagMutation = (Array.isArray(addTagsValues) && addTagsValues.length > 0) ||
1481
- (Array.isArray(removeTagsValues) && removeTagsValues.length > 0);
1482
- if (options.tags !== undefined || clearFrontMatterKeys.has("tags") || hasAdditiveTagMutation) {
1483
- const baseTags = clearFrontMatterKeys.has("tags")
1484
- ? []
1485
- : options.tags !== undefined
1486
- ? parseTags(options.tags)
1487
- : Array.isArray(document.metadata.tags)
1488
- ? [...document.metadata.tags]
1489
- : [];
1490
- const withAdditions = mergeAdditiveTags(baseTags, addTagsValues);
1491
- const finalTags = applyTagRemovals(withAdditions, removeTagsValues);
1492
- document.metadata.tags = finalTags;
1493
- changedFields.push("tags");
1494
- }
1495
- applyUpdateScalarMutations(UPDATE_POST_TAG_SCALAR_MUTATIONS, options, scalarMutationContext);
1496
- const orderRaw = options.order ?? options.rank;
1497
- if (orderRaw !== undefined || clearFrontMatterKeys.has("order")) {
1498
- if (clearFrontMatterKeys.has("order")) {
1499
- delete document.metadata.order;
1500
- }
1501
- else {
1502
- const parsedOrder = parseOptionalNumber(orderRaw ?? "", "order");
1503
- if (!Number.isInteger(parsedOrder)) {
1504
- throw new PmCliError("Order must be an integer", EXIT_CODE.USAGE);
1505
- }
1506
- document.metadata.order = parsedOrder;
1507
- }
1508
- changedFields.push("order");
1509
- }
1510
- if (options.assignee !== undefined || clearFrontMatterKeys.has("assignee")) {
1511
- if (clearFrontMatterKeys.has("assignee")) {
1512
- delete document.metadata.assignee;
1513
- }
1514
- else {
1515
- const assignee = options.assignee?.trim() ?? "";
1516
- if (assignee === "") {
1517
- throw new PmCliError("--assignee must not be empty. Use --unset assignee to clear it.", EXIT_CODE.USAGE);
1518
- }
1519
- document.metadata.assignee = assignee;
1520
- }
1521
- changedFields.push("assignee");
1522
- }
1523
- if (options.parent !== undefined || clearFrontMatterKeys.has("parent")) {
1524
- if (clearFrontMatterKeys.has("parent")) {
1525
- delete document.metadata.parent;
1526
- }
1527
- else {
1528
- document.metadata.parent = resolvedParentValue ?? "";
1529
- }
1530
- changedFields.push("parent");
1531
- }
1532
- applyUpdateScalarMutations(UPDATE_STAKEHOLDER_SCALAR_MUTATIONS, options, scalarMutationContext);
1533
- if (options.sprint !== undefined || clearFrontMatterKeys.has("sprint")) {
1534
- if (clearFrontMatterKeys.has("sprint")) {
1535
- delete document.metadata.sprint;
1536
- }
1537
- else {
1538
- const sprintValidation = validateSprintOrReleaseValue("sprint", options.sprint ?? "", sprintReleasePolicy);
1539
- document.metadata.sprint = sprintValidation.value;
1540
- warnings.push(...sprintValidation.warnings);
1541
- }
1542
- changedFields.push("sprint");
1543
- }
1544
- if (options.release !== undefined || clearFrontMatterKeys.has("release")) {
1545
- if (clearFrontMatterKeys.has("release")) {
1546
- delete document.metadata.release;
1547
- }
1548
- else {
1549
- const releaseValidation = validateSprintOrReleaseValue("release", options.release ?? "", sprintReleasePolicy);
1550
- document.metadata.release = releaseValidation.value;
1551
- warnings.push(...releaseValidation.warnings);
1552
- }
1553
- changedFields.push("release");
1554
- }
1555
- if (options.blockedBy !== undefined || clearFrontMatterKeys.has("blocked_by")) {
1556
- if (clearFrontMatterKeys.has("blocked_by")) {
1557
- delete document.metadata.blocked_by;
1558
- }
1559
- else {
1560
- document.metadata.blocked_by = options.blockedBy?.trim() ?? "";
1561
- }
1562
- changedFields.push("blocked_by");
1563
- // pm-kyd6: keep the dependency graph in sync with the blocked_by scalar.
1564
- applyBlockedByDependencyEdge(document.metadata, resolvedBlockedByDependencyId, nowIso, author, changedFields);
1565
- }
1566
- applyUpdateScalarMutations(UPDATE_ISSUE_SCALAR_MUTATIONS, options, scalarMutationContext);
1567
- if (options.reminder !== undefined || clearFrontMatterKeys.has("reminders")) {
1568
- if (clearFrontMatterKeys.has("reminders")) {
1569
- delete document.metadata.reminders;
1570
- }
1571
- else {
1572
- document.metadata.reminders = parseReminderEntries(options.reminder ?? [], nowValue, { valueMode: "trimmed" });
1573
- }
1574
- changedFields.push("reminders");
1575
- }
1576
- if (options.event !== undefined || clearFrontMatterKeys.has("events")) {
1577
- if (clearFrontMatterKeys.has("events")) {
1578
- delete document.metadata.events;
1579
- }
1580
- else {
1581
- document.metadata.events = parseEventEntries(options.event ?? [], nowValue, {
1582
- allDayEmptyGuard: "truthy",
1583
- recurrenceEmptyNumericGuard: "truthy",
1584
- });
1585
- }
1586
- changedFields.push("events");
1587
- }
1588
- for (const definition of runtimeFieldRegistry.definitions) {
1589
- if (!clearFrontMatterKeys.has(definition.metadata_key)) {
1590
- continue;
1591
- }
1592
- if (metadataRecord[definition.metadata_key] === undefined) {
1593
- continue;
1594
- }
1595
- delete metadataRecord[definition.metadata_key];
1596
- changedFields.push(definition.metadata_key);
1597
- }
1598
- for (const fieldKey of extensionFieldNames) {
1599
- if (!clearFrontMatterKeys.has(fieldKey)) {
1600
- continue;
1601
- }
1602
- if (metadataRecord[fieldKey] === undefined) {
1603
- continue;
1604
- }
1605
- delete metadataRecord[fieldKey];
1606
- changedFields.push(fieldKey);
1607
- }
1608
- for (const [fieldKey, fieldValue] of Object.entries(runtimeFieldUpdates)) {
1609
- if (clearFrontMatterKeys.has(fieldKey)) {
1610
- continue;
1611
- }
1612
- if (stableValueEquals(metadataRecord[fieldKey], fieldValue)) {
1613
- continue;
1614
- }
1615
- metadataRecord[fieldKey] = fieldValue;
1616
- changedFields.push(fieldKey);
1617
- }
1618
- const registeredItemFieldUpdates = parseRegisteredItemFieldAssignments(options.field, extensionRegistrations);
1619
- for (const fieldKey of Object.keys(registeredItemFieldUpdates)) {
1620
- if (!clearFrontMatterKeys.has(fieldKey)) {
1621
- continue;
1622
- }
1623
- throw new PmCliError(`Cannot combine --unset ${fieldKey.replaceAll("_", "-")} with --field ${fieldKey}=...`, EXIT_CODE.USAGE);
1624
- }
1625
- for (const [fieldKey, fieldValue] of Object.entries(registeredItemFieldUpdates)) {
1626
- if (stableValueEquals(metadataRecord[fieldKey], fieldValue)) {
1627
- continue;
1628
- }
1629
- metadataRecord[fieldKey] = fieldValue;
1630
- changedFields.push(fieldKey);
1631
- }
1632
- try {
1633
- applyRegisteredItemFieldDefaultsAndValidation(metadataRecord, extensionRegistrations, { skipDefaultFields: clearFrontMatterKeys });
1634
- }
1635
- catch (error) {
1636
- throw new PmCliError(error instanceof Error ? error.message : "Invalid extension item field values", EXIT_CODE.USAGE);
1637
- }
1638
- return { changedFields, warnings };
1652
+ nowIso,
1653
+ author,
1654
+ pmRoot,
1655
+ });
1639
1656
  },
1640
1657
  });
1641
1658
  return {
@@ -1661,4 +1678,4 @@ export const _testOnlyUpdateCommand = {
1661
1678
  resolveRuntimeUnsetDefinition: (token, registry) => resolveRuntimeUnsetFieldDefinition(token, "update", registry),
1662
1679
  };
1663
1680
  //# sourceMappingURL=update.js.map
1664
- //# debugId=87aa6b2c-8735-58a6-b263-b310f37494b9
1681
+ //# debugId=6156dbbd-29ea-58f5-ba6e-c9ae989e23e3