@unbrained/pm-cli 2026.7.1 → 2026.7.3

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 (625) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/CHANGELOG.md +25 -0
  3. package/CONTRIBUTING.md +2 -2
  4. package/README.md +1 -1
  5. package/dist/cli/commander-usage.d.ts +2 -0
  6. package/dist/cli/commander-usage.js +110 -86
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/activity.js +79 -57
  9. package/dist/cli/commands/activity.js.map +1 -1
  10. package/dist/cli/commands/aggregate.js +102 -79
  11. package/dist/cli/commands/aggregate.js.map +1 -1
  12. package/dist/cli/commands/calendar.js +278 -243
  13. package/dist/cli/commands/calendar.js.map +1 -1
  14. package/dist/cli/commands/close-many.js +176 -114
  15. package/dist/cli/commands/close-many.js.map +1 -1
  16. package/dist/cli/commands/close.js +157 -129
  17. package/dist/cli/commands/close.js.map +1 -1
  18. package/dist/cli/commands/comments-audit.js +50 -42
  19. package/dist/cli/commands/comments-audit.js.map +1 -1
  20. package/dist/cli/commands/config.d.ts +2 -0
  21. package/dist/cli/commands/config.js +443 -879
  22. package/dist/cli/commands/config.js.map +1 -1
  23. package/dist/cli/commands/context.js +365 -287
  24. package/dist/cli/commands/context.js.map +1 -1
  25. package/dist/cli/commands/contracts.js +352 -238
  26. package/dist/cli/commands/contracts.js.map +1 -1
  27. package/dist/cli/commands/create.js +32 -17
  28. package/dist/cli/commands/create.js.map +1 -1
  29. package/dist/cli/commands/dedupe-audit.js +46 -39
  30. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  31. package/dist/cli/commands/dedupe-merge.js +88 -69
  32. package/dist/cli/commands/dedupe-merge.js.map +1 -1
  33. package/dist/cli/commands/extension/doctor.js +56 -67
  34. package/dist/cli/commands/extension/doctor.js.map +1 -1
  35. package/dist/cli/commands/extension/shared.js +21 -15
  36. package/dist/cli/commands/extension/shared.js.map +1 -1
  37. package/dist/cli/commands/get.js +114 -81
  38. package/dist/cli/commands/get.js.map +1 -1
  39. package/dist/cli/commands/health.d.ts +17 -0
  40. package/dist/cli/commands/health.js +545 -417
  41. package/dist/cli/commands/health.js.map +1 -1
  42. package/dist/cli/commands/history-compact.js +209 -140
  43. package/dist/cli/commands/history-compact.js.map +1 -1
  44. package/dist/cli/commands/history-redact.js +162 -119
  45. package/dist/cli/commands/history-redact.js.map +1 -1
  46. package/dist/cli/commands/history-repair.js +120 -85
  47. package/dist/cli/commands/history-repair.js.map +1 -1
  48. package/dist/cli/commands/init-agent-guidance.js +32 -19
  49. package/dist/cli/commands/init-agent-guidance.js.map +1 -1
  50. package/dist/cli/commands/init.d.ts +8 -2
  51. package/dist/cli/commands/init.js +263 -162
  52. package/dist/cli/commands/init.js.map +1 -1
  53. package/dist/cli/commands/list.js +152 -102
  54. package/dist/cli/commands/list.js.map +1 -1
  55. package/dist/cli/commands/next.js +60 -40
  56. package/dist/cli/commands/next.js.map +1 -1
  57. package/dist/cli/commands/plan.js +373 -298
  58. package/dist/cli/commands/plan.js.map +1 -1
  59. package/dist/cli/commands/profile.js +23 -15
  60. package/dist/cli/commands/profile.js.map +1 -1
  61. package/dist/cli/commands/recurrence-parsers.js +43 -25
  62. package/dist/cli/commands/recurrence-parsers.js.map +1 -1
  63. package/dist/cli/commands/reindex.d.ts +21 -5
  64. package/dist/cli/commands/reindex.js +345 -205
  65. package/dist/cli/commands/reindex.js.map +1 -1
  66. package/dist/cli/commands/restore.d.ts +8 -7
  67. package/dist/cli/commands/restore.js +105 -69
  68. package/dist/cli/commands/restore.js.map +1 -1
  69. package/dist/cli/commands/schema.js +33 -30
  70. package/dist/cli/commands/schema.js.map +1 -1
  71. package/dist/cli/commands/search.d.ts +10 -2
  72. package/dist/cli/commands/search.js +503 -470
  73. package/dist/cli/commands/search.js.map +1 -1
  74. package/dist/cli/commands/telemetry.js +98 -87
  75. package/dist/cli/commands/telemetry.js.map +1 -1
  76. package/dist/cli/commands/test-all.js +237 -168
  77. package/dist/cli/commands/test-all.js.map +1 -1
  78. package/dist/cli/commands/test.d.ts +6 -5
  79. package/dist/cli/commands/test.js +424 -344
  80. package/dist/cli/commands/test.js.map +1 -1
  81. package/dist/cli/commands/update-many.js +57 -42
  82. package/dist/cli/commands/update-many.js.map +1 -1
  83. package/dist/cli/commands/update.d.ts +1 -1
  84. package/dist/cli/commands/update.js +738 -671
  85. package/dist/cli/commands/update.js.map +1 -1
  86. package/dist/cli/commands/validate.d.ts +20 -1
  87. package/dist/cli/commands/validate.js +478 -343
  88. package/dist/cli/commands/validate.js.map +1 -1
  89. package/dist/cli/error-guidance.js +406 -361
  90. package/dist/cli/error-guidance.js.map +1 -1
  91. package/dist/cli/extension-command-help.js +27 -19
  92. package/dist/cli/extension-command-help.js.map +1 -1
  93. package/dist/cli/help-json-payload.js +57 -49
  94. package/dist/cli/help-json-payload.js.map +1 -1
  95. package/dist/cli/main.d.ts +47 -0
  96. package/dist/cli/main.js +474 -371
  97. package/dist/cli/main.js.map +1 -1
  98. package/dist/cli/migration-gates.js +22 -45
  99. package/dist/cli/migration-gates.js.map +1 -1
  100. package/dist/cli/register-list-query.js +299 -310
  101. package/dist/cli/register-list-query.js.map +1 -1
  102. package/dist/cli/register-mutation.js +763 -779
  103. package/dist/cli/register-mutation.js.map +1 -1
  104. package/dist/cli/register-operations.js +386 -362
  105. package/dist/cli/register-operations.js.map +1 -1
  106. package/dist/cli/register-setup.js +120 -101
  107. package/dist/cli/register-setup.js.map +1 -1
  108. package/dist/cli/registration-helpers.d.ts +4 -0
  109. package/dist/cli/registration-helpers.js +45 -56
  110. package/dist/cli/registration-helpers.js.map +1 -1
  111. package/dist/cli-bundle/chunks/{activity-DBLQVIP6.js → activity-5YWLSPGE.js} +9 -9
  112. package/dist/cli-bundle/chunks/activity-BIML7K2D.js +16 -0
  113. package/dist/cli-bundle/chunks/{aggregate-SDF7DUOD.js → aggregate-2V2M3JZU.js} +107 -83
  114. package/dist/cli-bundle/chunks/{aggregate-SDF7DUOD.js.map → aggregate-2V2M3JZU.js.map} +2 -2
  115. package/dist/cli-bundle/chunks/{aggregate-JTEF4BP7.js → aggregate-EK7DXML7.js} +108 -84
  116. package/dist/cli-bundle/chunks/aggregate-EK7DXML7.js.map +1 -0
  117. package/dist/cli-bundle/chunks/{append-LOVPGVPT.js → append-EZESUVJT.js} +8 -8
  118. package/dist/cli-bundle/chunks/{append-QCFJSDFL.js → append-JFG4WQMG.js} +8 -8
  119. package/dist/cli-bundle/chunks/{chunk-TP5Q5ZD3.js → chunk-32IUNTG4.js} +158 -119
  120. package/dist/cli-bundle/chunks/chunk-32IUNTG4.js.map +1 -0
  121. package/dist/cli-bundle/chunks/{chunk-BHO33VBQ.js → chunk-3W2HJKJX.js} +3 -3
  122. package/dist/cli-bundle/chunks/{chunk-VARHOHYV.js → chunk-4EXFFP7T.js} +86 -52
  123. package/dist/cli-bundle/chunks/chunk-4EXFFP7T.js.map +7 -0
  124. package/dist/cli-bundle/chunks/{chunk-4DUVCVLZ.js → chunk-4PFVUUYV.js} +2 -2
  125. package/dist/cli-bundle/chunks/{chunk-JSU5P7VS.js → chunk-4WB6S4YX.js} +308 -184
  126. package/dist/cli-bundle/chunks/chunk-4WB6S4YX.js.map +1 -0
  127. package/dist/cli-bundle/chunks/{chunk-HXTQJXWT.js → chunk-572FKBRL.js} +61 -102
  128. package/dist/cli-bundle/chunks/chunk-572FKBRL.js.map +1 -0
  129. package/dist/cli-bundle/chunks/{chunk-IJYK2T43.js → chunk-5E7N4T2Z.js} +2 -2
  130. package/dist/cli-bundle/chunks/{chunk-NKZAN7BD.js → chunk-5IZUBZBR.js} +3 -3
  131. package/dist/cli-bundle/chunks/{chunk-NOLPZMSV.js → chunk-5JIWFWOZ.js} +2 -2
  132. package/dist/cli-bundle/chunks/{chunk-FFMQB7WR.js → chunk-67LARBDL.js} +493 -404
  133. package/dist/cli-bundle/chunks/chunk-67LARBDL.js.map +1 -0
  134. package/dist/cli-bundle/chunks/{chunk-6AQZPVHQ.js → chunk-6CDCWKSX.js} +4 -4
  135. package/dist/cli-bundle/chunks/{chunk-3K2M5OYU.js → chunk-6KRFL33E.js} +308 -184
  136. package/dist/cli-bundle/chunks/chunk-6KRFL33E.js.map +7 -0
  137. package/dist/cli-bundle/chunks/{chunk-LB6TP6MC.js → chunk-6NYJGMTY.js} +2 -2
  138. package/dist/cli-bundle/chunks/{chunk-SLMUGTK3.js → chunk-7CLLC75T.js} +4 -4
  139. package/dist/cli-bundle/chunks/{chunk-2466X6E4.js → chunk-7LYO6S5A.js} +8 -8
  140. package/dist/cli-bundle/chunks/{chunk-W4ULYO7Z.js → chunk-A3OQ7TFW.js} +8 -8
  141. package/dist/cli-bundle/chunks/{chunk-5CGRF3L5.js → chunk-AIKU3IIL.js} +153 -90
  142. package/dist/cli-bundle/chunks/chunk-AIKU3IIL.js.map +1 -0
  143. package/dist/cli-bundle/chunks/{chunk-WYDHYJPO.js → chunk-AJHYQCBJ.js} +39 -5
  144. package/dist/cli-bundle/chunks/chunk-AJHYQCBJ.js.map +7 -0
  145. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js → chunk-B4O5S7I3.js} +79 -57
  146. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js.map → chunk-B4O5S7I3.js.map} +2 -2
  147. package/dist/cli-bundle/chunks/{chunk-OTUHB4HS.js → chunk-BE2SR6QL.js} +92 -77
  148. package/dist/cli-bundle/chunks/chunk-BE2SR6QL.js.map +1 -0
  149. package/dist/cli-bundle/chunks/{chunk-JLM7BHI7.js → chunk-BI4R7HI2.js} +75 -53
  150. package/dist/cli-bundle/chunks/chunk-BI4R7HI2.js.map +7 -0
  151. package/dist/cli-bundle/chunks/{chunk-AXIDKKAT.js → chunk-CXR3CMBQ.js} +33 -6
  152. package/dist/cli-bundle/chunks/chunk-CXR3CMBQ.js.map +1 -0
  153. package/dist/cli-bundle/chunks/{chunk-ZETXE4SE.js → chunk-ECU6MMTQ.js} +713 -613
  154. package/dist/cli-bundle/chunks/chunk-ECU6MMTQ.js.map +1 -0
  155. package/dist/cli-bundle/chunks/{chunk-2D4HATP2.js → chunk-EJ2OCBHF.js} +54 -30
  156. package/dist/cli-bundle/chunks/chunk-EJ2OCBHF.js.map +1 -0
  157. package/dist/cli-bundle/chunks/{chunk-BDTISOSD.js → chunk-EQURFOMH.js} +41 -26
  158. package/dist/cli-bundle/chunks/chunk-EQURFOMH.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{chunk-GJ326ZKX.js → chunk-ER4ME5U2.js} +3 -3
  160. package/dist/cli-bundle/chunks/{chunk-HZZEHPRG.js → chunk-ERG65A2L.js} +2 -2
  161. package/dist/cli-bundle/chunks/{chunk-IZBR4NRW.js → chunk-F6WNBITZ.js} +157 -113
  162. package/dist/cli-bundle/chunks/chunk-F6WNBITZ.js.map +7 -0
  163. package/dist/cli-bundle/chunks/{chunk-L5OEFZQG.js → chunk-FH2H3CBD.js} +3 -3
  164. package/dist/cli-bundle/chunks/{chunk-JPECA746.js → chunk-FUFFPIYA.js} +2 -2
  165. package/dist/cli-bundle/chunks/{chunk-CF7RL6FR.js → chunk-FZJM2TXF.js} +110 -73
  166. package/dist/cli-bundle/chunks/chunk-FZJM2TXF.js.map +1 -0
  167. package/dist/cli-bundle/chunks/{chunk-27BXPBAY.js → chunk-GUYNUXQT.js} +3 -3
  168. package/dist/cli-bundle/chunks/{chunk-MAUKX7JC.js → chunk-GVJE5T7Q.js} +2 -2
  169. package/dist/cli-bundle/chunks/{chunk-3J6JRJ3I.js → chunk-HB4FAT3O.js} +42 -60
  170. package/dist/cli-bundle/chunks/chunk-HB4FAT3O.js.map +7 -0
  171. package/dist/cli-bundle/chunks/{chunk-55SNVXRQ.js → chunk-HQAF23Q2.js} +626 -484
  172. package/dist/cli-bundle/chunks/chunk-HQAF23Q2.js.map +7 -0
  173. package/dist/cli-bundle/chunks/{chunk-ZRP4VG5U.js → chunk-JBZ2NTKX.js} +2 -2
  174. package/dist/cli-bundle/chunks/{chunk-RMMQ74TG.js → chunk-JPATY4SE.js} +54 -30
  175. package/dist/cli-bundle/chunks/chunk-JPATY4SE.js.map +7 -0
  176. package/dist/cli-bundle/chunks/{chunk-IPYBJWTE.js → chunk-K5DT2YKM.js} +109 -72
  177. package/dist/cli-bundle/chunks/chunk-K5DT2YKM.js.map +7 -0
  178. package/dist/cli-bundle/chunks/{chunk-EJUDVUYZ.js → chunk-KEZOIPCR.js} +3 -3
  179. package/dist/cli-bundle/chunks/{chunk-RVUALSJF.js → chunk-KHVGM5CS.js} +466 -365
  180. package/dist/cli-bundle/chunks/chunk-KHVGM5CS.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{chunk-YITK2PJ6.js → chunk-KS6ATO47.js} +288 -175
  182. package/dist/cli-bundle/chunks/chunk-KS6ATO47.js.map +7 -0
  183. package/dist/cli-bundle/chunks/{chunk-7R4QEMZZ.js → chunk-L4SLHV6G.js} +463 -362
  184. package/dist/cli-bundle/chunks/chunk-L4SLHV6G.js.map +1 -0
  185. package/dist/cli-bundle/chunks/{chunk-RLDHZHQS.js → chunk-LBE5QFMZ.js} +158 -114
  186. package/dist/cli-bundle/chunks/chunk-LBE5QFMZ.js.map +1 -0
  187. package/dist/cli-bundle/chunks/{chunk-22WKIL3H.js → chunk-LCWQP6NM.js} +76 -54
  188. package/dist/cli-bundle/chunks/chunk-LCWQP6NM.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-KNPEF7QG.js → chunk-LOWVNZBZ.js} +91 -76
  190. package/dist/cli-bundle/chunks/chunk-LOWVNZBZ.js.map +7 -0
  191. package/dist/cli-bundle/chunks/{chunk-HYTGA6GI.js → chunk-MDHWWBNZ.js} +3 -3
  192. package/dist/cli-bundle/chunks/{chunk-N74UMG5H.js → chunk-MEZZZBYX.js} +2 -2
  193. package/dist/cli-bundle/chunks/{chunk-V3NOKJF2.js → chunk-MHRS5FUX.js} +288 -175
  194. package/dist/cli-bundle/chunks/chunk-MHRS5FUX.js.map +1 -0
  195. package/dist/cli-bundle/chunks/{chunk-3XZCOZ5J.js → chunk-NOIEVOK5.js} +391 -313
  196. package/dist/cli-bundle/chunks/chunk-NOIEVOK5.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{chunk-SDR5J34Q.js → chunk-NZ7QIUP5.js} +4 -4
  198. package/dist/cli-bundle/chunks/{chunk-UYUYDGIB.js → chunk-OGLGI22K.js} +115 -67
  199. package/dist/cli-bundle/chunks/{chunk-UYUYDGIB.js.map → chunk-OGLGI22K.js.map} +1 -1
  200. package/dist/cli-bundle/chunks/{chunk-DDPTYJIM.js → chunk-P5L7Z2O6.js} +2 -2
  201. package/dist/cli-bundle/chunks/{chunk-BZCEN4JA.js → chunk-PULUSQAV.js} +492 -403
  202. package/dist/cli-bundle/chunks/chunk-PULUSQAV.js.map +7 -0
  203. package/dist/cli-bundle/chunks/{chunk-3VGN2UWE.js → chunk-QCDTQCMW.js} +22 -30
  204. package/dist/cli-bundle/chunks/chunk-QCDTQCMW.js.map +1 -0
  205. package/dist/cli-bundle/chunks/{chunk-4A3BJ675.js → chunk-QNNQAAZ5.js} +24 -18
  206. package/dist/cli-bundle/chunks/{chunk-4A3BJ675.js.map → chunk-QNNQAAZ5.js.map} +1 -1
  207. package/dist/cli-bundle/chunks/{chunk-MDPEOIGN.js → chunk-RAHINBVP.js} +60 -101
  208. package/dist/cli-bundle/chunks/chunk-RAHINBVP.js.map +7 -0
  209. package/dist/cli-bundle/chunks/{chunk-CWFNTKQJ.js → chunk-RJH5VQHW.js} +43 -61
  210. package/dist/cli-bundle/chunks/chunk-RJH5VQHW.js.map +1 -0
  211. package/dist/cli-bundle/chunks/{chunk-OGXLACHC.js → chunk-SU2E4AWU.js} +6 -6
  212. package/dist/cli-bundle/chunks/{chunk-HPPFYYOV.js → chunk-SU3TB4NS.js} +2 -2
  213. package/dist/cli-bundle/chunks/{chunk-JWXRETDF.js → chunk-SYE6WMV6.js} +626 -484
  214. package/dist/cli-bundle/chunks/chunk-SYE6WMV6.js.map +1 -0
  215. package/dist/cli-bundle/chunks/{chunk-NWMZWYYB.js → chunk-T3P7PMZP.js} +42 -27
  216. package/dist/cli-bundle/chunks/chunk-T3P7PMZP.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{chunk-G7I7DEZA.js → chunk-T4XBKJ3F.js} +4 -4
  218. package/dist/cli-bundle/chunks/{chunk-RH5ZBYFD.js → chunk-T6AXEBOP.js} +23 -17
  219. package/dist/cli-bundle/chunks/{chunk-RH5ZBYFD.js.map → chunk-T6AXEBOP.js.map} +2 -2
  220. package/dist/cli-bundle/chunks/{chunk-5QFDBI4F.js → chunk-TQ6AX5SQ.js} +58 -69
  221. package/dist/cli-bundle/chunks/{chunk-5QFDBI4F.js.map → chunk-TQ6AX5SQ.js.map} +2 -2
  222. package/dist/cli-bundle/chunks/{chunk-4XOIEKSD.js → chunk-U3S2B7TA.js} +86 -52
  223. package/dist/cli-bundle/chunks/chunk-U3S2B7TA.js.map +1 -0
  224. package/dist/cli-bundle/chunks/{chunk-VICZWYGZ.js → chunk-U5TR4N7J.js} +7 -7
  225. package/dist/cli-bundle/chunks/{chunk-EVMTBV6V.js → chunk-UMNQZS4H.js} +3 -3
  226. package/dist/cli-bundle/chunks/{chunk-A7FPBAQS.js → chunk-WJA3PXW7.js} +7 -7
  227. package/dist/cli-bundle/chunks/{chunk-RGEMWD6Q.js → chunk-WRYERRZX.js} +157 -118
  228. package/dist/cli-bundle/chunks/chunk-WRYERRZX.js.map +7 -0
  229. package/dist/cli-bundle/chunks/{chunk-NUHHPVVS.js → chunk-WYOIIFSE.js} +712 -612
  230. package/dist/cli-bundle/chunks/chunk-WYOIIFSE.js.map +7 -0
  231. package/dist/cli-bundle/chunks/{chunk-4DSGXSBL.js → chunk-XRYSCRZR.js} +116 -68
  232. package/dist/cli-bundle/chunks/{chunk-4DSGXSBL.js.map → chunk-XRYSCRZR.js.map} +3 -3
  233. package/dist/cli-bundle/chunks/{chunk-NU2UEROZ.js → chunk-YF746GTH.js} +59 -70
  234. package/dist/cli-bundle/chunks/{chunk-NU2UEROZ.js.map → chunk-YF746GTH.js.map} +1 -1
  235. package/dist/cli-bundle/chunks/{chunk-JMP4E6D7.js → chunk-YPWUSH72.js} +390 -312
  236. package/dist/cli-bundle/chunks/{chunk-JMP4E6D7.js.map → chunk-YPWUSH72.js.map} +2 -2
  237. package/dist/cli-bundle/chunks/{chunk-QCWF6IYD.js → chunk-YSDFIY7N.js} +3 -3
  238. package/dist/cli-bundle/chunks/{chunk-UZIWVBE6.js → chunk-YSGTMDWC.js} +2 -2
  239. package/dist/cli-bundle/chunks/{chunk-NFDPYAIP.js → chunk-YVKZ3ANP.js} +21 -29
  240. package/dist/cli-bundle/chunks/chunk-YVKZ3ANP.js.map +7 -0
  241. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js → chunk-Z4DGFQDH.js} +80 -58
  242. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js.map → chunk-Z4DGFQDH.js.map} +1 -1
  243. package/dist/cli-bundle/chunks/{chunk-64HNBBFQ.js → chunk-Z5F6XZXE.js} +6 -6
  244. package/dist/cli-bundle/chunks/{chunk-AVEE5EHK.js → chunk-Z7RPDF2Y.js} +3 -3
  245. package/dist/cli-bundle/chunks/{chunk-3S2KT7NG.js → chunk-ZFTKYWIF.js} +152 -89
  246. package/dist/cli-bundle/chunks/chunk-ZFTKYWIF.js.map +7 -0
  247. package/dist/cli-bundle/chunks/{claim-T3GCKV7C.js → claim-2BGBGSVI.js} +8 -8
  248. package/dist/cli-bundle/chunks/{claim-EMQLYPRW.js → claim-5GU7OE67.js} +8 -8
  249. package/dist/cli-bundle/chunks/close-6YODBUIV.js +14 -0
  250. package/dist/cli-bundle/chunks/{close-TQYAAFJP.js → close-AFVKPR57.js} +7 -7
  251. package/dist/cli-bundle/chunks/{close-many-BG5QQIDQ.js → close-many-7KLOSYLP.js} +186 -122
  252. package/dist/cli-bundle/chunks/close-many-7KLOSYLP.js.map +7 -0
  253. package/dist/cli-bundle/chunks/{close-many-LDRVEQY2.js → close-many-JKUJMHLG.js} +187 -123
  254. package/dist/cli-bundle/chunks/close-many-JKUJMHLG.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{comments-YUXJRZPQ.js → comments-DNWHEBOS.js} +9 -9
  256. package/dist/cli-bundle/chunks/{comments-QCKR2YY2.js → comments-RW23R3VE.js} +9 -9
  257. package/dist/cli-bundle/chunks/config-AUM5WBYA.js +1072 -0
  258. package/dist/cli-bundle/chunks/config-AUM5WBYA.js.map +7 -0
  259. package/dist/cli-bundle/chunks/config-OZWSA2NP.js +1062 -0
  260. package/dist/cli-bundle/chunks/config-OZWSA2NP.js.map +1 -0
  261. package/dist/cli-bundle/chunks/{context-B6275WPX.js → context-OYXRGY7S.js} +12 -12
  262. package/dist/cli-bundle/chunks/{context-OCZ3FJ4Z.js → context-PKCEHQY3.js} +12 -12
  263. package/dist/cli-bundle/chunks/{contracts-HN7ABKLP.js → contracts-L6ODXNUM.js} +320 -199
  264. package/dist/cli-bundle/chunks/contracts-L6ODXNUM.js.map +7 -0
  265. package/dist/cli-bundle/chunks/{contracts-W4FZVVD6.js → contracts-X74F2GSM.js} +321 -200
  266. package/dist/cli-bundle/chunks/contracts-X74F2GSM.js.map +1 -0
  267. package/dist/cli-bundle/chunks/{copy-DEM4DATS.js → copy-6XOR3HKN.js} +5 -5
  268. package/dist/cli-bundle/chunks/{copy-BTJOSKKT.js → copy-I4NCLBR4.js} +5 -5
  269. package/dist/cli-bundle/chunks/{create-RLRJMRTM.js → create-PM45M6PE.js} +12 -12
  270. package/dist/cli-bundle/chunks/create-Z7YCH3BE.js +28 -0
  271. package/dist/cli-bundle/chunks/{delete-BHK7VB2Z.js → delete-7YXHYG67.js} +5 -5
  272. package/dist/cli-bundle/chunks/{delete-LSVHAB4Y.js → delete-LPISP43T.js} +5 -5
  273. package/dist/cli-bundle/chunks/{deps-XHYXWEPT.js → deps-N2T26FME.js} +5 -5
  274. package/dist/cli-bundle/chunks/{deps-4UDFJRUA.js → deps-WATKQDE3.js} +5 -5
  275. package/dist/cli-bundle/chunks/{docs-GYZNVS26.js → docs-6LQ3GLM7.js} +7 -7
  276. package/dist/cli-bundle/chunks/{docs-26S44RXU.js → docs-Z3X6JZLT.js} +7 -7
  277. package/dist/cli-bundle/chunks/{eval-UYF3ZPVO.js → eval-6DCLG52D.js} +10 -10
  278. package/dist/cli-bundle/chunks/{eval-PGRVIJQU.js → eval-Y3ZCUTHK.js} +10 -10
  279. package/dist/cli-bundle/chunks/{extension-CPSLJQVE.js → extension-BNINIMT7.js} +11 -11
  280. package/dist/cli-bundle/chunks/{extension-CXJ6RELI.js → extension-QWE4YYK5.js} +11 -11
  281. package/dist/cli-bundle/chunks/{files-NQHEXUZD.js → files-6SGKHS6O.js} +7 -7
  282. package/dist/cli-bundle/chunks/{files-MBNICQFM.js → files-FUYPSOFJ.js} +7 -7
  283. package/dist/cli-bundle/chunks/{focus-DWYIG7GU.js → focus-2Q3K76G2.js} +6 -6
  284. package/dist/cli-bundle/chunks/{focus-XZW5423D.js → focus-ATLBWXXD.js} +6 -6
  285. package/dist/cli-bundle/chunks/{gc-LPVMKJQJ.js → gc-RUYEMNRF.js} +3 -3
  286. package/dist/cli-bundle/chunks/{gc-7GQYOS2G.js → gc-TDWSDR66.js} +3 -3
  287. package/dist/cli-bundle/chunks/{get-A7MAOHCU.js → get-2WGLX74N.js} +120 -80
  288. package/dist/cli-bundle/chunks/get-2WGLX74N.js.map +7 -0
  289. package/dist/cli-bundle/chunks/{get-DSDEKJ3L.js → get-LY6M2JIM.js} +121 -81
  290. package/dist/cli-bundle/chunks/get-LY6M2JIM.js.map +1 -0
  291. package/dist/cli-bundle/chunks/{health-3IPFLKXB.js → health-4RKHYS3T.js} +535 -371
  292. package/dist/cli-bundle/chunks/health-4RKHYS3T.js.map +1 -0
  293. package/dist/cli-bundle/chunks/{health-GZXGBZ36.js → health-TMFVNYRA.js} +534 -370
  294. package/dist/cli-bundle/chunks/health-TMFVNYRA.js.map +7 -0
  295. package/dist/cli-bundle/chunks/history-CGNQJXFE.js +18 -0
  296. package/dist/cli-bundle/chunks/{history-NERDJNUB.js → history-SGRRS72R.js} +8 -8
  297. package/dist/cli-bundle/chunks/{history-compact-2WRZ2WK4.js → history-compact-LOED43R3.js} +213 -134
  298. package/dist/cli-bundle/chunks/history-compact-LOED43R3.js.map +7 -0
  299. package/dist/cli-bundle/chunks/{history-compact-HR7BB4LR.js → history-compact-V5DNAQHH.js} +214 -135
  300. package/dist/cli-bundle/chunks/history-compact-V5DNAQHH.js.map +1 -0
  301. package/dist/cli-bundle/chunks/{history-redact-O3NBCNWC.js → history-redact-IRL7WJ3E.js} +9 -9
  302. package/dist/cli-bundle/chunks/history-redact-N3JK7VBW.js +19 -0
  303. package/dist/cli-bundle/chunks/{history-repair-XA3LC4GA.js → history-repair-4WVBVHFR.js} +124 -84
  304. package/dist/cli-bundle/chunks/history-repair-4WVBVHFR.js.map +1 -0
  305. package/dist/cli-bundle/chunks/{history-repair-LCMOS45X.js → history-repair-PGYQJMGD.js} +123 -83
  306. package/dist/cli-bundle/chunks/history-repair-PGYQJMGD.js.map +7 -0
  307. package/dist/cli-bundle/chunks/{init-64XDLQJB.js → init-4GESW7RM.js} +12 -12
  308. package/dist/cli-bundle/chunks/init-XIDPABA4.js +22 -0
  309. package/dist/cli-bundle/chunks/{learnings-LPKCSJX7.js → learnings-4BHWFFUV.js} +9 -9
  310. package/dist/cli-bundle/chunks/{learnings-JR6MA5TI.js → learnings-4FJY7WIW.js} +9 -9
  311. package/dist/cli-bundle/chunks/{list-G5Y65VF6.js → list-472TIOVK.js} +8 -8
  312. package/dist/cli-bundle/chunks/{list-DNBJVO3E.js → list-D7BF5CL2.js} +8 -8
  313. package/dist/cli-bundle/chunks/{next-FYTQF6HG.js → next-D5STGWI2.js} +71 -46
  314. package/dist/cli-bundle/chunks/next-D5STGWI2.js.map +1 -0
  315. package/dist/cli-bundle/chunks/{next-BCERKDUR.js → next-SFQZVX2B.js} +70 -45
  316. package/dist/cli-bundle/chunks/next-SFQZVX2B.js.map +7 -0
  317. package/dist/cli-bundle/chunks/{notes-2BMU3VVQ.js → notes-6KNOSLIT.js} +9 -9
  318. package/dist/cli-bundle/chunks/{notes-6KTGO2OJ.js → notes-W4UEICGF.js} +9 -9
  319. package/dist/cli-bundle/chunks/{plan-RKZHQVXR.js → plan-JO6V7BXO.js} +373 -279
  320. package/dist/cli-bundle/chunks/plan-JO6V7BXO.js.map +1 -0
  321. package/dist/cli-bundle/chunks/{plan-4WXEQCTN.js → plan-MJQW5XK3.js} +372 -278
  322. package/dist/cli-bundle/chunks/plan-MJQW5XK3.js.map +7 -0
  323. package/dist/cli-bundle/chunks/{profile-4OMM32CD.js → profile-3TOTMUR4.js} +27 -19
  324. package/dist/cli-bundle/chunks/profile-3TOTMUR4.js.map +7 -0
  325. package/dist/cli-bundle/chunks/{profile-QLER5ENE.js → profile-WIQY2KCV.js} +28 -20
  326. package/dist/cli-bundle/chunks/profile-WIQY2KCV.js.map +1 -0
  327. package/dist/cli-bundle/chunks/register-list-query-ELBHCCFI.js +416 -0
  328. package/dist/cli-bundle/chunks/register-list-query-ELBHCCFI.js.map +7 -0
  329. package/dist/cli-bundle/chunks/register-list-query-GAPQ6DM3.js +406 -0
  330. package/dist/cli-bundle/chunks/register-list-query-GAPQ6DM3.js.map +1 -0
  331. package/dist/cli-bundle/chunks/{register-mutation-KK7PHYYU.js → register-mutation-ROFE2YPC.js} +729 -702
  332. package/dist/cli-bundle/chunks/register-mutation-ROFE2YPC.js.map +7 -0
  333. package/dist/cli-bundle/chunks/{register-mutation-ENNDUAZG.js → register-mutation-SJWMVIJ2.js} +730 -703
  334. package/dist/cli-bundle/chunks/register-mutation-SJWMVIJ2.js.map +1 -0
  335. package/dist/cli-bundle/chunks/{register-operations-HZ6XERQG.js → register-operations-IADFVH53.js} +389 -365
  336. package/dist/cli-bundle/chunks/register-operations-IADFVH53.js.map +7 -0
  337. package/dist/cli-bundle/chunks/register-operations-MEKU3AKC.js +510 -0
  338. package/dist/cli-bundle/chunks/register-operations-MEKU3AKC.js.map +1 -0
  339. package/dist/cli-bundle/chunks/{register-setup-ZKJ53RS7.js → register-setup-3QJY43CY.js} +128 -103
  340. package/dist/cli-bundle/chunks/register-setup-3QJY43CY.js.map +7 -0
  341. package/dist/cli-bundle/chunks/{register-setup-P67EMBDJ.js → register-setup-AJWUSSQX.js} +129 -104
  342. package/dist/cli-bundle/chunks/register-setup-AJWUSSQX.js.map +1 -0
  343. package/dist/cli-bundle/chunks/{restore-4MHZFJ2E.js → restore-44IHMMZZ.js} +9 -9
  344. package/dist/cli-bundle/chunks/restore-EXHU34EU.js +17 -0
  345. package/dist/cli-bundle/chunks/{scheduling-shortcuts-LB6DOLRL.js → scheduling-shortcuts-OLHNLAZY.js} +12 -12
  346. package/dist/cli-bundle/chunks/{scheduling-shortcuts-UTOYKLXQ.js → scheduling-shortcuts-TSBK4AY5.js} +12 -12
  347. package/dist/cli-bundle/chunks/{schema-73HR2OJW.js → schema-IB2NZZWD.js} +7 -7
  348. package/dist/cli-bundle/chunks/{schema-U6LJKSIR.js → schema-VBCELP5G.js} +7 -7
  349. package/dist/cli-bundle/chunks/{search-AXPXKZER.js → search-7UBETML4.js} +10 -10
  350. package/dist/cli-bundle/chunks/{search-KILGT37L.js → search-R227JOL6.js} +10 -10
  351. package/dist/cli-bundle/chunks/{stats-W5KNVJWQ.js → stats-FAG7COEH.js} +6 -6
  352. package/dist/cli-bundle/chunks/{stats-PSYVVTNZ.js → stats-MCK7PLYS.js} +6 -6
  353. package/dist/cli-bundle/chunks/{telemetry-GAHHQTOS.js → telemetry-DRPDZMAO.js} +84 -70
  354. package/dist/cli-bundle/chunks/telemetry-DRPDZMAO.js.map +7 -0
  355. package/dist/cli-bundle/chunks/{telemetry-BZUF6H7G.js → telemetry-GVVUQSJQ.js} +85 -71
  356. package/dist/cli-bundle/chunks/telemetry-GVVUQSJQ.js.map +1 -0
  357. package/dist/cli-bundle/chunks/{test-PWDIZ255.js → test-QY44WAMR.js} +15 -15
  358. package/dist/cli-bundle/chunks/{test-ACD52Z3S.js → test-SY76DZTO.js} +15 -15
  359. package/dist/cli-bundle/chunks/test-all-QD6QAEG7.js +430 -0
  360. package/dist/cli-bundle/chunks/test-all-QD6QAEG7.js.map +7 -0
  361. package/dist/cli-bundle/chunks/test-all-USPJHXFR.js +427 -0
  362. package/dist/cli-bundle/chunks/test-all-USPJHXFR.js.map +1 -0
  363. package/dist/cli-bundle/chunks/{test-runs-UXIXPDKU.js → test-runs-MG5VIGSK.js} +185 -147
  364. package/dist/cli-bundle/chunks/test-runs-MG5VIGSK.js.map +1 -0
  365. package/dist/cli-bundle/chunks/{test-runs-PLRAZEFW.js → test-runs-QIR5MJPL.js} +184 -146
  366. package/dist/cli-bundle/chunks/test-runs-QIR5MJPL.js.map +7 -0
  367. package/dist/cli-bundle/chunks/update-A7EICML6.js +24 -0
  368. package/dist/cli-bundle/chunks/{update-KFX2SIAC.js → update-IKJZWLQC.js} +15 -15
  369. package/dist/cli-bundle/chunks/{update-many-RNSBX2TA.js → update-many-BEMTDA2X.js} +84 -69
  370. package/dist/cli-bundle/chunks/{update-many-RNSBX2TA.js.map → update-many-BEMTDA2X.js.map} +1 -1
  371. package/dist/cli-bundle/chunks/{update-many-Z5GJS5LC.js → update-many-RATAARHU.js} +83 -68
  372. package/dist/cli-bundle/chunks/{update-many-Z5GJS5LC.js.map → update-many-RATAARHU.js.map} +2 -2
  373. package/dist/cli-bundle/chunks/{upgrade-BRL6KCOJ.js → upgrade-NWMR3VQL.js} +11 -11
  374. package/dist/cli-bundle/chunks/{upgrade-HAK6JG2O.js → upgrade-VU46BLJZ.js} +11 -11
  375. package/dist/cli-bundle/chunks/{validate-X5W76YJL.js → validate-GAJ6FUSI.js} +451 -321
  376. package/dist/cli-bundle/chunks/validate-GAJ6FUSI.js.map +1 -0
  377. package/dist/cli-bundle/chunks/{validate-MTUVL5VC.js → validate-NRY6MFXN.js} +450 -320
  378. package/dist/cli-bundle/chunks/validate-NRY6MFXN.js.map +7 -0
  379. package/dist/cli-bundle/main.js +1107 -916
  380. package/dist/cli-bundle/main.js.map +3 -3
  381. package/dist/core/config/nested-settings.js +89 -67
  382. package/dist/core/config/nested-settings.js.map +1 -1
  383. package/dist/core/governance/metadata-coverage.js +20 -28
  384. package/dist/core/governance/metadata-coverage.js.map +1 -1
  385. package/dist/core/history/drift-scan.js +93 -81
  386. package/dist/core/history/drift-scan.js.map +1 -1
  387. package/dist/core/item/item-type-definition.js +14 -14
  388. package/dist/core/item/item-type-definition.js.map +1 -1
  389. package/dist/core/item/type-registry.js +114 -99
  390. package/dist/core/item/type-registry.js.map +1 -1
  391. package/dist/core/output/mutation-projection.js +42 -26
  392. package/dist/core/output/mutation-projection.js.map +1 -1
  393. package/dist/core/schema/runtime-schema.js +97 -80
  394. package/dist/core/schema/runtime-schema.js.map +1 -1
  395. package/dist/core/schema/status-defs-file.js +26 -3
  396. package/dist/core/schema/status-defs-file.js.map +1 -1
  397. package/dist/core/search/corpus.js +25 -19
  398. package/dist/core/search/corpus.js.map +1 -1
  399. package/dist/core/search/semantic-defaults.js +64 -37
  400. package/dist/core/search/semantic-defaults.js.map +1 -1
  401. package/dist/core/search/vector-stores.js +32 -17
  402. package/dist/core/search/vector-stores.js.map +1 -1
  403. package/dist/core/sentry/helpers.js +31 -28
  404. package/dist/core/sentry/helpers.js.map +1 -1
  405. package/dist/core/sentry/instrument.js +54 -43
  406. package/dist/core/sentry/instrument.js.map +1 -1
  407. package/dist/core/shared/memo.d.ts +12 -0
  408. package/dist/core/shared/memo.js +25 -0
  409. package/dist/core/shared/memo.js.map +1 -0
  410. package/dist/core/shared/serialization.js +24 -14
  411. package/dist/core/shared/serialization.js.map +1 -1
  412. package/dist/core/shared/time.js +26 -4
  413. package/dist/core/shared/time.js.map +1 -1
  414. package/dist/core/store/front-matter-cache.d.ts +5 -0
  415. package/dist/core/store/front-matter-cache.js +316 -171
  416. package/dist/core/store/front-matter-cache.js.map +1 -1
  417. package/dist/core/store/item-store.js +33 -26
  418. package/dist/core/store/item-store.js.map +1 -1
  419. package/dist/core/store/settings.js +247 -203
  420. package/dist/core/store/settings.js.map +1 -1
  421. package/dist/core/test/background-runs.js +189 -160
  422. package/dist/core/test/background-runs.js.map +1 -1
  423. package/dist/sdk/cli-contracts/flag-contracts.js +71 -99
  424. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  425. package/dist/sdk/compose.js +51 -42
  426. package/dist/sdk/compose.js.map +1 -1
  427. package/docs/AGENT_GUIDE.md +2 -2
  428. package/docs/ARCHITECTURE.md +2 -2
  429. package/docs/COMMANDS.md +8 -4
  430. package/docs/CONFIGURATION.md +1 -1
  431. package/docs/EXTENSIONS.md +12 -12
  432. package/docs/ONBOARDING.md +4 -2
  433. package/docs/README.md +2 -0
  434. package/docs/examples/starter-extension/README.md +11 -10
  435. package/marketplace.json +3 -3
  436. package/package.json +2 -2
  437. package/packages/pm-beads/extensions/beads/runtime.ts +240 -167
  438. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +65 -58
  439. package/packages/pm-todos/extensions/todos/runtime.ts +65 -42
  440. package/plugins/pm-claude/.claude-plugin/plugin.json +2 -2
  441. package/plugins/pm-claude/README.md +6 -3
  442. package/plugins/pm-claude/commands/pm-init.md +1 -1
  443. package/dist/cli-bundle/chunks/activity-AW6XVFH6.js +0 -16
  444. package/dist/cli-bundle/chunks/aggregate-JTEF4BP7.js.map +0 -1
  445. package/dist/cli-bundle/chunks/chunk-22WKIL3H.js.map +0 -1
  446. package/dist/cli-bundle/chunks/chunk-2D4HATP2.js.map +0 -1
  447. package/dist/cli-bundle/chunks/chunk-3J6JRJ3I.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-3K2M5OYU.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-3S2KT7NG.js.map +0 -7
  450. package/dist/cli-bundle/chunks/chunk-3VGN2UWE.js.map +0 -1
  451. package/dist/cli-bundle/chunks/chunk-3XZCOZ5J.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-4XOIEKSD.js.map +0 -1
  453. package/dist/cli-bundle/chunks/chunk-55SNVXRQ.js.map +0 -7
  454. package/dist/cli-bundle/chunks/chunk-5CGRF3L5.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-7R4QEMZZ.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-AXIDKKAT.js.map +0 -1
  457. package/dist/cli-bundle/chunks/chunk-BDTISOSD.js.map +0 -7
  458. package/dist/cli-bundle/chunks/chunk-BZCEN4JA.js.map +0 -7
  459. package/dist/cli-bundle/chunks/chunk-CF7RL6FR.js.map +0 -1
  460. package/dist/cli-bundle/chunks/chunk-CWFNTKQJ.js.map +0 -1
  461. package/dist/cli-bundle/chunks/chunk-FFMQB7WR.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-HXTQJXWT.js.map +0 -1
  463. package/dist/cli-bundle/chunks/chunk-IPYBJWTE.js.map +0 -7
  464. package/dist/cli-bundle/chunks/chunk-IZBR4NRW.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-JLM7BHI7.js.map +0 -7
  466. package/dist/cli-bundle/chunks/chunk-JSU5P7VS.js.map +0 -1
  467. package/dist/cli-bundle/chunks/chunk-JWXRETDF.js.map +0 -1
  468. package/dist/cli-bundle/chunks/chunk-KNPEF7QG.js.map +0 -7
  469. package/dist/cli-bundle/chunks/chunk-MDPEOIGN.js.map +0 -7
  470. package/dist/cli-bundle/chunks/chunk-NFDPYAIP.js.map +0 -7
  471. package/dist/cli-bundle/chunks/chunk-NUHHPVVS.js.map +0 -7
  472. package/dist/cli-bundle/chunks/chunk-NWMZWYYB.js.map +0 -1
  473. package/dist/cli-bundle/chunks/chunk-OTUHB4HS.js.map +0 -1
  474. package/dist/cli-bundle/chunks/chunk-RGEMWD6Q.js.map +0 -7
  475. package/dist/cli-bundle/chunks/chunk-RLDHZHQS.js.map +0 -1
  476. package/dist/cli-bundle/chunks/chunk-RMMQ74TG.js.map +0 -7
  477. package/dist/cli-bundle/chunks/chunk-RVUALSJF.js.map +0 -7
  478. package/dist/cli-bundle/chunks/chunk-TP5Q5ZD3.js.map +0 -1
  479. package/dist/cli-bundle/chunks/chunk-V3NOKJF2.js.map +0 -1
  480. package/dist/cli-bundle/chunks/chunk-VARHOHYV.js.map +0 -7
  481. package/dist/cli-bundle/chunks/chunk-WYDHYJPO.js.map +0 -7
  482. package/dist/cli-bundle/chunks/chunk-YITK2PJ6.js.map +0 -7
  483. package/dist/cli-bundle/chunks/chunk-ZETXE4SE.js.map +0 -1
  484. package/dist/cli-bundle/chunks/close-E6ZZGCJY.js +0 -14
  485. package/dist/cli-bundle/chunks/close-many-BG5QQIDQ.js.map +0 -7
  486. package/dist/cli-bundle/chunks/close-many-LDRVEQY2.js.map +0 -1
  487. package/dist/cli-bundle/chunks/config-DMSU64QO.js +0 -1541
  488. package/dist/cli-bundle/chunks/config-DMSU64QO.js.map +0 -7
  489. package/dist/cli-bundle/chunks/config-QH2DICD6.js +0 -1531
  490. package/dist/cli-bundle/chunks/config-QH2DICD6.js.map +0 -1
  491. package/dist/cli-bundle/chunks/contracts-HN7ABKLP.js.map +0 -7
  492. package/dist/cli-bundle/chunks/contracts-W4FZVVD6.js.map +0 -1
  493. package/dist/cli-bundle/chunks/create-OH3BDGBB.js +0 -28
  494. package/dist/cli-bundle/chunks/get-A7MAOHCU.js.map +0 -7
  495. package/dist/cli-bundle/chunks/get-DSDEKJ3L.js.map +0 -1
  496. package/dist/cli-bundle/chunks/health-3IPFLKXB.js.map +0 -1
  497. package/dist/cli-bundle/chunks/health-GZXGBZ36.js.map +0 -7
  498. package/dist/cli-bundle/chunks/history-WSZHY3PN.js +0 -18
  499. package/dist/cli-bundle/chunks/history-compact-2WRZ2WK4.js.map +0 -7
  500. package/dist/cli-bundle/chunks/history-compact-HR7BB4LR.js.map +0 -1
  501. package/dist/cli-bundle/chunks/history-redact-MP6CH7U5.js +0 -19
  502. package/dist/cli-bundle/chunks/history-repair-LCMOS45X.js.map +0 -7
  503. package/dist/cli-bundle/chunks/history-repair-XA3LC4GA.js.map +0 -1
  504. package/dist/cli-bundle/chunks/init-PAX32BJA.js +0 -22
  505. package/dist/cli-bundle/chunks/next-BCERKDUR.js.map +0 -7
  506. package/dist/cli-bundle/chunks/next-FYTQF6HG.js.map +0 -1
  507. package/dist/cli-bundle/chunks/plan-4WXEQCTN.js.map +0 -7
  508. package/dist/cli-bundle/chunks/plan-RKZHQVXR.js.map +0 -1
  509. package/dist/cli-bundle/chunks/profile-4OMM32CD.js.map +0 -7
  510. package/dist/cli-bundle/chunks/profile-QLER5ENE.js.map +0 -1
  511. package/dist/cli-bundle/chunks/register-list-query-7LV46VAU.js +0 -400
  512. package/dist/cli-bundle/chunks/register-list-query-7LV46VAU.js.map +0 -1
  513. package/dist/cli-bundle/chunks/register-list-query-SNG5PGA4.js +0 -410
  514. package/dist/cli-bundle/chunks/register-list-query-SNG5PGA4.js.map +0 -7
  515. package/dist/cli-bundle/chunks/register-mutation-ENNDUAZG.js.map +0 -1
  516. package/dist/cli-bundle/chunks/register-mutation-KK7PHYYU.js.map +0 -7
  517. package/dist/cli-bundle/chunks/register-operations-C6OWLDSH.js +0 -486
  518. package/dist/cli-bundle/chunks/register-operations-C6OWLDSH.js.map +0 -1
  519. package/dist/cli-bundle/chunks/register-operations-HZ6XERQG.js.map +0 -7
  520. package/dist/cli-bundle/chunks/register-setup-P67EMBDJ.js.map +0 -1
  521. package/dist/cli-bundle/chunks/register-setup-ZKJ53RS7.js.map +0 -7
  522. package/dist/cli-bundle/chunks/restore-YALDGTQR.js +0 -17
  523. package/dist/cli-bundle/chunks/telemetry-BZUF6H7G.js.map +0 -1
  524. package/dist/cli-bundle/chunks/telemetry-GAHHQTOS.js.map +0 -7
  525. package/dist/cli-bundle/chunks/test-all-L2MDDUCA.js +0 -358
  526. package/dist/cli-bundle/chunks/test-all-L2MDDUCA.js.map +0 -1
  527. package/dist/cli-bundle/chunks/test-all-RBZ6DLU2.js +0 -361
  528. package/dist/cli-bundle/chunks/test-all-RBZ6DLU2.js.map +0 -7
  529. package/dist/cli-bundle/chunks/test-runs-PLRAZEFW.js.map +0 -7
  530. package/dist/cli-bundle/chunks/test-runs-UXIXPDKU.js.map +0 -1
  531. package/dist/cli-bundle/chunks/update-AMRSOIWP.js +0 -24
  532. package/dist/cli-bundle/chunks/validate-MTUVL5VC.js.map +0 -7
  533. package/dist/cli-bundle/chunks/validate-X5W76YJL.js.map +0 -1
  534. /package/dist/cli-bundle/chunks/{activity-DBLQVIP6.js.map → activity-5YWLSPGE.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{activity-AW6XVFH6.js.map → activity-BIML7K2D.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{append-LOVPGVPT.js.map → append-EZESUVJT.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{append-QCFJSDFL.js.map → append-JFG4WQMG.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-BHO33VBQ.js.map → chunk-3W2HJKJX.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-4DUVCVLZ.js.map → chunk-4PFVUUYV.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-IJYK2T43.js.map → chunk-5E7N4T2Z.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-NKZAN7BD.js.map → chunk-5IZUBZBR.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-NOLPZMSV.js.map → chunk-5JIWFWOZ.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-6AQZPVHQ.js.map → chunk-6CDCWKSX.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-LB6TP6MC.js.map → chunk-6NYJGMTY.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-SLMUGTK3.js.map → chunk-7CLLC75T.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-2466X6E4.js.map → chunk-7LYO6S5A.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-W4ULYO7Z.js.map → chunk-A3OQ7TFW.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-GJ326ZKX.js.map → chunk-ER4ME5U2.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-HZZEHPRG.js.map → chunk-ERG65A2L.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-L5OEFZQG.js.map → chunk-FH2H3CBD.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-JPECA746.js.map → chunk-FUFFPIYA.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-27BXPBAY.js.map → chunk-GUYNUXQT.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-MAUKX7JC.js.map → chunk-GVJE5T7Q.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-ZRP4VG5U.js.map → chunk-JBZ2NTKX.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-EJUDVUYZ.js.map → chunk-KEZOIPCR.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-HYTGA6GI.js.map → chunk-MDHWWBNZ.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-N74UMG5H.js.map → chunk-MEZZZBYX.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-SDR5J34Q.js.map → chunk-NZ7QIUP5.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-DDPTYJIM.js.map → chunk-P5L7Z2O6.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-OGXLACHC.js.map → chunk-SU2E4AWU.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-HPPFYYOV.js.map → chunk-SU3TB4NS.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-G7I7DEZA.js.map → chunk-T4XBKJ3F.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-VICZWYGZ.js.map → chunk-U5TR4N7J.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-EVMTBV6V.js.map → chunk-UMNQZS4H.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-A7FPBAQS.js.map → chunk-WJA3PXW7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-QCWF6IYD.js.map → chunk-YSDFIY7N.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-UZIWVBE6.js.map → chunk-YSGTMDWC.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{chunk-64HNBBFQ.js.map → chunk-Z5F6XZXE.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{chunk-AVEE5EHK.js.map → chunk-Z7RPDF2Y.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{claim-T3GCKV7C.js.map → claim-2BGBGSVI.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{claim-EMQLYPRW.js.map → claim-5GU7OE67.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{close-E6ZZGCJY.js.map → close-6YODBUIV.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{close-TQYAAFJP.js.map → close-AFVKPR57.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{comments-YUXJRZPQ.js.map → comments-DNWHEBOS.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{comments-QCKR2YY2.js.map → comments-RW23R3VE.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{context-B6275WPX.js.map → context-OYXRGY7S.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{context-OCZ3FJ4Z.js.map → context-PKCEHQY3.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{copy-DEM4DATS.js.map → copy-6XOR3HKN.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{copy-BTJOSKKT.js.map → copy-I4NCLBR4.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{create-RLRJMRTM.js.map → create-PM45M6PE.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{create-OH3BDGBB.js.map → create-Z7YCH3BE.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{delete-BHK7VB2Z.js.map → delete-7YXHYG67.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{delete-LSVHAB4Y.js.map → delete-LPISP43T.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{deps-XHYXWEPT.js.map → deps-N2T26FME.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{deps-4UDFJRUA.js.map → deps-WATKQDE3.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{docs-GYZNVS26.js.map → docs-6LQ3GLM7.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{docs-26S44RXU.js.map → docs-Z3X6JZLT.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{eval-UYF3ZPVO.js.map → eval-6DCLG52D.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{eval-PGRVIJQU.js.map → eval-Y3ZCUTHK.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{extension-CPSLJQVE.js.map → extension-BNINIMT7.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{extension-CXJ6RELI.js.map → extension-QWE4YYK5.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{files-NQHEXUZD.js.map → files-6SGKHS6O.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{files-MBNICQFM.js.map → files-FUYPSOFJ.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{focus-DWYIG7GU.js.map → focus-2Q3K76G2.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{focus-XZW5423D.js.map → focus-ATLBWXXD.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{gc-LPVMKJQJ.js.map → gc-RUYEMNRF.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{gc-7GQYOS2G.js.map → gc-TDWSDR66.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{history-WSZHY3PN.js.map → history-CGNQJXFE.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{history-NERDJNUB.js.map → history-SGRRS72R.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{history-redact-O3NBCNWC.js.map → history-redact-IRL7WJ3E.js.map} +0 -0
  601. /package/dist/cli-bundle/chunks/{history-redact-MP6CH7U5.js.map → history-redact-N3JK7VBW.js.map} +0 -0
  602. /package/dist/cli-bundle/chunks/{init-64XDLQJB.js.map → init-4GESW7RM.js.map} +0 -0
  603. /package/dist/cli-bundle/chunks/{init-PAX32BJA.js.map → init-XIDPABA4.js.map} +0 -0
  604. /package/dist/cli-bundle/chunks/{learnings-LPKCSJX7.js.map → learnings-4BHWFFUV.js.map} +0 -0
  605. /package/dist/cli-bundle/chunks/{learnings-JR6MA5TI.js.map → learnings-4FJY7WIW.js.map} +0 -0
  606. /package/dist/cli-bundle/chunks/{list-G5Y65VF6.js.map → list-472TIOVK.js.map} +0 -0
  607. /package/dist/cli-bundle/chunks/{list-DNBJVO3E.js.map → list-D7BF5CL2.js.map} +0 -0
  608. /package/dist/cli-bundle/chunks/{notes-2BMU3VVQ.js.map → notes-6KNOSLIT.js.map} +0 -0
  609. /package/dist/cli-bundle/chunks/{notes-6KTGO2OJ.js.map → notes-W4UEICGF.js.map} +0 -0
  610. /package/dist/cli-bundle/chunks/{restore-4MHZFJ2E.js.map → restore-44IHMMZZ.js.map} +0 -0
  611. /package/dist/cli-bundle/chunks/{restore-YALDGTQR.js.map → restore-EXHU34EU.js.map} +0 -0
  612. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-LB6DOLRL.js.map → scheduling-shortcuts-OLHNLAZY.js.map} +0 -0
  613. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-UTOYKLXQ.js.map → scheduling-shortcuts-TSBK4AY5.js.map} +0 -0
  614. /package/dist/cli-bundle/chunks/{schema-73HR2OJW.js.map → schema-IB2NZZWD.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{schema-U6LJKSIR.js.map → schema-VBCELP5G.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{search-AXPXKZER.js.map → search-7UBETML4.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{search-KILGT37L.js.map → search-R227JOL6.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{stats-W5KNVJWQ.js.map → stats-FAG7COEH.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{stats-PSYVVTNZ.js.map → stats-MCK7PLYS.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{test-PWDIZ255.js.map → test-QY44WAMR.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{test-ACD52Z3S.js.map → test-SY76DZTO.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{update-AMRSOIWP.js.map → update-A7EICML6.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{update-KFX2SIAC.js.map → update-IKJZWLQC.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{upgrade-BRL6KCOJ.js.map → upgrade-NWMR3VQL.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{upgrade-HAK6JG2O.js.map → upgrade-VU46BLJZ.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-ER4ME5U2.js";
9
9
  import {
10
10
  migrateItemFilesToFormat
11
- } from "./chunks/chunk-NKZAN7BD.js";
11
+ } from "./chunks/chunk-5IZUBZBR.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-HB4FAT3O.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-EQURFOMH.js";
27
+ import "./chunks/chunk-XRYSCRZR.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-T6AXEBOP.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-RAHINBVP.js";
43
+ import "./chunks/chunk-6KRFL33E.js";
44
+ import "./chunks/chunk-3W2HJKJX.js";
45
+ import "./chunks/chunk-AJHYQCBJ.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-KHVGM5CS.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] = "8fc55c5b-a16f-5087-814e-4c58f90d7f1a");
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) {
@@ -2201,13 +2198,16 @@ function buildFallbackTitleFromMessage(message) {
2201
2198
  }
2202
2199
  return `${firstLine.slice(0, 117)}...`;
2203
2200
  }
2201
+ function normalizeContextValue(value, fallback) {
2202
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
2203
+ }
2204
2204
  function applyPmCliErrorContext(guidance, rawMessage, context) {
2205
2205
  if (!context) {
2206
2206
  return guidance;
2207
2207
  }
2208
2208
  const normalizedRawMessage = normalizeMessage(rawMessage);
2209
- const code = typeof context.code === "string" && context.code.trim().length > 0 ? context.code.trim() : guidance.code;
2210
- const type = typeof context.type === "string" && context.type.trim().length > 0 ? context.type.trim() : errorType(code);
2209
+ const code = normalizeContextValue(context.code, guidance.code);
2210
+ const type = normalizeContextValue(context.type, errorType(code));
2211
2211
  const examples = normalizeContextList(context.examples) ?? guidance.examples;
2212
2212
  const nextSteps = normalizeContextList(context.nextSteps) ?? guidance.nextSteps;
2213
2213
  const fallbackTitle = guidance.code === "command_failed" && context.code ? buildFallbackTitleFromMessage(normalizedRawMessage) : void 0;
@@ -2218,140 +2218,165 @@ function applyPmCliErrorContext(guidance, rawMessage, context) {
2218
2218
  type,
2219
2219
  title: fallbackTitle ?? guidance.title,
2220
2220
  happened: normalizedRawMessage.length > 0 ? normalizedRawMessage : guidance.happened,
2221
- required: typeof context.required === "string" && context.required.trim().length > 0 ? context.required.trim() : guidance.required,
2222
- why: typeof context.why === "string" && context.why.trim().length > 0 ? context.why.trim() : guidance.why,
2221
+ required: normalizeContextValue(context.required, guidance.required),
2222
+ why: normalizeContextValue(context.why, guidance.why),
2223
2223
  examples,
2224
2224
  nextSteps,
2225
2225
  recovery
2226
2226
  };
2227
2227
  }
2228
- function buildPmCliErrorGuidance(rawMessage, context) {
2229
- const message = normalizeMessage(rawMessage);
2228
+ function buildTrackerNotInitializedGuidance(rawMessage, message, context) {
2230
2229
  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);
2230
+ if (!trackerNotInitialized) {
2231
+ return null;
2241
2232
  }
2233
+ return applyPmCliErrorContext(makeGuidanceMessage({
2234
+ code: "tracker_not_initialized",
2235
+ title: "Tracker is not initialized",
2236
+ happened: `pm data path does not contain initialized tracker metadata (${trackerNotInitialized[1]}).`,
2237
+ required: "Initialize tracker storage before running this command.",
2238
+ why: "Most commands require settings and tracker directories created by pm init.",
2239
+ examples: ["pm init", "pm init acme"],
2240
+ nextSteps: ['Run "pm init", then rerun your original command.']
2241
+ }), rawMessage, context);
2242
+ }
2243
+ function buildItemNotFoundGuidance(rawMessage, message, context) {
2242
2244
  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);
2245
+ if (!itemNotFound) {
2246
+ return null;
2286
2247
  }
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);
2248
+ const badId = itemNotFound[1];
2249
+ const isPlaceholder = /^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(badId);
2250
+ 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.`;
2251
+ const nextSteps = isPlaceholder ? [
2252
+ "Check that the variable holding the item ID is defined before passing it to pm.",
2253
+ 'Use "pm list-open --limit 20" to find valid IDs.'
2254
+ ] : ["Confirm the active --path/PM_PATH scope, then retry with a valid id."];
2255
+ return applyPmCliErrorContext(makeGuidanceMessage({
2256
+ code: "item_not_found",
2257
+ title: "Item ID not found",
2258
+ happened,
2259
+ required: "Use an existing item ID from current tracker data.",
2260
+ why: "Mutation and read commands operate only on known IDs.",
2261
+ examples: ["pm list-open --limit 20", 'pm search "<keyword>" --limit 10'],
2262
+ nextSteps
2263
+ }), rawMessage, context);
2264
+ }
2265
+ function buildOwnershipConflictGuidance(rawMessage, message, context) {
2266
+ if (!message.includes("is assigned to") || !message.includes("Use --force to override")) {
2267
+ return null;
2268
+ }
2269
+ return applyPmCliErrorContext(makeGuidanceMessage({
2270
+ code: "ownership_conflict",
2271
+ title: "Ownership conflict",
2272
+ happened: message,
2273
+ required: "Run as assigned owner, use audit flags for safe non-owner updates, or use --force only for approved override scenarios.",
2274
+ why: "Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",
2275
+ examples: [
2276
+ 'pm update pm-a1b2 --allow-audit-update --description "..." --author "audit-agent"',
2277
+ 'pm update pm-a1b2 --allow-audit-dep-update --dep "..." --author "audit-agent"',
2278
+ 'pm comments pm-a1b2 "..." --allow-audit-comment --author "audit-agent"',
2279
+ 'pm claim pm-a1b2 --author "codex-agent"',
2280
+ 'pm release pm-a1b2 --allow-audit-release --author "reviewer"',
2281
+ "pm update pm-a1b2 --status in_progress --force"
2282
+ ],
2283
+ nextSteps: [
2284
+ "Use --allow-audit-update for metadata-only non-owner updates (excludes lifecycle/ownership fields).",
2285
+ "Use --allow-audit-dep-update for dependency-only non-owner additions.",
2286
+ "Use --allow-audit-comment on comments/notes/learnings for append-only audit entries.",
2287
+ "Use --force for PM audits and systematic metadata updates performed by leads/maintainers.",
2288
+ "Use --force when correcting known stale metadata after coordinating ownership changes.",
2289
+ 'For non-terminal reassignment, prefer "pm claim <ID> --author <you>" before running other mutations.',
2290
+ 'For assignee handoff release workflows, prefer "pm release <ID> --allow-audit-release --author <you>" before using --force.'
2291
+ ]
2292
+ }), rawMessage, context);
2293
+ }
2294
+ function buildLockConflictGuidance(rawMessage, message, context) {
2295
+ if (!message.includes("is locked")) {
2296
+ return null;
2296
2297
  }
2298
+ return applyPmCliErrorContext(makeGuidanceMessage({
2299
+ code: "lock_conflict",
2300
+ title: "Lock conflict",
2301
+ happened: message,
2302
+ required: "Wait for lock release, or use --force where supported if lock is stale and safe to override.",
2303
+ why: "Locking protects item files from concurrent write races.",
2304
+ examples: ['pm update pm-a1b2 --status in_progress --force --author "codex-agent"']
2305
+ }), rawMessage, context);
2306
+ }
2307
+ function buildPmMissingRequiredOptionGuidance(rawMessage, message, context) {
2297
2308
  const missingRequiredOption = message.match(/^Missing required option /);
2298
2309
  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);
2310
+ if (!missingRequiredOption && !missingRequiredOptions) {
2311
+ return null;
2312
+ }
2313
+ const plural = Boolean(missingRequiredOptions);
2314
+ const missingOptionFlag = !plural ? message.replace(/^Missing required option\s+/, "").trim() : null;
2315
+ const missingOptionLabel = missingOptionFlag ?? "";
2316
+ const missingOptionRequired = missingOptionFlag ? `Pass ${missingOptionFlag} with a valid value before running the command.` : "Provide the required option for this command invocation.";
2317
+ return applyPmCliErrorContext(makeGuidanceMessage({
2318
+ code: "missing_required_option",
2319
+ title: plural ? "Missing required options" : `Missing required option ${missingOptionLabel}`,
2320
+ happened: message,
2321
+ required: plural ? "Provide every required option for this command invocation." : missingOptionRequired,
2322
+ why: "Required options define command intent and enforce deterministic write contracts.",
2323
+ examples: [
2324
+ 'pm create --title "Task title" --description "Task details" --type Task --create-mode progressive',
2325
+ '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"'
2326
+ ],
2327
+ nextSteps: [
2328
+ 'Run "pm <command> --help" to view required and recommended flags.',
2329
+ "For staged triage without placeholder linkage values, use --create-mode progressive."
2330
+ ]
2331
+ }), rawMessage, context);
2332
+ }
2333
+ function buildNoUpdateFieldsGuidance(rawMessage, message, context) {
2334
+ if (!message.startsWith("No update flags provided")) {
2335
+ return null;
2336
+ }
2337
+ return applyPmCliErrorContext(makeGuidanceMessage({
2338
+ code: "no_update_fields",
2339
+ title: "No update fields supplied",
2340
+ happened: "The update command was called without any field-changing flags.",
2341
+ 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.",
2342
+ why: "pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",
2343
+ examples: [
2344
+ 'pm update pm-a1b2 --status in_progress --message "Start implementation"',
2345
+ 'pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"',
2346
+ 'pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'
2347
+ ],
2348
+ nextSteps: [
2349
+ "Choose the item field you intend to change, then pair that change with --message for history context.",
2350
+ "Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."
2351
+ ]
2352
+ }), rawMessage, context);
2353
+ }
2354
+ function buildInvalidArgumentGuidance(rawMessage, message, context) {
2355
+ if (!message.startsWith("Invalid ") && !message.includes(" must be ") && !message.includes(" requires ")) {
2356
+ return null;
2357
+ }
2358
+ const recovery = normalizeRecoveryPayload(context?.recovery);
2359
+ const commandName = inferCommandNameFromRecovery(recovery);
2360
+ const helpExample = commandName ? `pm ${commandName} --help` : "pm <command> --help";
2361
+ const allowedValues = inferAllowedValuesFromMessage(message);
2362
+ const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
2363
+ const examples = retryExample ? [retryExample, helpExample] : [helpExample, "pm contracts --command <command> --flags-only --json"];
2364
+ 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."];
2365
+ return applyPmCliErrorContext(makeGuidanceMessage({
2366
+ code: "invalid_argument_value",
2367
+ title: "Invalid argument value",
2368
+ happened: message,
2369
+ required: "Use values that match documented command constraints.",
2370
+ why: "Validation protects data consistency and deterministic behavior across commands.",
2371
+ examples,
2372
+ nextSteps
2373
+ }), rawMessage, context);
2374
+ }
2375
+ function buildPmCliErrorGuidance(rawMessage, context) {
2376
+ const message = normalizeMessage(rawMessage);
2377
+ 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);
2378
+ if (guidance) {
2379
+ return guidance;
2355
2380
  }
2356
2381
  return applyPmCliErrorContext(makeGuidanceMessage({
2357
2382
  code: "command_failed",
@@ -2471,147 +2496,173 @@ function buildLinkedTestQuotedRetryCommand(argv) {
2471
2496
  }
2472
2497
  return void 0;
2473
2498
  }
2474
- function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context) {
2475
- const message = normalizeMessage(rawMessage);
2499
+ function buildMissingRequiredOptionGuidance(message, commandName, allowedTypes, context) {
2476
2500
  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
- });
2501
+ if (!requiredOption) {
2502
+ return null;
2498
2503
  }
2504
+ const optionFlag = normalizeRequiredOptionLabel(requiredOption[1]);
2505
+ const isType = optionFlag.startsWith("--type");
2506
+ const retryCommand = context?.suggestedRetryCommand;
2507
+ const providedFlags = normalizeOptionFlags(context?.providedOptionFlags);
2508
+ const missing = [optionFlag];
2509
+ const examples = commandExampleForRequiredOption(commandName, optionFlag, allowedTypes);
2510
+ const examplesWithRetry = retryCommand ? appendIfMissing(examples, retryCommand) : examples;
2511
+ 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.`];
2512
+ const nextStepsWithRetry = retryCommand ? appendIfMissing(nextStepsBase, `Replay with preserved arguments: ${retryCommand}`) : nextStepsBase;
2513
+ const nextSteps = providedFlags && providedFlags.length > 0 ? appendIfMissing(nextStepsWithRetry, `Already provided options: ${providedFlags.join(", ")}`) : nextStepsWithRetry;
2514
+ return makeGuidanceMessage({
2515
+ code: "missing_required_option",
2516
+ title: `Missing required option ${optionFlag}`,
2517
+ happened: `Commander rejected the command because ${optionFlag} was not provided.`,
2518
+ required: `Pass ${optionFlag} with a valid value before running the command.`,
2519
+ why: isType ? "--type selects item contract and policy routing, including required/disabled option rules." : "Required flags define mandatory command intent and prevent ambiguous execution.",
2520
+ examples: examplesWithRetry,
2521
+ nextSteps,
2522
+ recovery: buildCommanderRecoveryPayload(context, { missing })
2523
+ });
2524
+ }
2525
+ function buildMissingRequiredArgumentGuidance(message, commandName, context) {
2499
2526
  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
- });
2527
+ if (!missingArgument) {
2528
+ return null;
2511
2529
  }
2530
+ const argumentName = missingArgument[1];
2531
+ return makeGuidanceMessage({
2532
+ code: "missing_required_argument",
2533
+ title: `Missing required argument ${argumentName}`,
2534
+ happened: `Command invocation omitted positional argument ${argumentName}.`,
2535
+ required: `Provide ${argumentName} in the expected command position.`,
2536
+ why: "Positional arguments identify the target entity or action context for the command.",
2537
+ examples: [`pm ${commandName ?? "<command>"} --help`],
2538
+ recovery: buildCommanderRecoveryPayload(context, { missing: [argumentName] })
2539
+ });
2540
+ }
2541
+ function buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions) {
2542
+ return makeGuidanceMessage({
2543
+ code: "unsupported_update_option",
2544
+ title: `Unsupported option ${optionName} for update`,
2545
+ happened: `pm update does not accept ${optionName} for linked artifact mutations.`,
2546
+ required: "Use dedicated linked-artifact commands instead of pm update for files/docs changes.",
2547
+ why: "pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",
2548
+ examples: [
2549
+ 'pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"',
2550
+ 'pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'
2551
+ ],
2552
+ nextSteps: ['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],
2553
+ recovery: buildCommanderRecoveryPayload(context, {
2554
+ suggested_flags: suggestions
2555
+ })
2556
+ });
2557
+ }
2558
+ function buildUnknownOptionGuidance(message, commandName, context) {
2512
2559
  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
- });
2560
+ if (!unknownOption) {
2561
+ return null;
2557
2562
  }
2563
+ const optionName = unknownOption[1];
2564
+ const suggestions = normalizeOptionFlags(context?.unknownOptionSuggestions);
2565
+ const retryCommand = context?.suggestedRetryCommand;
2566
+ if (commandName === "update" && (optionName === "--file" || optionName === "--doc")) {
2567
+ return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
2568
+ }
2569
+ const otherCommands = normalizeContextList(context?.unknownOptionOtherCommands);
2570
+ const nextSteps = [
2571
+ "Run command help to confirm the exact option contracts for this command path.",
2572
+ ...suggestions && suggestions.length > 0 ? [`Nearest supported options: ${suggestions.join(", ")}`] : [],
2573
+ ...otherCommands && otherCommands.length > 0 ? [`${optionName} is a valid option on: ${otherCommands.join(", ")}. If you meant one of those, run that command instead.`] : [],
2574
+ ...retryCommand ? [`Replay with suggested correction: ${retryCommand}`] : []
2575
+ ];
2576
+ const examples = [
2577
+ ...retryCommand ? [retryCommand] : [],
2578
+ `pm ${commandName ?? "<command>"} --help`
2579
+ ];
2580
+ return makeGuidanceMessage({
2581
+ code: "unknown_option",
2582
+ title: `Unknown option ${optionName}`,
2583
+ happened: `Commander does not recognize option ${optionName} for this command path.`,
2584
+ required: "Use supported options only, or move option to the correct subcommand.",
2585
+ why: "Option contracts are command-specific and intentionally validated.",
2586
+ examples,
2587
+ nextSteps,
2588
+ recovery: buildCommanderRecoveryPayload(context, {
2589
+ suggested_flags: suggestions
2590
+ })
2591
+ });
2592
+ }
2593
+ function buildKnownPackageCommandGuidance(commandToken, packageHint, baseExamples, baseNextSteps, context) {
2594
+ const installStep = `"${commandToken}" is provided by the ${packageHint.packageName} package. Install it with: ${packageHint.installCommand}`;
2595
+ return makeGuidanceMessage({
2596
+ code: "unknown_command",
2597
+ title: `Unknown command ${commandToken}`,
2598
+ happened: `pm does not expose command path "${commandToken}" in current runtime configuration. It is shipped by the optional ${packageHint.packageName} package.`,
2599
+ required: `Install the ${packageHint.packageName} package, or use a valid command name or subcommand path.`,
2600
+ why: "Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",
2601
+ examples: dedupeStrings([packageHint.installCommand, ...baseExamples]),
2602
+ nextSteps: dedupeStrings([installStep, ...baseNextSteps]),
2603
+ recovery: buildCommanderRecoveryPayload(context)
2604
+ });
2605
+ }
2606
+ function buildUnknownCommandGuidance(message, context) {
2558
2607
  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
- });
2608
+ if (!unknownCommand) {
2609
+ return null;
2589
2610
  }
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
- }
2611
+ const commandToken = unknownCommand[1];
2612
+ const runtimeExamples = normalizeContextList(context?.unknownCommandExamples);
2613
+ const runtimeNextSteps = normalizeContextList(context?.unknownCommandNextSteps);
2614
+ const packageHint = resolveKnownPackageCommandHint(commandToken);
2615
+ const baseExamples = runtimeExamples ?? ["pm --help"];
2616
+ const baseNextSteps = runtimeNextSteps ?? ["Verify spelling and active extensions, then rerun."];
2617
+ if (packageHint) {
2618
+ return buildKnownPackageCommandGuidance(commandToken, packageHint, baseExamples, baseNextSteps, context);
2619
+ }
2620
+ return makeGuidanceMessage({
2621
+ code: "unknown_command",
2622
+ title: `Unknown command ${commandToken}`,
2623
+ happened: `pm does not expose command path "${commandToken}" in current runtime configuration.`,
2624
+ required: "Use a valid command name or subcommand path.",
2625
+ why: "Command registry includes core commands plus active extension command handlers.",
2626
+ examples: baseExamples,
2627
+ nextSteps: baseNextSteps,
2628
+ recovery: buildCommanderRecoveryPayload(context)
2629
+ });
2630
+ }
2631
+ function buildLinkedTestValueNotQuotedGuidance(message, commandName, allowedTypes, context) {
2632
+ if (!/too many arguments/i.test(message) || commandName !== "test") {
2633
+ return null;
2634
+ }
2635
+ const argv = context?.normalizedInvocationArgs;
2636
+ const mutationFlag = findLinkedTestMutationFlag(argv);
2637
+ if (!mutationFlag) {
2638
+ return null;
2639
+ }
2640
+ const retryCommand = buildLinkedTestQuotedRetryCommand(argv);
2641
+ return makeGuidanceMessage({
2642
+ code: "linked_test_value_not_quoted",
2643
+ title: `Linked-test ${mutationFlag} value must be one argument`,
2644
+ 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.`,
2645
+ 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.`,
2646
+ why: "The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",
2647
+ examples: [
2648
+ ...retryCommand ? [retryCommand] : [],
2649
+ 'pm test pm-a1b2 --add "command=npm test -- parser"',
2650
+ 'pm test pm-a1b2 --add command "npm test -- parser"',
2651
+ `pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`
2652
+ ],
2653
+ nextSteps: [
2654
+ ...retryCommand ? [`Replay with the value re-joined into one argument: ${retryCommand}`] : [],
2655
+ "Prefer --add-json for commands containing commas, equals signs, or quotes.",
2656
+ 'Run "pm test --help" for linked-test entry contracts.'
2657
+ ],
2658
+ recovery: buildCommanderRecoveryPayload(context, retryCommand ? { suggested_retry: retryCommand } : {})
2659
+ });
2660
+ }
2661
+ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context) {
2662
+ const message = normalizeMessage(rawMessage);
2663
+ const guidance = buildMissingRequiredOptionGuidance(message, commandName, allowedTypes, context) ?? buildMissingRequiredArgumentGuidance(message, commandName, context) ?? buildUnknownOptionGuidance(message, commandName, context) ?? buildUnknownCommandGuidance(message, context) ?? buildLinkedTestValueNotQuotedGuidance(message, commandName, allowedTypes, context);
2664
+ if (guidance) {
2665
+ return guidance;
2615
2666
  }
2616
2667
  return makeGuidanceMessage({
2617
2668
  code: "invalid_command_usage",
@@ -2695,7 +2746,7 @@ function createLazyModule(importer) {
2695
2746
  !(function() {
2696
2747
  try {
2697
2748
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
2698
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c2d84713-bde8-5ed0-9975-41d50fb0be76");
2749
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "f4bd09b9-2429-5af4-9f71-f2a7fe58f0d1");
2699
2750
  } catch (e2) {
2700
2751
  }
2701
2752
  })();
@@ -2814,7 +2865,7 @@ function normalizeExtensionCommandArguments(values) {
2814
2865
  return normalized;
2815
2866
  }).filter((entry) => entry !== null);
2816
2867
  }
2817
- function collectExtensionCommandHelpDescriptors(commandHandlers, commandDefinitions, flagRegistrations) {
2868
+ function collectExtensionDefinitionsByCommand(commandDefinitions) {
2818
2869
  const definitionsByCommand = /* @__PURE__ */ new Map();
2819
2870
  for (const definition of commandDefinitions) {
2820
2871
  const commandPath = normalizeExtensionCommandPath(definition.command);
@@ -2839,6 +2890,9 @@ function collectExtensionCommandHelpDescriptors(commandHandlers, commandDefiniti
2839
2890
  }
2840
2891
  });
2841
2892
  }
2893
+ return definitionsByCommand;
2894
+ }
2895
+ function collectExtensionFlagsByCommand(flagRegistrations) {
2842
2896
  const flagsByCommand = /* @__PURE__ */ new Map();
2843
2897
  for (const registration of flagRegistrations) {
2844
2898
  const commandPath = normalizeExtensionCommandPath(registration.target_command);
@@ -2849,6 +2903,9 @@ function collectExtensionCommandHelpDescriptors(commandHandlers, commandDefiniti
2849
2903
  existing.push(...registration.flags);
2850
2904
  flagsByCommand.set(commandPath, existing);
2851
2905
  }
2906
+ return flagsByCommand;
2907
+ }
2908
+ function collectExtensionHelpCommandSet(commandHandlers, definitionsByCommand, flagsByCommand) {
2852
2909
  const commandSet = /* @__PURE__ */ new Set();
2853
2910
  for (const commandPath of commandHandlers) {
2854
2911
  const normalized = normalizeExtensionCommandPath(commandPath);
@@ -2862,6 +2919,12 @@ function collectExtensionCommandHelpDescriptors(commandHandlers, commandDefiniti
2862
2919
  for (const commandPath of flagsByCommand.keys()) {
2863
2920
  commandSet.add(commandPath);
2864
2921
  }
2922
+ return commandSet;
2923
+ }
2924
+ function collectExtensionCommandHelpDescriptors(commandHandlers, commandDefinitions, flagRegistrations) {
2925
+ const definitionsByCommand = collectExtensionDefinitionsByCommand(commandDefinitions);
2926
+ const flagsByCommand = collectExtensionFlagsByCommand(flagRegistrations);
2927
+ const commandSet = collectExtensionHelpCommandSet(commandHandlers, definitionsByCommand, flagsByCommand);
2865
2928
  const descriptors = /* @__PURE__ */ new Map();
2866
2929
  const sortedCommands = [...commandSet].sort((left, right) => left.localeCompare(right));
2867
2930
  for (const commandPath of sortedCommands) {
@@ -2897,7 +2960,7 @@ function applyDynamicExtensionArguments(command, descriptor) {
2897
2960
  command.argument(buildExtensionArgumentToken(argument), argument.description ?? "Extension argument.");
2898
2961
  }
2899
2962
  }
2900
- function formatDynamicExtensionOptionFlags(definition) {
2963
+ function normalizeDynamicExtensionOptionNames(definition) {
2901
2964
  const visible = toOptionalBoolean(definition.visible);
2902
2965
  if (visible === false) {
2903
2966
  return null;
@@ -2906,31 +2969,27 @@ function formatDynamicExtensionOptionFlags(definition) {
2906
2969
  const shortName = toNonEmptyFlagString(definition.short);
2907
2970
  const normalizedShort = shortName && shortName.startsWith("-") && !shortName.startsWith("--") ? shortName : null;
2908
2971
  const normalizedLong = longName && longName.startsWith("--") && longName.length > 2 ? longName : null;
2909
- if (!normalizedLong && !normalizedShort) {
2972
+ const optionNames = [normalizedShort, normalizedLong].filter((entry) => entry !== null);
2973
+ return optionNames.length > 0 ? optionNames : null;
2974
+ }
2975
+ function formatDynamicExtensionOptionFlags(definition) {
2976
+ const optionNames = normalizeDynamicExtensionOptionNames(definition);
2977
+ if (!optionNames) {
2910
2978
  return null;
2911
2979
  }
2912
2980
  const optionValueName = toNonEmptyFlagString(definition.value_name);
2913
2981
  const optionValueSuffix = optionValueName ? ` <${optionValueName}>` : "";
2914
- const optionNames = [normalizedShort, normalizedLong].filter((entry) => entry !== null);
2915
2982
  return `${optionNames.join(", ")}${optionValueSuffix}`;
2916
2983
  }
2917
2984
  function formatDynamicExtensionParseOptionFlags(definition) {
2918
- const visible = toOptionalBoolean(definition.visible);
2919
- if (visible === false) {
2920
- return null;
2921
- }
2922
- const longName = toNonEmptyFlagString(definition.long);
2923
- const shortName = toNonEmptyFlagString(definition.short);
2924
- const normalizedShort = shortName && shortName.startsWith("-") && !shortName.startsWith("--") ? shortName : null;
2925
- const normalizedLong = longName && longName.startsWith("--") && longName.length > 2 ? longName : null;
2926
- if (!normalizedLong && !normalizedShort) {
2985
+ const optionNames = normalizeDynamicExtensionOptionNames(definition);
2986
+ if (!optionNames) {
2927
2987
  return null;
2928
2988
  }
2929
2989
  const valueType = toNonEmptyFlagString(definition.value_type) ?? toNonEmptyFlagString(definition.type);
2930
2990
  const valueName = toNonEmptyFlagString(definition.value_name);
2931
2991
  const requiresValue = valueType !== "boolean" && (valueName !== null || valueType !== null || toOptionalBoolean(definition.required) === true);
2932
2992
  const valueSuffix = requiresValue ? ` <${valueName ?? "value"}>` : "";
2933
- const optionNames = [normalizedShort, normalizedLong].filter((entry) => entry !== null);
2934
2993
  return `${optionNames.join(", ")}${valueSuffix}`;
2935
2994
  }
2936
2995
  function formatDynamicExtensionOptionDescription(definition) {
@@ -3114,7 +3173,7 @@ function ensureCommandPath(root, pathParts) {
3114
3173
  !(function() {
3115
3174
  try {
3116
3175
  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");
3176
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e5659f1c-76e6-52e9-96f6-201091483918");
3118
3177
  } catch (e2) {
3119
3178
  }
3120
3179
  })();
@@ -3166,52 +3225,29 @@ function collectMandatoryMigrationBlockers(migrations) {
3166
3225
  function hasMutatingListValues(value) {
3167
3226
  return Array.isArray(value) && value.length > 0;
3168
3227
  }
3228
+ var ALWAYS_MUTATING_COMMANDS = /* @__PURE__ */ new Set(["create", "beads import", "todos import"]);
3229
+ var FORCEABLE_MUTATING_COMMANDS = /* @__PURE__ */ new Set(["restore", "update", "close", "delete", "append", "claim", "release"]);
3230
+ var TEXT_APPEND_COMMANDS = /* @__PURE__ */ new Set(["comments", "notes", "learnings"]);
3231
+ var LIST_MUTATION_COMMANDS = /* @__PURE__ */ new Set(["files", "docs", "test"]);
3169
3232
  function decideWriteGate(commandPath, options) {
3170
3233
  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
- };
3234
+ if (ALWAYS_MUTATING_COMMANDS.has(commandPath)) {
3235
+ return { isMutation: true, forceCapable: false, forceRequested: false };
3214
3236
  }
3237
+ if (FORCEABLE_MUTATING_COMMANDS.has(commandPath)) {
3238
+ return { isMutation: true, forceCapable: true, forceRequested };
3239
+ }
3240
+ if (TEXT_APPEND_COMMANDS.has(commandPath)) {
3241
+ return { isMutation: typeof options.add === "string", forceCapable: true, forceRequested };
3242
+ }
3243
+ if (LIST_MUTATION_COMMANDS.has(commandPath)) {
3244
+ return {
3245
+ isMutation: hasMutatingListValues(options.add) || hasMutatingListValues(options.remove),
3246
+ forceCapable: true,
3247
+ forceRequested
3248
+ };
3249
+ }
3250
+ return { isMutation: false, forceCapable: false, forceRequested: false };
3215
3251
  }
3216
3252
  function enforceMandatoryMigrationWriteGate(commandPath, options, blockers) {
3217
3253
  if (blockers.length === 0) {
@@ -3256,7 +3292,7 @@ async function enforceItemFormatWriteGateAndPreflightMigration(commandPath, opti
3256
3292
  !(function() {
3257
3293
  try {
3258
3294
  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");
3295
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "7d27d900-2792-5dba-95dc-262d72ce028e");
3260
3296
  } catch (e2) {
3261
3297
  }
3262
3298
  })();
@@ -3539,22 +3575,9 @@ function rewriteUnknownOptionArgv(argv, unknownOption, replacementFlag) {
3539
3575
  }
3540
3576
  return void 0;
3541
3577
  }
3542
- function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensionDescriptors) {
3543
- const unknownCommandMatch = rawMessage.match(/unknown command '([^']+)'/i);
3544
- if (!unknownCommandMatch || typeof unknownCommandMatch[1] !== "string") {
3545
- return void 0;
3546
- }
3547
- const normalizedUnknown = normalizeHelpCommandPath(unknownCommandMatch[1]);
3548
- if (normalizedUnknown.length === 0) {
3549
- return void 0;
3550
- }
3551
- const commandPaths = collectRuntimeCommandPaths(root, extensionDescriptors);
3552
- if (commandPaths.length === 0) {
3553
- return void 0;
3554
- }
3555
- const primaryToken = normalizedUnknown.split(" ")[0];
3556
- const commandPathSet = new Set(commandPaths);
3557
- const scoreAgainstUnknown = (candidatePath) => Math.min(scoreCommandPathMatch(candidatePath, normalizedUnknown), primaryToken !== normalizedUnknown ? scoreCommandPathMatch(candidatePath, primaryToken) : Number.POSITIVE_INFINITY);
3578
+ function scoreRuntimeCommandCandidates(params) {
3579
+ const commandPathSet = new Set(params.commandPaths);
3580
+ const scoreAgainstUnknown = (candidatePath) => Math.min(scoreCommandPathMatch(candidatePath, params.normalizedUnknown), params.primaryToken !== params.normalizedUnknown ? scoreCommandPathMatch(candidatePath, params.primaryToken) : Number.POSITIVE_INFINITY);
3558
3581
  const scoresByCommandPath = /* @__PURE__ */ new Map();
3559
3582
  const recordCandidateScore = (commandPath, score) => {
3560
3583
  if (!Number.isFinite(score) || !commandPathSet.has(commandPath)) {
@@ -3565,22 +3588,55 @@ function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensionDescr
3565
3588
  scoresByCommandPath.set(commandPath, score);
3566
3589
  }
3567
3590
  };
3568
- for (const commandPath of commandPaths) {
3591
+ for (const commandPath of params.commandPaths) {
3569
3592
  recordCandidateScore(commandPath, scoreAgainstUnknown(commandPath));
3570
3593
  }
3571
3594
  for (const [aliasToken, canonicalPath] of Object.entries(EXECUTABLE_COMMAND_ALIASES)) {
3572
3595
  recordCandidateScore(canonicalPath, scoreAgainstUnknown(aliasToken));
3573
3596
  }
3574
- const rankedCandidates = [...scoresByCommandPath.entries()].sort(([leftPath, leftScore], [rightPath, rightScore]) => leftScore !== rightScore ? leftScore - rightScore : leftPath.localeCompare(rightPath)).map(([commandPath]) => commandPath);
3575
- const installedPackageCandidates = collectInstalledPackageCommandPathHints(primaryToken, extensionDescriptors).filter((commandPath) => commandPaths.includes(commandPath));
3576
- const combinedCandidates = dedupeStrings2([...rankedCandidates, ...installedPackageCandidates]);
3577
- const fallbackTopLevel = [...new Set(commandPaths.map((commandPath) => commandPath.split(" ")[0]).filter((segment) => segment.length > 0))];
3578
- fallbackTopLevel.sort((left, right) => left.localeCompare(right));
3579
- const suggestedPaths = (combinedCandidates.length > 0 ? combinedCandidates : fallbackTopLevel).slice(0, 3);
3597
+ return [...scoresByCommandPath.entries()].sort(([leftPath, leftScore], [rightPath, rightScore]) => leftScore !== rightScore ? leftScore - rightScore : leftPath.localeCompare(rightPath)).map(([commandPath]) => commandPath);
3598
+ }
3599
+ function resolveUnknownCommandCandidates(params) {
3600
+ const rankedCandidates = scoreRuntimeCommandCandidates(params);
3601
+ const installedPackageCandidates = collectInstalledPackageCommandPathHints(params.primaryToken, params.extensionDescriptors).filter((commandPath) => params.commandPaths.includes(commandPath));
3602
+ return dedupeStrings2([...rankedCandidates, ...installedPackageCandidates]);
3603
+ }
3604
+ function resolveUnknownCommandFallbacks(commandPaths) {
3605
+ const topLevel = [...new Set(commandPaths.map((commandPath) => commandPath.split(" ")[0]).filter((segment) => segment.length > 0))];
3606
+ return topLevel.sort((left, right) => left.localeCompare(right));
3607
+ }
3608
+ function buildUnknownCommandExamples(suggestedPaths, hasConcreteCandidates) {
3580
3609
  const suggestedExamples = suggestedPaths.map((path) => `pm ${path} --help`);
3581
- const examples = combinedCandidates.length > 0 ? [.../* @__PURE__ */ new Set([...suggestedExamples, "pm --help"])] : [.../* @__PURE__ */ new Set(["pm --help", ...suggestedExamples])];
3610
+ if (hasConcreteCandidates) {
3611
+ return [.../* @__PURE__ */ new Set([...suggestedExamples, "pm --help"])];
3612
+ }
3613
+ return [.../* @__PURE__ */ new Set(["pm --help", ...suggestedExamples])];
3614
+ }
3615
+ function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensionDescriptors) {
3616
+ const unknownCommandMatch = rawMessage.match(/unknown command '([^']+)'/i);
3617
+ if (!unknownCommandMatch || typeof unknownCommandMatch[1] !== "string") {
3618
+ return void 0;
3619
+ }
3620
+ const normalizedUnknown = normalizeHelpCommandPath(unknownCommandMatch[1]);
3621
+ if (normalizedUnknown.length === 0) {
3622
+ return void 0;
3623
+ }
3624
+ const commandPaths = collectRuntimeCommandPaths(root, extensionDescriptors);
3625
+ if (commandPaths.length === 0) {
3626
+ return void 0;
3627
+ }
3628
+ const primaryToken = normalizedUnknown.split(" ")[0];
3629
+ const combinedCandidates = resolveUnknownCommandCandidates({
3630
+ commandPaths,
3631
+ normalizedUnknown,
3632
+ primaryToken,
3633
+ extensionDescriptors
3634
+ });
3635
+ const fallbackTopLevel = resolveUnknownCommandFallbacks(commandPaths);
3636
+ const suggestedPaths = (combinedCandidates.length > 0 ? combinedCandidates : fallbackTopLevel).slice(0, 3);
3637
+ const examples = buildUnknownCommandExamples(suggestedPaths, combinedCandidates.length > 0);
3582
3638
  const optionalPackageHint = resolveOptionalPackageInstallHint(normalizedUnknown);
3583
- const didYouMean = combinedCandidates.length > 0 ? `Did you mean: ${combinedCandidates.slice(0, 3).join(", ")}?` : null;
3639
+ const didYouMean = combinedCandidates.length > 0 ? `Did you mean: ${suggestedPaths.join(", ")}?` : null;
3584
3640
  return {
3585
3641
  unknownCommandExamples: examples,
3586
3642
  unknownCommandNextSteps: [
@@ -3641,6 +3697,48 @@ function isKnownHelpCommandPath(root, commandPathTokens) {
3641
3697
  }
3642
3698
  return matchedAny;
3643
3699
  }
3700
+ async function resolveAllowedTypesForUsage(bootstrapGlobal) {
3701
+ try {
3702
+ const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
3703
+ if (!await pathExists(getSettingsPath(pmRoot))) {
3704
+ return BUILTIN_TYPE_HELP_VALUES;
3705
+ }
3706
+ const settings = await readSettings(pmRoot);
3707
+ const extensionRegistrations = bootstrapGlobal.noExtensions ? void 0 : getActiveExtensionRegistrations();
3708
+ const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);
3709
+ return typeRegistry.types.length > 0 ? typeRegistry.types.join("|") : BUILTIN_TYPE_HELP_VALUES;
3710
+ } catch {
3711
+ return BUILTIN_TYPE_HELP_VALUES;
3712
+ }
3713
+ }
3714
+ function resolveUnknownOptionSuggestions(message, commandName) {
3715
+ const match = message.match(/unknown option '([^']+)'/i);
3716
+ const suggestions = match && commandName ? dedupeStrings2([
3717
+ ...getSemanticUnknownOptionSuggestions(commandName, match[1]),
3718
+ ...suggestNearestLongFlags(match[1], collectKnownLongFlags(commandName))
3719
+ ]) : void 0;
3720
+ return {
3721
+ match,
3722
+ suggestions,
3723
+ otherCommands: match ? findOtherCommandsForFlag(match[1], commandName) : []
3724
+ };
3725
+ }
3726
+ function resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOptionMatch, unknownOptionSuggestions) {
3727
+ if (!unknownOptionMatch || !unknownOptionSuggestions || unknownOptionSuggestions.length === 0) {
3728
+ return void 0;
3729
+ }
3730
+ const rewritten = rewriteUnknownOptionArgv(invocationArgv, unknownOptionMatch[1], unknownOptionSuggestions[0]);
3731
+ return rewritten ? renderAttemptedCommand(rewritten) : void 0;
3732
+ }
3733
+ function resolveSuggestedRetryForMissingOption(message, invocationArgv) {
3734
+ const missingRequiredOption = message.match(/required option '([^']+)' not specified/i);
3735
+ const requiredOptionToken = missingRequiredOption?.[1] ? trimTrailingPunctuationToken(firstWhitespaceSeparatedToken(missingRequiredOption[1].trim())) : void 0;
3736
+ if (!requiredOptionToken?.startsWith("--")) {
3737
+ return void 0;
3738
+ }
3739
+ const hasFlag = invocationArgv.some((token) => token === requiredOptionToken || token.startsWith(`${requiredOptionToken}=`));
3740
+ return hasFlag ? void 0 : renderAttemptedCommand([...invocationArgv, requiredOptionToken, "<value>"]);
3741
+ }
3644
3742
  async function resolveCommanderUsageContext(error, rootProgram, extensionDescriptors) {
3645
3743
  const rawMessage = typeof error === "object" && error !== null ? error.message : void 0;
3646
3744
  const message = rawMessage ?? "Invalid command usage";
@@ -3649,42 +3747,10 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
3649
3747
  const commandName = parseBootstrapCommandName(invocationArgv);
3650
3748
  const attemptedCommand = renderAttemptedCommand(invocationArgv);
3651
3749
  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
- }
3750
+ const allowedTypes = await resolveAllowedTypesForUsage(bootstrapGlobal);
3664
3751
  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
- }
3752
+ const unknownOption = resolveUnknownOptionSuggestions(message, commandName);
3753
+ const suggestedRetryCommand = resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOption.match, unknownOption.suggestions) ?? resolveSuggestedRetryForMissingOption(message, invocationArgv);
3688
3754
  return {
3689
3755
  message,
3690
3756
  commandName,
@@ -3692,8 +3758,8 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
3692
3758
  attemptedCommand,
3693
3759
  normalizedInvocationArgs: [...invocationArgv],
3694
3760
  providedOptionFlags,
3695
- unknownOptionSuggestions,
3696
- unknownOptionOtherCommands: unknownOptionOtherCommands.length > 0 ? unknownOptionOtherCommands : void 0,
3761
+ unknownOptionSuggestions: unknownOption.suggestions,
3762
+ unknownOptionOtherCommands: unknownOption.otherCommands.length > 0 ? unknownOption.otherCommands : void 0,
3697
3763
  suggestedRetryCommand,
3698
3764
  ...unknownCommandGuidance
3699
3765
  };
@@ -3740,7 +3806,7 @@ async function formatCommanderUsageJson(error, rootProgram, extensionDescriptors
3740
3806
  !(function() {
3741
3807
  try {
3742
3808
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3743
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "913c0a00-924f-520e-adb6-4073fdb73413");
3809
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4daddb64-a9f8-5131-92be-05d37fd24cf8");
3744
3810
  } catch (e2) {
3745
3811
  }
3746
3812
  })();
@@ -3873,20 +3939,26 @@ function buildHelpSubcommandSummaries(command) {
3873
3939
  description: entry.description().trim()
3874
3940
  })).sort((left, right) => left.name.localeCompare(right.name));
3875
3941
  }
3942
+ function buildJsonHelpNarrative(detailMode, fallbackNarrative, extensionDescriptor) {
3943
+ if (!extensionDescriptor) {
3944
+ return fallbackNarrative;
3945
+ }
3946
+ const extensionExamples = extensionDescriptor.examples ?? [];
3947
+ const extensionFailureHints = extensionDescriptor.failure_hints ?? [];
3948
+ return {
3949
+ intent: extensionDescriptor.intent ?? extensionDescriptor.description ?? fallbackNarrative.intent,
3950
+ examples: detailMode === "detailed" ? extensionExamples.length > 0 ? [...extensionExamples] : [...fallbackNarrative.examples] : extensionExamples.length > 0 ? [extensionExamples[0]] : [...fallbackNarrative.examples],
3951
+ tips: detailMode === "detailed" ? extensionFailureHints.length > 0 ? [...extensionFailureHints] : [...fallbackNarrative.tips] : [],
3952
+ detail_mode: detailMode
3953
+ };
3954
+ }
3876
3955
  function buildJsonHelpPayload(rootProgram, targetCommand, argv, requestedPath, extensionDescriptors) {
3877
3956
  const detailMode = resolveHelpDetailMode(argv);
3878
3957
  const resolvedPath = normalizeHelpCommandPath(getCommandPath(targetCommand));
3879
3958
  const commandPath = resolvedPath.length > 0 ? resolvedPath : void 0;
3880
3959
  const fallbackNarrative = resolveHelpNarrative(commandPath, detailMode);
3881
3960
  const extensionDescriptor = commandPath ? extensionDescriptors.get(commandPath) : void 0;
3882
- const extensionExamples = extensionDescriptor?.examples ?? [];
3883
- const extensionFailureHints = extensionDescriptor?.failure_hints ?? [];
3884
- const narrative = extensionDescriptor ? {
3885
- intent: extensionDescriptor.intent ?? extensionDescriptor.description ?? fallbackNarrative.intent,
3886
- examples: detailMode === "detailed" ? extensionExamples.length > 0 ? [...extensionExamples] : [...fallbackNarrative.examples] : extensionExamples.length > 0 ? [extensionExamples[0]] : [...fallbackNarrative.examples],
3887
- tips: detailMode === "detailed" ? extensionFailureHints.length > 0 ? [...extensionFailureHints] : [...fallbackNarrative.tips] : [],
3888
- detail_mode: detailMode
3889
- } : fallbackNarrative;
3961
+ const narrative = buildJsonHelpNarrative(detailMode, fallbackNarrative, extensionDescriptor);
3890
3962
  const optionSummaries = compactHelpOptionAliases(mergeHelpOptionSummaries(buildHelpOptionSummaries(targetCommand), buildDynamicExtensionHelpOptionSummaries(extensionDescriptor)));
3891
3963
  const subcommands = buildHelpSubcommandSummaries(targetCommand);
3892
3964
  return {
@@ -3939,20 +4011,39 @@ async function maybeRenderBootstrapJsonHelp(rootProgram, argv, extensionDescript
3939
4011
  process.exitCode = EXIT_CODE.SUCCESS;
3940
4012
  return true;
3941
4013
  }
4014
+ function buildCreateUpdatePolicyIntro(commandName, typeRegistry) {
4015
+ const lines = [
4016
+ "",
4017
+ "Type-aware option policies:",
4018
+ " pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",
4019
+ ` active type values: ${typeRegistry.types.join("|")}`
4020
+ ];
4021
+ if (commandName === "create") {
4022
+ lines.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows.");
4023
+ }
4024
+ return lines.join("\n");
4025
+ }
4026
+ function appendTypeOptionHelpLines(lines, typeDefinition) {
4027
+ if (typeDefinition.options.length === 0) {
4028
+ lines.push(" type options: none");
4029
+ return;
4030
+ }
4031
+ lines.push(" type options:");
4032
+ for (const option of typeDefinition.options) {
4033
+ const requiredLabel = option.required ? " (required)" : "";
4034
+ const aliases = option.aliases ?? [];
4035
+ lines.push(` - ${option.key}${requiredLabel}`);
4036
+ lines.push(` values: ${option.values.length > 0 ? option.values.join("|") : "any non-empty string"}`);
4037
+ lines.push(` aliases: ${aliases.length > 0 ? aliases.join("|") : "none"}`);
4038
+ if (option.description && option.description.trim().length > 0) {
4039
+ lines.push(` description: ${option.description.trim()}`);
4040
+ }
4041
+ }
4042
+ }
3942
4043
  function buildCreateUpdatePolicyHelpText(commandName, typeRegistry, argv) {
3943
4044
  const selectedTypeRaw = parseBootstrapTypeValue(argv);
3944
4045
  if (!selectedTypeRaw) {
3945
- const allowed = typeRegistry.types.join("|");
3946
- const lines2 = [
3947
- "",
3948
- "Type-aware option policies:",
3949
- " pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",
3950
- ` active type values: ${allowed}`
3951
- ];
3952
- if (commandName === "create") {
3953
- lines2.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows.");
3954
- }
3955
- return lines2.join("\n");
4046
+ return buildCreateUpdatePolicyIntro(commandName, typeRegistry);
3956
4047
  }
3957
4048
  const typeDefinition = resolveTypeDefinition(selectedTypeRaw, typeRegistry);
3958
4049
  if (!typeDefinition) {
@@ -3977,21 +4068,7 @@ function buildCreateUpdatePolicyHelpText(commandName, typeRegistry, argv) {
3977
4068
  lines.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy.");
3978
4069
  lines.push(" strict parity remains available via --create-mode strict.");
3979
4070
  }
3980
- if (typeDefinition.options.length === 0) {
3981
- lines.push(" type options: none");
3982
- } else {
3983
- lines.push(" type options:");
3984
- for (const option of typeDefinition.options) {
3985
- const requiredLabel = option.required ? " (required)" : "";
3986
- const aliases = option.aliases ?? [];
3987
- lines.push(` - ${option.key}${requiredLabel}`);
3988
- lines.push(` values: ${option.values.length > 0 ? option.values.join("|") : "any non-empty string"}`);
3989
- lines.push(` aliases: ${aliases.length > 0 ? aliases.join("|") : "none"}`);
3990
- if (option.description && option.description.trim().length > 0) {
3991
- lines.push(` description: ${option.description.trim()}`);
3992
- }
3993
- }
3994
- }
4071
+ appendTypeOptionHelpLines(lines, typeDefinition);
3995
4072
  if (policyState.errors.length > 0) {
3996
4073
  lines.push(` config errors: ${policyState.errors.join("; ")}`);
3997
4074
  }
@@ -4013,7 +4090,7 @@ function attachCreateUpdatePolicyHelpText(rootProgram, typeRegistry, argv) {
4013
4090
  !(function() {
4014
4091
  try {
4015
4092
  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");
4093
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "aa682568-77f6-5659-a6dd-3a69dd4e1fc0");
4017
4094
  } catch (e2) {
4018
4095
  }
4019
4096
  })();
@@ -4058,10 +4135,10 @@ var EXPECTED_HANDLED_ERROR_EXIT_CODES = /* @__PURE__ */ new Set([
4058
4135
  EXIT_CODE.CONFLICT
4059
4136
  ]);
4060
4137
  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"));
4138
+ var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-3QJY43CY.js"));
4139
+ var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-ELBHCCFI.js"));
4140
+ var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-ROFE2YPC.js"));
4141
+ var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-IADFVH53.js"));
4065
4142
  function describeUnknownError(error) {
4066
4143
  if (error instanceof PmCliError) {
4067
4144
  return error.message;
@@ -4107,6 +4184,57 @@ function inferMissingFieldsFromErrorMessage(message) {
4107
4184
  const normalized = [...new Set(matches.map((entry) => normalizeLongOptionFlag(entry) ?? entry))];
4108
4185
  return normalized.length > 0 ? normalized : void 0;
4109
4186
  }
4187
+ function inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery) {
4188
+ if (existingRecovery?.suggested_retry) {
4189
+ return void 0;
4190
+ }
4191
+ const providedFields = extractProvidedOptionFlags(invocationArgv);
4192
+ const providedSet = new Set(providedFields.map((flag) => normalizeLongOptionFlag(flag) ?? flag));
4193
+ const rawInferred = inferMissingFieldsFromErrorMessage(rawMessage);
4194
+ const trulyMissing = rawInferred?.filter((flag) => !providedSet.has(normalizeLongOptionFlag(flag) ?? flag));
4195
+ return trulyMissing && trulyMissing.length > 0 ? trulyMissing : void 0;
4196
+ }
4197
+ function resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferredMissing, existingRecovery) {
4198
+ if (existingRecovery?.suggested_retry) {
4199
+ return existingRecovery.suggested_retry;
4200
+ }
4201
+ const missingFlag = inferredMissing?.[0];
4202
+ const normalizedMissing = missingFlag ? normalizeLongOptionFlag(missingFlag) : void 0;
4203
+ const suggestedRetry = normalizedMissing ? renderAttemptedCommand3([...invocationArgv, normalizedMissing, "<value>"]) : attemptedCommand;
4204
+ return suggestedRetry === attemptedCommand ? void 0 : suggestedRetry;
4205
+ }
4206
+ function projectExistingRecoveryOptionalFields(existingRecovery) {
4207
+ if (!existingRecovery) {
4208
+ return {};
4209
+ }
4210
+ const optionalFields = [
4211
+ "recovery_mode",
4212
+ "missing_required_fields",
4213
+ "suggested_flags",
4214
+ "fallback_candidates",
4215
+ "next_best_command"
4216
+ ];
4217
+ const projected = {};
4218
+ for (const field of optionalFields) {
4219
+ const value = existingRecovery[field];
4220
+ if (value !== void 0 && value !== null) {
4221
+ projected[field] = value;
4222
+ }
4223
+ }
4224
+ return projected;
4225
+ }
4226
+ function buildRecoveryPayload(params) {
4227
+ const existingRecovery = params.existingRecovery;
4228
+ return {
4229
+ attempted_command: existingRecovery?.attempted_command ?? params.attemptedCommand,
4230
+ normalized_args: existingRecovery?.normalized_args ?? [...params.invocationArgv],
4231
+ /* c8 ignore next */
4232
+ provided_fields: existingRecovery?.provided_fields ?? (params.providedFields.length > 0 ? params.providedFields : void 0),
4233
+ missing: existingRecovery?.missing ?? params.inferredMissing,
4234
+ ...projectExistingRecoveryOptionalFields(existingRecovery),
4235
+ ...params.suggestedRetry ? { suggested_retry: params.suggestedRetry } : {}
4236
+ };
4237
+ }
4110
4238
  function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
4111
4239
  const explainRequested = invocationArgv.includes("--explain");
4112
4240
  const existingRecovery = context?.recovery;
@@ -4119,37 +4247,16 @@ function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
4119
4247
  }
4120
4248
  const attemptedCommand = renderAttemptedCommand3(invocationArgv);
4121
4249
  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
- };
4250
+ const inferredMissing = inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery);
4251
+ const suggestedRetry = resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferredMissing, existingRecovery);
4252
+ const recovery = buildRecoveryPayload({
4253
+ invocationArgv,
4254
+ attemptedCommand,
4255
+ providedFields,
4256
+ inferredMissing,
4257
+ suggestedRetry,
4258
+ existingRecovery
4259
+ });
4153
4260
  return {
4154
4261
  ...context,
4155
4262
  recovery
@@ -4480,8 +4587,11 @@ function collectExtensionFlagDefinitionsForInvocation(registrations, commandPath
4480
4587
  }
4481
4588
  return nestedMatch.length > 0 ? nestedMatch : exact;
4482
4589
  }
4590
+ function dynamicCommandArguments(descriptor) {
4591
+ return descriptor.arguments ?? [];
4592
+ }
4483
4593
  function formatDynamicCommandUsage(descriptor) {
4484
- const argumentSuffix = descriptor.arguments.map((argument) => {
4594
+ const argumentSuffix = dynamicCommandArguments(descriptor).map((argument) => {
4485
4595
  const label = argument.variadic ? `${argument.name}...` : argument.name;
4486
4596
  return argument.required ? `<${label}>` : `[${label}]`;
4487
4597
  }).join(" ");
@@ -4495,10 +4605,12 @@ function isImporterOrExporterCommandPath(registrations, commandPath) {
4495
4605
  return registrations.importers.some((entry) => normalizeExtensionCommandPath(`${entry.importer} import`) === normalized) || registrations.exporters.some((entry) => normalizeExtensionCommandPath(`${entry.exporter} export`) === normalized);
4496
4606
  }
4497
4607
  function validateDynamicExtensionCommandArgs(descriptor, args) {
4498
- const requiredCount = descriptor.arguments.filter((argument) => argument.required).length;
4499
- const variadic = descriptor.arguments.some((argument) => argument.variadic);
4500
- const maxCount = variadic ? Number.POSITIVE_INFINITY : descriptor.arguments.length;
4501
- const hintSuffix = descriptor.failure_hints.length > 0 ? ` ${descriptor.failure_hints.join(" ")}` : "";
4608
+ const descriptorArguments = dynamicCommandArguments(descriptor);
4609
+ const requiredCount = descriptorArguments.filter((argument) => argument.required).length;
4610
+ const variadic = descriptorArguments.some((argument) => argument.variadic);
4611
+ const maxCount = variadic ? Number.POSITIVE_INFINITY : descriptorArguments.length;
4612
+ const failureHints = descriptor.failure_hints ?? [];
4613
+ const hintSuffix = failureHints.length > 0 ? ` ${failureHints.join(" ")}` : "";
4502
4614
  if (args.length < requiredCount) {
4503
4615
  throw new PmCliError(`Missing required argument for extension command '${descriptor.command}'. Usage: ${formatDynamicCommandUsage(descriptor)}${hintSuffix}`, EXIT_CODE.USAGE);
4504
4616
  }
@@ -5079,14 +5191,39 @@ async function runRequiredExtensionCommand(command, options, globalOptions, exte
5079
5191
  return extensionCommandResult.result;
5080
5192
  }
5081
5193
  var WRAPPED_ACTION_HANDLER = /* @__PURE__ */ Symbol("pm.wrappedActionHandler");
5194
+ function resolveActionCommand(actionArgs, fallback) {
5195
+ const possibleCommand = actionArgs[actionArgs.length - 1];
5196
+ return possibleCommand instanceof Command ? possibleCommand : fallback;
5197
+ }
5198
+ function maybePrintExtensionProfileWarnings(enabled, label, warnings) {
5199
+ if (enabled && warnings.length > 0) {
5200
+ printError(`profile:extensions ${label}=${formatHookWarnings(warnings)}`);
5201
+ }
5202
+ }
5203
+ function validateDynamicInvocationArgs(params) {
5204
+ const dynamicDescriptor = activeRuntimeExtensionCommandDescriptors.get(normalizeExtensionCommandPath(params.commandPath));
5205
+ if (!dynamicDescriptor || !isImporterOrExporterCommandPath(params.activeRegistrations, params.commandPath)) {
5206
+ return;
5207
+ }
5208
+ const positionalArgs = dynamicCommandArguments(dynamicDescriptor).length === 0 ? collectLoosePositionalArgs(params.commandArgs) : stripLooseCommandOptionTokens(params.commandArgs, params.extensionFlagDefinitions);
5209
+ validateDynamicExtensionCommandArgs(dynamicDescriptor, positionalArgs);
5210
+ }
5211
+ function syncCommanderActionArgs(actionCommand, actionArgs, commandArgs) {
5212
+ actionCommand.args = [...commandArgs];
5213
+ if ("_processArguments" in actionCommand && typeof actionCommand._processArguments === "function") {
5214
+ actionCommand._processArguments();
5215
+ }
5216
+ if (actionArgs.length > 0 && Array.isArray(actionArgs[0])) {
5217
+ actionArgs[0] = [...actionCommand.processedArgs];
5218
+ }
5219
+ }
5082
5220
  function wrapProgramActionsForExtensionHandlers(rootProgram) {
5083
5221
  const visit = (entry) => {
5084
5222
  const actionEntry = entry;
5085
5223
  if (typeof actionEntry._actionHandler === "function" && actionEntry[WRAPPED_ACTION_HANDLER] !== true) {
5086
5224
  const originalAction = actionEntry._actionHandler;
5087
5225
  actionEntry._actionHandler = async function wrappedActionHandler(...actionArgs) {
5088
- const possibleCommand = actionArgs[actionArgs.length - 1];
5089
- const actionCommand = possibleCommand instanceof Command ? possibleCommand : entry;
5226
+ const actionCommand = resolveActionCommand(actionArgs, entry);
5090
5227
  const startedAt = Date.now();
5091
5228
  clearResolvedGlobalOptions(actionCommand);
5092
5229
  let globalOptions = getGlobalOptions(actionCommand);
@@ -5107,26 +5244,14 @@ function wrapProgramActionsForExtensionHandlers(rootProgram) {
5107
5244
  global: globalOptions,
5108
5245
  pm_root: pmRoot
5109
5246
  });
5110
- if (globalOptions.profile && parserOverride.warnings.length > 0) {
5111
- printError(`profile:extensions parser_warnings=${formatHookWarnings(parserOverride.warnings)}`);
5112
- }
5247
+ maybePrintExtensionProfileWarnings(globalOptions.profile, "parser_warnings", parserOverride.warnings);
5113
5248
  commandArgs = parserOverride.context.args;
5114
5249
  commandOptions = parserOverride.context.options;
5115
5250
  globalOptions = parserOverride.context.global;
5116
- const dynamicDescriptor = activeRuntimeExtensionCommandDescriptors.get(normalizeExtensionCommandPath(commandPath));
5117
- if (dynamicDescriptor && isImporterOrExporterCommandPath(activeRegistrations, commandPath)) {
5118
- const positionalArgs = dynamicDescriptor.arguments.length === 0 ? collectLoosePositionalArgs(commandArgs) : stripLooseCommandOptionTokens(commandArgs, extensionFlagDefinitions);
5119
- validateDynamicExtensionCommandArgs(dynamicDescriptor, positionalArgs);
5120
- }
5251
+ validateDynamicInvocationArgs({ activeRegistrations, commandPath, commandArgs, extensionFlagDefinitions });
5121
5252
  globalOptions = await applyDefaultOutputFormat(globalOptions);
5122
5253
  setResolvedGlobalOptions(actionCommand, globalOptions);
5123
- actionCommand.args = [...commandArgs];
5124
- if ("_processArguments" in actionCommand && typeof actionCommand._processArguments === "function") {
5125
- actionCommand._processArguments();
5126
- }
5127
- if (actionArgs.length > 0 && Array.isArray(actionArgs[0])) {
5128
- actionArgs[0] = [...actionCommand.processedArgs];
5129
- }
5254
+ syncCommanderActionArgs(actionCommand, actionArgs, commandArgs);
5130
5255
  for (const [key, value] of Object.entries(commandOptions)) {
5131
5256
  actionCommand.setOptionValueWithSource(key, value, "cli");
5132
5257
  }
@@ -5145,9 +5270,7 @@ function wrapProgramActionsForExtensionHandlers(rootProgram) {
5145
5270
  global: globalOptions,
5146
5271
  pm_root: pmRoot
5147
5272
  });
5148
- if (globalOptions.profile && extensionCommandResult.warnings.length > 0) {
5149
- printError(`profile:extensions command_handler_warnings=${formatHookWarnings(extensionCommandResult.warnings)}`);
5150
- }
5273
+ maybePrintExtensionProfileWarnings(globalOptions.profile, "command_handler_warnings", extensionCommandResult.warnings);
5151
5274
  if (extensionCommandResult.handled) {
5152
5275
  setActiveCommandResult(extensionCommandResult.result);
5153
5276
  printResult(extensionCommandResult.result, {
@@ -5172,34 +5295,62 @@ function wrapProgramActionsForExtensionHandlers(rootProgram) {
5172
5295
  };
5173
5296
  visit(rootProgram);
5174
5297
  }
5298
+ async function clearDynamicExtensionCommandState(params) {
5299
+ activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5300
+ setActiveExtensionServices({ overrides: [] });
5301
+ if (params) {
5302
+ await maybeAttachCreateUpdatePolicyHelpText(params.rootProgram, params.pmRoot, params.invocationArgv, createEmptyExtensionRegistrationRegistry(), params.settings);
5303
+ }
5304
+ }
5305
+ function attachDynamicExtensionHelp(command, descriptor, flagHelp, metadataHelp) {
5306
+ if (descriptor?.flags && descriptor.flags.length > 0) {
5307
+ applyDynamicExtensionFlagOptions(command, descriptor.flags);
5308
+ const residualFlagHelp = buildResidualDynamicExtensionFlagHelp(command, descriptor.flags);
5309
+ if (residualFlagHelp) {
5310
+ command.addHelpText("after", residualFlagHelp);
5311
+ }
5312
+ } else if (flagHelp) {
5313
+ command.addHelpText("after", flagHelp);
5314
+ }
5315
+ if (metadataHelp) {
5316
+ command.addHelpText("after", metadataHelp);
5317
+ }
5318
+ }
5175
5319
  async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv) {
5176
5320
  const bootstrapGlobalOptions = parseBootstrapGlobalOptions(invocationArgv);
5177
5321
  const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobalOptions.path);
5178
5322
  if (bootstrapGlobalOptions.noExtensions) {
5179
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5180
- setActiveExtensionServices({ overrides: [] });
5181
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry());
5323
+ await clearDynamicExtensionCommandState({
5324
+ rootProgram,
5325
+ pmRoot,
5326
+ invocationArgv
5327
+ });
5182
5328
  return;
5183
5329
  }
5184
5330
  const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(pmRoot);
5185
5331
  const probe = buildBootstrapActivationProbe(invocationArgv);
5186
5332
  if (!discoverySnapshot) {
5187
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5188
- setActiveExtensionServices({ overrides: [] });
5333
+ await clearDynamicExtensionCommandState();
5189
5334
  return;
5190
5335
  }
5191
5336
  if (!discoveryNeedsActivationForProbe(discoverySnapshot.discovery, probe)) {
5192
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5193
- setActiveExtensionServices({ overrides: [] });
5194
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry(), discoverySnapshot.settings);
5337
+ await clearDynamicExtensionCommandState({
5338
+ rootProgram,
5339
+ pmRoot,
5340
+ invocationArgv,
5341
+ settings: discoverySnapshot.settings
5342
+ });
5195
5343
  emitExtensionSkippedProfile(bootstrapProfileEnabled(invocationArgv), discoverySnapshot, probe);
5196
5344
  return;
5197
5345
  }
5198
5346
  const snapshot = await loadRuntimeExtensionSnapshot(pmRoot);
5199
5347
  if (!snapshot) {
5200
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5201
- setActiveExtensionServices({ overrides: [] });
5202
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry(), discoverySnapshot.settings);
5348
+ await clearDynamicExtensionCommandState({
5349
+ rootProgram,
5350
+ pmRoot,
5351
+ invocationArgv,
5352
+ settings: discoverySnapshot.settings
5353
+ });
5203
5354
  return;
5204
5355
  }
5205
5356
  setActiveExtensionServices(snapshot.services);
@@ -5216,18 +5367,7 @@ async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv)
5216
5367
  const flagHelp = snapshot.commandFlagHelp.get(commandPath);
5217
5368
  const metadataHelp = descriptor ? buildDynamicExtensionCommandMetadataHelp(descriptor) : null;
5218
5369
  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
- }
5370
+ attachDynamicExtensionHelp(existingCommand, descriptor, flagHelp, metadataHelp);
5231
5371
  continue;
5232
5372
  }
5233
5373
  const dynamicCommand = ensureCommandPath(rootProgram, pathParts);
@@ -5650,6 +5790,308 @@ function enforceExplicitRetryForFlagTypos(bootstrapInvocation) {
5650
5790
  }
5651
5791
  });
5652
5792
  }
5793
+ function createTelemetryCommandErrorEmitter(params) {
5794
+ return async (event) => {
5795
+ const errorCategory = resolveTelemetryErrorCategory(event.errorCode);
5796
+ const commandResolution = deriveTelemetryCommandResolution({
5797
+ ok: false,
5798
+ errorCode: event.errorCode,
5799
+ errorCategory
5800
+ });
5801
+ await emitTelemetryErrorEvent({
5802
+ command: event.command,
5803
+ args: params.invocationArgv,
5804
+ options: event.options,
5805
+ global: params.bootstrapGlobal,
5806
+ pm_version: CLI_VERSION,
5807
+ pm_root: params.bootstrapPmRoot,
5808
+ error_code: event.errorCode,
5809
+ error_message: event.errorMessage,
5810
+ exit_code: event.exitCode,
5811
+ error_category: errorCategory,
5812
+ command_resolution: commandResolution,
5813
+ resolution_stage: event.resolutionStage
5814
+ });
5815
+ return {
5816
+ errorCategory,
5817
+ commandResolution
5818
+ };
5819
+ };
5820
+ }
5821
+ async function prepareExtensionServicesForRunPmCliError(params) {
5822
+ if (params.bootstrapGlobal.noExtensions) {
5823
+ return;
5824
+ }
5825
+ const bootstrapProbe = buildBootstrapActivationProbe(params.invocationArgv);
5826
+ const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(params.bootstrapPmRoot);
5827
+ if (discoverySnapshot && discoveryNeedsActivationForProbe(discoverySnapshot.discovery, bootstrapProbe)) {
5828
+ const bootstrapSnapshot = await loadRuntimeExtensionSnapshot(params.bootstrapPmRoot);
5829
+ setRecoveredExtensionServices(bootstrapSnapshot);
5830
+ return;
5831
+ }
5832
+ if (discoverySnapshot) {
5833
+ emitExtensionSkippedProfile(bootstrapProfileEnabled(params.invocationArgv), discoverySnapshot, bootstrapProbe);
5834
+ }
5835
+ setActiveExtensionServices({ overrides: [] });
5836
+ }
5837
+ function setRecoveredExtensionServices(bootstrapSnapshot) {
5838
+ if (!bootstrapSnapshot) {
5839
+ setActiveExtensionServices({ overrides: [] });
5840
+ return;
5841
+ }
5842
+ setActiveExtensionServices(bootstrapSnapshot.services);
5843
+ }
5844
+ async function finishRunPmCliFailure(params) {
5845
+ sentryFinishCommandSpan(false, params.errorMessage, {
5846
+ error_code: params.classificationCode,
5847
+ error_category: params.errorCategory,
5848
+ exit_code: params.exitCode,
5849
+ command_resolution: params.commandResolution,
5850
+ resolution_stage: params.resolutionStage
5851
+ });
5852
+ await runAndClearAfterCommandHooks({
5853
+ ok: false,
5854
+ error: params.errorMessage,
5855
+ exit_code: params.exitCode,
5856
+ error_code: params.classificationCode,
5857
+ error_category: params.errorCategory,
5858
+ command_resolution: params.commandResolution,
5859
+ resolution_stage: params.resolutionStage
5860
+ });
5861
+ }
5862
+ async function finishRunPmCliSuccessParse() {
5863
+ sentryFinishCommandSpan(true, void 0, {
5864
+ exit_code: EXIT_CODE.SUCCESS,
5865
+ command_resolution: "success",
5866
+ resolution_stage: "parse"
5867
+ });
5868
+ await runAndClearAfterCommandHooks({
5869
+ ok: true,
5870
+ exit_code: EXIT_CODE.SUCCESS,
5871
+ command_resolution: "success",
5872
+ resolution_stage: "parse"
5873
+ });
5874
+ process.exitCode = EXIT_CODE.SUCCESS;
5875
+ }
5876
+ async function handleRunPmCliKnownError(context, numericExitCode) {
5877
+ const hasExplicitExitCode = typeof numericExitCode === "number" && Number.isFinite(numericExitCode);
5878
+ if (!(context.error instanceof PmCliError) && (isCommanderError(context.error) || !hasExplicitExitCode)) {
5879
+ return false;
5880
+ }
5881
+ const errorMessage = describeUnknownError(context.error);
5882
+ const exitCode = context.error instanceof PmCliError ? context.error.exitCode : normalizeThrownExitCode(numericExitCode);
5883
+ const rawContext = context.error instanceof PmCliError ? context.error.context : void 0;
5884
+ const enrichedContext = buildPmCliRecoveryContext(rawContext, context.invocationArgv, errorMessage);
5885
+ const classification = classifyPmCliError(errorMessage, enrichedContext);
5886
+ const renderedError = context.jsonErrors ? JSON.stringify(formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext), null, 2) : formatPmCliErrorForDisplay(errorMessage, enrichedContext);
5887
+ printError(renderedError);
5888
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5889
+ command: context.attemptedCommand,
5890
+ errorCode: classification.code,
5891
+ errorMessage: classification.detail,
5892
+ exitCode,
5893
+ options: {
5894
+ bootstrap_global_options: context.bootstrapGlobal
5895
+ },
5896
+ resolutionStage: "execute"
5897
+ });
5898
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5899
+ command: context.attemptedCommand,
5900
+ error_code: classification.code,
5901
+ error_category: errorCategory,
5902
+ exit_code: exitCode,
5903
+ error_message: classification.detail,
5904
+ command_resolution: commandResolution,
5905
+ resolution_stage: "execute",
5906
+ source_context: activeTelemetryCommandContext?.source_context
5907
+ });
5908
+ await finishRunPmCliFailure({
5909
+ errorMessage,
5910
+ exitCode,
5911
+ classificationCode: classification.code,
5912
+ errorCategory,
5913
+ commandResolution,
5914
+ resolutionStage: "execute"
5915
+ });
5916
+ if (loggedHandledErrorToSentry) {
5917
+ sentryCaptureCliError(wrapThrownErrorForSentry(context.error, errorMessage));
5918
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5919
+ }
5920
+ process.exitCode = exitCode;
5921
+ return true;
5922
+ }
5923
+ function resolveUnknownHelpToken(invocationArgv) {
5924
+ const helpRequest = parseBootstrapHelpRequest(invocationArgv);
5925
+ return helpRequest.commandPathTokens[0] ?? parseBootstrapCommandName(invocationArgv) ?? "<command>";
5926
+ }
5927
+ async function handleUnknownHelpCommandError(context, code) {
5928
+ const unknownToken = resolveUnknownHelpToken(context.invocationArgv);
5929
+ const unknownMessage = `unknown command '${unknownToken}'`;
5930
+ const recoveryCommandDescriptors = await loadRuntimeExtensionCommandDescriptorsForRecovery(resolvePmRoot(process.cwd(), context.bootstrapGlobal.path));
5931
+ const usageContext = await resolveCommanderUsageContext({ message: unknownMessage }, program, recoveryCommandDescriptors);
5932
+ const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5933
+ unknownCommandExamples: usageContext.unknownCommandExamples,
5934
+ unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5935
+ attemptedCommand: usageContext.attemptedCommand,
5936
+ normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5937
+ providedOptionFlags: usageContext.providedOptionFlags,
5938
+ unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5939
+ suggestedRetryCommand: usageContext.suggestedRetryCommand
5940
+ });
5941
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5942
+ command: unknownToken,
5943
+ errorCode: classification.code,
5944
+ errorMessage: classification.detail,
5945
+ exitCode: EXIT_CODE.USAGE,
5946
+ options: {
5947
+ bootstrap_global_options: context.bootstrapGlobal,
5948
+ commander_code: code ?? "commander.helpDisplayed"
5949
+ },
5950
+ resolutionStage: "parse"
5951
+ });
5952
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5953
+ command: unknownToken,
5954
+ error_code: classification.code,
5955
+ error_category: errorCategory,
5956
+ exit_code: EXIT_CODE.USAGE,
5957
+ error_message: classification.detail,
5958
+ command_resolution: commandResolution,
5959
+ resolution_stage: "parse",
5960
+ source_context: activeTelemetryCommandContext?.source_context
5961
+ });
5962
+ const renderedUsage = context.jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors) : await formatCommanderUsageMessage({ message: unknownMessage }, program, recoveryCommandDescriptors);
5963
+ await finishRunPmCliFailure({
5964
+ errorMessage: unknownMessage,
5965
+ exitCode: EXIT_CODE.USAGE,
5966
+ classificationCode: classification.code,
5967
+ errorCategory,
5968
+ commandResolution,
5969
+ resolutionStage: "parse"
5970
+ });
5971
+ printError(renderedUsage);
5972
+ if (loggedHandledErrorToSentry) {
5973
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5974
+ }
5975
+ process.exitCode = EXIT_CODE.USAGE;
5976
+ }
5977
+ async function handleRunPmCliHelpDisplayError(context, code, rawMessage) {
5978
+ const isHelpDisplayCode = code === "commander.helpDisplayed" || code === "commander.help" || code === "commander.helpCommand";
5979
+ if (!isHelpDisplayCode && !rawMessage.includes("(outputHelp)")) {
5980
+ return false;
5981
+ }
5982
+ const helpRequest = parseBootstrapHelpRequest(context.invocationArgv);
5983
+ if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
5984
+ await handleUnknownHelpCommandError(context, code);
5985
+ return true;
5986
+ }
5987
+ await finishRunPmCliSuccessParse();
5988
+ return true;
5989
+ }
5990
+ async function handleRunPmCliCommanderUsageError(context, code) {
5991
+ const usageContext = await resolveCommanderUsageContext(context.error, program, activeRuntimeExtensionCommandDescriptors);
5992
+ const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5993
+ unknownCommandExamples: usageContext.unknownCommandExamples,
5994
+ unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5995
+ attemptedCommand: usageContext.attemptedCommand,
5996
+ normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5997
+ providedOptionFlags: usageContext.providedOptionFlags,
5998
+ unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5999
+ suggestedRetryCommand: usageContext.suggestedRetryCommand
6000
+ });
6001
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
6002
+ command: context.attemptedCommand,
6003
+ errorCode: classification.code,
6004
+ errorMessage: classification.detail,
6005
+ exitCode: EXIT_CODE.USAGE,
6006
+ options: {
6007
+ bootstrap_global_options: context.bootstrapGlobal,
6008
+ commander_code: code
6009
+ },
6010
+ resolutionStage: "parse"
6011
+ });
6012
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
6013
+ command: context.attemptedCommand,
6014
+ error_code: classification.code,
6015
+ error_category: errorCategory,
6016
+ exit_code: EXIT_CODE.USAGE,
6017
+ error_message: classification.detail,
6018
+ command_resolution: commandResolution,
6019
+ resolution_stage: "parse",
6020
+ source_context: activeTelemetryCommandContext?.source_context
6021
+ });
6022
+ const renderedUsage = context.jsonErrors ? await formatCommanderUsageJson(context.error, program, activeRuntimeExtensionCommandDescriptors) : await formatCommanderUsageMessage(context.error, program, activeRuntimeExtensionCommandDescriptors);
6023
+ await finishRunPmCliFailure({
6024
+ errorMessage: usageContext.message,
6025
+ exitCode: EXIT_CODE.USAGE,
6026
+ classificationCode: classification.code,
6027
+ errorCategory,
6028
+ commandResolution,
6029
+ resolutionStage: "parse"
6030
+ });
6031
+ printError(renderedUsage);
6032
+ if (loggedHandledErrorToSentry) {
6033
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
6034
+ }
6035
+ process.exitCode = EXIT_CODE.USAGE;
6036
+ }
6037
+ function shouldHandleRunPmCliCommanderError(error) {
6038
+ if (typeof error !== "object" || error === null || !("code" in error)) {
6039
+ return false;
6040
+ }
6041
+ const code = error.code;
6042
+ if (typeof code === "string" && (code === "commander.version" || code.startsWith("commander."))) {
6043
+ return true;
6044
+ }
6045
+ const rawMessage = String(error.message ?? "");
6046
+ return rawMessage.includes("(outputHelp)");
6047
+ }
6048
+ async function handleRunPmCliCommanderError(context) {
6049
+ const code = context.error.code;
6050
+ const rawMessage = String(context.error.message ?? "");
6051
+ if (await handleRunPmCliHelpDisplayError(context, code, rawMessage)) {
6052
+ return;
6053
+ }
6054
+ if (code === "commander.version") {
6055
+ await finishRunPmCliSuccessParse();
6056
+ return;
6057
+ }
6058
+ await handleRunPmCliCommanderUsageError(context, code);
6059
+ }
6060
+ async function handleRunPmCliError(params) {
6061
+ const bootstrapGlobal = parseBootstrapGlobalOptions(params.invocationArgv);
6062
+ const bootstrapPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
6063
+ const context = {
6064
+ error: params.error,
6065
+ invocationArgv: params.invocationArgv,
6066
+ bootstrapGlobal,
6067
+ jsonErrors: bootstrapGlobal.json,
6068
+ bootstrapPmRoot,
6069
+ attemptedCommand: parseBootstrapCommandName(params.invocationArgv) ?? "<unknown>",
6070
+ emitTelemetryCommandError: createTelemetryCommandErrorEmitter({
6071
+ invocationArgv: params.invocationArgv,
6072
+ bootstrapGlobal,
6073
+ bootstrapPmRoot
6074
+ })
6075
+ };
6076
+ await prepareExtensionServicesForRunPmCliError({
6077
+ invocationArgv: params.invocationArgv,
6078
+ bootstrapGlobal,
6079
+ bootstrapPmRoot
6080
+ });
6081
+ if (await handleRunPmCliKnownError(context, readThrownExitCode(params.error))) {
6082
+ return;
6083
+ }
6084
+ if (shouldHandleRunPmCliCommanderError(params.error)) {
6085
+ await handleRunPmCliCommanderError(context);
6086
+ return;
6087
+ }
6088
+ await handleGenericRunPmCliError({
6089
+ error: params.error,
6090
+ attemptedCommand: context.attemptedCommand,
6091
+ bootstrapGlobal,
6092
+ emitTelemetryCommandError: context.emitTelemetryCommandError
6093
+ });
6094
+ }
5653
6095
  async function runPmCli(rawArgv = process.argv.slice(2)) {
5654
6096
  const bootstrapInvocation = normalizeBootstrapInvocation(rawArgv);
5655
6097
  const invocationArgv = bootstrapInvocation.argv;
@@ -5684,268 +6126,7 @@ async function runPmCli(rawArgv = process.argv.slice(2)) {
5684
6126
  }
5685
6127
  await program.parseAsync(invocationProcessArgv);
5686
6128
  } 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
- });
6129
+ await handleRunPmCliError({ error, invocationArgv });
5949
6130
  }
5950
6131
  }
5951
6132
  var _testOnly = {
@@ -5984,6 +6165,12 @@ var _testOnly = {
5984
6165
  extensionProvidesTemplatesRuntime,
5985
6166
  hasAnyCapability,
5986
6167
  handleGenericRunPmCliError,
6168
+ handleRunPmCliCommanderError,
6169
+ handleRunPmCliError,
6170
+ handleRunPmCliHelpDisplayError,
6171
+ handleRunPmCliKnownError,
6172
+ handleRunPmCliCommanderUsageError,
6173
+ handleUnknownHelpCommandError,
5987
6174
  inferMissingFieldsFromErrorMessage,
5988
6175
  inferPostActionErrorCode,
5989
6176
  inferPostActionFailureMessage,
@@ -6000,12 +6187,14 @@ var _testOnly = {
6000
6187
  normalizeTelemetryResolutionStage,
6001
6188
  normalizeThrownExitCode,
6002
6189
  probeUsesAnyFlag,
6190
+ prepareExtensionServicesForRunPmCliError,
6003
6191
  readRecordBoolean,
6004
6192
  readRecordNumber,
6005
6193
  readRecordString,
6006
6194
  registerDynamicExtensionCommandPaths,
6007
6195
  registerRuntimeSchemaFieldFlags,
6008
6196
  resolveCoreCommandRegistrationSelection,
6197
+ resolveUnknownHelpToken,
6009
6198
  readThrownExitCode,
6010
6199
  runAndClearAfterCommandHooks,
6011
6200
  runRequiredExtensionCommand,
@@ -6013,8 +6202,10 @@ var _testOnly = {
6013
6202
  shouldLogHandledErrorToSentry,
6014
6203
  shouldRegisterDynamicExtensionPaths,
6015
6204
  shouldRegisterRuntimeSchemaFlags,
6205
+ shouldHandleRunPmCliCommanderError,
6016
6206
  setActiveExtensionHookContextForTest,
6017
6207
  setActiveRuntimeExtensionCommandDescriptorsForTest,
6208
+ setRecoveredExtensionServices,
6018
6209
  toLooseFieldDefinitionType,
6019
6210
  isImporterOrExporterCommandPath,
6020
6211
  validateDynamicExtensionCommandInvocation,