@unbrained/pm-cli 2026.6.30 → 2026.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (628) hide show
  1. package/AGENTS.md +2 -0
  2. package/CHANGELOG.md +26 -0
  3. package/dist/cli/bootstrap-args.js +89 -79
  4. package/dist/cli/bootstrap-args.js.map +1 -1
  5. package/dist/cli/commander-usage.d.ts +2 -0
  6. package/dist/cli/commander-usage.js +58 -47
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/aggregate.js +102 -79
  9. package/dist/cli/commands/aggregate.js.map +1 -1
  10. package/dist/cli/commands/calendar.js +339 -303
  11. package/dist/cli/commands/calendar.js.map +1 -1
  12. package/dist/cli/commands/close-many.js +89 -68
  13. package/dist/cli/commands/close-many.js.map +1 -1
  14. package/dist/cli/commands/close.js +157 -129
  15. package/dist/cli/commands/close.js.map +1 -1
  16. package/dist/cli/commands/comments-audit.js +50 -42
  17. package/dist/cli/commands/comments-audit.js.map +1 -1
  18. package/dist/cli/commands/config.d.ts +2 -0
  19. package/dist/cli/commands/config.js +443 -879
  20. package/dist/cli/commands/config.js.map +1 -1
  21. package/dist/cli/commands/context.js +365 -287
  22. package/dist/cli/commands/context.js.map +1 -1
  23. package/dist/cli/commands/contracts.js +352 -238
  24. package/dist/cli/commands/contracts.js.map +1 -1
  25. package/dist/cli/commands/create.js +483 -434
  26. package/dist/cli/commands/create.js.map +1 -1
  27. package/dist/cli/commands/dedupe-audit.js +46 -39
  28. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  29. package/dist/cli/commands/dedupe-merge.js +88 -69
  30. package/dist/cli/commands/dedupe-merge.js.map +1 -1
  31. package/dist/cli/commands/extension/bundled-catalog.js +59 -46
  32. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
  33. package/dist/cli/commands/extension/doctor.js +129 -78
  34. package/dist/cli/commands/extension/doctor.js.map +1 -1
  35. package/dist/cli/commands/extension/managed-state.js +101 -57
  36. package/dist/cli/commands/extension/managed-state.js.map +1 -1
  37. package/dist/cli/commands/extension/scaffold.d.ts +7 -0
  38. package/dist/cli/commands/extension/scaffold.js +214 -186
  39. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  40. package/dist/cli/commands/extension.d.ts +6 -1
  41. package/dist/cli/commands/extension.js +1034 -902
  42. package/dist/cli/commands/extension.js.map +1 -1
  43. package/dist/cli/commands/get.js +114 -81
  44. package/dist/cli/commands/get.js.map +1 -1
  45. package/dist/cli/commands/health.d.ts +17 -0
  46. package/dist/cli/commands/health.js +446 -307
  47. package/dist/cli/commands/health.js.map +1 -1
  48. package/dist/cli/commands/history-compact.js +209 -140
  49. package/dist/cli/commands/history-compact.js.map +1 -1
  50. package/dist/cli/commands/history-redact.js +162 -119
  51. package/dist/cli/commands/history-redact.js.map +1 -1
  52. package/dist/cli/commands/history-repair.js +120 -85
  53. package/dist/cli/commands/history-repair.js.map +1 -1
  54. package/dist/cli/commands/init.d.ts +8 -2
  55. package/dist/cli/commands/init.js +263 -162
  56. package/dist/cli/commands/init.js.map +1 -1
  57. package/dist/cli/commands/list-filter-shared.js +55 -48
  58. package/dist/cli/commands/list-filter-shared.js.map +1 -1
  59. package/dist/cli/commands/list.js +152 -102
  60. package/dist/cli/commands/list.js.map +1 -1
  61. package/dist/cli/commands/next.js +49 -32
  62. package/dist/cli/commands/next.js.map +1 -1
  63. package/dist/cli/commands/plan.js +373 -298
  64. package/dist/cli/commands/plan.js.map +1 -1
  65. package/dist/cli/commands/recurrence-parsers.js +43 -25
  66. package/dist/cli/commands/recurrence-parsers.js.map +1 -1
  67. package/dist/cli/commands/reindex.d.ts +21 -5
  68. package/dist/cli/commands/reindex.js +345 -205
  69. package/dist/cli/commands/reindex.js.map +1 -1
  70. package/dist/cli/commands/restore.d.ts +8 -7
  71. package/dist/cli/commands/restore.js +105 -69
  72. package/dist/cli/commands/restore.js.map +1 -1
  73. package/dist/cli/commands/schema.js +33 -30
  74. package/dist/cli/commands/schema.js.map +1 -1
  75. package/dist/cli/commands/search.d.ts +10 -2
  76. package/dist/cli/commands/search.js +595 -536
  77. package/dist/cli/commands/search.js.map +1 -1
  78. package/dist/cli/commands/telemetry.js +98 -87
  79. package/dist/cli/commands/telemetry.js.map +1 -1
  80. package/dist/cli/commands/test-all.js +237 -168
  81. package/dist/cli/commands/test-all.js.map +1 -1
  82. package/dist/cli/commands/test.d.ts +6 -5
  83. package/dist/cli/commands/test.js +530 -464
  84. package/dist/cli/commands/test.js.map +1 -1
  85. package/dist/cli/commands/update-many.js +57 -42
  86. package/dist/cli/commands/update-many.js.map +1 -1
  87. package/dist/cli/commands/update.d.ts +1 -1
  88. package/dist/cli/commands/update.js +764 -747
  89. package/dist/cli/commands/update.js.map +1 -1
  90. package/dist/cli/commands/validate.d.ts +18 -1
  91. package/dist/cli/commands/validate.js +466 -343
  92. package/dist/cli/commands/validate.js.map +1 -1
  93. package/dist/cli/error-guidance.js +399 -357
  94. package/dist/cli/error-guidance.js.map +1 -1
  95. package/dist/cli/extension-command-options.js +48 -21
  96. package/dist/cli/extension-command-options.js.map +1 -1
  97. package/dist/cli/main.d.ts +47 -0
  98. package/dist/cli/main.js +428 -341
  99. package/dist/cli/main.js.map +1 -1
  100. package/dist/cli/migration-gates.js +22 -45
  101. package/dist/cli/migration-gates.js.map +1 -1
  102. package/dist/cli/register-list-query.js +94 -105
  103. package/dist/cli/register-list-query.js.map +1 -1
  104. package/dist/cli/register-mutation.js +400 -416
  105. package/dist/cli/register-mutation.js.map +1 -1
  106. package/dist/cli/register-operations.js +86 -66
  107. package/dist/cli/register-operations.js.map +1 -1
  108. package/dist/cli/register-setup.js +120 -101
  109. package/dist/cli/register-setup.js.map +1 -1
  110. package/dist/cli/registration-helpers.js +117 -122
  111. package/dist/cli/registration-helpers.js.map +1 -1
  112. package/dist/cli-bundle/chunks/{activity-MVSEND6D.js → activity-CUC4JY3U.js} +9 -9
  113. package/dist/cli-bundle/chunks/activity-WEIEMM73.js +16 -0
  114. package/dist/cli-bundle/chunks/{aggregate-MOC4TR2G.js → aggregate-DKUTRY6R.js} +109 -85
  115. package/dist/cli-bundle/chunks/aggregate-DKUTRY6R.js.map +1 -0
  116. package/dist/cli-bundle/chunks/{aggregate-XJHLZQ5X.js → aggregate-SW5PNGCS.js} +108 -84
  117. package/dist/cli-bundle/chunks/{aggregate-XJHLZQ5X.js.map → aggregate-SW5PNGCS.js.map} +2 -2
  118. package/dist/cli-bundle/chunks/{append-KDHT4GHI.js → append-H32VOR2Y.js} +6 -6
  119. package/dist/cli-bundle/chunks/{append-LEDBAM3K.js → append-UBM632FK.js} +6 -6
  120. package/dist/cli-bundle/chunks/{chunk-Z55WX4IQ.js → chunk-2227673O.js} +158 -114
  121. package/dist/cli-bundle/chunks/chunk-2227673O.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-SJZTPVFT.js → chunk-2ASNV4DH.js} +4 -4
  123. package/dist/cli-bundle/chunks/{chunk-JVQ7UOYC.js → chunk-2CHRYUXL.js} +2 -2
  124. package/dist/cli-bundle/chunks/{chunk-QE5UFCCO.js → chunk-2KWL5NPW.js} +42 -27
  125. package/dist/cli-bundle/chunks/chunk-2KWL5NPW.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-ZEATCVAC.js → chunk-36UGKF4O.js} +21 -29
  127. package/dist/cli-bundle/chunks/chunk-36UGKF4O.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-JZG5ADVE.js → chunk-3AZUFQK6.js} +1103 -963
  129. package/dist/cli-bundle/chunks/chunk-3AZUFQK6.js.map +1 -0
  130. package/dist/cli-bundle/chunks/{chunk-DRPF274X.js → chunk-3LCUASYG.js} +2 -2
  131. package/dist/cli-bundle/chunks/{chunk-JJ4SG243.js → chunk-3Q2HBMTI.js} +2 -2
  132. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js +87 -0
  133. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{chunk-GF7EAR22.js → chunk-4NUOWFBT.js} +109 -72
  135. package/dist/cli-bundle/chunks/chunk-4NUOWFBT.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-TQ6E76BE.js → chunk-55XRYWEG.js} +6 -6
  137. package/dist/cli-bundle/chunks/{chunk-5IRVSKPS.js → chunk-5GVTFFTC.js} +150 -224
  138. package/dist/cli-bundle/chunks/chunk-5GVTFFTC.js.map +1 -0
  139. package/dist/cli-bundle/chunks/{chunk-CHRNYKNI.js → chunk-5PGBHRY3.js} +41 -26
  140. package/dist/cli-bundle/chunks/chunk-5PGBHRY3.js.map +7 -0
  141. package/dist/cli-bundle/chunks/{chunk-53ARXF2O.js → chunk-66Z3X7ZG.js} +261 -161
  142. package/dist/cli-bundle/chunks/chunk-66Z3X7ZG.js.map +7 -0
  143. package/dist/cli-bundle/chunks/{chunk-A3UNLXNJ.js → chunk-6ITZLD4T.js} +738 -688
  144. package/dist/cli-bundle/chunks/chunk-6ITZLD4T.js.map +7 -0
  145. package/dist/cli-bundle/chunks/{chunk-JTRKME24.js → chunk-6YCYF2AI.js} +262 -162
  146. package/dist/cli-bundle/chunks/chunk-6YCYF2AI.js.map +1 -0
  147. package/dist/cli-bundle/chunks/{chunk-RM6MHL6A.js → chunk-6ZMBJRDJ.js} +580 -467
  148. package/dist/cli-bundle/chunks/chunk-6ZMBJRDJ.js.map +7 -0
  149. package/dist/cli-bundle/chunks/{chunk-RPRW26NG.js → chunk-7MYWF4ZX.js} +110 -73
  150. package/dist/cli-bundle/chunks/chunk-7MYWF4ZX.js.map +1 -0
  151. package/dist/cli-bundle/chunks/{chunk-SNUK7H5J.js → chunk-7NSPKJUS.js} +716 -606
  152. package/dist/cli-bundle/chunks/chunk-7NSPKJUS.js.map +7 -0
  153. package/dist/cli-bundle/chunks/{chunk-KYDYQMNW.js → chunk-7TH5NMVB.js} +95 -53
  154. package/dist/cli-bundle/chunks/chunk-7TH5NMVB.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{chunk-VD3LKZFX.js → chunk-7W4H4K26.js} +739 -689
  156. package/dist/cli-bundle/chunks/chunk-7W4H4K26.js.map +1 -0
  157. package/dist/cli-bundle/chunks/{chunk-IBU2LLWM.js → chunk-A6VOGKBA.js} +6 -6
  158. package/dist/cli-bundle/chunks/{chunk-MLHX6DN5.js → chunk-AIAIXG7I.js} +2 -2
  159. package/dist/cli-bundle/chunks/{chunk-NIBP3I7A.js → chunk-AJEBCRIY.js} +128 -126
  160. package/dist/cli-bundle/chunks/chunk-AJEBCRIY.js.map +1 -0
  161. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js → chunk-B4O5S7I3.js} +79 -57
  162. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js.map → chunk-B4O5S7I3.js.map} +2 -2
  163. package/dist/cli-bundle/chunks/{chunk-5ABGFWR4.js → chunk-BTX5MIQF.js} +2 -2
  164. package/dist/cli-bundle/chunks/chunk-BVZZN2LH.js +809 -0
  165. package/dist/cli-bundle/chunks/chunk-BVZZN2LH.js.map +7 -0
  166. package/dist/cli-bundle/chunks/{chunk-3JWQCLR5.js → chunk-CYBDUHNO.js} +3 -3
  167. package/dist/cli-bundle/chunks/{chunk-WFJZDUM7.js → chunk-CZPVDLD2.js} +4 -4
  168. package/dist/cli-bundle/chunks/{chunk-FDEVKXC4.js → chunk-EMPGXBUF.js} +22 -30
  169. package/dist/cli-bundle/chunks/chunk-EMPGXBUF.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{chunk-HUYYMTGW.js → chunk-EUKTMRN3.js} +2 -2
  171. package/dist/cli-bundle/chunks/{chunk-EVWYAG46.js → chunk-FFOQHGNH.js} +6 -6
  172. package/dist/cli-bundle/chunks/{chunk-IF4ERU6A.js → chunk-GFMSLORL.js} +6 -6
  173. package/dist/cli-bundle/chunks/{chunk-IZQOJR2B.js → chunk-GRRG3MCT.js} +198 -189
  174. package/dist/cli-bundle/chunks/chunk-GRRG3MCT.js.map +7 -0
  175. package/dist/cli-bundle/chunks/{chunk-IDYCAK35.js → chunk-H4GRLYJS.js} +3 -3
  176. package/dist/cli-bundle/chunks/{chunk-VMY7MZEM.js → chunk-HQTPRV4D.js} +6 -6
  177. package/dist/cli-bundle/chunks/{chunk-CY5IJMUM.js → chunk-I66WE2HE.js} +712 -602
  178. package/dist/cli-bundle/chunks/chunk-I66WE2HE.js.map +1 -0
  179. package/dist/cli-bundle/chunks/{chunk-ZFIEEDTJ.js → chunk-IEEJQCZ4.js} +509 -363
  180. package/dist/cli-bundle/chunks/chunk-IEEJQCZ4.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{chunk-DU66JUGT.js → chunk-IG5JYZGU.js} +488 -420
  182. package/dist/cli-bundle/chunks/chunk-IG5JYZGU.js.map +7 -0
  183. package/dist/cli-bundle/chunks/{chunk-7L6TXOOC.js → chunk-JMK5GCK2.js} +2 -2
  184. package/dist/cli-bundle/chunks/{chunk-LBH7UYKY.js → chunk-JXAUVO6X.js} +258 -169
  185. package/dist/cli-bundle/chunks/{chunk-LBH7UYKY.js.map → chunk-JXAUVO6X.js.map} +2 -2
  186. package/dist/cli-bundle/chunks/{chunk-KRASIL6M.js → chunk-K2VYLVX4.js} +2 -2
  187. package/dist/cli-bundle/chunks/{chunk-4YIMPANT.js → chunk-KCO2EAN5.js} +3 -3
  188. package/dist/cli-bundle/chunks/{chunk-T7ZMQI4J.js → chunk-KIYCOJ63.js} +198 -189
  189. package/dist/cli-bundle/chunks/chunk-KIYCOJ63.js.map +1 -0
  190. package/dist/cli-bundle/chunks/{chunk-D6USKAMA.js → chunk-KLXF7NCC.js} +2 -2
  191. package/dist/cli-bundle/chunks/{chunk-V3KLX7U7.js → chunk-KN3URLKS.js} +510 -364
  192. package/dist/cli-bundle/chunks/chunk-KN3URLKS.js.map +1 -0
  193. package/dist/cli-bundle/chunks/{chunk-OB3RJV5F.js → chunk-LRKMWUUV.js} +2 -2
  194. package/dist/cli-bundle/chunks/{chunk-74PUWBGN.js → chunk-LTRAF2D7.js} +3 -3
  195. package/dist/cli-bundle/chunks/{chunk-5T6WPLRO.js → chunk-MNBPX5JS.js} +394 -354
  196. package/dist/cli-bundle/chunks/chunk-MNBPX5JS.js.map +7 -0
  197. package/dist/cli-bundle/chunks/{chunk-4TXTVZL3.js → chunk-MRD4T5LF.js} +2 -2
  198. package/dist/cli-bundle/chunks/{chunk-E2Q2ULMR.js → chunk-N2JSWVWG.js} +4 -4
  199. package/dist/cli-bundle/chunks/{chunk-7WDETKGP.js → chunk-N3QCJS4M.js} +1105 -965
  200. package/dist/cli-bundle/chunks/chunk-N3QCJS4M.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{chunk-KGQ3W65B.js → chunk-NRZS637N.js} +258 -169
  202. package/dist/cli-bundle/chunks/chunk-NRZS637N.js.map +1 -0
  203. package/dist/cli-bundle/chunks/chunk-OTUJZKGI.js +799 -0
  204. package/dist/cli-bundle/chunks/chunk-OTUJZKGI.js.map +1 -0
  205. package/dist/cli-bundle/chunks/{chunk-ZIE6WXJ2.js → chunk-Q6K2OACU.js} +153 -90
  206. package/dist/cli-bundle/chunks/chunk-Q6K2OACU.js.map +1 -0
  207. package/dist/cli-bundle/chunks/{chunk-K46GQ265.js → chunk-Q6NXOHS6.js} +489 -421
  208. package/dist/cli-bundle/chunks/chunk-Q6NXOHS6.js.map +1 -0
  209. package/dist/cli-bundle/chunks/{chunk-7RIJGN4R.js → chunk-QH3FSKRJ.js} +2 -2
  210. package/dist/cli-bundle/chunks/{chunk-UB3V5WUI.js → chunk-RM37OPYK.js} +394 -354
  211. package/dist/cli-bundle/chunks/chunk-RM37OPYK.js.map +1 -0
  212. package/dist/cli-bundle/chunks/{chunk-OUQ5JEFM.js → chunk-S62UANU7.js} +3 -3
  213. package/dist/cli-bundle/chunks/{chunk-NO6Y6FB2.js → chunk-SPM2XLWI.js} +37 -28
  214. package/dist/cli-bundle/chunks/chunk-SPM2XLWI.js.map +7 -0
  215. package/dist/cli-bundle/chunks/{chunk-DORJSBGJ.js → chunk-SYNKD3ZG.js} +127 -125
  216. package/dist/cli-bundle/chunks/chunk-SYNKD3ZG.js.map +7 -0
  217. package/dist/cli-bundle/chunks/{chunk-6YRAMXRS.js → chunk-SYVUU7EK.js} +581 -468
  218. package/dist/cli-bundle/chunks/chunk-SYVUU7EK.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{chunk-D5LYZVGB.js → chunk-TPOFWBMY.js} +95 -53
  220. package/dist/cli-bundle/chunks/chunk-TPOFWBMY.js.map +1 -0
  221. package/dist/cli-bundle/chunks/{chunk-IHXXUIXS.js → chunk-TTHCEV5Q.js} +92 -77
  222. package/dist/cli-bundle/chunks/chunk-TTHCEV5Q.js.map +1 -0
  223. package/dist/cli-bundle/chunks/{chunk-DLDCPF5X.js → chunk-U2BEEM2X.js} +3 -3
  224. package/dist/cli-bundle/chunks/{chunk-Z5BM2FKQ.js → chunk-UGLU6Q2I.js} +91 -76
  225. package/dist/cli-bundle/chunks/chunk-UGLU6Q2I.js.map +7 -0
  226. package/dist/cli-bundle/chunks/{chunk-73PTKMAE.js → chunk-UT73HUPC.js} +3 -3
  227. package/dist/cli-bundle/chunks/{chunk-F7G53BOA.js → chunk-UTSH5GWX.js} +4 -4
  228. package/dist/cli-bundle/chunks/{chunk-AWN4PPH5.js → chunk-UWKEJMZU.js} +157 -113
  229. package/dist/cli-bundle/chunks/chunk-UWKEJMZU.js.map +7 -0
  230. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js +84 -0
  231. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js.map +1 -0
  232. package/dist/cli-bundle/chunks/{chunk-KTMMTOIP.js → chunk-W47SML5B.js} +152 -89
  233. package/dist/cli-bundle/chunks/chunk-W47SML5B.js.map +7 -0
  234. package/dist/cli-bundle/chunks/{chunk-UFKNF23C.js → chunk-WJAMWAHZ.js} +157 -118
  235. package/dist/cli-bundle/chunks/chunk-WJAMWAHZ.js.map +7 -0
  236. package/dist/cli-bundle/chunks/{chunk-HIBK6H4S.js → chunk-XCHUVHKU.js} +685 -544
  237. package/dist/cli-bundle/chunks/chunk-XCHUVHKU.js.map +1 -0
  238. package/dist/cli-bundle/chunks/{chunk-DJDXAU74.js → chunk-XEWQKDYZ.js} +685 -544
  239. package/dist/cli-bundle/chunks/chunk-XEWQKDYZ.js.map +7 -0
  240. package/dist/cli-bundle/chunks/{chunk-BOWQWXLI.js → chunk-XTHQWXVC.js} +158 -119
  241. package/dist/cli-bundle/chunks/chunk-XTHQWXVC.js.map +1 -0
  242. package/dist/cli-bundle/chunks/{chunk-6T5ZIWBS.js → chunk-XWGEMNBR.js} +150 -224
  243. package/dist/cli-bundle/chunks/chunk-XWGEMNBR.js.map +7 -0
  244. package/dist/cli-bundle/chunks/{chunk-JIP67N2K.js → chunk-Y4NRKBFW.js} +3 -3
  245. package/dist/cli-bundle/chunks/{chunk-WTRUDJ3R.js → chunk-YLZZ6T54.js} +38 -29
  246. package/dist/cli-bundle/chunks/chunk-YLZZ6T54.js.map +1 -0
  247. package/dist/cli-bundle/chunks/{chunk-FBZ5XAAF.js → chunk-YPKFV2JR.js} +6 -6
  248. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js → chunk-Z4DGFQDH.js} +80 -58
  249. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js.map → chunk-Z4DGFQDH.js.map} +1 -1
  250. package/dist/cli-bundle/chunks/{chunk-BN3CWK6G.js → chunk-ZNHEYCDD.js} +2 -2
  251. package/dist/cli-bundle/chunks/{chunk-YEDFE4DC.js → chunk-ZNT7KEWE.js} +2 -2
  252. package/dist/cli-bundle/chunks/{claim-HMCLSLUE.js → claim-SENTPZBN.js} +8 -8
  253. package/dist/cli-bundle/chunks/{claim-6NINZYB3.js → claim-Z7MEQCBT.js} +8 -8
  254. package/dist/cli-bundle/chunks/{close-OP3LK7Z2.js → close-424MX4CU.js} +7 -7
  255. package/dist/cli-bundle/chunks/close-YCWQQPDS.js +14 -0
  256. package/dist/cli-bundle/chunks/{close-many-CXJBOWWY.js → close-many-2IV4J2TR.js} +103 -82
  257. package/dist/cli-bundle/chunks/close-many-2IV4J2TR.js.map +1 -0
  258. package/dist/cli-bundle/chunks/{close-many-BFMP6HHK.js → close-many-SWY34BII.js} +102 -81
  259. package/dist/cli-bundle/chunks/close-many-SWY34BII.js.map +7 -0
  260. package/dist/cli-bundle/chunks/{comments-ETHABIY6.js → comments-4FGNTSNV.js} +8 -8
  261. package/dist/cli-bundle/chunks/{comments-MU2WMBUY.js → comments-7YS5MY5X.js} +8 -8
  262. package/dist/cli-bundle/chunks/config-BZJKK7FZ.js +1062 -0
  263. package/dist/cli-bundle/chunks/config-BZJKK7FZ.js.map +1 -0
  264. package/dist/cli-bundle/chunks/config-G74GISC4.js +1072 -0
  265. package/dist/cli-bundle/chunks/config-G74GISC4.js.map +7 -0
  266. package/dist/cli-bundle/chunks/{context-7ZEZV3BV.js → context-LHVKJSPJ.js} +12 -12
  267. package/dist/cli-bundle/chunks/{context-XDI4DKKT.js → context-ZQY54JNS.js} +12 -12
  268. package/dist/cli-bundle/chunks/{contracts-SMOAN5NF.js → contracts-CP2EZJC7.js} +320 -199
  269. package/dist/cli-bundle/chunks/contracts-CP2EZJC7.js.map +7 -0
  270. package/dist/cli-bundle/chunks/{contracts-KP4QAGVW.js → contracts-FIZLMP7O.js} +321 -200
  271. package/dist/cli-bundle/chunks/contracts-FIZLMP7O.js.map +1 -0
  272. package/dist/cli-bundle/chunks/{copy-JJ3KOQW2.js → copy-GYNQQPW2.js} +5 -5
  273. package/dist/cli-bundle/chunks/{copy-CWM6SBY6.js → copy-TLW7JTQT.js} +5 -5
  274. package/dist/cli-bundle/chunks/{create-J5Q2ELZT.js → create-VSKYSOCD.js} +12 -12
  275. package/dist/cli-bundle/chunks/create-XTMAPS7I.js +28 -0
  276. package/dist/cli-bundle/chunks/{delete-2GZLQEUQ.js → delete-4W5JYCEG.js} +5 -5
  277. package/dist/cli-bundle/chunks/{delete-OOQS4KVD.js → delete-ANTOTI2I.js} +5 -5
  278. package/dist/cli-bundle/chunks/{deps-IF4IGL4R.js → deps-HPPE6MJN.js} +5 -5
  279. package/dist/cli-bundle/chunks/{deps-ZVGGCRR6.js → deps-ZQZN54EZ.js} +5 -5
  280. package/dist/cli-bundle/chunks/{docs-NFTBCQQC.js → docs-RPOVFMP3.js} +7 -7
  281. package/dist/cli-bundle/chunks/{docs-2TIFR62T.js → docs-XJNYBJGE.js} +7 -7
  282. package/dist/cli-bundle/chunks/{eval-2F6EH4XN.js → eval-DM6JBZTS.js} +10 -10
  283. package/dist/cli-bundle/chunks/{eval-PFKXQR3B.js → eval-RFBI5FGS.js} +10 -10
  284. package/dist/cli-bundle/chunks/{extension-GMVOIP4O.js → extension-B3YY4WY5.js} +11 -10
  285. package/dist/cli-bundle/chunks/{extension-3LRYX7SW.js → extension-TTSEFQTS.js} +11 -10
  286. package/dist/cli-bundle/chunks/{files-DF3HO6XK.js → files-5D65CHGE.js} +7 -7
  287. package/dist/cli-bundle/chunks/{files-T5ODMETM.js → files-GPIG77EN.js} +7 -7
  288. package/dist/cli-bundle/chunks/{focus-MY5ARIEK.js → focus-C3PEJV2C.js} +6 -6
  289. package/dist/cli-bundle/chunks/{focus-DLXKK4AH.js → focus-ZHN7WIGX.js} +6 -6
  290. package/dist/cli-bundle/chunks/{gc-MDGRR2SU.js → gc-D4JQ6OWN.js} +3 -3
  291. package/dist/cli-bundle/chunks/{gc-FULIVYR4.js → gc-VZIXDL32.js} +3 -3
  292. package/dist/cli-bundle/chunks/{get-VYPIICPC.js → get-GIBRUUOP.js} +121 -81
  293. package/dist/cli-bundle/chunks/get-GIBRUUOP.js.map +1 -0
  294. package/dist/cli-bundle/chunks/{get-AWK324RS.js → get-IOVAN6RU.js} +120 -80
  295. package/dist/cli-bundle/chunks/get-IOVAN6RU.js.map +7 -0
  296. package/dist/cli-bundle/chunks/{health-Q66C43GN.js → health-L2U3AFKV.js} +437 -264
  297. package/dist/cli-bundle/chunks/health-L2U3AFKV.js.map +1 -0
  298. package/dist/cli-bundle/chunks/{health-FBCVZGSX.js → health-MM7AWXYF.js} +436 -263
  299. package/dist/cli-bundle/chunks/health-MM7AWXYF.js.map +7 -0
  300. package/dist/cli-bundle/chunks/history-DD7L7BNL.js +18 -0
  301. package/dist/cli-bundle/chunks/{history-X4OSES6K.js → history-IL7XCEX2.js} +8 -8
  302. package/dist/cli-bundle/chunks/{history-compact-2GHT32UX.js → history-compact-HALOTOU7.js} +214 -135
  303. package/dist/cli-bundle/chunks/history-compact-HALOTOU7.js.map +1 -0
  304. package/dist/cli-bundle/chunks/{history-compact-WLCQEKXS.js → history-compact-MV25P7DM.js} +213 -134
  305. package/dist/cli-bundle/chunks/history-compact-MV25P7DM.js.map +7 -0
  306. package/dist/cli-bundle/chunks/history-redact-IX4YEWMY.js +19 -0
  307. package/dist/cli-bundle/chunks/{history-redact-45YW65BK.js → history-redact-VYCWQFK7.js} +9 -9
  308. package/dist/cli-bundle/chunks/{history-repair-FY75IC26.js → history-repair-44MODPQF.js} +124 -84
  309. package/dist/cli-bundle/chunks/history-repair-44MODPQF.js.map +1 -0
  310. package/dist/cli-bundle/chunks/{history-repair-GABSDSVD.js → history-repair-CPNAOCNF.js} +123 -83
  311. package/dist/cli-bundle/chunks/history-repair-CPNAOCNF.js.map +7 -0
  312. package/dist/cli-bundle/chunks/{init-KO7CGIRQ.js → init-F27NHENZ.js} +12 -11
  313. package/dist/cli-bundle/chunks/init-HHVQQP6C.js +22 -0
  314. package/dist/cli-bundle/chunks/{learnings-LHZT5BHW.js → learnings-HJVDQIGY.js} +8 -8
  315. package/dist/cli-bundle/chunks/{learnings-3F7YLI45.js → learnings-XSFSUUWK.js} +8 -8
  316. package/dist/cli-bundle/chunks/{list-Y6AU5BJS.js → list-HPMEKCAA.js} +8 -8
  317. package/dist/cli-bundle/chunks/{list-ROT7JF62.js → list-VMPWTURB.js} +8 -8
  318. package/dist/cli-bundle/chunks/{next-66BJB4N2.js → next-ETXF2ZCN.js} +59 -37
  319. package/dist/cli-bundle/chunks/next-ETXF2ZCN.js.map +7 -0
  320. package/dist/cli-bundle/chunks/{next-N5MWJTBY.js → next-QM6YJIIS.js} +60 -38
  321. package/dist/cli-bundle/chunks/next-QM6YJIIS.js.map +1 -0
  322. package/dist/cli-bundle/chunks/{notes-FW6YFLND.js → notes-GDZIKGR6.js} +8 -8
  323. package/dist/cli-bundle/chunks/{notes-EVJZ3VAB.js → notes-WDDBPC4D.js} +8 -8
  324. package/dist/cli-bundle/chunks/{plan-ZHKZ7JVF.js → plan-BGDR73Z6.js} +373 -279
  325. package/dist/cli-bundle/chunks/plan-BGDR73Z6.js.map +1 -0
  326. package/dist/cli-bundle/chunks/{plan-DQ7G4EDC.js → plan-C5IMM335.js} +372 -278
  327. package/dist/cli-bundle/chunks/plan-C5IMM335.js.map +7 -0
  328. package/dist/cli-bundle/chunks/{profile-CHAW6SEA.js → profile-CCOKZ2IQ.js} +9 -9
  329. package/dist/cli-bundle/chunks/{profile-UPZGCDOG.js → profile-HUCENIEQ.js} +9 -9
  330. package/dist/cli-bundle/chunks/{register-list-query-Y2VRHPCL.js → register-list-query-ROSNIL52.js} +80 -83
  331. package/dist/cli-bundle/chunks/register-list-query-ROSNIL52.js.map +1 -0
  332. package/dist/cli-bundle/chunks/{register-list-query-KY6Z6WV7.js → register-list-query-XN4ZRHSV.js} +79 -82
  333. package/dist/cli-bundle/chunks/register-list-query-XN4ZRHSV.js.map +7 -0
  334. package/dist/cli-bundle/chunks/{register-mutation-PCARIGZS.js → register-mutation-CFSB2MS3.js} +406 -385
  335. package/dist/cli-bundle/chunks/register-mutation-CFSB2MS3.js.map +1 -0
  336. package/dist/cli-bundle/chunks/{register-mutation-N6AYSKPM.js → register-mutation-KRLAHEL2.js} +405 -384
  337. package/dist/cli-bundle/chunks/register-mutation-KRLAHEL2.js.map +7 -0
  338. package/dist/cli-bundle/chunks/{register-operations-L6CYTOIH.js → register-operations-4PASGJDB.js} +112 -93
  339. package/dist/cli-bundle/chunks/register-operations-4PASGJDB.js.map +7 -0
  340. package/dist/cli-bundle/chunks/{register-operations-YAT6FUUB.js → register-operations-MBN4KGUM.js} +113 -94
  341. package/dist/cli-bundle/chunks/register-operations-MBN4KGUM.js.map +1 -0
  342. package/dist/cli-bundle/chunks/{register-setup-N7UGXYJC.js → register-setup-VIAWYFP5.js} +129 -104
  343. package/dist/cli-bundle/chunks/register-setup-VIAWYFP5.js.map +1 -0
  344. package/dist/cli-bundle/chunks/{register-setup-MPANILQF.js → register-setup-ZCGKHDKL.js} +128 -103
  345. package/dist/cli-bundle/chunks/register-setup-ZCGKHDKL.js.map +7 -0
  346. package/dist/cli-bundle/chunks/{restore-DKMCLPI5.js → restore-4CBWUMCX.js} +9 -9
  347. package/dist/cli-bundle/chunks/restore-5UEAGG3W.js +17 -0
  348. package/dist/cli-bundle/chunks/{scheduling-shortcuts-3F4QUEDH.js → scheduling-shortcuts-6VFKNKCM.js} +12 -12
  349. package/dist/cli-bundle/chunks/{scheduling-shortcuts-BNZLQK36.js → scheduling-shortcuts-ERHCVTEM.js} +12 -12
  350. package/dist/cli-bundle/chunks/{schema-OLT6LVKH.js → schema-TDGK6N3I.js} +7 -7
  351. package/dist/cli-bundle/chunks/{schema-XJXKJQF5.js → schema-UE5KKAUX.js} +7 -7
  352. package/dist/cli-bundle/chunks/{search-KP6H7COV.js → search-FP7MEU4S.js} +10 -10
  353. package/dist/cli-bundle/chunks/{search-CX5UMV4H.js → search-K4CFLQ5S.js} +10 -10
  354. package/dist/cli-bundle/chunks/{stats-QZUG6MX5.js → stats-NJJCALEZ.js} +6 -6
  355. package/dist/cli-bundle/chunks/{stats-7XW4OEMK.js → stats-XT6QRKQY.js} +6 -6
  356. package/dist/cli-bundle/chunks/{telemetry-DIFPXCAT.js → telemetry-5SQ5UDXC.js} +84 -70
  357. package/dist/cli-bundle/chunks/telemetry-5SQ5UDXC.js.map +7 -0
  358. package/dist/cli-bundle/chunks/{telemetry-WTYFUPRL.js → telemetry-HVXFZA2U.js} +85 -71
  359. package/dist/cli-bundle/chunks/telemetry-HVXFZA2U.js.map +1 -0
  360. package/dist/cli-bundle/chunks/{test-QNDXZQCW.js → test-UFSJ5YIO.js} +15 -14
  361. package/dist/cli-bundle/chunks/{test-HU2BS7EY.js → test-YCDAUBWF.js} +15 -14
  362. package/dist/cli-bundle/chunks/test-all-2BWKY3GQ.js +427 -0
  363. package/dist/cli-bundle/chunks/test-all-2BWKY3GQ.js.map +1 -0
  364. package/dist/cli-bundle/chunks/test-all-PM7UYN42.js +430 -0
  365. package/dist/cli-bundle/chunks/test-all-PM7UYN42.js.map +7 -0
  366. package/dist/cli-bundle/chunks/{test-runs-CA6K32RD.js → test-runs-FK5E75AA.js} +185 -147
  367. package/dist/cli-bundle/chunks/test-runs-FK5E75AA.js.map +1 -0
  368. package/dist/cli-bundle/chunks/{test-runs-LANLLPVO.js → test-runs-H4TGWGRN.js} +184 -146
  369. package/dist/cli-bundle/chunks/test-runs-H4TGWGRN.js.map +7 -0
  370. package/dist/cli-bundle/chunks/update-MTCFES6X.js +24 -0
  371. package/dist/cli-bundle/chunks/{update-DJKWLBWJ.js → update-Y5WQVT5O.js} +15 -15
  372. package/dist/cli-bundle/chunks/{update-many-LU3SCNK5.js → update-many-6YAYYRLE.js} +83 -68
  373. package/dist/cli-bundle/chunks/{update-many-LU3SCNK5.js.map → update-many-6YAYYRLE.js.map} +2 -2
  374. package/dist/cli-bundle/chunks/{update-many-VW5DGF3S.js → update-many-JTKKSA7Y.js} +84 -69
  375. package/dist/cli-bundle/chunks/{update-many-VW5DGF3S.js.map → update-many-JTKKSA7Y.js.map} +1 -1
  376. package/dist/cli-bundle/chunks/{upgrade-ICXY244R.js → upgrade-DTAHZ236.js} +11 -10
  377. package/dist/cli-bundle/chunks/{upgrade-ICXY244R.js.map → upgrade-DTAHZ236.js.map} +1 -1
  378. package/dist/cli-bundle/chunks/{upgrade-77FRUAXN.js → upgrade-JUDU7YL4.js} +13 -12
  379. package/dist/cli-bundle/chunks/{upgrade-77FRUAXN.js.map → upgrade-JUDU7YL4.js.map} +1 -1
  380. package/dist/cli-bundle/chunks/{validate-2G566PKQ.js → validate-732RWS5W.js} +440 -319
  381. package/dist/cli-bundle/chunks/validate-732RWS5W.js.map +7 -0
  382. package/dist/cli-bundle/chunks/{validate-BDPVXHHH.js → validate-W7H5TEDC.js} +441 -320
  383. package/dist/cli-bundle/chunks/validate-W7H5TEDC.js.map +1 -0
  384. package/dist/cli-bundle/main.js +986 -1500
  385. package/dist/cli-bundle/main.js.map +4 -4
  386. package/dist/core/config/nested-settings.js +89 -67
  387. package/dist/core/config/nested-settings.js.map +1 -1
  388. package/dist/core/extensions/activation-summary-markdown.js +23 -12
  389. package/dist/core/extensions/activation-summary-markdown.js.map +1 -1
  390. package/dist/core/extensions/extension-policy.d.ts +18 -3
  391. package/dist/core/extensions/extension-policy.js +116 -106
  392. package/dist/core/extensions/extension-policy.js.map +1 -1
  393. package/dist/core/extensions/loader.js +310 -232
  394. package/dist/core/extensions/loader.js.map +1 -1
  395. package/dist/core/governance/metadata-coverage.js +20 -28
  396. package/dist/core/governance/metadata-coverage.js.map +1 -1
  397. package/dist/core/history/drift-scan.js +93 -81
  398. package/dist/core/history/drift-scan.js.map +1 -1
  399. package/dist/core/item/item-format.js +523 -410
  400. package/dist/core/item/item-format.js.map +1 -1
  401. package/dist/core/item/item-type-definition.js +14 -14
  402. package/dist/core/item/item-type-definition.js.map +1 -1
  403. package/dist/core/item/type-registry.js +87 -82
  404. package/dist/core/item/type-registry.js.map +1 -1
  405. package/dist/core/output/mutation-projection.js +42 -26
  406. package/dist/core/output/mutation-projection.js.map +1 -1
  407. package/dist/core/schema/runtime-schema.js +34 -28
  408. package/dist/core/schema/runtime-schema.js.map +1 -1
  409. package/dist/core/search/semantic-defaults.js +64 -37
  410. package/dist/core/search/semantic-defaults.js.map +1 -1
  411. package/dist/core/search/vector-stores.js +32 -17
  412. package/dist/core/search/vector-stores.js.map +1 -1
  413. package/dist/core/sentry/helpers.js +31 -28
  414. package/dist/core/sentry/helpers.js.map +1 -1
  415. package/dist/core/sentry/instrument.js +54 -43
  416. package/dist/core/sentry/instrument.js.map +1 -1
  417. package/dist/core/store/front-matter-cache.js +239 -153
  418. package/dist/core/store/front-matter-cache.js.map +1 -1
  419. package/dist/core/store/item-store.js +33 -26
  420. package/dist/core/store/item-store.js.map +1 -1
  421. package/dist/core/store/settings.js +247 -203
  422. package/dist/core/store/settings.js.map +1 -1
  423. package/dist/core/test/background-runs.js +189 -160
  424. package/dist/core/test/background-runs.js.map +1 -1
  425. package/dist/mcp/server.js +387 -367
  426. package/dist/mcp/server.js.map +1 -1
  427. package/dist/sdk/cli-contracts/flag-contracts.js +111 -180
  428. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  429. package/dist/sdk/cli-contracts/tool-schema.js +76 -45
  430. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  431. package/dist/sdk/compose.d.ts +4 -1
  432. package/dist/sdk/compose.js +181 -115
  433. package/dist/sdk/compose.js.map +1 -1
  434. package/docs/RELEASING.md +2 -3
  435. package/package.json +2 -2
  436. package/packages/pm-beads/extensions/beads/runtime.ts +240 -167
  437. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +65 -58
  438. package/packages/pm-todos/extensions/todos/runtime.ts +65 -42
  439. package/dist/cli-bundle/chunks/activity-EJBMXUBH.js +0 -16
  440. package/dist/cli-bundle/chunks/aggregate-MOC4TR2G.js.map +0 -1
  441. package/dist/cli-bundle/chunks/chunk-53ARXF2O.js.map +0 -7
  442. package/dist/cli-bundle/chunks/chunk-5IRVSKPS.js.map +0 -1
  443. package/dist/cli-bundle/chunks/chunk-5T6WPLRO.js.map +0 -7
  444. package/dist/cli-bundle/chunks/chunk-6T5ZIWBS.js.map +0 -7
  445. package/dist/cli-bundle/chunks/chunk-6YRAMXRS.js.map +0 -1
  446. package/dist/cli-bundle/chunks/chunk-7WDETKGP.js.map +0 -7
  447. package/dist/cli-bundle/chunks/chunk-A3UNLXNJ.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-AWN4PPH5.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-BOWQWXLI.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-C2KCIZKZ.js +0 -115
  451. package/dist/cli-bundle/chunks/chunk-C2KCIZKZ.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-CHRNYKNI.js.map +0 -7
  453. package/dist/cli-bundle/chunks/chunk-CY5IJMUM.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-D5LYZVGB.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-DJDXAU74.js.map +0 -7
  456. package/dist/cli-bundle/chunks/chunk-DORJSBGJ.js.map +0 -7
  457. package/dist/cli-bundle/chunks/chunk-DU66JUGT.js.map +0 -7
  458. package/dist/cli-bundle/chunks/chunk-F6VH3LFC.js +0 -118
  459. package/dist/cli-bundle/chunks/chunk-F6VH3LFC.js.map +0 -7
  460. package/dist/cli-bundle/chunks/chunk-FDEVKXC4.js.map +0 -1
  461. package/dist/cli-bundle/chunks/chunk-GF7EAR22.js.map +0 -7
  462. package/dist/cli-bundle/chunks/chunk-HIBK6H4S.js.map +0 -1
  463. package/dist/cli-bundle/chunks/chunk-IHXXUIXS.js.map +0 -1
  464. package/dist/cli-bundle/chunks/chunk-ISEKN64V.js +0 -35
  465. package/dist/cli-bundle/chunks/chunk-ISEKN64V.js.map +0 -7
  466. package/dist/cli-bundle/chunks/chunk-IZQOJR2B.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-JTRKME24.js.map +0 -1
  468. package/dist/cli-bundle/chunks/chunk-JZG5ADVE.js.map +0 -1
  469. package/dist/cli-bundle/chunks/chunk-K46GQ265.js.map +0 -1
  470. package/dist/cli-bundle/chunks/chunk-KGQ3W65B.js.map +0 -1
  471. package/dist/cli-bundle/chunks/chunk-KTMMTOIP.js.map +0 -7
  472. package/dist/cli-bundle/chunks/chunk-KYDYQMNW.js.map +0 -7
  473. package/dist/cli-bundle/chunks/chunk-NIBP3I7A.js.map +0 -1
  474. package/dist/cli-bundle/chunks/chunk-NO6Y6FB2.js.map +0 -7
  475. package/dist/cli-bundle/chunks/chunk-QE5UFCCO.js.map +0 -1
  476. package/dist/cli-bundle/chunks/chunk-RM6MHL6A.js.map +0 -7
  477. package/dist/cli-bundle/chunks/chunk-RPRW26NG.js.map +0 -1
  478. package/dist/cli-bundle/chunks/chunk-SNUK7H5J.js.map +0 -7
  479. package/dist/cli-bundle/chunks/chunk-T7ZMQI4J.js.map +0 -1
  480. package/dist/cli-bundle/chunks/chunk-UB3V5WUI.js.map +0 -1
  481. package/dist/cli-bundle/chunks/chunk-UFKNF23C.js.map +0 -7
  482. package/dist/cli-bundle/chunks/chunk-V3KLX7U7.js.map +0 -1
  483. package/dist/cli-bundle/chunks/chunk-VD3LKZFX.js.map +0 -1
  484. package/dist/cli-bundle/chunks/chunk-W2VMLL5S.js +0 -32
  485. package/dist/cli-bundle/chunks/chunk-W2VMLL5S.js.map +0 -1
  486. package/dist/cli-bundle/chunks/chunk-WTRUDJ3R.js.map +0 -1
  487. package/dist/cli-bundle/chunks/chunk-Z55WX4IQ.js.map +0 -1
  488. package/dist/cli-bundle/chunks/chunk-Z5BM2FKQ.js.map +0 -7
  489. package/dist/cli-bundle/chunks/chunk-ZEATCVAC.js.map +0 -7
  490. package/dist/cli-bundle/chunks/chunk-ZFIEEDTJ.js.map +0 -7
  491. package/dist/cli-bundle/chunks/chunk-ZIE6WXJ2.js.map +0 -1
  492. package/dist/cli-bundle/chunks/close-37KEHLYM.js +0 -14
  493. package/dist/cli-bundle/chunks/close-many-BFMP6HHK.js.map +0 -7
  494. package/dist/cli-bundle/chunks/close-many-CXJBOWWY.js.map +0 -1
  495. package/dist/cli-bundle/chunks/config-FIXJZEQK.js +0 -1541
  496. package/dist/cli-bundle/chunks/config-FIXJZEQK.js.map +0 -7
  497. package/dist/cli-bundle/chunks/config-X3ZVCUUG.js +0 -1531
  498. package/dist/cli-bundle/chunks/config-X3ZVCUUG.js.map +0 -1
  499. package/dist/cli-bundle/chunks/contracts-KP4QAGVW.js.map +0 -1
  500. package/dist/cli-bundle/chunks/contracts-SMOAN5NF.js.map +0 -7
  501. package/dist/cli-bundle/chunks/create-DFMNBKBS.js +0 -28
  502. package/dist/cli-bundle/chunks/get-AWK324RS.js.map +0 -7
  503. package/dist/cli-bundle/chunks/get-VYPIICPC.js.map +0 -1
  504. package/dist/cli-bundle/chunks/health-FBCVZGSX.js.map +0 -7
  505. package/dist/cli-bundle/chunks/health-Q66C43GN.js.map +0 -1
  506. package/dist/cli-bundle/chunks/history-5XUSLAJA.js +0 -18
  507. package/dist/cli-bundle/chunks/history-compact-2GHT32UX.js.map +0 -1
  508. package/dist/cli-bundle/chunks/history-compact-WLCQEKXS.js.map +0 -7
  509. package/dist/cli-bundle/chunks/history-redact-BVHWDXPR.js +0 -19
  510. package/dist/cli-bundle/chunks/history-repair-FY75IC26.js.map +0 -1
  511. package/dist/cli-bundle/chunks/history-repair-GABSDSVD.js.map +0 -7
  512. package/dist/cli-bundle/chunks/init-TRYJELH4.js +0 -21
  513. package/dist/cli-bundle/chunks/next-66BJB4N2.js.map +0 -7
  514. package/dist/cli-bundle/chunks/next-N5MWJTBY.js.map +0 -1
  515. package/dist/cli-bundle/chunks/plan-DQ7G4EDC.js.map +0 -7
  516. package/dist/cli-bundle/chunks/plan-ZHKZ7JVF.js.map +0 -1
  517. package/dist/cli-bundle/chunks/register-list-query-KY6Z6WV7.js.map +0 -7
  518. package/dist/cli-bundle/chunks/register-list-query-Y2VRHPCL.js.map +0 -1
  519. package/dist/cli-bundle/chunks/register-mutation-N6AYSKPM.js.map +0 -7
  520. package/dist/cli-bundle/chunks/register-mutation-PCARIGZS.js.map +0 -1
  521. package/dist/cli-bundle/chunks/register-operations-L6CYTOIH.js.map +0 -7
  522. package/dist/cli-bundle/chunks/register-operations-YAT6FUUB.js.map +0 -1
  523. package/dist/cli-bundle/chunks/register-setup-MPANILQF.js.map +0 -7
  524. package/dist/cli-bundle/chunks/register-setup-N7UGXYJC.js.map +0 -1
  525. package/dist/cli-bundle/chunks/restore-IRAKSWIW.js +0 -17
  526. package/dist/cli-bundle/chunks/telemetry-DIFPXCAT.js.map +0 -7
  527. package/dist/cli-bundle/chunks/telemetry-WTYFUPRL.js.map +0 -1
  528. package/dist/cli-bundle/chunks/test-all-PZTBLLQ6.js +0 -360
  529. package/dist/cli-bundle/chunks/test-all-PZTBLLQ6.js.map +0 -7
  530. package/dist/cli-bundle/chunks/test-all-XLPI4USF.js +0 -357
  531. package/dist/cli-bundle/chunks/test-all-XLPI4USF.js.map +0 -1
  532. package/dist/cli-bundle/chunks/test-runs-CA6K32RD.js.map +0 -1
  533. package/dist/cli-bundle/chunks/test-runs-LANLLPVO.js.map +0 -7
  534. package/dist/cli-bundle/chunks/update-UXDLTEOZ.js +0 -24
  535. package/dist/cli-bundle/chunks/validate-2G566PKQ.js.map +0 -7
  536. package/dist/cli-bundle/chunks/validate-BDPVXHHH.js.map +0 -1
  537. /package/dist/cli-bundle/chunks/{activity-MVSEND6D.js.map → activity-CUC4JY3U.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{activity-EJBMXUBH.js.map → activity-WEIEMM73.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{append-KDHT4GHI.js.map → append-H32VOR2Y.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{append-LEDBAM3K.js.map → append-UBM632FK.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-SJZTPVFT.js.map → chunk-2ASNV4DH.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-JVQ7UOYC.js.map → chunk-2CHRYUXL.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-DRPF274X.js.map → chunk-3LCUASYG.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-JJ4SG243.js.map → chunk-3Q2HBMTI.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-TQ6E76BE.js.map → chunk-55XRYWEG.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-IBU2LLWM.js.map → chunk-A6VOGKBA.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-MLHX6DN5.js.map → chunk-AIAIXG7I.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-5ABGFWR4.js.map → chunk-BTX5MIQF.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-3JWQCLR5.js.map → chunk-CYBDUHNO.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-WFJZDUM7.js.map → chunk-CZPVDLD2.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-HUYYMTGW.js.map → chunk-EUKTMRN3.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-EVWYAG46.js.map → chunk-FFOQHGNH.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-IF4ERU6A.js.map → chunk-GFMSLORL.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-IDYCAK35.js.map → chunk-H4GRLYJS.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-VMY7MZEM.js.map → chunk-HQTPRV4D.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-7L6TXOOC.js.map → chunk-JMK5GCK2.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-KRASIL6M.js.map → chunk-K2VYLVX4.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-4YIMPANT.js.map → chunk-KCO2EAN5.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-D6USKAMA.js.map → chunk-KLXF7NCC.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-OB3RJV5F.js.map → chunk-LRKMWUUV.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-74PUWBGN.js.map → chunk-LTRAF2D7.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-4TXTVZL3.js.map → chunk-MRD4T5LF.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-E2Q2ULMR.js.map → chunk-N2JSWVWG.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-7RIJGN4R.js.map → chunk-QH3FSKRJ.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-OUQ5JEFM.js.map → chunk-S62UANU7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-DLDCPF5X.js.map → chunk-U2BEEM2X.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-73PTKMAE.js.map → chunk-UT73HUPC.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{chunk-F7G53BOA.js.map → chunk-UTSH5GWX.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{chunk-JIP67N2K.js.map → chunk-Y4NRKBFW.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{chunk-FBZ5XAAF.js.map → chunk-YPKFV2JR.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{chunk-BN3CWK6G.js.map → chunk-ZNHEYCDD.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{chunk-YEDFE4DC.js.map → chunk-ZNT7KEWE.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{claim-HMCLSLUE.js.map → claim-SENTPZBN.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{claim-6NINZYB3.js.map → claim-Z7MEQCBT.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{close-OP3LK7Z2.js.map → close-424MX4CU.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{close-37KEHLYM.js.map → close-YCWQQPDS.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{comments-ETHABIY6.js.map → comments-4FGNTSNV.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{comments-MU2WMBUY.js.map → comments-7YS5MY5X.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{context-7ZEZV3BV.js.map → context-LHVKJSPJ.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{context-XDI4DKKT.js.map → context-ZQY54JNS.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{copy-JJ3KOQW2.js.map → copy-GYNQQPW2.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{copy-CWM6SBY6.js.map → copy-TLW7JTQT.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{create-J5Q2ELZT.js.map → create-VSKYSOCD.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{create-DFMNBKBS.js.map → create-XTMAPS7I.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{delete-2GZLQEUQ.js.map → delete-4W5JYCEG.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{delete-OOQS4KVD.js.map → delete-ANTOTI2I.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{deps-IF4IGL4R.js.map → deps-HPPE6MJN.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{deps-ZVGGCRR6.js.map → deps-ZQZN54EZ.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{docs-NFTBCQQC.js.map → docs-RPOVFMP3.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{docs-2TIFR62T.js.map → docs-XJNYBJGE.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{eval-2F6EH4XN.js.map → eval-DM6JBZTS.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{eval-PFKXQR3B.js.map → eval-RFBI5FGS.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{extension-GMVOIP4O.js.map → extension-B3YY4WY5.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{extension-3LRYX7SW.js.map → extension-TTSEFQTS.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{files-DF3HO6XK.js.map → files-5D65CHGE.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{files-T5ODMETM.js.map → files-GPIG77EN.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{focus-MY5ARIEK.js.map → focus-C3PEJV2C.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{focus-DLXKK4AH.js.map → focus-ZHN7WIGX.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{gc-MDGRR2SU.js.map → gc-D4JQ6OWN.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{gc-FULIVYR4.js.map → gc-VZIXDL32.js.map} +0 -0
  601. /package/dist/cli-bundle/chunks/{history-5XUSLAJA.js.map → history-DD7L7BNL.js.map} +0 -0
  602. /package/dist/cli-bundle/chunks/{history-X4OSES6K.js.map → history-IL7XCEX2.js.map} +0 -0
  603. /package/dist/cli-bundle/chunks/{history-redact-BVHWDXPR.js.map → history-redact-IX4YEWMY.js.map} +0 -0
  604. /package/dist/cli-bundle/chunks/{history-redact-45YW65BK.js.map → history-redact-VYCWQFK7.js.map} +0 -0
  605. /package/dist/cli-bundle/chunks/{init-KO7CGIRQ.js.map → init-F27NHENZ.js.map} +0 -0
  606. /package/dist/cli-bundle/chunks/{init-TRYJELH4.js.map → init-HHVQQP6C.js.map} +0 -0
  607. /package/dist/cli-bundle/chunks/{learnings-LHZT5BHW.js.map → learnings-HJVDQIGY.js.map} +0 -0
  608. /package/dist/cli-bundle/chunks/{learnings-3F7YLI45.js.map → learnings-XSFSUUWK.js.map} +0 -0
  609. /package/dist/cli-bundle/chunks/{list-Y6AU5BJS.js.map → list-HPMEKCAA.js.map} +0 -0
  610. /package/dist/cli-bundle/chunks/{list-ROT7JF62.js.map → list-VMPWTURB.js.map} +0 -0
  611. /package/dist/cli-bundle/chunks/{notes-FW6YFLND.js.map → notes-GDZIKGR6.js.map} +0 -0
  612. /package/dist/cli-bundle/chunks/{notes-EVJZ3VAB.js.map → notes-WDDBPC4D.js.map} +0 -0
  613. /package/dist/cli-bundle/chunks/{profile-CHAW6SEA.js.map → profile-CCOKZ2IQ.js.map} +0 -0
  614. /package/dist/cli-bundle/chunks/{profile-UPZGCDOG.js.map → profile-HUCENIEQ.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{restore-DKMCLPI5.js.map → restore-4CBWUMCX.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{restore-IRAKSWIW.js.map → restore-5UEAGG3W.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-3F4QUEDH.js.map → scheduling-shortcuts-6VFKNKCM.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-BNZLQK36.js.map → scheduling-shortcuts-ERHCVTEM.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{schema-OLT6LVKH.js.map → schema-TDGK6N3I.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{schema-XJXKJQF5.js.map → schema-UE5KKAUX.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{search-KP6H7COV.js.map → search-FP7MEU4S.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{search-CX5UMV4H.js.map → search-K4CFLQ5S.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{stats-QZUG6MX5.js.map → stats-NJJCALEZ.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{stats-7XW4OEMK.js.map → stats-XT6QRKQY.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{test-QNDXZQCW.js.map → test-UFSJ5YIO.js.map} +0 -0
  626. /package/dist/cli-bundle/chunks/{test-HU2BS7EY.js.map → test-YCDAUBWF.js.map} +0 -0
  627. /package/dist/cli-bundle/chunks/{update-UXDLTEOZ.js.map → update-MTCFES6X.js.map} +0 -0
  628. /package/dist/cli-bundle/chunks/{update-DJKWLBWJ.js.map → update-Y5WQVT5O.js.map} +0 -0
@@ -5,10 +5,10 @@ import {
5
5
  emitTelemetryErrorEvent,
6
6
  finishTelemetryCommand,
7
7
  startTelemetryCommand
8
- } from "./chunks/chunk-IDYCAK35.js";
8
+ } from "./chunks/chunk-H4GRLYJS.js";
9
9
  import {
10
10
  migrateItemFilesToFormat
11
- } from "./chunks/chunk-OUQ5JEFM.js";
11
+ } from "./chunks/chunk-S62UANU7.js";
12
12
  import {
13
13
  applyDefaultOutputFormat,
14
14
  clearResolvedGlobalOptions,
@@ -18,23 +18,31 @@ import {
18
18
  getGlobalOptions,
19
19
  invalidateSearchCachesForMutation,
20
20
  setResolvedGlobalOptions
21
- } from "./chunks/chunk-DORJSBGJ.js";
22
- import {
23
- PM_CORE_COMMAND_NAMES,
24
- resolveSubcommandFlagContractsForCommand
25
- } from "./chunks/chunk-6T5ZIWBS.js";
21
+ } from "./chunks/chunk-SYNKD3ZG.js";
26
22
  import {
27
23
  printError,
28
24
  printResult,
29
25
  writeStdout
30
- } from "./chunks/chunk-CHRNYKNI.js";
31
- import "./chunks/chunk-KYDYQMNW.js";
26
+ } from "./chunks/chunk-5PGBHRY3.js";
27
+ import "./chunks/chunk-7TH5NMVB.js";
28
+ import {
29
+ EXECUTABLE_COMMAND_ALIASES,
30
+ applyBootstrapPagerPolicy,
31
+ normalizeBootstrapInvocation,
32
+ normalizeExtensionNameForMatch,
33
+ parseBootstrapCommandName,
34
+ parseBootstrapGlobalOptions,
35
+ parseBootstrapHelpRequest,
36
+ parseBootstrapTypeValue,
37
+ stripGlobalBootstrapTokens
38
+ } from "./chunks/chunk-BVZZN2LH.js";
32
39
  import {
33
- normalizeExtensionNameForMatch
34
- } from "./chunks/chunk-F6VH3LFC.js";
35
- import "./chunks/chunk-LBH7UYKY.js";
36
- import "./chunks/chunk-ZFIEEDTJ.js";
37
- import "./chunks/chunk-MLHX6DN5.js";
40
+ PM_CORE_COMMAND_NAMES,
41
+ resolveSubcommandFlagContractsForCommand
42
+ } from "./chunks/chunk-XWGEMNBR.js";
43
+ import "./chunks/chunk-JXAUVO6X.js";
44
+ import "./chunks/chunk-IEEJQCZ4.js";
45
+ import "./chunks/chunk-AIAIXG7I.js";
38
46
  import {
39
47
  BUILTIN_ITEM_TYPE_VALUES,
40
48
  EXIT_CODE,
@@ -82,7 +90,7 @@ import {
82
90
  setActiveExtensionServices,
83
91
  toNonEmptyStringOrUndefined,
84
92
  writeSettings
85
- } from "./chunks/chunk-SNUK7H5J.js";
93
+ } from "./chunks/chunk-7NSPKJUS.js";
86
94
 
87
95
  // dist/cli/main.js
88
96
  import { Command } from "commander";
@@ -183,7 +191,7 @@ async function maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions) {
183
191
  !(function() {
184
192
  try {
185
193
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
186
- 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");
187
195
  } catch (e2) {
188
196
  }
189
197
  })();
@@ -348,6 +356,51 @@ function resolveTracesSampleRate() {
348
356
  }
349
357
  return parsed;
350
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
+ }
351
404
  async function ensureSentryInit() {
352
405
  if (_initDone)
353
406
  return _sentry;
@@ -392,47 +445,13 @@ async function ensureSentryInit() {
392
445
  if (event.transaction) {
393
446
  event.transaction = scrubString(event.transaction, "transaction");
394
447
  }
395
- if (event.exception?.values) {
396
- for (const exception of event.exception.values) {
397
- if (exception.value) {
398
- exception.value = scrubString(exception.value, "value");
399
- }
400
- if (exception.stacktrace?.frames) {
401
- for (const frame of exception.stacktrace.frames) {
402
- scrubStackFrame(frame);
403
- }
404
- }
405
- }
406
- }
407
- if (event.breadcrumbs) {
408
- for (const breadcrumb of event.breadcrumbs) {
409
- if (breadcrumb.message) {
410
- breadcrumb.message = scrubString(breadcrumb.message);
411
- }
412
- if (breadcrumb.data && typeof breadcrumb.data === "object") {
413
- breadcrumb.data = scrubEventData(breadcrumb.data);
414
- }
415
- }
416
- }
417
- if (event.extra && typeof event.extra === "object") {
418
- event.extra = scrubEventData(event.extra);
419
- }
420
- if (event.contexts) {
421
- for (const [ctxKey, ctx] of Object.entries(event.contexts)) {
422
- if (ctx && typeof ctx === "object") {
423
- event.contexts[ctxKey] = scrubEventData(ctx);
424
- }
425
- }
426
- }
427
- if (event.request && typeof event.request === "object") {
428
- event.request = scrubEventData(event.request);
429
- }
430
- if (event.user && typeof event.user === "object") {
431
- event.user = scrubEventData(event.user);
432
- }
433
- if (event.tags && typeof event.tags === "object") {
434
- event.tags = scrubEventData(event.tags);
435
- }
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");
436
455
  return event;
437
456
  },
438
457
  beforeSendTransaction(event) {
@@ -479,7 +498,7 @@ function getSentry() {
479
498
  !(function() {
480
499
  try {
481
500
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
482
- 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");
483
502
  } catch (e2) {
484
503
  }
485
504
  })();
@@ -493,6 +512,33 @@ function setSpanAttribute(span, key, value) {
493
512
  attributeTarget.setAttribute(key, value);
494
513
  }
495
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
+ }
496
542
  function sentrySetCommandContext(command, args, options, metadata) {
497
543
  const Sentry = getSentry();
498
544
  if (!Sentry)
@@ -544,33 +590,9 @@ function sentryFinishCommandSpan(ok, error, metadata) {
544
590
  const normalizedExitCode = typeof metadata?.exit_code === "number" ? String(metadata.exit_code) : void 0;
545
591
  const Sentry = getSentry();
546
592
  if (Sentry) {
547
- Sentry.setTag("pm.ok", normalizedOk);
548
- Sentry.setTag("pm.command_ok", normalizedOk);
549
- if (typeof metadata?.exit_code === "number") {
550
- Sentry.setTag("pm.exit_code", String(metadata.exit_code));
551
- Sentry.setTag("pm.command_exit_code", String(metadata.exit_code));
552
- }
553
- if (typeof metadata?.error_code === "string" && metadata.error_code.trim().length > 0) {
554
- Sentry.setTag("pm.error_code", metadata.error_code);
555
- }
556
- if (typeof metadata?.error_category === "string" && metadata.error_category.trim().length > 0) {
557
- Sentry.setTag("pm.error_category", metadata.error_category);
558
- }
559
- if (typeof metadata?.command_resolution === "string" && metadata.command_resolution.trim().length > 0) {
560
- Sentry.setTag("pm.command_resolution", metadata.command_resolution);
561
- }
562
- if (typeof metadata?.resolution_stage === "string" && metadata.resolution_stage.trim().length > 0) {
563
- Sentry.setTag("pm.resolution_stage", metadata.resolution_stage);
564
- }
593
+ setSentryCommandFinishTags(Sentry, normalizedOk, metadata);
565
594
  }
566
- setSpanAttribute(activeCommandSpan, "pm.ok", normalizedOk);
567
- setSpanAttribute(activeCommandSpan, "pm.command_ok", normalizedOk);
568
- setSpanAttribute(activeCommandSpan, "pm.exit_code", normalizedExitCode);
569
- setSpanAttribute(activeCommandSpan, "pm.command_exit_code", normalizedExitCode);
570
- setSpanAttribute(activeCommandSpan, "pm.error_code", metadata?.error_code);
571
- setSpanAttribute(activeCommandSpan, "pm.error_category", metadata?.error_category);
572
- setSpanAttribute(activeCommandSpan, "pm.command_resolution", metadata?.command_resolution);
573
- setSpanAttribute(activeCommandSpan, "pm.resolution_stage", metadata?.resolution_stage);
595
+ setCommandSpanFinishAttributes(activeCommandSpan, normalizedOk, normalizedExitCode, metadata);
574
596
  activeCommandSpan.setStatus(ok ? { code: 1 } : { code: 2, message: error ?? "command_failed" });
575
597
  activeCommandSpan.end();
576
598
  activeCommandSpan = void 0;
@@ -663,7 +685,7 @@ async function sentryFlush(timeoutMs = 3e3) {
663
685
  !(function() {
664
686
  try {
665
687
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
666
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "006c671c-d2fc-5908-8431-08bc7e418184");
688
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "23023585-f2dc-5ec7-a046-cc39355aaf59");
667
689
  } catch (e2) {
668
690
  }
669
691
  })();
@@ -841,29 +863,26 @@ function validateLooseCommandOptionsWithFlagDefinitions(options, definitions, co
841
863
  }
842
864
  }
843
865
  }
844
- function coerceLooseOptionValue(value, kind) {
845
- if (Array.isArray(value)) {
846
- return value.map((entry) => coerceLooseOptionValue(entry, kind));
866
+ function coerceLooseStringOptionValue(value) {
867
+ if (typeof value === "string") {
868
+ return value;
847
869
  }
848
- if (kind === "string") {
849
- if (typeof value === "string") {
850
- return value;
851
- }
852
- if (value === null || value === void 0) {
853
- return value;
854
- }
855
- return String(value);
870
+ if (value === null || value === void 0) {
871
+ return value;
856
872
  }
857
- if (kind === "number") {
858
- if (typeof value === "number") {
859
- return Number.isFinite(value) ? value : value;
860
- }
861
- if (typeof value === "string" && value.trim().length > 0) {
862
- const parsed = Number(value);
863
- return Number.isFinite(parsed) ? parsed : value;
864
- }
873
+ return String(value);
874
+ }
875
+ function coerceLooseNumberOptionValue(value) {
876
+ if (typeof value === "number") {
865
877
  return value;
866
878
  }
879
+ if (typeof value === "string" && value.trim().length > 0) {
880
+ const parsed = Number(value);
881
+ return Number.isFinite(parsed) ? parsed : value;
882
+ }
883
+ return value;
884
+ }
885
+ function coerceLooseBooleanOptionValue(value) {
867
886
  if (typeof value === "boolean") {
868
887
  return value;
869
888
  }
@@ -878,6 +897,17 @@ function coerceLooseOptionValue(value, kind) {
878
897
  }
879
898
  return value;
880
899
  }
900
+ var LOOSE_OPTION_VALUE_COERCERS = {
901
+ string: coerceLooseStringOptionValue,
902
+ number: coerceLooseNumberOptionValue,
903
+ boolean: coerceLooseBooleanOptionValue
904
+ };
905
+ function coerceLooseOptionValue(value, kind) {
906
+ if (Array.isArray(value)) {
907
+ return value.map((entry) => coerceLooseOptionValue(entry, kind));
908
+ }
909
+ return LOOSE_OPTION_VALUE_COERCERS[kind](value);
910
+ }
881
911
  function splitCommaListValue(value, kind) {
882
912
  const entries = flattenFlagListValue(value);
883
913
  return kind ? entries.map((entry) => coerceLooseOptionValue(entry, kind)) : entries;
@@ -1893,7 +1923,7 @@ function renderPmCommand(argv) {
1893
1923
  !(function() {
1894
1924
  try {
1895
1925
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
1896
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4fdf7d5d-e4c8-5f0c-a969-2ed905b3a5dc");
1926
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "594fd898-5ce1-5e77-8731-5bcd90c16f9a");
1897
1927
  } catch (e2) {
1898
1928
  }
1899
1929
  })();
@@ -1943,67 +1973,66 @@ function renderList(title, entries) {
1943
1973
  }
1944
1974
  return [title, ...entries.map((entry) => ` - ${entry}`)];
1945
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
+ }
1946
2005
  function normalizeRecoveryPayload(payload) {
1947
2006
  if (!payload || typeof payload !== "object") {
1948
2007
  return void 0;
1949
2008
  }
1950
- const normalizeStringArray = (values) => {
1951
- if (!Array.isArray(values)) {
1952
- return void 0;
1953
- }
1954
- const normalized2 = values.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1955
- return normalized2.length > 0 ? normalized2 : void 0;
1956
- };
1957
2009
  const normalized = {};
1958
2010
  if (payload.recovery_mode === "compact") {
1959
2011
  normalized.recovery_mode = "compact";
1960
2012
  }
1961
- if (typeof payload.attempted_command === "string" && payload.attempted_command.trim().length > 0) {
1962
- normalized.attempted_command = payload.attempted_command.trim();
1963
- }
1964
- if (Array.isArray(payload.normalized_args)) {
1965
- const args = payload.normalized_args.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1966
- if (args.length > 0) {
1967
- normalized.normalized_args = args;
1968
- }
1969
- }
1970
- if (Array.isArray(payload.provided_fields)) {
1971
- const fields = payload.provided_fields.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1972
- if (fields.length > 0) {
1973
- normalized.provided_fields = fields;
1974
- }
1975
- }
1976
- if (Array.isArray(payload.missing)) {
1977
- const missing = payload.missing.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1978
- if (missing.length > 0) {
1979
- normalized.missing = missing;
1980
- }
1981
- }
1982
- const missingRequiredFields = normalizeStringArray(payload.missing_required_fields);
1983
- if (missingRequiredFields) {
1984
- normalized.missing_required_fields = missingRequiredFields;
1985
- }
1986
- const suggestedFlags = normalizeStringArray(payload.suggested_flags);
1987
- if (suggestedFlags) {
1988
- normalized.suggested_flags = suggestedFlags;
1989
- }
1990
- if (typeof payload.suggested_retry === "string" && payload.suggested_retry.trim().length > 0) {
1991
- normalized.suggested_retry = payload.suggested_retry.trim();
1992
- }
1993
- if (Array.isArray(payload.fallback_candidates)) {
1994
- const fallbackCandidates = payload.fallback_candidates.map((entry) => ({
1995
- source: typeof entry?.source === "string" ? entry.source.trim() : "",
1996
- command: typeof entry?.command === "string" ? entry.command.trim() : "",
1997
- reason: typeof entry?.reason === "string" ? entry.reason.trim() : ""
1998
- })).filter((entry) => entry.source.length > 0 && entry.command.length > 0 && entry.reason.length > 0);
1999
- if (fallbackCandidates.length > 0) {
2000
- normalized.fallback_candidates = fallbackCandidates;
2001
- }
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}`);
2002
2030
  }
2003
- if (typeof payload.next_best_command === "string" && payload.next_best_command.trim().length > 0) {
2004
- 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)}`);
2005
2035
  }
2006
- return Object.keys(normalized).length > 0 ? normalized : void 0;
2007
2036
  }
2008
2037
  function renderRecoveryBundle(recovery) {
2009
2038
  const normalized = normalizeRecoveryPayload(recovery);
@@ -2011,30 +2040,14 @@ function renderRecoveryBundle(recovery) {
2011
2040
  return [];
2012
2041
  }
2013
2042
  const lines = ["Recovery bundle:"];
2014
- if (normalized.attempted_command) {
2015
- lines.push(` attempted_command: ${normalized.attempted_command}`);
2016
- }
2017
- if (normalized.normalized_args && normalized.normalized_args.length > 0) {
2018
- lines.push(` normalized_args: ${normalized.normalized_args.join(" ")}`);
2019
- }
2020
- if (normalized.provided_fields && normalized.provided_fields.length > 0) {
2021
- lines.push(` provided_fields: ${normalized.provided_fields.join(", ")}`);
2022
- }
2023
- if (normalized.missing && normalized.missing.length > 0) {
2024
- lines.push(` missing: ${normalized.missing.join(", ")}`);
2025
- }
2026
- if (normalized.missing_required_fields && normalized.missing_required_fields.length > 0) {
2027
- lines.push(` missing_required_fields: ${normalized.missing_required_fields.join(", ")}`);
2028
- }
2029
- if (normalized.suggested_flags && normalized.suggested_flags.length > 0) {
2030
- lines.push(` suggested_flags: ${normalized.suggested_flags.join(", ")}`);
2031
- }
2032
- if (normalized.suggested_retry) {
2033
- lines.push(` suggested_retry: ${normalized.suggested_retry}`);
2034
- }
2035
- if (normalized.next_best_command) {
2036
- lines.push(` next_best_command: ${normalized.next_best_command}`);
2037
- }
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);
2038
2051
  if (normalized.fallback_candidates && normalized.fallback_candidates.length > 0) {
2039
2052
  lines.push(" fallback_candidates:");
2040
2053
  for (const candidate of normalized.fallback_candidates) {
@@ -2209,133 +2222,158 @@ function applyPmCliErrorContext(guidance, rawMessage, context) {
2209
2222
  recovery
2210
2223
  };
2211
2224
  }
2212
- function buildPmCliErrorGuidance(rawMessage, context) {
2213
- const message = normalizeMessage(rawMessage);
2225
+ function buildTrackerNotInitializedGuidance(rawMessage, message, context) {
2214
2226
  const trackerNotInitialized = message.match(/^Tracker is not initialized at (.+)\. Run pm init first\.$/);
2215
- if (trackerNotInitialized) {
2216
- return applyPmCliErrorContext(makeGuidanceMessage({
2217
- code: "tracker_not_initialized",
2218
- title: "Tracker is not initialized",
2219
- happened: `pm data path does not contain initialized tracker metadata (${trackerNotInitialized[1]}).`,
2220
- required: "Initialize tracker storage before running this command.",
2221
- why: "Most commands require settings and tracker directories created by pm init.",
2222
- examples: ["pm init", "pm init acme"],
2223
- nextSteps: ['Run "pm init", then rerun your original command.']
2224
- }), rawMessage, context);
2227
+ if (!trackerNotInitialized) {
2228
+ return null;
2225
2229
  }
2230
+ return applyPmCliErrorContext(makeGuidanceMessage({
2231
+ code: "tracker_not_initialized",
2232
+ title: "Tracker is not initialized",
2233
+ happened: `pm data path does not contain initialized tracker metadata (${trackerNotInitialized[1]}).`,
2234
+ required: "Initialize tracker storage before running this command.",
2235
+ why: "Most commands require settings and tracker directories created by pm init.",
2236
+ examples: ["pm init", "pm init acme"],
2237
+ nextSteps: ['Run "pm init", then rerun your original command.']
2238
+ }), rawMessage, context);
2239
+ }
2240
+ function buildItemNotFoundGuidance(rawMessage, message, context) {
2226
2241
  const itemNotFound = message.match(/^Item ([^ ]+) not found$/);
2227
- if (itemNotFound) {
2228
- const badId = itemNotFound[1];
2229
- const isPlaceholder = /^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(badId);
2230
- 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.`;
2231
- const nextSteps = isPlaceholder ? [
2232
- "Check that the variable holding the item ID is defined before passing it to pm.",
2233
- 'Use "pm list-open --limit 20" to find valid IDs.'
2234
- ] : ["Confirm the active --path/PM_PATH scope, then retry with a valid id."];
2235
- return applyPmCliErrorContext(makeGuidanceMessage({
2236
- code: "item_not_found",
2237
- title: "Item ID not found",
2238
- happened,
2239
- required: "Use an existing item ID from current tracker data.",
2240
- why: "Mutation and read commands operate only on known IDs.",
2241
- examples: ["pm list-open --limit 20", 'pm search "<keyword>" --limit 10'],
2242
- nextSteps
2243
- }), rawMessage, context);
2244
- }
2245
- if (message.includes("is assigned to") && message.includes("Use --force to override")) {
2246
- return applyPmCliErrorContext(makeGuidanceMessage({
2247
- code: "ownership_conflict",
2248
- title: "Ownership conflict",
2249
- happened: message,
2250
- required: "Run as assigned owner, use audit flags for safe non-owner updates, or use --force only for approved override scenarios.",
2251
- why: "Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",
2252
- examples: [
2253
- 'pm update pm-a1b2 --allow-audit-update --description "..." --author "audit-agent"',
2254
- 'pm update pm-a1b2 --allow-audit-dep-update --dep "..." --author "audit-agent"',
2255
- 'pm comments pm-a1b2 "..." --allow-audit-comment --author "audit-agent"',
2256
- 'pm claim pm-a1b2 --author "codex-agent"',
2257
- 'pm release pm-a1b2 --allow-audit-release --author "reviewer"',
2258
- "pm update pm-a1b2 --status in_progress --force"
2259
- ],
2260
- nextSteps: [
2261
- "Use --allow-audit-update for metadata-only non-owner updates (excludes lifecycle/ownership fields).",
2262
- "Use --allow-audit-dep-update for dependency-only non-owner additions.",
2263
- "Use --allow-audit-comment on comments/notes/learnings for append-only audit entries.",
2264
- "Use --force for PM audits and systematic metadata updates performed by leads/maintainers.",
2265
- "Use --force when correcting known stale metadata after coordinating ownership changes.",
2266
- 'For non-terminal reassignment, prefer "pm claim <ID> --author <you>" before running other mutations.',
2267
- 'For assignee handoff release workflows, prefer "pm release <ID> --allow-audit-release --author <you>" before using --force.'
2268
- ]
2269
- }), rawMessage, context);
2242
+ if (!itemNotFound) {
2243
+ return null;
2270
2244
  }
2271
- if (message.includes("is locked")) {
2272
- return applyPmCliErrorContext(makeGuidanceMessage({
2273
- code: "lock_conflict",
2274
- title: "Lock conflict",
2275
- happened: message,
2276
- required: "Wait for lock release, or use --force where supported if lock is stale and safe to override.",
2277
- why: "Locking protects item files from concurrent write races.",
2278
- examples: ['pm update pm-a1b2 --status in_progress --force --author "codex-agent"']
2279
- }), rawMessage, context);
2245
+ const badId = itemNotFound[1];
2246
+ const isPlaceholder = /^(undefined|null|<.*>|\[.*\]|{.*}|)$/.test(badId);
2247
+ const happened = isPlaceholder ? `The item ID "${badId}" looks like a placeholder or unresolved variable. Ensure the ID argument is resolved before calling pm.` : `No item with id "${badId}" exists in the active tracker scope.`;
2248
+ const nextSteps = isPlaceholder ? [
2249
+ "Check that the variable holding the item ID is defined before passing it to pm.",
2250
+ 'Use "pm list-open --limit 20" to find valid IDs.'
2251
+ ] : ["Confirm the active --path/PM_PATH scope, then retry with a valid id."];
2252
+ return applyPmCliErrorContext(makeGuidanceMessage({
2253
+ code: "item_not_found",
2254
+ title: "Item ID not found",
2255
+ happened,
2256
+ required: "Use an existing item ID from current tracker data.",
2257
+ why: "Mutation and read commands operate only on known IDs.",
2258
+ examples: ["pm list-open --limit 20", 'pm search "<keyword>" --limit 10'],
2259
+ nextSteps
2260
+ }), rawMessage, context);
2261
+ }
2262
+ function buildOwnershipConflictGuidance(rawMessage, message, context) {
2263
+ if (!message.includes("is assigned to") || !message.includes("Use --force to override")) {
2264
+ return null;
2265
+ }
2266
+ return applyPmCliErrorContext(makeGuidanceMessage({
2267
+ code: "ownership_conflict",
2268
+ title: "Ownership conflict",
2269
+ happened: message,
2270
+ required: "Run as assigned owner, use audit flags for safe non-owner updates, or use --force only for approved override scenarios.",
2271
+ why: "Ownership checks prevent accidental concurrent mutations on claimed items and protect against conflicting writes.",
2272
+ examples: [
2273
+ 'pm update pm-a1b2 --allow-audit-update --description "..." --author "audit-agent"',
2274
+ 'pm update pm-a1b2 --allow-audit-dep-update --dep "..." --author "audit-agent"',
2275
+ 'pm comments pm-a1b2 "..." --allow-audit-comment --author "audit-agent"',
2276
+ 'pm claim pm-a1b2 --author "codex-agent"',
2277
+ 'pm release pm-a1b2 --allow-audit-release --author "reviewer"',
2278
+ "pm update pm-a1b2 --status in_progress --force"
2279
+ ],
2280
+ nextSteps: [
2281
+ "Use --allow-audit-update for metadata-only non-owner updates (excludes lifecycle/ownership fields).",
2282
+ "Use --allow-audit-dep-update for dependency-only non-owner additions.",
2283
+ "Use --allow-audit-comment on comments/notes/learnings for append-only audit entries.",
2284
+ "Use --force for PM audits and systematic metadata updates performed by leads/maintainers.",
2285
+ "Use --force when correcting known stale metadata after coordinating ownership changes.",
2286
+ 'For non-terminal reassignment, prefer "pm claim <ID> --author <you>" before running other mutations.',
2287
+ 'For assignee handoff release workflows, prefer "pm release <ID> --allow-audit-release --author <you>" before using --force.'
2288
+ ]
2289
+ }), rawMessage, context);
2290
+ }
2291
+ function buildLockConflictGuidance(rawMessage, message, context) {
2292
+ if (!message.includes("is locked")) {
2293
+ return null;
2280
2294
  }
2295
+ return applyPmCliErrorContext(makeGuidanceMessage({
2296
+ code: "lock_conflict",
2297
+ title: "Lock conflict",
2298
+ happened: message,
2299
+ required: "Wait for lock release, or use --force where supported if lock is stale and safe to override.",
2300
+ why: "Locking protects item files from concurrent write races.",
2301
+ examples: ['pm update pm-a1b2 --status in_progress --force --author "codex-agent"']
2302
+ }), rawMessage, context);
2303
+ }
2304
+ function buildPmMissingRequiredOptionGuidance(rawMessage, message, context) {
2281
2305
  const missingRequiredOption = message.match(/^Missing required option /);
2282
2306
  const missingRequiredOptions = message.match(/^Missing required options /);
2283
- if (missingRequiredOption || missingRequiredOptions) {
2284
- const plural = Boolean(missingRequiredOptions);
2285
- const missingOptionFlag = !plural ? message.replace(/^Missing required option\s+/, "").trim() : null;
2286
- const missingOptionLabel = missingOptionFlag ?? "";
2287
- const missingOptionRequired = missingOptionFlag ? `Pass ${missingOptionFlag} with a valid value before running the command.` : "Provide the required option for this command invocation.";
2288
- return applyPmCliErrorContext(makeGuidanceMessage({
2289
- code: "missing_required_option",
2290
- title: plural ? "Missing required options" : `Missing required option ${missingOptionLabel}`,
2291
- happened: message,
2292
- required: plural ? "Provide every required option for this command invocation." : missingOptionRequired,
2293
- why: "Required options define command intent and enforce deterministic write contracts.",
2294
- examples: [
2295
- 'pm create --title "Task title" --description "Task details" --type Task --create-mode progressive',
2296
- '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"'
2297
- ],
2298
- nextSteps: [
2299
- 'Run "pm <command> --help" to view required and recommended flags.',
2300
- "For staged triage without placeholder linkage values, use --create-mode progressive."
2301
- ]
2302
- }), rawMessage, context);
2303
- }
2304
- if (message.startsWith("No update flags provided")) {
2305
- return applyPmCliErrorContext(makeGuidanceMessage({
2306
- code: "no_update_fields",
2307
- title: "No update fields supplied",
2308
- happened: "The update command was called without any field-changing flags.",
2309
- 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.",
2310
- why: "pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",
2311
- examples: [
2312
- 'pm update pm-a1b2 --status in_progress --message "Start implementation"',
2313
- 'pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"',
2314
- 'pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'
2315
- ],
2316
- nextSteps: [
2317
- "Choose the item field you intend to change, then pair that change with --message for history context.",
2318
- "Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."
2319
- ]
2320
- }), rawMessage, context);
2321
- }
2322
- if (message.startsWith("Invalid ") || message.includes(" must be ") || message.includes(" requires ")) {
2323
- const recovery = normalizeRecoveryPayload(context?.recovery);
2324
- const commandName = inferCommandNameFromRecovery(recovery);
2325
- const helpExample = commandName ? `pm ${commandName} --help` : "pm <command> --help";
2326
- const allowedValues = inferAllowedValuesFromMessage(message);
2327
- const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
2328
- const examples = retryExample ? [retryExample, helpExample] : [helpExample, "pm contracts --command <command> --flags-only --json"];
2329
- 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."];
2330
- return applyPmCliErrorContext(makeGuidanceMessage({
2331
- code: "invalid_argument_value",
2332
- title: "Invalid argument value",
2333
- happened: message,
2334
- required: "Use values that match documented command constraints.",
2335
- why: "Validation protects data consistency and deterministic behavior across commands.",
2336
- examples,
2337
- nextSteps
2338
- }), rawMessage, context);
2307
+ if (!missingRequiredOption && !missingRequiredOptions) {
2308
+ return null;
2309
+ }
2310
+ const plural = Boolean(missingRequiredOptions);
2311
+ const missingOptionFlag = !plural ? message.replace(/^Missing required option\s+/, "").trim() : null;
2312
+ const missingOptionLabel = missingOptionFlag ?? "";
2313
+ const missingOptionRequired = missingOptionFlag ? `Pass ${missingOptionFlag} with a valid value before running the command.` : "Provide the required option for this command invocation.";
2314
+ return applyPmCliErrorContext(makeGuidanceMessage({
2315
+ code: "missing_required_option",
2316
+ title: plural ? "Missing required options" : `Missing required option ${missingOptionLabel}`,
2317
+ happened: message,
2318
+ required: plural ? "Provide every required option for this command invocation." : missingOptionRequired,
2319
+ why: "Required options define command intent and enforce deterministic write contracts.",
2320
+ examples: [
2321
+ 'pm create --title "Task title" --description "Task details" --type Task --create-mode progressive',
2322
+ 'pm create --title "Task title" --description "Task details" --type Task --status open --priority 1 --message "Create task" --dep "id=pm-epic01,kind=parent,author=codex-agent,created_at=now" --comment "author=codex-agent,created_at=now,text=Why this task exists." --note "author=codex-agent,created_at=now,text=Initial implementation note." --learning "author=codex-agent,created_at=now,text=Durable lesson placeholder." --file "path=src/example.ts,scope=project" --test "command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240" --doc "path=README.md,scope=project"'
2323
+ ],
2324
+ nextSteps: [
2325
+ 'Run "pm <command> --help" to view required and recommended flags.',
2326
+ "For staged triage without placeholder linkage values, use --create-mode progressive."
2327
+ ]
2328
+ }), rawMessage, context);
2329
+ }
2330
+ function buildNoUpdateFieldsGuidance(rawMessage, message, context) {
2331
+ if (!message.startsWith("No update flags provided")) {
2332
+ return null;
2333
+ }
2334
+ return applyPmCliErrorContext(makeGuidanceMessage({
2335
+ code: "no_update_fields",
2336
+ title: "No update fields supplied",
2337
+ happened: "The update command was called without any field-changing flags.",
2338
+ required: "Provide at least one field-changing flag such as --status, --priority, --title, --tags, --description, or --body. Use --message only to label a real mutation.",
2339
+ why: "pm update mutates existing item fields; no-op invocations are rejected to avoid ambiguous history.",
2340
+ examples: [
2341
+ 'pm update pm-a1b2 --status in_progress --message "Start implementation"',
2342
+ 'pm update pm-a1b2 --description "Clarified implementation scope" --message "Clarify task intent"',
2343
+ 'pm append pm-a1b2 --body "Detailed progress notes" --message "Append progress notes"'
2344
+ ],
2345
+ nextSteps: [
2346
+ "Choose the item field you intend to change, then pair that change with --message for history context.",
2347
+ "Use pm comments, pm notes, pm learnings, or pm append when you only need to add narrative context."
2348
+ ]
2349
+ }), rawMessage, context);
2350
+ }
2351
+ function buildInvalidArgumentGuidance(rawMessage, message, context) {
2352
+ if (!message.startsWith("Invalid ") && !message.includes(" must be ") && !message.includes(" requires ")) {
2353
+ return null;
2354
+ }
2355
+ const recovery = normalizeRecoveryPayload(context?.recovery);
2356
+ const commandName = inferCommandNameFromRecovery(recovery);
2357
+ const helpExample = commandName ? `pm ${commandName} --help` : "pm <command> --help";
2358
+ const allowedValues = inferAllowedValuesFromMessage(message);
2359
+ const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
2360
+ const examples = retryExample ? [retryExample, helpExample] : [helpExample, "pm contracts --command <command> --flags-only --json"];
2361
+ const nextSteps = allowedValues.length > 0 ? [`Allowed values: ${allowedValues.join("|")}`, `Run "${helpExample}" to confirm command-specific constraints.`] : ["Check allowed values in command help, then rerun with corrected input."];
2362
+ return applyPmCliErrorContext(makeGuidanceMessage({
2363
+ code: "invalid_argument_value",
2364
+ title: "Invalid argument value",
2365
+ happened: message,
2366
+ required: "Use values that match documented command constraints.",
2367
+ why: "Validation protects data consistency and deterministic behavior across commands.",
2368
+ examples,
2369
+ nextSteps
2370
+ }), rawMessage, context);
2371
+ }
2372
+ function buildPmCliErrorGuidance(rawMessage, context) {
2373
+ const message = normalizeMessage(rawMessage);
2374
+ const guidance = buildTrackerNotInitializedGuidance(rawMessage, message, context) ?? buildItemNotFoundGuidance(rawMessage, message, context) ?? buildOwnershipConflictGuidance(rawMessage, message, context) ?? buildLockConflictGuidance(rawMessage, message, context) ?? buildPmMissingRequiredOptionGuidance(rawMessage, message, context) ?? buildNoUpdateFieldsGuidance(rawMessage, message, context) ?? buildInvalidArgumentGuidance(rawMessage, message, context);
2375
+ if (guidance) {
2376
+ return guidance;
2339
2377
  }
2340
2378
  return applyPmCliErrorContext(makeGuidanceMessage({
2341
2379
  code: "command_failed",
@@ -2455,147 +2493,173 @@ function buildLinkedTestQuotedRetryCommand(argv) {
2455
2493
  }
2456
2494
  return void 0;
2457
2495
  }
2458
- function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context) {
2459
- const message = normalizeMessage(rawMessage);
2496
+ function buildMissingRequiredOptionGuidance(message, commandName, allowedTypes, context) {
2460
2497
  const requiredOption = message.match(/required option '([^']+)' not specified/);
2461
- if (requiredOption) {
2462
- const optionFlag = normalizeRequiredOptionLabel(requiredOption[1]);
2463
- const isType = optionFlag.startsWith("--type");
2464
- const retryCommand = context?.suggestedRetryCommand;
2465
- const providedFlags = normalizeOptionFlags(context?.providedOptionFlags);
2466
- const missing = [optionFlag];
2467
- const examples = commandExampleForRequiredOption(commandName, optionFlag, allowedTypes);
2468
- const examplesWithRetry = retryCommand ? appendIfMissing(examples, retryCommand) : examples;
2469
- 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.`];
2470
- const nextStepsWithRetry = retryCommand ? appendIfMissing(nextStepsBase, `Replay with preserved arguments: ${retryCommand}`) : nextStepsBase;
2471
- const nextSteps = providedFlags && providedFlags.length > 0 ? appendIfMissing(nextStepsWithRetry, `Already provided options: ${providedFlags.join(", ")}`) : nextStepsWithRetry;
2472
- return makeGuidanceMessage({
2473
- code: "missing_required_option",
2474
- title: `Missing required option ${optionFlag}`,
2475
- happened: `Commander rejected the command because ${optionFlag} was not provided.`,
2476
- required: `Pass ${optionFlag} with a valid value before running the command.`,
2477
- why: isType ? "--type selects item contract and policy routing, including required/disabled option rules." : "Required flags define mandatory command intent and prevent ambiguous execution.",
2478
- examples: examplesWithRetry,
2479
- nextSteps,
2480
- recovery: buildCommanderRecoveryPayload(context, { missing })
2481
- });
2498
+ if (!requiredOption) {
2499
+ return null;
2482
2500
  }
2501
+ const optionFlag = normalizeRequiredOptionLabel(requiredOption[1]);
2502
+ const isType = optionFlag.startsWith("--type");
2503
+ const retryCommand = context?.suggestedRetryCommand;
2504
+ const providedFlags = normalizeOptionFlags(context?.providedOptionFlags);
2505
+ const missing = [optionFlag];
2506
+ const examples = commandExampleForRequiredOption(commandName, optionFlag, allowedTypes);
2507
+ const examplesWithRetry = retryCommand ? appendIfMissing(examples, retryCommand) : examples;
2508
+ const nextStepsBase = isType ? [`Allowed type values: ${allowedTypes}`, `Run "pm ${commandName ?? "create"} --help --type <value>" for type-aware policy details.`] : [`Run "pm ${commandName ?? "<command>"} --help" for required option guidance.`];
2509
+ const nextStepsWithRetry = retryCommand ? appendIfMissing(nextStepsBase, `Replay with preserved arguments: ${retryCommand}`) : nextStepsBase;
2510
+ const nextSteps = providedFlags && providedFlags.length > 0 ? appendIfMissing(nextStepsWithRetry, `Already provided options: ${providedFlags.join(", ")}`) : nextStepsWithRetry;
2511
+ return makeGuidanceMessage({
2512
+ code: "missing_required_option",
2513
+ title: `Missing required option ${optionFlag}`,
2514
+ happened: `Commander rejected the command because ${optionFlag} was not provided.`,
2515
+ required: `Pass ${optionFlag} with a valid value before running the command.`,
2516
+ why: isType ? "--type selects item contract and policy routing, including required/disabled option rules." : "Required flags define mandatory command intent and prevent ambiguous execution.",
2517
+ examples: examplesWithRetry,
2518
+ nextSteps,
2519
+ recovery: buildCommanderRecoveryPayload(context, { missing })
2520
+ });
2521
+ }
2522
+ function buildMissingRequiredArgumentGuidance(message, commandName, context) {
2483
2523
  const missingArgument = message.match(/missing required argument '([^']+)'/);
2484
- if (missingArgument) {
2485
- const argumentName = missingArgument[1];
2486
- return makeGuidanceMessage({
2487
- code: "missing_required_argument",
2488
- title: `Missing required argument ${argumentName}`,
2489
- happened: `Command invocation omitted positional argument ${argumentName}.`,
2490
- required: `Provide ${argumentName} in the expected command position.`,
2491
- why: "Positional arguments identify the target entity or action context for the command.",
2492
- examples: [`pm ${commandName ?? "<command>"} --help`],
2493
- recovery: buildCommanderRecoveryPayload(context, { missing: [argumentName] })
2494
- });
2524
+ if (!missingArgument) {
2525
+ return null;
2495
2526
  }
2527
+ const argumentName = missingArgument[1];
2528
+ return makeGuidanceMessage({
2529
+ code: "missing_required_argument",
2530
+ title: `Missing required argument ${argumentName}`,
2531
+ happened: `Command invocation omitted positional argument ${argumentName}.`,
2532
+ required: `Provide ${argumentName} in the expected command position.`,
2533
+ why: "Positional arguments identify the target entity or action context for the command.",
2534
+ examples: [`pm ${commandName ?? "<command>"} --help`],
2535
+ recovery: buildCommanderRecoveryPayload(context, { missing: [argumentName] })
2536
+ });
2537
+ }
2538
+ function buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions) {
2539
+ return makeGuidanceMessage({
2540
+ code: "unsupported_update_option",
2541
+ title: `Unsupported option ${optionName} for update`,
2542
+ happened: `pm update does not accept ${optionName} for linked artifact mutations.`,
2543
+ required: "Use dedicated linked-artifact commands instead of pm update for files/docs changes.",
2544
+ why: "pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",
2545
+ examples: [
2546
+ 'pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"',
2547
+ 'pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'
2548
+ ],
2549
+ nextSteps: ['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],
2550
+ recovery: buildCommanderRecoveryPayload(context, {
2551
+ suggested_flags: suggestions
2552
+ })
2553
+ });
2554
+ }
2555
+ function buildUnknownOptionGuidance(message, commandName, context) {
2496
2556
  const unknownOption = message.match(/unknown option '([^']+)'/);
2497
- if (unknownOption) {
2498
- const optionName = unknownOption[1];
2499
- const suggestions = normalizeOptionFlags(context?.unknownOptionSuggestions);
2500
- const retryCommand = context?.suggestedRetryCommand;
2501
- if (commandName === "update" && (optionName === "--file" || optionName === "--doc")) {
2502
- return makeGuidanceMessage({
2503
- code: "unsupported_update_option",
2504
- title: `Unsupported option ${optionName} for update`,
2505
- happened: `pm update does not accept ${optionName} for linked artifact mutations.`,
2506
- required: "Use dedicated linked-artifact commands instead of pm update for files/docs changes.",
2507
- why: "pm update manages scalar item metadata, while linked files/docs are managed by pm files and pm docs.",
2508
- examples: [
2509
- 'pm files pm-a1b2 --add "path=src/cli/main.ts,scope=project,note=implementation surface"',
2510
- 'pm docs pm-a1b2 --add "path=README.md,scope=project,note=user-facing contract"'
2511
- ],
2512
- nextSteps: ['Run "pm files --help" and "pm docs --help" for add/remove payload formats.'],
2513
- recovery: buildCommanderRecoveryPayload(context, {
2514
- missing: suggestions
2515
- })
2516
- });
2517
- }
2518
- const otherCommands = normalizeContextList(context?.unknownOptionOtherCommands);
2519
- const nextSteps = [
2520
- "Run command help to confirm the exact option contracts for this command path.",
2521
- ...suggestions && suggestions.length > 0 ? [`Nearest supported options: ${suggestions.join(", ")}`] : [],
2522
- ...otherCommands && otherCommands.length > 0 ? [`${optionName} is a valid option on: ${otherCommands.join(", ")}. If you meant one of those, run that command instead.`] : [],
2523
- ...retryCommand ? [`Replay with suggested correction: ${retryCommand}`] : []
2524
- ];
2525
- const examples = [
2526
- ...retryCommand ? [retryCommand] : [],
2527
- `pm ${commandName ?? "<command>"} --help`
2528
- ];
2529
- return makeGuidanceMessage({
2530
- code: "unknown_option",
2531
- title: `Unknown option ${optionName}`,
2532
- happened: `Commander does not recognize option ${optionName} for this command path.`,
2533
- required: "Use supported options only, or move option to the correct subcommand.",
2534
- why: "Option contracts are command-specific and intentionally validated.",
2535
- examples,
2536
- nextSteps,
2537
- recovery: buildCommanderRecoveryPayload(context, {
2538
- missing: suggestions
2539
- })
2540
- });
2557
+ if (!unknownOption) {
2558
+ return null;
2541
2559
  }
2560
+ const optionName = unknownOption[1];
2561
+ const suggestions = normalizeOptionFlags(context?.unknownOptionSuggestions);
2562
+ const retryCommand = context?.suggestedRetryCommand;
2563
+ if (commandName === "update" && (optionName === "--file" || optionName === "--doc")) {
2564
+ return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
2565
+ }
2566
+ const otherCommands = normalizeContextList(context?.unknownOptionOtherCommands);
2567
+ const nextSteps = [
2568
+ "Run command help to confirm the exact option contracts for this command path.",
2569
+ ...suggestions && suggestions.length > 0 ? [`Nearest supported options: ${suggestions.join(", ")}`] : [],
2570
+ ...otherCommands && otherCommands.length > 0 ? [`${optionName} is a valid option on: ${otherCommands.join(", ")}. If you meant one of those, run that command instead.`] : [],
2571
+ ...retryCommand ? [`Replay with suggested correction: ${retryCommand}`] : []
2572
+ ];
2573
+ const examples = [
2574
+ ...retryCommand ? [retryCommand] : [],
2575
+ `pm ${commandName ?? "<command>"} --help`
2576
+ ];
2577
+ return makeGuidanceMessage({
2578
+ code: "unknown_option",
2579
+ title: `Unknown option ${optionName}`,
2580
+ happened: `Commander does not recognize option ${optionName} for this command path.`,
2581
+ required: "Use supported options only, or move option to the correct subcommand.",
2582
+ why: "Option contracts are command-specific and intentionally validated.",
2583
+ examples,
2584
+ nextSteps,
2585
+ recovery: buildCommanderRecoveryPayload(context, {
2586
+ suggested_flags: suggestions
2587
+ })
2588
+ });
2589
+ }
2590
+ function buildKnownPackageCommandGuidance(commandToken, packageHint, baseExamples, baseNextSteps, context) {
2591
+ const installStep = `"${commandToken}" is provided by the ${packageHint.packageName} package. Install it with: ${packageHint.installCommand}`;
2592
+ return makeGuidanceMessage({
2593
+ code: "unknown_command",
2594
+ title: `Unknown command ${commandToken}`,
2595
+ happened: `pm does not expose command path "${commandToken}" in current runtime configuration. It is shipped by the optional ${packageHint.packageName} package.`,
2596
+ required: `Install the ${packageHint.packageName} package, or use a valid command name or subcommand path.`,
2597
+ why: "Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",
2598
+ examples: dedupeStrings([packageHint.installCommand, ...baseExamples]),
2599
+ nextSteps: dedupeStrings([installStep, ...baseNextSteps]),
2600
+ recovery: buildCommanderRecoveryPayload(context)
2601
+ });
2602
+ }
2603
+ function buildUnknownCommandGuidance(message, context) {
2542
2604
  const unknownCommand = message.match(/unknown command '([^']+)'/);
2543
- if (unknownCommand) {
2544
- const commandToken = unknownCommand[1];
2545
- const runtimeExamples = normalizeContextList(context?.unknownCommandExamples);
2546
- const runtimeNextSteps = normalizeContextList(context?.unknownCommandNextSteps);
2547
- const packageHint = resolveKnownPackageCommandHint(commandToken);
2548
- const baseExamples = runtimeExamples ?? ["pm --help"];
2549
- const baseNextSteps = runtimeNextSteps ?? ["Verify spelling and active extensions, then rerun."];
2550
- if (packageHint) {
2551
- const installStep = `"${commandToken}" is provided by the ${packageHint.packageName} package. Install it with: ${packageHint.installCommand}`;
2552
- return makeGuidanceMessage({
2553
- code: "unknown_command",
2554
- title: `Unknown command ${commandToken}`,
2555
- happened: `pm does not expose command path "${commandToken}" in current runtime configuration. It is shipped by the optional ${packageHint.packageName} package.`,
2556
- required: `Install the ${packageHint.packageName} package, or use a valid command name or subcommand path.`,
2557
- why: "Command registry includes core commands plus active extension command handlers; package-provided commands appear only after the package is installed.",
2558
- examples: dedupeStrings([packageHint.installCommand, ...baseExamples]),
2559
- nextSteps: dedupeStrings([installStep, ...baseNextSteps]),
2560
- recovery: buildCommanderRecoveryPayload(context)
2561
- });
2562
- }
2563
- return makeGuidanceMessage({
2564
- code: "unknown_command",
2565
- title: `Unknown command ${commandToken}`,
2566
- happened: `pm does not expose command path "${commandToken}" in current runtime configuration.`,
2567
- required: "Use a valid command name or subcommand path.",
2568
- why: "Command registry includes core commands plus active extension command handlers.",
2569
- examples: baseExamples,
2570
- nextSteps: baseNextSteps,
2571
- recovery: buildCommanderRecoveryPayload(context)
2572
- });
2605
+ if (!unknownCommand) {
2606
+ return null;
2573
2607
  }
2574
- if (/too many arguments/i.test(message) && commandName === "test") {
2575
- const argv = context?.normalizedInvocationArgs;
2576
- const mutationFlag = findLinkedTestMutationFlag(argv);
2577
- if (mutationFlag) {
2578
- const retryCommand = buildLinkedTestQuotedRetryCommand(argv);
2579
- return makeGuidanceMessage({
2580
- code: "linked_test_value_not_quoted",
2581
- title: `Linked-test ${mutationFlag} value must be one argument`,
2582
- 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.`,
2583
- 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.`,
2584
- why: "The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",
2585
- examples: [
2586
- ...retryCommand ? [retryCommand] : [],
2587
- 'pm test pm-a1b2 --add "command=npm test -- parser"',
2588
- 'pm test pm-a1b2 --add command "npm test -- parser"',
2589
- `pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`
2590
- ],
2591
- nextSteps: [
2592
- ...retryCommand ? [`Replay with the value re-joined into one argument: ${retryCommand}`] : [],
2593
- "Prefer --add-json for commands containing commas, equals signs, or quotes.",
2594
- 'Run "pm test --help" for linked-test entry contracts.'
2595
- ],
2596
- recovery: buildCommanderRecoveryPayload(context, retryCommand ? { suggested_retry: retryCommand } : {})
2597
- });
2598
- }
2608
+ const commandToken = unknownCommand[1];
2609
+ const runtimeExamples = normalizeContextList(context?.unknownCommandExamples);
2610
+ const runtimeNextSteps = normalizeContextList(context?.unknownCommandNextSteps);
2611
+ const packageHint = resolveKnownPackageCommandHint(commandToken);
2612
+ const baseExamples = runtimeExamples ?? ["pm --help"];
2613
+ const baseNextSteps = runtimeNextSteps ?? ["Verify spelling and active extensions, then rerun."];
2614
+ if (packageHint) {
2615
+ return buildKnownPackageCommandGuidance(commandToken, packageHint, baseExamples, baseNextSteps, context);
2616
+ }
2617
+ return makeGuidanceMessage({
2618
+ code: "unknown_command",
2619
+ title: `Unknown command ${commandToken}`,
2620
+ happened: `pm does not expose command path "${commandToken}" in current runtime configuration.`,
2621
+ required: "Use a valid command name or subcommand path.",
2622
+ why: "Command registry includes core commands plus active extension command handlers.",
2623
+ examples: baseExamples,
2624
+ nextSteps: baseNextSteps,
2625
+ recovery: buildCommanderRecoveryPayload(context)
2626
+ });
2627
+ }
2628
+ function buildLinkedTestValueNotQuotedGuidance(message, commandName, allowedTypes, context) {
2629
+ if (!/too many arguments/i.test(message) || commandName !== "test") {
2630
+ return null;
2631
+ }
2632
+ const argv = context?.normalizedInvocationArgs;
2633
+ const mutationFlag = findLinkedTestMutationFlag(argv);
2634
+ if (!mutationFlag) {
2635
+ return null;
2636
+ }
2637
+ const retryCommand = buildLinkedTestQuotedRetryCommand(argv);
2638
+ return makeGuidanceMessage({
2639
+ code: "linked_test_value_not_quoted",
2640
+ title: `Linked-test ${mutationFlag} value must be one argument`,
2641
+ happened: `Commander saw extra positional tokens after the item id \u2014 usually a ${mutationFlag} value containing spaces (for example a command with " -- ") that the shell split into multiple tokens.`,
2642
+ required: `Quote the whole ${mutationFlag} value as a single argument. Accepted forms: --add "command=npm test -- parser", --add command "npm test -- parser" (two-token form with the value quoted), or --add-json for complex commands.`,
2643
+ why: "The shell splits unquoted values before pm can see them, so pm cannot reassemble the intended command unambiguously.",
2644
+ examples: [
2645
+ ...retryCommand ? [retryCommand] : [],
2646
+ 'pm test pm-a1b2 --add "command=npm test -- parser"',
2647
+ 'pm test pm-a1b2 --add command "npm test -- parser"',
2648
+ `pm test pm-a1b2 --add-json '{"command":"npm test -- parser"}'`
2649
+ ],
2650
+ nextSteps: [
2651
+ ...retryCommand ? [`Replay with the value re-joined into one argument: ${retryCommand}`] : [],
2652
+ "Prefer --add-json for commands containing commas, equals signs, or quotes.",
2653
+ 'Run "pm test --help" for linked-test entry contracts.'
2654
+ ],
2655
+ recovery: buildCommanderRecoveryPayload(context, retryCommand ? { suggested_retry: retryCommand } : {})
2656
+ });
2657
+ }
2658
+ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context) {
2659
+ const message = normalizeMessage(rawMessage);
2660
+ const guidance = buildMissingRequiredOptionGuidance(message, commandName, allowedTypes, context) ?? buildMissingRequiredArgumentGuidance(message, commandName, context) ?? buildUnknownOptionGuidance(message, commandName, context) ?? buildUnknownCommandGuidance(message, context) ?? buildLinkedTestValueNotQuotedGuidance(message, commandName, allowedTypes, context);
2661
+ if (guidance) {
2662
+ return guidance;
2599
2663
  }
2600
2664
  return makeGuidanceMessage({
2601
2665
  code: "invalid_command_usage",
@@ -3094,674 +3158,11 @@ function ensureCommandPath(root, pathParts) {
3094
3158
  return current;
3095
3159
  }
3096
3160
 
3097
- // dist/cli/bootstrap-args.js
3161
+ // dist/cli/migration-gates.js
3098
3162
  !(function() {
3099
3163
  try {
3100
3164
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3101
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "df81f91f-ed92-5511-b34c-ea7c1b81230b");
3102
- } catch (e2) {
3103
- }
3104
- })();
3105
- function parseBootstrapPathToken(token, next) {
3106
- if (token === "--path" || token === "--pm-path") {
3107
- if (typeof next === "string" && next.length > 0) {
3108
- return {
3109
- consumed: 2,
3110
- pathValue: next,
3111
- preferred: token === "--pm-path"
3112
- };
3113
- }
3114
- return {
3115
- consumed: 1,
3116
- preferred: token === "--pm-path"
3117
- };
3118
- }
3119
- const inlinePrefix = token.startsWith("--path=") ? "--path=" : token.startsWith("--pm-path=") ? "--pm-path=" : void 0;
3120
- if (!inlinePrefix) {
3121
- return null;
3122
- }
3123
- const value = token.slice(inlinePrefix.length);
3124
- if (value.length > 0) {
3125
- return {
3126
- consumed: 1,
3127
- pathValue: value,
3128
- preferred: inlinePrefix === "--pm-path="
3129
- };
3130
- }
3131
- return {
3132
- consumed: 1,
3133
- preferred: inlinePrefix === "--pm-path="
3134
- };
3135
- }
3136
- function parseBootstrapGlobalOptions(argv) {
3137
- let legacyPathValue;
3138
- let pmPathValue;
3139
- let noExtensions = false;
3140
- let noPager = false;
3141
- let json = false;
3142
- let quiet = false;
3143
- let index = 0;
3144
- while (index < argv.length) {
3145
- const token = argv[index];
3146
- if (token === "--") {
3147
- break;
3148
- }
3149
- if (token === "--no-extensions") {
3150
- noExtensions = true;
3151
- index += 1;
3152
- continue;
3153
- }
3154
- if (token === "--no-pager") {
3155
- noPager = true;
3156
- index += 1;
3157
- continue;
3158
- }
3159
- if (token === "--json") {
3160
- json = true;
3161
- index += 1;
3162
- continue;
3163
- }
3164
- if (token === "--quiet") {
3165
- quiet = true;
3166
- index += 1;
3167
- continue;
3168
- }
3169
- const parsedPath = parseBootstrapPathToken(token, argv[index + 1]);
3170
- if (parsedPath) {
3171
- if (parsedPath.pathValue !== void 0) {
3172
- if (parsedPath.preferred) {
3173
- pmPathValue = parsedPath.pathValue;
3174
- } else {
3175
- legacyPathValue = parsedPath.pathValue;
3176
- }
3177
- }
3178
- index += parsedPath.consumed;
3179
- continue;
3180
- }
3181
- index += 1;
3182
- }
3183
- return {
3184
- path: pmPathValue ?? legacyPathValue,
3185
- noExtensions,
3186
- noPager,
3187
- json,
3188
- quiet
3189
- };
3190
- }
3191
- function stripGlobalBootstrapTokens(argv) {
3192
- const remaining = [];
3193
- let index = 0;
3194
- while (index < argv.length) {
3195
- const token = argv[index];
3196
- if (token === "--") {
3197
- break;
3198
- }
3199
- if (token === "--json" || token === "--quiet" || token === "--no-extensions" || token === "--no-pager" || token === "--profile" || token === "--id-only" || token === "--explain") {
3200
- index += 1;
3201
- continue;
3202
- }
3203
- if (token === "--path" || token === "--pm-path") {
3204
- index += 2;
3205
- continue;
3206
- }
3207
- if (token.startsWith("--path=") || token.startsWith("--pm-path=")) {
3208
- index += 1;
3209
- continue;
3210
- }
3211
- remaining.push(token);
3212
- index += 1;
3213
- }
3214
- return remaining;
3215
- }
3216
- function parseBootstrapHelpRequest(argv) {
3217
- const stripped = stripGlobalBootstrapTokens(argv);
3218
- const first = stripped[0]?.trim().toLowerCase();
3219
- if (first === "help") {
3220
- const commandPathTokens2 = [];
3221
- for (let index = 1; index < stripped.length; index += 1) {
3222
- const token = stripped[index];
3223
- if (token.startsWith("-")) {
3224
- break;
3225
- }
3226
- commandPathTokens2.push(token.trim().toLowerCase());
3227
- }
3228
- return {
3229
- requested: true,
3230
- commandPathTokens: commandPathTokens2
3231
- };
3232
- }
3233
- const helpFlagIndex = stripped.findIndex((token) => token === "--help" || token === "-h");
3234
- if (helpFlagIndex < 0) {
3235
- return {
3236
- requested: false,
3237
- commandPathTokens: []
3238
- };
3239
- }
3240
- const commandPathTokens = [];
3241
- for (const token of stripped) {
3242
- if (token.startsWith("-")) {
3243
- break;
3244
- }
3245
- commandPathTokens.push(token.trim().toLowerCase());
3246
- }
3247
- return {
3248
- requested: true,
3249
- commandPathTokens
3250
- };
3251
- }
3252
- function findCommandTokenIndex(argv) {
3253
- for (let index = 0; index < argv.length; index += 1) {
3254
- const token = argv[index];
3255
- if (token === "--") {
3256
- return void 0;
3257
- }
3258
- if (token === "--path" || token === "--pm-path") {
3259
- index += 1;
3260
- continue;
3261
- }
3262
- if (token.startsWith("--path=") || token.startsWith("--pm-path=") || token === "--json" || token === "--quiet" || token === "--no-extensions" || token === "--no-pager" || token === "--profile" || token === "--id-only" || token === "--explain") {
3263
- continue;
3264
- }
3265
- if (token.startsWith("-")) {
3266
- continue;
3267
- }
3268
- return index;
3269
- }
3270
- return void 0;
3271
- }
3272
- function parseBootstrapCommandName(argv) {
3273
- const index = findCommandTokenIndex(argv);
3274
- return index === void 0 ? void 0 : argv[index].trim().toLowerCase();
3275
- }
3276
- function shouldDisablePagerForInvocation(argv, bootstrapGlobal) {
3277
- if (bootstrapGlobal.noPager) {
3278
- return true;
3279
- }
3280
- if (process.stdout.isTTY === true) {
3281
- return false;
3282
- }
3283
- const helpRequest = parseBootstrapHelpRequest(argv);
3284
- return helpRequest.requested;
3285
- }
3286
- function applyBootstrapPagerPolicy(argv) {
3287
- const bootstrapGlobal = parseBootstrapGlobalOptions(argv);
3288
- if (!shouldDisablePagerForInvocation(argv, bootstrapGlobal)) {
3289
- return;
3290
- }
3291
- process.env.PAGER = "cat";
3292
- process.env.MANPAGER = "cat";
3293
- process.env.GIT_PAGER = "cat";
3294
- if (typeof process.env.LESS !== "string" || process.env.LESS.trim().length === 0) {
3295
- process.env.LESS = "FRX";
3296
- }
3297
- }
3298
- var EXTENSION_ACTION_SYNTAX_TOKENS = /* @__PURE__ */ new Set([
3299
- "install",
3300
- "uninstall",
3301
- "explore",
3302
- "manage",
3303
- "doctor",
3304
- "adopt",
3305
- "adopt-all",
3306
- "activate",
3307
- "deactivate"
3308
- ]);
3309
- function normalizeLegacyExtensionActionSyntax(argv) {
3310
- const extensionIndex = argv.findIndex((token) => token === "extension");
3311
- if (extensionIndex < 0) {
3312
- return [...argv];
3313
- }
3314
- const actionToken = argv[extensionIndex + 1];
3315
- if (!actionToken || actionToken.startsWith("-")) {
3316
- return [...argv];
3317
- }
3318
- if (!EXTENSION_ACTION_SYNTAX_TOKENS.has(actionToken)) {
3319
- return [...argv];
3320
- }
3321
- if (argv.includes("--help") || argv.includes("-h")) {
3322
- return [...argv];
3323
- }
3324
- const forcedActionFlag = `--${actionToken}`;
3325
- if (argv.includes(forcedActionFlag)) {
3326
- return [...argv];
3327
- }
3328
- return [...argv.slice(0, extensionIndex + 1), forcedActionFlag, ...argv.slice(extensionIndex + 2)];
3329
- }
3330
- var EXECUTABLE_COMMAND_ALIASES = {
3331
- show: "get",
3332
- view: "get",
3333
- comment: "comments",
3334
- note: "notes",
3335
- learning: "learnings"
3336
- };
3337
- function rewriteCommandAlias(argv, trace) {
3338
- const index = findCommandTokenIndex(argv);
3339
- if (index === void 0) {
3340
- return argv;
3341
- }
3342
- const token = argv[index];
3343
- const canonical = EXECUTABLE_COMMAND_ALIASES[token.trim().toLowerCase()];
3344
- if (!canonical) {
3345
- return argv;
3346
- }
3347
- const rewritten = [...argv];
3348
- rewritten[index] = canonical;
3349
- trace.push({ from: token, to: [canonical], reason: "command_alias", confidence: "high" });
3350
- return rewritten;
3351
- }
3352
- function normalizeFlagKeyToken(raw) {
3353
- const withoutPrefix = raw.replace(/^--?/, "");
3354
- return withoutPrefix.replace(/_/g, "-").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
3355
- }
3356
- function toComparableFlagKey(raw) {
3357
- return normalizeFlagKeyToken(raw).replace(/-/g, "");
3358
- }
3359
- function markUnambiguousFlag(map, key, canonicalFlag) {
3360
- const existing = map.get(key);
3361
- if (existing === void 0) {
3362
- map.set(key, canonicalFlag);
3363
- return;
3364
- }
3365
- if (existing !== canonicalFlag) {
3366
- map.set(key, null);
3367
- }
3368
- }
3369
- function collectLongFlagCandidates(contract) {
3370
- const candidates = [];
3371
- const pushLongFlag = (value) => {
3372
- if (typeof value !== "string") {
3373
- return;
3374
- }
3375
- if (!value.startsWith("--")) {
3376
- return;
3377
- }
3378
- candidates.push(value);
3379
- };
3380
- pushLongFlag(contract.flag);
3381
- for (const alias of contract.aliases ?? []) {
3382
- pushLongFlag(alias);
3383
- }
3384
- return candidates;
3385
- }
3386
- function buildFlagLookup(commandName, contractsOverride) {
3387
- const contracts = contractsOverride ?? resolveSubcommandFlagContractsForCommand(commandName);
3388
- const canonicalByNormalized = /* @__PURE__ */ new Map();
3389
- const canonicalByCompact = /* @__PURE__ */ new Map();
3390
- const canonicalComparablesMap = /* @__PURE__ */ new Map();
3391
- const listCanonicalFlags = /* @__PURE__ */ new Set();
3392
- for (const contract of contracts) {
3393
- const longCandidates = collectLongFlagCandidates(contract);
3394
- if (longCandidates.length === 0) {
3395
- continue;
3396
- }
3397
- const canonicalFlag = `--${normalizeFlagKeyToken(longCandidates[0])}`;
3398
- for (const candidate of longCandidates) {
3399
- markUnambiguousFlag(canonicalByNormalized, normalizeFlagKeyToken(candidate), canonicalFlag);
3400
- markUnambiguousFlag(canonicalByCompact, toComparableFlagKey(candidate), canonicalFlag);
3401
- }
3402
- const comparable = toComparableFlagKey(canonicalFlag);
3403
- if (!canonicalComparablesMap.has(canonicalFlag)) {
3404
- canonicalComparablesMap.set(canonicalFlag, comparable);
3405
- }
3406
- if (contract.list === true) {
3407
- listCanonicalFlags.add(canonicalFlag);
3408
- }
3409
- }
3410
- return {
3411
- canonicalByNormalized,
3412
- canonicalByCompact,
3413
- canonicalComparables: [...canonicalComparablesMap.entries()].map(([canonicalFlag, comparable]) => ({
3414
- canonicalFlag,
3415
- comparable
3416
- })),
3417
- listCanonicalFlags
3418
- };
3419
- }
3420
- function resolveCanonicalFlag(rawKey, lookup) {
3421
- const normalizedKey = normalizeFlagKeyToken(rawKey);
3422
- const direct = lookup.canonicalByNormalized.get(normalizedKey);
3423
- if (typeof direct === "string") {
3424
- return {
3425
- flag: direct,
3426
- reason: "flag_alias",
3427
- confidence: "high"
3428
- };
3429
- }
3430
- const comparableKey = normalizedKey.replace(/-/g, "");
3431
- const compactMatch = lookup.canonicalByCompact.get(comparableKey);
3432
- if (typeof compactMatch === "string") {
3433
- return {
3434
- flag: compactMatch,
3435
- reason: "flag_alias",
3436
- confidence: "high"
3437
- };
3438
- }
3439
- const maxDistance = comparableKey.length >= 8 ? 2 : 1;
3440
- let bestDistance = Number.POSITIVE_INFINITY;
3441
- let bestFlag;
3442
- let tied = false;
3443
- for (const candidate of lookup.canonicalComparables) {
3444
- const distance = levenshteinDistanceWithinLimit(comparableKey, candidate.comparable, maxDistance);
3445
- if (distance === null) {
3446
- continue;
3447
- }
3448
- if (distance < bestDistance) {
3449
- bestDistance = distance;
3450
- bestFlag = candidate.canonicalFlag;
3451
- tied = false;
3452
- continue;
3453
- }
3454
- if (distance === bestDistance && bestFlag !== candidate.canonicalFlag) {
3455
- tied = true;
3456
- }
3457
- }
3458
- if (!bestFlag || tied || !Number.isFinite(bestDistance) || bestDistance <= 0) {
3459
- return null;
3460
- }
3461
- return {
3462
- flag: bestFlag,
3463
- reason: "flag_typo",
3464
- confidence: bestDistance >= 2 ? "medium" : "high"
3465
- };
3466
- }
3467
- function parseBareKeyValueToken(token) {
3468
- if (token.includes("://")) {
3469
- return null;
3470
- }
3471
- const match = token.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);
3472
- if (!match) {
3473
- return null;
3474
- }
3475
- const key = match[1];
3476
- const value = match[3];
3477
- if (value.length === 0) {
3478
- return null;
3479
- }
3480
- return {
3481
- key,
3482
- value
3483
- };
3484
- }
3485
- function normalizeLongOptionToken(token, lookup) {
3486
- if (!token.startsWith("--")) {
3487
- return { tokens: [token] };
3488
- }
3489
- const equalsIndex = token.indexOf("=");
3490
- const key = equalsIndex >= 0 ? token.slice(0, equalsIndex) : token;
3491
- const inlineValue = equalsIndex >= 0 ? token.slice(equalsIndex + 1) : void 0;
3492
- const resolution = resolveCanonicalFlag(key, lookup);
3493
- if (!resolution) {
3494
- return { tokens: [token] };
3495
- }
3496
- const normalizedToken = inlineValue === void 0 ? resolution.flag : `${resolution.flag}=${inlineValue}`;
3497
- if (normalizedToken === token) {
3498
- return { tokens: [token] };
3499
- }
3500
- return {
3501
- tokens: [normalizedToken],
3502
- event: {
3503
- from: token,
3504
- to: [normalizedToken],
3505
- reason: resolution.reason,
3506
- confidence: resolution.confidence
3507
- }
3508
- };
3509
- }
3510
- var GLOBAL_VALUE_CONSUMING_FLAGS = /* @__PURE__ */ new Set(["--pm-path", "--path"]);
3511
- function splitCanonicalListToken(token) {
3512
- if (!token.startsWith("--")) {
3513
- return null;
3514
- }
3515
- const equalsIndex = token.indexOf("=");
3516
- if (equalsIndex < 0) {
3517
- return { flag: token };
3518
- }
3519
- return {
3520
- flag: token.slice(0, equalsIndex),
3521
- inlineValue: token.slice(equalsIndex + 1)
3522
- };
3523
- }
3524
- function coalesceRepeatedListFlags(argv, listFlags, valueConsumingFlags = /* @__PURE__ */ new Set(), multiValueListFlags = /* @__PURE__ */ new Set()) {
3525
- if (listFlags.size === 0) {
3526
- return { argv: [...argv], events: [] };
3527
- }
3528
- const result = [];
3529
- const slots = /* @__PURE__ */ new Map();
3530
- let index = 0;
3531
- while (index < argv.length) {
3532
- const token = argv[index];
3533
- if (token === "--") {
3534
- result.push(...argv.slice(index));
3535
- break;
3536
- }
3537
- if (valueConsumingFlags.has(token)) {
3538
- result.push(token);
3539
- const next = argv[index + 1];
3540
- if (typeof next === "string" && next !== "--") {
3541
- result.push(next);
3542
- index += 2;
3543
- } else {
3544
- index += 1;
3545
- }
3546
- continue;
3547
- }
3548
- const parsed = splitCanonicalListToken(token);
3549
- if (!parsed || !listFlags.has(parsed.flag)) {
3550
- result.push(token);
3551
- index += 1;
3552
- continue;
3553
- }
3554
- let value;
3555
- let consumed = 1;
3556
- if (parsed.inlineValue !== void 0) {
3557
- value = parsed.inlineValue;
3558
- } else {
3559
- const next = argv[index + 1];
3560
- if (typeof next === "string" && next !== "--" && !next.startsWith("-")) {
3561
- const values = [next];
3562
- if (multiValueListFlags.has(parsed.flag)) {
3563
- let valueIndex = index + 2;
3564
- while (valueIndex < argv.length && argv[valueIndex] !== "--" && !argv[valueIndex].startsWith("-")) {
3565
- values.push(argv[valueIndex]);
3566
- valueIndex += 1;
3567
- }
3568
- }
3569
- value = values.join(",");
3570
- consumed = 1 + values.length;
3571
- }
3572
- }
3573
- if (value === void 0) {
3574
- result.push(token);
3575
- index += consumed;
3576
- continue;
3577
- }
3578
- const originalTokens = argv.slice(index, index + consumed);
3579
- const existing = slots.get(parsed.flag);
3580
- if (existing) {
3581
- existing.values.push(value);
3582
- existing.occurrences += 1;
3583
- } else {
3584
- const slot = {
3585
- outputIndex: result.length,
3586
- originalTokens,
3587
- values: [value],
3588
- occurrences: 1
3589
- };
3590
- slots.set(parsed.flag, slot);
3591
- result.push(null);
3592
- }
3593
- index += consumed;
3594
- }
3595
- const events = [];
3596
- const splices = [];
3597
- for (const [flag, slot] of slots) {
3598
- const shouldMerge = slot.occurrences >= 2 || multiValueListFlags.has(flag) && slot.originalTokens.length > 2;
3599
- if (shouldMerge) {
3600
- const mergedToken = `${flag}=${slot.values.join(",")}`;
3601
- splices.push({ outputIndex: slot.outputIndex, tokens: [mergedToken] });
3602
- events.push({
3603
- from: `${flag} (x${slot.occurrences})`,
3604
- to: [mergedToken],
3605
- reason: "list_merge",
3606
- confidence: "high"
3607
- });
3608
- } else {
3609
- splices.push({ outputIndex: slot.outputIndex, tokens: slot.originalTokens });
3610
- }
3611
- }
3612
- splices.sort((a, b) => b.outputIndex - a.outputIndex);
3613
- for (const splice of splices) {
3614
- result.splice(splice.outputIndex, 1, ...splice.tokens);
3615
- }
3616
- return { argv: result, events };
3617
- }
3618
- var LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG = /* @__PURE__ */ new Map([
3619
- ["--add", /* @__PURE__ */ new Set(["command", "cmd", "path"])],
3620
- ["--remove", /* @__PURE__ */ new Set(["command", "path"])]
3621
- ]);
3622
- function isLinkedTestTwoTokenValuePosition(commandName, emittedTokens) {
3623
- if (commandName !== "test" || emittedTokens.length < 2) {
3624
- return false;
3625
- }
3626
- const key = emittedTokens[emittedTokens.length - 1];
3627
- const flag = emittedTokens[emittedTokens.length - 2];
3628
- const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(flag);
3629
- return keys !== void 0 && keys.has(key);
3630
- }
3631
- function mergeLinkedTestTwoTokenEntries(argv, commandName, trace) {
3632
- if (commandName !== "test") {
3633
- return argv;
3634
- }
3635
- const result = [];
3636
- let index = 0;
3637
- while (index < argv.length) {
3638
- const token = argv[index];
3639
- if (token === "--") {
3640
- result.push(...argv.slice(index));
3641
- return result;
3642
- }
3643
- const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(token);
3644
- const key = keys ? argv[index + 1] : void 0;
3645
- if (!keys || typeof key !== "string" || !keys.has(key)) {
3646
- result.push(token);
3647
- index += 1;
3648
- continue;
3649
- }
3650
- let runEnd = index + 2;
3651
- while (runEnd < argv.length && !argv[runEnd].startsWith("-")) {
3652
- runEnd += 1;
3653
- }
3654
- if (runEnd - (index + 2) !== 1) {
3655
- result.push(token);
3656
- index += 1;
3657
- continue;
3658
- }
3659
- const value = argv[index + 2];
3660
- const mergedValue = `${key}=${value}`;
3661
- result.push(token, mergedValue);
3662
- trace.push({
3663
- from: `${token} ${key} ${value}`,
3664
- to: [token, mergedValue],
3665
- reason: "bare_key_value",
3666
- confidence: "high"
3667
- });
3668
- index += 3;
3669
- }
3670
- return result;
3671
- }
3672
- function normalizeBootstrapInvocation(argv) {
3673
- const trace = [];
3674
- const legacyNormalized = normalizeLegacyExtensionActionSyntax(argv);
3675
- if (legacyNormalized.length !== argv.length || legacyNormalized.some((token, index) => token !== argv[index])) {
3676
- trace.push({
3677
- from: argv.join(" "),
3678
- to: [...legacyNormalized],
3679
- reason: "legacy_extension_action",
3680
- confidence: "high"
3681
- });
3682
- }
3683
- const aliasNormalized = rewriteCommandAlias(legacyNormalized, trace);
3684
- const commandName = parseBootstrapCommandName(aliasNormalized);
3685
- const commandPathName = parseBootstrapCommandPathName(aliasNormalized);
3686
- const lookup = buildFlagLookup(commandPathName ?? commandName);
3687
- const normalizedArgv = [];
3688
- for (let index = 0; index < aliasNormalized.length; index += 1) {
3689
- const token = aliasNormalized[index];
3690
- if (token === "--") {
3691
- normalizedArgv.push(...aliasNormalized.slice(index));
3692
- break;
3693
- }
3694
- const previous = normalizedArgv[normalizedArgv.length - 1];
3695
- if (token.startsWith("--")) {
3696
- const normalizedToken = normalizeLongOptionToken(token, lookup);
3697
- normalizedArgv.push(...normalizedToken.tokens);
3698
- if (normalizedToken.event) {
3699
- trace.push(normalizedToken.event);
3700
- }
3701
- continue;
3702
- }
3703
- const bareKeyValue = parseBareKeyValueToken(token);
3704
- if (bareKeyValue && !(typeof previous === "string" && previous.startsWith("-")) && !isLinkedTestTwoTokenValuePosition(commandName, normalizedArgv)) {
3705
- const resolution = resolveCanonicalFlag(bareKeyValue.key, lookup);
3706
- if (resolution) {
3707
- const replacement = [resolution.flag, bareKeyValue.value];
3708
- normalizedArgv.push(...replacement);
3709
- trace.push({
3710
- from: token,
3711
- to: replacement,
3712
- reason: "bare_key_value",
3713
- confidence: resolution.confidence
3714
- });
3715
- continue;
3716
- }
3717
- }
3718
- normalizedArgv.push(token);
3719
- }
3720
- const linkedTestNormalized = mergeLinkedTestTwoTokenEntries(normalizedArgv, commandName, trace);
3721
- const coalesced = coalesceRepeatedListFlags(linkedTestNormalized, lookup.listCanonicalFlags, GLOBAL_VALUE_CONSUMING_FLAGS, commandName === "create" ? /* @__PURE__ */ new Set(["--tags"]) : /* @__PURE__ */ new Set());
3722
- for (const event of coalesced.events) {
3723
- trace.push(event);
3724
- }
3725
- return {
3726
- argv: coalesced.argv,
3727
- commandName,
3728
- trace
3729
- };
3730
- }
3731
- function parseBootstrapCommandPathName(argv) {
3732
- const stripped = stripGlobalBootstrapTokens(argv);
3733
- const first = stripped[0]?.trim().toLowerCase();
3734
- const second = stripped[1]?.trim().toLowerCase();
3735
- if ((first === "extension" || first === "package" || first === "packages") && typeof second === "string" && second.length > 0 && !second.startsWith("-")) {
3736
- return `${first} ${second}`;
3737
- }
3738
- return first;
3739
- }
3740
- function parseBootstrapTypeValue(argv) {
3741
- for (let index = 0; index < argv.length; index += 1) {
3742
- const token = argv[index];
3743
- if (token === "--type") {
3744
- const candidate = argv[index + 1];
3745
- if (typeof candidate === "string" && candidate.trim().length > 0) {
3746
- return candidate.trim();
3747
- }
3748
- continue;
3749
- }
3750
- if (token.startsWith("--type=")) {
3751
- const candidate = token.slice("--type=".length).trim();
3752
- if (candidate.length > 0) {
3753
- return candidate;
3754
- }
3755
- }
3756
- }
3757
- return void 0;
3758
- }
3759
-
3760
- // dist/cli/migration-gates.js
3761
- !(function() {
3762
- try {
3763
- var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3764
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "3f652b37-a8f5-5d02-9199-d2982382b7a8");
3165
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e5659f1c-76e6-52e9-96f6-201091483918");
3765
3166
  } catch (e2) {
3766
3167
  }
3767
3168
  })();
@@ -3813,52 +3214,29 @@ function collectMandatoryMigrationBlockers(migrations) {
3813
3214
  function hasMutatingListValues(value) {
3814
3215
  return Array.isArray(value) && value.length > 0;
3815
3216
  }
3217
+ var ALWAYS_MUTATING_COMMANDS = /* @__PURE__ */ new Set(["create", "beads import", "todos import"]);
3218
+ var FORCEABLE_MUTATING_COMMANDS = /* @__PURE__ */ new Set(["restore", "update", "close", "delete", "append", "claim", "release"]);
3219
+ var TEXT_APPEND_COMMANDS = /* @__PURE__ */ new Set(["comments", "notes", "learnings"]);
3220
+ var LIST_MUTATION_COMMANDS = /* @__PURE__ */ new Set(["files", "docs", "test"]);
3816
3221
  function decideWriteGate(commandPath, options) {
3817
3222
  const forceRequested = options.force === true;
3818
- switch (commandPath) {
3819
- case "create":
3820
- case "beads import":
3821
- case "todos import":
3822
- return {
3823
- isMutation: true,
3824
- forceCapable: false,
3825
- forceRequested: false
3826
- };
3827
- case "restore":
3828
- case "update":
3829
- case "close":
3830
- case "delete":
3831
- case "append":
3832
- case "claim":
3833
- case "release":
3834
- return {
3835
- isMutation: true,
3836
- forceCapable: true,
3837
- forceRequested
3838
- };
3839
- case "comments":
3840
- case "notes":
3841
- case "learnings":
3842
- return {
3843
- isMutation: typeof options.add === "string",
3844
- forceCapable: true,
3845
- forceRequested
3846
- };
3847
- case "files":
3848
- case "docs":
3849
- case "test":
3850
- return {
3851
- isMutation: hasMutatingListValues(options.add) || hasMutatingListValues(options.remove),
3852
- forceCapable: true,
3853
- forceRequested
3854
- };
3855
- default:
3856
- return {
3857
- isMutation: false,
3858
- forceCapable: false,
3859
- forceRequested: false
3860
- };
3223
+ if (ALWAYS_MUTATING_COMMANDS.has(commandPath)) {
3224
+ return { isMutation: true, forceCapable: false, forceRequested: false };
3225
+ }
3226
+ if (FORCEABLE_MUTATING_COMMANDS.has(commandPath)) {
3227
+ return { isMutation: true, forceCapable: true, forceRequested };
3228
+ }
3229
+ if (TEXT_APPEND_COMMANDS.has(commandPath)) {
3230
+ return { isMutation: typeof options.add === "string", forceCapable: true, forceRequested };
3861
3231
  }
3232
+ if (LIST_MUTATION_COMMANDS.has(commandPath)) {
3233
+ return {
3234
+ isMutation: hasMutatingListValues(options.add) || hasMutatingListValues(options.remove),
3235
+ forceCapable: true,
3236
+ forceRequested
3237
+ };
3238
+ }
3239
+ return { isMutation: false, forceCapable: false, forceRequested: false };
3862
3240
  }
3863
3241
  function enforceMandatoryMigrationWriteGate(commandPath, options, blockers) {
3864
3242
  if (blockers.length === 0) {
@@ -3903,7 +3281,7 @@ async function enforceItemFormatWriteGateAndPreflightMigration(commandPath, opti
3903
3281
  !(function() {
3904
3282
  try {
3905
3283
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3906
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c0b38b44-fdea-5d80-b2d4-361f2b07c8f1");
3284
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "66620fd2-4f5f-5930-a9e1-0497672abda9");
3907
3285
  } catch (e2) {
3908
3286
  }
3909
3287
  })();
@@ -4288,6 +3666,48 @@ function isKnownHelpCommandPath(root, commandPathTokens) {
4288
3666
  }
4289
3667
  return matchedAny;
4290
3668
  }
3669
+ async function resolveAllowedTypesForUsage(bootstrapGlobal) {
3670
+ try {
3671
+ const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
3672
+ if (!await pathExists(getSettingsPath(pmRoot))) {
3673
+ return BUILTIN_TYPE_HELP_VALUES;
3674
+ }
3675
+ const settings = await readSettings(pmRoot);
3676
+ const extensionRegistrations = bootstrapGlobal.noExtensions ? void 0 : getActiveExtensionRegistrations();
3677
+ const typeRegistry = resolveItemTypeRegistry(settings, extensionRegistrations);
3678
+ return typeRegistry.types.length > 0 ? typeRegistry.types.join("|") : BUILTIN_TYPE_HELP_VALUES;
3679
+ } catch {
3680
+ return BUILTIN_TYPE_HELP_VALUES;
3681
+ }
3682
+ }
3683
+ function resolveUnknownOptionSuggestions(message, commandName) {
3684
+ const match = message.match(/unknown option '([^']+)'/i);
3685
+ const suggestions = match && commandName ? dedupeStrings2([
3686
+ ...getSemanticUnknownOptionSuggestions(commandName, match[1]),
3687
+ ...suggestNearestLongFlags(match[1], collectKnownLongFlags(commandName))
3688
+ ]) : void 0;
3689
+ return {
3690
+ match,
3691
+ suggestions,
3692
+ otherCommands: match ? findOtherCommandsForFlag(match[1], commandName) : []
3693
+ };
3694
+ }
3695
+ function resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOptionMatch, unknownOptionSuggestions) {
3696
+ if (!unknownOptionMatch || !unknownOptionSuggestions || unknownOptionSuggestions.length === 0) {
3697
+ return void 0;
3698
+ }
3699
+ const rewritten = rewriteUnknownOptionArgv(invocationArgv, unknownOptionMatch[1], unknownOptionSuggestions[0]);
3700
+ return rewritten ? renderAttemptedCommand(rewritten) : void 0;
3701
+ }
3702
+ function resolveSuggestedRetryForMissingOption(message, invocationArgv) {
3703
+ const missingRequiredOption = message.match(/required option '([^']+)' not specified/i);
3704
+ const requiredOptionToken = missingRequiredOption?.[1] ? trimTrailingPunctuationToken(firstWhitespaceSeparatedToken(missingRequiredOption[1].trim())) : void 0;
3705
+ if (!requiredOptionToken?.startsWith("--")) {
3706
+ return void 0;
3707
+ }
3708
+ const hasFlag = invocationArgv.some((token) => token === requiredOptionToken || token.startsWith(`${requiredOptionToken}=`));
3709
+ return hasFlag ? void 0 : renderAttemptedCommand([...invocationArgv, requiredOptionToken, "<value>"]);
3710
+ }
4291
3711
  async function resolveCommanderUsageContext(error, rootProgram, extensionDescriptors) {
4292
3712
  const rawMessage = typeof error === "object" && error !== null ? error.message : void 0;
4293
3713
  const message = rawMessage ?? "Invalid command usage";
@@ -4296,42 +3716,10 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
4296
3716
  const commandName = parseBootstrapCommandName(invocationArgv);
4297
3717
  const attemptedCommand = renderAttemptedCommand(invocationArgv);
4298
3718
  const providedOptionFlags = extractProvidedOptionFlags(invocationArgv);
4299
- let allowedTypes = BUILTIN_TYPE_HELP_VALUES;
4300
- try {
4301
- const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
4302
- if (await pathExists(getSettingsPath(pmRoot))) {
4303
- const settings = await readSettings(pmRoot);
4304
- const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
4305
- if (typeRegistry.types.length > 0) {
4306
- allowedTypes = typeRegistry.types.join("|");
4307
- }
4308
- }
4309
- } catch {
4310
- }
3719
+ const allowedTypes = await resolveAllowedTypesForUsage(bootstrapGlobal);
4311
3720
  const unknownCommandGuidance = buildUnknownCommandGuidanceFromRuntime(message, rootProgram, extensionDescriptors);
4312
- const unknownOptionMatch = message.match(/unknown option '([^']+)'/i);
4313
- const unknownOptionSuggestions = unknownOptionMatch && commandName ? dedupeStrings2([
4314
- ...getSemanticUnknownOptionSuggestions(commandName, unknownOptionMatch[1]),
4315
- ...suggestNearestLongFlags(unknownOptionMatch[1], collectKnownLongFlags(commandName))
4316
- ]) : void 0;
4317
- const unknownOptionOtherCommands = unknownOptionMatch ? findOtherCommandsForFlag(unknownOptionMatch[1], commandName) : [];
4318
- let suggestedRetryCommand;
4319
- if (unknownOptionMatch && unknownOptionSuggestions && unknownOptionSuggestions.length > 0) {
4320
- const rewritten = rewriteUnknownOptionArgv(invocationArgv, unknownOptionMatch[1], unknownOptionSuggestions[0]);
4321
- if (rewritten) {
4322
- suggestedRetryCommand = renderAttemptedCommand(rewritten);
4323
- }
4324
- }
4325
- if (!suggestedRetryCommand) {
4326
- const missingRequiredOption = message.match(/required option '([^']+)' not specified/i);
4327
- const requiredOptionToken = missingRequiredOption?.[1] ? trimTrailingPunctuationToken(firstWhitespaceSeparatedToken(missingRequiredOption[1].trim())) : void 0;
4328
- if (requiredOptionToken?.startsWith("--")) {
4329
- const hasFlag = invocationArgv.some((token) => token.startsWith(requiredOptionToken));
4330
- if (!hasFlag) {
4331
- suggestedRetryCommand = renderAttemptedCommand([...invocationArgv, requiredOptionToken, "<value>"]);
4332
- }
4333
- }
4334
- }
3721
+ const unknownOption = resolveUnknownOptionSuggestions(message, commandName);
3722
+ const suggestedRetryCommand = resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOption.match, unknownOption.suggestions) ?? resolveSuggestedRetryForMissingOption(message, invocationArgv);
4335
3723
  return {
4336
3724
  message,
4337
3725
  commandName,
@@ -4339,8 +3727,8 @@ async function resolveCommanderUsageContext(error, rootProgram, extensionDescrip
4339
3727
  attemptedCommand,
4340
3728
  normalizedInvocationArgs: [...invocationArgv],
4341
3729
  providedOptionFlags,
4342
- unknownOptionSuggestions,
4343
- unknownOptionOtherCommands: unknownOptionOtherCommands.length > 0 ? unknownOptionOtherCommands : void 0,
3730
+ unknownOptionSuggestions: unknownOption.suggestions,
3731
+ unknownOptionOtherCommands: unknownOption.otherCommands.length > 0 ? unknownOption.otherCommands : void 0,
4344
3732
  suggestedRetryCommand,
4345
3733
  ...unknownCommandGuidance
4346
3734
  };
@@ -4660,7 +4048,7 @@ function attachCreateUpdatePolicyHelpText(rootProgram, typeRegistry, argv) {
4660
4048
  !(function() {
4661
4049
  try {
4662
4050
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
4663
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "9f13a662-73c4-5ffa-99bc-4edee2b7a7fb");
4051
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "a367900b-1ec4-5110-9997-7f0a02e315c0");
4664
4052
  } catch (e2) {
4665
4053
  }
4666
4054
  })();
@@ -4705,10 +4093,10 @@ var EXPECTED_HANDLED_ERROR_EXIT_CODES = /* @__PURE__ */ new Set([
4705
4093
  EXIT_CODE.CONFLICT
4706
4094
  ]);
4707
4095
  var TRUE_LIKE_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
4708
- var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-MPANILQF.js"));
4709
- var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-KY6Z6WV7.js"));
4710
- var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-N6AYSKPM.js"));
4711
- var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-L6CYTOIH.js"));
4096
+ var loadSetupRegistrationModule = createLazyModule(() => import("./chunks/register-setup-ZCGKHDKL.js"));
4097
+ var loadListQueryRegistrationModule = createLazyModule(() => import("./chunks/register-list-query-XN4ZRHSV.js"));
4098
+ var loadMutationRegistrationModule = createLazyModule(() => import("./chunks/register-mutation-KRLAHEL2.js"));
4099
+ var loadOperationRegistrationModule = createLazyModule(() => import("./chunks/register-operations-4PASGJDB.js"));
4712
4100
  function describeUnknownError(error) {
4713
4101
  if (error instanceof PmCliError) {
4714
4102
  return error.message;
@@ -4754,6 +4142,57 @@ function inferMissingFieldsFromErrorMessage(message) {
4754
4142
  const normalized = [...new Set(matches.map((entry) => normalizeLongOptionFlag(entry) ?? entry))];
4755
4143
  return normalized.length > 0 ? normalized : void 0;
4756
4144
  }
4145
+ function inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery) {
4146
+ if (existingRecovery?.suggested_retry) {
4147
+ return void 0;
4148
+ }
4149
+ const providedFields = extractProvidedOptionFlags(invocationArgv);
4150
+ const providedSet = new Set(providedFields.map((flag) => normalizeLongOptionFlag(flag) ?? flag));
4151
+ const rawInferred = inferMissingFieldsFromErrorMessage(rawMessage);
4152
+ const trulyMissing = rawInferred?.filter((flag) => !providedSet.has(normalizeLongOptionFlag(flag) ?? flag));
4153
+ return trulyMissing && trulyMissing.length > 0 ? trulyMissing : void 0;
4154
+ }
4155
+ function resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferredMissing, existingRecovery) {
4156
+ if (existingRecovery?.suggested_retry) {
4157
+ return existingRecovery.suggested_retry;
4158
+ }
4159
+ const missingFlag = inferredMissing?.[0];
4160
+ const normalizedMissing = missingFlag ? normalizeLongOptionFlag(missingFlag) : void 0;
4161
+ const suggestedRetry = normalizedMissing ? renderAttemptedCommand3([...invocationArgv, normalizedMissing, "<value>"]) : attemptedCommand;
4162
+ return suggestedRetry === attemptedCommand ? void 0 : suggestedRetry;
4163
+ }
4164
+ function projectExistingRecoveryOptionalFields(existingRecovery) {
4165
+ if (!existingRecovery) {
4166
+ return {};
4167
+ }
4168
+ const optionalFields = [
4169
+ "recovery_mode",
4170
+ "missing_required_fields",
4171
+ "suggested_flags",
4172
+ "fallback_candidates",
4173
+ "next_best_command"
4174
+ ];
4175
+ const projected = {};
4176
+ for (const field of optionalFields) {
4177
+ const value = existingRecovery[field];
4178
+ if (value !== void 0 && value !== null) {
4179
+ projected[field] = value;
4180
+ }
4181
+ }
4182
+ return projected;
4183
+ }
4184
+ function buildRecoveryPayload(params) {
4185
+ const existingRecovery = params.existingRecovery;
4186
+ return {
4187
+ attempted_command: existingRecovery?.attempted_command ?? params.attemptedCommand,
4188
+ normalized_args: existingRecovery?.normalized_args ?? [...params.invocationArgv],
4189
+ /* c8 ignore next */
4190
+ provided_fields: existingRecovery?.provided_fields ?? (params.providedFields.length > 0 ? params.providedFields : void 0),
4191
+ missing: existingRecovery?.missing ?? params.inferredMissing,
4192
+ ...projectExistingRecoveryOptionalFields(existingRecovery),
4193
+ ...params.suggestedRetry ? { suggested_retry: params.suggestedRetry } : {}
4194
+ };
4195
+ }
4757
4196
  function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
4758
4197
  const explainRequested = invocationArgv.includes("--explain");
4759
4198
  const existingRecovery = context?.recovery;
@@ -4766,37 +4205,16 @@ function buildPmCliRecoveryContext(context, invocationArgv, rawMessage) {
4766
4205
  }
4767
4206
  const attemptedCommand = renderAttemptedCommand3(invocationArgv);
4768
4207
  const providedFields = extractProvidedOptionFlags(invocationArgv);
4769
- const providedSet = new Set(providedFields.map((flag) => normalizeLongOptionFlag(flag) ?? flag));
4770
- const rawInferred = existingRecovery?.suggested_retry ? void 0 : inferMissingFieldsFromErrorMessage(rawMessage);
4771
- const trulyMissing = rawInferred?.filter((flag) => !providedSet.has(normalizeLongOptionFlag(flag) ?? flag));
4772
- const inferredMissing = trulyMissing && trulyMissing.length > 0 ? trulyMissing : void 0;
4773
- let suggestedRetry = existingRecovery?.suggested_retry;
4774
- if (!suggestedRetry && inferredMissing && inferredMissing.length > 0) {
4775
- const missingFlag = inferredMissing[0];
4776
- const normalizedMissing = normalizeLongOptionFlag(missingFlag);
4777
- if (normalizedMissing) {
4778
- suggestedRetry = renderAttemptedCommand3([...invocationArgv, normalizedMissing, "<value>"]);
4779
- }
4780
- }
4781
- if (!suggestedRetry) {
4782
- suggestedRetry = attemptedCommand;
4783
- }
4784
- if (!existingRecovery?.suggested_retry && suggestedRetry === attemptedCommand) {
4785
- suggestedRetry = void 0;
4786
- }
4787
- const recovery = {
4788
- attempted_command: existingRecovery?.attempted_command ?? attemptedCommand,
4789
- normalized_args: existingRecovery?.normalized_args ?? [...invocationArgv],
4790
- /* c8 ignore next */
4791
- provided_fields: existingRecovery?.provided_fields ?? (providedFields.length > 0 ? providedFields : void 0),
4792
- missing: existingRecovery?.missing ?? inferredMissing,
4793
- ...existingRecovery?.recovery_mode ? { recovery_mode: existingRecovery.recovery_mode } : {},
4794
- ...existingRecovery?.missing_required_fields ? { missing_required_fields: existingRecovery.missing_required_fields } : {},
4795
- ...existingRecovery?.suggested_flags ? { suggested_flags: existingRecovery.suggested_flags } : {},
4796
- ...suggestedRetry ? { suggested_retry: suggestedRetry } : {},
4797
- ...existingRecovery?.fallback_candidates ? { fallback_candidates: existingRecovery.fallback_candidates } : {},
4798
- ...existingRecovery?.next_best_command ? { next_best_command: existingRecovery.next_best_command } : {}
4799
- };
4208
+ const inferredMissing = inferMissingFieldsForRecovery(rawMessage, invocationArgv, existingRecovery);
4209
+ const suggestedRetry = resolveRecoverySuggestedRetry(invocationArgv, attemptedCommand, inferredMissing, existingRecovery);
4210
+ const recovery = buildRecoveryPayload({
4211
+ invocationArgv,
4212
+ attemptedCommand,
4213
+ providedFields,
4214
+ inferredMissing,
4215
+ suggestedRetry,
4216
+ existingRecovery
4217
+ });
4800
4218
  return {
4801
4219
  ...context,
4802
4220
  recovery
@@ -5819,34 +5237,62 @@ function wrapProgramActionsForExtensionHandlers(rootProgram) {
5819
5237
  };
5820
5238
  visit(rootProgram);
5821
5239
  }
5240
+ async function clearDynamicExtensionCommandState(params) {
5241
+ activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5242
+ setActiveExtensionServices({ overrides: [] });
5243
+ if (params) {
5244
+ await maybeAttachCreateUpdatePolicyHelpText(params.rootProgram, params.pmRoot, params.invocationArgv, createEmptyExtensionRegistrationRegistry(), params.settings);
5245
+ }
5246
+ }
5247
+ function attachDynamicExtensionHelp(command, descriptor, flagHelp, metadataHelp) {
5248
+ if (descriptor?.flags && descriptor.flags.length > 0) {
5249
+ applyDynamicExtensionFlagOptions(command, descriptor.flags);
5250
+ const residualFlagHelp = buildResidualDynamicExtensionFlagHelp(command, descriptor.flags);
5251
+ if (residualFlagHelp) {
5252
+ command.addHelpText("after", residualFlagHelp);
5253
+ }
5254
+ } else if (flagHelp) {
5255
+ command.addHelpText("after", flagHelp);
5256
+ }
5257
+ if (metadataHelp) {
5258
+ command.addHelpText("after", metadataHelp);
5259
+ }
5260
+ }
5822
5261
  async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv) {
5823
5262
  const bootstrapGlobalOptions = parseBootstrapGlobalOptions(invocationArgv);
5824
5263
  const pmRoot = resolvePmRoot(process.cwd(), bootstrapGlobalOptions.path);
5825
5264
  if (bootstrapGlobalOptions.noExtensions) {
5826
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5827
- setActiveExtensionServices({ overrides: [] });
5828
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry());
5265
+ await clearDynamicExtensionCommandState({
5266
+ rootProgram,
5267
+ pmRoot,
5268
+ invocationArgv
5269
+ });
5829
5270
  return;
5830
5271
  }
5831
5272
  const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(pmRoot);
5832
5273
  const probe = buildBootstrapActivationProbe(invocationArgv);
5833
5274
  if (!discoverySnapshot) {
5834
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5835
- setActiveExtensionServices({ overrides: [] });
5275
+ await clearDynamicExtensionCommandState();
5836
5276
  return;
5837
5277
  }
5838
5278
  if (!discoveryNeedsActivationForProbe(discoverySnapshot.discovery, probe)) {
5839
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5840
- setActiveExtensionServices({ overrides: [] });
5841
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry(), discoverySnapshot.settings);
5279
+ await clearDynamicExtensionCommandState({
5280
+ rootProgram,
5281
+ pmRoot,
5282
+ invocationArgv,
5283
+ settings: discoverySnapshot.settings
5284
+ });
5842
5285
  emitExtensionSkippedProfile(bootstrapProfileEnabled(invocationArgv), discoverySnapshot, probe);
5843
5286
  return;
5844
5287
  }
5845
5288
  const snapshot = await loadRuntimeExtensionSnapshot(pmRoot);
5846
5289
  if (!snapshot) {
5847
- activeRuntimeExtensionCommandDescriptors = /* @__PURE__ */ new Map();
5848
- setActiveExtensionServices({ overrides: [] });
5849
- await maybeAttachCreateUpdatePolicyHelpText(rootProgram, pmRoot, invocationArgv, createEmptyExtensionRegistrationRegistry(), discoverySnapshot.settings);
5290
+ await clearDynamicExtensionCommandState({
5291
+ rootProgram,
5292
+ pmRoot,
5293
+ invocationArgv,
5294
+ settings: discoverySnapshot.settings
5295
+ });
5850
5296
  return;
5851
5297
  }
5852
5298
  setActiveExtensionServices(snapshot.services);
@@ -5863,18 +5309,7 @@ async function registerDynamicExtensionCommandPaths(rootProgram, invocationArgv)
5863
5309
  const flagHelp = snapshot.commandFlagHelp.get(commandPath);
5864
5310
  const metadataHelp = descriptor ? buildDynamicExtensionCommandMetadataHelp(descriptor) : null;
5865
5311
  if (existingCommand) {
5866
- if (descriptor?.flags && descriptor.flags.length > 0) {
5867
- applyDynamicExtensionFlagOptions(existingCommand, descriptor.flags);
5868
- const residualFlagHelp = buildResidualDynamicExtensionFlagHelp(existingCommand, descriptor.flags);
5869
- if (residualFlagHelp) {
5870
- existingCommand.addHelpText("after", residualFlagHelp);
5871
- }
5872
- } else if (flagHelp) {
5873
- existingCommand.addHelpText("after", flagHelp);
5874
- }
5875
- if (metadataHelp) {
5876
- existingCommand.addHelpText("after", metadataHelp);
5877
- }
5312
+ attachDynamicExtensionHelp(existingCommand, descriptor, flagHelp, metadataHelp);
5878
5313
  continue;
5879
5314
  }
5880
5315
  const dynamicCommand = ensureCommandPath(rootProgram, pathParts);
@@ -6297,6 +5732,308 @@ function enforceExplicitRetryForFlagTypos(bootstrapInvocation) {
6297
5732
  }
6298
5733
  });
6299
5734
  }
5735
+ function createTelemetryCommandErrorEmitter(params) {
5736
+ return async (event) => {
5737
+ const errorCategory = resolveTelemetryErrorCategory(event.errorCode);
5738
+ const commandResolution = deriveTelemetryCommandResolution({
5739
+ ok: false,
5740
+ errorCode: event.errorCode,
5741
+ errorCategory
5742
+ });
5743
+ await emitTelemetryErrorEvent({
5744
+ command: event.command,
5745
+ args: params.invocationArgv,
5746
+ options: event.options,
5747
+ global: params.bootstrapGlobal,
5748
+ pm_version: CLI_VERSION,
5749
+ pm_root: params.bootstrapPmRoot,
5750
+ error_code: event.errorCode,
5751
+ error_message: event.errorMessage,
5752
+ exit_code: event.exitCode,
5753
+ error_category: errorCategory,
5754
+ command_resolution: commandResolution,
5755
+ resolution_stage: event.resolutionStage
5756
+ });
5757
+ return {
5758
+ errorCategory,
5759
+ commandResolution
5760
+ };
5761
+ };
5762
+ }
5763
+ async function prepareExtensionServicesForRunPmCliError(params) {
5764
+ if (params.bootstrapGlobal.noExtensions) {
5765
+ return;
5766
+ }
5767
+ const bootstrapProbe = buildBootstrapActivationProbe(params.invocationArgv);
5768
+ const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(params.bootstrapPmRoot);
5769
+ if (discoverySnapshot && discoveryNeedsActivationForProbe(discoverySnapshot.discovery, bootstrapProbe)) {
5770
+ const bootstrapSnapshot = await loadRuntimeExtensionSnapshot(params.bootstrapPmRoot);
5771
+ setRecoveredExtensionServices(bootstrapSnapshot);
5772
+ return;
5773
+ }
5774
+ if (discoverySnapshot) {
5775
+ emitExtensionSkippedProfile(bootstrapProfileEnabled(params.invocationArgv), discoverySnapshot, bootstrapProbe);
5776
+ }
5777
+ setActiveExtensionServices({ overrides: [] });
5778
+ }
5779
+ function setRecoveredExtensionServices(bootstrapSnapshot) {
5780
+ if (!bootstrapSnapshot) {
5781
+ setActiveExtensionServices({ overrides: [] });
5782
+ return;
5783
+ }
5784
+ setActiveExtensionServices(bootstrapSnapshot.services);
5785
+ }
5786
+ async function finishRunPmCliFailure(params) {
5787
+ sentryFinishCommandSpan(false, params.errorMessage, {
5788
+ error_code: params.classificationCode,
5789
+ error_category: params.errorCategory,
5790
+ exit_code: params.exitCode,
5791
+ command_resolution: params.commandResolution,
5792
+ resolution_stage: params.resolutionStage
5793
+ });
5794
+ await runAndClearAfterCommandHooks({
5795
+ ok: false,
5796
+ error: params.errorMessage,
5797
+ exit_code: params.exitCode,
5798
+ error_code: params.classificationCode,
5799
+ error_category: params.errorCategory,
5800
+ command_resolution: params.commandResolution,
5801
+ resolution_stage: params.resolutionStage
5802
+ });
5803
+ }
5804
+ async function finishRunPmCliSuccessParse() {
5805
+ sentryFinishCommandSpan(true, void 0, {
5806
+ exit_code: EXIT_CODE.SUCCESS,
5807
+ command_resolution: "success",
5808
+ resolution_stage: "parse"
5809
+ });
5810
+ await runAndClearAfterCommandHooks({
5811
+ ok: true,
5812
+ exit_code: EXIT_CODE.SUCCESS,
5813
+ command_resolution: "success",
5814
+ resolution_stage: "parse"
5815
+ });
5816
+ process.exitCode = EXIT_CODE.SUCCESS;
5817
+ }
5818
+ async function handleRunPmCliKnownError(context, numericExitCode) {
5819
+ const hasExplicitExitCode = typeof numericExitCode === "number" && Number.isFinite(numericExitCode);
5820
+ if (!(context.error instanceof PmCliError) && (isCommanderError(context.error) || !hasExplicitExitCode)) {
5821
+ return false;
5822
+ }
5823
+ const errorMessage = describeUnknownError(context.error);
5824
+ const exitCode = context.error instanceof PmCliError ? context.error.exitCode : normalizeThrownExitCode(numericExitCode);
5825
+ const rawContext = context.error instanceof PmCliError ? context.error.context : void 0;
5826
+ const enrichedContext = buildPmCliRecoveryContext(rawContext, context.invocationArgv, errorMessage);
5827
+ const classification = classifyPmCliError(errorMessage, enrichedContext);
5828
+ const renderedError = context.jsonErrors ? JSON.stringify(formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext), null, 2) : formatPmCliErrorForDisplay(errorMessage, enrichedContext);
5829
+ printError(renderedError);
5830
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5831
+ command: context.attemptedCommand,
5832
+ errorCode: classification.code,
5833
+ errorMessage: classification.detail,
5834
+ exitCode,
5835
+ options: {
5836
+ bootstrap_global_options: context.bootstrapGlobal
5837
+ },
5838
+ resolutionStage: "execute"
5839
+ });
5840
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5841
+ command: context.attemptedCommand,
5842
+ error_code: classification.code,
5843
+ error_category: errorCategory,
5844
+ exit_code: exitCode,
5845
+ error_message: classification.detail,
5846
+ command_resolution: commandResolution,
5847
+ resolution_stage: "execute",
5848
+ source_context: activeTelemetryCommandContext?.source_context
5849
+ });
5850
+ await finishRunPmCliFailure({
5851
+ errorMessage,
5852
+ exitCode,
5853
+ classificationCode: classification.code,
5854
+ errorCategory,
5855
+ commandResolution,
5856
+ resolutionStage: "execute"
5857
+ });
5858
+ if (loggedHandledErrorToSentry) {
5859
+ sentryCaptureCliError(wrapThrownErrorForSentry(context.error, errorMessage));
5860
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5861
+ }
5862
+ process.exitCode = exitCode;
5863
+ return true;
5864
+ }
5865
+ function resolveUnknownHelpToken(invocationArgv) {
5866
+ const helpRequest = parseBootstrapHelpRequest(invocationArgv);
5867
+ return helpRequest.commandPathTokens[0] ?? parseBootstrapCommandName(invocationArgv) ?? "<command>";
5868
+ }
5869
+ async function handleUnknownHelpCommandError(context, code) {
5870
+ const unknownToken = resolveUnknownHelpToken(context.invocationArgv);
5871
+ const unknownMessage = `unknown command '${unknownToken}'`;
5872
+ const recoveryCommandDescriptors = await loadRuntimeExtensionCommandDescriptorsForRecovery(resolvePmRoot(process.cwd(), context.bootstrapGlobal.path));
5873
+ const usageContext = await resolveCommanderUsageContext({ message: unknownMessage }, program, recoveryCommandDescriptors);
5874
+ const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5875
+ unknownCommandExamples: usageContext.unknownCommandExamples,
5876
+ unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5877
+ attemptedCommand: usageContext.attemptedCommand,
5878
+ normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5879
+ providedOptionFlags: usageContext.providedOptionFlags,
5880
+ unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5881
+ suggestedRetryCommand: usageContext.suggestedRetryCommand
5882
+ });
5883
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5884
+ command: unknownToken,
5885
+ errorCode: classification.code,
5886
+ errorMessage: classification.detail,
5887
+ exitCode: EXIT_CODE.USAGE,
5888
+ options: {
5889
+ bootstrap_global_options: context.bootstrapGlobal,
5890
+ commander_code: code ?? "commander.helpDisplayed"
5891
+ },
5892
+ resolutionStage: "parse"
5893
+ });
5894
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5895
+ command: unknownToken,
5896
+ error_code: classification.code,
5897
+ error_category: errorCategory,
5898
+ exit_code: EXIT_CODE.USAGE,
5899
+ error_message: classification.detail,
5900
+ command_resolution: commandResolution,
5901
+ resolution_stage: "parse",
5902
+ source_context: activeTelemetryCommandContext?.source_context
5903
+ });
5904
+ const renderedUsage = context.jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors) : await formatCommanderUsageMessage({ message: unknownMessage }, program, recoveryCommandDescriptors);
5905
+ await finishRunPmCliFailure({
5906
+ errorMessage: unknownMessage,
5907
+ exitCode: EXIT_CODE.USAGE,
5908
+ classificationCode: classification.code,
5909
+ errorCategory,
5910
+ commandResolution,
5911
+ resolutionStage: "parse"
5912
+ });
5913
+ printError(renderedUsage);
5914
+ if (loggedHandledErrorToSentry) {
5915
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5916
+ }
5917
+ process.exitCode = EXIT_CODE.USAGE;
5918
+ }
5919
+ async function handleRunPmCliHelpDisplayError(context, code, rawMessage) {
5920
+ const isHelpDisplayCode = code === "commander.helpDisplayed" || code === "commander.help" || code === "commander.helpCommand";
5921
+ if (!isHelpDisplayCode && !rawMessage.includes("(outputHelp)")) {
5922
+ return false;
5923
+ }
5924
+ const helpRequest = parseBootstrapHelpRequest(context.invocationArgv);
5925
+ if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
5926
+ await handleUnknownHelpCommandError(context, code);
5927
+ return true;
5928
+ }
5929
+ await finishRunPmCliSuccessParse();
5930
+ return true;
5931
+ }
5932
+ async function handleRunPmCliCommanderUsageError(context, code) {
5933
+ const usageContext = await resolveCommanderUsageContext(context.error, program, activeRuntimeExtensionCommandDescriptors);
5934
+ const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
5935
+ unknownCommandExamples: usageContext.unknownCommandExamples,
5936
+ unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
5937
+ attemptedCommand: usageContext.attemptedCommand,
5938
+ normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
5939
+ providedOptionFlags: usageContext.providedOptionFlags,
5940
+ unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
5941
+ suggestedRetryCommand: usageContext.suggestedRetryCommand
5942
+ });
5943
+ const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
5944
+ command: context.attemptedCommand,
5945
+ errorCode: classification.code,
5946
+ errorMessage: classification.detail,
5947
+ exitCode: EXIT_CODE.USAGE,
5948
+ options: {
5949
+ bootstrap_global_options: context.bootstrapGlobal,
5950
+ commander_code: code
5951
+ },
5952
+ resolutionStage: "parse"
5953
+ });
5954
+ const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
5955
+ command: context.attemptedCommand,
5956
+ error_code: classification.code,
5957
+ error_category: errorCategory,
5958
+ exit_code: EXIT_CODE.USAGE,
5959
+ error_message: classification.detail,
5960
+ command_resolution: commandResolution,
5961
+ resolution_stage: "parse",
5962
+ source_context: activeTelemetryCommandContext?.source_context
5963
+ });
5964
+ const renderedUsage = context.jsonErrors ? await formatCommanderUsageJson(context.error, program, activeRuntimeExtensionCommandDescriptors) : await formatCommanderUsageMessage(context.error, program, activeRuntimeExtensionCommandDescriptors);
5965
+ await finishRunPmCliFailure({
5966
+ errorMessage: usageContext.message,
5967
+ exitCode: EXIT_CODE.USAGE,
5968
+ classificationCode: classification.code,
5969
+ errorCategory,
5970
+ commandResolution,
5971
+ resolutionStage: "parse"
5972
+ });
5973
+ printError(renderedUsage);
5974
+ if (loggedHandledErrorToSentry) {
5975
+ await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
5976
+ }
5977
+ process.exitCode = EXIT_CODE.USAGE;
5978
+ }
5979
+ function shouldHandleRunPmCliCommanderError(error) {
5980
+ if (typeof error !== "object" || error === null || !("code" in error)) {
5981
+ return false;
5982
+ }
5983
+ const code = error.code;
5984
+ if (typeof code === "string" && (code === "commander.version" || code.startsWith("commander."))) {
5985
+ return true;
5986
+ }
5987
+ const rawMessage = String(error.message ?? "");
5988
+ return rawMessage.includes("(outputHelp)");
5989
+ }
5990
+ async function handleRunPmCliCommanderError(context) {
5991
+ const code = context.error.code;
5992
+ const rawMessage = String(context.error.message ?? "");
5993
+ if (await handleRunPmCliHelpDisplayError(context, code, rawMessage)) {
5994
+ return;
5995
+ }
5996
+ if (code === "commander.version") {
5997
+ await finishRunPmCliSuccessParse();
5998
+ return;
5999
+ }
6000
+ await handleRunPmCliCommanderUsageError(context, code);
6001
+ }
6002
+ async function handleRunPmCliError(params) {
6003
+ const bootstrapGlobal = parseBootstrapGlobalOptions(params.invocationArgv);
6004
+ const bootstrapPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
6005
+ const context = {
6006
+ error: params.error,
6007
+ invocationArgv: params.invocationArgv,
6008
+ bootstrapGlobal,
6009
+ jsonErrors: bootstrapGlobal.json,
6010
+ bootstrapPmRoot,
6011
+ attemptedCommand: parseBootstrapCommandName(params.invocationArgv) ?? "<unknown>",
6012
+ emitTelemetryCommandError: createTelemetryCommandErrorEmitter({
6013
+ invocationArgv: params.invocationArgv,
6014
+ bootstrapGlobal,
6015
+ bootstrapPmRoot
6016
+ })
6017
+ };
6018
+ await prepareExtensionServicesForRunPmCliError({
6019
+ invocationArgv: params.invocationArgv,
6020
+ bootstrapGlobal,
6021
+ bootstrapPmRoot
6022
+ });
6023
+ if (await handleRunPmCliKnownError(context, readThrownExitCode(params.error))) {
6024
+ return;
6025
+ }
6026
+ if (shouldHandleRunPmCliCommanderError(params.error)) {
6027
+ await handleRunPmCliCommanderError(context);
6028
+ return;
6029
+ }
6030
+ await handleGenericRunPmCliError({
6031
+ error: params.error,
6032
+ attemptedCommand: context.attemptedCommand,
6033
+ bootstrapGlobal,
6034
+ emitTelemetryCommandError: context.emitTelemetryCommandError
6035
+ });
6036
+ }
6300
6037
  async function runPmCli(rawArgv = process.argv.slice(2)) {
6301
6038
  const bootstrapInvocation = normalizeBootstrapInvocation(rawArgv);
6302
6039
  const invocationArgv = bootstrapInvocation.argv;
@@ -6331,268 +6068,7 @@ async function runPmCli(rawArgv = process.argv.slice(2)) {
6331
6068
  }
6332
6069
  await program.parseAsync(invocationProcessArgv);
6333
6070
  } catch (error) {
6334
- const bootstrapGlobal = parseBootstrapGlobalOptions(invocationArgv);
6335
- const jsonErrors = bootstrapGlobal.json;
6336
- const bootstrapPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
6337
- const attemptedCommand = parseBootstrapCommandName(invocationArgv) ?? "<unknown>";
6338
- const emitTelemetryCommandError = async (params) => {
6339
- const errorCategory = resolveTelemetryErrorCategory(params.errorCode);
6340
- const commandResolution = deriveTelemetryCommandResolution({
6341
- ok: false,
6342
- errorCode: params.errorCode,
6343
- errorCategory
6344
- });
6345
- await emitTelemetryErrorEvent({
6346
- command: params.command,
6347
- args: invocationArgv,
6348
- options: params.options,
6349
- global: bootstrapGlobal,
6350
- pm_version: CLI_VERSION,
6351
- pm_root: bootstrapPmRoot,
6352
- error_code: params.errorCode,
6353
- error_message: params.errorMessage,
6354
- exit_code: params.exitCode,
6355
- error_category: errorCategory,
6356
- command_resolution: commandResolution,
6357
- resolution_stage: params.resolutionStage
6358
- });
6359
- return {
6360
- errorCategory,
6361
- commandResolution
6362
- };
6363
- };
6364
- if (!bootstrapGlobal.noExtensions) {
6365
- const bootstrapProbe = buildBootstrapActivationProbe(invocationArgv);
6366
- const discoverySnapshot = await loadRuntimeExtensionDiscoverySnapshot(bootstrapPmRoot);
6367
- if (discoverySnapshot && discoveryNeedsActivationForProbe(discoverySnapshot.discovery, bootstrapProbe)) {
6368
- const bootstrapSnapshot = await loadRuntimeExtensionSnapshot(bootstrapPmRoot);
6369
- setActiveExtensionServices(bootstrapSnapshot?.services ?? { overrides: [] });
6370
- } else {
6371
- if (discoverySnapshot) {
6372
- emitExtensionSkippedProfile(bootstrapProfileEnabled(invocationArgv), discoverySnapshot, bootstrapProbe);
6373
- }
6374
- setActiveExtensionServices({ overrides: [] });
6375
- }
6376
- }
6377
- const numericExitCode = readThrownExitCode(error);
6378
- if (error instanceof PmCliError || !isCommanderError(error) && typeof numericExitCode === "number" && Number.isFinite(numericExitCode)) {
6379
- const errorMessage = describeUnknownError(error);
6380
- const exitCode = error instanceof PmCliError ? error.exitCode : normalizeThrownExitCode(numericExitCode);
6381
- const context = error instanceof PmCliError ? error.context : void 0;
6382
- const enrichedContext = buildPmCliRecoveryContext(context, invocationArgv, errorMessage);
6383
- const classification = classifyPmCliError(errorMessage, enrichedContext);
6384
- const renderedError = jsonErrors ? JSON.stringify(formatPmCliErrorForJson(errorMessage, exitCode, enrichedContext), null, 2) : formatPmCliErrorForDisplay(errorMessage, enrichedContext);
6385
- printError(renderedError);
6386
- const { errorCategory, commandResolution } = await emitTelemetryCommandError({
6387
- command: attemptedCommand,
6388
- errorCode: classification.code,
6389
- errorMessage: classification.detail,
6390
- exitCode,
6391
- options: {
6392
- bootstrap_global_options: bootstrapGlobal
6393
- },
6394
- resolutionStage: "execute"
6395
- });
6396
- const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
6397
- command: attemptedCommand,
6398
- error_code: classification.code,
6399
- error_category: errorCategory,
6400
- exit_code: exitCode,
6401
- error_message: classification.detail,
6402
- command_resolution: commandResolution,
6403
- resolution_stage: "execute",
6404
- source_context: activeTelemetryCommandContext?.source_context
6405
- });
6406
- sentryFinishCommandSpan(false, errorMessage, {
6407
- error_code: classification.code,
6408
- error_category: errorCategory,
6409
- exit_code: exitCode,
6410
- command_resolution: commandResolution,
6411
- resolution_stage: "execute"
6412
- });
6413
- await runAndClearAfterCommandHooks({
6414
- ok: false,
6415
- error: errorMessage,
6416
- exit_code: exitCode,
6417
- error_code: classification.code,
6418
- error_category: errorCategory,
6419
- command_resolution: commandResolution,
6420
- resolution_stage: "execute"
6421
- });
6422
- if (loggedHandledErrorToSentry) {
6423
- sentryCaptureCliError(wrapThrownErrorForSentry(error, errorMessage));
6424
- }
6425
- if (loggedHandledErrorToSentry) {
6426
- await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
6427
- }
6428
- process.exitCode = exitCode;
6429
- return;
6430
- }
6431
- if (typeof error === "object" && error !== null && "code" in error) {
6432
- const code = error.code;
6433
- const rawMessage = typeof error.message === "string" ? error.message ?? "" : "";
6434
- const isHelpDisplayCode = code === "commander.helpDisplayed" || code === "commander.help" || code === "commander.helpCommand";
6435
- if (isHelpDisplayCode || rawMessage.includes("(outputHelp)")) {
6436
- const helpRequest = parseBootstrapHelpRequest(invocationArgv);
6437
- if (helpRequest.requested && !isKnownHelpCommandPath(program, helpRequest.commandPathTokens)) {
6438
- const unknownToken = helpRequest.commandPathTokens[0] ?? parseBootstrapCommandName(invocationArgv) ?? "<command>";
6439
- const unknownMessage = `unknown command '${unknownToken}'`;
6440
- const recoveryCommandDescriptors = await loadRuntimeExtensionCommandDescriptorsForRecovery(resolvePmRoot(process.cwd(), bootstrapGlobal.path));
6441
- const usageContext = await resolveCommanderUsageContext({ message: unknownMessage }, program, recoveryCommandDescriptors);
6442
- const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
6443
- unknownCommandExamples: usageContext.unknownCommandExamples,
6444
- unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
6445
- attemptedCommand: usageContext.attemptedCommand,
6446
- normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
6447
- providedOptionFlags: usageContext.providedOptionFlags,
6448
- unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
6449
- suggestedRetryCommand: usageContext.suggestedRetryCommand
6450
- });
6451
- const { errorCategory, commandResolution } = await emitTelemetryCommandError({
6452
- command: unknownToken,
6453
- errorCode: classification.code,
6454
- errorMessage: classification.detail,
6455
- exitCode: EXIT_CODE.USAGE,
6456
- options: {
6457
- bootstrap_global_options: bootstrapGlobal,
6458
- commander_code: code ?? "commander.helpDisplayed"
6459
- },
6460
- resolutionStage: "parse"
6461
- });
6462
- const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
6463
- command: unknownToken,
6464
- error_code: classification.code,
6465
- error_category: errorCategory,
6466
- exit_code: EXIT_CODE.USAGE,
6467
- error_message: classification.detail,
6468
- command_resolution: commandResolution,
6469
- resolution_stage: "parse",
6470
- source_context: activeTelemetryCommandContext?.source_context
6471
- });
6472
- const renderedUsage = jsonErrors ? await formatCommanderUsageJson({ message: unknownMessage }, program, recoveryCommandDescriptors) : await formatCommanderUsageMessage({ message: unknownMessage }, program, recoveryCommandDescriptors);
6473
- sentryFinishCommandSpan(false, unknownMessage, {
6474
- error_code: classification.code,
6475
- error_category: errorCategory,
6476
- exit_code: EXIT_CODE.USAGE,
6477
- command_resolution: commandResolution,
6478
- resolution_stage: "parse"
6479
- });
6480
- await runAndClearAfterCommandHooks({
6481
- ok: false,
6482
- error: unknownMessage,
6483
- exit_code: EXIT_CODE.USAGE,
6484
- error_code: classification.code,
6485
- error_category: errorCategory,
6486
- command_resolution: commandResolution,
6487
- resolution_stage: "parse"
6488
- });
6489
- if (jsonErrors) {
6490
- printError(renderedUsage);
6491
- } else {
6492
- printError(renderedUsage);
6493
- }
6494
- if (loggedHandledErrorToSentry) {
6495
- await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
6496
- }
6497
- process.exitCode = EXIT_CODE.USAGE;
6498
- return;
6499
- }
6500
- sentryFinishCommandSpan(true, void 0, {
6501
- exit_code: EXIT_CODE.SUCCESS,
6502
- command_resolution: "success",
6503
- resolution_stage: "parse"
6504
- });
6505
- await runAndClearAfterCommandHooks({
6506
- ok: true,
6507
- exit_code: EXIT_CODE.SUCCESS,
6508
- command_resolution: "success",
6509
- resolution_stage: "parse"
6510
- });
6511
- process.exitCode = EXIT_CODE.SUCCESS;
6512
- return;
6513
- }
6514
- if (code === "commander.version") {
6515
- sentryFinishCommandSpan(true, void 0, {
6516
- exit_code: EXIT_CODE.SUCCESS,
6517
- command_resolution: "success",
6518
- resolution_stage: "parse"
6519
- });
6520
- await runAndClearAfterCommandHooks({
6521
- ok: true,
6522
- exit_code: EXIT_CODE.SUCCESS,
6523
- command_resolution: "success",
6524
- resolution_stage: "parse"
6525
- });
6526
- process.exitCode = EXIT_CODE.SUCCESS;
6527
- return;
6528
- }
6529
- if (code?.startsWith("commander.")) {
6530
- const usageContext = await resolveCommanderUsageContext(error, program, activeRuntimeExtensionCommandDescriptors);
6531
- const classification = classifyCommanderError(usageContext.message, usageContext.commandName, usageContext.allowedTypes, {
6532
- unknownCommandExamples: usageContext.unknownCommandExamples,
6533
- unknownCommandNextSteps: usageContext.unknownCommandNextSteps,
6534
- attemptedCommand: usageContext.attemptedCommand,
6535
- normalizedInvocationArgs: usageContext.normalizedInvocationArgs,
6536
- providedOptionFlags: usageContext.providedOptionFlags,
6537
- unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
6538
- suggestedRetryCommand: usageContext.suggestedRetryCommand
6539
- });
6540
- const { errorCategory, commandResolution } = await emitTelemetryCommandError({
6541
- command: attemptedCommand,
6542
- errorCode: classification.code,
6543
- errorMessage: classification.detail,
6544
- exitCode: EXIT_CODE.USAGE,
6545
- options: {
6546
- bootstrap_global_options: bootstrapGlobal,
6547
- commander_code: code
6548
- },
6549
- resolutionStage: "parse"
6550
- });
6551
- const loggedHandledErrorToSentry = await maybeLogHandledCliErrorToSentry({
6552
- command: attemptedCommand,
6553
- error_code: classification.code,
6554
- error_category: errorCategory,
6555
- exit_code: EXIT_CODE.USAGE,
6556
- error_message: classification.detail,
6557
- command_resolution: commandResolution,
6558
- resolution_stage: "parse",
6559
- source_context: activeTelemetryCommandContext?.source_context
6560
- });
6561
- const renderedUsage = jsonErrors ? await formatCommanderUsageJson(error, program, activeRuntimeExtensionCommandDescriptors) : await formatCommanderUsageMessage(error, program, activeRuntimeExtensionCommandDescriptors);
6562
- sentryFinishCommandSpan(false, usageContext.message, {
6563
- error_code: classification.code,
6564
- error_category: errorCategory,
6565
- exit_code: EXIT_CODE.USAGE,
6566
- command_resolution: commandResolution,
6567
- resolution_stage: "parse"
6568
- });
6569
- await runAndClearAfterCommandHooks({
6570
- ok: false,
6571
- error: usageContext.message,
6572
- exit_code: EXIT_CODE.USAGE,
6573
- error_code: classification.code,
6574
- error_category: errorCategory,
6575
- command_resolution: commandResolution,
6576
- resolution_stage: "parse"
6577
- });
6578
- if (jsonErrors) {
6579
- printError(renderedUsage);
6580
- } else {
6581
- printError(renderedUsage);
6582
- }
6583
- if (loggedHandledErrorToSentry) {
6584
- await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
6585
- }
6586
- process.exitCode = EXIT_CODE.USAGE;
6587
- return;
6588
- }
6589
- }
6590
- await handleGenericRunPmCliError({
6591
- error,
6592
- attemptedCommand,
6593
- bootstrapGlobal,
6594
- emitTelemetryCommandError
6595
- });
6071
+ await handleRunPmCliError({ error, invocationArgv });
6596
6072
  }
6597
6073
  }
6598
6074
  var _testOnly = {
@@ -6631,6 +6107,12 @@ var _testOnly = {
6631
6107
  extensionProvidesTemplatesRuntime,
6632
6108
  hasAnyCapability,
6633
6109
  handleGenericRunPmCliError,
6110
+ handleRunPmCliCommanderError,
6111
+ handleRunPmCliError,
6112
+ handleRunPmCliHelpDisplayError,
6113
+ handleRunPmCliKnownError,
6114
+ handleRunPmCliCommanderUsageError,
6115
+ handleUnknownHelpCommandError,
6634
6116
  inferMissingFieldsFromErrorMessage,
6635
6117
  inferPostActionErrorCode,
6636
6118
  inferPostActionFailureMessage,
@@ -6647,12 +6129,14 @@ var _testOnly = {
6647
6129
  normalizeTelemetryResolutionStage,
6648
6130
  normalizeThrownExitCode,
6649
6131
  probeUsesAnyFlag,
6132
+ prepareExtensionServicesForRunPmCliError,
6650
6133
  readRecordBoolean,
6651
6134
  readRecordNumber,
6652
6135
  readRecordString,
6653
6136
  registerDynamicExtensionCommandPaths,
6654
6137
  registerRuntimeSchemaFieldFlags,
6655
6138
  resolveCoreCommandRegistrationSelection,
6139
+ resolveUnknownHelpToken,
6656
6140
  readThrownExitCode,
6657
6141
  runAndClearAfterCommandHooks,
6658
6142
  runRequiredExtensionCommand,
@@ -6660,8 +6144,10 @@ var _testOnly = {
6660
6144
  shouldLogHandledErrorToSentry,
6661
6145
  shouldRegisterDynamicExtensionPaths,
6662
6146
  shouldRegisterRuntimeSchemaFlags,
6147
+ shouldHandleRunPmCliCommanderError,
6663
6148
  setActiveExtensionHookContextForTest,
6664
6149
  setActiveRuntimeExtensionCommandDescriptorsForTest,
6150
+ setRecoveredExtensionServices,
6665
6151
  toLooseFieldDefinitionType,
6666
6152
  isImporterOrExporterCommandPath,
6667
6153
  validateDynamicExtensionCommandInvocation,