@unbrained/pm-cli 2026.7.1 → 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 (563) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cli/commander-usage.d.ts +2 -0
  3. package/dist/cli/commander-usage.js +58 -47
  4. package/dist/cli/commander-usage.js.map +1 -1
  5. package/dist/cli/commands/aggregate.js +102 -79
  6. package/dist/cli/commands/aggregate.js.map +1 -1
  7. package/dist/cli/commands/calendar.js +278 -243
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/close-many.js +89 -68
  10. package/dist/cli/commands/close-many.js.map +1 -1
  11. package/dist/cli/commands/close.js +157 -129
  12. package/dist/cli/commands/close.js.map +1 -1
  13. package/dist/cli/commands/comments-audit.js +50 -42
  14. package/dist/cli/commands/comments-audit.js.map +1 -1
  15. package/dist/cli/commands/config.d.ts +2 -0
  16. package/dist/cli/commands/config.js +443 -879
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/context.js +365 -287
  19. package/dist/cli/commands/context.js.map +1 -1
  20. package/dist/cli/commands/contracts.js +352 -238
  21. package/dist/cli/commands/contracts.js.map +1 -1
  22. package/dist/cli/commands/dedupe-audit.js +46 -39
  23. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  24. package/dist/cli/commands/dedupe-merge.js +88 -69
  25. package/dist/cli/commands/dedupe-merge.js.map +1 -1
  26. package/dist/cli/commands/get.js +114 -81
  27. package/dist/cli/commands/get.js.map +1 -1
  28. package/dist/cli/commands/health.d.ts +17 -0
  29. package/dist/cli/commands/health.js +446 -307
  30. package/dist/cli/commands/health.js.map +1 -1
  31. package/dist/cli/commands/history-compact.js +209 -140
  32. package/dist/cli/commands/history-compact.js.map +1 -1
  33. package/dist/cli/commands/history-redact.js +162 -119
  34. package/dist/cli/commands/history-redact.js.map +1 -1
  35. package/dist/cli/commands/history-repair.js +120 -85
  36. package/dist/cli/commands/history-repair.js.map +1 -1
  37. package/dist/cli/commands/init.d.ts +8 -2
  38. package/dist/cli/commands/init.js +263 -162
  39. package/dist/cli/commands/init.js.map +1 -1
  40. package/dist/cli/commands/list.js +152 -102
  41. package/dist/cli/commands/list.js.map +1 -1
  42. package/dist/cli/commands/next.js +49 -32
  43. package/dist/cli/commands/next.js.map +1 -1
  44. package/dist/cli/commands/plan.js +373 -298
  45. package/dist/cli/commands/plan.js.map +1 -1
  46. package/dist/cli/commands/recurrence-parsers.js +43 -25
  47. package/dist/cli/commands/recurrence-parsers.js.map +1 -1
  48. package/dist/cli/commands/reindex.d.ts +21 -5
  49. package/dist/cli/commands/reindex.js +345 -205
  50. package/dist/cli/commands/reindex.js.map +1 -1
  51. package/dist/cli/commands/restore.d.ts +8 -7
  52. package/dist/cli/commands/restore.js +105 -69
  53. package/dist/cli/commands/restore.js.map +1 -1
  54. package/dist/cli/commands/schema.js +33 -30
  55. package/dist/cli/commands/schema.js.map +1 -1
  56. package/dist/cli/commands/search.d.ts +10 -2
  57. package/dist/cli/commands/search.js +503 -470
  58. package/dist/cli/commands/search.js.map +1 -1
  59. package/dist/cli/commands/telemetry.js +98 -87
  60. package/dist/cli/commands/telemetry.js.map +1 -1
  61. package/dist/cli/commands/test-all.js +237 -168
  62. package/dist/cli/commands/test-all.js.map +1 -1
  63. package/dist/cli/commands/test.d.ts +6 -5
  64. package/dist/cli/commands/test.js +424 -344
  65. package/dist/cli/commands/test.js.map +1 -1
  66. package/dist/cli/commands/update-many.js +57 -42
  67. package/dist/cli/commands/update-many.js.map +1 -1
  68. package/dist/cli/commands/update.d.ts +1 -1
  69. package/dist/cli/commands/update.js +738 -671
  70. package/dist/cli/commands/update.js.map +1 -1
  71. package/dist/cli/commands/validate.d.ts +18 -1
  72. package/dist/cli/commands/validate.js +466 -343
  73. package/dist/cli/commands/validate.js.map +1 -1
  74. package/dist/cli/error-guidance.js +399 -357
  75. package/dist/cli/error-guidance.js.map +1 -1
  76. package/dist/cli/main.d.ts +47 -0
  77. package/dist/cli/main.js +428 -341
  78. package/dist/cli/main.js.map +1 -1
  79. package/dist/cli/migration-gates.js +22 -45
  80. package/dist/cli/migration-gates.js.map +1 -1
  81. package/dist/cli/register-list-query.js +94 -105
  82. package/dist/cli/register-list-query.js.map +1 -1
  83. package/dist/cli/register-mutation.js +400 -416
  84. package/dist/cli/register-mutation.js.map +1 -1
  85. package/dist/cli/register-operations.js +86 -66
  86. package/dist/cli/register-operations.js.map +1 -1
  87. package/dist/cli/register-setup.js +120 -101
  88. package/dist/cli/register-setup.js.map +1 -1
  89. package/dist/cli-bundle/chunks/{activity-DBLQVIP6.js → activity-CUC4JY3U.js} +9 -9
  90. package/dist/cli-bundle/chunks/activity-WEIEMM73.js +16 -0
  91. package/dist/cli-bundle/chunks/{aggregate-JTEF4BP7.js → aggregate-DKUTRY6R.js} +108 -84
  92. package/dist/cli-bundle/chunks/aggregate-DKUTRY6R.js.map +1 -0
  93. package/dist/cli-bundle/chunks/{aggregate-SDF7DUOD.js → aggregate-SW5PNGCS.js} +107 -83
  94. package/dist/cli-bundle/chunks/{aggregate-SDF7DUOD.js.map → aggregate-SW5PNGCS.js.map} +2 -2
  95. package/dist/cli-bundle/chunks/{append-QCFJSDFL.js → append-H32VOR2Y.js} +6 -6
  96. package/dist/cli-bundle/chunks/{append-LOVPGVPT.js → append-UBM632FK.js} +6 -6
  97. package/dist/cli-bundle/chunks/{chunk-RLDHZHQS.js → chunk-2227673O.js} +158 -114
  98. package/dist/cli-bundle/chunks/chunk-2227673O.js.map +1 -0
  99. package/dist/cli-bundle/chunks/{chunk-SLMUGTK3.js → chunk-2ASNV4DH.js} +4 -4
  100. package/dist/cli-bundle/chunks/{chunk-UZIWVBE6.js → chunk-2CHRYUXL.js} +2 -2
  101. package/dist/cli-bundle/chunks/{chunk-NWMZWYYB.js → chunk-2KWL5NPW.js} +42 -27
  102. package/dist/cli-bundle/chunks/chunk-2KWL5NPW.js.map +1 -0
  103. package/dist/cli-bundle/chunks/{chunk-NFDPYAIP.js → chunk-36UGKF4O.js} +21 -29
  104. package/dist/cli-bundle/chunks/chunk-36UGKF4O.js.map +7 -0
  105. package/dist/cli-bundle/chunks/{chunk-NU2UEROZ.js → chunk-3AZUFQK6.js} +6 -6
  106. package/dist/cli-bundle/chunks/{chunk-LB6TP6MC.js → chunk-3LCUASYG.js} +2 -2
  107. package/dist/cli-bundle/chunks/{chunk-HPPFYYOV.js → chunk-3Q2HBMTI.js} +2 -2
  108. package/dist/cli-bundle/chunks/{chunk-IPYBJWTE.js → chunk-4NUOWFBT.js} +109 -72
  109. package/dist/cli-bundle/chunks/chunk-4NUOWFBT.js.map +7 -0
  110. package/dist/cli-bundle/chunks/{chunk-W4ULYO7Z.js → chunk-55XRYWEG.js} +6 -6
  111. package/dist/cli-bundle/chunks/{chunk-HXTQJXWT.js → chunk-5GVTFFTC.js} +2 -2
  112. package/dist/cli-bundle/chunks/{chunk-BDTISOSD.js → chunk-5PGBHRY3.js} +41 -26
  113. package/dist/cli-bundle/chunks/chunk-5PGBHRY3.js.map +7 -0
  114. package/dist/cli-bundle/chunks/{chunk-YITK2PJ6.js → chunk-66Z3X7ZG.js} +261 -161
  115. package/dist/cli-bundle/chunks/chunk-66Z3X7ZG.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-NUHHPVVS.js → chunk-6ITZLD4T.js} +712 -612
  117. package/dist/cli-bundle/chunks/chunk-6ITZLD4T.js.map +7 -0
  118. package/dist/cli-bundle/chunks/{chunk-V3NOKJF2.js → chunk-6YCYF2AI.js} +262 -162
  119. package/dist/cli-bundle/chunks/chunk-6YCYF2AI.js.map +1 -0
  120. package/dist/cli-bundle/chunks/{chunk-BZCEN4JA.js → chunk-6ZMBJRDJ.js} +492 -403
  121. package/dist/cli-bundle/chunks/chunk-6ZMBJRDJ.js.map +7 -0
  122. package/dist/cli-bundle/chunks/{chunk-CF7RL6FR.js → chunk-7MYWF4ZX.js} +110 -73
  123. package/dist/cli-bundle/chunks/chunk-7MYWF4ZX.js.map +1 -0
  124. package/dist/cli-bundle/chunks/{chunk-RVUALSJF.js → chunk-7NSPKJUS.js} +356 -285
  125. package/dist/cli-bundle/chunks/chunk-7NSPKJUS.js.map +7 -0
  126. package/dist/cli-bundle/chunks/{chunk-4DSGXSBL.js → chunk-7TH5NMVB.js} +95 -53
  127. package/dist/cli-bundle/chunks/chunk-7TH5NMVB.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-ZETXE4SE.js → chunk-7W4H4K26.js} +713 -613
  129. package/dist/cli-bundle/chunks/chunk-7W4H4K26.js.map +1 -0
  130. package/dist/cli-bundle/chunks/{chunk-64HNBBFQ.js → chunk-A6VOGKBA.js} +6 -6
  131. package/dist/cli-bundle/chunks/{chunk-WYDHYJPO.js → chunk-AIAIXG7I.js} +2 -2
  132. package/dist/cli-bundle/chunks/{chunk-CWFNTKQJ.js → chunk-AJEBCRIY.js} +5 -5
  133. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js → chunk-B4O5S7I3.js} +79 -57
  134. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js.map → chunk-B4O5S7I3.js.map} +2 -2
  135. package/dist/cli-bundle/chunks/{chunk-NOLPZMSV.js → chunk-BTX5MIQF.js} +2 -2
  136. package/dist/cli-bundle/chunks/{chunk-RH5ZBYFD.js → chunk-BVZZN2LH.js} +3 -3
  137. package/dist/cli-bundle/chunks/{chunk-27BXPBAY.js → chunk-CYBDUHNO.js} +3 -3
  138. package/dist/cli-bundle/chunks/{chunk-A7FPBAQS.js → chunk-CZPVDLD2.js} +4 -4
  139. package/dist/cli-bundle/chunks/{chunk-3VGN2UWE.js → chunk-EMPGXBUF.js} +22 -30
  140. package/dist/cli-bundle/chunks/chunk-EMPGXBUF.js.map +1 -0
  141. package/dist/cli-bundle/chunks/{chunk-JPECA746.js → chunk-EUKTMRN3.js} +2 -2
  142. package/dist/cli-bundle/chunks/{chunk-2466X6E4.js → chunk-FFOQHGNH.js} +6 -6
  143. package/dist/cli-bundle/chunks/{chunk-JLM7BHI7.js → chunk-GFMSLORL.js} +6 -6
  144. package/dist/cli-bundle/chunks/{chunk-SDR5J34Q.js → chunk-GRRG3MCT.js} +4 -4
  145. package/dist/cli-bundle/chunks/{chunk-GJ326ZKX.js → chunk-H4GRLYJS.js} +3 -3
  146. package/dist/cli-bundle/chunks/{chunk-OGXLACHC.js → chunk-HQTPRV4D.js} +6 -6
  147. package/dist/cli-bundle/chunks/{chunk-7R4QEMZZ.js → chunk-I66WE2HE.js} +354 -283
  148. package/dist/cli-bundle/chunks/chunk-I66WE2HE.js.map +1 -0
  149. package/dist/cli-bundle/chunks/{chunk-BHO33VBQ.js → chunk-IEEJQCZ4.js} +3 -3
  150. package/dist/cli-bundle/chunks/{chunk-JMP4E6D7.js → chunk-IG5JYZGU.js} +390 -312
  151. package/dist/cli-bundle/chunks/{chunk-JMP4E6D7.js.map → chunk-IG5JYZGU.js.map} +2 -2
  152. package/dist/cli-bundle/chunks/{chunk-4DUVCVLZ.js → chunk-JMK5GCK2.js} +2 -2
  153. package/dist/cli-bundle/chunks/{chunk-3K2M5OYU.js → chunk-JXAUVO6X.js} +258 -169
  154. package/dist/cli-bundle/chunks/{chunk-3K2M5OYU.js.map → chunk-JXAUVO6X.js.map} +2 -2
  155. package/dist/cli-bundle/chunks/{chunk-AXIDKKAT.js → chunk-K2VYLVX4.js} +2 -2
  156. package/dist/cli-bundle/chunks/{chunk-EJUDVUYZ.js → chunk-KCO2EAN5.js} +3 -3
  157. package/dist/cli-bundle/chunks/{chunk-6AQZPVHQ.js → chunk-KIYCOJ63.js} +4 -4
  158. package/dist/cli-bundle/chunks/{chunk-ZRP4VG5U.js → chunk-KLXF7NCC.js} +2 -2
  159. package/dist/cli-bundle/chunks/{chunk-QCWF6IYD.js → chunk-KN3URLKS.js} +3 -3
  160. package/dist/cli-bundle/chunks/{chunk-N74UMG5H.js → chunk-LRKMWUUV.js} +2 -2
  161. package/dist/cli-bundle/chunks/{chunk-AVEE5EHK.js → chunk-LTRAF2D7.js} +3 -3
  162. package/dist/cli-bundle/chunks/{chunk-VARHOHYV.js → chunk-MNBPX5JS.js} +55 -36
  163. package/dist/cli-bundle/chunks/chunk-MNBPX5JS.js.map +7 -0
  164. package/dist/cli-bundle/chunks/{chunk-IJYK2T43.js → chunk-MRD4T5LF.js} +2 -2
  165. package/dist/cli-bundle/chunks/{chunk-G7I7DEZA.js → chunk-N2JSWVWG.js} +4 -4
  166. package/dist/cli-bundle/chunks/{chunk-5QFDBI4F.js → chunk-N3QCJS4M.js} +6 -6
  167. package/dist/cli-bundle/chunks/{chunk-JSU5P7VS.js → chunk-NRZS637N.js} +258 -169
  168. package/dist/cli-bundle/chunks/chunk-NRZS637N.js.map +1 -0
  169. package/dist/cli-bundle/chunks/{chunk-4A3BJ675.js → chunk-OTUJZKGI.js} +3 -3
  170. package/dist/cli-bundle/chunks/{chunk-5CGRF3L5.js → chunk-Q6K2OACU.js} +153 -90
  171. package/dist/cli-bundle/chunks/chunk-Q6K2OACU.js.map +1 -0
  172. package/dist/cli-bundle/chunks/{chunk-3XZCOZ5J.js → chunk-Q6NXOHS6.js} +391 -313
  173. package/dist/cli-bundle/chunks/chunk-Q6NXOHS6.js.map +1 -0
  174. package/dist/cli-bundle/chunks/{chunk-HZZEHPRG.js → chunk-QH3FSKRJ.js} +2 -2
  175. package/dist/cli-bundle/chunks/{chunk-4XOIEKSD.js → chunk-RM37OPYK.js} +56 -37
  176. package/dist/cli-bundle/chunks/chunk-RM37OPYK.js.map +1 -0
  177. package/dist/cli-bundle/chunks/{chunk-NKZAN7BD.js → chunk-S62UANU7.js} +3 -3
  178. package/dist/cli-bundle/chunks/{chunk-RMMQ74TG.js → chunk-SPM2XLWI.js} +37 -28
  179. package/dist/cli-bundle/chunks/chunk-SPM2XLWI.js.map +7 -0
  180. package/dist/cli-bundle/chunks/{chunk-3J6JRJ3I.js → chunk-SYNKD3ZG.js} +5 -5
  181. package/dist/cli-bundle/chunks/{chunk-FFMQB7WR.js → chunk-SYVUU7EK.js} +493 -404
  182. package/dist/cli-bundle/chunks/chunk-SYVUU7EK.js.map +1 -0
  183. package/dist/cli-bundle/chunks/{chunk-UYUYDGIB.js → chunk-TPOFWBMY.js} +95 -53
  184. package/dist/cli-bundle/chunks/chunk-TPOFWBMY.js.map +1 -0
  185. package/dist/cli-bundle/chunks/{chunk-OTUHB4HS.js → chunk-TTHCEV5Q.js} +92 -77
  186. package/dist/cli-bundle/chunks/chunk-TTHCEV5Q.js.map +1 -0
  187. package/dist/cli-bundle/chunks/{chunk-L5OEFZQG.js → chunk-U2BEEM2X.js} +3 -3
  188. package/dist/cli-bundle/chunks/{chunk-KNPEF7QG.js → chunk-UGLU6Q2I.js} +91 -76
  189. package/dist/cli-bundle/chunks/chunk-UGLU6Q2I.js.map +7 -0
  190. package/dist/cli-bundle/chunks/{chunk-EVMTBV6V.js → chunk-UT73HUPC.js} +3 -3
  191. package/dist/cli-bundle/chunks/{chunk-VICZWYGZ.js → chunk-UTSH5GWX.js} +4 -4
  192. package/dist/cli-bundle/chunks/{chunk-IZBR4NRW.js → chunk-UWKEJMZU.js} +157 -113
  193. package/dist/cli-bundle/chunks/chunk-UWKEJMZU.js.map +7 -0
  194. package/dist/cli-bundle/chunks/{chunk-3S2KT7NG.js → chunk-W47SML5B.js} +152 -89
  195. package/dist/cli-bundle/chunks/chunk-W47SML5B.js.map +7 -0
  196. package/dist/cli-bundle/chunks/{chunk-RGEMWD6Q.js → chunk-WJAMWAHZ.js} +157 -118
  197. package/dist/cli-bundle/chunks/chunk-WJAMWAHZ.js.map +7 -0
  198. package/dist/cli-bundle/chunks/{chunk-JWXRETDF.js → chunk-XCHUVHKU.js} +626 -484
  199. package/dist/cli-bundle/chunks/chunk-XCHUVHKU.js.map +1 -0
  200. package/dist/cli-bundle/chunks/{chunk-55SNVXRQ.js → chunk-XEWQKDYZ.js} +626 -484
  201. package/dist/cli-bundle/chunks/chunk-XEWQKDYZ.js.map +7 -0
  202. package/dist/cli-bundle/chunks/{chunk-TP5Q5ZD3.js → chunk-XTHQWXVC.js} +158 -119
  203. package/dist/cli-bundle/chunks/chunk-XTHQWXVC.js.map +1 -0
  204. package/dist/cli-bundle/chunks/{chunk-MDPEOIGN.js → chunk-XWGEMNBR.js} +2 -2
  205. package/dist/cli-bundle/chunks/{chunk-HYTGA6GI.js → chunk-Y4NRKBFW.js} +3 -3
  206. package/dist/cli-bundle/chunks/{chunk-2D4HATP2.js → chunk-YLZZ6T54.js} +38 -29
  207. package/dist/cli-bundle/chunks/chunk-YLZZ6T54.js.map +1 -0
  208. package/dist/cli-bundle/chunks/{chunk-22WKIL3H.js → chunk-YPKFV2JR.js} +6 -6
  209. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js → chunk-Z4DGFQDH.js} +80 -58
  210. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js.map → chunk-Z4DGFQDH.js.map} +1 -1
  211. package/dist/cli-bundle/chunks/{chunk-DDPTYJIM.js → chunk-ZNHEYCDD.js} +2 -2
  212. package/dist/cli-bundle/chunks/{chunk-MAUKX7JC.js → chunk-ZNT7KEWE.js} +2 -2
  213. package/dist/cli-bundle/chunks/{claim-T3GCKV7C.js → claim-SENTPZBN.js} +8 -8
  214. package/dist/cli-bundle/chunks/{claim-EMQLYPRW.js → claim-Z7MEQCBT.js} +8 -8
  215. package/dist/cli-bundle/chunks/{close-TQYAAFJP.js → close-424MX4CU.js} +7 -7
  216. package/dist/cli-bundle/chunks/close-YCWQQPDS.js +14 -0
  217. package/dist/cli-bundle/chunks/{close-many-LDRVEQY2.js → close-many-2IV4J2TR.js} +102 -81
  218. package/dist/cli-bundle/chunks/close-many-2IV4J2TR.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{close-many-BG5QQIDQ.js → close-many-SWY34BII.js} +101 -80
  220. package/dist/cli-bundle/chunks/close-many-SWY34BII.js.map +7 -0
  221. package/dist/cli-bundle/chunks/{comments-YUXJRZPQ.js → comments-4FGNTSNV.js} +8 -8
  222. package/dist/cli-bundle/chunks/{comments-QCKR2YY2.js → comments-7YS5MY5X.js} +8 -8
  223. package/dist/cli-bundle/chunks/config-BZJKK7FZ.js +1062 -0
  224. package/dist/cli-bundle/chunks/config-BZJKK7FZ.js.map +1 -0
  225. package/dist/cli-bundle/chunks/config-G74GISC4.js +1072 -0
  226. package/dist/cli-bundle/chunks/config-G74GISC4.js.map +7 -0
  227. package/dist/cli-bundle/chunks/{context-OCZ3FJ4Z.js → context-LHVKJSPJ.js} +12 -12
  228. package/dist/cli-bundle/chunks/{context-B6275WPX.js → context-ZQY54JNS.js} +12 -12
  229. package/dist/cli-bundle/chunks/{contracts-HN7ABKLP.js → contracts-CP2EZJC7.js} +320 -199
  230. package/dist/cli-bundle/chunks/contracts-CP2EZJC7.js.map +7 -0
  231. package/dist/cli-bundle/chunks/{contracts-W4FZVVD6.js → contracts-FIZLMP7O.js} +321 -200
  232. package/dist/cli-bundle/chunks/contracts-FIZLMP7O.js.map +1 -0
  233. package/dist/cli-bundle/chunks/{copy-DEM4DATS.js → copy-GYNQQPW2.js} +5 -5
  234. package/dist/cli-bundle/chunks/{copy-BTJOSKKT.js → copy-TLW7JTQT.js} +5 -5
  235. package/dist/cli-bundle/chunks/{create-RLRJMRTM.js → create-VSKYSOCD.js} +12 -12
  236. package/dist/cli-bundle/chunks/create-XTMAPS7I.js +28 -0
  237. package/dist/cli-bundle/chunks/{delete-LSVHAB4Y.js → delete-4W5JYCEG.js} +5 -5
  238. package/dist/cli-bundle/chunks/{delete-BHK7VB2Z.js → delete-ANTOTI2I.js} +5 -5
  239. package/dist/cli-bundle/chunks/{deps-XHYXWEPT.js → deps-HPPE6MJN.js} +5 -5
  240. package/dist/cli-bundle/chunks/{deps-4UDFJRUA.js → deps-ZQZN54EZ.js} +5 -5
  241. package/dist/cli-bundle/chunks/{docs-GYZNVS26.js → docs-RPOVFMP3.js} +7 -7
  242. package/dist/cli-bundle/chunks/{docs-26S44RXU.js → docs-XJNYBJGE.js} +7 -7
  243. package/dist/cli-bundle/chunks/{eval-PGRVIJQU.js → eval-DM6JBZTS.js} +10 -10
  244. package/dist/cli-bundle/chunks/{eval-UYF3ZPVO.js → eval-RFBI5FGS.js} +10 -10
  245. package/dist/cli-bundle/chunks/{extension-CPSLJQVE.js → extension-B3YY4WY5.js} +11 -11
  246. package/dist/cli-bundle/chunks/{extension-CXJ6RELI.js → extension-TTSEFQTS.js} +11 -11
  247. package/dist/cli-bundle/chunks/{files-NQHEXUZD.js → files-5D65CHGE.js} +7 -7
  248. package/dist/cli-bundle/chunks/{files-MBNICQFM.js → files-GPIG77EN.js} +7 -7
  249. package/dist/cli-bundle/chunks/{focus-XZW5423D.js → focus-C3PEJV2C.js} +6 -6
  250. package/dist/cli-bundle/chunks/{focus-DWYIG7GU.js → focus-ZHN7WIGX.js} +6 -6
  251. package/dist/cli-bundle/chunks/{gc-LPVMKJQJ.js → gc-D4JQ6OWN.js} +3 -3
  252. package/dist/cli-bundle/chunks/{gc-7GQYOS2G.js → gc-VZIXDL32.js} +3 -3
  253. package/dist/cli-bundle/chunks/{get-DSDEKJ3L.js → get-GIBRUUOP.js} +121 -81
  254. package/dist/cli-bundle/chunks/get-GIBRUUOP.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{get-A7MAOHCU.js → get-IOVAN6RU.js} +120 -80
  256. package/dist/cli-bundle/chunks/get-IOVAN6RU.js.map +7 -0
  257. package/dist/cli-bundle/chunks/{health-3IPFLKXB.js → health-L2U3AFKV.js} +437 -265
  258. package/dist/cli-bundle/chunks/health-L2U3AFKV.js.map +1 -0
  259. package/dist/cli-bundle/chunks/{health-GZXGBZ36.js → health-MM7AWXYF.js} +436 -264
  260. package/dist/cli-bundle/chunks/health-MM7AWXYF.js.map +7 -0
  261. package/dist/cli-bundle/chunks/history-DD7L7BNL.js +18 -0
  262. package/dist/cli-bundle/chunks/{history-NERDJNUB.js → history-IL7XCEX2.js} +8 -8
  263. package/dist/cli-bundle/chunks/{history-compact-HR7BB4LR.js → history-compact-HALOTOU7.js} +214 -135
  264. package/dist/cli-bundle/chunks/history-compact-HALOTOU7.js.map +1 -0
  265. package/dist/cli-bundle/chunks/{history-compact-2WRZ2WK4.js → history-compact-MV25P7DM.js} +213 -134
  266. package/dist/cli-bundle/chunks/history-compact-MV25P7DM.js.map +7 -0
  267. package/dist/cli-bundle/chunks/history-redact-IX4YEWMY.js +19 -0
  268. package/dist/cli-bundle/chunks/{history-redact-O3NBCNWC.js → history-redact-VYCWQFK7.js} +9 -9
  269. package/dist/cli-bundle/chunks/{history-repair-XA3LC4GA.js → history-repair-44MODPQF.js} +124 -84
  270. package/dist/cli-bundle/chunks/history-repair-44MODPQF.js.map +1 -0
  271. package/dist/cli-bundle/chunks/{history-repair-LCMOS45X.js → history-repair-CPNAOCNF.js} +123 -83
  272. package/dist/cli-bundle/chunks/history-repair-CPNAOCNF.js.map +7 -0
  273. package/dist/cli-bundle/chunks/{init-64XDLQJB.js → init-F27NHENZ.js} +12 -12
  274. package/dist/cli-bundle/chunks/init-HHVQQP6C.js +22 -0
  275. package/dist/cli-bundle/chunks/{learnings-LPKCSJX7.js → learnings-HJVDQIGY.js} +8 -8
  276. package/dist/cli-bundle/chunks/{learnings-JR6MA5TI.js → learnings-XSFSUUWK.js} +8 -8
  277. package/dist/cli-bundle/chunks/{list-G5Y65VF6.js → list-HPMEKCAA.js} +8 -8
  278. package/dist/cli-bundle/chunks/{list-DNBJVO3E.js → list-VMPWTURB.js} +8 -8
  279. package/dist/cli-bundle/chunks/{next-BCERKDUR.js → next-ETXF2ZCN.js} +59 -37
  280. package/dist/cli-bundle/chunks/next-ETXF2ZCN.js.map +7 -0
  281. package/dist/cli-bundle/chunks/{next-FYTQF6HG.js → next-QM6YJIIS.js} +60 -38
  282. package/dist/cli-bundle/chunks/next-QM6YJIIS.js.map +1 -0
  283. package/dist/cli-bundle/chunks/{notes-2BMU3VVQ.js → notes-GDZIKGR6.js} +8 -8
  284. package/dist/cli-bundle/chunks/{notes-6KTGO2OJ.js → notes-WDDBPC4D.js} +8 -8
  285. package/dist/cli-bundle/chunks/{plan-RKZHQVXR.js → plan-BGDR73Z6.js} +373 -279
  286. package/dist/cli-bundle/chunks/plan-BGDR73Z6.js.map +1 -0
  287. package/dist/cli-bundle/chunks/{plan-4WXEQCTN.js → plan-C5IMM335.js} +372 -278
  288. package/dist/cli-bundle/chunks/plan-C5IMM335.js.map +7 -0
  289. package/dist/cli-bundle/chunks/{profile-QLER5ENE.js → profile-CCOKZ2IQ.js} +9 -9
  290. package/dist/cli-bundle/chunks/{profile-4OMM32CD.js → profile-HUCENIEQ.js} +9 -9
  291. package/dist/cli-bundle/chunks/{register-list-query-7LV46VAU.js → register-list-query-ROSNIL52.js} +80 -83
  292. package/dist/cli-bundle/chunks/register-list-query-ROSNIL52.js.map +1 -0
  293. package/dist/cli-bundle/chunks/{register-list-query-SNG5PGA4.js → register-list-query-XN4ZRHSV.js} +79 -82
  294. package/dist/cli-bundle/chunks/register-list-query-XN4ZRHSV.js.map +7 -0
  295. package/dist/cli-bundle/chunks/{register-mutation-ENNDUAZG.js → register-mutation-CFSB2MS3.js} +403 -382
  296. package/dist/cli-bundle/chunks/register-mutation-CFSB2MS3.js.map +1 -0
  297. package/dist/cli-bundle/chunks/{register-mutation-KK7PHYYU.js → register-mutation-KRLAHEL2.js} +402 -381
  298. package/dist/cli-bundle/chunks/register-mutation-KRLAHEL2.js.map +7 -0
  299. package/dist/cli-bundle/chunks/{register-operations-HZ6XERQG.js → register-operations-4PASGJDB.js} +112 -93
  300. package/dist/cli-bundle/chunks/register-operations-4PASGJDB.js.map +7 -0
  301. package/dist/cli-bundle/chunks/{register-operations-C6OWLDSH.js → register-operations-MBN4KGUM.js} +113 -94
  302. package/dist/cli-bundle/chunks/register-operations-MBN4KGUM.js.map +1 -0
  303. package/dist/cli-bundle/chunks/{register-setup-P67EMBDJ.js → register-setup-VIAWYFP5.js} +129 -104
  304. package/dist/cli-bundle/chunks/register-setup-VIAWYFP5.js.map +1 -0
  305. package/dist/cli-bundle/chunks/{register-setup-ZKJ53RS7.js → register-setup-ZCGKHDKL.js} +128 -103
  306. package/dist/cli-bundle/chunks/register-setup-ZCGKHDKL.js.map +7 -0
  307. package/dist/cli-bundle/chunks/{restore-4MHZFJ2E.js → restore-4CBWUMCX.js} +9 -9
  308. package/dist/cli-bundle/chunks/restore-5UEAGG3W.js +17 -0
  309. package/dist/cli-bundle/chunks/{scheduling-shortcuts-LB6DOLRL.js → scheduling-shortcuts-6VFKNKCM.js} +12 -12
  310. package/dist/cli-bundle/chunks/{scheduling-shortcuts-UTOYKLXQ.js → scheduling-shortcuts-ERHCVTEM.js} +12 -12
  311. package/dist/cli-bundle/chunks/{schema-73HR2OJW.js → schema-TDGK6N3I.js} +7 -7
  312. package/dist/cli-bundle/chunks/{schema-U6LJKSIR.js → schema-UE5KKAUX.js} +7 -7
  313. package/dist/cli-bundle/chunks/{search-KILGT37L.js → search-FP7MEU4S.js} +10 -10
  314. package/dist/cli-bundle/chunks/{search-AXPXKZER.js → search-K4CFLQ5S.js} +10 -10
  315. package/dist/cli-bundle/chunks/{stats-PSYVVTNZ.js → stats-NJJCALEZ.js} +6 -6
  316. package/dist/cli-bundle/chunks/{stats-W5KNVJWQ.js → stats-XT6QRKQY.js} +6 -6
  317. package/dist/cli-bundle/chunks/{telemetry-GAHHQTOS.js → telemetry-5SQ5UDXC.js} +84 -70
  318. package/dist/cli-bundle/chunks/telemetry-5SQ5UDXC.js.map +7 -0
  319. package/dist/cli-bundle/chunks/{telemetry-BZUF6H7G.js → telemetry-HVXFZA2U.js} +85 -71
  320. package/dist/cli-bundle/chunks/telemetry-HVXFZA2U.js.map +1 -0
  321. package/dist/cli-bundle/chunks/{test-ACD52Z3S.js → test-UFSJ5YIO.js} +15 -15
  322. package/dist/cli-bundle/chunks/{test-PWDIZ255.js → test-YCDAUBWF.js} +15 -15
  323. package/dist/cli-bundle/chunks/test-all-2BWKY3GQ.js +427 -0
  324. package/dist/cli-bundle/chunks/test-all-2BWKY3GQ.js.map +1 -0
  325. package/dist/cli-bundle/chunks/test-all-PM7UYN42.js +430 -0
  326. package/dist/cli-bundle/chunks/test-all-PM7UYN42.js.map +7 -0
  327. package/dist/cli-bundle/chunks/{test-runs-UXIXPDKU.js → test-runs-FK5E75AA.js} +185 -147
  328. package/dist/cli-bundle/chunks/test-runs-FK5E75AA.js.map +1 -0
  329. package/dist/cli-bundle/chunks/{test-runs-PLRAZEFW.js → test-runs-H4TGWGRN.js} +184 -146
  330. package/dist/cli-bundle/chunks/test-runs-H4TGWGRN.js.map +7 -0
  331. package/dist/cli-bundle/chunks/update-MTCFES6X.js +24 -0
  332. package/dist/cli-bundle/chunks/{update-KFX2SIAC.js → update-Y5WQVT5O.js} +15 -15
  333. package/dist/cli-bundle/chunks/{update-many-Z5GJS5LC.js → update-many-6YAYYRLE.js} +82 -67
  334. package/dist/cli-bundle/chunks/{update-many-Z5GJS5LC.js.map → update-many-6YAYYRLE.js.map} +2 -2
  335. package/dist/cli-bundle/chunks/{update-many-RNSBX2TA.js → update-many-JTKKSA7Y.js} +83 -68
  336. package/dist/cli-bundle/chunks/{update-many-RNSBX2TA.js.map → update-many-JTKKSA7Y.js.map} +1 -1
  337. package/dist/cli-bundle/chunks/{upgrade-HAK6JG2O.js → upgrade-DTAHZ236.js} +11 -11
  338. package/dist/cli-bundle/chunks/{upgrade-BRL6KCOJ.js → upgrade-JUDU7YL4.js} +11 -11
  339. package/dist/cli-bundle/chunks/{validate-MTUVL5VC.js → validate-732RWS5W.js} +440 -320
  340. package/dist/cli-bundle/chunks/validate-732RWS5W.js.map +7 -0
  341. package/dist/cli-bundle/chunks/{validate-X5W76YJL.js → validate-W7H5TEDC.js} +441 -321
  342. package/dist/cli-bundle/chunks/validate-W7H5TEDC.js.map +1 -0
  343. package/dist/cli-bundle/main.js +945 -812
  344. package/dist/cli-bundle/main.js.map +3 -3
  345. package/dist/core/config/nested-settings.js +89 -67
  346. package/dist/core/config/nested-settings.js.map +1 -1
  347. package/dist/core/governance/metadata-coverage.js +20 -28
  348. package/dist/core/governance/metadata-coverage.js.map +1 -1
  349. package/dist/core/history/drift-scan.js +93 -81
  350. package/dist/core/history/drift-scan.js.map +1 -1
  351. package/dist/core/item/item-type-definition.js +14 -14
  352. package/dist/core/item/item-type-definition.js.map +1 -1
  353. package/dist/core/item/type-registry.js +87 -82
  354. package/dist/core/item/type-registry.js.map +1 -1
  355. package/dist/core/output/mutation-projection.js +42 -26
  356. package/dist/core/output/mutation-projection.js.map +1 -1
  357. package/dist/core/schema/runtime-schema.js +34 -28
  358. package/dist/core/schema/runtime-schema.js.map +1 -1
  359. package/dist/core/search/semantic-defaults.js +64 -37
  360. package/dist/core/search/semantic-defaults.js.map +1 -1
  361. package/dist/core/search/vector-stores.js +32 -17
  362. package/dist/core/search/vector-stores.js.map +1 -1
  363. package/dist/core/sentry/helpers.js +31 -28
  364. package/dist/core/sentry/helpers.js.map +1 -1
  365. package/dist/core/sentry/instrument.js +54 -43
  366. package/dist/core/sentry/instrument.js.map +1 -1
  367. package/dist/core/store/front-matter-cache.js +239 -153
  368. package/dist/core/store/front-matter-cache.js.map +1 -1
  369. package/dist/core/store/item-store.js +33 -26
  370. package/dist/core/store/item-store.js.map +1 -1
  371. package/dist/core/store/settings.js +247 -203
  372. package/dist/core/store/settings.js.map +1 -1
  373. package/dist/core/test/background-runs.js +189 -160
  374. package/dist/core/test/background-runs.js.map +1 -1
  375. package/package.json +2 -2
  376. package/packages/pm-beads/extensions/beads/runtime.ts +240 -167
  377. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +65 -58
  378. package/packages/pm-todos/extensions/todos/runtime.ts +65 -42
  379. package/dist/cli-bundle/chunks/activity-AW6XVFH6.js +0 -16
  380. package/dist/cli-bundle/chunks/aggregate-JTEF4BP7.js.map +0 -1
  381. package/dist/cli-bundle/chunks/chunk-2D4HATP2.js.map +0 -1
  382. package/dist/cli-bundle/chunks/chunk-3S2KT7NG.js.map +0 -7
  383. package/dist/cli-bundle/chunks/chunk-3VGN2UWE.js.map +0 -1
  384. package/dist/cli-bundle/chunks/chunk-3XZCOZ5J.js.map +0 -1
  385. package/dist/cli-bundle/chunks/chunk-4DSGXSBL.js.map +0 -7
  386. package/dist/cli-bundle/chunks/chunk-4XOIEKSD.js.map +0 -1
  387. package/dist/cli-bundle/chunks/chunk-55SNVXRQ.js.map +0 -7
  388. package/dist/cli-bundle/chunks/chunk-5CGRF3L5.js.map +0 -1
  389. package/dist/cli-bundle/chunks/chunk-7R4QEMZZ.js.map +0 -1
  390. package/dist/cli-bundle/chunks/chunk-BDTISOSD.js.map +0 -7
  391. package/dist/cli-bundle/chunks/chunk-BZCEN4JA.js.map +0 -7
  392. package/dist/cli-bundle/chunks/chunk-CF7RL6FR.js.map +0 -1
  393. package/dist/cli-bundle/chunks/chunk-FFMQB7WR.js.map +0 -1
  394. package/dist/cli-bundle/chunks/chunk-IPYBJWTE.js.map +0 -7
  395. package/dist/cli-bundle/chunks/chunk-IZBR4NRW.js.map +0 -7
  396. package/dist/cli-bundle/chunks/chunk-JSU5P7VS.js.map +0 -1
  397. package/dist/cli-bundle/chunks/chunk-JWXRETDF.js.map +0 -1
  398. package/dist/cli-bundle/chunks/chunk-KNPEF7QG.js.map +0 -7
  399. package/dist/cli-bundle/chunks/chunk-NFDPYAIP.js.map +0 -7
  400. package/dist/cli-bundle/chunks/chunk-NUHHPVVS.js.map +0 -7
  401. package/dist/cli-bundle/chunks/chunk-NWMZWYYB.js.map +0 -1
  402. package/dist/cli-bundle/chunks/chunk-OTUHB4HS.js.map +0 -1
  403. package/dist/cli-bundle/chunks/chunk-RGEMWD6Q.js.map +0 -7
  404. package/dist/cli-bundle/chunks/chunk-RLDHZHQS.js.map +0 -1
  405. package/dist/cli-bundle/chunks/chunk-RMMQ74TG.js.map +0 -7
  406. package/dist/cli-bundle/chunks/chunk-RVUALSJF.js.map +0 -7
  407. package/dist/cli-bundle/chunks/chunk-TP5Q5ZD3.js.map +0 -1
  408. package/dist/cli-bundle/chunks/chunk-UYUYDGIB.js.map +0 -1
  409. package/dist/cli-bundle/chunks/chunk-V3NOKJF2.js.map +0 -1
  410. package/dist/cli-bundle/chunks/chunk-VARHOHYV.js.map +0 -7
  411. package/dist/cli-bundle/chunks/chunk-YITK2PJ6.js.map +0 -7
  412. package/dist/cli-bundle/chunks/chunk-ZETXE4SE.js.map +0 -1
  413. package/dist/cli-bundle/chunks/close-E6ZZGCJY.js +0 -14
  414. package/dist/cli-bundle/chunks/close-many-BG5QQIDQ.js.map +0 -7
  415. package/dist/cli-bundle/chunks/close-many-LDRVEQY2.js.map +0 -1
  416. package/dist/cli-bundle/chunks/config-DMSU64QO.js +0 -1541
  417. package/dist/cli-bundle/chunks/config-DMSU64QO.js.map +0 -7
  418. package/dist/cli-bundle/chunks/config-QH2DICD6.js +0 -1531
  419. package/dist/cli-bundle/chunks/config-QH2DICD6.js.map +0 -1
  420. package/dist/cli-bundle/chunks/contracts-HN7ABKLP.js.map +0 -7
  421. package/dist/cli-bundle/chunks/contracts-W4FZVVD6.js.map +0 -1
  422. package/dist/cli-bundle/chunks/create-OH3BDGBB.js +0 -28
  423. package/dist/cli-bundle/chunks/get-A7MAOHCU.js.map +0 -7
  424. package/dist/cli-bundle/chunks/get-DSDEKJ3L.js.map +0 -1
  425. package/dist/cli-bundle/chunks/health-3IPFLKXB.js.map +0 -1
  426. package/dist/cli-bundle/chunks/health-GZXGBZ36.js.map +0 -7
  427. package/dist/cli-bundle/chunks/history-WSZHY3PN.js +0 -18
  428. package/dist/cli-bundle/chunks/history-compact-2WRZ2WK4.js.map +0 -7
  429. package/dist/cli-bundle/chunks/history-compact-HR7BB4LR.js.map +0 -1
  430. package/dist/cli-bundle/chunks/history-redact-MP6CH7U5.js +0 -19
  431. package/dist/cli-bundle/chunks/history-repair-LCMOS45X.js.map +0 -7
  432. package/dist/cli-bundle/chunks/history-repair-XA3LC4GA.js.map +0 -1
  433. package/dist/cli-bundle/chunks/init-PAX32BJA.js +0 -22
  434. package/dist/cli-bundle/chunks/next-BCERKDUR.js.map +0 -7
  435. package/dist/cli-bundle/chunks/next-FYTQF6HG.js.map +0 -1
  436. package/dist/cli-bundle/chunks/plan-4WXEQCTN.js.map +0 -7
  437. package/dist/cli-bundle/chunks/plan-RKZHQVXR.js.map +0 -1
  438. package/dist/cli-bundle/chunks/register-list-query-7LV46VAU.js.map +0 -1
  439. package/dist/cli-bundle/chunks/register-list-query-SNG5PGA4.js.map +0 -7
  440. package/dist/cli-bundle/chunks/register-mutation-ENNDUAZG.js.map +0 -1
  441. package/dist/cli-bundle/chunks/register-mutation-KK7PHYYU.js.map +0 -7
  442. package/dist/cli-bundle/chunks/register-operations-C6OWLDSH.js.map +0 -1
  443. package/dist/cli-bundle/chunks/register-operations-HZ6XERQG.js.map +0 -7
  444. package/dist/cli-bundle/chunks/register-setup-P67EMBDJ.js.map +0 -1
  445. package/dist/cli-bundle/chunks/register-setup-ZKJ53RS7.js.map +0 -7
  446. package/dist/cli-bundle/chunks/restore-YALDGTQR.js +0 -17
  447. package/dist/cli-bundle/chunks/telemetry-BZUF6H7G.js.map +0 -1
  448. package/dist/cli-bundle/chunks/telemetry-GAHHQTOS.js.map +0 -7
  449. package/dist/cli-bundle/chunks/test-all-L2MDDUCA.js +0 -358
  450. package/dist/cli-bundle/chunks/test-all-L2MDDUCA.js.map +0 -1
  451. package/dist/cli-bundle/chunks/test-all-RBZ6DLU2.js +0 -361
  452. package/dist/cli-bundle/chunks/test-all-RBZ6DLU2.js.map +0 -7
  453. package/dist/cli-bundle/chunks/test-runs-PLRAZEFW.js.map +0 -7
  454. package/dist/cli-bundle/chunks/test-runs-UXIXPDKU.js.map +0 -1
  455. package/dist/cli-bundle/chunks/update-AMRSOIWP.js +0 -24
  456. package/dist/cli-bundle/chunks/validate-MTUVL5VC.js.map +0 -7
  457. package/dist/cli-bundle/chunks/validate-X5W76YJL.js.map +0 -1
  458. /package/dist/cli-bundle/chunks/{activity-DBLQVIP6.js.map → activity-CUC4JY3U.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{activity-AW6XVFH6.js.map → activity-WEIEMM73.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{append-QCFJSDFL.js.map → append-H32VOR2Y.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{append-LOVPGVPT.js.map → append-UBM632FK.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{chunk-SLMUGTK3.js.map → chunk-2ASNV4DH.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{chunk-UZIWVBE6.js.map → chunk-2CHRYUXL.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{chunk-NU2UEROZ.js.map → chunk-3AZUFQK6.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{chunk-LB6TP6MC.js.map → chunk-3LCUASYG.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{chunk-HPPFYYOV.js.map → chunk-3Q2HBMTI.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{chunk-W4ULYO7Z.js.map → chunk-55XRYWEG.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{chunk-HXTQJXWT.js.map → chunk-5GVTFFTC.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{chunk-64HNBBFQ.js.map → chunk-A6VOGKBA.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{chunk-WYDHYJPO.js.map → chunk-AIAIXG7I.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{chunk-CWFNTKQJ.js.map → chunk-AJEBCRIY.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{chunk-NOLPZMSV.js.map → chunk-BTX5MIQF.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{chunk-RH5ZBYFD.js.map → chunk-BVZZN2LH.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{chunk-27BXPBAY.js.map → chunk-CYBDUHNO.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{chunk-A7FPBAQS.js.map → chunk-CZPVDLD2.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{chunk-JPECA746.js.map → chunk-EUKTMRN3.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{chunk-2466X6E4.js.map → chunk-FFOQHGNH.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{chunk-JLM7BHI7.js.map → chunk-GFMSLORL.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{chunk-SDR5J34Q.js.map → chunk-GRRG3MCT.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{chunk-GJ326ZKX.js.map → chunk-H4GRLYJS.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{chunk-OGXLACHC.js.map → chunk-HQTPRV4D.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{chunk-BHO33VBQ.js.map → chunk-IEEJQCZ4.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{chunk-4DUVCVLZ.js.map → chunk-JMK5GCK2.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{chunk-AXIDKKAT.js.map → chunk-K2VYLVX4.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{chunk-EJUDVUYZ.js.map → chunk-KCO2EAN5.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{chunk-6AQZPVHQ.js.map → chunk-KIYCOJ63.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{chunk-ZRP4VG5U.js.map → chunk-KLXF7NCC.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{chunk-QCWF6IYD.js.map → chunk-KN3URLKS.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{chunk-N74UMG5H.js.map → chunk-LRKMWUUV.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{chunk-AVEE5EHK.js.map → chunk-LTRAF2D7.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{chunk-IJYK2T43.js.map → chunk-MRD4T5LF.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{chunk-G7I7DEZA.js.map → chunk-N2JSWVWG.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{chunk-5QFDBI4F.js.map → chunk-N3QCJS4M.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{chunk-4A3BJ675.js.map → chunk-OTUJZKGI.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{chunk-HZZEHPRG.js.map → chunk-QH3FSKRJ.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{chunk-NKZAN7BD.js.map → chunk-S62UANU7.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{chunk-3J6JRJ3I.js.map → chunk-SYNKD3ZG.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{chunk-L5OEFZQG.js.map → chunk-U2BEEM2X.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{chunk-EVMTBV6V.js.map → chunk-UT73HUPC.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{chunk-VICZWYGZ.js.map → chunk-UTSH5GWX.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{chunk-MDPEOIGN.js.map → chunk-XWGEMNBR.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{chunk-HYTGA6GI.js.map → chunk-Y4NRKBFW.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{chunk-22WKIL3H.js.map → chunk-YPKFV2JR.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{chunk-DDPTYJIM.js.map → chunk-ZNHEYCDD.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{chunk-MAUKX7JC.js.map → chunk-ZNT7KEWE.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{claim-T3GCKV7C.js.map → claim-SENTPZBN.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{claim-EMQLYPRW.js.map → claim-Z7MEQCBT.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{close-TQYAAFJP.js.map → close-424MX4CU.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{close-E6ZZGCJY.js.map → close-YCWQQPDS.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{comments-YUXJRZPQ.js.map → comments-4FGNTSNV.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{comments-QCKR2YY2.js.map → comments-7YS5MY5X.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{context-OCZ3FJ4Z.js.map → context-LHVKJSPJ.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{context-B6275WPX.js.map → context-ZQY54JNS.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{copy-DEM4DATS.js.map → copy-GYNQQPW2.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{copy-BTJOSKKT.js.map → copy-TLW7JTQT.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{create-RLRJMRTM.js.map → create-VSKYSOCD.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{create-OH3BDGBB.js.map → create-XTMAPS7I.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{delete-LSVHAB4Y.js.map → delete-4W5JYCEG.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{delete-BHK7VB2Z.js.map → delete-ANTOTI2I.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{deps-XHYXWEPT.js.map → deps-HPPE6MJN.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{deps-4UDFJRUA.js.map → deps-ZQZN54EZ.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{docs-GYZNVS26.js.map → docs-RPOVFMP3.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{docs-26S44RXU.js.map → docs-XJNYBJGE.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{eval-PGRVIJQU.js.map → eval-DM6JBZTS.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{eval-UYF3ZPVO.js.map → eval-RFBI5FGS.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{extension-CPSLJQVE.js.map → extension-B3YY4WY5.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{extension-CXJ6RELI.js.map → extension-TTSEFQTS.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{files-NQHEXUZD.js.map → files-5D65CHGE.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{files-MBNICQFM.js.map → files-GPIG77EN.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{focus-XZW5423D.js.map → focus-C3PEJV2C.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{focus-DWYIG7GU.js.map → focus-ZHN7WIGX.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{gc-LPVMKJQJ.js.map → gc-D4JQ6OWN.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{gc-7GQYOS2G.js.map → gc-VZIXDL32.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{history-WSZHY3PN.js.map → history-DD7L7BNL.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{history-NERDJNUB.js.map → history-IL7XCEX2.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{history-redact-MP6CH7U5.js.map → history-redact-IX4YEWMY.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{history-redact-O3NBCNWC.js.map → history-redact-VYCWQFK7.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{init-64XDLQJB.js.map → init-F27NHENZ.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{init-PAX32BJA.js.map → init-HHVQQP6C.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{learnings-LPKCSJX7.js.map → learnings-HJVDQIGY.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{learnings-JR6MA5TI.js.map → learnings-XSFSUUWK.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{list-G5Y65VF6.js.map → list-HPMEKCAA.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{list-DNBJVO3E.js.map → list-VMPWTURB.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{notes-2BMU3VVQ.js.map → notes-GDZIKGR6.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{notes-6KTGO2OJ.js.map → notes-WDDBPC4D.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{profile-QLER5ENE.js.map → profile-CCOKZ2IQ.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{profile-4OMM32CD.js.map → profile-HUCENIEQ.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{restore-4MHZFJ2E.js.map → restore-4CBWUMCX.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{restore-YALDGTQR.js.map → restore-5UEAGG3W.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-LB6DOLRL.js.map → scheduling-shortcuts-6VFKNKCM.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-UTOYKLXQ.js.map → scheduling-shortcuts-ERHCVTEM.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{schema-73HR2OJW.js.map → schema-TDGK6N3I.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{schema-U6LJKSIR.js.map → schema-UE5KKAUX.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{search-KILGT37L.js.map → search-FP7MEU4S.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{search-AXPXKZER.js.map → search-K4CFLQ5S.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{stats-PSYVVTNZ.js.map → stats-NJJCALEZ.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{stats-W5KNVJWQ.js.map → stats-XT6QRKQY.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{test-ACD52Z3S.js.map → test-UFSJ5YIO.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{test-PWDIZ255.js.map → test-YCDAUBWF.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{update-AMRSOIWP.js.map → update-MTCFES6X.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{update-KFX2SIAC.js.map → update-Y5WQVT5O.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{upgrade-HAK6JG2O.js.map → upgrade-DTAHZ236.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{upgrade-BRL6KCOJ.js.map → upgrade-JUDU7YL4.js.map} +0 -0
@@ -5,10 +5,10 @@ import {
5
5
  emitTelemetryErrorEvent,
6
6
  finishTelemetryCommand,
7
7
  startTelemetryCommand
8
- } from "./chunks/chunk-GJ326ZKX.js";
8
+ } from "./chunks/chunk-H4GRLYJS.js";
9
9
  import {
10
10
  migrateItemFilesToFormat
11
- } from "./chunks/chunk-NKZAN7BD.js";
11
+ } from "./chunks/chunk-S62UANU7.js";
12
12
  import {
13
13
  applyDefaultOutputFormat,
14
14
  clearResolvedGlobalOptions,
@@ -18,13 +18,13 @@ import {
18
18
  getGlobalOptions,
19
19
  invalidateSearchCachesForMutation,
20
20
  setResolvedGlobalOptions
21
- } from "./chunks/chunk-3J6JRJ3I.js";
21
+ } from "./chunks/chunk-SYNKD3ZG.js";
22
22
  import {
23
23
  printError,
24
24
  printResult,
25
25
  writeStdout
26
- } from "./chunks/chunk-BDTISOSD.js";
27
- import "./chunks/chunk-4DSGXSBL.js";
26
+ } from "./chunks/chunk-5PGBHRY3.js";
27
+ import "./chunks/chunk-7TH5NMVB.js";
28
28
  import {
29
29
  EXECUTABLE_COMMAND_ALIASES,
30
30
  applyBootstrapPagerPolicy,
@@ -35,14 +35,14 @@ import {
35
35
  parseBootstrapHelpRequest,
36
36
  parseBootstrapTypeValue,
37
37
  stripGlobalBootstrapTokens
38
- } from "./chunks/chunk-RH5ZBYFD.js";
38
+ } from "./chunks/chunk-BVZZN2LH.js";
39
39
  import {
40
40
  PM_CORE_COMMAND_NAMES,
41
41
  resolveSubcommandFlagContractsForCommand
42
- } from "./chunks/chunk-MDPEOIGN.js";
43
- import "./chunks/chunk-3K2M5OYU.js";
44
- import "./chunks/chunk-BHO33VBQ.js";
45
- import "./chunks/chunk-WYDHYJPO.js";
42
+ } from "./chunks/chunk-XWGEMNBR.js";
43
+ import "./chunks/chunk-JXAUVO6X.js";
44
+ import "./chunks/chunk-IEEJQCZ4.js";
45
+ import "./chunks/chunk-AIAIXG7I.js";
46
46
  import {
47
47
  BUILTIN_ITEM_TYPE_VALUES,
48
48
  EXIT_CODE,
@@ -90,7 +90,7 @@ import {
90
90
  setActiveExtensionServices,
91
91
  toNonEmptyStringOrUndefined,
92
92
  writeSettings
93
- } from "./chunks/chunk-RVUALSJF.js";
93
+ } from "./chunks/chunk-7NSPKJUS.js";
94
94
 
95
95
  // dist/cli/main.js
96
96
  import { Command } from "commander";
@@ -191,7 +191,7 @@ async function maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions) {
191
191
  !(function() {
192
192
  try {
193
193
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
194
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "1e5dec43-11a5-5a85-b2ab-e9a7d10fa478");
194
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "acfdb01f-4105-58f5-98a1-8c28cefa6aae");
195
195
  } catch (e2) {
196
196
  }
197
197
  })();
@@ -356,6 +356,51 @@ function resolveTracesSampleRate() {
356
356
  }
357
357
  return parsed;
358
358
  }
359
+ function scrubSentryExceptionValues(event) {
360
+ if (!event.exception?.values) {
361
+ return;
362
+ }
363
+ for (const exception of event.exception.values) {
364
+ if (exception.value) {
365
+ exception.value = scrubString(exception.value, "value");
366
+ }
367
+ if (exception.stacktrace?.frames) {
368
+ for (const frame of exception.stacktrace.frames) {
369
+ scrubStackFrame(frame);
370
+ }
371
+ }
372
+ }
373
+ }
374
+ function scrubSentryBreadcrumbs(event) {
375
+ if (!event.breadcrumbs) {
376
+ return;
377
+ }
378
+ for (const breadcrumb of event.breadcrumbs) {
379
+ if (breadcrumb.message) {
380
+ breadcrumb.message = scrubString(breadcrumb.message);
381
+ }
382
+ if (breadcrumb.data && typeof breadcrumb.data === "object") {
383
+ breadcrumb.data = scrubEventData(breadcrumb.data);
384
+ }
385
+ }
386
+ }
387
+ function scrubSentryContexts(event) {
388
+ if (!event.contexts) {
389
+ return;
390
+ }
391
+ for (const [ctxKey, ctx] of Object.entries(event.contexts)) {
392
+ if (ctx && typeof ctx === "object") {
393
+ event.contexts[ctxKey] = scrubEventData(ctx);
394
+ }
395
+ }
396
+ }
397
+ function scrubSentryRecordField(event, key) {
398
+ const target = event;
399
+ const value = target[key];
400
+ if (value && typeof value === "object") {
401
+ target[key] = scrubEventData(value);
402
+ }
403
+ }
359
404
  async function ensureSentryInit() {
360
405
  if (_initDone)
361
406
  return _sentry;
@@ -400,47 +445,13 @@ async function ensureSentryInit() {
400
445
  if (event.transaction) {
401
446
  event.transaction = scrubString(event.transaction, "transaction");
402
447
  }
403
- if (event.exception?.values) {
404
- for (const exception of event.exception.values) {
405
- if (exception.value) {
406
- exception.value = scrubString(exception.value, "value");
407
- }
408
- if (exception.stacktrace?.frames) {
409
- for (const frame of exception.stacktrace.frames) {
410
- scrubStackFrame(frame);
411
- }
412
- }
413
- }
414
- }
415
- if (event.breadcrumbs) {
416
- for (const breadcrumb of event.breadcrumbs) {
417
- if (breadcrumb.message) {
418
- breadcrumb.message = scrubString(breadcrumb.message);
419
- }
420
- if (breadcrumb.data && typeof breadcrumb.data === "object") {
421
- breadcrumb.data = scrubEventData(breadcrumb.data);
422
- }
423
- }
424
- }
425
- if (event.extra && typeof event.extra === "object") {
426
- event.extra = scrubEventData(event.extra);
427
- }
428
- if (event.contexts) {
429
- for (const [ctxKey, ctx] of Object.entries(event.contexts)) {
430
- if (ctx && typeof ctx === "object") {
431
- event.contexts[ctxKey] = scrubEventData(ctx);
432
- }
433
- }
434
- }
435
- if (event.request && typeof event.request === "object") {
436
- event.request = scrubEventData(event.request);
437
- }
438
- if (event.user && typeof event.user === "object") {
439
- event.user = scrubEventData(event.user);
440
- }
441
- if (event.tags && typeof event.tags === "object") {
442
- event.tags = scrubEventData(event.tags);
443
- }
448
+ scrubSentryExceptionValues(event);
449
+ scrubSentryBreadcrumbs(event);
450
+ scrubSentryRecordField(event, "extra");
451
+ scrubSentryContexts(event);
452
+ scrubSentryRecordField(event, "request");
453
+ scrubSentryRecordField(event, "user");
454
+ scrubSentryRecordField(event, "tags");
444
455
  return event;
445
456
  },
446
457
  beforeSendTransaction(event) {
@@ -487,7 +498,7 @@ function getSentry() {
487
498
  !(function() {
488
499
  try {
489
500
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
490
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "130c8e28-49f7-57d9-a522-1692a4f725c6");
501
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "3ab66a74-037d-56a6-9113-59c1e6d09872");
491
502
  } catch (e2) {
492
503
  }
493
504
  })();
@@ -501,6 +512,33 @@ function setSpanAttribute(span, key, value) {
501
512
  attributeTarget.setAttribute(key, value);
502
513
  }
503
514
  }
515
+ function setSentryTagIfPresent(Sentry, key, value) {
516
+ if (typeof value === "string" && value.trim().length > 0) {
517
+ Sentry.setTag(key, value);
518
+ }
519
+ }
520
+ function setSentryCommandFinishTags(Sentry, normalizedOk, metadata) {
521
+ Sentry.setTag("pm.ok", normalizedOk);
522
+ Sentry.setTag("pm.command_ok", normalizedOk);
523
+ if (typeof metadata?.exit_code === "number") {
524
+ Sentry.setTag("pm.exit_code", String(metadata.exit_code));
525
+ Sentry.setTag("pm.command_exit_code", String(metadata.exit_code));
526
+ }
527
+ setSentryTagIfPresent(Sentry, "pm.error_code", metadata?.error_code);
528
+ setSentryTagIfPresent(Sentry, "pm.error_category", metadata?.error_category);
529
+ setSentryTagIfPresent(Sentry, "pm.command_resolution", metadata?.command_resolution);
530
+ setSentryTagIfPresent(Sentry, "pm.resolution_stage", metadata?.resolution_stage);
531
+ }
532
+ function setCommandSpanFinishAttributes(span, normalizedOk, normalizedExitCode, metadata) {
533
+ setSpanAttribute(span, "pm.ok", normalizedOk);
534
+ setSpanAttribute(span, "pm.command_ok", normalizedOk);
535
+ setSpanAttribute(span, "pm.exit_code", normalizedExitCode);
536
+ setSpanAttribute(span, "pm.command_exit_code", normalizedExitCode);
537
+ setSpanAttribute(span, "pm.error_code", metadata?.error_code);
538
+ setSpanAttribute(span, "pm.error_category", metadata?.error_category);
539
+ setSpanAttribute(span, "pm.command_resolution", metadata?.command_resolution);
540
+ setSpanAttribute(span, "pm.resolution_stage", metadata?.resolution_stage);
541
+ }
504
542
  function sentrySetCommandContext(command, args, options, metadata) {
505
543
  const Sentry = getSentry();
506
544
  if (!Sentry)
@@ -552,33 +590,9 @@ function sentryFinishCommandSpan(ok, error, metadata) {
552
590
  const normalizedExitCode = typeof metadata?.exit_code === "number" ? String(metadata.exit_code) : void 0;
553
591
  const Sentry = getSentry();
554
592
  if (Sentry) {
555
- Sentry.setTag("pm.ok", normalizedOk);
556
- Sentry.setTag("pm.command_ok", normalizedOk);
557
- if (typeof metadata?.exit_code === "number") {
558
- Sentry.setTag("pm.exit_code", String(metadata.exit_code));
559
- Sentry.setTag("pm.command_exit_code", String(metadata.exit_code));
560
- }
561
- if (typeof metadata?.error_code === "string" && metadata.error_code.trim().length > 0) {
562
- Sentry.setTag("pm.error_code", metadata.error_code);
563
- }
564
- if (typeof metadata?.error_category === "string" && metadata.error_category.trim().length > 0) {
565
- Sentry.setTag("pm.error_category", metadata.error_category);
566
- }
567
- if (typeof metadata?.command_resolution === "string" && metadata.command_resolution.trim().length > 0) {
568
- Sentry.setTag("pm.command_resolution", metadata.command_resolution);
569
- }
570
- if (typeof metadata?.resolution_stage === "string" && metadata.resolution_stage.trim().length > 0) {
571
- Sentry.setTag("pm.resolution_stage", metadata.resolution_stage);
572
- }
593
+ setSentryCommandFinishTags(Sentry, normalizedOk, metadata);
573
594
  }
574
- setSpanAttribute(activeCommandSpan, "pm.ok", normalizedOk);
575
- setSpanAttribute(activeCommandSpan, "pm.command_ok", normalizedOk);
576
- setSpanAttribute(activeCommandSpan, "pm.exit_code", normalizedExitCode);
577
- setSpanAttribute(activeCommandSpan, "pm.command_exit_code", normalizedExitCode);
578
- setSpanAttribute(activeCommandSpan, "pm.error_code", metadata?.error_code);
579
- setSpanAttribute(activeCommandSpan, "pm.error_category", metadata?.error_category);
580
- setSpanAttribute(activeCommandSpan, "pm.command_resolution", metadata?.command_resolution);
581
- setSpanAttribute(activeCommandSpan, "pm.resolution_stage", metadata?.resolution_stage);
595
+ setCommandSpanFinishAttributes(activeCommandSpan, normalizedOk, normalizedExitCode, metadata);
582
596
  activeCommandSpan.setStatus(ok ? { code: 1 } : { code: 2, message: error ?? "command_failed" });
583
597
  activeCommandSpan.end();
584
598
  activeCommandSpan = void 0;
@@ -1909,7 +1923,7 @@ function renderPmCommand(argv) {
1909
1923
  !(function() {
1910
1924
  try {
1911
1925
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
1912
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4fdf7d5d-e4c8-5f0c-a969-2ed905b3a5dc");
1926
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "594fd898-5ce1-5e77-8731-5bcd90c16f9a");
1913
1927
  } catch (e2) {
1914
1928
  }
1915
1929
  })();
@@ -1959,67 +1973,66 @@ function renderList(title, entries) {
1959
1973
  }
1960
1974
  return [title, ...entries.map((entry) => ` - ${entry}`)];
1961
1975
  }
1976
+ function normalizeStringArray(values) {
1977
+ if (!Array.isArray(values)) {
1978
+ return void 0;
1979
+ }
1980
+ const normalized = values.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1981
+ return normalized.length > 0 ? normalized : void 0;
1982
+ }
1983
+ function normalizeRecoveryCandidates(candidates) {
1984
+ if (!Array.isArray(candidates)) {
1985
+ return void 0;
1986
+ }
1987
+ const normalized = candidates.map((entry) => ({
1988
+ source: typeof entry?.source === "string" ? entry.source.trim() : "",
1989
+ command: typeof entry?.command === "string" ? entry.command.trim() : "",
1990
+ reason: typeof entry?.reason === "string" ? entry.reason.trim() : ""
1991
+ })).filter((entry) => entry.source.length > 0 && entry.command.length > 0 && entry.reason.length > 0);
1992
+ return normalized.length > 0 ? normalized : void 0;
1993
+ }
1994
+ function assignRecoveryString(normalized, key, value) {
1995
+ if (typeof value === "string" && value.trim().length > 0) {
1996
+ normalized[key] = value.trim();
1997
+ }
1998
+ }
1999
+ function assignRecoveryStringArray(normalized, key, value) {
2000
+ const values = normalizeStringArray(value);
2001
+ if (values) {
2002
+ normalized[key] = values;
2003
+ }
2004
+ }
1962
2005
  function normalizeRecoveryPayload(payload) {
1963
2006
  if (!payload || typeof payload !== "object") {
1964
2007
  return void 0;
1965
2008
  }
1966
- const normalizeStringArray = (values) => {
1967
- if (!Array.isArray(values)) {
1968
- return void 0;
1969
- }
1970
- const normalized2 = values.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1971
- return normalized2.length > 0 ? normalized2 : void 0;
1972
- };
1973
2009
  const normalized = {};
1974
2010
  if (payload.recovery_mode === "compact") {
1975
2011
  normalized.recovery_mode = "compact";
1976
2012
  }
1977
- if (typeof payload.attempted_command === "string" && payload.attempted_command.trim().length > 0) {
1978
- normalized.attempted_command = payload.attempted_command.trim();
1979
- }
1980
- if (Array.isArray(payload.normalized_args)) {
1981
- const args = payload.normalized_args.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1982
- if (args.length > 0) {
1983
- normalized.normalized_args = args;
1984
- }
1985
- }
1986
- if (Array.isArray(payload.provided_fields)) {
1987
- const fields = payload.provided_fields.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1988
- if (fields.length > 0) {
1989
- normalized.provided_fields = fields;
1990
- }
1991
- }
1992
- if (Array.isArray(payload.missing)) {
1993
- const missing = payload.missing.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1994
- if (missing.length > 0) {
1995
- normalized.missing = missing;
1996
- }
1997
- }
1998
- const missingRequiredFields = normalizeStringArray(payload.missing_required_fields);
1999
- if (missingRequiredFields) {
2000
- normalized.missing_required_fields = missingRequiredFields;
2001
- }
2002
- const suggestedFlags = normalizeStringArray(payload.suggested_flags);
2003
- if (suggestedFlags) {
2004
- normalized.suggested_flags = suggestedFlags;
2005
- }
2006
- if (typeof payload.suggested_retry === "string" && payload.suggested_retry.trim().length > 0) {
2007
- normalized.suggested_retry = payload.suggested_retry.trim();
2008
- }
2009
- if (Array.isArray(payload.fallback_candidates)) {
2010
- const fallbackCandidates = payload.fallback_candidates.map((entry) => ({
2011
- source: typeof entry?.source === "string" ? entry.source.trim() : "",
2012
- command: typeof entry?.command === "string" ? entry.command.trim() : "",
2013
- reason: typeof entry?.reason === "string" ? entry.reason.trim() : ""
2014
- })).filter((entry) => entry.source.length > 0 && entry.command.length > 0 && entry.reason.length > 0);
2015
- if (fallbackCandidates.length > 0) {
2016
- normalized.fallback_candidates = fallbackCandidates;
2017
- }
2013
+ assignRecoveryString(normalized, "attempted_command", payload.attempted_command);
2014
+ assignRecoveryStringArray(normalized, "normalized_args", payload.normalized_args);
2015
+ assignRecoveryStringArray(normalized, "provided_fields", payload.provided_fields);
2016
+ assignRecoveryStringArray(normalized, "missing", payload.missing);
2017
+ assignRecoveryStringArray(normalized, "missing_required_fields", payload.missing_required_fields);
2018
+ assignRecoveryStringArray(normalized, "suggested_flags", payload.suggested_flags);
2019
+ assignRecoveryString(normalized, "suggested_retry", payload.suggested_retry);
2020
+ const fallbackCandidates = normalizeRecoveryCandidates(payload.fallback_candidates);
2021
+ if (fallbackCandidates) {
2022
+ normalized.fallback_candidates = fallbackCandidates;
2023
+ }
2024
+ assignRecoveryString(normalized, "next_best_command", payload.next_best_command);
2025
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
2026
+ }
2027
+ function appendRecoveryTextLine(lines, label, value) {
2028
+ if (value) {
2029
+ lines.push(` ${label}: ${value}`);
2018
2030
  }
2019
- if (typeof payload.next_best_command === "string" && payload.next_best_command.trim().length > 0) {
2020
- normalized.next_best_command = payload.next_best_command.trim();
2031
+ }
2032
+ function appendRecoveryListLine(lines, label, values, separator) {
2033
+ if (values && values.length > 0) {
2034
+ lines.push(` ${label}: ${values.join(separator)}`);
2021
2035
  }
2022
- return Object.keys(normalized).length > 0 ? normalized : void 0;
2023
2036
  }
2024
2037
  function renderRecoveryBundle(recovery) {
2025
2038
  const normalized = normalizeRecoveryPayload(recovery);
@@ -2027,30 +2040,14 @@ function renderRecoveryBundle(recovery) {
2027
2040
  return [];
2028
2041
  }
2029
2042
  const lines = ["Recovery bundle:"];
2030
- if (normalized.attempted_command) {
2031
- lines.push(` attempted_command: ${normalized.attempted_command}`);
2032
- }
2033
- if (normalized.normalized_args && normalized.normalized_args.length > 0) {
2034
- lines.push(` normalized_args: ${normalized.normalized_args.join(" ")}`);
2035
- }
2036
- if (normalized.provided_fields && normalized.provided_fields.length > 0) {
2037
- lines.push(` provided_fields: ${normalized.provided_fields.join(", ")}`);
2038
- }
2039
- if (normalized.missing && normalized.missing.length > 0) {
2040
- lines.push(` missing: ${normalized.missing.join(", ")}`);
2041
- }
2042
- if (normalized.missing_required_fields && normalized.missing_required_fields.length > 0) {
2043
- lines.push(` missing_required_fields: ${normalized.missing_required_fields.join(", ")}`);
2044
- }
2045
- if (normalized.suggested_flags && normalized.suggested_flags.length > 0) {
2046
- lines.push(` suggested_flags: ${normalized.suggested_flags.join(", ")}`);
2047
- }
2048
- if (normalized.suggested_retry) {
2049
- lines.push(` suggested_retry: ${normalized.suggested_retry}`);
2050
- }
2051
- if (normalized.next_best_command) {
2052
- lines.push(` next_best_command: ${normalized.next_best_command}`);
2053
- }
2043
+ appendRecoveryTextLine(lines, "attempted_command", normalized.attempted_command);
2044
+ appendRecoveryListLine(lines, "normalized_args", normalized.normalized_args, " ");
2045
+ appendRecoveryListLine(lines, "provided_fields", normalized.provided_fields, ", ");
2046
+ appendRecoveryListLine(lines, "missing", normalized.missing, ", ");
2047
+ appendRecoveryListLine(lines, "missing_required_fields", normalized.missing_required_fields, ", ");
2048
+ appendRecoveryListLine(lines, "suggested_flags", normalized.suggested_flags, ", ");
2049
+ appendRecoveryTextLine(lines, "suggested_retry", normalized.suggested_retry);
2050
+ appendRecoveryTextLine(lines, "next_best_command", normalized.next_best_command);
2054
2051
  if (normalized.fallback_candidates && normalized.fallback_candidates.length > 0) {
2055
2052
  lines.push(" fallback_candidates:");
2056
2053
  for (const candidate of normalized.fallback_candidates) {
@@ -2225,133 +2222,158 @@ function applyPmCliErrorContext(guidance, rawMessage, context) {
2225
2222
  recovery
2226
2223
  };
2227
2224
  }
2228
- function buildPmCliErrorGuidance(rawMessage, context) {
2229
- const message = normalizeMessage(rawMessage);
2225
+ function buildTrackerNotInitializedGuidance(rawMessage, message, context) {
2230
2226
  const trackerNotInitialized = message.match(/^Tracker is not initialized at (.+)\. Run pm init first\.$/);
2231
- if (trackerNotInitialized) {
2232
- return applyPmCliErrorContext(makeGuidanceMessage({
2233
- code: "tracker_not_initialized",
2234
- title: "Tracker is not initialized",
2235
- happened: `pm data path does not contain initialized tracker metadata (${trackerNotInitialized[1]}).`,
2236
- required: "Initialize tracker storage before running this command.",
2237
- why: "Most commands require settings and tracker directories created by pm init.",
2238
- examples: ["pm init", "pm init acme"],
2239
- nextSteps: ['Run "pm init", then rerun your original command.']
2240
- }), rawMessage, context);
2227
+ if (!trackerNotInitialized) {
2228
+ return null;
2241
2229
  }
2230
+ return applyPmCliErrorContext(makeGuidanceMessage({
2231
+ code: "tracker_not_initialized",
2232
+ title: "Tracker is not initialized",
2233
+ happened: `pm data path does not contain initialized tracker metadata (${trackerNotInitialized[1]}).`,
2234
+ required: "Initialize tracker storage before running this command.",
2235
+ why: "Most commands require settings and tracker directories created by pm init.",
2236
+ examples: ["pm init", "pm init acme"],
2237
+ nextSteps: ['Run "pm init", then rerun your original command.']
2238
+ }), rawMessage, context);
2239
+ }
2240
+ function buildItemNotFoundGuidance(rawMessage, message, context) {
2242
2241
  const itemNotFound = message.match(/^Item ([^ ]+) not found$/);
2243
- if (itemNotFound) {
2244
- const badId = itemNotFound[1];
2245
- const isPlaceholder = /^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(badId);
2246
- const happened = isPlaceholder ? `The item ID "${badId}" looks like a placeholder or unresolved variable. Ensure the ID argument is resolved before calling pm.` : `No item with id "${badId}" exists in the active tracker scope.`;
2247
- const nextSteps = isPlaceholder ? [
2248
- "Check that the variable holding the item ID is defined before passing it to pm.",
2249
- 'Use "pm list-open --limit 20" to find valid IDs.'
2250
- ] : ["Confirm the active --path/PM_PATH scope, then retry with a valid id."];
2251
- return applyPmCliErrorContext(makeGuidanceMessage({
2252
- code: "item_not_found",
2253
- title: "Item ID not found",
2254
- happened,
2255
- required: "Use an existing item ID from current tracker data.",
2256
- why: "Mutation and read commands operate only on known IDs.",
2257
- examples: ["pm list-open --limit 20", 'pm search "<keyword>" --limit 10'],
2258
- nextSteps
2259
- }), rawMessage, context);
2260
- }
2261
- if (message.includes("is assigned to") && message.includes("Use --force to override")) {
2262
- return applyPmCliErrorContext(makeGuidanceMessage({
2263
- code: "ownership_conflict",
2264
- title: "Ownership conflict",
2265
- happened: message,
2266
- required: "Run as assigned owner, use audit flags for safe non-owner updates, or use --force only for approved override scenarios.",
2267
- why: "Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",
2268
- examples: [
2269
- 'pm update pm-a1b2 --allow-audit-update --description "..." --author "audit-agent"',
2270
- 'pm update pm-a1b2 --allow-audit-dep-update --dep "..." --author "audit-agent"',
2271
- 'pm comments pm-a1b2 "..." --allow-audit-comment --author "audit-agent"',
2272
- 'pm claim pm-a1b2 --author "codex-agent"',
2273
- 'pm release pm-a1b2 --allow-audit-release --author "reviewer"',
2274
- "pm update pm-a1b2 --status in_progress --force"
2275
- ],
2276
- nextSteps: [
2277
- "Use --allow-audit-update for metadata-only non-owner updates (excludes lifecycle/ownership fields).",
2278
- "Use --allow-audit-dep-update for dependency-only non-owner additions.",
2279
- "Use --allow-audit-comment on comments/notes/learnings for append-only audit entries.",
2280
- "Use --force for PM audits and systematic metadata updates performed by leads/maintainers.",
2281
- "Use --force when correcting known stale metadata after coordinating ownership changes.",
2282
- 'For non-terminal reassignment, prefer "pm claim <ID> --author <you>" before running other mutations.',
2283
- 'For assignee handoff release workflows, prefer "pm release <ID> --allow-audit-release --author <you>" before using --force.'
2284
- ]
2285
- }), rawMessage, context);
2242
+ if (!itemNotFound) {
2243
+ return null;
2286
2244
  }
2287
- if (message.includes("is locked")) {
2288
- return applyPmCliErrorContext(makeGuidanceMessage({
2289
- code: "lock_conflict",
2290
- title: "Lock conflict",
2291
- happened: message,
2292
- required: "Wait for lock release, or use --force where supported if lock is stale and safe to override.",
2293
- why: "Locking protects item files from concurrent write races.",
2294
- examples: ['pm update pm-a1b2 --status in_progress --force --author "codex-agent"']
2295
- }), rawMessage, context);
2245
+ const badId = itemNotFound[1];
2246
+ const isPlaceholder = /^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(badId);
2247
+ const happened = isPlaceholder ? `The item ID "${badId}" looks like a placeholder or unresolved variable. Ensure the ID argument is resolved before calling pm.` : `No item with id "${badId}" exists in the active tracker scope.`;
2248
+ const nextSteps = isPlaceholder ? [
2249
+ "Check that the variable holding the item ID is defined before passing it to pm.",
2250
+ 'Use "pm list-open --limit 20" to find valid IDs.'
2251
+ ] : ["Confirm the active --path/PM_PATH scope, then retry with a valid id."];
2252
+ return applyPmCliErrorContext(makeGuidanceMessage({
2253
+ code: "item_not_found",
2254
+ title: "Item ID not found",
2255
+ happened,
2256
+ required: "Use an existing item ID from current tracker data.",
2257
+ why: "Mutation and read commands operate only on known IDs.",
2258
+ examples: ["pm list-open --limit 20", 'pm search "<keyword>" --limit 10'],
2259
+ nextSteps
2260
+ }), rawMessage, context);
2261
+ }
2262
+ function buildOwnershipConflictGuidance(rawMessage, message, context) {
2263
+ if (!message.includes("is assigned to") || !message.includes("Use --force to override")) {
2264
+ return null;
2265
+ }
2266
+ return applyPmCliErrorContext(makeGuidanceMessage({
2267
+ code: "ownership_conflict",
2268
+ title: "Ownership conflict",
2269
+ happened: message,
2270
+ required: "Run as assigned owner, use audit flags for safe non-owner updates, or use --force only for approved override scenarios.",
2271
+ why: "Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",
2272
+ examples: [
2273
+ 'pm update pm-a1b2 --allow-audit-update --description "..." --author "audit-agent"',
2274
+ 'pm update pm-a1b2 --allow-audit-dep-update --dep "..." --author "audit-agent"',
2275
+ 'pm comments pm-a1b2 "..." --allow-audit-comment --author "audit-agent"',
2276
+ 'pm claim pm-a1b2 --author "codex-agent"',
2277
+ 'pm release pm-a1b2 --allow-audit-release --author "reviewer"',
2278
+ "pm update pm-a1b2 --status in_progress --force"
2279
+ ],
2280
+ nextSteps: [
2281
+ "Use --allow-audit-update for metadata-only non-owner updates (excludes lifecycle/ownership fields).",
2282
+ "Use --allow-audit-dep-update for dependency-only non-owner additions.",
2283
+ "Use --allow-audit-comment on comments/notes/learnings for append-only audit entries.",
2284
+ "Use --force for PM audits and systematic metadata updates performed by leads/maintainers.",
2285
+ "Use --force when correcting known stale metadata after coordinating ownership changes.",
2286
+ 'For non-terminal reassignment, prefer "pm claim <ID> --author <you>" before running other mutations.',
2287
+ 'For assignee handoff release workflows, prefer "pm release <ID> --allow-audit-release --author <you>" before using --force.'
2288
+ ]
2289
+ }), rawMessage, context);
2290
+ }
2291
+ function buildLockConflictGuidance(rawMessage, message, context) {
2292
+ if (!message.includes("is locked")) {
2293
+ return null;
2296
2294
  }
2295
+ return applyPmCliErrorContext(makeGuidanceMessage({
2296
+ code: "lock_conflict",
2297
+ title: "Lock conflict",
2298
+ happened: message,
2299
+ required: "Wait for lock release, or use --force where supported if lock is stale and safe to override.",
2300
+ why: "Locking protects item files from concurrent write races.",
2301
+ examples: ['pm update pm-a1b2 --status in_progress --force --author "codex-agent"']
2302
+ }), rawMessage, context);
2303
+ }
2304
+ function buildPmMissingRequiredOptionGuidance(rawMessage, message, context) {
2297
2305
  const missingRequiredOption = message.match(/^Missing required option /);
2298
2306
  const missingRequiredOptions = message.match(/^Missing required options /);
2299
- if (missingRequiredOption || missingRequiredOptions) {
2300
- const plural = Boolean(missingRequiredOptions);
2301
- const missingOptionFlag = !plural ? message.replace(/^Missing required option\s+/, "").trim() : null;
2302
- const missingOptionLabel = missingOptionFlag ?? "";
2303
- const missingOptionRequired = missingOptionFlag ? `Pass ${missingOptionFlag} with a valid value before running the command.` : "Provide the required option for this command invocation.";
2304
- return applyPmCliErrorContext(makeGuidanceMessage({
2305
- code: "missing_required_option",
2306
- title: plural ? "Missing required options" : `Missing required option ${missingOptionLabel}`,
2307
- happened: message,
2308
- required: plural ? "Provide every required option for this command invocation." : missingOptionRequired,
2309
- why: "Required options define command intent and enforce deterministic write contracts.",
2310
- examples: [
2311
- 'pm create --title "Task title" --description "Task details" --type Task --create-mode progressive',
2312
- 'pm create --title "Task title" --description "Task details" --type Task --status open --priority 1 --message "Create task" --dep "id=pm-epic01,kind=parent,author=codex-agent,created_at=now" --comment "author=codex-agent,created_at=now,text=Why this task exists." --note "author=codex-agent,created_at=now,text=Initial implementation note." --learning "author=codex-agent,created_at=now,text=Durable lesson placeholder." --file "path=src/example.ts,scope=project" --test "command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240" --doc "path=README.md,scope=project"'
2313
- ],
2314
- nextSteps: [
2315
- 'Run "pm <command> --help" to view required and recommended flags.',
2316
- "For staged triage without placeholder linkage values, use --create-mode progressive."
2317
- ]
2318
- }), rawMessage, context);
2319
- }
2320
- if (message.startsWith("No update flags provided")) {
2321
- return applyPmCliErrorContext(makeGuidanceMessage({
2322
- code: "no_update_fields",
2323
- title: "No update fields supplied",
2324
- happened: "The update command was called without any field-changing flags.",
2325
- required: "Provide at least one field-changing flag such as --status, --priority, --title, --tags, --description, or --body. Use --message only to label a real mutation.",
2326
- why: "pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",
2327
- examples: [
2328
- 'pm update pm-a1b2 --status in_progress --message "Start implementation"',
2329
- 'pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"',
2330
- 'pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'
2331
- ],
2332
- nextSteps: [
2333
- "Choose the item field you intend to change, then pair that change with --message for history context.",
2334
- "Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."
2335
- ]
2336
- }), rawMessage, context);
2337
- }
2338
- if (message.startsWith("Invalid ") || message.includes(" must be ") || message.includes(" requires ")) {
2339
- const recovery = normalizeRecoveryPayload(context?.recovery);
2340
- const commandName = inferCommandNameFromRecovery(recovery);
2341
- const helpExample = commandName ? `pm ${commandName} --help` : "pm <command> --help";
2342
- const allowedValues = inferAllowedValuesFromMessage(message);
2343
- const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
2344
- const examples = retryExample ? [retryExample, helpExample] : [helpExample, "pm contracts --command <command> --flags-only --json"];
2345
- const nextSteps = allowedValues.length > 0 ? [`Allowed values: ${allowedValues.join("|")}`, `Run "${helpExample}" to confirm command-specific constraints.`] : ["Check allowed values in command help, then rerun with corrected input."];
2346
- return applyPmCliErrorContext(makeGuidanceMessage({
2347
- code: "invalid_argument_value",
2348
- title: "Invalid argument value",
2349
- happened: message,
2350
- required: "Use values that match documented command constraints.",
2351
- why: "Validation protects data consistency and deterministic behavior across commands.",
2352
- examples,
2353
- nextSteps
2354
- }), rawMessage, context);
2307
+ if (!missingRequiredOption && !missingRequiredOptions) {
2308
+ return null;
2309
+ }
2310
+ const plural = Boolean(missingRequiredOptions);
2311
+ const missingOptionFlag = !plural ? message.replace(/^Missing required option\s+/, "").trim() : null;
2312
+ const missingOptionLabel = missingOptionFlag ?? "";
2313
+ const missingOptionRequired = missingOptionFlag ? `Pass ${missingOptionFlag} with a valid value before running the command.` : "Provide the required option for this command invocation.";
2314
+ return applyPmCliErrorContext(makeGuidanceMessage({
2315
+ code: "missing_required_option",
2316
+ title: plural ? "Missing required options" : `Missing required option ${missingOptionLabel}`,
2317
+ happened: message,
2318
+ required: plural ? "Provide every required option for this command invocation." : missingOptionRequired,
2319
+ why: "Required options define command intent and enforce deterministic write contracts.",
2320
+ examples: [
2321
+ 'pm create --title "Task title" --description "Task details" --type Task --create-mode progressive',
2322
+ 'pm create --title "Task title" --description "Task details" --type Task --status open --priority 1 --message "Create task" --dep "id=pm-epic01,kind=parent,author=codex-agent,created_at=now" --comment "author=codex-agent,created_at=now,text=Why this task exists." --note "author=codex-agent,created_at=now,text=Initial implementation note." --learning "author=codex-agent,created_at=now,text=Durable lesson placeholder." --file "path=src/example.ts,scope=project" --test "command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240" --doc "path=README.md,scope=project"'
2323
+ ],
2324
+ nextSteps: [
2325
+ 'Run "pm <command> --help" to view required and recommended flags.',
2326
+ "For staged triage without placeholder linkage values, use --create-mode progressive."
2327
+ ]
2328
+ }), rawMessage, context);
2329
+ }
2330
+ function buildNoUpdateFieldsGuidance(rawMessage, message, context) {
2331
+ if (!message.startsWith("No update flags provided")) {
2332
+ return null;
2333
+ }
2334
+ return applyPmCliErrorContext(makeGuidanceMessage({
2335
+ code: "no_update_fields",
2336
+ title: "No update fields supplied",
2337
+ happened: "The update command was called without any field-changing flags.",
2338
+ required: "Provide at least one field-changing flag such as --status, --priority, --title, --tags, --description, or --body. Use --message only to label a real mutation.",
2339
+ why: "pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",
2340
+ examples: [
2341
+ 'pm update pm-a1b2 --status in_progress --message "Start implementation"',
2342
+ 'pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"',
2343
+ 'pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'
2344
+ ],
2345
+ nextSteps: [
2346
+ "Choose the item field you intend to change, then pair that change with --message for history context.",
2347
+ "Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."
2348
+ ]
2349
+ }), rawMessage, context);
2350
+ }
2351
+ function buildInvalidArgumentGuidance(rawMessage, message, context) {
2352
+ if (!message.startsWith("Invalid ") && !message.includes(" must be ") && !message.includes(" requires ")) {
2353
+ return null;
2354
+ }
2355
+ const recovery = normalizeRecoveryPayload(context?.recovery);
2356
+ const commandName = inferCommandNameFromRecovery(recovery);
2357
+ const helpExample = commandName ? `pm ${commandName} --help` : "pm <command> --help";
2358
+ const allowedValues = inferAllowedValuesFromMessage(message);
2359
+ const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
2360
+ const examples = retryExample ? [retryExample, helpExample] : [helpExample, "pm contracts --command <command> --flags-only --json"];
2361
+ const nextSteps = allowedValues.length > 0 ? [`Allowed values: ${allowedValues.join("|")}`, `Run "${helpExample}" to confirm command-specific constraints.`] : ["Check allowed values in command help, then rerun with corrected input."];
2362
+ return applyPmCliErrorContext(makeGuidanceMessage({
2363
+ code: "invalid_argument_value",
2364
+ title: "Invalid argument value",
2365
+ happened: message,
2366
+ required: "Use values that match documented command constraints.",
2367
+ why: "Validation protects data consistency and deterministic behavior across commands.",
2368
+ examples,
2369
+ nextSteps
2370
+ }), rawMessage, context);
2371
+ }
2372
+ function buildPmCliErrorGuidance(rawMessage, context) {
2373
+ const message = normalizeMessage(rawMessage);
2374
+ const guidance = buildTrackerNotInitializedGuidance(rawMessage, message, context) ?? buildItemNotFoundGuidance(rawMessage, message, context) ?? buildOwnershipConflictGuidance(rawMessage, message, context) ?? buildLockConflictGuidance(rawMessage, message, context) ?? buildPmMissingRequiredOptionGuidance(rawMessage, message, context) ?? buildNoUpdateFieldsGuidance(rawMessage, message, context) ?? buildInvalidArgumentGuidance(rawMessage, message, context);
2375
+ if (guidance) {
2376
+ return guidance;
2355
2377
  }
2356
2378
  return applyPmCliErrorContext(makeGuidanceMessage({
2357
2379
  code: "command_failed",
@@ -2471,147 +2493,173 @@ function buildLinkedTestQuotedRetryCommand(argv) {
2471
2493
  }
2472
2494
  return void 0;
2473
2495
  }
2474
- function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context) {
2475
- const message = normalizeMessage(rawMessage);
2496
+ function buildMissingRequiredOptionGuidance(message, commandName, allowedTypes, context) {
2476
2497
  const requiredOption = message.match(/required option '([^']+)' not specified/);
2477
- if (requiredOption) {
2478
- const optionFlag = normalizeRequiredOptionLabel(requiredOption[1]);
2479
- const isType = optionFlag.startsWith("--type");
2480
- const retryCommand = context?.suggestedRetryCommand;
2481
- const providedFlags = normalizeOptionFlags(context?.providedOptionFlags);
2482
- const missing = [optionFlag];
2483
- const examples = commandExampleForRequiredOption(commandName, optionFlag, allowedTypes);
2484
- const examplesWithRetry = retryCommand ? appendIfMissing(examples, retryCommand) : examples;
2485
- const nextStepsBase = isType ? [`Allowed type values: ${allowedTypes}`, `Run "pm ${commandName ?? "create"} --help --type <value>" for type-aware policy details.`] : [`Run "pm ${commandName ?? "<command>"} --help" for required option guidance.`];
2486
- const nextStepsWithRetry = retryCommand ? appendIfMissing(nextStepsBase, `Replay with preserved arguments: ${retryCommand}`) : nextStepsBase;
2487
- const nextSteps = providedFlags && providedFlags.length > 0 ? appendIfMissing(nextStepsWithRetry, `Already provided options: ${providedFlags.join(", ")}`) : nextStepsWithRetry;
2488
- return makeGuidanceMessage({
2489
- code: "missing_required_option",
2490
- title: `Missing required option ${optionFlag}`,
2491
- happened: `Commander rejected the command because ${optionFlag} was not provided.`,
2492
- required: `Pass ${optionFlag} with a valid value before running the command.`,
2493
- why: isType ? "--type selects item contract and policy routing, including required/disabled option rules." : "Required flags define mandatory command intent and prevent ambiguous execution.",
2494
- examples: examplesWithRetry,
2495
- nextSteps,
2496
- recovery: buildCommanderRecoveryPayload(context, { missing })
2497
- });
2498
+ if (!requiredOption) {
2499
+ return null;
2498
2500
  }
2501
+ const optionFlag = normalizeRequiredOptionLabel(requiredOption[1]);
2502
+ const isType = optionFlag.startsWith("--type");
2503
+ const retryCommand = context?.suggestedRetryCommand;
2504
+ const providedFlags = normalizeOptionFlags(context?.providedOptionFlags);
2505
+ const missing = [optionFlag];
2506
+ const examples = commandExampleForRequiredOption(commandName, optionFlag, allowedTypes);
2507
+ const examplesWithRetry = retryCommand ? appendIfMissing(examples, retryCommand) : examples;
2508
+ const nextStepsBase = isType ? [`Allowed type values: ${allowedTypes}`, `Run "pm ${commandName ?? "create"} --help --type <value>" for type-aware policy details.`] : [`Run "pm ${commandName ?? "<command>"} --help" for required option guidance.`];
2509
+ const nextStepsWithRetry = retryCommand ? appendIfMissing(nextStepsBase, `Replay with preserved arguments: ${retryCommand}`) : nextStepsBase;
2510
+ const nextSteps = providedFlags && providedFlags.length > 0 ? appendIfMissing(nextStepsWithRetry, `Already provided options: ${providedFlags.join(", ")}`) : nextStepsWithRetry;
2511
+ return makeGuidanceMessage({
2512
+ code: "missing_required_option",
2513
+ title: `Missing required option ${optionFlag}`,
2514
+ happened: `Commander rejected the command because ${optionFlag} was not provided.`,
2515
+ required: `Pass ${optionFlag} with a valid value before running the command.`,
2516
+ why: isType ? "--type selects item contract and policy routing, including required/disabled option rules." : "Required flags define mandatory command intent and prevent ambiguous execution.",
2517
+ examples: examplesWithRetry,
2518
+ nextSteps,
2519
+ recovery: buildCommanderRecoveryPayload(context, { missing })
2520
+ });
2521
+ }
2522
+ function buildMissingRequiredArgumentGuidance(message, commandName, context) {
2499
2523
  const missingArgument = message.match(/missing required argument '([^']+)'/);
2500
- if (missingArgument) {
2501
- const argumentName = missingArgument[1];
2502
- return makeGuidanceMessage({
2503
- code: "missing_required_argument",
2504
- title: `Missing required argument ${argumentName}`,
2505
- happened: `Command invocation omitted positional argument ${argumentName}.`,
2506
- required: `Provide ${argumentName} in the expected command position.`,
2507
- why: "Positional arguments identify the target entity or action context for the command.",
2508
- examples: [`pm ${commandName ?? "<command>"} --help`],
2509
- recovery: buildCommanderRecoveryPayload(context, { missing: [argumentName] })
2510
- });
2524
+ if (!missingArgument) {
2525
+ return null;
2511
2526
  }
2527
+ const argumentName = missingArgument[1];
2528
+ return makeGuidanceMessage({
2529
+ code: "missing_required_argument",
2530
+ title: `Missing required argument ${argumentName}`,
2531
+ happened: `Command invocation omitted positional argument ${argumentName}.`,
2532
+ required: `Provide ${argumentName} in the expected command position.`,
2533
+ why: "Positional arguments identify the target entity or action context for the command.",
2534
+ examples: [`pm ${commandName ?? "<command>"} --help`],
2535
+ recovery: buildCommanderRecoveryPayload(context, { missing: [argumentName] })
2536
+ });
2537
+ }
2538
+ function buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions) {
2539
+ return makeGuidanceMessage({
2540
+ code: "unsupported_update_option",
2541
+ title: `Unsupported option ${optionName} for update`,
2542
+ happened: `pm update does not accept ${optionName} for linked artifact mutations.`,
2543
+ required: "Use dedicated linked-artifact commands instead of pm update for files/docs changes.",
2544
+ why: "pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",
2545
+ examples: [
2546
+ 'pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"',
2547
+ 'pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'
2548
+ ],
2549
+ nextSteps: ['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],
2550
+ recovery: buildCommanderRecoveryPayload(context, {
2551
+ suggested_flags: suggestions
2552
+ })
2553
+ });
2554
+ }
2555
+ function buildUnknownOptionGuidance(message, commandName, context) {
2512
2556
  const unknownOption = message.match(/unknown option '([^']+)'/);
2513
- if (unknownOption) {
2514
- const optionName = unknownOption[1];
2515
- const suggestions = normalizeOptionFlags(context?.unknownOptionSuggestions);
2516
- const retryCommand = context?.suggestedRetryCommand;
2517
- if (commandName === "update" && (optionName === "--file" || optionName === "--doc")) {
2518
- return makeGuidanceMessage({
2519
- code: "unsupported_update_option",
2520
- title: `Unsupported option ${optionName} for update`,
2521
- happened: `pm update does not accept ${optionName} for linked artifact mutations.`,
2522
- required: "Use dedicated linked-artifact commands instead of pm update for files/docs changes.",
2523
- why: "pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",
2524
- examples: [
2525
- 'pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"',
2526
- 'pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'
2527
- ],
2528
- nextSteps: ['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],
2529
- recovery: buildCommanderRecoveryPayload(context, {
2530
- missing: suggestions
2531
- })
2532
- });
2533
- }
2534
- const otherCommands = normalizeContextList(context?.unknownOptionOtherCommands);
2535
- const nextSteps = [
2536
- "Run command help to confirm the exact option contracts for this command path.",
2537
- ...suggestions && suggestions.length > 0 ? [`Nearest supported options: ${suggestions.join(", ")}`] : [],
2538
- ...otherCommands && otherCommands.length > 0 ? [`${optionName} is a valid option on: ${otherCommands.join(", ")}. If you meant one of those, run that command instead.`] : [],
2539
- ...retryCommand ? [`Replay with suggested correction: ${retryCommand}`] : []
2540
- ];
2541
- const examples = [
2542
- ...retryCommand ? [retryCommand] : [],
2543
- `pm ${commandName ?? "<command>"} --help`
2544
- ];
2545
- return makeGuidanceMessage({
2546
- code: "unknown_option",
2547
- title: `Unknown option ${optionName}`,
2548
- happened: `Commander does not recognize option ${optionName} for this command path.`,
2549
- required: "Use supported options only, or move option to the correct subcommand.",
2550
- why: "Option contracts are command-specific and intentionally validated.",
2551
- examples,
2552
- nextSteps,
2553
- recovery: buildCommanderRecoveryPayload(context, {
2554
- missing: suggestions
2555
- })
2556
- });
2557
+ if (!unknownOption) {
2558
+ return null;
2557
2559
  }
2560
+ const optionName = unknownOption[1];
2561
+ const suggestions = normalizeOptionFlags(context?.unknownOptionSuggestions);
2562
+ const retryCommand = context?.suggestedRetryCommand;
2563
+ if (commandName === "update" && (optionName === "--file" || optionName === "--doc")) {
2564
+ return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
2565
+ }
2566
+ const otherCommands = normalizeContextList(context?.unknownOptionOtherCommands);
2567
+ const nextSteps = [
2568
+ "Run command help to confirm the exact option contracts for this command path.",
2569
+ ...suggestions && suggestions.length > 0 ? [`Nearest supported options: ${suggestions.join(", ")}`] : [],
2570
+ ...otherCommands && otherCommands.length > 0 ? [`${optionName} is a valid option on: ${otherCommands.join(", ")}. If you meant one of those, run that command instead.`] : [],
2571
+ ...retryCommand ? [`Replay with suggested correction: ${retryCommand}`] : []
2572
+ ];
2573
+ const examples = [
2574
+ ...retryCommand ? [retryCommand] : [],
2575
+ `pm ${commandName ?? "<command>"} --help`
2576
+ ];
2577
+ return makeGuidanceMessage({
2578
+ code: "unknown_option",
2579
+ title: `Unknown option ${optionName}`,
2580
+ happened: `Commander does not recognize option ${optionName} for this command path.`,
2581
+ required: "Use supported options only, or move option to the correct subcommand.",
2582
+ why: "Option contracts are command-specific and intentionally validated.",
2583
+ examples,
2584
+ nextSteps,
2585
+ recovery: buildCommanderRecoveryPayload(context, {
2586
+ suggested_flags: suggestions
2587
+ })
2588
+ });
2589
+ }
2590
+ function buildKnownPackageCommandGuidance(commandToken, packageHint, baseExamples, baseNextSteps, context) {
2591
+ const installStep = `"${commandToken}" is provided by the ${packageHint.packageName} package. Install it with: ${packageHint.installCommand}`;
2592
+ return makeGuidanceMessage({
2593
+ code: "unknown_command",
2594
+ title: `Unknown command ${commandToken}`,
2595
+ happened: `pm does not expose command path "${commandToken}" in current runtime configuration. It is shipped by the optional ${packageHint.packageName} package.`,
2596
+ required: `Install the ${packageHint.packageName} package, or use a valid command name or subcommand path.`,
2597
+ why: "Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",
2598
+ examples: dedupeStrings([packageHint.installCommand, ...baseExamples]),
2599
+ nextSteps: dedupeStrings([installStep, ...baseNextSteps]),
2600
+ recovery: buildCommanderRecoveryPayload(context)
2601
+ });
2602
+ }
2603
+ function buildUnknownCommandGuidance(message, context) {
2558
2604
  const unknownCommand = message.match(/unknown command '([^']+)'/);
2559
- if (unknownCommand) {
2560
- const commandToken = unknownCommand[1];
2561
- const runtimeExamples = normalizeContextList(context?.unknownCommandExamples);
2562
- const runtimeNextSteps = normalizeContextList(context?.unknownCommandNextSteps);
2563
- const packageHint = resolveKnownPackageCommandHint(commandToken);
2564
- const baseExamples = runtimeExamples ?? ["pm --help"];
2565
- const baseNextSteps = runtimeNextSteps ?? ["Verify spelling and active extensions, then rerun."];
2566
- if (packageHint) {
2567
- const installStep = `"${commandToken}" is provided by the ${packageHint.packageName} package. Install it with: ${packageHint.installCommand}`;
2568
- return makeGuidanceMessage({
2569
- code: "unknown_command",
2570
- title: `Unknown command ${commandToken}`,
2571
- happened: `pm does not expose command path "${commandToken}" in current runtime configuration. It is shipped by the optional ${packageHint.packageName} package.`,
2572
- required: `Install the ${packageHint.packageName} package, or use a valid command name or subcommand path.`,
2573
- why: "Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",
2574
- examples: dedupeStrings([packageHint.installCommand, ...baseExamples]),
2575
- nextSteps: dedupeStrings([installStep, ...baseNextSteps]),
2576
- recovery: buildCommanderRecoveryPayload(context)
2577
- });
2578
- }
2579
- return makeGuidanceMessage({
2580
- code: "unknown_command",
2581
- title: `Unknown command ${commandToken}`,
2582
- happened: `pm does not expose command path "${commandToken}" in current runtime configuration.`,
2583
- required: "Use a valid command name or subcommand path.",
2584
- why: "Command registry includes core commands plus active extension command handlers.",
2585
- examples: baseExamples,
2586
- nextSteps: baseNextSteps,
2587
- recovery: buildCommanderRecoveryPayload(context)
2588
- });
2605
+ if (!unknownCommand) {
2606
+ return null;
2589
2607
  }
2590
- if (/too many arguments/i.test(message) && commandName === "test") {
2591
- const argv = context?.normalizedInvocationArgs;
2592
- const mutationFlag = findLinkedTestMutationFlag(argv);
2593
- if (mutationFlag) {
2594
- const retryCommand = buildLinkedTestQuotedRetryCommand(argv);
2595
- return makeGuidanceMessage({
2596
- code: "linked_test_value_not_quoted",
2597
- title: `Linked-test ${mutationFlag} value must be one argument`,
2598
- happened: `Commander saw extra positional tokens after the item id \u2014 usually a ${mutationFlag} value containing spaces (for example a command with " -- ") that the shell split into multiple tokens.`,
2599
- required: `Quote the whole ${mutationFlag} value as a single argument. Accepted forms: --add "command=npm test -- parser", --add command "npm test -- parser" (two-token form with the value quoted), or --add-json for complex commands.`,
2600
- why: "The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",
2601
- examples: [
2602
- ...retryCommand ? [retryCommand] : [],
2603
- 'pm test pm-a1b2 --add "command=npm test -- parser"',
2604
- 'pm test pm-a1b2 --add command "npm test -- parser"',
2605
- `pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`
2606
- ],
2607
- nextSteps: [
2608
- ...retryCommand ? [`Replay with the value re-joined into one argument: ${retryCommand}`] : [],
2609
- "Prefer --add-json for commands containing commas, equals signs, or quotes.",
2610
- 'Run "pm test --help" for linked-test entry contracts.'
2611
- ],
2612
- recovery: buildCommanderRecoveryPayload(context, retryCommand ? { suggested_retry: retryCommand } : {})
2613
- });
2614
- }
2608
+ const commandToken = unknownCommand[1];
2609
+ const runtimeExamples = normalizeContextList(context?.unknownCommandExamples);
2610
+ const runtimeNextSteps = normalizeContextList(context?.unknownCommandNextSteps);
2611
+ const packageHint = resolveKnownPackageCommandHint(commandToken);
2612
+ const baseExamples = runtimeExamples ?? ["pm --help"];
2613
+ const baseNextSteps = runtimeNextSteps ?? ["Verify spelling and active extensions, then rerun."];
2614
+ if (packageHint) {
2615
+ return buildKnownPackageCommandGuidance(commandToken, packageHint, baseExamples, baseNextSteps, context);
2616
+ }
2617
+ return makeGuidanceMessage({
2618
+ code: "unknown_command",
2619
+ title: `Unknown command ${commandToken}`,
2620
+ happened: `pm does not expose command path "${commandToken}" in current runtime configuration.`,
2621
+ required: "Use a valid command name or subcommand path.",
2622
+ why: "Command registry includes core commands plus active extension command handlers.",
2623
+ examples: baseExamples,
2624
+ nextSteps: baseNextSteps,
2625
+ recovery: buildCommanderRecoveryPayload(context)
2626
+ });
2627
+ }
2628
+ function buildLinkedTestValueNotQuotedGuidance(message, commandName, allowedTypes, context) {
2629
+ if (!/too many arguments/i.test(message) || commandName !== "test") {
2630
+ return null;
2631
+ }
2632
+ const argv = context?.normalizedInvocationArgs;
2633
+ const mutationFlag = findLinkedTestMutationFlag(argv);
2634
+ if (!mutationFlag) {
2635
+ return null;
2636
+ }
2637
+ const retryCommand = buildLinkedTestQuotedRetryCommand(argv);
2638
+ return makeGuidanceMessage({
2639
+ code: "linked_test_value_not_quoted",
2640
+ title: `Linked-test ${mutationFlag} value must be one argument`,
2641
+ happened: `Commander saw extra positional tokens after the item id \u2014 usually a ${mutationFlag} value containing spaces (for example a command with " -- ") that the shell split into multiple tokens.`,
2642
+ required: `Quote the whole ${mutationFlag} value as a single argument. Accepted forms: --add "command=npm test -- parser", --add command "npm test -- parser" (two-token form with the value quoted), or --add-json for complex commands.`,
2643
+ why: "The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",
2644
+ examples: [
2645
+ ...retryCommand ? [retryCommand] : [],
2646
+ 'pm test pm-a1b2 --add "command=npm test -- parser"',
2647
+ 'pm test pm-a1b2 --add command "npm test -- parser"',
2648
+ `pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`
2649
+ ],
2650
+ nextSteps: [
2651
+ ...retryCommand ? [`Replay with the value re-joined into one argument: ${retryCommand}`] : [],
2652
+ "Prefer --add-json for commands containing commas, equals signs, or quotes.",
2653
+ 'Run "pm test --help" for linked-test entry contracts.'
2654
+ ],
2655
+ recovery: buildCommanderRecoveryPayload(context, retryCommand ? { suggested_retry: retryCommand } : {})
2656
+ });
2657
+ }
2658
+ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context) {
2659
+ const message = normalizeMessage(rawMessage);
2660
+ const guidance = buildMissingRequiredOptionGuidance(message, commandName, allowedTypes, context) ?? buildMissingRequiredArgumentGuidance(message, commandName, context) ?? buildUnknownOptionGuidance(message, commandName, context) ?? buildUnknownCommandGuidance(message, context) ?? buildLinkedTestValueNotQuotedGuidance(message, commandName, allowedTypes, context);
2661
+ if (guidance) {
2662
+ return guidance;
2615
2663
  }
2616
2664
  return makeGuidanceMessage({
2617
2665
  code: "invalid_command_usage",
@@ -3114,7 +3162,7 @@ function ensureCommandPath(root, pathParts) {
3114
3162
  !(function() {
3115
3163
  try {
3116
3164
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3117
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "3f652b37-a8f5-5d02-9199-d2982382b7a8");
3165
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e5659f1c-76e6-52e9-96f6-201091483918");
3118
3166
  } catch (e2) {
3119
3167
  }
3120
3168
  })();
@@ -3166,52 +3214,29 @@ function collectMandatoryMigrationBlockers(migrations) {
3166
3214
  function hasMutatingListValues(value) {
3167
3215
  return Array.isArray(value) && value.length > 0;
3168
3216
  }
3217
+ var ALWAYS_MUTATING_COMMANDS = /* @__PURE__ */ new Set(["create", "beads import", "todos import"]);
3218
+ var FORCEABLE_MUTATING_COMMANDS = /* @__PURE__ */ new Set(["restore", "update", "close", "delete", "append", "claim", "release"]);
3219
+ var TEXT_APPEND_COMMANDS = /* @__PURE__ */ new Set(["comments", "notes", "learnings"]);
3220
+ var LIST_MUTATION_COMMANDS = /* @__PURE__ */ new Set(["files", "docs", "test"]);
3169
3221
  function decideWriteGate(commandPath, options) {
3170
3222
  const forceRequested = options.force === true;
3171
- switch (commandPath) {
3172
- case "create":
3173
- case "beads import":
3174
- case "todos import":
3175
- return {
3176
- isMutation: true,
3177
- forceCapable: false,
3178
- forceRequested: false
3179
- };
3180
- case "restore":
3181
- case "update":
3182
- case "close":
3183
- case "delete":
3184
- case "append":
3185
- case "claim":
3186
- case "release":
3187
- return {
3188
- isMutation: true,
3189
- forceCapable: true,
3190
- forceRequested
3191
- };
3192
- case "comments":
3193
- case "notes":
3194
- case "learnings":
3195
- return {
3196
- isMutation: typeof options.add === "string",
3197
- forceCapable: true,
3198
- forceRequested
3199
- };
3200
- case "files":
3201
- case "docs":
3202
- case "test":
3203
- return {
3204
- isMutation: hasMutatingListValues(options.add) || hasMutatingListValues(options.remove),
3205
- forceCapable: true,
3206
- forceRequested
3207
- };
3208
- default:
3209
- return {
3210
- isMutation: false,
3211
- forceCapable: false,
3212
- forceRequested: false
3213
- };
3223
+ if (ALWAYS_MUTATING_COMMANDS.has(commandPath)) {
3224
+ return { isMutation: true, forceCapable: false, forceRequested: false };
3225
+ }
3226
+ if (FORCEABLE_MUTATING_COMMANDS.has(commandPath)) {
3227
+ return { isMutation: true, forceCapable: true, forceRequested };
3228
+ }
3229
+ if (TEXT_APPEND_COMMANDS.has(commandPath)) {
3230
+ return { isMutation: typeof options.add === "string", forceCapable: true, forceRequested };
3231
+ }
3232
+ if (LIST_MUTATION_COMMANDS.has(commandPath)) {
3233
+ return {
3234
+ isMutation: hasMutatingListValues(options.add) || hasMutatingListValues(options.remove),
3235
+ forceCapable: true,
3236
+ forceRequested
3237
+ };
3214
3238
  }
3239
+ return { isMutation: false, forceCapable: false, forceRequested: false };
3215
3240
  }
3216
3241
  function enforceMandatoryMigrationWriteGate(commandPath, options, blockers) {
3217
3242
  if (blockers.length === 0) {
@@ -3256,7 +3281,7 @@ async function enforceItemFormatWriteGateAndPreflightMigration(commandPath, opti
3256
3281
  !(function() {
3257
3282
  try {
3258
3283
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3259
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c0b38b44-fdea-5d80-b2d4-361f2b07c8f1");
3284
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "66620fd2-4f5f-5930-a9e1-0497672abda9");
3260
3285
  } catch (e2) {
3261
3286
  }
3262
3287
  })();
@@ -3641,6 +3666,48 @@ function isKnownHelpCommandPath(root, commandPathTokens) {
3641
3666
  }
3642
3667
  return matchedAny;
3643
3668
  }
3669
+ async function resolveAllowedTypesForUsage(bootstrapGlobal) {
3670
+ try {
3671
+ const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
3672
+ if (!await pathExists(getSettingsPath(pmRoot))) {
3673
+ return BUILTIN_TYPE_HELP_VALUES;
3674
+ }
3675
+ const settings = await readSettings(pmRoot);
3676
+ const extensionRegistrations = bootstrapGlobal.noExtensions ? void 0 : getActiveExtensionRegistrations();
3677
+ const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);
3678
+ return typeRegistry.types.length > 0 ? typeRegistry.types.join("|") : BUILTIN_TYPE_HELP_VALUES;
3679
+ } catch {
3680
+ return BUILTIN_TYPE_HELP_VALUES;
3681
+ }
3682
+ }
3683
+ function resolveUnknownOptionSuggestions(message, commandName) {
3684
+ const match = message.match(/unknown option '([^']+)'/i);
3685
+ const suggestions = match && commandName ? dedupeStrings2([
3686
+ ...getSemanticUnknownOptionSuggestions(commandName, match[1]),
3687
+ ...suggestNearestLongFlags(match[1], collectKnownLongFlags(commandName))
3688
+ ]) : void 0;
3689
+ return {
3690
+ match,
3691
+ suggestions,
3692
+ otherCommands: match ? findOtherCommandsForFlag(match[1], commandName) : []
3693
+ };
3694
+ }
3695
+ function resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOptionMatch, unknownOptionSuggestions) {
3696
+ if (!unknownOptionMatch || !unknownOptionSuggestions || unknownOptionSuggestions.length === 0) {
3697
+ return void 0;
3698
+ }
3699
+ const rewritten = rewriteUnknownOptionArgv(invocationArgv, unknownOptionMatch[1], unknownOptionSuggestions[0]);
3700
+ return rewritten ? renderAttemptedCommand(rewritten) : void 0;
3701
+ }
3702
+ function resolveSuggestedRetryForMissingOption(message, invocationArgv) {
3703
+ const missingRequiredOption = message.match(/required option '([^']+)' not specified/i);
3704
+ const requiredOptionToken = missingRequiredOption?.[1] ? trimTrailingPunctuationToken(firstWhitespaceSeparatedToken(missingRequiredOption[1].trim())) : void 0;
3705
+ if (!requiredOptionToken?.startsWith("--")) {
3706
+ return void 0;
3707
+ }
3708
+ const hasFlag = invocationArgv.some((token) => token === requiredOptionToken || token.startsWith(`${requiredOptionToken}=`));
3709
+ return hasFlag ? void 0 : renderAttemptedCommand([...invocationArgv, requiredOptionToken, "<value>"]);
3710
+ }
3644
3711
  async function resolveCommanderUsageContext(error, rootProgram, extensionDescriptors) {
3645
3712
  const rawMessage = typeof error === "object" && error !== null ? error.message : void 0;
3646
3713
  const message = rawMessage ?? "Invalid command usage";
@@ -3649,42 +3716,10 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
3649
3716
  const commandName = parseBootstrapCommandName(invocationArgv);
3650
3717
  const attemptedCommand = renderAttemptedCommand(invocationArgv);
3651
3718
  const providedOptionFlags = extractProvidedOptionFlags(invocationArgv);
3652
- let allowedTypes = BUILTIN_TYPE_HELP_VALUES;
3653
- try {
3654
- const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
3655
- if (await pathExists(getSettingsPath(pmRoot))) {
3656
- const settings = await readSettings(pmRoot);
3657
- const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
3658
- if (typeRegistry.types.length > 0) {
3659
- allowedTypes = typeRegistry.types.join("|");
3660
- }
3661
- }
3662
- } catch {
3663
- }
3719
+ const allowedTypes = await resolveAllowedTypesForUsage(bootstrapGlobal);
3664
3720
  const unknownCommandGuidance = buildUnknownCommandGuidanceFromRuntime(message, rootProgram, extensionDescriptors);
3665
- const unknownOptionMatch = message.match(/unknown option '([^']+)'/i);
3666
- const unknownOptionSuggestions = unknownOptionMatch && commandName ? dedupeStrings2([
3667
- ...getSemanticUnknownOptionSuggestions(commandName, unknownOptionMatch[1]),
3668
- ...suggestNearestLongFlags(unknownOptionMatch[1], collectKnownLongFlags(commandName))
3669
- ]) : void 0;
3670
- const unknownOptionOtherCommands = unknownOptionMatch ? findOtherCommandsForFlag(unknownOptionMatch[1], commandName) : [];
3671
- let suggestedRetryCommand;
3672
- if (unknownOptionMatch && unknownOptionSuggestions && unknownOptionSuggestions.length > 0) {
3673
- const rewritten = rewriteUnknownOptionArgv(invocationArgv, unknownOptionMatch[1], unknownOptionSuggestions[0]);
3674
- if (rewritten) {
3675
- suggestedRetryCommand = renderAttemptedCommand(rewritten);
3676
- }
3677
- }
3678
- if (!suggestedRetryCommand) {
3679
- const missingRequiredOption = message.match(/required option '([^']+)' not specified/i);
3680
- const requiredOptionToken = missingRequiredOption?.[1] ? trimTrailingPunctuationToken(firstWhitespaceSeparatedToken(missingRequiredOption[1].trim())) : void 0;
3681
- if (requiredOptionToken?.startsWith("--")) {
3682
- const hasFlag = invocationArgv.some((token) => token.startsWith(requiredOptionToken));
3683
- if (!hasFlag) {
3684
- suggestedRetryCommand = renderAttemptedCommand([...invocationArgv, requiredOptionToken, "<value>"]);
3685
- }
3686
- }
3687
- }
3721
+ const unknownOption = resolveUnknownOptionSuggestions(message, commandName);
3722
+ const suggestedRetryCommand = resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOption.match, unknownOption.suggestions) ?? resolveSuggestedRetryForMissingOption(message, invocationArgv);
3688
3723
  return {
3689
3724
  message,
3690
3725
  commandName,
@@ -3692,8 +3727,8 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
3692
3727
  attemptedCommand,
3693
3728
  normalizedInvocationArgs: [...invocationArgv],
3694
3729
  providedOptionFlags,
3695
- unknownOptionSuggestions,
3696
- unknownOptionOtherCommands: unknownOptionOtherCommands.length > 0 ? unknownOptionOtherCommands : void 0,
3730
+ unknownOptionSuggestions: unknownOption.suggestions,
3731
+ unknownOptionOtherCommands: unknownOption.otherCommands.length > 0 ? unknownOption.otherCommands : void 0,
3697
3732
  suggestedRetryCommand,
3698
3733
  ...unknownCommandGuidance
3699
3734
  };
@@ -4013,7 +4048,7 @@ function attachCreateUpdatePolicyHelpText(rootProgram, typeRegistry, argv) {
4013
4048
  !(function() {
4014
4049
  try {
4015
4050
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
4016
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "9f13a662-73c4-5ffa-99bc-4edee2b7a7fb");
4051
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "a367900b-1ec4-5110-9997-7f0a02e315c0");
4017
4052
  } catch (e2) {
4018
4053
  }
4019
4054
  })();
@@ -4058,10 +4093,10 @@ var EXPECTED_HANDLED_ERROR_EXIT_CODES = /* @__PURE__ */ new Set([
4058
4093
  EXIT_CODE.CONFLICT
4059
4094
  ]);
4060
4095
  var TRUE_LIKE_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
4061
- var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-ZKJ53RS7.js"));
4062
- var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-SNG5PGA4.js"));
4063
- var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-KK7PHYYU.js"));
4064
- var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-HZ6XERQG.js"));
4096
+ var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-ZCGKHDKL.js"));
4097
+ var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-XN4ZRHSV.js"));
4098
+ var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-KRLAHEL2.js"));
4099
+ var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-4PASGJDB.js"));
4065
4100
  function describeUnknownError(error) {
4066
4101
  if (error instanceof PmCliError) {
4067
4102
  return error.message;
@@ -4107,6 +4142,57 @@ function inferMissingFieldsFromErrorMessage(message) {
4107
4142
  const normalized = [...new Set(matches.map((entry) => normalizeLongOptionFlag(entry) ?? entry))];
4108
4143
  return normalized.length > 0 ? normalized : void 0;
4109
4144
  }
4145
+ function inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery) {
4146
+ if (existingRecovery?.suggested_retry) {
4147
+ return void 0;
4148
+ }
4149
+ const providedFields = extractProvidedOptionFlags(invocationArgv);
4150
+ const providedSet = new Set(providedFields.map((flag) => normalizeLongOptionFlag(flag) ?? flag));
4151
+ const rawInferred = inferMissingFieldsFromErrorMessage(rawMessage);
4152
+ const trulyMissing = rawInferred?.filter((flag) => !providedSet.has(normalizeLongOptionFlag(flag) ?? flag));
4153
+ return trulyMissing && trulyMissing.length > 0 ? trulyMissing : void 0;
4154
+ }
4155
+ function resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferredMissing, existingRecovery) {
4156
+ if (existingRecovery?.suggested_retry) {
4157
+ return existingRecovery.suggested_retry;
4158
+ }
4159
+ const missingFlag = inferredMissing?.[0];
4160
+ const normalizedMissing = missingFlag ? normalizeLongOptionFlag(missingFlag) : void 0;
4161
+ const suggestedRetry = normalizedMissing ? renderAttemptedCommand3([...invocationArgv, normalizedMissing, "<value>"]) : attemptedCommand;
4162
+ return suggestedRetry === attemptedCommand ? void 0 : suggestedRetry;
4163
+ }
4164
+ function projectExistingRecoveryOptionalFields(existingRecovery) {
4165
+ if (!existingRecovery) {
4166
+ return {};
4167
+ }
4168
+ const optionalFields = [
4169
+ "recovery_mode",
4170
+ "missing_required_fields",
4171
+ "suggested_flags",
4172
+ "fallback_candidates",
4173
+ "next_best_command"
4174
+ ];
4175
+ const projected = {};
4176
+ for (const field of optionalFields) {
4177
+ const value = existingRecovery[field];
4178
+ if (value !== void 0 && value !== null) {
4179
+ projected[field] = value;
4180
+ }
4181
+ }
4182
+ return projected;
4183
+ }
4184
+ function buildRecoveryPayload(params) {
4185
+ const existingRecovery = params.existingRecovery;
4186
+ return {
4187
+ attempted_command: existingRecovery?.attempted_command ?? params.attemptedCommand,
4188
+ normalized_args: existingRecovery?.normalized_args ?? [...params.invocationArgv],
4189
+ /* c8 ignore next */
4190
+ provided_fields: existingRecovery?.provided_fields ?? (params.providedFields.length > 0 ? params.providedFields : void 0),
4191
+ missing: existingRecovery?.missing ?? params.inferredMissing,
4192
+ ...projectExistingRecoveryOptionalFields(existingRecovery),
4193
+ ...params.suggestedRetry ? { suggested_retry: params.suggestedRetry } : {}
4194
+ };
4195
+ }
4110
4196
  function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
4111
4197
  const explainRequested = invocationArgv.includes("--explain");
4112
4198
  const existingRecovery = context?.recovery;
@@ -4119,37 +4205,16 @@ function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
4119
4205
  }
4120
4206
  const attemptedCommand = renderAttemptedCommand3(invocationArgv);
4121
4207
  const providedFields = extractProvidedOptionFlags(invocationArgv);
4122
- const providedSet = new Set(providedFields.map((flag) => normalizeLongOptionFlag(flag) ?? flag));
4123
- const rawInferred = existingRecovery?.suggested_retry ? void 0 : inferMissingFieldsFromErrorMessage(rawMessage);
4124
- const trulyMissing = rawInferred?.filter((flag) => !providedSet.has(normalizeLongOptionFlag(flag) ?? flag));
4125
- const inferredMissing = trulyMissing && trulyMissing.length > 0 ? trulyMissing : void 0;
4126
- let suggestedRetry = existingRecovery?.suggested_retry;
4127
- if (!suggestedRetry && inferredMissing && inferredMissing.length > 0) {
4128
- const missingFlag = inferredMissing[0];
4129
- const normalizedMissing = normalizeLongOptionFlag(missingFlag);
4130
- if (normalizedMissing) {
4131
- suggestedRetry = renderAttemptedCommand3([...invocationArgv, normalizedMissing, "<value>"]);
4132
- }
4133
- }
4134
- if (!suggestedRetry) {
4135
- suggestedRetry = attemptedCommand;
4136
- }
4137
- if (!existingRecovery?.suggested_retry && suggestedRetry === attemptedCommand) {
4138
- suggestedRetry = void 0;
4139
- }
4140
- const recovery = {
4141
- attempted_command: existingRecovery?.attempted_command ?? attemptedCommand,
4142
- normalized_args: existingRecovery?.normalized_args ?? [...invocationArgv],
4143
- /* c8 ignore next */
4144
- provided_fields: existingRecovery?.provided_fields ?? (providedFields.length > 0 ? providedFields : void 0),
4145
- missing: existingRecovery?.missing ?? inferredMissing,
4146
- ...existingRecovery?.recovery_mode ? { recovery_mode: existingRecovery.recovery_mode } : {},
4147
- ...existingRecovery?.missing_required_fields ? { missing_required_fields: existingRecovery.missing_required_fields } : {},
4148
- ...existingRecovery?.suggested_flags ? { suggested_flags: existingRecovery.suggested_flags } : {},
4149
- ...suggestedRetry ? { suggested_retry: suggestedRetry } : {},
4150
- ...existingRecovery?.fallback_candidates ? { fallback_candidates: existingRecovery.fallback_candidates } : {},
4151
- ...existingRecovery?.next_best_command ? { next_best_command: existingRecovery.next_best_command } : {}
4152
- };
4208
+ const inferredMissing = inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery);
4209
+ const suggestedRetry = resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferredMissing, existingRecovery);
4210
+ const recovery = buildRecoveryPayload({
4211
+ invocationArgv,
4212
+ attemptedCommand,
4213
+ providedFields,
4214
+ inferredMissing,
4215
+ suggestedRetry,
4216
+ existingRecovery
4217
+ });
4153
4218
  return {
4154
4219
  ...context,
4155
4220
  recovery
@@ -5172,34 +5237,62 @@ function wrapProgramActionsForExtensionHandlers(rootProgram) {
5172
5237
  };
5173
5238
  visit(rootProgram);
5174
5239
  }
5240
+ async function clearDynamicExtensionCommandState(params) {
5241
+ activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5242
+ setActiveExtensionServices({ overrides: [] });
5243
+ if (params) {
5244
+ await maybeAttachCreateUpdatePolicyHelpText(params.rootProgram, params.pmRoot, params.invocationArgv, createEmptyExtensionRegistrationRegistry(), params.settings);
5245
+ }
5246
+ }
5247
+ function attachDynamicExtensionHelp(command, descriptor, flagHelp, metadataHelp) {
5248
+ if (descriptor?.flags && descriptor.flags.length > 0) {
5249
+ applyDynamicExtensionFlagOptions(command, descriptor.flags);
5250
+ const residualFlagHelp = buildResidualDynamicExtensionFlagHelp(command, descriptor.flags);
5251
+ if (residualFlagHelp) {
5252
+ command.addHelpText("after", residualFlagHelp);
5253
+ }
5254
+ } else if (flagHelp) {
5255
+ command.addHelpText("after", flagHelp);
5256
+ }
5257
+ if (metadataHelp) {
5258
+ command.addHelpText("after", metadataHelp);
5259
+ }
5260
+ }
5175
5261
  async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv) {
5176
5262
  const bootstrapGlobalOptions = parseBootstrapGlobalOptions(invocationArgv);
5177
5263
  const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobalOptions.path);
5178
5264
  if (bootstrapGlobalOptions.noExtensions) {
5179
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5180
- setActiveExtensionServices({ overrides: [] });
5181
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry());
5265
+ await clearDynamicExtensionCommandState({
5266
+ rootProgram,
5267
+ pmRoot,
5268
+ invocationArgv
5269
+ });
5182
5270
  return;
5183
5271
  }
5184
5272
  const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(pmRoot);
5185
5273
  const probe = buildBootstrapActivationProbe(invocationArgv);
5186
5274
  if (!discoverySnapshot) {
5187
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5188
- setActiveExtensionServices({ overrides: [] });
5275
+ await clearDynamicExtensionCommandState();
5189
5276
  return;
5190
5277
  }
5191
5278
  if (!discoveryNeedsActivationForProbe(discoverySnapshot.discovery, probe)) {
5192
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5193
- setActiveExtensionServices({ overrides: [] });
5194
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry(), discoverySnapshot.settings);
5279
+ await clearDynamicExtensionCommandState({
5280
+ rootProgram,
5281
+ pmRoot,
5282
+ invocationArgv,
5283
+ settings: discoverySnapshot.settings
5284
+ });
5195
5285
  emitExtensionSkippedProfile(bootstrapProfileEnabled(invocationArgv), discoverySnapshot, probe);
5196
5286
  return;
5197
5287
  }
5198
5288
  const snapshot = await loadRuntimeExtensionSnapshot(pmRoot);
5199
5289
  if (!snapshot) {
5200
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5201
- setActiveExtensionServices({ overrides: [] });
5202
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry(), discoverySnapshot.settings);
5290
+ await clearDynamicExtensionCommandState({
5291
+ rootProgram,
5292
+ pmRoot,
5293
+ invocationArgv,
5294
+ settings: discoverySnapshot.settings
5295
+ });
5203
5296
  return;
5204
5297
  }
5205
5298
  setActiveExtensionServices(snapshot.services);
@@ -5216,18 +5309,7 @@ async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv)
5216
5309
  const flagHelp = snapshot.commandFlagHelp.get(commandPath);
5217
5310
  const metadataHelp = descriptor ? buildDynamicExtensionCommandMetadataHelp(descriptor) : null;
5218
5311
  if (existingCommand) {
5219
- if (descriptor?.flags && descriptor.flags.length > 0) {
5220
- applyDynamicExtensionFlagOptions(existingCommand, descriptor.flags);
5221
- const residualFlagHelp = buildResidualDynamicExtensionFlagHelp(existingCommand, descriptor.flags);
5222
- if (residualFlagHelp) {
5223
- existingCommand.addHelpText("after", residualFlagHelp);
5224
- }
5225
- } else if (flagHelp) {
5226
- existingCommand.addHelpText("after", flagHelp);
5227
- }
5228
- if (metadataHelp) {
5229
- existingCommand.addHelpText("after", metadataHelp);
5230
- }
5312
+ attachDynamicExtensionHelp(existingCommand, descriptor, flagHelp, metadataHelp);
5231
5313
  continue;
5232
5314
  }
5233
5315
  const dynamicCommand = ensureCommandPath(rootProgram, pathParts);
@@ -5650,6 +5732,308 @@ function enforceExplicitRetryForFlagTypos(bootstrapInvocation) {
5650
5732
  }
5651
5733
  });
5652
5734
  }
5735
+ function createTelemetryCommandErrorEmitter(params) {
5736
+ return async (event) => {
5737
+ const errorCategory = resolveTelemetryErrorCategory(event.errorCode);
5738
+ const commandResolution = deriveTelemetryCommandResolution({
5739
+ ok: false,
5740
+ errorCode: event.errorCode,
5741
+ errorCategory
5742
+ });
5743
+ await emitTelemetryErrorEvent({
5744
+ command: event.command,
5745
+ args: params.invocationArgv,
5746
+ options: event.options,
5747
+ global: params.bootstrapGlobal,
5748
+ pm_version: CLI_VERSION,
5749
+ pm_root: params.bootstrapPmRoot,
5750
+ error_code: event.errorCode,
5751
+ error_message: event.errorMessage,
5752
+ exit_code: event.exitCode,
5753
+ error_category: errorCategory,
5754
+ command_resolution: commandResolution,
5755
+ resolution_stage: event.resolutionStage
5756
+ });
5757
+ return {
5758
+ errorCategory,
5759
+ commandResolution
5760
+ };
5761
+ };
5762
+ }
5763
+ async function prepareExtensionServicesForRunPmCliError(params) {
5764
+ if (params.bootstrapGlobal.noExtensions) {
5765
+ return;
5766
+ }
5767
+ const bootstrapProbe = buildBootstrapActivationProbe(params.invocationArgv);
5768
+ const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(params.bootstrapPmRoot);
5769
+ if (discoverySnapshot && discoveryNeedsActivationForProbe(discoverySnapshot.discovery, bootstrapProbe)) {
5770
+ const bootstrapSnapshot = await loadRuntimeExtensionSnapshot(params.bootstrapPmRoot);
5771
+ setRecoveredExtensionServices(bootstrapSnapshot);
5772
+ return;
5773
+ }
5774
+ if (discoverySnapshot) {
5775
+ emitExtensionSkippedProfile(bootstrapProfileEnabled(params.invocationArgv), discoverySnapshot, bootstrapProbe);
5776
+ }
5777
+ setActiveExtensionServices({ overrides: [] });
5778
+ }
5779
+ function setRecoveredExtensionServices(bootstrapSnapshot) {
5780
+ if (!bootstrapSnapshot) {
5781
+ setActiveExtensionServices({ overrides: [] });
5782
+ return;
5783
+ }
5784
+ setActiveExtensionServices(bootstrapSnapshot.services);
5785
+ }
5786
+ async function finishRunPmCliFailure(params) {
5787
+ sentryFinishCommandSpan(false, params.errorMessage, {
5788
+ error_code: params.classificationCode,
5789
+ error_category: params.errorCategory,
5790
+ exit_code: params.exitCode,
5791
+ command_resolution: params.commandResolution,
5792
+ resolution_stage: params.resolutionStage
5793
+ });
5794
+ await runAndClearAfterCommandHooks({
5795
+ ok: false,
5796
+ error: params.errorMessage,
5797
+ exit_code: params.exitCode,
5798
+ error_code: params.classificationCode,
5799
+ error_category: params.errorCategory,
5800
+ command_resolution: params.commandResolution,
5801
+ resolution_stage: params.resolutionStage
5802
+ });
5803
+ }
5804
+ async function finishRunPmCliSuccessParse() {
5805
+ sentryFinishCommandSpan(true, void 0, {
5806
+ exit_code: EXIT_CODE.SUCCESS,
5807
+ command_resolution: "success",
5808
+ resolution_stage: "parse"
5809
+ });
5810
+ await runAndClearAfterCommandHooks({
5811
+ ok: true,
5812
+ exit_code: EXIT_CODE.SUCCESS,
5813
+ command_resolution: "success",
5814
+ resolution_stage: "parse"
5815
+ });
5816
+ process.exitCode = EXIT_CODE.SUCCESS;
5817
+ }
5818
+ async function handleRunPmCliKnownError(context, numericExitCode) {
5819
+ const hasExplicitExitCode = typeof numericExitCode === "number" && Number.isFinite(numericExitCode);
5820
+ if (!(context.error instanceof PmCliError) && (isCommanderError(context.error) || !hasExplicitExitCode)) {
5821
+ return false;
5822
+ }
5823
+ const errorMessage = describeUnknownError(context.error);
5824
+ const exitCode = context.error instanceof PmCliError ? context.error.exitCode : normalizeThrownExitCode(numericExitCode);
5825
+ const rawContext = context.error instanceof PmCliError ? context.error.context : void 0;
5826
+ const enrichedContext = buildPmCliRecoveryContext(rawContext, context.invocationArgv, errorMessage);
5827
+ const classification = classifyPmCliError(errorMessage, enrichedContext);
5828
+ const renderedError = context.jsonErrors ? JSON.stringify(formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext), null, 2) : formatPmCliErrorForDisplay(errorMessage, enrichedContext);
5829
+ printError(renderedError);
5830
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5831
+ command: context.attemptedCommand,
5832
+ errorCode: classification.code,
5833
+ errorMessage: classification.detail,
5834
+ exitCode,
5835
+ options: {
5836
+ bootstrap_global_options: context.bootstrapGlobal
5837
+ },
5838
+ resolutionStage: "execute"
5839
+ });
5840
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5841
+ command: context.attemptedCommand,
5842
+ error_code: classification.code,
5843
+ error_category: errorCategory,
5844
+ exit_code: exitCode,
5845
+ error_message: classification.detail,
5846
+ command_resolution: commandResolution,
5847
+ resolution_stage: "execute",
5848
+ source_context: activeTelemetryCommandContext?.source_context
5849
+ });
5850
+ await finishRunPmCliFailure({
5851
+ errorMessage,
5852
+ exitCode,
5853
+ classificationCode: classification.code,
5854
+ errorCategory,
5855
+ commandResolution,
5856
+ resolutionStage: "execute"
5857
+ });
5858
+ if (loggedHandledErrorToSentry) {
5859
+ sentryCaptureCliError(wrapThrownErrorForSentry(context.error, errorMessage));
5860
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5861
+ }
5862
+ process.exitCode = exitCode;
5863
+ return true;
5864
+ }
5865
+ function resolveUnknownHelpToken(invocationArgv) {
5866
+ const helpRequest = parseBootstrapHelpRequest(invocationArgv);
5867
+ return helpRequest.commandPathTokens[0] ?? parseBootstrapCommandName(invocationArgv) ?? "<command>";
5868
+ }
5869
+ async function handleUnknownHelpCommandError(context, code) {
5870
+ const unknownToken = resolveUnknownHelpToken(context.invocationArgv);
5871
+ const unknownMessage = `unknown command '${unknownToken}'`;
5872
+ const recoveryCommandDescriptors = await loadRuntimeExtensionCommandDescriptorsForRecovery(resolvePmRoot(process.cwd(), context.bootstrapGlobal.path));
5873
+ const usageContext = await resolveCommanderUsageContext({ message: unknownMessage }, program, recoveryCommandDescriptors);
5874
+ const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5875
+ unknownCommandExamples: usageContext.unknownCommandExamples,
5876
+ unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5877
+ attemptedCommand: usageContext.attemptedCommand,
5878
+ normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5879
+ providedOptionFlags: usageContext.providedOptionFlags,
5880
+ unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5881
+ suggestedRetryCommand: usageContext.suggestedRetryCommand
5882
+ });
5883
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5884
+ command: unknownToken,
5885
+ errorCode: classification.code,
5886
+ errorMessage: classification.detail,
5887
+ exitCode: EXIT_CODE.USAGE,
5888
+ options: {
5889
+ bootstrap_global_options: context.bootstrapGlobal,
5890
+ commander_code: code ?? "commander.helpDisplayed"
5891
+ },
5892
+ resolutionStage: "parse"
5893
+ });
5894
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5895
+ command: unknownToken,
5896
+ error_code: classification.code,
5897
+ error_category: errorCategory,
5898
+ exit_code: EXIT_CODE.USAGE,
5899
+ error_message: classification.detail,
5900
+ command_resolution: commandResolution,
5901
+ resolution_stage: "parse",
5902
+ source_context: activeTelemetryCommandContext?.source_context
5903
+ });
5904
+ const renderedUsage = context.jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors) : await formatCommanderUsageMessage({ message: unknownMessage }, program, recoveryCommandDescriptors);
5905
+ await finishRunPmCliFailure({
5906
+ errorMessage: unknownMessage,
5907
+ exitCode: EXIT_CODE.USAGE,
5908
+ classificationCode: classification.code,
5909
+ errorCategory,
5910
+ commandResolution,
5911
+ resolutionStage: "parse"
5912
+ });
5913
+ printError(renderedUsage);
5914
+ if (loggedHandledErrorToSentry) {
5915
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5916
+ }
5917
+ process.exitCode = EXIT_CODE.USAGE;
5918
+ }
5919
+ async function handleRunPmCliHelpDisplayError(context, code, rawMessage) {
5920
+ const isHelpDisplayCode = code === "commander.helpDisplayed" || code === "commander.help" || code === "commander.helpCommand";
5921
+ if (!isHelpDisplayCode && !rawMessage.includes("(outputHelp)")) {
5922
+ return false;
5923
+ }
5924
+ const helpRequest = parseBootstrapHelpRequest(context.invocationArgv);
5925
+ if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
5926
+ await handleUnknownHelpCommandError(context, code);
5927
+ return true;
5928
+ }
5929
+ await finishRunPmCliSuccessParse();
5930
+ return true;
5931
+ }
5932
+ async function handleRunPmCliCommanderUsageError(context, code) {
5933
+ const usageContext = await resolveCommanderUsageContext(context.error, program, activeRuntimeExtensionCommandDescriptors);
5934
+ const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5935
+ unknownCommandExamples: usageContext.unknownCommandExamples,
5936
+ unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5937
+ attemptedCommand: usageContext.attemptedCommand,
5938
+ normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5939
+ providedOptionFlags: usageContext.providedOptionFlags,
5940
+ unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5941
+ suggestedRetryCommand: usageContext.suggestedRetryCommand
5942
+ });
5943
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5944
+ command: context.attemptedCommand,
5945
+ errorCode: classification.code,
5946
+ errorMessage: classification.detail,
5947
+ exitCode: EXIT_CODE.USAGE,
5948
+ options: {
5949
+ bootstrap_global_options: context.bootstrapGlobal,
5950
+ commander_code: code
5951
+ },
5952
+ resolutionStage: "parse"
5953
+ });
5954
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5955
+ command: context.attemptedCommand,
5956
+ error_code: classification.code,
5957
+ error_category: errorCategory,
5958
+ exit_code: EXIT_CODE.USAGE,
5959
+ error_message: classification.detail,
5960
+ command_resolution: commandResolution,
5961
+ resolution_stage: "parse",
5962
+ source_context: activeTelemetryCommandContext?.source_context
5963
+ });
5964
+ const renderedUsage = context.jsonErrors ? await formatCommanderUsageJson(context.error, program, activeRuntimeExtensionCommandDescriptors) : await formatCommanderUsageMessage(context.error, program, activeRuntimeExtensionCommandDescriptors);
5965
+ await finishRunPmCliFailure({
5966
+ errorMessage: usageContext.message,
5967
+ exitCode: EXIT_CODE.USAGE,
5968
+ classificationCode: classification.code,
5969
+ errorCategory,
5970
+ commandResolution,
5971
+ resolutionStage: "parse"
5972
+ });
5973
+ printError(renderedUsage);
5974
+ if (loggedHandledErrorToSentry) {
5975
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5976
+ }
5977
+ process.exitCode = EXIT_CODE.USAGE;
5978
+ }
5979
+ function shouldHandleRunPmCliCommanderError(error) {
5980
+ if (typeof error !== "object" || error === null || !("code" in error)) {
5981
+ return false;
5982
+ }
5983
+ const code = error.code;
5984
+ if (typeof code === "string" && (code === "commander.version" || code.startsWith("commander."))) {
5985
+ return true;
5986
+ }
5987
+ const rawMessage = String(error.message ?? "");
5988
+ return rawMessage.includes("(outputHelp)");
5989
+ }
5990
+ async function handleRunPmCliCommanderError(context) {
5991
+ const code = context.error.code;
5992
+ const rawMessage = String(context.error.message ?? "");
5993
+ if (await handleRunPmCliHelpDisplayError(context, code, rawMessage)) {
5994
+ return;
5995
+ }
5996
+ if (code === "commander.version") {
5997
+ await finishRunPmCliSuccessParse();
5998
+ return;
5999
+ }
6000
+ await handleRunPmCliCommanderUsageError(context, code);
6001
+ }
6002
+ async function handleRunPmCliError(params) {
6003
+ const bootstrapGlobal = parseBootstrapGlobalOptions(params.invocationArgv);
6004
+ const bootstrapPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
6005
+ const context = {
6006
+ error: params.error,
6007
+ invocationArgv: params.invocationArgv,
6008
+ bootstrapGlobal,
6009
+ jsonErrors: bootstrapGlobal.json,
6010
+ bootstrapPmRoot,
6011
+ attemptedCommand: parseBootstrapCommandName(params.invocationArgv) ?? "<unknown>",
6012
+ emitTelemetryCommandError: createTelemetryCommandErrorEmitter({
6013
+ invocationArgv: params.invocationArgv,
6014
+ bootstrapGlobal,
6015
+ bootstrapPmRoot
6016
+ })
6017
+ };
6018
+ await prepareExtensionServicesForRunPmCliError({
6019
+ invocationArgv: params.invocationArgv,
6020
+ bootstrapGlobal,
6021
+ bootstrapPmRoot
6022
+ });
6023
+ if (await handleRunPmCliKnownError(context, readThrownExitCode(params.error))) {
6024
+ return;
6025
+ }
6026
+ if (shouldHandleRunPmCliCommanderError(params.error)) {
6027
+ await handleRunPmCliCommanderError(context);
6028
+ return;
6029
+ }
6030
+ await handleGenericRunPmCliError({
6031
+ error: params.error,
6032
+ attemptedCommand: context.attemptedCommand,
6033
+ bootstrapGlobal,
6034
+ emitTelemetryCommandError: context.emitTelemetryCommandError
6035
+ });
6036
+ }
5653
6037
  async function runPmCli(rawArgv = process.argv.slice(2)) {
5654
6038
  const bootstrapInvocation = normalizeBootstrapInvocation(rawArgv);
5655
6039
  const invocationArgv = bootstrapInvocation.argv;
@@ -5684,268 +6068,7 @@ async function runPmCli(rawArgv = process.argv.slice(2)) {
5684
6068
  }
5685
6069
  await program.parseAsync(invocationProcessArgv);
5686
6070
  } catch (error) {
5687
- const bootstrapGlobal = parseBootstrapGlobalOptions(invocationArgv);
5688
- const jsonErrors = bootstrapGlobal.json;
5689
- const bootstrapPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
5690
- const attemptedCommand = parseBootstrapCommandName(invocationArgv) ?? "<unknown>";
5691
- const emitTelemetryCommandError = async (params) => {
5692
- const errorCategory = resolveTelemetryErrorCategory(params.errorCode);
5693
- const commandResolution = deriveTelemetryCommandResolution({
5694
- ok: false,
5695
- errorCode: params.errorCode,
5696
- errorCategory
5697
- });
5698
- await emitTelemetryErrorEvent({
5699
- command: params.command,
5700
- args: invocationArgv,
5701
- options: params.options,
5702
- global: bootstrapGlobal,
5703
- pm_version: CLI_VERSION,
5704
- pm_root: bootstrapPmRoot,
5705
- error_code: params.errorCode,
5706
- error_message: params.errorMessage,
5707
- exit_code: params.exitCode,
5708
- error_category: errorCategory,
5709
- command_resolution: commandResolution,
5710
- resolution_stage: params.resolutionStage
5711
- });
5712
- return {
5713
- errorCategory,
5714
- commandResolution
5715
- };
5716
- };
5717
- if (!bootstrapGlobal.noExtensions) {
5718
- const bootstrapProbe = buildBootstrapActivationProbe(invocationArgv);
5719
- const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(bootstrapPmRoot);
5720
- if (discoverySnapshot && discoveryNeedsActivationForProbe(discoverySnapshot.discovery, bootstrapProbe)) {
5721
- const bootstrapSnapshot = await loadRuntimeExtensionSnapshot(bootstrapPmRoot);
5722
- setActiveExtensionServices(bootstrapSnapshot?.services ?? { overrides: [] });
5723
- } else {
5724
- if (discoverySnapshot) {
5725
- emitExtensionSkippedProfile(bootstrapProfileEnabled(invocationArgv), discoverySnapshot, bootstrapProbe);
5726
- }
5727
- setActiveExtensionServices({ overrides: [] });
5728
- }
5729
- }
5730
- const numericExitCode = readThrownExitCode(error);
5731
- if (error instanceof PmCliError || !isCommanderError(error) && typeof numericExitCode === "number" && Number.isFinite(numericExitCode)) {
5732
- const errorMessage = describeUnknownError(error);
5733
- const exitCode = error instanceof PmCliError ? error.exitCode : normalizeThrownExitCode(numericExitCode);
5734
- const context = error instanceof PmCliError ? error.context : void 0;
5735
- const enrichedContext = buildPmCliRecoveryContext(context, invocationArgv, errorMessage);
5736
- const classification = classifyPmCliError(errorMessage, enrichedContext);
5737
- const renderedError = jsonErrors ? JSON.stringify(formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext), null, 2) : formatPmCliErrorForDisplay(errorMessage, enrichedContext);
5738
- printError(renderedError);
5739
- const { errorCategory, commandResolution } = await emitTelemetryCommandError({
5740
- command: attemptedCommand,
5741
- errorCode: classification.code,
5742
- errorMessage: classification.detail,
5743
- exitCode,
5744
- options: {
5745
- bootstrap_global_options: bootstrapGlobal
5746
- },
5747
- resolutionStage: "execute"
5748
- });
5749
- const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5750
- command: attemptedCommand,
5751
- error_code: classification.code,
5752
- error_category: errorCategory,
5753
- exit_code: exitCode,
5754
- error_message: classification.detail,
5755
- command_resolution: commandResolution,
5756
- resolution_stage: "execute",
5757
- source_context: activeTelemetryCommandContext?.source_context
5758
- });
5759
- sentryFinishCommandSpan(false, errorMessage, {
5760
- error_code: classification.code,
5761
- error_category: errorCategory,
5762
- exit_code: exitCode,
5763
- command_resolution: commandResolution,
5764
- resolution_stage: "execute"
5765
- });
5766
- await runAndClearAfterCommandHooks({
5767
- ok: false,
5768
- error: errorMessage,
5769
- exit_code: exitCode,
5770
- error_code: classification.code,
5771
- error_category: errorCategory,
5772
- command_resolution: commandResolution,
5773
- resolution_stage: "execute"
5774
- });
5775
- if (loggedHandledErrorToSentry) {
5776
- sentryCaptureCliError(wrapThrownErrorForSentry(error, errorMessage));
5777
- }
5778
- if (loggedHandledErrorToSentry) {
5779
- await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5780
- }
5781
- process.exitCode = exitCode;
5782
- return;
5783
- }
5784
- if (typeof error === "object" && error !== null && "code" in error) {
5785
- const code = error.code;
5786
- const rawMessage = typeof error.message === "string" ? error.message ?? "" : "";
5787
- const isHelpDisplayCode = code === "commander.helpDisplayed" || code === "commander.help" || code === "commander.helpCommand";
5788
- if (isHelpDisplayCode || rawMessage.includes("(outputHelp)")) {
5789
- const helpRequest = parseBootstrapHelpRequest(invocationArgv);
5790
- if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
5791
- const unknownToken = helpRequest.commandPathTokens[0] ?? parseBootstrapCommandName(invocationArgv) ?? "<command>";
5792
- const unknownMessage = `unknown command '${unknownToken}'`;
5793
- const recoveryCommandDescriptors = await loadRuntimeExtensionCommandDescriptorsForRecovery(resolvePmRoot(process.cwd(), bootstrapGlobal.path));
5794
- const usageContext = await resolveCommanderUsageContext({ message: unknownMessage }, program, recoveryCommandDescriptors);
5795
- const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5796
- unknownCommandExamples: usageContext.unknownCommandExamples,
5797
- unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5798
- attemptedCommand: usageContext.attemptedCommand,
5799
- normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5800
- providedOptionFlags: usageContext.providedOptionFlags,
5801
- unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5802
- suggestedRetryCommand: usageContext.suggestedRetryCommand
5803
- });
5804
- const { errorCategory, commandResolution } = await emitTelemetryCommandError({
5805
- command: unknownToken,
5806
- errorCode: classification.code,
5807
- errorMessage: classification.detail,
5808
- exitCode: EXIT_CODE.USAGE,
5809
- options: {
5810
- bootstrap_global_options: bootstrapGlobal,
5811
- commander_code: code ?? "commander.helpDisplayed"
5812
- },
5813
- resolutionStage: "parse"
5814
- });
5815
- const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5816
- command: unknownToken,
5817
- error_code: classification.code,
5818
- error_category: errorCategory,
5819
- exit_code: EXIT_CODE.USAGE,
5820
- error_message: classification.detail,
5821
- command_resolution: commandResolution,
5822
- resolution_stage: "parse",
5823
- source_context: activeTelemetryCommandContext?.source_context
5824
- });
5825
- const renderedUsage = jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors) : await formatCommanderUsageMessage({ message: unknownMessage }, program, recoveryCommandDescriptors);
5826
- sentryFinishCommandSpan(false, unknownMessage, {
5827
- error_code: classification.code,
5828
- error_category: errorCategory,
5829
- exit_code: EXIT_CODE.USAGE,
5830
- command_resolution: commandResolution,
5831
- resolution_stage: "parse"
5832
- });
5833
- await runAndClearAfterCommandHooks({
5834
- ok: false,
5835
- error: unknownMessage,
5836
- exit_code: EXIT_CODE.USAGE,
5837
- error_code: classification.code,
5838
- error_category: errorCategory,
5839
- command_resolution: commandResolution,
5840
- resolution_stage: "parse"
5841
- });
5842
- if (jsonErrors) {
5843
- printError(renderedUsage);
5844
- } else {
5845
- printError(renderedUsage);
5846
- }
5847
- if (loggedHandledErrorToSentry) {
5848
- await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5849
- }
5850
- process.exitCode = EXIT_CODE.USAGE;
5851
- return;
5852
- }
5853
- sentryFinishCommandSpan(true, void 0, {
5854
- exit_code: EXIT_CODE.SUCCESS,
5855
- command_resolution: "success",
5856
- resolution_stage: "parse"
5857
- });
5858
- await runAndClearAfterCommandHooks({
5859
- ok: true,
5860
- exit_code: EXIT_CODE.SUCCESS,
5861
- command_resolution: "success",
5862
- resolution_stage: "parse"
5863
- });
5864
- process.exitCode = EXIT_CODE.SUCCESS;
5865
- return;
5866
- }
5867
- if (code === "commander.version") {
5868
- sentryFinishCommandSpan(true, void 0, {
5869
- exit_code: EXIT_CODE.SUCCESS,
5870
- command_resolution: "success",
5871
- resolution_stage: "parse"
5872
- });
5873
- await runAndClearAfterCommandHooks({
5874
- ok: true,
5875
- exit_code: EXIT_CODE.SUCCESS,
5876
- command_resolution: "success",
5877
- resolution_stage: "parse"
5878
- });
5879
- process.exitCode = EXIT_CODE.SUCCESS;
5880
- return;
5881
- }
5882
- if (code?.startsWith("commander.")) {
5883
- const usageContext = await resolveCommanderUsageContext(error, program, activeRuntimeExtensionCommandDescriptors);
5884
- const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5885
- unknownCommandExamples: usageContext.unknownCommandExamples,
5886
- unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5887
- attemptedCommand: usageContext.attemptedCommand,
5888
- normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5889
- providedOptionFlags: usageContext.providedOptionFlags,
5890
- unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5891
- suggestedRetryCommand: usageContext.suggestedRetryCommand
5892
- });
5893
- const { errorCategory, commandResolution } = await emitTelemetryCommandError({
5894
- command: attemptedCommand,
5895
- errorCode: classification.code,
5896
- errorMessage: classification.detail,
5897
- exitCode: EXIT_CODE.USAGE,
5898
- options: {
5899
- bootstrap_global_options: bootstrapGlobal,
5900
- commander_code: code
5901
- },
5902
- resolutionStage: "parse"
5903
- });
5904
- const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5905
- command: attemptedCommand,
5906
- error_code: classification.code,
5907
- error_category: errorCategory,
5908
- exit_code: EXIT_CODE.USAGE,
5909
- error_message: classification.detail,
5910
- command_resolution: commandResolution,
5911
- resolution_stage: "parse",
5912
- source_context: activeTelemetryCommandContext?.source_context
5913
- });
5914
- const renderedUsage = jsonErrors ? await formatCommanderUsageJson(error, program, activeRuntimeExtensionCommandDescriptors) : await formatCommanderUsageMessage(error, program, activeRuntimeExtensionCommandDescriptors);
5915
- sentryFinishCommandSpan(false, usageContext.message, {
5916
- error_code: classification.code,
5917
- error_category: errorCategory,
5918
- exit_code: EXIT_CODE.USAGE,
5919
- command_resolution: commandResolution,
5920
- resolution_stage: "parse"
5921
- });
5922
- await runAndClearAfterCommandHooks({
5923
- ok: false,
5924
- error: usageContext.message,
5925
- exit_code: EXIT_CODE.USAGE,
5926
- error_code: classification.code,
5927
- error_category: errorCategory,
5928
- command_resolution: commandResolution,
5929
- resolution_stage: "parse"
5930
- });
5931
- if (jsonErrors) {
5932
- printError(renderedUsage);
5933
- } else {
5934
- printError(renderedUsage);
5935
- }
5936
- if (loggedHandledErrorToSentry) {
5937
- await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5938
- }
5939
- process.exitCode = EXIT_CODE.USAGE;
5940
- return;
5941
- }
5942
- }
5943
- await handleGenericRunPmCliError({
5944
- error,
5945
- attemptedCommand,
5946
- bootstrapGlobal,
5947
- emitTelemetryCommandError
5948
- });
6071
+ await handleRunPmCliError({ error, invocationArgv });
5949
6072
  }
5950
6073
  }
5951
6074
  var _testOnly = {
@@ -5984,6 +6107,12 @@ var _testOnly = {
5984
6107
  extensionProvidesTemplatesRuntime,
5985
6108
  hasAnyCapability,
5986
6109
  handleGenericRunPmCliError,
6110
+ handleRunPmCliCommanderError,
6111
+ handleRunPmCliError,
6112
+ handleRunPmCliHelpDisplayError,
6113
+ handleRunPmCliKnownError,
6114
+ handleRunPmCliCommanderUsageError,
6115
+ handleUnknownHelpCommandError,
5987
6116
  inferMissingFieldsFromErrorMessage,
5988
6117
  inferPostActionErrorCode,
5989
6118
  inferPostActionFailureMessage,
@@ -6000,12 +6129,14 @@ var _testOnly = {
6000
6129
  normalizeTelemetryResolutionStage,
6001
6130
  normalizeThrownExitCode,
6002
6131
  probeUsesAnyFlag,
6132
+ prepareExtensionServicesForRunPmCliError,
6003
6133
  readRecordBoolean,
6004
6134
  readRecordNumber,
6005
6135
  readRecordString,
6006
6136
  registerDynamicExtensionCommandPaths,
6007
6137
  registerRuntimeSchemaFieldFlags,
6008
6138
  resolveCoreCommandRegistrationSelection,
6139
+ resolveUnknownHelpToken,
6009
6140
  readThrownExitCode,
6010
6141
  runAndClearAfterCommandHooks,
6011
6142
  runRequiredExtensionCommand,
@@ -6013,8 +6144,10 @@ var _testOnly = {
6013
6144
  shouldLogHandledErrorToSentry,
6014
6145
  shouldRegisterDynamicExtensionPaths,
6015
6146
  shouldRegisterRuntimeSchemaFlags,
6147
+ shouldHandleRunPmCliCommanderError,
6016
6148
  setActiveExtensionHookContextForTest,
6017
6149
  setActiveRuntimeExtensionCommandDescriptorsForTest,
6150
+ setRecoveredExtensionServices,
6018
6151
  toLooseFieldDefinitionType,
6019
6152
  isImporterOrExporterCommandPath,
6020
6153
  validateDynamicExtensionCommandInvocation,