@unbrained/pm-cli 2026.7.5 → 2026.7.7

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 (597) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/cli/commands/annotation-command.d.ts +1 -0
  3. package/dist/cli/commands/annotation-command.js +29 -2
  4. package/dist/cli/commands/annotation-command.js.map +1 -1
  5. package/dist/cli/commands/comments.js +3 -4
  6. package/dist/cli/commands/comments.js.map +1 -1
  7. package/dist/cli/commands/extension/bundled-catalog.d.ts +3 -0
  8. package/dist/cli/commands/extension/bundled-catalog.js +38 -28
  9. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
  10. package/dist/cli/commands/extension/install-sources.js +81 -18
  11. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  12. package/dist/cli/commands/health.js +9 -5
  13. package/dist/cli/commands/health.js.map +1 -1
  14. package/dist/cli/commands/learnings.js +5 -3
  15. package/dist/cli/commands/learnings.js.map +1 -1
  16. package/dist/cli/commands/notes.js +5 -3
  17. package/dist/cli/commands/notes.js.map +1 -1
  18. package/dist/cli/commands/reindex.js +4 -3
  19. package/dist/cli/commands/reindex.js.map +1 -1
  20. package/dist/cli/commands/search.js +3 -3
  21. package/dist/cli/commands/search.js.map +1 -1
  22. package/dist/cli/commands/test.d.ts +9 -0
  23. package/dist/cli/commands/test.js +144 -105
  24. package/dist/cli/commands/test.js.map +1 -1
  25. package/dist/cli/extension-command-help.js +10 -2
  26. package/dist/cli/extension-command-help.js.map +1 -1
  27. package/dist/cli/register-list-query.d.ts +1 -1
  28. package/dist/cli/register-list-query.js +18 -27
  29. package/dist/cli/register-list-query.js.map +1 -1
  30. package/dist/cli/register-operations.d.ts +0 -8
  31. package/dist/cli/register-operations.js +41 -46
  32. package/dist/cli/register-operations.js.map +1 -1
  33. package/dist/cli/register-setup.js +113 -13
  34. package/dist/cli/register-setup.js.map +1 -1
  35. package/dist/cli/registration-helpers.d.ts +5 -1
  36. package/dist/cli/registration-helpers.js +14 -2
  37. package/dist/cli/registration-helpers.js.map +1 -1
  38. package/dist/cli-bundle/chunks/append-F7WPGIQL.js +11 -0
  39. package/dist/cli-bundle/chunks/{contracts-OJEXMKVW.js → append-PVCTBVJG.js} +8 -9
  40. package/dist/cli-bundle/chunks/{chunk-PPE4YUQM.js → chunk-2APXX4TZ.js} +17 -28
  41. package/dist/cli-bundle/chunks/chunk-2APXX4TZ.js.map +1 -0
  42. package/dist/cli-bundle/chunks/{docs-S6UTOTO5.js → chunk-2LEJGRQ7.js} +3 -12
  43. package/dist/cli-bundle/chunks/{docs-S6UTOTO5.js.map → chunk-2LEJGRQ7.js.map} +1 -1
  44. package/dist/cli-bundle/chunks/{chunk-T3ABIMGW.js → chunk-2TILG6F2.js} +3 -3
  45. package/dist/cli-bundle/chunks/{chunk-S5AYOUT5.js → chunk-3G6UMXT3.js} +6 -8
  46. package/dist/cli-bundle/chunks/{chunk-S5AYOUT5.js.map → chunk-3G6UMXT3.js.map} +1 -1
  47. package/dist/cli-bundle/chunks/{chunk-RCT3YJOK.js → chunk-3TYOW6RR.js} +8 -8
  48. package/dist/cli-bundle/chunks/{chunk-3JZNEQBA.js → chunk-3X542TEY.js} +7 -7
  49. package/dist/cli-bundle/chunks/{history-repair-EVTO6LIH.js → chunk-42LXP4VO.js} +14 -21
  50. package/dist/cli-bundle/chunks/{history-repair-EVTO6LIH.js.map → chunk-42LXP4VO.js.map} +1 -1
  51. package/dist/cli-bundle/chunks/{chunk-5J2XPTAD.js → chunk-43SIHQND.js} +36 -15
  52. package/dist/cli-bundle/chunks/chunk-43SIHQND.js.map +7 -0
  53. package/dist/cli-bundle/chunks/{history-repair-4N6SDVHK.js → chunk-43UQN754.js} +12 -19
  54. package/dist/cli-bundle/chunks/{history-repair-4N6SDVHK.js.map → chunk-43UQN754.js.map} +1 -1
  55. package/dist/cli-bundle/chunks/{chunk-OWTIRHX4.js → chunk-43YSKY75.js} +4 -6
  56. package/dist/cli-bundle/chunks/{chunk-OWTIRHX4.js.map → chunk-43YSKY75.js.map} +1 -1
  57. package/dist/cli-bundle/chunks/{notes-72YXN5JX.js → chunk-4BKDAEDF.js} +6 -13
  58. package/dist/cli-bundle/chunks/{notes-72YXN5JX.js.map → chunk-4BKDAEDF.js.map} +2 -2
  59. package/dist/cli-bundle/chunks/{close-many-AP4MWU36.js → chunk-4IQKDKGE.js} +18 -32
  60. package/dist/cli-bundle/chunks/{close-many-AP4MWU36.js.map → chunk-4IQKDKGE.js.map} +1 -1
  61. package/dist/cli-bundle/chunks/{chunk-ZCJAA3JK.js → chunk-4MZOKTI2.js} +6 -8
  62. package/dist/cli-bundle/chunks/{chunk-ZCJAA3JK.js.map → chunk-4MZOKTI2.js.map} +1 -1
  63. package/dist/cli-bundle/chunks/{chunk-IJ6CO3JV.js → chunk-52NS7JDP.js} +14 -20
  64. package/dist/cli-bundle/chunks/{chunk-IJ6CO3JV.js.map → chunk-52NS7JDP.js.map} +1 -1
  65. package/dist/cli-bundle/chunks/{chunk-T3F4DF23.js → chunk-565WYS5W.js} +12 -16
  66. package/dist/cli-bundle/chunks/{chunk-T3F4DF23.js.map → chunk-565WYS5W.js.map} +1 -1
  67. package/dist/cli-bundle/chunks/{copy-OTJOWFL6.js → chunk-5FIQ4EX3.js} +13 -19
  68. package/dist/cli-bundle/chunks/{copy-OTJOWFL6.js.map → chunk-5FIQ4EX3.js.map} +1 -1
  69. package/dist/cli-bundle/chunks/{config-V57QD47V.js → chunk-6G6O3OPQ.js} +259 -41
  70. package/dist/cli-bundle/chunks/chunk-6G6O3OPQ.js.map +1 -0
  71. package/dist/cli-bundle/chunks/{chunk-K3AGVXSF.js → chunk-6LCJRGPD.js} +9 -13
  72. package/dist/cli-bundle/chunks/{chunk-K3AGVXSF.js.map → chunk-6LCJRGPD.js.map} +1 -1
  73. package/dist/cli-bundle/chunks/{chunk-7MDXZAZS.js → chunk-6UQCNWFV.js} +6 -8
  74. package/dist/cli-bundle/chunks/{chunk-7MDXZAZS.js.map → chunk-6UQCNWFV.js.map} +1 -1
  75. package/dist/cli-bundle/chunks/{chunk-LEKT4K7I.js → chunk-6XTSYPPO.js} +1216 -387
  76. package/dist/cli-bundle/chunks/chunk-6XTSYPPO.js.map +7 -0
  77. package/dist/cli-bundle/chunks/chunk-7ML7JONU.js +5434 -0
  78. package/dist/cli-bundle/chunks/chunk-7ML7JONU.js.map +1 -0
  79. package/dist/cli-bundle/chunks/{chunk-TSPKZRRW.js → chunk-7PNQA24K.js} +30 -36
  80. package/dist/cli-bundle/chunks/{chunk-TSPKZRRW.js.map → chunk-7PNQA24K.js.map} +1 -1
  81. package/dist/cli-bundle/chunks/{chunk-YOF5VPKM.js → chunk-7VQ3JJN5.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-BFVHCAOO.js → chunk-7Y5N34HX.js} +8 -12
  83. package/dist/cli-bundle/chunks/{chunk-BFVHCAOO.js.map → chunk-7Y5N34HX.js.map} +1 -1
  84. package/dist/cli-bundle/chunks/{chunk-P5TFTLWW.js → chunk-AGAVEDIE.js} +7 -7
  85. package/dist/cli-bundle/chunks/{chunk-YFIE7YK6.js → chunk-AJUON7E6.js} +3 -3
  86. package/dist/cli-bundle/chunks/{close-many-OMZIGZB4.js → chunk-ARKHKYYS.js} +16 -30
  87. package/dist/cli-bundle/chunks/{close-many-OMZIGZB4.js.map → chunk-ARKHKYYS.js.map} +1 -1
  88. package/dist/cli-bundle/chunks/{chunk-7EQNAZX2.js → chunk-C5ACVMOI.js} +99 -51
  89. package/dist/cli-bundle/chunks/chunk-C5ACVMOI.js.map +7 -0
  90. package/dist/cli-bundle/chunks/{chunk-PJ3A56YF.js → chunk-CJQM7O7R.js} +16 -20
  91. package/dist/cli-bundle/chunks/{chunk-PJ3A56YF.js.map → chunk-CJQM7O7R.js.map} +1 -1
  92. package/dist/cli-bundle/chunks/{chunk-WISPVC2E.js → chunk-D2DCTFTL.js} +7 -9
  93. package/dist/cli-bundle/chunks/{chunk-WISPVC2E.js.map → chunk-D2DCTFTL.js.map} +1 -1
  94. package/dist/cli-bundle/chunks/{append-CZGUZ45Q.js → chunk-DDDWVPID.js} +7 -11
  95. package/dist/cli-bundle/chunks/{append-CZGUZ45Q.js.map → chunk-DDDWVPID.js.map} +1 -1
  96. package/dist/cli-bundle/chunks/{learnings-2HTPZNGZ.js → chunk-DG6BSXZ7.js} +6 -13
  97. package/dist/cli-bundle/chunks/{learnings-2HTPZNGZ.js.map → chunk-DG6BSXZ7.js.map} +2 -2
  98. package/dist/cli-bundle/chunks/{chunk-7WYXBPYQ.js → chunk-DR2V5OIV.js} +3 -3
  99. package/dist/cli-bundle/chunks/{chunk-YQMMMONE.js → chunk-E3LWJUGF.js} +4 -6
  100. package/dist/cli-bundle/chunks/{chunk-YQMMMONE.js.map → chunk-E3LWJUGF.js.map} +1 -1
  101. package/dist/cli-bundle/chunks/{chunk-D3UCE7RW.js → chunk-E3YQFSFE.js} +6 -10
  102. package/dist/cli-bundle/chunks/{chunk-D3UCE7RW.js.map → chunk-E3YQFSFE.js.map} +1 -1
  103. package/dist/cli-bundle/chunks/{chunk-PDXT6Q55.js → chunk-EDO7VXSO.js} +2 -2
  104. package/dist/cli-bundle/chunks/{chunk-FDBARR33.js → chunk-EIUBK2LT.js} +12 -18
  105. package/dist/cli-bundle/chunks/{chunk-FDBARR33.js.map → chunk-EIUBK2LT.js.map} +1 -1
  106. package/dist/cli-bundle/chunks/{chunk-HBYZDSK5.js → chunk-EMXPI36L.js} +14 -20
  107. package/dist/cli-bundle/chunks/{chunk-HBYZDSK5.js.map → chunk-EMXPI36L.js.map} +1 -1
  108. package/dist/cli-bundle/chunks/{chunk-4OFLJHX6.js → chunk-EOUVR7JN.js} +13 -8
  109. package/dist/cli-bundle/chunks/chunk-EOUVR7JN.js.map +1 -0
  110. package/dist/cli-bundle/chunks/{chunk-FUM6UMY4.js → chunk-EVEPHNXJ.js} +4 -4
  111. package/dist/cli-bundle/chunks/{deps-L2FPIAD3.js → chunk-F6MT7KKE.js} +6 -10
  112. package/dist/cli-bundle/chunks/{deps-L2FPIAD3.js.map → chunk-F6MT7KKE.js.map} +1 -1
  113. package/dist/cli-bundle/chunks/{chunk-FGQKEDE4.js → chunk-F6YC2A6X.js} +7 -11
  114. package/dist/cli-bundle/chunks/{chunk-FGQKEDE4.js.map → chunk-F6YC2A6X.js.map} +1 -1
  115. package/dist/cli-bundle/chunks/chunk-FILL6BB2.js +5514 -0
  116. package/dist/cli-bundle/chunks/chunk-FILL6BB2.js.map +7 -0
  117. package/dist/cli-bundle/chunks/{chunk-RX3HQSYG.js → chunk-FN6SB4HU.js} +2 -2
  118. package/dist/cli-bundle/chunks/chunk-GH73UOSJ.js +5359 -0
  119. package/dist/cli-bundle/chunks/chunk-GH73UOSJ.js.map +1 -0
  120. package/dist/cli-bundle/chunks/{chunk-JLA7EVYV.js → chunk-GLS6VMWI.js} +37 -16
  121. package/dist/cli-bundle/chunks/chunk-GLS6VMWI.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{files-JPU3FNJ7.js → chunk-GPIDUMMN.js} +10 -17
  123. package/dist/cli-bundle/chunks/{files-JPU3FNJ7.js.map → chunk-GPIDUMMN.js.map} +1 -1
  124. package/dist/cli-bundle/chunks/{history-compact-3F6VELO7.js → chunk-GTM5HQL4.js} +15 -21
  125. package/dist/cli-bundle/chunks/{history-compact-3F6VELO7.js.map → chunk-GTM5HQL4.js.map} +1 -1
  126. package/dist/cli-bundle/chunks/{chunk-DLQ4ZTCU.js → chunk-H2SMKL2N.js} +8 -8
  127. package/dist/cli-bundle/chunks/{chunk-S4APD35C.js → chunk-HHEWQXPD.js} +6 -6
  128. package/dist/cli-bundle/chunks/chunk-HHEWQXPD.js.map +7 -0
  129. package/dist/cli-bundle/chunks/{chunk-C3PMDWGX.js → chunk-HX6QXV5P.js} +2 -2
  130. package/dist/cli-bundle/chunks/{copy-LEE6P6EM.js → chunk-I74FMIWA.js} +11 -17
  131. package/dist/cli-bundle/chunks/{copy-LEE6P6EM.js.map → chunk-I74FMIWA.js.map} +1 -1
  132. package/dist/cli-bundle/chunks/chunk-IDIBF4E2.js +804 -0
  133. package/dist/cli-bundle/chunks/chunk-IDIBF4E2.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{comments-SAG5LSKL.js → chunk-II7R6KD4.js} +9 -13
  135. package/dist/cli-bundle/chunks/{comments-SAG5LSKL.js.map → chunk-II7R6KD4.js.map} +1 -1
  136. package/dist/cli-bundle/chunks/chunk-J2VGADNG.js +10320 -0
  137. package/dist/cli-bundle/chunks/chunk-J2VGADNG.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-Y76TWC45.js → chunk-J7BOLHAV.js} +5 -7
  139. package/dist/cli-bundle/chunks/{chunk-Y76TWC45.js.map → chunk-J7BOLHAV.js.map} +1 -1
  140. package/dist/cli-bundle/chunks/{chunk-QHZO65XW.js → chunk-KTGJ2CBU.js} +4 -6
  141. package/dist/cli-bundle/chunks/{chunk-QHZO65XW.js.map → chunk-KTGJ2CBU.js.map} +1 -1
  142. package/dist/cli-bundle/chunks/{chunk-5VVUKE3U.js → chunk-LCFJ7XAM.js} +32 -2
  143. package/dist/cli-bundle/chunks/{chunk-5VVUKE3U.js.map → chunk-LCFJ7XAM.js.map} +3 -3
  144. package/dist/cli-bundle/chunks/{chunk-YMABYTNG.js → chunk-LZQU6XJG.js} +28 -34
  145. package/dist/cli-bundle/chunks/{chunk-YMABYTNG.js.map → chunk-LZQU6XJG.js.map} +1 -1
  146. package/dist/cli-bundle/chunks/{chunk-3Y4OESPP.js → chunk-M62RO3XK.js} +10 -14
  147. package/dist/cli-bundle/chunks/{chunk-3Y4OESPP.js.map → chunk-M62RO3XK.js.map} +1 -1
  148. package/dist/cli-bundle/chunks/{chunk-YPPVU5GX.js → chunk-MCEUKJKW.js} +9 -11
  149. package/dist/cli-bundle/chunks/{chunk-YPPVU5GX.js.map → chunk-MCEUKJKW.js.map} +1 -1
  150. package/dist/cli-bundle/chunks/{chunk-T5Y3QSNF.js → chunk-MHNMCDWR.js} +1447 -86
  151. package/dist/cli-bundle/chunks/chunk-MHNMCDWR.js.map +1 -0
  152. package/dist/cli-bundle/chunks/{chunk-HJE4JTKQ.js → chunk-MRFWUSVA.js} +4 -6
  153. package/dist/cli-bundle/chunks/{chunk-HJE4JTKQ.js.map → chunk-MRFWUSVA.js.map} +1 -1
  154. package/dist/cli-bundle/chunks/{chunk-P3VRG72Q.js → chunk-N6ZHDLUY.js} +6 -8
  155. package/dist/cli-bundle/chunks/{chunk-P3VRG72Q.js.map → chunk-N6ZHDLUY.js.map} +1 -1
  156. package/dist/cli-bundle/chunks/{delete-HQKGRNRZ.js → chunk-NWWL22C7.js} +8 -12
  157. package/dist/cli-bundle/chunks/{delete-HQKGRNRZ.js.map → chunk-NWWL22C7.js.map} +1 -1
  158. package/dist/cli-bundle/chunks/{chunk-N6DNM2FA.js → chunk-P3MJJW7P.js} +2 -2
  159. package/dist/cli-bundle/chunks/{chunk-5JE6SMYS.js → chunk-PDXJXEZJ.js} +2 -2
  160. package/dist/cli-bundle/chunks/{append-NSQBCXZJ.js → chunk-Q64AYQYW.js} +9 -13
  161. package/dist/cli-bundle/chunks/{append-NSQBCXZJ.js.map → chunk-Q64AYQYW.js.map} +1 -1
  162. package/dist/cli-bundle/chunks/{update-many-SLLAMHT7.js → chunk-QDABF2RB.js} +26 -47
  163. package/dist/cli-bundle/chunks/{update-many-SLLAMHT7.js.map → chunk-QDABF2RB.js.map} +1 -1
  164. package/dist/cli-bundle/chunks/{chunk-NBFCNJ7Q.js → chunk-QFBSP3NI.js} +529 -46
  165. package/dist/cli-bundle/chunks/chunk-QFBSP3NI.js.map +1 -0
  166. package/dist/cli-bundle/chunks/{focus-LFZ6IDBR.js → chunk-RB3KLPAH.js} +11 -16
  167. package/dist/cli-bundle/chunks/{focus-LFZ6IDBR.js.map → chunk-RB3KLPAH.js.map} +1 -1
  168. package/dist/cli-bundle/chunks/{chunk-YSAH5FY5.js → chunk-RY7PTTUB.js} +94 -53
  169. package/dist/cli-bundle/chunks/chunk-RY7PTTUB.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{chunk-WVSGSZ6J.js → chunk-S547WBYG.js} +1477 -86
  171. package/dist/cli-bundle/chunks/chunk-S547WBYG.js.map +7 -0
  172. package/dist/cli-bundle/chunks/{update-many-DC7X3EWM.js → chunk-S5BNGFN5.js} +24 -45
  173. package/dist/cli-bundle/chunks/{update-many-DC7X3EWM.js.map → chunk-S5BNGFN5.js.map} +1 -1
  174. package/dist/cli-bundle/chunks/{focus-WNMYCVYA.js → chunk-S6VC2A2K.js} +9 -14
  175. package/dist/cli-bundle/chunks/{focus-WNMYCVYA.js.map → chunk-S6VC2A2K.js.map} +1 -1
  176. package/dist/cli-bundle/chunks/{learnings-YBIHY3D6.js → chunk-SIM5JDON.js} +7 -14
  177. package/dist/cli-bundle/chunks/{learnings-YBIHY3D6.js.map → chunk-SIM5JDON.js.map} +1 -1
  178. package/dist/cli-bundle/chunks/{chunk-ZD34OFFQ.js → chunk-SY75LYXR.js} +12 -7
  179. package/dist/cli-bundle/chunks/chunk-SY75LYXR.js.map +7 -0
  180. package/dist/cli-bundle/chunks/{chunk-TT42JUMF.js → chunk-TEISGNSH.js} +7 -7
  181. package/dist/cli-bundle/chunks/chunk-TEISGNSH.js.map +1 -0
  182. package/dist/cli-bundle/chunks/{chunk-AAEQMOC6.js → chunk-TEKZOS7M.js} +2 -2
  183. package/dist/cli-bundle/chunks/{chunk-4QQ6PM7M.js → chunk-TGUK6XN6.js} +14 -18
  184. package/dist/cli-bundle/chunks/{chunk-4QQ6PM7M.js.map → chunk-TGUK6XN6.js.map} +1 -1
  185. package/dist/cli-bundle/chunks/{plan-R4NDQ27E.js → chunk-TNC6MZUD.js} +10 -21
  186. package/dist/cli-bundle/chunks/{plan-R4NDQ27E.js.map → chunk-TNC6MZUD.js.map} +1 -1
  187. package/dist/cli-bundle/chunks/chunk-TZLYO4PP.js +10498 -0
  188. package/dist/cli-bundle/chunks/chunk-TZLYO4PP.js.map +7 -0
  189. package/dist/cli-bundle/chunks/{chunk-YD5FML7K.js → chunk-UO7XAZK6.js} +27 -4
  190. package/dist/cli-bundle/chunks/chunk-UO7XAZK6.js.map +1 -0
  191. package/dist/cli-bundle/chunks/{docs-6CRCSVKK.js → chunk-V5ZWKJNY.js} +5 -14
  192. package/dist/cli-bundle/chunks/{docs-6CRCSVKK.js.map → chunk-V5ZWKJNY.js.map} +1 -1
  193. package/dist/cli-bundle/chunks/{notes-NJ7IQJX4.js → chunk-VGO73OCK.js} +7 -14
  194. package/dist/cli-bundle/chunks/{notes-NJ7IQJX4.js.map → chunk-VGO73OCK.js.map} +1 -1
  195. package/dist/cli-bundle/chunks/{chunk-NER3KUUS.js → chunk-VLEA2UTQ.js} +2 -2
  196. package/dist/cli-bundle/chunks/{files-6P57MRKL.js → chunk-W5HXHC7C.js} +8 -15
  197. package/dist/cli-bundle/chunks/{files-6P57MRKL.js.map → chunk-W5HXHC7C.js.map} +1 -1
  198. package/dist/cli-bundle/chunks/{chunk-ZMD35NYG.js → chunk-WCWVEXGA.js} +2 -2
  199. package/dist/cli-bundle/chunks/chunk-X47MKQXU.js +6690 -0
  200. package/dist/cli-bundle/chunks/chunk-X47MKQXU.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{delete-62JQTYT4.js → chunk-XBX5CBRQ.js} +6 -10
  202. package/dist/cli-bundle/chunks/{delete-62JQTYT4.js.map → chunk-XBX5CBRQ.js.map} +1 -1
  203. package/dist/cli-bundle/chunks/{chunk-MTTXDAK4.js → chunk-XC3X7BQR.js} +541 -44
  204. package/dist/cli-bundle/chunks/chunk-XC3X7BQR.js.map +7 -0
  205. package/dist/cli-bundle/chunks/{history-compact-656Y2TN4.js → chunk-XHCVAZGM.js} +17 -23
  206. package/dist/cli-bundle/chunks/{history-compact-656Y2TN4.js.map → chunk-XHCVAZGM.js.map} +1 -1
  207. package/dist/cli-bundle/chunks/{chunk-ZAHXPXVY.js → chunk-XPMXPR7K.js} +7 -9
  208. package/dist/cli-bundle/chunks/{chunk-ZAHXPXVY.js.map → chunk-XPMXPR7K.js.map} +1 -1
  209. package/dist/cli-bundle/chunks/{deps-55FTG6Z5.js → chunk-XS2TMNXR.js} +8 -12
  210. package/dist/cli-bundle/chunks/{deps-55FTG6Z5.js.map → chunk-XS2TMNXR.js.map} +1 -1
  211. package/dist/cli-bundle/chunks/{plan-XWY5T67S.js → chunk-XXIYUTLK.js} +12 -23
  212. package/dist/cli-bundle/chunks/{plan-XWY5T67S.js.map → chunk-XXIYUTLK.js.map} +1 -1
  213. package/dist/cli-bundle/chunks/{chunk-7QH7DHUB.js → chunk-XZWL7VNE.js} +1220 -398
  214. package/dist/cli-bundle/chunks/chunk-XZWL7VNE.js.map +1 -0
  215. package/dist/cli-bundle/chunks/chunk-Y5IKRUEM.js +6624 -0
  216. package/dist/cli-bundle/chunks/chunk-Y5IKRUEM.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{chunk-ABRA3BHY.js → chunk-Y7KYVCZM.js} +12 -18
  218. package/dist/cli-bundle/chunks/{chunk-ABRA3BHY.js.map → chunk-Y7KYVCZM.js.map} +1 -1
  219. package/dist/cli-bundle/chunks/{chunk-UI5BJ6DO.js → chunk-YCVWWIKY.js} +17 -28
  220. package/dist/cli-bundle/chunks/chunk-YCVWWIKY.js.map +7 -0
  221. package/dist/cli-bundle/chunks/chunk-YH5NBDFA.js +780 -0
  222. package/dist/cli-bundle/chunks/chunk-YH5NBDFA.js.map +1 -0
  223. package/dist/cli-bundle/chunks/chunk-YNCFP5AR.js +5509 -0
  224. package/dist/cli-bundle/chunks/chunk-YNCFP5AR.js.map +7 -0
  225. package/dist/cli-bundle/chunks/{comments-MIW5MZOX.js → chunk-YPD7SQ5P.js} +8 -12
  226. package/dist/cli-bundle/chunks/{comments-MIW5MZOX.js.map → chunk-YPD7SQ5P.js.map} +2 -2
  227. package/dist/cli-bundle/chunks/{chunk-T35XLYZF.js → chunk-YPMZMKN7.js} +2 -2
  228. package/dist/cli-bundle/chunks/{chunk-R3ZBLGTC.js → chunk-YTD5GICJ.js} +4 -4
  229. package/dist/cli-bundle/chunks/{config-DJJKZB5R.js → chunk-ZNEG2UDO.js} +264 -39
  230. package/dist/cli-bundle/chunks/{config-DJJKZB5R.js.map → chunk-ZNEG2UDO.js.map} +4 -4
  231. package/dist/cli-bundle/chunks/{chunk-EEY54JMF.js → chunk-ZO7CLOY2.js} +3 -3
  232. package/dist/cli-bundle/chunks/{close-3YRR3XY6.js → close-3YYQ5OG2.js} +5 -9
  233. package/dist/cli-bundle/chunks/close-Z3Q4U7TS.js +12 -0
  234. package/dist/cli-bundle/chunks/close-many-3L2RXH3M.js +22 -0
  235. package/dist/cli-bundle/chunks/close-many-D366FTIG.js +26 -0
  236. package/dist/cli-bundle/chunks/comments-54XDJNFE.js +17 -0
  237. package/dist/cli-bundle/chunks/comments-HGHC2PN6.js +13 -0
  238. package/dist/cli-bundle/chunks/copy-44RT5GDW.js +13 -0
  239. package/dist/cli-bundle/chunks/copy-UGMUGHZA.js +9 -0
  240. package/dist/cli-bundle/chunks/{create-XWWQFQ6S.js → create-4GWJWPXG.js} +9 -14
  241. package/dist/cli-bundle/chunks/create-AZXCUYKP.js +25 -0
  242. package/dist/cli-bundle/chunks/delete-Y6SXIQ4X.js +10 -0
  243. package/dist/cli-bundle/chunks/delete-YQ2VPXNF.js +14 -0
  244. package/dist/cli-bundle/chunks/deps-BU5EBJDU.js +17 -0
  245. package/dist/cli-bundle/chunks/deps-FMANWFRP.js +13 -0
  246. package/dist/cli-bundle/chunks/docs-OQBSJNIA.js +18 -0
  247. package/dist/cli-bundle/chunks/docs-VNPBZXEL.js +14 -0
  248. package/dist/cli-bundle/chunks/files-72HZEBOE.js +18 -0
  249. package/dist/cli-bundle/chunks/{activity-YKAKZTZ4.js → files-HTSB2KJG.js} +13 -13
  250. package/dist/cli-bundle/chunks/focus-FOG4ALC2.js +14 -0
  251. package/dist/cli-bundle/chunks/focus-SUTMKXGX.js +10 -0
  252. package/dist/cli-bundle/chunks/history-compact-M6IFAMBP.js +25 -0
  253. package/dist/cli-bundle/chunks/history-compact-NEXRPP2O.js +21 -0
  254. package/dist/cli-bundle/chunks/{history-redact-54ICFKXM.js → history-redact-NQX3OGZP.js} +7 -11
  255. package/dist/cli-bundle/chunks/history-redact-WQJBZ3PX.js +17 -0
  256. package/dist/cli-bundle/chunks/history-repair-CBHMHAJO.js +19 -0
  257. package/dist/cli-bundle/chunks/history-repair-NHOJG7WO.js +23 -0
  258. package/dist/cli-bundle/chunks/learnings-M64NTSOR.js +13 -0
  259. package/dist/cli-bundle/chunks/learnings-T63JGKKN.js +17 -0
  260. package/dist/cli-bundle/chunks/notes-73WE2UV2.js +13 -0
  261. package/dist/cli-bundle/chunks/notes-U7L6HQQ2.js +17 -0
  262. package/dist/cli-bundle/chunks/plan-OSCNYFGC.js +24 -0
  263. package/dist/cli-bundle/chunks/plan-OSCNYFGC.js.map +7 -0
  264. package/dist/cli-bundle/chunks/plan-TN537L24.js +28 -0
  265. package/dist/cli-bundle/chunks/plan-TN537L24.js.map +1 -0
  266. package/dist/cli-bundle/chunks/profile-MHAMXMHQ.js +37 -0
  267. package/dist/cli-bundle/chunks/profile-MHAMXMHQ.js.map +1 -0
  268. package/dist/cli-bundle/chunks/profile-TIGLAKJ7.js +33 -0
  269. package/dist/cli-bundle/chunks/profile-TIGLAKJ7.js.map +7 -0
  270. package/dist/cli-bundle/chunks/{register-list-query-5H66WFYF.js → register-list-query-OHXD7G5N.js} +41 -33
  271. package/dist/cli-bundle/chunks/register-list-query-OHXD7G5N.js.map +7 -0
  272. package/dist/cli-bundle/chunks/{register-list-query-FB3FNDLZ.js → register-list-query-ZCRABAPN.js} +42 -34
  273. package/dist/cli-bundle/chunks/register-list-query-ZCRABAPN.js.map +1 -0
  274. package/dist/cli-bundle/chunks/{register-mutation-UJO23C7R.js → register-mutation-P3G4XP6Q.js} +36 -41
  275. package/dist/cli-bundle/chunks/{register-mutation-UJO23C7R.js.map → register-mutation-P3G4XP6Q.js.map} +1 -1
  276. package/dist/cli-bundle/chunks/{register-mutation-Z2ETYHKS.js → register-mutation-XX4H56PE.js} +34 -39
  277. package/dist/cli-bundle/chunks/{register-mutation-Z2ETYHKS.js.map → register-mutation-XX4H56PE.js.map} +1 -1
  278. package/dist/cli-bundle/chunks/{register-operations-A3XAM5J7.js → register-operations-V6PIYEDU.js} +80 -52
  279. package/dist/cli-bundle/chunks/register-operations-V6PIYEDU.js.map +1 -0
  280. package/dist/cli-bundle/chunks/{register-operations-SG7HBSUP.js → register-operations-V6VKTG54.js} +79 -51
  281. package/dist/cli-bundle/chunks/register-operations-V6VKTG54.js.map +7 -0
  282. package/dist/cli-bundle/chunks/{register-setup-K6U3NVY5.js → register-setup-6RVAWT6W.js} +129 -31
  283. package/dist/cli-bundle/chunks/register-setup-6RVAWT6W.js.map +7 -0
  284. package/dist/cli-bundle/chunks/{register-setup-I45OGJUV.js → register-setup-6YVUSQYD.js} +130 -32
  285. package/dist/cli-bundle/chunks/register-setup-6YVUSQYD.js.map +1 -0
  286. package/dist/cli-bundle/chunks/{restore-YJ2ET6AT.js → restore-HC3YSWF7.js} +7 -11
  287. package/dist/cli-bundle/chunks/restore-HC3YSWF7.js.map +1 -0
  288. package/dist/cli-bundle/chunks/restore-LFAMMRYZ.js +15 -0
  289. package/dist/cli-bundle/chunks/restore-LFAMMRYZ.js.map +7 -0
  290. package/dist/cli-bundle/chunks/{schema-2PUXCZ25.js → schema-DAGSYO6E.js} +6 -10
  291. package/dist/cli-bundle/chunks/schema-DAGSYO6E.js.map +7 -0
  292. package/dist/cli-bundle/chunks/{schema-Y6DXXK2F.js → schema-UBXJCQAC.js} +6 -10
  293. package/dist/cli-bundle/chunks/schema-UBXJCQAC.js.map +1 -0
  294. package/dist/cli-bundle/chunks/update-CJGG5WMV.js +21 -0
  295. package/dist/cli-bundle/chunks/update-CJGG5WMV.js.map +7 -0
  296. package/dist/cli-bundle/chunks/update-LKD64AFP.js +25 -0
  297. package/dist/cli-bundle/chunks/update-LKD64AFP.js.map +1 -0
  298. package/dist/cli-bundle/chunks/update-many-G4SM7BHC.js +31 -0
  299. package/dist/cli-bundle/chunks/update-many-G4SM7BHC.js.map +7 -0
  300. package/dist/cli-bundle/chunks/update-many-VLIV3D7R.js +35 -0
  301. package/dist/cli-bundle/chunks/update-many-VLIV3D7R.js.map +1 -0
  302. package/dist/cli-bundle/main.js +29 -31
  303. package/dist/cli-bundle/main.js.map +2 -2
  304. package/dist/cli-bundle/sdk-runtime.js +136 -54
  305. package/dist/cli-bundle/sdk-testing.js +7 -8
  306. package/dist/cli-bundle/sdk.js +132 -84
  307. package/dist/cli-bundle/sdk.js.map +2 -2
  308. package/dist/core/history/drift-scan.js +3 -8
  309. package/dist/core/history/drift-scan.js.map +1 -1
  310. package/dist/core/output/mutation-projection.js +11 -5
  311. package/dist/core/output/mutation-projection.js.map +1 -1
  312. package/dist/core/search/cache.js +3 -3
  313. package/dist/core/search/cache.js.map +1 -1
  314. package/dist/core/search/semantic-defaults.d.ts +2 -0
  315. package/dist/core/search/semantic-defaults.js +11 -4
  316. package/dist/core/search/semantic-defaults.js.map +1 -1
  317. package/dist/core/search/vector-stores.d.ts +1 -1
  318. package/dist/core/search/vector-stores.js +33 -7
  319. package/dist/core/search/vector-stores.js.map +1 -1
  320. package/dist/mcp/server.d.ts +22 -50
  321. package/dist/mcp/server.js +62 -916
  322. package/dist/mcp/server.js.map +1 -1
  323. package/dist/sdk/cli-contracts/flag-contracts.js +7 -7
  324. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  325. package/dist/sdk/cli-contracts/tool-schema.js +9 -7
  326. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  327. package/dist/sdk/index.d.ts +4 -2
  328. package/dist/sdk/index.js +4 -4
  329. package/dist/sdk/index.js.map +1 -1
  330. package/dist/sdk/runtime.d.ts +312 -5
  331. package/dist/sdk/runtime.js +1391 -26
  332. package/dist/sdk/runtime.js.map +1 -1
  333. package/dist/sdk/start-task-status.d.ts +13 -0
  334. package/dist/sdk/start-task-status.js +19 -0
  335. package/dist/sdk/start-task-status.js.map +1 -0
  336. package/dist/sdk/workspace-contracts-cache.d.ts +17 -0
  337. package/dist/sdk/workspace-contracts-cache.js +36 -0
  338. package/dist/sdk/workspace-contracts-cache.js.map +1 -0
  339. package/docs/COMMANDS.md +10 -1
  340. package/docs/RELEASING.md +3 -1
  341. package/docs/SDK.md +81 -0
  342. package/docs/TESTING.md +3 -0
  343. package/docs/examples/sdk-app-embedding/run-embedded-pm.mjs +16 -2
  344. package/docs/examples/sdk-contract-consumer/inspect-contracts.mjs +16 -1
  345. package/package.json +1 -1
  346. package/dist/cli-bundle/chunks/activity-4XQIDNM5.js +0 -18
  347. package/dist/cli-bundle/chunks/aggregate-EQX2RGB7.js +0 -375
  348. package/dist/cli-bundle/chunks/aggregate-EQX2RGB7.js.map +0 -7
  349. package/dist/cli-bundle/chunks/aggregate-PEGZGJXD.js +0 -372
  350. package/dist/cli-bundle/chunks/aggregate-PEGZGJXD.js.map +0 -1
  351. package/dist/cli-bundle/chunks/chunk-37E72CNS.js +0 -217
  352. package/dist/cli-bundle/chunks/chunk-37E72CNS.js.map +0 -1
  353. package/dist/cli-bundle/chunks/chunk-3PL6LEKP.js +0 -1961
  354. package/dist/cli-bundle/chunks/chunk-3PL6LEKP.js.map +0 -1
  355. package/dist/cli-bundle/chunks/chunk-3U3VEWK6.js +0 -1749
  356. package/dist/cli-bundle/chunks/chunk-3U3VEWK6.js.map +0 -7
  357. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js +0 -87
  358. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js.map +0 -7
  359. package/dist/cli-bundle/chunks/chunk-4LRVSBO6.js +0 -822
  360. package/dist/cli-bundle/chunks/chunk-4LRVSBO6.js.map +0 -7
  361. package/dist/cli-bundle/chunks/chunk-4OFLJHX6.js.map +0 -1
  362. package/dist/cli-bundle/chunks/chunk-53BTLLAF.js +0 -2181
  363. package/dist/cli-bundle/chunks/chunk-53BTLLAF.js.map +0 -1
  364. package/dist/cli-bundle/chunks/chunk-57C2RLW5.js +0 -1704
  365. package/dist/cli-bundle/chunks/chunk-57C2RLW5.js.map +0 -1
  366. package/dist/cli-bundle/chunks/chunk-5B3X4Y22.js +0 -2330
  367. package/dist/cli-bundle/chunks/chunk-5B3X4Y22.js.map +0 -7
  368. package/dist/cli-bundle/chunks/chunk-5J2XPTAD.js.map +0 -7
  369. package/dist/cli-bundle/chunks/chunk-5JZ7APJU.js +0 -995
  370. package/dist/cli-bundle/chunks/chunk-5JZ7APJU.js.map +0 -1
  371. package/dist/cli-bundle/chunks/chunk-75U6M5ZD.js +0 -819
  372. package/dist/cli-bundle/chunks/chunk-75U6M5ZD.js.map +0 -1
  373. package/dist/cli-bundle/chunks/chunk-7C2O74AE.js +0 -23
  374. package/dist/cli-bundle/chunks/chunk-7C2O74AE.js.map +0 -7
  375. package/dist/cli-bundle/chunks/chunk-7EQNAZX2.js.map +0 -7
  376. package/dist/cli-bundle/chunks/chunk-7QH7DHUB.js.map +0 -1
  377. package/dist/cli-bundle/chunks/chunk-BVEUCSH2.js +0 -530
  378. package/dist/cli-bundle/chunks/chunk-BVEUCSH2.js.map +0 -7
  379. package/dist/cli-bundle/chunks/chunk-DC3QJQWI.js +0 -275
  380. package/dist/cli-bundle/chunks/chunk-DC3QJQWI.js.map +0 -7
  381. package/dist/cli-bundle/chunks/chunk-DRBV5UC2.js +0 -231
  382. package/dist/cli-bundle/chunks/chunk-DRBV5UC2.js.map +0 -7
  383. package/dist/cli-bundle/chunks/chunk-E2FUG6GD.js +0 -2184
  384. package/dist/cli-bundle/chunks/chunk-E2FUG6GD.js.map +0 -7
  385. package/dist/cli-bundle/chunks/chunk-EZFKWSC7.js +0 -1615
  386. package/dist/cli-bundle/chunks/chunk-EZFKWSC7.js.map +0 -7
  387. package/dist/cli-bundle/chunks/chunk-FJRKQREY.js +0 -228
  388. package/dist/cli-bundle/chunks/chunk-FJRKQREY.js.map +0 -1
  389. package/dist/cli-bundle/chunks/chunk-GIWXVMZ3.js +0 -3237
  390. package/dist/cli-bundle/chunks/chunk-GIWXVMZ3.js.map +0 -7
  391. package/dist/cli-bundle/chunks/chunk-HK72NWAD.js +0 -1570
  392. package/dist/cli-bundle/chunks/chunk-HK72NWAD.js.map +0 -1
  393. package/dist/cli-bundle/chunks/chunk-JFCVQXZX.js +0 -3206
  394. package/dist/cli-bundle/chunks/chunk-JFCVQXZX.js.map +0 -1
  395. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js +0 -371
  396. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js.map +0 -7
  397. package/dist/cli-bundle/chunks/chunk-JLA7EVYV.js.map +0 -1
  398. package/dist/cli-bundle/chunks/chunk-K32L7HZO.js +0 -76
  399. package/dist/cli-bundle/chunks/chunk-K32L7HZO.js.map +0 -1
  400. package/dist/cli-bundle/chunks/chunk-KDZ6K25I.js +0 -79
  401. package/dist/cli-bundle/chunks/chunk-KDZ6K25I.js.map +0 -7
  402. package/dist/cli-bundle/chunks/chunk-KL22PY6L.js +0 -915
  403. package/dist/cli-bundle/chunks/chunk-KL22PY6L.js.map +0 -1
  404. package/dist/cli-bundle/chunks/chunk-KLG4ZULO.js +0 -218
  405. package/dist/cli-bundle/chunks/chunk-KLG4ZULO.js.map +0 -7
  406. package/dist/cli-bundle/chunks/chunk-LEKT4K7I.js.map +0 -7
  407. package/dist/cli-bundle/chunks/chunk-MNZ7DRNC.js +0 -1858
  408. package/dist/cli-bundle/chunks/chunk-MNZ7DRNC.js.map +0 -1
  409. package/dist/cli-bundle/chunks/chunk-MTTXDAK4.js.map +0 -7
  410. package/dist/cli-bundle/chunks/chunk-MZ7VNEVY.js +0 -520
  411. package/dist/cli-bundle/chunks/chunk-MZ7VNEVY.js.map +0 -1
  412. package/dist/cli-bundle/chunks/chunk-N7X4WP6L.js +0 -1041
  413. package/dist/cli-bundle/chunks/chunk-N7X4WP6L.js.map +0 -7
  414. package/dist/cli-bundle/chunks/chunk-NBFCNJ7Q.js.map +0 -1
  415. package/dist/cli-bundle/chunks/chunk-NNHHXJB2.js +0 -20
  416. package/dist/cli-bundle/chunks/chunk-NNHHXJB2.js.map +0 -1
  417. package/dist/cli-bundle/chunks/chunk-OBA2WH65.js +0 -918
  418. package/dist/cli-bundle/chunks/chunk-OBA2WH65.js.map +0 -7
  419. package/dist/cli-bundle/chunks/chunk-OESSOFJ4.js +0 -1985
  420. package/dist/cli-bundle/chunks/chunk-OESSOFJ4.js.map +0 -7
  421. package/dist/cli-bundle/chunks/chunk-OK5NXCZB.js +0 -238
  422. package/dist/cli-bundle/chunks/chunk-OK5NXCZB.js.map +0 -1
  423. package/dist/cli-bundle/chunks/chunk-P5YORJRH.js +0 -1977
  424. package/dist/cli-bundle/chunks/chunk-P5YORJRH.js.map +0 -7
  425. package/dist/cli-bundle/chunks/chunk-PPAJG4GB.js +0 -1031
  426. package/dist/cli-bundle/chunks/chunk-PPAJG4GB.js.map +0 -1
  427. package/dist/cli-bundle/chunks/chunk-PPE4YUQM.js.map +0 -1
  428. package/dist/cli-bundle/chunks/chunk-QZ342C63.js +0 -220
  429. package/dist/cli-bundle/chunks/chunk-QZ342C63.js.map +0 -7
  430. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js +0 -368
  431. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js.map +0 -1
  432. package/dist/cli-bundle/chunks/chunk-S4APD35C.js.map +0 -7
  433. package/dist/cli-bundle/chunks/chunk-STPSZ2XY.js +0 -1149
  434. package/dist/cli-bundle/chunks/chunk-STPSZ2XY.js.map +0 -1
  435. package/dist/cli-bundle/chunks/chunk-T4MX77AK.js +0 -272
  436. package/dist/cli-bundle/chunks/chunk-T4MX77AK.js.map +0 -1
  437. package/dist/cli-bundle/chunks/chunk-T5Y3QSNF.js.map +0 -1
  438. package/dist/cli-bundle/chunks/chunk-TT42JUMF.js.map +0 -1
  439. package/dist/cli-bundle/chunks/chunk-UHKX7I75.js +0 -165
  440. package/dist/cli-bundle/chunks/chunk-UHKX7I75.js.map +0 -1
  441. package/dist/cli-bundle/chunks/chunk-UI5BJ6DO.js.map +0 -7
  442. package/dist/cli-bundle/chunks/chunk-US3T3W5J.js +0 -1932
  443. package/dist/cli-bundle/chunks/chunk-US3T3W5J.js.map +0 -1
  444. package/dist/cli-bundle/chunks/chunk-UZRDBL6W.js +0 -175
  445. package/dist/cli-bundle/chunks/chunk-UZRDBL6W.js.map +0 -7
  446. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js +0 -84
  447. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js.map +0 -1
  448. package/dist/cli-bundle/chunks/chunk-VZIYHZDX.js +0 -1868
  449. package/dist/cli-bundle/chunks/chunk-VZIYHZDX.js.map +0 -7
  450. package/dist/cli-bundle/chunks/chunk-WVSGSZ6J.js.map +0 -7
  451. package/dist/cli-bundle/chunks/chunk-XQCG2JGW.js +0 -1152
  452. package/dist/cli-bundle/chunks/chunk-XQCG2JGW.js.map +0 -7
  453. package/dist/cli-bundle/chunks/chunk-YD5FML7K.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-YSAH5FY5.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-YZIR4R3U.js +0 -1005
  456. package/dist/cli-bundle/chunks/chunk-YZIR4R3U.js.map +0 -7
  457. package/dist/cli-bundle/chunks/chunk-Z2CRRZYF.js +0 -215
  458. package/dist/cli-bundle/chunks/chunk-Z2CRRZYF.js.map +0 -1
  459. package/dist/cli-bundle/chunks/chunk-ZD34OFFQ.js.map +0 -7
  460. package/dist/cli-bundle/chunks/chunk-ZJB3UV5U.js +0 -2306
  461. package/dist/cli-bundle/chunks/chunk-ZJB3UV5U.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-ZVDL32GJ.js +0 -241
  463. package/dist/cli-bundle/chunks/chunk-ZVDL32GJ.js.map +0 -7
  464. package/dist/cli-bundle/chunks/claim-4DROPSIS.js +0 -144
  465. package/dist/cli-bundle/chunks/claim-4DROPSIS.js.map +0 -1
  466. package/dist/cli-bundle/chunks/claim-VX54TV5U.js +0 -147
  467. package/dist/cli-bundle/chunks/claim-VX54TV5U.js.map +0 -7
  468. package/dist/cli-bundle/chunks/close-OB2Y4QP5.js +0 -16
  469. package/dist/cli-bundle/chunks/config-V57QD47V.js.map +0 -1
  470. package/dist/cli-bundle/chunks/context-4OQGIPSO.js +0 -45
  471. package/dist/cli-bundle/chunks/context-WLA6IAWE.js +0 -49
  472. package/dist/cli-bundle/chunks/contracts-HXJLKCRI.js +0 -12
  473. package/dist/cli-bundle/chunks/create-WKOZKPQR.js +0 -30
  474. package/dist/cli-bundle/chunks/eval-N6UHFWVO.js +0 -288
  475. package/dist/cli-bundle/chunks/eval-N6UHFWVO.js.map +0 -7
  476. package/dist/cli-bundle/chunks/eval-PHOTWYHI.js +0 -278
  477. package/dist/cli-bundle/chunks/eval-PHOTWYHI.js.map +0 -1
  478. package/dist/cli-bundle/chunks/extension-NBAH62ML.js +0 -40
  479. package/dist/cli-bundle/chunks/extension-ZF6ZZPOU.js +0 -44
  480. package/dist/cli-bundle/chunks/gc-AETFKZ44.js +0 -398
  481. package/dist/cli-bundle/chunks/gc-AETFKZ44.js.map +0 -7
  482. package/dist/cli-bundle/chunks/gc-RLBP4QVN.js +0 -388
  483. package/dist/cli-bundle/chunks/gc-RLBP4QVN.js.map +0 -1
  484. package/dist/cli-bundle/chunks/get-NH2MPBCI.js +0 -283
  485. package/dist/cli-bundle/chunks/get-NH2MPBCI.js.map +0 -1
  486. package/dist/cli-bundle/chunks/get-P4ZQXCPZ.js +0 -286
  487. package/dist/cli-bundle/chunks/get-P4ZQXCPZ.js.map +0 -7
  488. package/dist/cli-bundle/chunks/health-3GVPMQBL.js +0 -1612
  489. package/dist/cli-bundle/chunks/health-3GVPMQBL.js.map +0 -1
  490. package/dist/cli-bundle/chunks/health-DNTM72GJ.js +0 -1615
  491. package/dist/cli-bundle/chunks/health-DNTM72GJ.js.map +0 -7
  492. package/dist/cli-bundle/chunks/history-RYKLC72X.js +0 -20
  493. package/dist/cli-bundle/chunks/history-SGPYRAFT.js +0 -24
  494. package/dist/cli-bundle/chunks/history-redact-4H3FCKF3.js +0 -21
  495. package/dist/cli-bundle/chunks/init-RPIPQUNV.js +0 -32
  496. package/dist/cli-bundle/chunks/init-SKQAESQS.js +0 -28
  497. package/dist/cli-bundle/chunks/list-64LHZ3HM.js +0 -32
  498. package/dist/cli-bundle/chunks/list-7LXBTEKI.js +0 -36
  499. package/dist/cli-bundle/chunks/next-7ODPAQ4U.js +0 -306
  500. package/dist/cli-bundle/chunks/next-7ODPAQ4U.js.map +0 -7
  501. package/dist/cli-bundle/chunks/next-ODJUM4ZM.js +0 -303
  502. package/dist/cli-bundle/chunks/next-ODJUM4ZM.js.map +0 -1
  503. package/dist/cli-bundle/chunks/profile-XQWEQKS3.js +0 -397
  504. package/dist/cli-bundle/chunks/profile-XQWEQKS3.js.map +0 -1
  505. package/dist/cli-bundle/chunks/profile-YRDHLMRO.js +0 -400
  506. package/dist/cli-bundle/chunks/profile-YRDHLMRO.js.map +0 -7
  507. package/dist/cli-bundle/chunks/register-list-query-5H66WFYF.js.map +0 -7
  508. package/dist/cli-bundle/chunks/register-list-query-FB3FNDLZ.js.map +0 -1
  509. package/dist/cli-bundle/chunks/register-operations-A3XAM5J7.js.map +0 -1
  510. package/dist/cli-bundle/chunks/register-operations-SG7HBSUP.js.map +0 -7
  511. package/dist/cli-bundle/chunks/register-setup-I45OGJUV.js.map +0 -1
  512. package/dist/cli-bundle/chunks/register-setup-K6U3NVY5.js.map +0 -7
  513. package/dist/cli-bundle/chunks/restore-PXOFL6AM.js +0 -19
  514. package/dist/cli-bundle/chunks/scheduling-shortcuts-SSC4MYWQ.js +0 -91
  515. package/dist/cli-bundle/chunks/scheduling-shortcuts-SSC4MYWQ.js.map +0 -7
  516. package/dist/cli-bundle/chunks/scheduling-shortcuts-ULRG7MNP.js +0 -88
  517. package/dist/cli-bundle/chunks/scheduling-shortcuts-ULRG7MNP.js.map +0 -1
  518. package/dist/cli-bundle/chunks/search-3S72CTD6.js +0 -38
  519. package/dist/cli-bundle/chunks/search-WNUNBQXO.js +0 -34
  520. package/dist/cli-bundle/chunks/stats-IJYTRQGV.js +0 -250
  521. package/dist/cli-bundle/chunks/stats-IJYTRQGV.js.map +0 -7
  522. package/dist/cli-bundle/chunks/stats-L2D5Y2O5.js +0 -240
  523. package/dist/cli-bundle/chunks/stats-L2D5Y2O5.js.map +0 -1
  524. package/dist/cli-bundle/chunks/telemetry-L2CVOKVN.js +0 -309
  525. package/dist/cli-bundle/chunks/telemetry-L2CVOKVN.js.map +0 -7
  526. package/dist/cli-bundle/chunks/telemetry-QBYWQA76.js +0 -306
  527. package/dist/cli-bundle/chunks/telemetry-QBYWQA76.js.map +0 -1
  528. package/dist/cli-bundle/chunks/test-DQ2QFJ7W.js +0 -45
  529. package/dist/cli-bundle/chunks/test-W7QBLVJS.js +0 -41
  530. package/dist/cli-bundle/chunks/test-all-636NTRTT.js +0 -434
  531. package/dist/cli-bundle/chunks/test-all-636NTRTT.js.map +0 -1
  532. package/dist/cli-bundle/chunks/test-all-DWYK3RG6.js +0 -437
  533. package/dist/cli-bundle/chunks/test-all-DWYK3RG6.js.map +0 -7
  534. package/dist/cli-bundle/chunks/test-runs-245OINZR.js +0 -28
  535. package/dist/cli-bundle/chunks/test-runs-ZRD4GCTT.js +0 -24
  536. package/dist/cli-bundle/chunks/update-SFLZPJXX.js +0 -30
  537. package/dist/cli-bundle/chunks/update-SJZ6S77U.js +0 -26
  538. package/dist/cli-bundle/chunks/upgrade-HFFXLZJA.js +0 -290
  539. package/dist/cli-bundle/chunks/upgrade-HFFXLZJA.js.map +0 -7
  540. package/dist/cli-bundle/chunks/upgrade-UYQKM7RF.js +0 -287
  541. package/dist/cli-bundle/chunks/upgrade-UYQKM7RF.js.map +0 -1
  542. package/dist/cli-bundle/chunks/validate-PA4FDTOV.js +0 -2143
  543. package/dist/cli-bundle/chunks/validate-PA4FDTOV.js.map +0 -7
  544. package/dist/cli-bundle/chunks/validate-Z7L75YEJ.js +0 -2105
  545. package/dist/cli-bundle/chunks/validate-Z7L75YEJ.js.map +0 -1
  546. /package/dist/cli-bundle/chunks/{activity-4XQIDNM5.js.map → append-F7WPGIQL.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{activity-YKAKZTZ4.js.map → append-PVCTBVJG.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-T3ABIMGW.js.map → chunk-2TILG6F2.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-RCT3YJOK.js.map → chunk-3TYOW6RR.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-3JZNEQBA.js.map → chunk-3X542TEY.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-YOF5VPKM.js.map → chunk-7VQ3JJN5.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-P5TFTLWW.js.map → chunk-AGAVEDIE.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-YFIE7YK6.js.map → chunk-AJUON7E6.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-7WYXBPYQ.js.map → chunk-DR2V5OIV.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-PDXT6Q55.js.map → chunk-EDO7VXSO.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-FUM6UMY4.js.map → chunk-EVEPHNXJ.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-RX3HQSYG.js.map → chunk-FN6SB4HU.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-DLQ4ZTCU.js.map → chunk-H2SMKL2N.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-C3PMDWGX.js.map → chunk-HX6QXV5P.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-N6DNM2FA.js.map → chunk-P3MJJW7P.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-5JE6SMYS.js.map → chunk-PDXJXEZJ.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-AAEQMOC6.js.map → chunk-TEKZOS7M.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-NER3KUUS.js.map → chunk-VLEA2UTQ.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-ZMD35NYG.js.map → chunk-WCWVEXGA.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-T35XLYZF.js.map → chunk-YPMZMKN7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-R3ZBLGTC.js.map → chunk-YTD5GICJ.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-EEY54JMF.js.map → chunk-ZO7CLOY2.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{close-3YRR3XY6.js.map → close-3YYQ5OG2.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{close-OB2Y4QP5.js.map → close-Z3Q4U7TS.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{context-4OQGIPSO.js.map → close-many-3L2RXH3M.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{context-WLA6IAWE.js.map → close-many-D366FTIG.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{contracts-OJEXMKVW.js.map → comments-54XDJNFE.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{contracts-HXJLKCRI.js.map → comments-HGHC2PN6.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{create-XWWQFQ6S.js.map → copy-44RT5GDW.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{create-WKOZKPQR.js.map → copy-UGMUGHZA.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{extension-ZF6ZZPOU.js.map → create-4GWJWPXG.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{extension-NBAH62ML.js.map → create-AZXCUYKP.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{history-RYKLC72X.js.map → delete-Y6SXIQ4X.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{history-SGPYRAFT.js.map → delete-YQ2VPXNF.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{history-redact-54ICFKXM.js.map → deps-BU5EBJDU.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{history-redact-4H3FCKF3.js.map → deps-FMANWFRP.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{init-RPIPQUNV.js.map → docs-OQBSJNIA.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{init-SKQAESQS.js.map → docs-VNPBZXEL.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{list-64LHZ3HM.js.map → files-72HZEBOE.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{list-7LXBTEKI.js.map → files-HTSB2KJG.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{restore-YJ2ET6AT.js.map → focus-FOG4ALC2.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{restore-PXOFL6AM.js.map → focus-SUTMKXGX.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{schema-Y6DXXK2F.js.map → history-compact-M6IFAMBP.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{schema-2PUXCZ25.js.map → history-compact-NEXRPP2O.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{search-3S72CTD6.js.map → history-redact-NQX3OGZP.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{search-WNUNBQXO.js.map → history-redact-WQJBZ3PX.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{test-W7QBLVJS.js.map → history-repair-CBHMHAJO.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{test-DQ2QFJ7W.js.map → history-repair-NHOJG7WO.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{test-runs-ZRD4GCTT.js.map → learnings-M64NTSOR.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{test-runs-245OINZR.js.map → learnings-T63JGKKN.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{update-SJZ6S77U.js.map → notes-73WE2UV2.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{update-SFLZPJXX.js.map → notes-U7L6HQQ2.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../../cli/commands/context.ts"],"sourcesContent":["/**\n * @module cli/commands/context\n *\n * Implements the pm context command surface and its agent-facing runtime behavior.\n */\nimport { SETTINGS_DEFAULTS, EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { compareTimestampStrings, nowIso } from \"../../core/shared/time.js\";\nimport { isTerminalStatus, normalizeStatusForRegistry, normalizeStatusInput } from \"../../core/item/status.js\";\nimport { resolveRuntimeStatusRegistry, type RuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type {\n ContextDepth,\n ContextSectionName,\n ContextSettings,\n ItemFrontMatter,\n ItemStatus,\n PmSettings,\n} from \"../../types/index.js\";\nimport { CONTEXT_DEPTH_VALUES, CONTEXT_SECTION_VALUES } from \"../../types/index.js\";\nimport { parseIntegerLimit } from \"../shared-parsers.js\";\nimport { runCalendar, type CalendarOptions, type CalendarRow } from \"./calendar.js\";\nimport { runList, type ListOptions } from \"./list.js\";\nimport { runActivity, type CompactActivityEntry } from \"./activity.js\";\n\n// ---------------------------------------------------------------------------\n// Output format\n// ---------------------------------------------------------------------------\n\nexport const CONTEXT_OUTPUT_VALUES = [\"markdown\", \"toon\", \"json\"] as const;\n/**\n * Restricts context output format values accepted by command, SDK, and storage contracts.\n */\nexport type ContextOutputFormat = (typeof CONTEXT_OUTPUT_VALUES)[number];\n\n// ---------------------------------------------------------------------------\n// Options\n// ---------------------------------------------------------------------------\n\n/**\n * Documents the context options payload exchanged by command, SDK, and package integrations.\n */\nexport interface ContextOptions {\n date?: string;\n from?: string;\n to?: string;\n past?: boolean;\n type?: string;\n tag?: string;\n priority?: string;\n assignee?: string;\n assigneeFilter?: string;\n sprint?: string;\n release?: string;\n limit?: string;\n format?: string;\n depth?: string;\n fields?: string;\n section?: string[];\n activityLimit?: string;\n staleThreshold?: string;\n parent?: string;\n [key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Focus item (unchanged from original)\n// ---------------------------------------------------------------------------\n\n/**\n * Documents the context focus item payload exchanged by command, SDK, and package integrations.\n */\nexport interface ContextFocusItem {\n id: string;\n title: string;\n type: string;\n status: ItemStatus;\n priority: number;\n order: number | null;\n deadline: string | null;\n assignee: string | null;\n tags: string[];\n updated_at: string;\n parent: string | null;\n children_total?: number;\n children_closed?: number;\n completion_pct?: number;\n}\n\n// ---------------------------------------------------------------------------\n// Section data types\n// ---------------------------------------------------------------------------\n\n/**\n * Documents the hierarchy child payload exchanged by command, SDK, and package integrations.\n */\nexport interface HierarchyChild {\n id: string;\n title: string;\n type: string;\n status: ItemStatus;\n children_total: number;\n children_closed: number;\n}\n\n/**\n * Documents the hierarchy node payload exchanged by command, SDK, and package integrations.\n */\nexport interface HierarchyNode {\n id: string;\n title: string;\n type: string;\n status: ItemStatus;\n children_total: number;\n children_closed: number;\n children_open: number;\n children_in_progress: number;\n children_blocked: number;\n children: HierarchyChild[];\n}\n\n/**\n * Documents the progress entry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ProgressEntry {\n id: string;\n title: string;\n type: string;\n total: number;\n closed: number;\n open: number;\n in_progress: number;\n blocked: number;\n completion_pct: number;\n}\n\n/**\n * Documents the blocker entry payload exchanged by command, SDK, and package integrations.\n */\nexport interface BlockerEntry {\n id: string;\n title: string;\n blocked_by: string | null;\n blocked_by_title: string | null;\n blocked_by_status: ItemStatus | null;\n blocked_reason: string | null;\n unblock_note: string | null;\n}\n\n/**\n * Documents the hot file payload exchanged by command, SDK, and package integrations.\n */\nexport interface HotFile {\n path: string;\n references: number;\n items: string[];\n}\n\n/**\n * Documents the workload entry payload exchanged by command, SDK, and package integrations.\n */\nexport interface WorkloadEntry {\n assignee: string | null;\n active: number;\n in_progress: number;\n items: string[];\n}\n\n/**\n * Documents the stale entry payload exchanged by command, SDK, and package integrations.\n */\nexport interface StaleEntry {\n id: string;\n title: string;\n status: ItemStatus;\n updated_at: string;\n stale_days: number;\n}\n\n/**\n * Documents the recent context item payload exchanged by command, SDK, and package integrations.\n */\nexport interface RecentContextItem extends ContextFocusItem {\n created_at?: string;\n}\n\n/**\n * Documents the test health summary payload exchanged by command, SDK, and package integrations.\n */\nexport interface TestHealthSummary {\n items_with_tests: number;\n items_with_recent_runs: number;\n recent_runs: {\n passed: number;\n failed: number;\n skipped: number;\n };\n items_failing: string[];\n}\n\n// ---------------------------------------------------------------------------\n// Agenda / summary (unchanged)\n// ---------------------------------------------------------------------------\n\ninterface ContextAgendaSummary {\n events: number;\n items: number;\n deadlines: number;\n reminders: number;\n scheduled: number;\n}\n\ninterface ContextSummary {\n active_items: number;\n in_progress: number;\n open: number;\n blocked: number;\n blocked_fallback_used: boolean;\n high_level: number;\n low_level: number;\n agenda_events: number;\n total_items?: number;\n closed?: number;\n canceled?: number;\n}\n\n// ---------------------------------------------------------------------------\n// Result\n// ---------------------------------------------------------------------------\n\n/**\n * Documents the context result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ContextResult {\n output_default: \"toon\";\n now: string;\n depth: ContextDepth;\n sections_included: ContextSectionName[];\n window: {\n anchor: string;\n start: string | null;\n end: string | null;\n past: boolean;\n from: string | null;\n to: string | null;\n };\n filters: {\n type: string | null;\n tag: string | null;\n priority: string | null;\n assignee: string | null;\n assignee_filter: string | null;\n sprint: string | null;\n release: string | null;\n limit: string | null;\n parent: string | null;\n runtime_filters?: Record<string, unknown>;\n };\n summary: ContextSummary;\n high_level: ContextFocusItem[];\n low_level: ContextFocusItem[];\n blocked_fallback: ContextFocusItem[];\n agenda: {\n summary: ContextAgendaSummary;\n events: CalendarRow[];\n };\n hierarchy?: HierarchyNode[];\n activity?: CompactActivityEntry[];\n progress?: ProgressEntry[];\n blockers?: BlockerEntry[];\n recently_created?: RecentContextItem[];\n unparented?: ContextFocusItem[];\n files?: HotFile[];\n workload?: WorkloadEntry[];\n staleness?: StaleEntry[];\n tests?: TestHealthSummary;\n suggestions?: string[];\n /** Focus-row field subset requested via --fields; null/omitted means full rows. */\n focus_fields?: string[];\n warnings?: string[];\n}\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst HIGH_LEVEL_TYPES = new Set<string>([\"Epic\", \"Feature\"]);\nconst DEFAULT_CONTEXT_LIMIT = 10;\n\nconst STANDARD_SECTIONS: ContextSectionName[] = [\"hierarchy\", \"activity\", \"progress\", \"recently_created\", \"unparented\", \"workload\"];\nconst DEEP_SECTIONS: ContextSectionName[] = [\n ...STANDARD_SECTIONS,\n \"blockers\",\n \"files\",\n \"staleness\",\n \"tests\",\n];\nconst LEADING_HYPHEN_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})/;\nconst LEADING_COMPACT_DATE = /^(\\d{4})(\\d{2})(\\d{2})(?:[T ]?\\d{2}|$)/;\nconst COMPACT_DATE = /^(\\d{4})(\\d{2})(\\d{2})$/;\nconst COMPACT_DATETIME = /^(\\d{4})(\\d{2})(\\d{2})(?:[T\\s]?)(\\d{2})(\\d{2})(\\d{2})?(Z|[+-]\\d{2}:?\\d{2})?$/i;\n\n// ---------------------------------------------------------------------------\n// Parsers\n// ---------------------------------------------------------------------------\n\nfunction parseOutputFormat(raw: string | undefined): ContextOutputFormat | undefined {\n if (!raw) return undefined;\n const normalized = raw.trim().toLowerCase();\n if (!CONTEXT_OUTPUT_VALUES.includes(normalized as ContextOutputFormat)) {\n throw new PmCliError(\"Context format must be one of markdown|toon|json\", EXIT_CODE.USAGE);\n }\n return normalized as ContextOutputFormat;\n}\n\n// Fields selectable by `pm context --fields` for focus-row projection. Every\n// ContextFocusItem scalar plus `created_at` (carried by recently-created rows)\n// is addressable; unknown names are rejected with a usage hint.\nconst FOCUS_PROJECTION_FIELDS = new Set<string>([\n \"id\",\n \"title\",\n \"type\",\n \"status\",\n \"priority\",\n \"order\",\n \"deadline\",\n \"assignee\",\n \"tags\",\n \"updated_at\",\n \"parent\",\n \"children_total\",\n \"children_closed\",\n \"completion_pct\",\n \"created_at\",\n]);\n\n/**\n * Parses the comma-separated `--fields` value into a validated, de-duplicated\n * focus-row projection list. Returns undefined when no projection was requested.\n */\nexport function parseContextFocusFields(raw: string | undefined): string[] | undefined {\n if (raw === undefined) return undefined;\n const fields: string[] = [];\n for (const token of raw.split(\",\")) {\n const normalized = token.trim().toLowerCase();\n if (normalized.length === 0) continue;\n if (!FOCUS_PROJECTION_FIELDS.has(normalized)) {\n throw new PmCliError(\n `Context --fields value not projectable: ${normalized} (valid: ${[...FOCUS_PROJECTION_FIELDS].join(\", \")})`,\n EXIT_CODE.USAGE,\n );\n }\n if (!fields.includes(normalized)) fields.push(normalized);\n }\n if (fields.length === 0) {\n throw new PmCliError(\"Context --fields requires at least one field name\", EXIT_CODE.USAGE);\n }\n return fields;\n}\n\n/**\n * Projects focus rows onto the requested field subset, preserving field order so\n * the rendered/serialized output mirrors the `--fields` argument.\n */\nexport function projectContextFocusRows<T extends ContextFocusItem>(rows: T[], fields: string[]): ContextFocusItem[] {\n return rows.map((row) => {\n const projected: Record<string, unknown> = {};\n const source = row as Record<string, unknown>;\n for (const field of fields) {\n projected[field] = source[field] ?? null;\n }\n return projected as unknown as ContextFocusItem;\n });\n}\n\n/**\n * Implements resolve context output format for the public runtime surface of this module.\n */\nexport function resolveContextOutputFormat(options: ContextOptions, global: GlobalOptions): ContextOutputFormat {\n const commandFormat = parseOutputFormat(options.format);\n if (global.json && commandFormat && commandFormat !== \"json\") {\n throw new PmCliError(\"Cannot combine --json with --format markdown|toon\", EXIT_CODE.USAGE);\n }\n if (global.json) {\n return \"json\";\n }\n return commandFormat ?? \"toon\";\n}\n\n// --depth full surfaces the entire backlog: when no explicit --limit is given,\n// every section returns all rows instead of the default top-N sample.\nfunction parseContextLimit(raw: string | undefined, depth: ContextDepth): number {\n return parseIntegerLimit(raw, \"--limit\") ?? (depth === \"full\" ? Number.MAX_SAFE_INTEGER : DEFAULT_CONTEXT_LIMIT);\n}\n\n/**\n * Implements parse context depth for the public runtime surface of this module.\n */\nexport function parseContextDepth(raw: string | undefined, settings: ContextSettings): ContextDepth {\n if (!raw) return settings.default_depth;\n const normalized = raw.trim().toLowerCase();\n if (!CONTEXT_DEPTH_VALUES.includes(normalized as ContextDepth)) {\n throw new PmCliError(`Context --depth must be one of ${CONTEXT_DEPTH_VALUES.join(\"|\")}`, EXIT_CODE.USAGE);\n }\n return normalized as ContextDepth;\n}\n\n/**\n * Implements parse context sections for the public runtime surface of this module.\n */\nexport function parseContextSections(\n raw: string[] | undefined,\n depth: ContextDepth,\n settings: ContextSettings,\n): ContextSectionName[] {\n if (raw && raw.length > 0) {\n const sections: ContextSectionName[] = [];\n for (const value of raw) {\n const normalized = value.trim().toLowerCase();\n if (!CONTEXT_SECTION_VALUES.includes(normalized as ContextSectionName)) {\n throw new PmCliError(\n `Context --section must be one of ${CONTEXT_SECTION_VALUES.join(\"|\")}`,\n EXIT_CODE.USAGE,\n );\n }\n if (!sections.includes(normalized as ContextSectionName)) {\n sections.push(normalized as ContextSectionName);\n }\n }\n return sections;\n }\n if (depth === \"brief\") return [];\n // --depth full is the comprehensive snapshot: every known section, regardless\n // of the per-section settings toggles that brief/standard/deep respect.\n if (depth === \"full\") return [...CONTEXT_SECTION_VALUES];\n const pool = depth === \"deep\" ? DEEP_SECTIONS : STANDARD_SECTIONS;\n return pool.filter((section) => settings.sections[section]);\n}\n\nfunction parseActivityLimit(raw: string | undefined, settings: ContextSettings): number {\n if (!raw) return settings.activity_limit;\n const parsed = parseIntegerLimit(raw, \"--activity-limit\");\n /* c8 ignore start -- parseIntegerLimit either throws or returns a number; fallback is defensive typing guard */\n return parsed ?? settings.activity_limit;\n /* c8 ignore stop */\n}\n\nfunction parseStaleThresholdDays(raw: string | undefined, settings: ContextSettings): number {\n if (!raw) return settings.stale_threshold_days;\n const trimmed = raw.trim().toLowerCase();\n const match = /^(\\d+)d?$/.exec(trimmed);\n if (!match) {\n throw new PmCliError(\"--stale-threshold must be a number of days (e.g. 7 or 7d)\", EXIT_CODE.USAGE);\n }\n const days = parseInt(match[1], 10);\n if (days <= 0) {\n throw new PmCliError(\"--stale-threshold must be positive\", EXIT_CODE.USAGE);\n }\n return days;\n}\n\n// ---------------------------------------------------------------------------\n// Status helpers\n// ---------------------------------------------------------------------------\n\nfunction statusRank(status: ItemStatus, statusRegistry: RuntimeStatusRegistry): number {\n const normalizedStatus = normalizeStatusForRegistry(status, statusRegistry);\n const inProgressStatus = normalizeStatusInput(\"in_progress\", statusRegistry);\n const openStatus = normalizeStatusInput(\"open\", statusRegistry);\n const blockedStatus = normalizeStatusInput(\"blocked\", statusRegistry);\n const draftStatus = normalizeStatusInput(\"draft\", statusRegistry);\n if (inProgressStatus && normalizedStatus === inProgressStatus) return 0;\n if (openStatus && normalizedStatus === openStatus) return 1;\n if (blockedStatus && normalizedStatus === blockedStatus) return 2;\n if (draftStatus && normalizedStatus === draftStatus) return 3;\n if (statusRegistry.active_statuses.has(normalizedStatus)) return 4;\n if (statusRegistry.blocked_statuses.has(normalizedStatus)) return 5;\n if (statusRegistry.terminal_statuses.has(normalizedStatus)) return 7;\n return 6;\n}\n\nfunction isClosedStatus(status: ItemStatus, statusRegistry: RuntimeStatusRegistry): boolean {\n const closeStatus = normalizeStatusInput(\"closed\", statusRegistry);\n return normalizeStatusForRegistry(status, statusRegistry) === closeStatus;\n}\n\nfunction isInProgressStatus(status: ItemStatus, statusRegistry: RuntimeStatusRegistry): boolean {\n const inProgressStatus = normalizeStatusInput(\"in_progress\", statusRegistry);\n return normalizeStatusForRegistry(status, statusRegistry) === inProgressStatus;\n}\n\nfunction isOpenStatus(status: ItemStatus, statusRegistry: RuntimeStatusRegistry): boolean {\n const openStatus = normalizeStatusInput(\"open\", statusRegistry);\n return normalizeStatusForRegistry(status, statusRegistry) === openStatus;\n}\n\nfunction isBlockedStatus(status: ItemStatus, statusRegistry: RuntimeStatusRegistry): boolean {\n return statusRegistry.blocked_statuses.has(normalizeStatusForRegistry(status, statusRegistry));\n}\n\n// Projection flags belong to list/calendar/activity output shaping and must not\n// leak into runContext's downstream calls, which need full ItemFrontMatter rows.\n// --parent is a context-level subtree scope computed here transitively, so it\n// must not reach runList (whose --parent matches direct children only).\nconst LIST_PROJECTION_FLAGS = [\"compact\", \"brief\", \"fields\", \"includeBody\", \"include_body\", \"parent\"] as const;\n\nfunction stripListProjectionFlags(options: ContextOptions): Record<string, unknown> {\n const copy: Record<string, unknown> = { ...(options as Record<string, unknown>) };\n for (const key of LIST_PROJECTION_FLAGS) {\n delete copy[key];\n }\n return copy;\n}\n\n/**\n * Resolves the transitive subtree (the anchor item plus every descendant via\n * parent links) so `--parent` can scope a snapshot to one epic/milestone. Reuses\n * the same {@link buildChildrenByParent}/{@link collectDescendants} helpers the\n * hierarchy section relies on, so subtree membership stays consistent across the\n * snapshot. Ids are normalized to lowercase for case-insensitive membership; the\n * `found` flag is false when the anchor id is absent from the corpus. Exported so\n * sibling read commands (e.g. `pm next`) can apply the same subtree scoping.\n */\nexport function collectSubtreeIds(corpus: ItemFrontMatter[], parentId: string): { ids: Set<string>; found: boolean } {\n const target = parentId.trim().toLowerCase();\n const anchor = corpus.find((item) => item.id.trim().toLowerCase() === target);\n if (!anchor) {\n return { ids: new Set<string>(), found: false };\n }\n const childrenByParent = buildChildrenByParent(corpus);\n const descendants = collectDescendants(anchor.id, childrenByParent);\n // Store normalized ids so membership checks are case-insensitive end-to-end.\n const ids = new Set<string>([anchor.id, ...descendants.map((item) => item.id)].map((id) => id.trim().toLowerCase()));\n return { ids, found: true };\n}\n\nfunction parseContextParent(raw: string | undefined): string | undefined {\n if (raw === undefined) return undefined;\n const trimmed = raw.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(\"Context --parent requires an item id\", EXIT_CODE.USAGE);\n }\n return trimmed;\n}\n\n// ---------------------------------------------------------------------------\n// Sorting / mapping helpers (unchanged from original)\n// ---------------------------------------------------------------------------\n\nfunction compareOptionalOrder(left: number | null | undefined, right: number | null | undefined): number {\n const leftValue = left ?? null;\n const rightValue = right ?? null;\n if (leftValue === null && rightValue === null) return 0;\n if (leftValue === null) return 1;\n if (rightValue === null) return -1;\n return leftValue - rightValue;\n}\n\nfunction compareOptionalDeadline(left: string | null | undefined, right: string | null | undefined): number {\n const leftValue = left ?? null;\n const rightValue = right ?? null;\n if (leftValue === null && rightValue === null) return 0;\n if (leftValue === null) return 1;\n if (rightValue === null) return -1;\n return compareTimestampStrings(leftValue, rightValue);\n}\n\nfunction daysInUtcMonth(year: number, monthIndex: number): number {\n return new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate();\n}\n\nfunction hasNoInvalidDatePrefix(value: string): boolean {\n const match = LEADING_HYPHEN_DATE.exec(value) ?? LEADING_COMPACT_DATE.exec(value);\n if (!match) {\n return true;\n }\n const year = Number.parseInt(match[1], 10);\n const month = Number.parseInt(match[2], 10);\n const day = Number.parseInt(match[3], 10);\n return month >= 1 && month <= 12 && day >= 1 && day <= daysInUtcMonth(year, month - 1);\n}\n\nfunction normalizeTimestampCandidate(value: string): string {\n const compactDate = COMPACT_DATE.exec(value);\n if (compactDate) {\n return `${compactDate[1]}-${compactDate[2]}-${compactDate[3]}`;\n }\n const compactDateTime = COMPACT_DATETIME.exec(value);\n if (compactDateTime) {\n const [, year, month, day, hour, minute, secondRaw, offsetRaw] = compactDateTime;\n const second = secondRaw ? `:${secondRaw}` : \"\";\n const offset = offsetRaw && offsetRaw.length === 5 && offsetRaw !== \"Z\" ? `${offsetRaw.slice(0, 3)}:${offsetRaw.slice(3)}` : offsetRaw ?? \"\";\n return `${year}-${month}-${day}T${hour}:${minute}${second}${offset}`;\n }\n return value;\n}\n\nfunction parseContextTimestampMs(value: unknown): number {\n if (typeof value !== \"string\") {\n return Number.NaN;\n }\n const trimmed = value.trim();\n if (trimmed.length === 0 || !hasNoInvalidDatePrefix(trimmed)) {\n return Number.NaN;\n }\n const parsed = Date.parse(normalizeTimestampCandidate(trimmed));\n return Number.isFinite(parsed) ? parsed : Number.NaN;\n}\n\nfunction sortableTimestamp(value: unknown): string {\n const parsed = parseContextTimestampMs(value);\n return Number.isFinite(parsed) ? new Date(parsed).toISOString() : \"\";\n}\n\nfunction dateTokenForTimestamp(value: unknown): string {\n const parsed = parseContextTimestampMs(value);\n return Number.isFinite(parsed) ? new Date(parsed).toISOString().slice(0, 10) : \"unknown\";\n}\n\nfunction normalizedParentId(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : null;\n}\n\n/**\n * Ranks two items by work criticality: in-progress before open before blocked\n * before draft (via {@link statusRank}), then ascending priority, explicit order,\n * earliest deadline, most-recently-updated, and finally id for a total order.\n * Exported as the canonical focus ordering so sibling read commands (e.g.\n * `pm next`) recommend work in the exact same sequence as `pm context`.\n */\nexport function compareCriticalItems(left: ItemFrontMatter, right: ItemFrontMatter, statusRegistry: RuntimeStatusRegistry): number {\n const byStatus = statusRank(left.status, statusRegistry) - statusRank(right.status, statusRegistry);\n if (byStatus !== 0) return byStatus;\n const byPriority = left.priority - right.priority;\n if (byPriority !== 0) return byPriority;\n const byOrder = compareOptionalOrder(left.order, right.order);\n if (byOrder !== 0) return byOrder;\n const byDeadline = compareOptionalDeadline(left.deadline, right.deadline);\n if (byDeadline !== 0) return byDeadline;\n const byUpdated = compareTimestampStrings(sortableTimestamp(right.updated_at), sortableTimestamp(left.updated_at));\n const byId = left.id.localeCompare(right.id);\n return byUpdated !== 0 ? byUpdated : byId;\n}\n\nfunction completionPct(closed: number, total: number): number {\n return total > 0 ? Math.round((closed / total) * 100) : 0;\n}\n\n/**\n * Indexes items by their parent id, yielding a parent→direct-children map used by\n * the hierarchy/progress rollups and by focus-row child completion. Items without\n * a parent are skipped. Exported so sibling read commands reuse the same index.\n */\nexport function buildChildrenByParent(allItems: ItemFrontMatter[]): Map<string, ItemFrontMatter[]> {\n const childrenByParent = new Map<string, ItemFrontMatter[]>();\n for (const item of allItems) {\n const parent = normalizedParentId(item.parent);\n if (!parent) continue;\n const children = childrenByParent.get(parent) ?? [];\n children.push(item);\n childrenByParent.set(parent, children);\n }\n return childrenByParent;\n}\n\n/**\n * Projects an item onto the compact {@link ContextFocusItem} focus row. When both\n * a status registry and a parent→children index are supplied, it also folds in the\n * descendant rollup (`children_total`/`children_closed`/`completion_pct`). Exported\n * so sibling read commands (e.g. `pm next`) emit identically-shaped focus rows.\n */\nexport function toContextFocusItem(\n item: ItemFrontMatter,\n statusRegistry?: RuntimeStatusRegistry,\n childrenByParent?: Map<string, ItemFrontMatter[]>,\n): ContextFocusItem {\n const focus: ContextFocusItem = {\n id: item.id,\n title: item.title,\n type: item.type,\n status: item.status,\n priority: item.priority,\n order: item.order ?? null,\n deadline: item.deadline ?? null,\n assignee: item.assignee ?? null,\n tags: Array.isArray(item.tags) ? [...item.tags] : [],\n updated_at: item.updated_at,\n parent: normalizedParentId(item.parent),\n };\n if (statusRegistry && childrenByParent) {\n const descendants = collectDescendants(item.id, childrenByParent);\n const total = descendants.length;\n if (total > 0) {\n const closed = descendants.filter((desc) => isClosedStatus(desc.status, statusRegistry)).length;\n focus.children_total = total;\n focus.children_closed = closed;\n focus.completion_pct = completionPct(closed, total);\n }\n }\n return focus;\n}\n\nfunction summarizeAgenda(events: CalendarRow[]): ContextAgendaSummary {\n let deadlines = 0;\n let reminders = 0;\n let scheduled = 0;\n const itemIds = new Set<string>();\n for (const event of events) {\n itemIds.add(event.item_id);\n if (event.kind === \"deadline\") {\n deadlines += 1;\n continue;\n }\n if (event.kind === \"reminder\") {\n reminders += 1;\n continue;\n }\n scheduled += 1;\n }\n return {\n events: events.length,\n items: itemIds.size,\n deadlines,\n reminders,\n scheduled,\n };\n}\n\nfunction mergeSortedWarnings(...warningGroups: Array<string[] | undefined>): string[] {\n return [...new Set(warningGroups.flatMap((group) => group ?? []))].sort((left, right) => left.localeCompare(right));\n}\n\nfunction filterTerminalCalendarEvents(events: CalendarRow[], statusRegistry: RuntimeStatusRegistry): CalendarRow[] {\n return events.filter((event) => !statusRegistry.terminal_statuses.has(normalizeStatusForRegistry(event.item_status, statusRegistry)));\n}\n\n// ---------------------------------------------------------------------------\n// Section builders\n// ---------------------------------------------------------------------------\n\nfunction buildHierarchy(\n allItems: ItemFrontMatter[],\n activeItems: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n limit: number,\n): HierarchyNode[] {\n const itemMap = new Map<string, ItemFrontMatter>();\n for (const item of allItems) {\n itemMap.set(item.id, item);\n }\n\n const childrenByParent = buildChildrenByParent(allItems);\n\n const activeHighLevelIds = new Set(\n activeItems.filter((item) => HIGH_LEVEL_TYPES.has(item.type)).map((item) => item.id),\n );\n\n const nodes: HierarchyNode[] = [];\n for (const parentId of activeHighLevelIds) {\n const parent = itemMap.get(parentId);\n if (!parent) continue;\n const allDescendants = collectDescendants(parentId, childrenByParent);\n const childItems = childrenByParent.get(parentId) ?? [];\n\n let closedCount = 0;\n let openCount = 0;\n let inProgressCount = 0;\n let blockedCount = 0;\n /* c8 ignore start -- chained status-classification branch accounting is noisy under v8 for mixed descendant sets */\n for (const desc of allDescendants) {\n if (isClosedStatus(desc.status, statusRegistry)) closedCount++;\n else if (isInProgressStatus(desc.status, statusRegistry)) inProgressCount++;\n else if (isBlockedStatus(desc.status, statusRegistry)) blockedCount++;\n else if (isOpenStatus(desc.status, statusRegistry)) openCount++;\n }\n /* c8 ignore stop */\n\n const children: HierarchyChild[] = childItems\n .sort((a, b) => compareCriticalItems(a, b, statusRegistry))\n .slice(0, limit)\n .map((child) => {\n const grandchildren = collectDescendants(child.id, childrenByParent);\n const gcClosed = grandchildren.filter((gc) => isClosedStatus(gc.status, statusRegistry)).length;\n return {\n id: child.id,\n title: child.title,\n type: child.type,\n status: child.status,\n children_total: grandchildren.length,\n children_closed: gcClosed,\n };\n });\n\n nodes.push({\n id: parent.id,\n title: parent.title,\n type: parent.type,\n status: parent.status,\n children_total: allDescendants.length,\n children_closed: closedCount,\n children_open: openCount,\n children_in_progress: inProgressCount,\n children_blocked: blockedCount,\n children,\n });\n }\n\n return nodes\n .sort((a, b) => {\n const aParent = itemMap.get(a.id)!;\n const bParent = itemMap.get(b.id)!;\n return compareCriticalItems(aParent, bParent, statusRegistry);\n })\n .slice(0, limit);\n}\n\nfunction collectDescendants(\n parentId: string,\n childrenByParent: Map<string, ItemFrontMatter[]>,\n): ItemFrontMatter[] {\n const result: ItemFrontMatter[] = [];\n const stack = [parentId];\n const visited = new Set<string>();\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (visited.has(current)) continue;\n visited.add(current);\n const children = childrenByParent.get(current) ?? [];\n for (const child of children) {\n result.push(child);\n stack.push(child.id);\n }\n }\n return result;\n}\n\nexport const _testOnly = {\n buildActivity,\n buildBlockers,\n buildChildrenByParent,\n buildHierarchy,\n buildHotFiles,\n buildProgress,\n buildRecentlyCreated,\n buildStaleness,\n buildTestHealth,\n buildUnparented,\n buildWorkload,\n collectDescendants,\n collectSubtreeIds,\n compareCriticalItems,\n compareOptionalDeadline,\n compareOptionalOrder,\n completionPct,\n dateTokenForTimestamp,\n filterTerminalCalendarEvents,\n isBlockedStatus,\n isClosedStatus,\n isInProgressStatus,\n isOpenStatus,\n mergeSortedWarnings,\n normalizedParentId,\n parseActivityLimit,\n parseContextLimit,\n parseContextParent,\n parseContextTimestampMs,\n parseStaleThresholdDays,\n sortableTimestamp,\n statusRank,\n stripListProjectionFlags,\n summarizeAgenda,\n toContextFocusItem,\n};\n\nasync function buildActivity(\n activityLimit: number,\n global: GlobalOptions,\n): Promise<CompactActivityEntry[]> {\n const result = await runActivity({ compact: true, limit: String(activityLimit) }, global);\n return result.compact_activity ?? [];\n}\n\nfunction buildProgress(\n allItems: ItemFrontMatter[],\n activeItems: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n limit: number,\n): ProgressEntry[] {\n const childrenByParent = new Map<string, ItemFrontMatter[]>();\n for (const item of allItems) {\n if (!item.parent) continue;\n const children = childrenByParent.get(item.parent) ?? [];\n children.push(item);\n childrenByParent.set(item.parent, children);\n }\n\n const activeHighLevel = activeItems.filter((item) => HIGH_LEVEL_TYPES.has(item.type));\n const entries: ProgressEntry[] = [];\n for (const parent of activeHighLevel) {\n const descendants = collectDescendants(parent.id, childrenByParent);\n const total = descendants.length;\n if (total === 0) continue;\n\n let closed = 0;\n let open = 0;\n let inProgress = 0;\n let blocked = 0;\n /* c8 ignore start -- chained status-classification branch accounting is noisy under v8 for mixed descendant sets */\n for (const desc of descendants) {\n if (isClosedStatus(desc.status, statusRegistry)) closed++;\n else if (isInProgressStatus(desc.status, statusRegistry)) inProgress++;\n else if (isBlockedStatus(desc.status, statusRegistry)) blocked++;\n else if (isOpenStatus(desc.status, statusRegistry)) open++;\n }\n /* c8 ignore stop */\n\n entries.push({\n id: parent.id,\n title: parent.title,\n type: parent.type,\n total,\n closed,\n open,\n in_progress: inProgress,\n blocked,\n completion_pct: completionPct(closed, total),\n });\n }\n\n return entries\n .sort((a, b) => a.completion_pct - b.completion_pct)\n .slice(0, limit);\n}\n\nfunction buildBlockers(\n blockedItems: ItemFrontMatter[],\n itemMap: Map<string, ItemFrontMatter>,\n limit: number,\n): BlockerEntry[] {\n return blockedItems.slice(0, limit).map((item) => {\n const blockerItem = item.blocked_by ? itemMap.get(item.blocked_by) : undefined;\n return {\n id: item.id,\n title: item.title,\n blocked_by: item.blocked_by ?? null,\n blocked_by_title: blockerItem?.title ?? null,\n blocked_by_status: blockerItem?.status ?? null,\n blocked_reason: item.blocked_reason ?? null,\n unblock_note: item.unblock_note ?? null,\n };\n });\n}\n\nfunction buildHotFiles(\n activeItems: ItemFrontMatter[],\n limit: number,\n): HotFile[] {\n const fileMap = new Map<string, Set<string>>();\n for (const item of activeItems) {\n for (const file of item.files ?? []) {\n const existing = fileMap.get(file.path) ?? new Set<string>();\n existing.add(item.id);\n fileMap.set(file.path, existing);\n }\n }\n\n return [...fileMap.entries()]\n .map(([filePath, itemIds]) => ({\n path: filePath,\n references: itemIds.size,\n items: [...itemIds].sort(),\n }))\n .sort((a, b) => b.references - a.references)\n .slice(0, limit);\n}\n\nfunction buildWorkload(\n activeItems: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n limit: number,\n): WorkloadEntry[] {\n const groups = new Map<string | null, ItemFrontMatter[]>();\n for (const item of activeItems) {\n const key = item.assignee ?? null;\n const existing = groups.get(key) ?? [];\n existing.push(item);\n groups.set(key, existing);\n }\n\n return [...groups.entries()]\n .map(([assignee, items]) => ({\n assignee,\n active: items.length,\n in_progress: items.filter((item) => isInProgressStatus(item.status, statusRegistry)).length,\n items: items.map((item) => item.id).sort(),\n }))\n .sort((a, b) => b.active - a.active)\n .slice(0, limit);\n}\n\nfunction buildStaleness(\n allNonTerminal: ItemFrontMatter[],\n staleThresholdDays: number,\n now: string,\n limit: number,\n): StaleEntry[] {\n const cutoffMs = new Date(now).getTime() - staleThresholdDays * 24 * 60 * 60 * 1000;\n\n return allNonTerminal\n .filter((item) => new Date(item.updated_at).getTime() < cutoffMs)\n .map((item) => ({\n id: item.id,\n title: item.title,\n status: item.status,\n updated_at: item.updated_at,\n stale_days: Math.floor((new Date(now).getTime() - new Date(item.updated_at).getTime()) / (24 * 60 * 60 * 1000)),\n }))\n .sort((a, b) => b.stale_days - a.stale_days)\n .slice(0, limit);\n}\n\nfunction buildRecentlyCreated(\n allNonTerminal: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n childrenByParent: Map<string, ItemFrontMatter[]>,\n limit: number,\n): RecentContextItem[] {\n return allNonTerminal\n .map((item) => ({ item, sortKey: sortableTimestamp(item.created_at) }))\n .sort((left, right) => {\n const byCreated = compareTimestampStrings(right.sortKey, left.sortKey);\n return byCreated !== 0 ? byCreated : left.item.id.localeCompare(right.item.id);\n })\n .slice(0, limit)\n .map(({ item }) => ({\n ...toContextFocusItem(item, statusRegistry, childrenByParent),\n created_at: item.created_at,\n }));\n}\n\nfunction buildUnparented(\n allNonTerminal: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n childrenByParent: Map<string, ItemFrontMatter[]>,\n limit: number,\n): ContextFocusItem[] {\n return allNonTerminal\n .filter((item) => !normalizedParentId(item.parent) && !HIGH_LEVEL_TYPES.has(item.type))\n .sort((left, right) => compareCriticalItems(left, right, statusRegistry))\n .slice(0, limit)\n .map((item) => toContextFocusItem(item, statusRegistry, childrenByParent));\n}\n\nfunction buildTestHealth(\n activeItems: ItemFrontMatter[],\n): TestHealthSummary {\n let itemsWithTests = 0;\n let itemsWithRecentRuns = 0;\n let passed = 0;\n let failed = 0;\n let skipped = 0;\n const itemsFailing: string[] = [];\n\n for (const item of activeItems) {\n if ((item.tests ?? []).length > 0) {\n itemsWithTests++;\n }\n const runs = item.test_runs ?? [];\n if (runs.length > 0) {\n itemsWithRecentRuns++;\n let itemHasFailure = false;\n for (const run of runs) {\n passed += run.passed ?? 0;\n failed += run.failed ?? 0;\n skipped += run.skipped ?? 0;\n if ((run.failed ?? 0) > 0) {\n itemHasFailure = true;\n }\n }\n if (itemHasFailure) {\n itemsFailing.push(item.id);\n }\n }\n }\n\n return {\n items_with_tests: itemsWithTests,\n items_with_recent_runs: itemsWithRecentRuns,\n recent_runs: { passed, failed, skipped },\n items_failing: itemsFailing.sort(),\n };\n}\n\n// ---------------------------------------------------------------------------\n// Markdown formatting\n// ---------------------------------------------------------------------------\n\nfunction formatClock(timestamp: string): string {\n return `${new Date(timestamp).toISOString().slice(11, 16)}Z`;\n}\n\nfunction formatFocusLine(item: ContextFocusItem): string {\n const orderToken = item.order === null ? \"-\" : String(item.order);\n const deadlineToken = item.deadline ?? \"-\";\n const parentToken = item.parent ? ` parent:${item.parent}` : \"\";\n const progressToken =\n item.children_total !== undefined && item.children_closed !== undefined && item.completion_pct !== undefined\n ? ` children:${item.children_closed}/${item.children_total} done:${item.completion_pct}%`\n : \"\";\n return `${item.id} p${item.priority} ${item.status} ${item.type} order:${orderToken} deadline:${deadlineToken}${parentToken}${progressToken} ${item.title}`;\n}\n\n// Renders a focus row projected to a `--fields` subset as space-separated\n// field:value tokens, mirroring the projection field order. Array values join\n// with commas; missing/null values render as `-`.\nfunction formatProjectedFocusLine(item: ContextFocusItem, fields: string[]): string {\n const source = item as unknown as Record<string, unknown>;\n return fields\n .map((field) => {\n const value = source[field];\n if (Array.isArray(value)) return `${field}:${value.join(\",\")}`;\n return `${field}:${value ?? \"-\"}`;\n })\n .join(\" \");\n}\n\nfunction formatAgendaLine(event: CalendarRow): string {\n const base = `${formatClock(event.at)} [${event.kind}] ${event.item_id} p${event.item_priority} ${event.item_status} ${event.item_title}`;\n if (event.kind === \"reminder\") {\n return `${base} — ${event.reminder_text}`;\n }\n if (event.kind === \"event\") {\n const recurringSuffix = event.event_recurring ? \" (recurring)\" : \"\";\n const title = event.event_title ?? event.item_title;\n return `${base} — ${title}${recurringSuffix}`;\n }\n return base;\n}\n\nfunction pushContextFocusSection(\n lines: string[],\n title: string,\n rows: ContextFocusItem[],\n emptyText: string,\n renderFocus: (item: ContextFocusItem) => string,\n): void {\n lines.push(`## ${title}`);\n if (rows.length === 0) {\n lines.push(emptyText);\n } else {\n for (const item of rows) {\n lines.push(`- ${renderFocus(item)}`);\n }\n }\n lines.push(\"\");\n}\n\nfunction pushBlockedFallbackSection(\n lines: string[],\n result: ContextResult,\n renderFocus: (item: ContextFocusItem) => string,\n): void {\n if (result.blocked_fallback.length === 0) {\n return;\n }\n lines.push(\"## Blocked fallback\");\n for (const item of result.blocked_fallback) {\n lines.push(`- ${renderFocus(item)}`);\n }\n lines.push(\"\");\n}\n\nfunction pushAgendaSection(lines: string[], result: ContextResult): void {\n lines.push(\"## Agenda\");\n lines.push(\n `- events: ${result.agenda.summary.events} (deadlines: ${result.agenda.summary.deadlines}, reminders: ${result.agenda.summary.reminders}, scheduled: ${result.agenda.summary.scheduled})`,\n );\n if (result.agenda.events.length === 0) {\n lines.push(\"No agenda events matched the selected filters.\");\n } else {\n for (const event of result.agenda.events) {\n lines.push(`- ${formatAgendaLine(event)}`);\n }\n }\n lines.push(\"\");\n}\n\nfunction pushHierarchySection(lines: string[], result: ContextResult): void {\n if (!result.hierarchy || result.hierarchy.length === 0) {\n return;\n }\n lines.push(\"## Hierarchy\");\n for (const node of result.hierarchy) {\n const pct = node.children_total > 0 ? Math.round((node.children_closed / node.children_total) * 100) : 0;\n lines.push(`- ${node.id} ${node.type} ${node.status} \"${node.title}\" [${node.children_closed}/${node.children_total} done ${pct}%]`);\n for (const child of node.children) {\n const cpct = child.children_total > 0 ? Math.round((child.children_closed / child.children_total) * 100) : 0;\n lines.push(` - ${child.id} ${child.type} ${child.status} \"${child.title}\" [${child.children_closed}/${child.children_total} done ${cpct}%]`);\n }\n }\n lines.push(\"\");\n}\n\nfunction pushProgressSection(lines: string[], result: ContextResult): void {\n if (!result.progress || result.progress.length === 0) {\n return;\n }\n lines.push(\"## Progress\");\n for (const entry of result.progress) {\n lines.push(`- ${entry.id} \"${entry.title}\" ${entry.completion_pct}% (${entry.closed}/${entry.total} closed, ${entry.in_progress} wip, ${entry.open} open, ${entry.blocked} blocked)`);\n }\n lines.push(\"\");\n}\n\nfunction pushRecentlyCreatedSection(\n lines: string[],\n result: ContextResult,\n focusFields: string[] | undefined,\n renderFocus: (item: ContextFocusItem) => string,\n): void {\n if (!result.recently_created || result.recently_created.length === 0) {\n return;\n }\n lines.push(\"## Recently created\");\n for (const item of result.recently_created) {\n lines.push(focusFields ? `- ${renderFocus(item)}` : `- ${dateTokenForTimestamp(item.created_at)} ${formatFocusLine(item)}`);\n }\n lines.push(\"\");\n}\n\nfunction pushUnparentedSection(\n lines: string[],\n result: ContextResult,\n renderFocus: (item: ContextFocusItem) => string,\n): void {\n if (!result.unparented || result.unparented.length === 0) {\n return;\n }\n lines.push(\"## Unparented\");\n for (const item of result.unparented) {\n lines.push(`- ${renderFocus(item)}`);\n }\n lines.push(\"\");\n}\n\nfunction pushActivitySection(lines: string[], result: ContextResult): void {\n if (!result.activity || result.activity.length === 0) {\n return;\n }\n lines.push(\"## Recent activity\");\n for (const entry of result.activity) {\n const msg = entry.msg ? ` ${entry.msg}` : \"\";\n lines.push(`- ${entry.ts.slice(0, 16)}Z ${entry.id} ${entry.op} by:${entry.author}${msg}`);\n }\n lines.push(\"\");\n}\n\nfunction pushBlockersSection(lines: string[], result: ContextResult): void {\n if (!result.blockers || result.blockers.length === 0) {\n return;\n }\n lines.push(\"## Blockers\");\n for (const entry of result.blockers) {\n const by = entry.blocked_by ? `blocked_by:${entry.blocked_by}(${entry.blocked_by_status ?? \"?\"})` : \"blocked_by:-\";\n const reason = entry.blocked_reason ? ` reason:\"${entry.blocked_reason}\"` : \"\";\n const note = entry.unblock_note ? ` unblock:\"${entry.unblock_note}\"` : \"\";\n lines.push(`- ${entry.id} \"${entry.title}\" ${by}${reason}${note}`);\n }\n lines.push(\"\");\n}\n\nfunction pushFilesSection(lines: string[], result: ContextResult): void {\n if (!result.files || result.files.length === 0) {\n return;\n }\n lines.push(\"## Hot files\");\n for (const file of result.files) {\n lines.push(`- ${file.path} refs:${file.references} items:[${file.items.join(\",\")}]`);\n }\n lines.push(\"\");\n}\n\nfunction pushWorkloadSection(lines: string[], result: ContextResult): void {\n if (!result.workload || result.workload.length === 0) {\n return;\n }\n lines.push(\"## Workload\");\n for (const entry of result.workload) {\n const who = entry.assignee ?? \"(unassigned)\";\n lines.push(`- ${who} active:${entry.active} wip:${entry.in_progress} items:[${entry.items.join(\",\")}]`);\n }\n lines.push(\"\");\n}\n\nfunction pushStalenessSection(lines: string[], result: ContextResult): void {\n if (!result.staleness || result.staleness.length === 0) {\n return;\n }\n lines.push(\"## Stale items\");\n for (const entry of result.staleness) {\n lines.push(`- ${entry.id} ${entry.status} stale:${entry.stale_days}d last:${entry.updated_at.slice(0, 10)} \"${entry.title}\"`);\n }\n lines.push(\"\");\n}\n\nfunction pushTestHealthSection(lines: string[], result: ContextResult): void {\n if (!result.tests) {\n return;\n }\n lines.push(\"## Test health\");\n lines.push(`- items_with_tests: ${result.tests.items_with_tests}`);\n lines.push(`- items_with_recent_runs: ${result.tests.items_with_recent_runs}`);\n lines.push(`- passed: ${result.tests.recent_runs.passed}, failed: ${result.tests.recent_runs.failed}, skipped: ${result.tests.recent_runs.skipped}`);\n if (result.tests.items_failing.length > 0) {\n lines.push(`- items_failing: [${result.tests.items_failing.join(\",\")}]`);\n }\n lines.push(\"\");\n}\n\nfunction pushEmptyContextSuggestions(lines: string[], result: ContextResult): void {\n const isEmpty =\n result.summary.active_items === 0 &&\n result.summary.blocked === 0 &&\n result.agenda.summary.events === 0;\n if (!isEmpty) {\n return;\n }\n lines.push(\"## Suggestions\");\n lines.push(\"No active work items or upcoming events. Consider:\");\n lines.push(\"- `pm create --type Task --title \\\"...\\\"` to add a new work item\");\n lines.push(\"- `pm list --status closed --limit 5` to review recent completions\");\n lines.push(\"- `pm search <keywords>` to find related past work\");\n lines.push(\"- `pm aggregate` for a full project status overview\");\n}\n\n/**\n * Implements render context markdown for the public runtime surface of this module.\n */\nexport function renderContextMarkdown(result: ContextResult): string {\n const lines: string[] = [];\n const focusFields = result.focus_fields;\n const renderFocus = (item: ContextFocusItem): string =>\n focusFields ? formatProjectedFocusLine(item, focusFields) : formatFocusLine(item);\n lines.push(\"# pm context\");\n lines.push(\"\");\n lines.push(`- now: ${result.now}`);\n lines.push(`- depth: ${result.depth}`);\n if (result.filters.parent) {\n lines.push(`- scope: subtree of ${result.filters.parent}`);\n }\n lines.push(`- active_items: ${result.summary.active_items} (in_progress: ${result.summary.in_progress}, open: ${result.summary.open})`);\n if (result.summary.total_items !== undefined) {\n lines.push(`- total_items: ${result.summary.total_items} (closed: ${result.summary.closed ?? 0}, canceled: ${result.summary.canceled ?? 0})`);\n }\n lines.push(`- agenda_events: ${result.summary.agenda_events}`);\n lines.push(`- blocked_fallback_used: ${result.summary.blocked_fallback_used}`);\n const renderedSections = result.sections_included.filter(\n (section) => section !== \"blockers\" || (result.blockers?.length ?? 0) > 0,\n );\n if (renderedSections.length > 0) {\n lines.push(`- sections: ${renderedSections.join(\", \")}`);\n }\n lines.push(\"\");\n\n pushContextFocusSection(lines, \"High-level focus\", result.high_level, \"No high-level active items.\", renderFocus);\n pushContextFocusSection(lines, \"Low-level focus\", result.low_level, \"No low-level active items.\", renderFocus);\n pushBlockedFallbackSection(lines, result, renderFocus);\n pushAgendaSection(lines, result);\n pushHierarchySection(lines, result);\n pushProgressSection(lines, result);\n pushRecentlyCreatedSection(lines, result, focusFields, renderFocus);\n pushUnparentedSection(lines, result, renderFocus);\n pushActivitySection(lines, result);\n pushBlockersSection(lines, result);\n pushFilesSection(lines, result);\n pushWorkloadSection(lines, result);\n pushStalenessSection(lines, result);\n pushTestHealthSection(lines, result);\n pushEmptyContextSuggestions(lines, result);\n\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Main runner\n// ---------------------------------------------------------------------------\n\ninterface ContextRuntime {\n settings: PmSettings;\n contextSettings: ContextSettings;\n statusRegistry: RuntimeStatusRegistry;\n depth: ContextDepth;\n limit: number;\n sectionsIncluded: ContextSectionName[];\n activityLimit: number;\n staleThresholdDays: number;\n parentScope: string | undefined;\n focusFields: string[] | undefined;\n baseListOptions: Record<string, unknown>;\n}\n\ninterface ContextCorpus {\n listed: Awaited<ReturnType<typeof runList>>;\n listedFrontMatter: ItemFrontMatter[];\n allItems: ItemFrontMatter[];\n fullCorpus: ItemFrontMatter[];\n subtreeIds: Set<string> | undefined;\n}\n\ninterface ContextFocusGroups {\n activeItems: ItemFrontMatter[];\n blockedItems: ItemFrontMatter[];\n highLevel: ContextFocusItem[];\n lowLevel: ContextFocusItem[];\n blockedFallback: ContextFocusItem[];\n blockedFallbackUsed: boolean;\n}\n\ninterface ContextOptionalSections {\n hierarchy?: HierarchyNode[];\n activity?: CompactActivityEntry[];\n progress?: ProgressEntry[];\n blockersSection?: BlockerEntry[];\n recentlyCreated?: RecentContextItem[];\n unparented?: ContextFocusItem[];\n filesSection?: HotFile[];\n workload?: WorkloadEntry[];\n staleness?: StaleEntry[];\n tests?: TestHealthSummary;\n}\n\nasync function resolveContextRuntime(options: ContextOptions, global: GlobalOptions): Promise<ContextRuntime> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n const settings = await readSettings(pmRoot);\n /* c8 ignore start -- settings persistence currently always materializes context defaults */\n const contextSettings = settings.context ?? SETTINGS_DEFAULTS.context;\n /* c8 ignore stop */\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const depth = parseContextDepth(options.depth, contextSettings);\n return {\n settings,\n contextSettings,\n statusRegistry,\n depth,\n limit: parseContextLimit(options.limit, depth),\n sectionsIncluded: parseContextSections(options.section, depth, contextSettings),\n activityLimit: parseActivityLimit(options.activityLimit, contextSettings),\n staleThresholdDays: parseStaleThresholdDays(options.staleThreshold, contextSettings),\n parentScope: parseContextParent(options.parent),\n focusFields: parseContextFocusFields(options.fields),\n baseListOptions: stripListProjectionFlags(options),\n };\n}\n\nfunction contextNeedsAllItems(sectionsIncluded: ContextSectionName[]): boolean {\n return sectionsIncluded.some((section) =>\n [\"hierarchy\", \"progress\", \"blockers\", \"staleness\", \"recently_created\", \"unparented\"].includes(section),\n );\n}\n\nfunction buildUnpaginatedContextListOptions(baseListOptions: Record<string, unknown>, extra: Partial<ListOptions>): ListOptions {\n return {\n ...baseListOptions,\n ...extra,\n noTruncate: true,\n limit: undefined,\n offset: undefined,\n };\n}\n\nasync function loadContextCorpus(\n options: ContextOptions,\n global: GlobalOptions,\n runtime: ContextRuntime,\n): Promise<ContextCorpus> {\n const needsAllItems = contextNeedsAllItems(runtime.sectionsIncluded);\n const listOptions: ListOptions = runtime.parentScope === undefined\n ? { ...runtime.baseListOptions, excludeTerminal: true }\n : buildUnpaginatedContextListOptions(runtime.baseListOptions, { excludeTerminal: true });\n const listed = await runList(undefined, listOptions, global);\n let listedFrontMatter = listed.items as ItemFrontMatter[];\n let allItems: ItemFrontMatter[] = listedFrontMatter;\n if (needsAllItems || runtime.parentScope !== undefined) {\n const allListed = await runList(\n undefined,\n buildUnpaginatedContextListOptions(runtime.baseListOptions, { excludeTerminal: false }),\n global,\n );\n allItems = allListed.items as ItemFrontMatter[];\n }\n const fullCorpus = allItems;\n const subtreeIds = resolveContextSubtreeIds(runtime.parentScope, fullCorpus);\n if (subtreeIds) {\n listedFrontMatter = listedFrontMatter.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));\n allItems = allItems.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));\n }\n return { listed, listedFrontMatter, allItems, fullCorpus, subtreeIds };\n}\n\nfunction resolveContextSubtreeIds(parentScope: string | undefined, fullCorpus: ItemFrontMatter[]): Set<string> | undefined {\n if (parentScope === undefined) {\n return undefined;\n }\n const subtree = collectSubtreeIds(fullCorpus, parentScope);\n if (!subtree.found) {\n throw new PmCliError(`Context --parent item not found: ${parentScope}`, EXIT_CODE.NOT_FOUND);\n }\n return subtree.ids;\n}\n\nfunction resolveContextFocusGroups(\n listedFrontMatter: ItemFrontMatter[],\n allItems: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n sectionsIncluded: ContextSectionName[],\n limit: number,\n): ContextFocusGroups {\n const ranked = [...listedFrontMatter].sort((left, right) => compareCriticalItems(left, right, statusRegistry));\n const activeStatuses = statusRegistry.active_statuses;\n const activeItems = ranked.filter((item) => activeStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));\n const blockedItems = ranked.filter((item) =>\n statusRegistry.blocked_statuses.has(normalizeStatusForRegistry(item.status, statusRegistry)),\n );\n const childrenByParent = buildChildrenByParent(allItems);\n const focusChildrenByParent = contextNeedsAllItems(sectionsIncluded) ? childrenByParent : undefined;\n const highLevel = activeItems\n .filter((item) => HIGH_LEVEL_TYPES.has(item.type))\n .slice(0, limit)\n .map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent));\n const lowLevel = activeItems\n .filter((item) => !HIGH_LEVEL_TYPES.has(item.type))\n .slice(0, limit)\n .map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent));\n const blockedFallbackUsed = activeItems.length === 0;\n return {\n activeItems,\n blockedItems,\n highLevel,\n lowLevel,\n blockedFallback: blockedFallbackUsed\n ? blockedItems.slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent))\n : [],\n blockedFallbackUsed,\n };\n}\n\nasync function buildContextAgenda(\n options: ContextOptions,\n global: GlobalOptions,\n runtime: ContextRuntime,\n subtreeIds: Set<string> | undefined,\n): Promise<{ agenda: Awaited<ReturnType<typeof runCalendar>>; agendaEvents: CalendarRow[]; agendaSummary: ContextAgendaSummary }> {\n const calendarOptions: CalendarOptions = {\n ...runtime.baseListOptions,\n view: \"agenda\",\n include: \"all\",\n limit: runtime.parentScope === undefined ? String(runtime.limit) : undefined,\n };\n const agenda = await runCalendar(calendarOptions, global);\n const scopedAgenda =\n subtreeIds === undefined\n ? agenda.events\n : agenda.events.filter((event) => subtreeIds.has(event.item_id.trim().toLowerCase()));\n const agendaEvents = filterTerminalCalendarEvents(scopedAgenda, runtime.statusRegistry).slice(0, runtime.limit);\n return { agenda, agendaEvents, agendaSummary: summarizeAgenda(agendaEvents) };\n}\n\nfunction countContextStatus(items: ItemFrontMatter[], status: string | undefined, statusRegistry: RuntimeStatusRegistry): number {\n const targetStatus = String(status);\n return items.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === targetStatus).length;\n}\n\nasync function buildOptionalContextSections(params: {\n runtime: ContextRuntime;\n allItems: ItemFrontMatter[];\n fullCorpus: ItemFrontMatter[];\n focusGroups: ContextFocusGroups;\n now: string;\n global: GlobalOptions;\n}): Promise<ContextOptionalSections> {\n const { runtime, allItems, fullCorpus, focusGroups, now, global } = params;\n const childrenByParent = buildChildrenByParent(allItems);\n const itemMap = new Map(fullCorpus.map((item) => [item.id, item]));\n const allNonTerminal = allItems.filter((item) => !isTerminalStatus(item.status, runtime.statusRegistry));\n const has = (section: ContextSectionName) => runtime.sectionsIncluded.includes(section);\n return {\n hierarchy: has(\"hierarchy\") ? buildHierarchy(allItems, focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : undefined,\n activity: has(\"activity\") ? await buildActivity(runtime.activityLimit, global) : undefined,\n progress: has(\"progress\") ? buildProgress(allItems, focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : undefined,\n blockersSection: has(\"blockers\") ? buildBlockers(focusGroups.blockedItems, itemMap, runtime.limit) : undefined,\n recentlyCreated: has(\"recently_created\")\n ? buildRecentlyCreated(allNonTerminal, runtime.statusRegistry, childrenByParent, runtime.limit)\n : undefined,\n unparented: has(\"unparented\") ? buildUnparented(allNonTerminal, runtime.statusRegistry, childrenByParent, runtime.limit) : undefined,\n filesSection: has(\"files\") ? buildHotFiles(focusGroups.activeItems, runtime.limit) : undefined,\n workload: has(\"workload\") ? buildWorkload(focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : undefined,\n staleness: has(\"staleness\") ? buildStaleness(allNonTerminal, runtime.staleThresholdDays, now, runtime.limit) : undefined,\n tests: has(\"tests\") ? buildTestHealth(focusGroups.activeItems) : undefined,\n };\n}\n\nfunction buildContextSummaryExtras(\n needsAllItems: boolean,\n allItems: ItemFrontMatter[],\n statusRegistry: RuntimeStatusRegistry,\n): Pick<ContextSummary, \"total_items\" | \"closed\" | \"canceled\"> {\n if (!needsAllItems) {\n return {};\n }\n const canceledStatus = normalizeStatusInput(\"canceled\", statusRegistry);\n return {\n total_items: allItems.length,\n closed: allItems.filter((item) => isClosedStatus(item.status, statusRegistry)).length,\n canceled: allItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === canceledStatus).length,\n };\n}\n\nfunction attachOptionalContextSections(result: ContextResult, sections: ContextOptionalSections): void {\n if (sections.hierarchy) result.hierarchy = sections.hierarchy;\n if (sections.activity) result.activity = sections.activity;\n if (sections.progress) result.progress = sections.progress;\n if (sections.blockersSection) result.blockers = sections.blockersSection;\n if (sections.recentlyCreated) result.recently_created = sections.recentlyCreated;\n if (sections.unparented) result.unparented = sections.unparented;\n if (sections.filesSection) result.files = sections.filesSection;\n if (sections.workload) result.workload = sections.workload;\n if (sections.staleness) result.staleness = sections.staleness;\n if (sections.tests) result.tests = sections.tests;\n}\n\nfunction applyContextFocusProjection(result: ContextResult, focusFields: string[] | undefined): void {\n if (!focusFields) {\n return;\n }\n result.focus_fields = focusFields;\n result.high_level = projectContextFocusRows(result.high_level, focusFields);\n result.low_level = projectContextFocusRows(result.low_level, focusFields);\n result.blocked_fallback = projectContextFocusRows(result.blocked_fallback, focusFields);\n if (result.recently_created) {\n result.recently_created = projectContextFocusRows(result.recently_created, focusFields) as RecentContextItem[];\n }\n if (result.unparented) {\n result.unparented = projectContextFocusRows(result.unparented, focusFields);\n }\n}\n\nfunction maybeAttachEmptyContextSuggestions(result: ContextResult, activeItems: ItemFrontMatter[], blockedItems: ItemFrontMatter[]): void {\n if (activeItems.length > 0 || blockedItems.length > 0 || result.agenda.events.length > 0) {\n return;\n }\n result.suggestions = [\n 'pm create --type Task --title \"...\" to add a new work item',\n \"pm list --status closed --limit 5 to review recent completions\",\n \"pm search <keywords> to find related past work\",\n \"pm aggregate for a full project status overview\",\n ];\n}\n\n/**\n * Implements run context for the public runtime surface of this module.\n */\nexport async function runContext(options: ContextOptions, global: GlobalOptions): Promise<ContextResult> {\n const runtime = await resolveContextRuntime(options, global);\n const corpus = await loadContextCorpus(options, global, runtime);\n const focusGroups = resolveContextFocusGroups(\n corpus.listedFrontMatter,\n corpus.allItems,\n runtime.statusRegistry,\n runtime.sectionsIncluded,\n runtime.limit,\n );\n const agendaContext = await buildContextAgenda(options, global, runtime, corpus.subtreeIds);\n const warnings = mergeSortedWarnings(corpus.listed.warnings, agendaContext.agenda.warnings);\n const inProgressCount = countContextStatus(\n focusGroups.activeItems,\n normalizeStatusInput(\"in_progress\", runtime.statusRegistry),\n runtime.statusRegistry,\n );\n const openCount = countContextStatus(\n focusGroups.activeItems,\n normalizeStatusInput(\"open\", runtime.statusRegistry),\n runtime.statusRegistry,\n );\n const sections = await buildOptionalContextSections({\n runtime,\n allItems: corpus.allItems,\n fullCorpus: corpus.fullCorpus,\n focusGroups,\n now: agendaContext.agenda.now,\n global,\n });\n const summaryExtras = buildContextSummaryExtras(\n contextNeedsAllItems(runtime.sectionsIncluded),\n corpus.allItems,\n runtime.statusRegistry,\n );\n\n const result: ContextResult = {\n output_default: \"toon\",\n now: agendaContext.agenda.now,\n depth: runtime.depth,\n sections_included: runtime.sectionsIncluded,\n window: {\n anchor: agendaContext.agenda.anchor,\n start: agendaContext.agenda.range.start,\n end: agendaContext.agenda.range.end,\n past: agendaContext.agenda.range.past,\n from: agendaContext.agenda.range.from,\n to: agendaContext.agenda.range.to,\n },\n filters: {\n type: options.type ?? null,\n tag: options.tag ?? null,\n priority: options.priority ?? null,\n assignee: options.assignee ?? null,\n assignee_filter: options.assigneeFilter ?? null,\n sprint: options.sprint ?? null,\n release: options.release ?? null,\n limit: options.limit ?? null,\n parent: runtime.parentScope ?? null,\n /* c8 ignore next -- listed/calendar runtime filters are always materialized by their command handlers */\n runtime_filters: (corpus.listed.filters.runtime_filters ?? agendaContext.agenda.filters.runtime_filters ?? {}) as Record<string, unknown>,\n },\n summary: {\n active_items: focusGroups.activeItems.length,\n in_progress: inProgressCount,\n open: openCount,\n blocked: focusGroups.blockedItems.length,\n blocked_fallback_used: focusGroups.blockedFallbackUsed,\n high_level: focusGroups.highLevel.length,\n low_level: focusGroups.lowLevel.length,\n agenda_events: agendaContext.agendaSummary.events,\n ...summaryExtras,\n },\n high_level: focusGroups.highLevel,\n low_level: focusGroups.lowLevel,\n blocked_fallback: focusGroups.blockedFallback,\n agenda: {\n summary: agendaContext.agendaSummary,\n events: agendaContext.agendaEvents,\n },\n };\n\n attachOptionalContextSections(result, sections);\n applyContextFocusProjection(result, runtime.focusFields);\n if (warnings.length > 0) result.warnings = warnings;\n maybeAttachEmptyContextSuggestions(result, focusGroups.activeItems, focusGroups.blockedItems);\n\n return result;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,IAAM,wBAAwB,CAAC,YAAY,QAAQ,MAAM;AAiQhE,IAAM,mBAAmB,oBAAI,IAAY,CAAC,QAAQ,SAAS,CAAC;AAC5D,IAAM,wBAAwB;AAE9B,IAAM,oBAA0C,CAAC,aAAa,YAAY,YAAY,oBAAoB,cAAc,UAAU;AAClI,IAAM,gBAAsC;EAC1C,GAAG;EACH;EACA;EACA;EACA;;AAEF,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAC7B,IAAM,eAAe;AACrB,IAAM,mBAAmB;AAMzB,SAAS,kBAAkB,KAAuB;AAChD,MAAI,CAAC;AAAK,WAAO;AACjB,QAAM,aAAa,IAAI,KAAI,EAAG,YAAW;AACzC,MAAI,CAAC,sBAAsB,SAAS,UAAiC,GAAG;AACtE,UAAM,IAAI,WAAW,oDAAoD,UAAU,KAAK;EAC1F;AACA,SAAO;AACT;AAKA,IAAM,0BAA0B,oBAAI,IAAY;EAC9C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AAMK,SAAU,wBAAwB,KAAuB;AAC7D,MAAI,QAAQ;AAAW,WAAO;AAC9B,QAAM,SAAmB,CAAA;AACzB,aAAW,SAAS,IAAI,MAAM,GAAG,GAAG;AAClC,UAAM,aAAa,MAAM,KAAI,EAAG,YAAW;AAC3C,QAAI,WAAW,WAAW;AAAG;AAC7B,QAAI,CAAC,wBAAwB,IAAI,UAAU,GAAG;AAC5C,YAAM,IAAI,WACR,2CAA2C,UAAU,YAAY,CAAC,GAAG,uBAAuB,EAAE,KAAK,IAAI,CAAC,KAC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;IAEL,YAAY,YAAY;IACxB,WAAW,YAAY;IACvB,kBAAkB,YAAY;IAC9B,QAAQ;MACN,SAAS,cAAc;MACvB,QAAQ,cAAc;;;AAI1B,gCAA8B,QAAQ,QAAQ;AAC9C,8BAA4B,QAAQ,QAAQ,WAAW;AACvD,MAAI,SAAS,SAAS;AAAG,WAAO,WAAW;AAC3C,qCAAmC,QAAQ,YAAY,aAAa,YAAY,YAAY;AAE5F,SAAO;AACT","debugId":"034228c0-2ef9-5500-a0de-723ef2544e22"}
@@ -1,272 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="dcbbdaca-5a6d-5e33-bb6f-94ff876a6112")}catch(e){}}();
3
- import {
4
- CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS
5
- } from "./chunk-PPE4YUQM.js";
6
- import {
7
- nowIso
8
- } from "./chunk-FJRKQREY.js";
9
- import {
10
- PmCliError
11
- } from "./chunk-US3T3W5J.js";
12
- import {
13
- EXIT_CODE,
14
- getSettingsPath,
15
- pathExists,
16
- readFileIfExists,
17
- resolvePmRoot,
18
- writeFileAtomic
19
- } from "./chunk-YD5FML7K.js";
20
-
21
- // dist/cli/commands/templates.js
22
- import fs from "node:fs/promises";
23
- import path from "node:path";
24
- var TEMPLATE_DIRECTORY_NAME = "templates";
25
- var TEMPLATE_FILE_EXTENSION = ".json";
26
- var TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
27
- var TEMPLATE_OPTION_REPEATABLE_KEYS = CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target);
28
- var TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set(TEMPLATE_OPTION_REPEATABLE_KEYS);
29
- var BUILTIN_TEMPLATE_TIMESTAMP = "1970-01-01T00:00:00.000Z";
30
- var BUILTIN_TEMPLATES = {
31
- bug: {
32
- type: "Issue",
33
- priority: "1",
34
- tags: "bug",
35
- acceptanceCriteria: "Bug no longer reproduces with the steps below and a regression test guards it.",
36
- expectedResult: "Describe the correct behavior.",
37
- actualResult: "Describe the observed (buggy) behavior.",
38
- body: "## Repro steps\n1. \n2. \n3. \n\n## Expected\n\n## Actual\n"
39
- },
40
- feature: {
41
- type: "Feature",
42
- priority: "2",
43
- tags: "feature",
44
- acceptanceCriteria: "Feature is shipped behind agreed scope with tests and docs updated.",
45
- whyNow: "Explain why this is worth doing now (impact / urgency).",
46
- body: "## Goal\n\n## Why now\n\n## Out of scope\n"
47
- },
48
- spike: {
49
- type: "Task",
50
- priority: "2",
51
- tags: "spike",
52
- estimatedMinutes: "120",
53
- acceptanceCriteria: "Timeboxed investigation complete; findings and a recommendation are recorded.",
54
- body: "## Question to answer\n\n## Timebox\n2h\n\n## Findings\n\n## Recommendation\n"
55
- },
56
- chore: {
57
- type: "Chore",
58
- priority: "3",
59
- tags: "chore",
60
- acceptanceCriteria: "Maintenance task done with no behavior change and green checks.",
61
- body: "## What\n\n## Why\n"
62
- }
63
- };
64
- function normalizeTemplateName(rawName) {
65
- const name = rawName.trim();
66
- if (!TEMPLATE_NAME_PATTERN.test(name)) {
67
- throw new PmCliError(`Invalid template name "${rawName}". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`, EXIT_CODE.USAGE);
68
- }
69
- return name;
70
- }
71
- function templatesDirectory(pmRoot) {
72
- return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);
73
- }
74
- function templatePath(pmRoot, normalizedName) {
75
- return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);
76
- }
77
- async function ensureTrackerInitialized(pmRoot) {
78
- if (!await pathExists(getSettingsPath(pmRoot))) {
79
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
80
- }
81
- }
82
- function sortTemplateOptions(options) {
83
- return Object.fromEntries(Object.entries(options).sort(([left], [right]) => left.localeCompare(right)));
84
- }
85
- function extractTemplateOptions(rawOptions) {
86
- const next = {};
87
- for (const [key, value] of Object.entries(rawOptions)) {
88
- if (value === void 0) {
89
- continue;
90
- }
91
- if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {
92
- if (typeof value === "string") {
93
- next[key] = [value];
94
- continue;
95
- }
96
- if (!Array.isArray(value)) {
97
- continue;
98
- }
99
- const values = value.filter((entry) => typeof entry === "string");
100
- if (values.length > 0) {
101
- next[key] = values;
102
- }
103
- continue;
104
- }
105
- if (typeof value === "string") {
106
- next[key] = value;
107
- continue;
108
- }
109
- if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
110
- next[key] = [...value];
111
- }
112
- }
113
- return sortTemplateOptions(next);
114
- }
115
- function parseStoredTemplateOptions(rawOptions, templateName) {
116
- if (typeof rawOptions !== "object" || rawOptions === null || Array.isArray(rawOptions)) {
117
- throw new PmCliError(`Template "${templateName}" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);
118
- }
119
- const optionsRecord = rawOptions;
120
- const normalized = {};
121
- for (const [key, value] of Object.entries(optionsRecord)) {
122
- const normalizedKey = key.trim();
123
- if (normalizedKey.length === 0) {
124
- throw new PmCliError(`Template "${templateName}" contains an empty option key.`, EXIT_CODE.GENERIC_FAILURE);
125
- }
126
- if (typeof value === "string") {
127
- normalized[normalizedKey] = value;
128
- continue;
129
- }
130
- if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
131
- normalized[normalizedKey] = [...value];
132
- continue;
133
- }
134
- throw new PmCliError(`Template "${templateName}" contains invalid value for option "${normalizedKey}".`, EXIT_CODE.GENERIC_FAILURE);
135
- }
136
- return sortTemplateOptions(normalized);
137
- }
138
- function parseStoredTemplateDocument(raw, normalizedName) {
139
- let parsed;
140
- try {
141
- parsed = JSON.parse(raw);
142
- } catch {
143
- throw new PmCliError(`Template "${normalizedName}" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);
144
- }
145
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
146
- throw new PmCliError(`Template "${normalizedName}" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);
147
- }
148
- const record = parsed;
149
- const options = parseStoredTemplateOptions(record.options, normalizedName);
150
- const now = nowIso();
151
- return {
152
- name: typeof record.name === "string" && record.name.trim().length > 0 ? record.name.trim() : normalizedName,
153
- created_at: typeof record.created_at === "string" ? record.created_at : now,
154
- updated_at: typeof record.updated_at === "string" ? record.updated_at : now,
155
- options
156
- };
157
- }
158
- function builtinTemplateDocument(normalizedName) {
159
- const options = BUILTIN_TEMPLATES[normalizedName];
160
- if (!options) {
161
- return null;
162
- }
163
- return {
164
- name: normalizedName,
165
- created_at: BUILTIN_TEMPLATE_TIMESTAMP,
166
- updated_at: BUILTIN_TEMPLATE_TIMESTAMP,
167
- options: sortTemplateOptions({ ...options })
168
- };
169
- }
170
- async function resolveTemplateDocument(pmRoot, normalizedName) {
171
- const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));
172
- if (raw !== null) {
173
- return { document: parseStoredTemplateDocument(raw, normalizedName), source: "user" };
174
- }
175
- const builtin = builtinTemplateDocument(normalizedName);
176
- if (builtin) {
177
- return { document: builtin, source: "builtin" };
178
- }
179
- throw new PmCliError(`Template "${normalizedName}" not found`, EXIT_CODE.NOT_FOUND);
180
- }
181
- async function readStoredTemplateDocument(pmRoot, normalizedName) {
182
- const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));
183
- if (raw === null) {
184
- throw new PmCliError(`Template "${normalizedName}" not found`, EXIT_CODE.NOT_FOUND);
185
- }
186
- return parseStoredTemplateDocument(raw, normalizedName);
187
- }
188
- async function loadCreateTemplateOptions(pmRoot, rawTemplateName) {
189
- const normalizedName = normalizeTemplateName(rawTemplateName);
190
- const { document } = await resolveTemplateDocument(pmRoot, normalizedName);
191
- return document.options;
192
- }
193
- async function runTemplatesSave(rawTemplateName, options, global) {
194
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
195
- await ensureTrackerInitialized(pmRoot);
196
- const normalizedName = normalizeTemplateName(rawTemplateName);
197
- const nextOptions = extractTemplateOptions(options);
198
- if (Object.keys(nextOptions).length === 0) {
199
- throw new PmCliError("templates save requires at least one create option flag", EXIT_CODE.USAGE);
200
- }
201
- const now = nowIso();
202
- const storedPath = templatePath(pmRoot, normalizedName);
203
- let createdAt = now;
204
- if (await pathExists(storedPath)) {
205
- const existing = await readStoredTemplateDocument(pmRoot, normalizedName);
206
- createdAt = existing.created_at;
207
- }
208
- const document = {
209
- name: normalizedName,
210
- created_at: createdAt,
211
- updated_at: now,
212
- options: nextOptions
213
- };
214
- await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });
215
- await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}
216
- `);
217
- return {
218
- name: document.name,
219
- created_at: document.created_at,
220
- updated_at: document.updated_at,
221
- path: storedPath,
222
- options: document.options
223
- };
224
- }
225
- async function readUserTemplateNames(pmRoot) {
226
- const dirPath = templatesDirectory(pmRoot);
227
- if (!await pathExists(dirPath)) {
228
- return [];
229
- }
230
- const entries = await fs.readdir(dirPath);
231
- return entries.filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION)).map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length)).filter((entry) => TEMPLATE_NAME_PATTERN.test(entry));
232
- }
233
- async function runTemplatesList(global) {
234
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
235
- await ensureTrackerInitialized(pmRoot);
236
- const userTemplates = await readUserTemplateNames(pmRoot);
237
- const userTemplateSet = new Set(userTemplates);
238
- const builtinTemplates = Object.keys(BUILTIN_TEMPLATES).filter((name) => !userTemplateSet.has(name));
239
- const sortedUser = [...userTemplates].sort((left, right) => left.localeCompare(right));
240
- const sortedBuiltin = [...builtinTemplates].sort((left, right) => left.localeCompare(right));
241
- const templates = [.../* @__PURE__ */ new Set([...sortedUser, ...sortedBuiltin])].sort((left, right) => left.localeCompare(right));
242
- return {
243
- templates,
244
- count: templates.length,
245
- builtin_templates: sortedBuiltin,
246
- user_templates: sortedUser
247
- };
248
- }
249
- async function runTemplatesShow(rawTemplateName, global) {
250
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
251
- await ensureTrackerInitialized(pmRoot);
252
- const normalizedName = normalizeTemplateName(rawTemplateName);
253
- const { document, source } = await resolveTemplateDocument(pmRoot, normalizedName);
254
- return {
255
- name: document.name,
256
- source,
257
- created_at: document.created_at,
258
- updated_at: document.updated_at,
259
- path: source === "builtin" ? `builtin:${normalizedName}` : templatePath(pmRoot, normalizedName),
260
- options: document.options
261
- };
262
- }
263
-
264
- export {
265
- loadCreateTemplateOptions,
266
- runTemplatesSave,
267
- runTemplatesList,
268
- runTemplatesShow
269
- };
270
- //# sourceMappingURL=chunk-T4MX77AK.js.map
271
-
272
- //# debugId=dcbbdaca-5a6d-5e33-bb6f-94ff876a6112
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../../cli/commands/templates.ts"],"sourcesContent":["/**\n * @module cli/commands/templates\n *\n * Implements the pm templates command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport {\n CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,\n} from \"../../sdk/cli-contracts.js\";\n\nconst TEMPLATE_DIRECTORY_NAME = \"templates\";\nconst TEMPLATE_FILE_EXTENSION = \".json\";\nconst TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\nconst TEMPLATE_OPTION_REPEATABLE_KEYS = CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target);\nconst TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set<string>(TEMPLATE_OPTION_REPEATABLE_KEYS);\n\ntype TemplateOptionValue = string | string[];\n/**\n * Restricts create template options values accepted by command, SDK, and storage contracts.\n */\nexport type CreateTemplateOptions = Record<string, TemplateOptionValue>;\n/**\n * Restricts template source values accepted by command, SDK, and storage contracts.\n */\nexport type TemplateSource = \"builtin\" | \"user\";\n\nconst BUILTIN_TEMPLATE_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\nconst BUILTIN_TEMPLATES: Readonly<Record<string, CreateTemplateOptions>> = {\n bug: {\n type: \"Issue\",\n priority: \"1\",\n tags: \"bug\",\n acceptanceCriteria: \"Bug no longer reproduces with the steps below and a regression test guards it.\",\n expectedResult: \"Describe the correct behavior.\",\n actualResult: \"Describe the observed (buggy) behavior.\",\n body: \"## Repro steps\\n1. \\n2. \\n3. \\n\\n## Expected\\n\\n## Actual\\n\",\n },\n feature: {\n type: \"Feature\",\n priority: \"2\",\n tags: \"feature\",\n acceptanceCriteria: \"Feature is shipped behind agreed scope with tests and docs updated.\",\n whyNow: \"Explain why this is worth doing now (impact / urgency).\",\n body: \"## Goal\\n\\n## Why now\\n\\n## Out of scope\\n\",\n },\n spike: {\n type: \"Task\",\n priority: \"2\",\n tags: \"spike\",\n estimatedMinutes: \"120\",\n acceptanceCriteria: \"Timeboxed investigation complete; findings and a recommendation are recorded.\",\n body: \"## Question to answer\\n\\n## Timebox\\n2h\\n\\n## Findings\\n\\n## Recommendation\\n\",\n },\n chore: {\n type: \"Chore\",\n priority: \"3\",\n tags: \"chore\",\n acceptanceCriteria: \"Maintenance task done with no behavior change and green checks.\",\n body: \"## What\\n\\n## Why\\n\",\n },\n};\n\ninterface StoredCreateTemplateDocument {\n name: string;\n created_at: string;\n updated_at: string;\n options: CreateTemplateOptions;\n}\n\nexport const _testOnly = {\n normalizeTemplateName,\n extractTemplateOptions,\n parseStoredTemplateDocument,\n builtinTemplateDocument,\n readStoredTemplateDocument,\n};\n\n/**\n * Documents the templates save result payload exchanged by command, SDK, and package integrations.\n */\nexport interface TemplatesSaveResult {\n name: string;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\n/**\n * Documents the templates list result payload exchanged by command, SDK, and package integrations.\n */\nexport interface TemplatesListResult {\n templates: string[];\n count: number;\n builtin_templates: string[];\n user_templates: string[];\n}\n\n/**\n * Documents the templates show result payload exchanged by command, SDK, and package integrations.\n */\nexport interface TemplatesShowResult {\n name: string;\n source: TemplateSource;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\nfunction normalizeTemplateName(rawName: string): string {\n const name = rawName.trim();\n if (!TEMPLATE_NAME_PATTERN.test(name)) {\n throw new PmCliError(\n `Invalid template name \"${rawName}\". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,\n EXIT_CODE.USAGE,\n );\n }\n return name;\n}\n\nfunction templatesDirectory(pmRoot: string): string {\n return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);\n}\n\nfunction templatePath(pmRoot: string, normalizedName: string): string {\n return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);\n}\n\nasync function ensureTrackerInitialized(pmRoot: string): Promise<void> {\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n}\n\nfunction sortTemplateOptions(options: CreateTemplateOptions): CreateTemplateOptions {\n return Object.fromEntries(\n Object.entries(options).sort(([left], [right]) => left.localeCompare(right)),\n ) as CreateTemplateOptions;\n}\n\nfunction extractTemplateOptions(rawOptions: Record<string, unknown>): CreateTemplateOptions {\n const next: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(rawOptions)) {\n if (value === undefined) {\n continue;\n }\n if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {\n if (typeof value === \"string\") {\n next[key] = [value];\n continue;\n }\n if (!Array.isArray(value)) {\n continue;\n }\n const values = value.filter((entry): entry is string => typeof entry === \"string\");\n if (values.length > 0) {\n next[key] = values;\n }\n continue;\n }\n if (typeof value === \"string\") {\n next[key] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n next[key] = [...value];\n }\n }\n return sortTemplateOptions(next);\n}\n\nfunction parseStoredTemplateOptions(rawOptions: unknown, templateName: string): CreateTemplateOptions {\n if (typeof rawOptions !== \"object\" || rawOptions === null || Array.isArray(rawOptions)) {\n throw new PmCliError(`Template \"${templateName}\" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const optionsRecord = rawOptions as Record<string, unknown>;\n const normalized: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(optionsRecord)) {\n const normalizedKey = key.trim();\n if (normalizedKey.length === 0) {\n throw new PmCliError(\n `Template \"${templateName}\" contains an empty option key.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (typeof value === \"string\") {\n normalized[normalizedKey] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n normalized[normalizedKey] = [...value];\n continue;\n }\n throw new PmCliError(\n `Template \"${templateName}\" contains invalid value for option \"${normalizedKey}\".`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return sortTemplateOptions(normalized);\n}\n\nfunction parseStoredTemplateDocument(raw: string, normalizedName: string): StoredCreateTemplateDocument {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new PmCliError(`Template \"${normalizedName}\" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new PmCliError(`Template \"${normalizedName}\" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const record = parsed as Record<string, unknown>;\n const options = parseStoredTemplateOptions(record.options, normalizedName);\n const now = nowIso();\n return {\n name: typeof record.name === \"string\" && record.name.trim().length > 0 ? record.name.trim() : normalizedName,\n created_at: typeof record.created_at === \"string\" ? record.created_at : now,\n updated_at: typeof record.updated_at === \"string\" ? record.updated_at : now,\n options,\n };\n}\n\nfunction builtinTemplateDocument(normalizedName: string): StoredCreateTemplateDocument | null {\n const options = BUILTIN_TEMPLATES[normalizedName];\n if (!options) {\n return null;\n }\n return {\n name: normalizedName,\n created_at: BUILTIN_TEMPLATE_TIMESTAMP,\n updated_at: BUILTIN_TEMPLATE_TIMESTAMP,\n options: sortTemplateOptions({ ...options }),\n };\n}\n\ninterface ResolvedTemplateDocument {\n document: StoredCreateTemplateDocument;\n source: TemplateSource;\n}\n\nasync function resolveTemplateDocument(pmRoot: string, normalizedName: string): Promise<ResolvedTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw !== null) {\n return { document: parseStoredTemplateDocument(raw, normalizedName), source: \"user\" };\n }\n const builtin = builtinTemplateDocument(normalizedName);\n if (builtin) {\n return { document: builtin, source: \"builtin\" };\n }\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n}\n\nasync function readStoredTemplateDocument(pmRoot: string, normalizedName: string): Promise<StoredCreateTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw === null) {\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n }\n return parseStoredTemplateDocument(raw, normalizedName);\n}\n\n/**\n * Implements load create template options for the public runtime surface of this module.\n */\nexport async function loadCreateTemplateOptions(pmRoot: string, rawTemplateName: string): Promise<CreateTemplateOptions> {\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document } = await resolveTemplateDocument(pmRoot, normalizedName);\n return document.options;\n}\n\n/**\n * Implements run templates save for the public runtime surface of this module.\n */\nexport async function runTemplatesSave(\n rawTemplateName: string,\n options: Record<string, unknown>,\n global: GlobalOptions,\n): Promise<TemplatesSaveResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const nextOptions = extractTemplateOptions(options);\n if (Object.keys(nextOptions).length === 0) {\n throw new PmCliError(\"templates save requires at least one create option flag\", EXIT_CODE.USAGE);\n }\n\n const now = nowIso();\n const storedPath = templatePath(pmRoot, normalizedName);\n let createdAt = now;\n if (await pathExists(storedPath)) {\n const existing = await readStoredTemplateDocument(pmRoot, normalizedName);\n createdAt = existing.created_at;\n }\n\n const document: StoredCreateTemplateDocument = {\n name: normalizedName,\n created_at: createdAt,\n updated_at: now,\n options: nextOptions,\n };\n await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });\n await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}\\n`);\n return {\n name: document.name,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: storedPath,\n options: document.options,\n };\n}\n\nasync function readUserTemplateNames(pmRoot: string): Promise<string[]> {\n const dirPath = templatesDirectory(pmRoot);\n if (!(await pathExists(dirPath))) {\n return [];\n }\n const entries = await fs.readdir(dirPath);\n return entries\n .filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION))\n .map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length))\n .filter((entry) => TEMPLATE_NAME_PATTERN.test(entry));\n}\n\n/**\n * Implements run templates list for the public runtime surface of this module.\n */\nexport async function runTemplatesList(global: GlobalOptions): Promise<TemplatesListResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const userTemplates = await readUserTemplateNames(pmRoot);\n const userTemplateSet = new Set<string>(userTemplates);\n const builtinTemplates = Object.keys(BUILTIN_TEMPLATES).filter((name) => !userTemplateSet.has(name));\n const sortedUser = [...userTemplates].sort((left, right) => left.localeCompare(right));\n const sortedBuiltin = [...builtinTemplates].sort((left, right) => left.localeCompare(right));\n const templates = [...new Set([...sortedUser, ...sortedBuiltin])].sort((left, right) => left.localeCompare(right));\n return {\n templates,\n count: templates.length,\n builtin_templates: sortedBuiltin,\n user_templates: sortedUser,\n };\n}\n\n/**\n * Implements run templates show for the public runtime surface of this module.\n */\nexport async function runTemplatesShow(rawTemplateName: string, global: GlobalOptions): Promise<TemplatesShowResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document, source } = await resolveTemplateDocument(pmRoot, normalizedName);\n return {\n name: document.name,\n source,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: source === \"builtin\" ? `builtin:${normalizedName}` : templatePath(pmRoot, normalizedName),\n options: document.options,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,QAAQ;AACf,OAAO,UAAU;AAWjB,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,wBAAwB;AAE9B,IAAM,kCAAkC,6CAA6C,IAAI,CAAC,UAAU,MAAM,MAAM;AAChH,IAAM,qCAAqC,IAAI,IAAY,+BAA+B;AAY1F,IAAM,6BAA6B;AACnC,IAAM,oBAAqE;EACzE,KAAK;IACH,MAAM;IACN,UAAU;IACV,MAAM;IACN,oBAAoB;IACpB,gBAAgB;IAChB,cAAc;IACd,MAAM;;EAER,SAAS;IACP,MAAM;IACN,UAAU;IACV,MAAM;IACN,oBAAoB;IACpB,QAAQ;IACR,MAAM;;EAER,OAAO;IACL,MAAM;IACN,UAAU;IACV,MAAM;IACN,kBAAkB;IAClB,oBAAoB;IACpB,MAAM;;EAER,OAAO;IACL,MAAM;IACN,UAAU;IACV,MAAM;IACN,oBAAoB;IACpB,MAAM;;;AAoDV,SAAS,sBAAsB,SAAe;AAC5C,QAAM,OAAO,QAAQ,KAAI;AACzB,MAAI,CAAC,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