@unbrained/pm-cli 2026.7.1 → 2026.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (625) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/CHANGELOG.md +25 -0
  3. package/CONTRIBUTING.md +2 -2
  4. package/README.md +1 -1
  5. package/dist/cli/commander-usage.d.ts +2 -0
  6. package/dist/cli/commander-usage.js +110 -86
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/activity.js +79 -57
  9. package/dist/cli/commands/activity.js.map +1 -1
  10. package/dist/cli/commands/aggregate.js +102 -79
  11. package/dist/cli/commands/aggregate.js.map +1 -1
  12. package/dist/cli/commands/calendar.js +278 -243
  13. package/dist/cli/commands/calendar.js.map +1 -1
  14. package/dist/cli/commands/close-many.js +176 -114
  15. package/dist/cli/commands/close-many.js.map +1 -1
  16. package/dist/cli/commands/close.js +157 -129
  17. package/dist/cli/commands/close.js.map +1 -1
  18. package/dist/cli/commands/comments-audit.js +50 -42
  19. package/dist/cli/commands/comments-audit.js.map +1 -1
  20. package/dist/cli/commands/config.d.ts +2 -0
  21. package/dist/cli/commands/config.js +443 -879
  22. package/dist/cli/commands/config.js.map +1 -1
  23. package/dist/cli/commands/context.js +365 -287
  24. package/dist/cli/commands/context.js.map +1 -1
  25. package/dist/cli/commands/contracts.js +352 -238
  26. package/dist/cli/commands/contracts.js.map +1 -1
  27. package/dist/cli/commands/create.js +32 -17
  28. package/dist/cli/commands/create.js.map +1 -1
  29. package/dist/cli/commands/dedupe-audit.js +46 -39
  30. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  31. package/dist/cli/commands/dedupe-merge.js +88 -69
  32. package/dist/cli/commands/dedupe-merge.js.map +1 -1
  33. package/dist/cli/commands/extension/doctor.js +56 -67
  34. package/dist/cli/commands/extension/doctor.js.map +1 -1
  35. package/dist/cli/commands/extension/shared.js +21 -15
  36. package/dist/cli/commands/extension/shared.js.map +1 -1
  37. package/dist/cli/commands/get.js +114 -81
  38. package/dist/cli/commands/get.js.map +1 -1
  39. package/dist/cli/commands/health.d.ts +17 -0
  40. package/dist/cli/commands/health.js +545 -417
  41. package/dist/cli/commands/health.js.map +1 -1
  42. package/dist/cli/commands/history-compact.js +209 -140
  43. package/dist/cli/commands/history-compact.js.map +1 -1
  44. package/dist/cli/commands/history-redact.js +162 -119
  45. package/dist/cli/commands/history-redact.js.map +1 -1
  46. package/dist/cli/commands/history-repair.js +120 -85
  47. package/dist/cli/commands/history-repair.js.map +1 -1
  48. package/dist/cli/commands/init-agent-guidance.js +32 -19
  49. package/dist/cli/commands/init-agent-guidance.js.map +1 -1
  50. package/dist/cli/commands/init.d.ts +8 -2
  51. package/dist/cli/commands/init.js +263 -162
  52. package/dist/cli/commands/init.js.map +1 -1
  53. package/dist/cli/commands/list.js +152 -102
  54. package/dist/cli/commands/list.js.map +1 -1
  55. package/dist/cli/commands/next.js +60 -40
  56. package/dist/cli/commands/next.js.map +1 -1
  57. package/dist/cli/commands/plan.js +373 -298
  58. package/dist/cli/commands/plan.js.map +1 -1
  59. package/dist/cli/commands/profile.js +23 -15
  60. package/dist/cli/commands/profile.js.map +1 -1
  61. package/dist/cli/commands/recurrence-parsers.js +43 -25
  62. package/dist/cli/commands/recurrence-parsers.js.map +1 -1
  63. package/dist/cli/commands/reindex.d.ts +21 -5
  64. package/dist/cli/commands/reindex.js +345 -205
  65. package/dist/cli/commands/reindex.js.map +1 -1
  66. package/dist/cli/commands/restore.d.ts +8 -7
  67. package/dist/cli/commands/restore.js +105 -69
  68. package/dist/cli/commands/restore.js.map +1 -1
  69. package/dist/cli/commands/schema.js +33 -30
  70. package/dist/cli/commands/schema.js.map +1 -1
  71. package/dist/cli/commands/search.d.ts +10 -2
  72. package/dist/cli/commands/search.js +503 -470
  73. package/dist/cli/commands/search.js.map +1 -1
  74. package/dist/cli/commands/telemetry.js +98 -87
  75. package/dist/cli/commands/telemetry.js.map +1 -1
  76. package/dist/cli/commands/test-all.js +237 -168
  77. package/dist/cli/commands/test-all.js.map +1 -1
  78. package/dist/cli/commands/test.d.ts +6 -5
  79. package/dist/cli/commands/test.js +424 -344
  80. package/dist/cli/commands/test.js.map +1 -1
  81. package/dist/cli/commands/update-many.js +57 -42
  82. package/dist/cli/commands/update-many.js.map +1 -1
  83. package/dist/cli/commands/update.d.ts +1 -1
  84. package/dist/cli/commands/update.js +738 -671
  85. package/dist/cli/commands/update.js.map +1 -1
  86. package/dist/cli/commands/validate.d.ts +20 -1
  87. package/dist/cli/commands/validate.js +478 -343
  88. package/dist/cli/commands/validate.js.map +1 -1
  89. package/dist/cli/error-guidance.js +406 -361
  90. package/dist/cli/error-guidance.js.map +1 -1
  91. package/dist/cli/extension-command-help.js +27 -19
  92. package/dist/cli/extension-command-help.js.map +1 -1
  93. package/dist/cli/help-json-payload.js +57 -49
  94. package/dist/cli/help-json-payload.js.map +1 -1
  95. package/dist/cli/main.d.ts +47 -0
  96. package/dist/cli/main.js +474 -371
  97. package/dist/cli/main.js.map +1 -1
  98. package/dist/cli/migration-gates.js +22 -45
  99. package/dist/cli/migration-gates.js.map +1 -1
  100. package/dist/cli/register-list-query.js +299 -310
  101. package/dist/cli/register-list-query.js.map +1 -1
  102. package/dist/cli/register-mutation.js +763 -779
  103. package/dist/cli/register-mutation.js.map +1 -1
  104. package/dist/cli/register-operations.js +386 -362
  105. package/dist/cli/register-operations.js.map +1 -1
  106. package/dist/cli/register-setup.js +120 -101
  107. package/dist/cli/register-setup.js.map +1 -1
  108. package/dist/cli/registration-helpers.d.ts +4 -0
  109. package/dist/cli/registration-helpers.js +45 -56
  110. package/dist/cli/registration-helpers.js.map +1 -1
  111. package/dist/cli-bundle/chunks/{activity-DBLQVIP6.js → activity-5YWLSPGE.js} +9 -9
  112. package/dist/cli-bundle/chunks/activity-BIML7K2D.js +16 -0
  113. package/dist/cli-bundle/chunks/{aggregate-SDF7DUOD.js → aggregate-2V2M3JZU.js} +107 -83
  114. package/dist/cli-bundle/chunks/{aggregate-SDF7DUOD.js.map → aggregate-2V2M3JZU.js.map} +2 -2
  115. package/dist/cli-bundle/chunks/{aggregate-JTEF4BP7.js → aggregate-EK7DXML7.js} +108 -84
  116. package/dist/cli-bundle/chunks/aggregate-EK7DXML7.js.map +1 -0
  117. package/dist/cli-bundle/chunks/{append-LOVPGVPT.js → append-EZESUVJT.js} +8 -8
  118. package/dist/cli-bundle/chunks/{append-QCFJSDFL.js → append-JFG4WQMG.js} +8 -8
  119. package/dist/cli-bundle/chunks/{chunk-TP5Q5ZD3.js → chunk-32IUNTG4.js} +158 -119
  120. package/dist/cli-bundle/chunks/chunk-32IUNTG4.js.map +1 -0
  121. package/dist/cli-bundle/chunks/{chunk-BHO33VBQ.js → chunk-3W2HJKJX.js} +3 -3
  122. package/dist/cli-bundle/chunks/{chunk-VARHOHYV.js → chunk-4EXFFP7T.js} +86 -52
  123. package/dist/cli-bundle/chunks/chunk-4EXFFP7T.js.map +7 -0
  124. package/dist/cli-bundle/chunks/{chunk-4DUVCVLZ.js → chunk-4PFVUUYV.js} +2 -2
  125. package/dist/cli-bundle/chunks/{chunk-JSU5P7VS.js → chunk-4WB6S4YX.js} +308 -184
  126. package/dist/cli-bundle/chunks/chunk-4WB6S4YX.js.map +1 -0
  127. package/dist/cli-bundle/chunks/{chunk-HXTQJXWT.js → chunk-572FKBRL.js} +61 -102
  128. package/dist/cli-bundle/chunks/chunk-572FKBRL.js.map +1 -0
  129. package/dist/cli-bundle/chunks/{chunk-IJYK2T43.js → chunk-5E7N4T2Z.js} +2 -2
  130. package/dist/cli-bundle/chunks/{chunk-NKZAN7BD.js → chunk-5IZUBZBR.js} +3 -3
  131. package/dist/cli-bundle/chunks/{chunk-NOLPZMSV.js → chunk-5JIWFWOZ.js} +2 -2
  132. package/dist/cli-bundle/chunks/{chunk-FFMQB7WR.js → chunk-67LARBDL.js} +493 -404
  133. package/dist/cli-bundle/chunks/chunk-67LARBDL.js.map +1 -0
  134. package/dist/cli-bundle/chunks/{chunk-6AQZPVHQ.js → chunk-6CDCWKSX.js} +4 -4
  135. package/dist/cli-bundle/chunks/{chunk-3K2M5OYU.js → chunk-6KRFL33E.js} +308 -184
  136. package/dist/cli-bundle/chunks/chunk-6KRFL33E.js.map +7 -0
  137. package/dist/cli-bundle/chunks/{chunk-LB6TP6MC.js → chunk-6NYJGMTY.js} +2 -2
  138. package/dist/cli-bundle/chunks/{chunk-SLMUGTK3.js → chunk-7CLLC75T.js} +4 -4
  139. package/dist/cli-bundle/chunks/{chunk-2466X6E4.js → chunk-7LYO6S5A.js} +8 -8
  140. package/dist/cli-bundle/chunks/{chunk-W4ULYO7Z.js → chunk-A3OQ7TFW.js} +8 -8
  141. package/dist/cli-bundle/chunks/{chunk-5CGRF3L5.js → chunk-AIKU3IIL.js} +153 -90
  142. package/dist/cli-bundle/chunks/chunk-AIKU3IIL.js.map +1 -0
  143. package/dist/cli-bundle/chunks/{chunk-WYDHYJPO.js → chunk-AJHYQCBJ.js} +39 -5
  144. package/dist/cli-bundle/chunks/chunk-AJHYQCBJ.js.map +7 -0
  145. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js → chunk-B4O5S7I3.js} +79 -57
  146. package/dist/cli-bundle/chunks/{chunk-VZDBVEZR.js.map → chunk-B4O5S7I3.js.map} +2 -2
  147. package/dist/cli-bundle/chunks/{chunk-OTUHB4HS.js → chunk-BE2SR6QL.js} +92 -77
  148. package/dist/cli-bundle/chunks/chunk-BE2SR6QL.js.map +1 -0
  149. package/dist/cli-bundle/chunks/{chunk-JLM7BHI7.js → chunk-BI4R7HI2.js} +75 -53
  150. package/dist/cli-bundle/chunks/chunk-BI4R7HI2.js.map +7 -0
  151. package/dist/cli-bundle/chunks/{chunk-AXIDKKAT.js → chunk-CXR3CMBQ.js} +33 -6
  152. package/dist/cli-bundle/chunks/chunk-CXR3CMBQ.js.map +1 -0
  153. package/dist/cli-bundle/chunks/{chunk-ZETXE4SE.js → chunk-ECU6MMTQ.js} +713 -613
  154. package/dist/cli-bundle/chunks/chunk-ECU6MMTQ.js.map +1 -0
  155. package/dist/cli-bundle/chunks/{chunk-2D4HATP2.js → chunk-EJ2OCBHF.js} +54 -30
  156. package/dist/cli-bundle/chunks/chunk-EJ2OCBHF.js.map +1 -0
  157. package/dist/cli-bundle/chunks/{chunk-BDTISOSD.js → chunk-EQURFOMH.js} +41 -26
  158. package/dist/cli-bundle/chunks/chunk-EQURFOMH.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{chunk-GJ326ZKX.js → chunk-ER4ME5U2.js} +3 -3
  160. package/dist/cli-bundle/chunks/{chunk-HZZEHPRG.js → chunk-ERG65A2L.js} +2 -2
  161. package/dist/cli-bundle/chunks/{chunk-IZBR4NRW.js → chunk-F6WNBITZ.js} +157 -113
  162. package/dist/cli-bundle/chunks/chunk-F6WNBITZ.js.map +7 -0
  163. package/dist/cli-bundle/chunks/{chunk-L5OEFZQG.js → chunk-FH2H3CBD.js} +3 -3
  164. package/dist/cli-bundle/chunks/{chunk-JPECA746.js → chunk-FUFFPIYA.js} +2 -2
  165. package/dist/cli-bundle/chunks/{chunk-CF7RL6FR.js → chunk-FZJM2TXF.js} +110 -73
  166. package/dist/cli-bundle/chunks/chunk-FZJM2TXF.js.map +1 -0
  167. package/dist/cli-bundle/chunks/{chunk-27BXPBAY.js → chunk-GUYNUXQT.js} +3 -3
  168. package/dist/cli-bundle/chunks/{chunk-MAUKX7JC.js → chunk-GVJE5T7Q.js} +2 -2
  169. package/dist/cli-bundle/chunks/{chunk-3J6JRJ3I.js → chunk-HB4FAT3O.js} +42 -60
  170. package/dist/cli-bundle/chunks/chunk-HB4FAT3O.js.map +7 -0
  171. package/dist/cli-bundle/chunks/{chunk-55SNVXRQ.js → chunk-HQAF23Q2.js} +626 -484
  172. package/dist/cli-bundle/chunks/chunk-HQAF23Q2.js.map +7 -0
  173. package/dist/cli-bundle/chunks/{chunk-ZRP4VG5U.js → chunk-JBZ2NTKX.js} +2 -2
  174. package/dist/cli-bundle/chunks/{chunk-RMMQ74TG.js → chunk-JPATY4SE.js} +54 -30
  175. package/dist/cli-bundle/chunks/chunk-JPATY4SE.js.map +7 -0
  176. package/dist/cli-bundle/chunks/{chunk-IPYBJWTE.js → chunk-K5DT2YKM.js} +109 -72
  177. package/dist/cli-bundle/chunks/chunk-K5DT2YKM.js.map +7 -0
  178. package/dist/cli-bundle/chunks/{chunk-EJUDVUYZ.js → chunk-KEZOIPCR.js} +3 -3
  179. package/dist/cli-bundle/chunks/{chunk-RVUALSJF.js → chunk-KHVGM5CS.js} +466 -365
  180. package/dist/cli-bundle/chunks/chunk-KHVGM5CS.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{chunk-YITK2PJ6.js → chunk-KS6ATO47.js} +288 -175
  182. package/dist/cli-bundle/chunks/chunk-KS6ATO47.js.map +7 -0
  183. package/dist/cli-bundle/chunks/{chunk-7R4QEMZZ.js → chunk-L4SLHV6G.js} +463 -362
  184. package/dist/cli-bundle/chunks/chunk-L4SLHV6G.js.map +1 -0
  185. package/dist/cli-bundle/chunks/{chunk-RLDHZHQS.js → chunk-LBE5QFMZ.js} +158 -114
  186. package/dist/cli-bundle/chunks/chunk-LBE5QFMZ.js.map +1 -0
  187. package/dist/cli-bundle/chunks/{chunk-22WKIL3H.js → chunk-LCWQP6NM.js} +76 -54
  188. package/dist/cli-bundle/chunks/chunk-LCWQP6NM.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-KNPEF7QG.js → chunk-LOWVNZBZ.js} +91 -76
  190. package/dist/cli-bundle/chunks/chunk-LOWVNZBZ.js.map +7 -0
  191. package/dist/cli-bundle/chunks/{chunk-HYTGA6GI.js → chunk-MDHWWBNZ.js} +3 -3
  192. package/dist/cli-bundle/chunks/{chunk-N74UMG5H.js → chunk-MEZZZBYX.js} +2 -2
  193. package/dist/cli-bundle/chunks/{chunk-V3NOKJF2.js → chunk-MHRS5FUX.js} +288 -175
  194. package/dist/cli-bundle/chunks/chunk-MHRS5FUX.js.map +1 -0
  195. package/dist/cli-bundle/chunks/{chunk-3XZCOZ5J.js → chunk-NOIEVOK5.js} +391 -313
  196. package/dist/cli-bundle/chunks/chunk-NOIEVOK5.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{chunk-SDR5J34Q.js → chunk-NZ7QIUP5.js} +4 -4
  198. package/dist/cli-bundle/chunks/{chunk-UYUYDGIB.js → chunk-OGLGI22K.js} +115 -67
  199. package/dist/cli-bundle/chunks/{chunk-UYUYDGIB.js.map → chunk-OGLGI22K.js.map} +1 -1
  200. package/dist/cli-bundle/chunks/{chunk-DDPTYJIM.js → chunk-P5L7Z2O6.js} +2 -2
  201. package/dist/cli-bundle/chunks/{chunk-BZCEN4JA.js → chunk-PULUSQAV.js} +492 -403
  202. package/dist/cli-bundle/chunks/chunk-PULUSQAV.js.map +7 -0
  203. package/dist/cli-bundle/chunks/{chunk-3VGN2UWE.js → chunk-QCDTQCMW.js} +22 -30
  204. package/dist/cli-bundle/chunks/chunk-QCDTQCMW.js.map +1 -0
  205. package/dist/cli-bundle/chunks/{chunk-4A3BJ675.js → chunk-QNNQAAZ5.js} +24 -18
  206. package/dist/cli-bundle/chunks/{chunk-4A3BJ675.js.map → chunk-QNNQAAZ5.js.map} +1 -1
  207. package/dist/cli-bundle/chunks/{chunk-MDPEOIGN.js → chunk-RAHINBVP.js} +60 -101
  208. package/dist/cli-bundle/chunks/chunk-RAHINBVP.js.map +7 -0
  209. package/dist/cli-bundle/chunks/{chunk-CWFNTKQJ.js → chunk-RJH5VQHW.js} +43 -61
  210. package/dist/cli-bundle/chunks/chunk-RJH5VQHW.js.map +1 -0
  211. package/dist/cli-bundle/chunks/{chunk-OGXLACHC.js → chunk-SU2E4AWU.js} +6 -6
  212. package/dist/cli-bundle/chunks/{chunk-HPPFYYOV.js → chunk-SU3TB4NS.js} +2 -2
  213. package/dist/cli-bundle/chunks/{chunk-JWXRETDF.js → chunk-SYE6WMV6.js} +626 -484
  214. package/dist/cli-bundle/chunks/chunk-SYE6WMV6.js.map +1 -0
  215. package/dist/cli-bundle/chunks/{chunk-NWMZWYYB.js → chunk-T3P7PMZP.js} +42 -27
  216. package/dist/cli-bundle/chunks/chunk-T3P7PMZP.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{chunk-G7I7DEZA.js → chunk-T4XBKJ3F.js} +4 -4
  218. package/dist/cli-bundle/chunks/{chunk-RH5ZBYFD.js → chunk-T6AXEBOP.js} +23 -17
  219. package/dist/cli-bundle/chunks/{chunk-RH5ZBYFD.js.map → chunk-T6AXEBOP.js.map} +2 -2
  220. package/dist/cli-bundle/chunks/{chunk-5QFDBI4F.js → chunk-TQ6AX5SQ.js} +58 -69
  221. package/dist/cli-bundle/chunks/{chunk-5QFDBI4F.js.map → chunk-TQ6AX5SQ.js.map} +2 -2
  222. package/dist/cli-bundle/chunks/{chunk-4XOIEKSD.js → chunk-U3S2B7TA.js} +86 -52
  223. package/dist/cli-bundle/chunks/chunk-U3S2B7TA.js.map +1 -0
  224. package/dist/cli-bundle/chunks/{chunk-VICZWYGZ.js → chunk-U5TR4N7J.js} +7 -7
  225. package/dist/cli-bundle/chunks/{chunk-EVMTBV6V.js → chunk-UMNQZS4H.js} +3 -3
  226. package/dist/cli-bundle/chunks/{chunk-A7FPBAQS.js → chunk-WJA3PXW7.js} +7 -7
  227. package/dist/cli-bundle/chunks/{chunk-RGEMWD6Q.js → chunk-WRYERRZX.js} +157 -118
  228. package/dist/cli-bundle/chunks/chunk-WRYERRZX.js.map +7 -0
  229. package/dist/cli-bundle/chunks/{chunk-NUHHPVVS.js → chunk-WYOIIFSE.js} +712 -612
  230. package/dist/cli-bundle/chunks/chunk-WYOIIFSE.js.map +7 -0
  231. package/dist/cli-bundle/chunks/{chunk-4DSGXSBL.js → chunk-XRYSCRZR.js} +116 -68
  232. package/dist/cli-bundle/chunks/{chunk-4DSGXSBL.js.map → chunk-XRYSCRZR.js.map} +3 -3
  233. package/dist/cli-bundle/chunks/{chunk-NU2UEROZ.js → chunk-YF746GTH.js} +59 -70
  234. package/dist/cli-bundle/chunks/{chunk-NU2UEROZ.js.map → chunk-YF746GTH.js.map} +1 -1
  235. package/dist/cli-bundle/chunks/{chunk-JMP4E6D7.js → chunk-YPWUSH72.js} +390 -312
  236. package/dist/cli-bundle/chunks/{chunk-JMP4E6D7.js.map → chunk-YPWUSH72.js.map} +2 -2
  237. package/dist/cli-bundle/chunks/{chunk-QCWF6IYD.js → chunk-YSDFIY7N.js} +3 -3
  238. package/dist/cli-bundle/chunks/{chunk-UZIWVBE6.js → chunk-YSGTMDWC.js} +2 -2
  239. package/dist/cli-bundle/chunks/{chunk-NFDPYAIP.js → chunk-YVKZ3ANP.js} +21 -29
  240. package/dist/cli-bundle/chunks/chunk-YVKZ3ANP.js.map +7 -0
  241. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js → chunk-Z4DGFQDH.js} +80 -58
  242. package/dist/cli-bundle/chunks/{chunk-OKQ22KTH.js.map → chunk-Z4DGFQDH.js.map} +1 -1
  243. package/dist/cli-bundle/chunks/{chunk-64HNBBFQ.js → chunk-Z5F6XZXE.js} +6 -6
  244. package/dist/cli-bundle/chunks/{chunk-AVEE5EHK.js → chunk-Z7RPDF2Y.js} +3 -3
  245. package/dist/cli-bundle/chunks/{chunk-3S2KT7NG.js → chunk-ZFTKYWIF.js} +152 -89
  246. package/dist/cli-bundle/chunks/chunk-ZFTKYWIF.js.map +7 -0
  247. package/dist/cli-bundle/chunks/{claim-T3GCKV7C.js → claim-2BGBGSVI.js} +8 -8
  248. package/dist/cli-bundle/chunks/{claim-EMQLYPRW.js → claim-5GU7OE67.js} +8 -8
  249. package/dist/cli-bundle/chunks/close-6YODBUIV.js +14 -0
  250. package/dist/cli-bundle/chunks/{close-TQYAAFJP.js → close-AFVKPR57.js} +7 -7
  251. package/dist/cli-bundle/chunks/{close-many-BG5QQIDQ.js → close-many-7KLOSYLP.js} +186 -122
  252. package/dist/cli-bundle/chunks/close-many-7KLOSYLP.js.map +7 -0
  253. package/dist/cli-bundle/chunks/{close-many-LDRVEQY2.js → close-many-JKUJMHLG.js} +187 -123
  254. package/dist/cli-bundle/chunks/close-many-JKUJMHLG.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{comments-YUXJRZPQ.js → comments-DNWHEBOS.js} +9 -9
  256. package/dist/cli-bundle/chunks/{comments-QCKR2YY2.js → comments-RW23R3VE.js} +9 -9
  257. package/dist/cli-bundle/chunks/config-AUM5WBYA.js +1072 -0
  258. package/dist/cli-bundle/chunks/config-AUM5WBYA.js.map +7 -0
  259. package/dist/cli-bundle/chunks/config-OZWSA2NP.js +1062 -0
  260. package/dist/cli-bundle/chunks/config-OZWSA2NP.js.map +1 -0
  261. package/dist/cli-bundle/chunks/{context-B6275WPX.js → context-OYXRGY7S.js} +12 -12
  262. package/dist/cli-bundle/chunks/{context-OCZ3FJ4Z.js → context-PKCEHQY3.js} +12 -12
  263. package/dist/cli-bundle/chunks/{contracts-HN7ABKLP.js → contracts-L6ODXNUM.js} +320 -199
  264. package/dist/cli-bundle/chunks/contracts-L6ODXNUM.js.map +7 -0
  265. package/dist/cli-bundle/chunks/{contracts-W4FZVVD6.js → contracts-X74F2GSM.js} +321 -200
  266. package/dist/cli-bundle/chunks/contracts-X74F2GSM.js.map +1 -0
  267. package/dist/cli-bundle/chunks/{copy-DEM4DATS.js → copy-6XOR3HKN.js} +5 -5
  268. package/dist/cli-bundle/chunks/{copy-BTJOSKKT.js → copy-I4NCLBR4.js} +5 -5
  269. package/dist/cli-bundle/chunks/{create-RLRJMRTM.js → create-PM45M6PE.js} +12 -12
  270. package/dist/cli-bundle/chunks/create-Z7YCH3BE.js +28 -0
  271. package/dist/cli-bundle/chunks/{delete-BHK7VB2Z.js → delete-7YXHYG67.js} +5 -5
  272. package/dist/cli-bundle/chunks/{delete-LSVHAB4Y.js → delete-LPISP43T.js} +5 -5
  273. package/dist/cli-bundle/chunks/{deps-XHYXWEPT.js → deps-N2T26FME.js} +5 -5
  274. package/dist/cli-bundle/chunks/{deps-4UDFJRUA.js → deps-WATKQDE3.js} +5 -5
  275. package/dist/cli-bundle/chunks/{docs-GYZNVS26.js → docs-6LQ3GLM7.js} +7 -7
  276. package/dist/cli-bundle/chunks/{docs-26S44RXU.js → docs-Z3X6JZLT.js} +7 -7
  277. package/dist/cli-bundle/chunks/{eval-UYF3ZPVO.js → eval-6DCLG52D.js} +10 -10
  278. package/dist/cli-bundle/chunks/{eval-PGRVIJQU.js → eval-Y3ZCUTHK.js} +10 -10
  279. package/dist/cli-bundle/chunks/{extension-CPSLJQVE.js → extension-BNINIMT7.js} +11 -11
  280. package/dist/cli-bundle/chunks/{extension-CXJ6RELI.js → extension-QWE4YYK5.js} +11 -11
  281. package/dist/cli-bundle/chunks/{files-NQHEXUZD.js → files-6SGKHS6O.js} +7 -7
  282. package/dist/cli-bundle/chunks/{files-MBNICQFM.js → files-FUYPSOFJ.js} +7 -7
  283. package/dist/cli-bundle/chunks/{focus-DWYIG7GU.js → focus-2Q3K76G2.js} +6 -6
  284. package/dist/cli-bundle/chunks/{focus-XZW5423D.js → focus-ATLBWXXD.js} +6 -6
  285. package/dist/cli-bundle/chunks/{gc-LPVMKJQJ.js → gc-RUYEMNRF.js} +3 -3
  286. package/dist/cli-bundle/chunks/{gc-7GQYOS2G.js → gc-TDWSDR66.js} +3 -3
  287. package/dist/cli-bundle/chunks/{get-A7MAOHCU.js → get-2WGLX74N.js} +120 -80
  288. package/dist/cli-bundle/chunks/get-2WGLX74N.js.map +7 -0
  289. package/dist/cli-bundle/chunks/{get-DSDEKJ3L.js → get-LY6M2JIM.js} +121 -81
  290. package/dist/cli-bundle/chunks/get-LY6M2JIM.js.map +1 -0
  291. package/dist/cli-bundle/chunks/{health-3IPFLKXB.js → health-4RKHYS3T.js} +535 -371
  292. package/dist/cli-bundle/chunks/health-4RKHYS3T.js.map +1 -0
  293. package/dist/cli-bundle/chunks/{health-GZXGBZ36.js → health-TMFVNYRA.js} +534 -370
  294. package/dist/cli-bundle/chunks/health-TMFVNYRA.js.map +7 -0
  295. package/dist/cli-bundle/chunks/history-CGNQJXFE.js +18 -0
  296. package/dist/cli-bundle/chunks/{history-NERDJNUB.js → history-SGRRS72R.js} +8 -8
  297. package/dist/cli-bundle/chunks/{history-compact-2WRZ2WK4.js → history-compact-LOED43R3.js} +213 -134
  298. package/dist/cli-bundle/chunks/history-compact-LOED43R3.js.map +7 -0
  299. package/dist/cli-bundle/chunks/{history-compact-HR7BB4LR.js → history-compact-V5DNAQHH.js} +214 -135
  300. package/dist/cli-bundle/chunks/history-compact-V5DNAQHH.js.map +1 -0
  301. package/dist/cli-bundle/chunks/{history-redact-O3NBCNWC.js → history-redact-IRL7WJ3E.js} +9 -9
  302. package/dist/cli-bundle/chunks/history-redact-N3JK7VBW.js +19 -0
  303. package/dist/cli-bundle/chunks/{history-repair-XA3LC4GA.js → history-repair-4WVBVHFR.js} +124 -84
  304. package/dist/cli-bundle/chunks/history-repair-4WVBVHFR.js.map +1 -0
  305. package/dist/cli-bundle/chunks/{history-repair-LCMOS45X.js → history-repair-PGYQJMGD.js} +123 -83
  306. package/dist/cli-bundle/chunks/history-repair-PGYQJMGD.js.map +7 -0
  307. package/dist/cli-bundle/chunks/{init-64XDLQJB.js → init-4GESW7RM.js} +12 -12
  308. package/dist/cli-bundle/chunks/init-XIDPABA4.js +22 -0
  309. package/dist/cli-bundle/chunks/{learnings-LPKCSJX7.js → learnings-4BHWFFUV.js} +9 -9
  310. package/dist/cli-bundle/chunks/{learnings-JR6MA5TI.js → learnings-4FJY7WIW.js} +9 -9
  311. package/dist/cli-bundle/chunks/{list-G5Y65VF6.js → list-472TIOVK.js} +8 -8
  312. package/dist/cli-bundle/chunks/{list-DNBJVO3E.js → list-D7BF5CL2.js} +8 -8
  313. package/dist/cli-bundle/chunks/{next-FYTQF6HG.js → next-D5STGWI2.js} +71 -46
  314. package/dist/cli-bundle/chunks/next-D5STGWI2.js.map +1 -0
  315. package/dist/cli-bundle/chunks/{next-BCERKDUR.js → next-SFQZVX2B.js} +70 -45
  316. package/dist/cli-bundle/chunks/next-SFQZVX2B.js.map +7 -0
  317. package/dist/cli-bundle/chunks/{notes-2BMU3VVQ.js → notes-6KNOSLIT.js} +9 -9
  318. package/dist/cli-bundle/chunks/{notes-6KTGO2OJ.js → notes-W4UEICGF.js} +9 -9
  319. package/dist/cli-bundle/chunks/{plan-RKZHQVXR.js → plan-JO6V7BXO.js} +373 -279
  320. package/dist/cli-bundle/chunks/plan-JO6V7BXO.js.map +1 -0
  321. package/dist/cli-bundle/chunks/{plan-4WXEQCTN.js → plan-MJQW5XK3.js} +372 -278
  322. package/dist/cli-bundle/chunks/plan-MJQW5XK3.js.map +7 -0
  323. package/dist/cli-bundle/chunks/{profile-4OMM32CD.js → profile-3TOTMUR4.js} +27 -19
  324. package/dist/cli-bundle/chunks/profile-3TOTMUR4.js.map +7 -0
  325. package/dist/cli-bundle/chunks/{profile-QLER5ENE.js → profile-WIQY2KCV.js} +28 -20
  326. package/dist/cli-bundle/chunks/profile-WIQY2KCV.js.map +1 -0
  327. package/dist/cli-bundle/chunks/register-list-query-ELBHCCFI.js +416 -0
  328. package/dist/cli-bundle/chunks/register-list-query-ELBHCCFI.js.map +7 -0
  329. package/dist/cli-bundle/chunks/register-list-query-GAPQ6DM3.js +406 -0
  330. package/dist/cli-bundle/chunks/register-list-query-GAPQ6DM3.js.map +1 -0
  331. package/dist/cli-bundle/chunks/{register-mutation-KK7PHYYU.js → register-mutation-ROFE2YPC.js} +729 -702
  332. package/dist/cli-bundle/chunks/register-mutation-ROFE2YPC.js.map +7 -0
  333. package/dist/cli-bundle/chunks/{register-mutation-ENNDUAZG.js → register-mutation-SJWMVIJ2.js} +730 -703
  334. package/dist/cli-bundle/chunks/register-mutation-SJWMVIJ2.js.map +1 -0
  335. package/dist/cli-bundle/chunks/{register-operations-HZ6XERQG.js → register-operations-IADFVH53.js} +389 -365
  336. package/dist/cli-bundle/chunks/register-operations-IADFVH53.js.map +7 -0
  337. package/dist/cli-bundle/chunks/register-operations-MEKU3AKC.js +510 -0
  338. package/dist/cli-bundle/chunks/register-operations-MEKU3AKC.js.map +1 -0
  339. package/dist/cli-bundle/chunks/{register-setup-ZKJ53RS7.js → register-setup-3QJY43CY.js} +128 -103
  340. package/dist/cli-bundle/chunks/register-setup-3QJY43CY.js.map +7 -0
  341. package/dist/cli-bundle/chunks/{register-setup-P67EMBDJ.js → register-setup-AJWUSSQX.js} +129 -104
  342. package/dist/cli-bundle/chunks/register-setup-AJWUSSQX.js.map +1 -0
  343. package/dist/cli-bundle/chunks/{restore-4MHZFJ2E.js → restore-44IHMMZZ.js} +9 -9
  344. package/dist/cli-bundle/chunks/restore-EXHU34EU.js +17 -0
  345. package/dist/cli-bundle/chunks/{scheduling-shortcuts-LB6DOLRL.js → scheduling-shortcuts-OLHNLAZY.js} +12 -12
  346. package/dist/cli-bundle/chunks/{scheduling-shortcuts-UTOYKLXQ.js → scheduling-shortcuts-TSBK4AY5.js} +12 -12
  347. package/dist/cli-bundle/chunks/{schema-73HR2OJW.js → schema-IB2NZZWD.js} +7 -7
  348. package/dist/cli-bundle/chunks/{schema-U6LJKSIR.js → schema-VBCELP5G.js} +7 -7
  349. package/dist/cli-bundle/chunks/{search-AXPXKZER.js → search-7UBETML4.js} +10 -10
  350. package/dist/cli-bundle/chunks/{search-KILGT37L.js → search-R227JOL6.js} +10 -10
  351. package/dist/cli-bundle/chunks/{stats-W5KNVJWQ.js → stats-FAG7COEH.js} +6 -6
  352. package/dist/cli-bundle/chunks/{stats-PSYVVTNZ.js → stats-MCK7PLYS.js} +6 -6
  353. package/dist/cli-bundle/chunks/{telemetry-GAHHQTOS.js → telemetry-DRPDZMAO.js} +84 -70
  354. package/dist/cli-bundle/chunks/telemetry-DRPDZMAO.js.map +7 -0
  355. package/dist/cli-bundle/chunks/{telemetry-BZUF6H7G.js → telemetry-GVVUQSJQ.js} +85 -71
  356. package/dist/cli-bundle/chunks/telemetry-GVVUQSJQ.js.map +1 -0
  357. package/dist/cli-bundle/chunks/{test-PWDIZ255.js → test-QY44WAMR.js} +15 -15
  358. package/dist/cli-bundle/chunks/{test-ACD52Z3S.js → test-SY76DZTO.js} +15 -15
  359. package/dist/cli-bundle/chunks/test-all-QD6QAEG7.js +430 -0
  360. package/dist/cli-bundle/chunks/test-all-QD6QAEG7.js.map +7 -0
  361. package/dist/cli-bundle/chunks/test-all-USPJHXFR.js +427 -0
  362. package/dist/cli-bundle/chunks/test-all-USPJHXFR.js.map +1 -0
  363. package/dist/cli-bundle/chunks/{test-runs-UXIXPDKU.js → test-runs-MG5VIGSK.js} +185 -147
  364. package/dist/cli-bundle/chunks/test-runs-MG5VIGSK.js.map +1 -0
  365. package/dist/cli-bundle/chunks/{test-runs-PLRAZEFW.js → test-runs-QIR5MJPL.js} +184 -146
  366. package/dist/cli-bundle/chunks/test-runs-QIR5MJPL.js.map +7 -0
  367. package/dist/cli-bundle/chunks/update-A7EICML6.js +24 -0
  368. package/dist/cli-bundle/chunks/{update-KFX2SIAC.js → update-IKJZWLQC.js} +15 -15
  369. package/dist/cli-bundle/chunks/{update-many-RNSBX2TA.js → update-many-BEMTDA2X.js} +84 -69
  370. package/dist/cli-bundle/chunks/{update-many-RNSBX2TA.js.map → update-many-BEMTDA2X.js.map} +1 -1
  371. package/dist/cli-bundle/chunks/{update-many-Z5GJS5LC.js → update-many-RATAARHU.js} +83 -68
  372. package/dist/cli-bundle/chunks/{update-many-Z5GJS5LC.js.map → update-many-RATAARHU.js.map} +2 -2
  373. package/dist/cli-bundle/chunks/{upgrade-BRL6KCOJ.js → upgrade-NWMR3VQL.js} +11 -11
  374. package/dist/cli-bundle/chunks/{upgrade-HAK6JG2O.js → upgrade-VU46BLJZ.js} +11 -11
  375. package/dist/cli-bundle/chunks/{validate-X5W76YJL.js → validate-GAJ6FUSI.js} +451 -321
  376. package/dist/cli-bundle/chunks/validate-GAJ6FUSI.js.map +1 -0
  377. package/dist/cli-bundle/chunks/{validate-MTUVL5VC.js → validate-NRY6MFXN.js} +450 -320
  378. package/dist/cli-bundle/chunks/validate-NRY6MFXN.js.map +7 -0
  379. package/dist/cli-bundle/main.js +1107 -916
  380. package/dist/cli-bundle/main.js.map +3 -3
  381. package/dist/core/config/nested-settings.js +89 -67
  382. package/dist/core/config/nested-settings.js.map +1 -1
  383. package/dist/core/governance/metadata-coverage.js +20 -28
  384. package/dist/core/governance/metadata-coverage.js.map +1 -1
  385. package/dist/core/history/drift-scan.js +93 -81
  386. package/dist/core/history/drift-scan.js.map +1 -1
  387. package/dist/core/item/item-type-definition.js +14 -14
  388. package/dist/core/item/item-type-definition.js.map +1 -1
  389. package/dist/core/item/type-registry.js +114 -99
  390. package/dist/core/item/type-registry.js.map +1 -1
  391. package/dist/core/output/mutation-projection.js +42 -26
  392. package/dist/core/output/mutation-projection.js.map +1 -1
  393. package/dist/core/schema/runtime-schema.js +97 -80
  394. package/dist/core/schema/runtime-schema.js.map +1 -1
  395. package/dist/core/schema/status-defs-file.js +26 -3
  396. package/dist/core/schema/status-defs-file.js.map +1 -1
  397. package/dist/core/search/corpus.js +25 -19
  398. package/dist/core/search/corpus.js.map +1 -1
  399. package/dist/core/search/semantic-defaults.js +64 -37
  400. package/dist/core/search/semantic-defaults.js.map +1 -1
  401. package/dist/core/search/vector-stores.js +32 -17
  402. package/dist/core/search/vector-stores.js.map +1 -1
  403. package/dist/core/sentry/helpers.js +31 -28
  404. package/dist/core/sentry/helpers.js.map +1 -1
  405. package/dist/core/sentry/instrument.js +54 -43
  406. package/dist/core/sentry/instrument.js.map +1 -1
  407. package/dist/core/shared/memo.d.ts +12 -0
  408. package/dist/core/shared/memo.js +25 -0
  409. package/dist/core/shared/memo.js.map +1 -0
  410. package/dist/core/shared/serialization.js +24 -14
  411. package/dist/core/shared/serialization.js.map +1 -1
  412. package/dist/core/shared/time.js +26 -4
  413. package/dist/core/shared/time.js.map +1 -1
  414. package/dist/core/store/front-matter-cache.d.ts +5 -0
  415. package/dist/core/store/front-matter-cache.js +316 -171
  416. package/dist/core/store/front-matter-cache.js.map +1 -1
  417. package/dist/core/store/item-store.js +33 -26
  418. package/dist/core/store/item-store.js.map +1 -1
  419. package/dist/core/store/settings.js +247 -203
  420. package/dist/core/store/settings.js.map +1 -1
  421. package/dist/core/test/background-runs.js +189 -160
  422. package/dist/core/test/background-runs.js.map +1 -1
  423. package/dist/sdk/cli-contracts/flag-contracts.js +71 -99
  424. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  425. package/dist/sdk/compose.js +51 -42
  426. package/dist/sdk/compose.js.map +1 -1
  427. package/docs/AGENT_GUIDE.md +2 -2
  428. package/docs/ARCHITECTURE.md +2 -2
  429. package/docs/COMMANDS.md +8 -4
  430. package/docs/CONFIGURATION.md +1 -1
  431. package/docs/EXTENSIONS.md +12 -12
  432. package/docs/ONBOARDING.md +4 -2
  433. package/docs/README.md +2 -0
  434. package/docs/examples/starter-extension/README.md +11 -10
  435. package/marketplace.json +3 -3
  436. package/package.json +2 -2
  437. package/packages/pm-beads/extensions/beads/runtime.ts +240 -167
  438. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +65 -58
  439. package/packages/pm-todos/extensions/todos/runtime.ts +65 -42
  440. package/plugins/pm-claude/.claude-plugin/plugin.json +2 -2
  441. package/plugins/pm-claude/README.md +6 -3
  442. package/plugins/pm-claude/commands/pm-init.md +1 -1
  443. package/dist/cli-bundle/chunks/activity-AW6XVFH6.js +0 -16
  444. package/dist/cli-bundle/chunks/aggregate-JTEF4BP7.js.map +0 -1
  445. package/dist/cli-bundle/chunks/chunk-22WKIL3H.js.map +0 -1
  446. package/dist/cli-bundle/chunks/chunk-2D4HATP2.js.map +0 -1
  447. package/dist/cli-bundle/chunks/chunk-3J6JRJ3I.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-3K2M5OYU.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-3S2KT7NG.js.map +0 -7
  450. package/dist/cli-bundle/chunks/chunk-3VGN2UWE.js.map +0 -1
  451. package/dist/cli-bundle/chunks/chunk-3XZCOZ5J.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-4XOIEKSD.js.map +0 -1
  453. package/dist/cli-bundle/chunks/chunk-55SNVXRQ.js.map +0 -7
  454. package/dist/cli-bundle/chunks/chunk-5CGRF3L5.js.map +0 -1
  455. package/dist/cli-bundle/chunks/chunk-7R4QEMZZ.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-AXIDKKAT.js.map +0 -1
  457. package/dist/cli-bundle/chunks/chunk-BDTISOSD.js.map +0 -7
  458. package/dist/cli-bundle/chunks/chunk-BZCEN4JA.js.map +0 -7
  459. package/dist/cli-bundle/chunks/chunk-CF7RL6FR.js.map +0 -1
  460. package/dist/cli-bundle/chunks/chunk-CWFNTKQJ.js.map +0 -1
  461. package/dist/cli-bundle/chunks/chunk-FFMQB7WR.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-HXTQJXWT.js.map +0 -1
  463. package/dist/cli-bundle/chunks/chunk-IPYBJWTE.js.map +0 -7
  464. package/dist/cli-bundle/chunks/chunk-IZBR4NRW.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-JLM7BHI7.js.map +0 -7
  466. package/dist/cli-bundle/chunks/chunk-JSU5P7VS.js.map +0 -1
  467. package/dist/cli-bundle/chunks/chunk-JWXRETDF.js.map +0 -1
  468. package/dist/cli-bundle/chunks/chunk-KNPEF7QG.js.map +0 -7
  469. package/dist/cli-bundle/chunks/chunk-MDPEOIGN.js.map +0 -7
  470. package/dist/cli-bundle/chunks/chunk-NFDPYAIP.js.map +0 -7
  471. package/dist/cli-bundle/chunks/chunk-NUHHPVVS.js.map +0 -7
  472. package/dist/cli-bundle/chunks/chunk-NWMZWYYB.js.map +0 -1
  473. package/dist/cli-bundle/chunks/chunk-OTUHB4HS.js.map +0 -1
  474. package/dist/cli-bundle/chunks/chunk-RGEMWD6Q.js.map +0 -7
  475. package/dist/cli-bundle/chunks/chunk-RLDHZHQS.js.map +0 -1
  476. package/dist/cli-bundle/chunks/chunk-RMMQ74TG.js.map +0 -7
  477. package/dist/cli-bundle/chunks/chunk-RVUALSJF.js.map +0 -7
  478. package/dist/cli-bundle/chunks/chunk-TP5Q5ZD3.js.map +0 -1
  479. package/dist/cli-bundle/chunks/chunk-V3NOKJF2.js.map +0 -1
  480. package/dist/cli-bundle/chunks/chunk-VARHOHYV.js.map +0 -7
  481. package/dist/cli-bundle/chunks/chunk-WYDHYJPO.js.map +0 -7
  482. package/dist/cli-bundle/chunks/chunk-YITK2PJ6.js.map +0 -7
  483. package/dist/cli-bundle/chunks/chunk-ZETXE4SE.js.map +0 -1
  484. package/dist/cli-bundle/chunks/close-E6ZZGCJY.js +0 -14
  485. package/dist/cli-bundle/chunks/close-many-BG5QQIDQ.js.map +0 -7
  486. package/dist/cli-bundle/chunks/close-many-LDRVEQY2.js.map +0 -1
  487. package/dist/cli-bundle/chunks/config-DMSU64QO.js +0 -1541
  488. package/dist/cli-bundle/chunks/config-DMSU64QO.js.map +0 -7
  489. package/dist/cli-bundle/chunks/config-QH2DICD6.js +0 -1531
  490. package/dist/cli-bundle/chunks/config-QH2DICD6.js.map +0 -1
  491. package/dist/cli-bundle/chunks/contracts-HN7ABKLP.js.map +0 -7
  492. package/dist/cli-bundle/chunks/contracts-W4FZVVD6.js.map +0 -1
  493. package/dist/cli-bundle/chunks/create-OH3BDGBB.js +0 -28
  494. package/dist/cli-bundle/chunks/get-A7MAOHCU.js.map +0 -7
  495. package/dist/cli-bundle/chunks/get-DSDEKJ3L.js.map +0 -1
  496. package/dist/cli-bundle/chunks/health-3IPFLKXB.js.map +0 -1
  497. package/dist/cli-bundle/chunks/health-GZXGBZ36.js.map +0 -7
  498. package/dist/cli-bundle/chunks/history-WSZHY3PN.js +0 -18
  499. package/dist/cli-bundle/chunks/history-compact-2WRZ2WK4.js.map +0 -7
  500. package/dist/cli-bundle/chunks/history-compact-HR7BB4LR.js.map +0 -1
  501. package/dist/cli-bundle/chunks/history-redact-MP6CH7U5.js +0 -19
  502. package/dist/cli-bundle/chunks/history-repair-LCMOS45X.js.map +0 -7
  503. package/dist/cli-bundle/chunks/history-repair-XA3LC4GA.js.map +0 -1
  504. package/dist/cli-bundle/chunks/init-PAX32BJA.js +0 -22
  505. package/dist/cli-bundle/chunks/next-BCERKDUR.js.map +0 -7
  506. package/dist/cli-bundle/chunks/next-FYTQF6HG.js.map +0 -1
  507. package/dist/cli-bundle/chunks/plan-4WXEQCTN.js.map +0 -7
  508. package/dist/cli-bundle/chunks/plan-RKZHQVXR.js.map +0 -1
  509. package/dist/cli-bundle/chunks/profile-4OMM32CD.js.map +0 -7
  510. package/dist/cli-bundle/chunks/profile-QLER5ENE.js.map +0 -1
  511. package/dist/cli-bundle/chunks/register-list-query-7LV46VAU.js +0 -400
  512. package/dist/cli-bundle/chunks/register-list-query-7LV46VAU.js.map +0 -1
  513. package/dist/cli-bundle/chunks/register-list-query-SNG5PGA4.js +0 -410
  514. package/dist/cli-bundle/chunks/register-list-query-SNG5PGA4.js.map +0 -7
  515. package/dist/cli-bundle/chunks/register-mutation-ENNDUAZG.js.map +0 -1
  516. package/dist/cli-bundle/chunks/register-mutation-KK7PHYYU.js.map +0 -7
  517. package/dist/cli-bundle/chunks/register-operations-C6OWLDSH.js +0 -486
  518. package/dist/cli-bundle/chunks/register-operations-C6OWLDSH.js.map +0 -1
  519. package/dist/cli-bundle/chunks/register-operations-HZ6XERQG.js.map +0 -7
  520. package/dist/cli-bundle/chunks/register-setup-P67EMBDJ.js.map +0 -1
  521. package/dist/cli-bundle/chunks/register-setup-ZKJ53RS7.js.map +0 -7
  522. package/dist/cli-bundle/chunks/restore-YALDGTQR.js +0 -17
  523. package/dist/cli-bundle/chunks/telemetry-BZUF6H7G.js.map +0 -1
  524. package/dist/cli-bundle/chunks/telemetry-GAHHQTOS.js.map +0 -7
  525. package/dist/cli-bundle/chunks/test-all-L2MDDUCA.js +0 -358
  526. package/dist/cli-bundle/chunks/test-all-L2MDDUCA.js.map +0 -1
  527. package/dist/cli-bundle/chunks/test-all-RBZ6DLU2.js +0 -361
  528. package/dist/cli-bundle/chunks/test-all-RBZ6DLU2.js.map +0 -7
  529. package/dist/cli-bundle/chunks/test-runs-PLRAZEFW.js.map +0 -7
  530. package/dist/cli-bundle/chunks/test-runs-UXIXPDKU.js.map +0 -1
  531. package/dist/cli-bundle/chunks/update-AMRSOIWP.js +0 -24
  532. package/dist/cli-bundle/chunks/validate-MTUVL5VC.js.map +0 -7
  533. package/dist/cli-bundle/chunks/validate-X5W76YJL.js.map +0 -1
  534. /package/dist/cli-bundle/chunks/{activity-DBLQVIP6.js.map → activity-5YWLSPGE.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{activity-AW6XVFH6.js.map → activity-BIML7K2D.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{append-LOVPGVPT.js.map → append-EZESUVJT.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{append-QCFJSDFL.js.map → append-JFG4WQMG.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-BHO33VBQ.js.map → chunk-3W2HJKJX.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-4DUVCVLZ.js.map → chunk-4PFVUUYV.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-IJYK2T43.js.map → chunk-5E7N4T2Z.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-NKZAN7BD.js.map → chunk-5IZUBZBR.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-NOLPZMSV.js.map → chunk-5JIWFWOZ.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-6AQZPVHQ.js.map → chunk-6CDCWKSX.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-LB6TP6MC.js.map → chunk-6NYJGMTY.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-SLMUGTK3.js.map → chunk-7CLLC75T.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-2466X6E4.js.map → chunk-7LYO6S5A.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-W4ULYO7Z.js.map → chunk-A3OQ7TFW.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-GJ326ZKX.js.map → chunk-ER4ME5U2.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-HZZEHPRG.js.map → chunk-ERG65A2L.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-L5OEFZQG.js.map → chunk-FH2H3CBD.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-JPECA746.js.map → chunk-FUFFPIYA.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-27BXPBAY.js.map → chunk-GUYNUXQT.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-MAUKX7JC.js.map → chunk-GVJE5T7Q.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-ZRP4VG5U.js.map → chunk-JBZ2NTKX.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-EJUDVUYZ.js.map → chunk-KEZOIPCR.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-HYTGA6GI.js.map → chunk-MDHWWBNZ.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-N74UMG5H.js.map → chunk-MEZZZBYX.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-SDR5J34Q.js.map → chunk-NZ7QIUP5.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-DDPTYJIM.js.map → chunk-P5L7Z2O6.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-OGXLACHC.js.map → chunk-SU2E4AWU.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-HPPFYYOV.js.map → chunk-SU3TB4NS.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-G7I7DEZA.js.map → chunk-T4XBKJ3F.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-VICZWYGZ.js.map → chunk-U5TR4N7J.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-EVMTBV6V.js.map → chunk-UMNQZS4H.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-A7FPBAQS.js.map → chunk-WJA3PXW7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-QCWF6IYD.js.map → chunk-YSDFIY7N.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-UZIWVBE6.js.map → chunk-YSGTMDWC.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{chunk-64HNBBFQ.js.map → chunk-Z5F6XZXE.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{chunk-AVEE5EHK.js.map → chunk-Z7RPDF2Y.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{claim-T3GCKV7C.js.map → claim-2BGBGSVI.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{claim-EMQLYPRW.js.map → claim-5GU7OE67.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{close-E6ZZGCJY.js.map → close-6YODBUIV.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{close-TQYAAFJP.js.map → close-AFVKPR57.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{comments-YUXJRZPQ.js.map → comments-DNWHEBOS.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{comments-QCKR2YY2.js.map → comments-RW23R3VE.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{context-B6275WPX.js.map → context-OYXRGY7S.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{context-OCZ3FJ4Z.js.map → context-PKCEHQY3.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{copy-DEM4DATS.js.map → copy-6XOR3HKN.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{copy-BTJOSKKT.js.map → copy-I4NCLBR4.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{create-RLRJMRTM.js.map → create-PM45M6PE.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{create-OH3BDGBB.js.map → create-Z7YCH3BE.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{delete-BHK7VB2Z.js.map → delete-7YXHYG67.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{delete-LSVHAB4Y.js.map → delete-LPISP43T.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{deps-XHYXWEPT.js.map → deps-N2T26FME.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{deps-4UDFJRUA.js.map → deps-WATKQDE3.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{docs-GYZNVS26.js.map → docs-6LQ3GLM7.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{docs-26S44RXU.js.map → docs-Z3X6JZLT.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{eval-UYF3ZPVO.js.map → eval-6DCLG52D.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{eval-PGRVIJQU.js.map → eval-Y3ZCUTHK.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{extension-CPSLJQVE.js.map → extension-BNINIMT7.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{extension-CXJ6RELI.js.map → extension-QWE4YYK5.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{files-NQHEXUZD.js.map → files-6SGKHS6O.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{files-MBNICQFM.js.map → files-FUYPSOFJ.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{focus-DWYIG7GU.js.map → focus-2Q3K76G2.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{focus-XZW5423D.js.map → focus-ATLBWXXD.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{gc-LPVMKJQJ.js.map → gc-RUYEMNRF.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{gc-7GQYOS2G.js.map → gc-TDWSDR66.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{history-WSZHY3PN.js.map → history-CGNQJXFE.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{history-NERDJNUB.js.map → history-SGRRS72R.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{history-redact-O3NBCNWC.js.map → history-redact-IRL7WJ3E.js.map} +0 -0
  601. /package/dist/cli-bundle/chunks/{history-redact-MP6CH7U5.js.map → history-redact-N3JK7VBW.js.map} +0 -0
  602. /package/dist/cli-bundle/chunks/{init-64XDLQJB.js.map → init-4GESW7RM.js.map} +0 -0
  603. /package/dist/cli-bundle/chunks/{init-PAX32BJA.js.map → init-XIDPABA4.js.map} +0 -0
  604. /package/dist/cli-bundle/chunks/{learnings-LPKCSJX7.js.map → learnings-4BHWFFUV.js.map} +0 -0
  605. /package/dist/cli-bundle/chunks/{learnings-JR6MA5TI.js.map → learnings-4FJY7WIW.js.map} +0 -0
  606. /package/dist/cli-bundle/chunks/{list-G5Y65VF6.js.map → list-472TIOVK.js.map} +0 -0
  607. /package/dist/cli-bundle/chunks/{list-DNBJVO3E.js.map → list-D7BF5CL2.js.map} +0 -0
  608. /package/dist/cli-bundle/chunks/{notes-2BMU3VVQ.js.map → notes-6KNOSLIT.js.map} +0 -0
  609. /package/dist/cli-bundle/chunks/{notes-6KTGO2OJ.js.map → notes-W4UEICGF.js.map} +0 -0
  610. /package/dist/cli-bundle/chunks/{restore-4MHZFJ2E.js.map → restore-44IHMMZZ.js.map} +0 -0
  611. /package/dist/cli-bundle/chunks/{restore-YALDGTQR.js.map → restore-EXHU34EU.js.map} +0 -0
  612. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-LB6DOLRL.js.map → scheduling-shortcuts-OLHNLAZY.js.map} +0 -0
  613. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-UTOYKLXQ.js.map → scheduling-shortcuts-TSBK4AY5.js.map} +0 -0
  614. /package/dist/cli-bundle/chunks/{schema-73HR2OJW.js.map → schema-IB2NZZWD.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{schema-U6LJKSIR.js.map → schema-VBCELP5G.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{search-AXPXKZER.js.map → search-7UBETML4.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{search-KILGT37L.js.map → search-R227JOL6.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{stats-W5KNVJWQ.js.map → stats-FAG7COEH.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{stats-PSYVVTNZ.js.map → stats-MCK7PLYS.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{test-PWDIZ255.js.map → test-QY44WAMR.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{test-ACD52Z3S.js.map → test-SY76DZTO.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{update-AMRSOIWP.js.map → update-A7EICML6.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{update-KFX2SIAC.js.map → update-IKJZWLQC.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{upgrade-BRL6KCOJ.js.map → upgrade-NWMR3VQL.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{upgrade-HAK6JG2O.js.map → upgrade-VU46BLJZ.js.map} +0 -0
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  runActivity
3
- } from "./chunk-JLM7BHI7.js";
3
+ } from "./chunk-BI4R7HI2.js";
4
4
  import {
5
5
  collectRuntimeFilterValues,
6
6
  matchesRuntimeFilters,
7
7
  runList
8
- } from "./chunk-3S2KT7NG.js";
8
+ } from "./chunk-ZFTKYWIF.js";
9
9
  import {
10
10
  parseIntegerLimit,
11
11
  parsePriority,
12
12
  parseType
13
- } from "./chunk-4DUVCVLZ.js";
13
+ } from "./chunk-4PFVUUYV.js";
14
14
  import {
15
15
  listAllFrontMatterLight
16
- } from "./chunk-3K2M5OYU.js";
16
+ } from "./chunk-6KRFL33E.js";
17
17
  import {
18
18
  isTerminalStatus,
19
19
  normalizeStatusForRegistry,
20
20
  normalizeStatusInput
21
- } from "./chunk-BHO33VBQ.js";
21
+ } from "./chunk-3W2HJKJX.js";
22
22
  import {
23
23
  compareTimestampStrings,
24
24
  nowIso,
25
25
  resolveIsoOrRelative
26
- } from "./chunk-WYDHYJPO.js";
26
+ } from "./chunk-AJHYQCBJ.js";
27
27
  import {
28
28
  CONTEXT_DEPTH_VALUES,
29
29
  CONTEXT_SECTION_VALUES,
@@ -40,14 +40,14 @@ import {
40
40
  resolveRuntimeFieldRegistry,
41
41
  resolveRuntimeStatusRegistry,
42
42
  weekdayOrderIndex
43
- } from "./chunk-RVUALSJF.js";
43
+ } from "./chunk-KHVGM5CS.js";
44
44
 
45
45
  // dist/cli/commands/calendar.js
46
46
  import { encode as encodeToon } from "@toon-format/toon";
47
47
  !(function() {
48
48
  try {
49
49
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
50
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4eb64c8f-5320-5716-9740-e5dae46f03b1");
50
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "16039cc1-59c0-510f-9ae1-d452ba30096c");
51
51
  } catch (e2) {
52
52
  }
53
53
  })();
@@ -254,122 +254,130 @@ function buildRecurringEventWindow(start, end, nowValue, lookbackDays, lookahead
254
254
  end: compareTimestampStrings(windowEnd, windowStart) > 0 ? windowEnd : addUtcDays(windowStart, 1)
255
255
  };
256
256
  }
257
- function expandRecurringOccurrences(startAt, recurrence, window2, occurrenceLimit) {
258
- const maxOccurrences = occurrenceLimit ?? MAX_RECURRENCE_OCCURRENCES;
259
- const interval = recurrence.interval ?? 1;
260
- const countLimit = recurrence.count ?? Number.POSITIVE_INFINITY;
261
- const until = recurrence.until;
262
- const excluded = buildExcludedInstantSet(recurrence.exdates);
263
- const recurrenceWeekdays = recurrence.by_weekday && recurrence.by_weekday.length > 0 ? [...recurrence.by_weekday] : [weekdayToken(startAt)];
264
- const recurrenceMonthDays = recurrence.by_month_day && recurrence.by_month_day.length > 0 ? [...recurrence.by_month_day] : [new Date(startAt).getUTCDate()];
265
- const weekdayFilter = recurrence.by_weekday ? new Set(recurrence.by_weekday) : void 0;
266
- const monthDayFilter = recurrence.by_month_day ? new Set(recurrence.by_month_day) : void 0;
267
- const sortedWeekdays = [...new Set(recurrenceWeekdays)].sort((left, right) => weekdayOrderIndex(left) - weekdayOrderIndex(right));
268
- const sortedMonthDays = [...new Set(recurrenceMonthDays)].sort((left, right) => left - right);
269
- const occurrences = [];
270
- let produced = 0;
271
- const consumeCandidate = (candidateAt) => {
272
- if (compareTimestampStrings(candidateAt, startAt) < 0) {
273
- return "continue";
274
- }
275
- if (until && compareTimestampStrings(candidateAt, until) > 0) {
276
- return "stop";
277
- }
278
- if (compareTimestampStrings(candidateAt, window2.end) >= 0) {
279
- return "stop";
280
- }
281
- if (excluded.has(candidateAt)) {
282
- return "continue";
283
- }
284
- produced += 1;
285
- if (compareTimestampStrings(candidateAt, window2.start) >= 0) {
286
- occurrences.push(candidateAt);
287
- }
288
- if (produced >= countLimit) {
289
- return "stop";
290
- }
291
- return "continue";
257
+ function buildRecurrenceExpansionContext(startAt, recurrence, window2, occurrenceLimit) {
258
+ const recurrenceWeekdays = recurrence.by_weekday !== void 0 ? [...recurrence.by_weekday] : [weekdayToken(startAt)];
259
+ const recurrenceMonthDays = recurrence.by_month_day !== void 0 ? [...recurrence.by_month_day] : [new Date(startAt).getUTCDate()];
260
+ return {
261
+ startAt,
262
+ startDate: new Date(startAt),
263
+ window: window2,
264
+ maxOccurrences: occurrenceLimit ?? MAX_RECURRENCE_OCCURRENCES,
265
+ interval: recurrence.interval ?? 1,
266
+ countLimit: recurrence.count ?? Number.POSITIVE_INFINITY,
267
+ until: recurrence.until,
268
+ excluded: buildExcludedInstantSet(recurrence.exdates),
269
+ weekdayFilter: recurrence.by_weekday !== void 0 ? new Set(recurrence.by_weekday) : void 0,
270
+ monthDayFilter: recurrence.by_month_day !== void 0 ? new Set(recurrence.by_month_day) : void 0,
271
+ sortedWeekdays: [...new Set(recurrenceWeekdays)].sort((left, right) => weekdayOrderIndex(left) - weekdayOrderIndex(right)),
272
+ sortedMonthDays: [...new Set(recurrenceMonthDays)].sort((left, right) => left - right),
273
+ occurrences: [],
274
+ produced: 0
292
275
  };
293
- const startDate = new Date(startAt);
294
- if (recurrence.freq === "daily") {
295
- let candidateAt = startAt;
296
- for (let iteration = 0; iteration < maxOccurrences; iteration += 1) {
297
- const candidateWeekday = weekdayToken(candidateAt);
298
- const candidateMonthDay = new Date(candidateAt).getUTCDate();
299
- const weekdayMatches = !weekdayFilter || weekdayFilter.has(candidateWeekday);
300
- const monthDayMatches = !monthDayFilter || monthDayFilter.has(candidateMonthDay);
301
- if (weekdayMatches && monthDayMatches && consumeCandidate(candidateAt) === "stop") {
302
- break;
303
- }
304
- candidateAt = addUtcDays(candidateAt, interval);
305
- }
306
- return occurrences;
276
+ }
277
+ function consumeRecurrenceCandidate(context, candidateAt) {
278
+ if (compareTimestampStrings(candidateAt, context.startAt) < 0) {
279
+ return "continue";
307
280
  }
308
- if (recurrence.freq === "weekly") {
309
- const weekStart = startOfUtcWeekMonday(startAt);
310
- for (let step = 0; step < maxOccurrences; step += 1) {
311
- const candidateWeekStart = addUtcDays(weekStart, step * interval * 7);
312
- for (const weekday of sortedWeekdays) {
313
- const dayOffset = weekdayOrderIndex(weekday);
314
- const candidateDay = addUtcDays(candidateWeekStart, dayOffset);
315
- const dayDate = new Date(candidateDay);
316
- const candidateAt = new Date(Date.UTC(dayDate.getUTCFullYear(), dayDate.getUTCMonth(), dayDate.getUTCDate(), startDate.getUTCHours(), startDate.getUTCMinutes(), startDate.getUTCSeconds(), startDate.getUTCMilliseconds())).toISOString();
317
- const candidateMonthDay = dayDate.getUTCDate();
318
- if (monthDayFilter && !monthDayFilter.has(candidateMonthDay)) {
319
- continue;
320
- }
321
- const consumed = consumeCandidate(candidateAt);
322
- if (consumed === "stop") {
323
- return occurrences;
324
- }
325
- }
326
- }
327
- return occurrences;
281
+ if (context.until && compareTimestampStrings(candidateAt, context.until) > 0) {
282
+ return "stop";
328
283
  }
329
- if (recurrence.freq === "monthly") {
330
- const startYear = startDate.getUTCFullYear();
331
- const startMonth = startDate.getUTCMonth();
332
- for (let step = 0; step < maxOccurrences; step += 1) {
333
- const monthAnchor = new Date(Date.UTC(startYear, startMonth + step * interval, 1, 0, 0, 0, 0));
334
- const year2 = monthAnchor.getUTCFullYear();
335
- const month2 = monthAnchor.getUTCMonth();
336
- for (const monthDay of sortedMonthDays) {
337
- const candidateAt = buildUtcTimestamp(year2, month2, monthDay, startDate);
338
- if (!candidateAt) {
339
- continue;
340
- }
341
- const candidateWeekday = weekdayToken(candidateAt);
342
- if (weekdayFilter && !weekdayFilter.has(candidateWeekday)) {
343
- continue;
344
- }
345
- const consumed = consumeCandidate(candidateAt);
346
- if (consumed === "stop") {
347
- return occurrences;
348
- }
284
+ if (compareTimestampStrings(candidateAt, context.window.end) >= 0) {
285
+ return "stop";
286
+ }
287
+ if (context.excluded.has(candidateAt)) {
288
+ return "continue";
289
+ }
290
+ context.produced += 1;
291
+ if (compareTimestampStrings(candidateAt, context.window.start) >= 0) {
292
+ context.occurrences.push(candidateAt);
293
+ }
294
+ return context.produced >= context.countLimit || context.occurrences.length >= context.maxOccurrences ? "stop" : "continue";
295
+ }
296
+ function recurrenceDayMatchesFilters(context, candidateAt) {
297
+ const candidateWeekday = weekdayToken(candidateAt);
298
+ const candidateMonthDay = new Date(candidateAt).getUTCDate();
299
+ const weekdayMatches = !context.weekdayFilter || context.weekdayFilter.has(candidateWeekday);
300
+ const monthDayMatches = !context.monthDayFilter || context.monthDayFilter.has(candidateMonthDay);
301
+ return weekdayMatches && monthDayMatches;
302
+ }
303
+ function expandDailyOccurrences(context) {
304
+ let candidateAt = context.startAt;
305
+ for (let iteration = 0; iteration < context.maxOccurrences; iteration += 1) {
306
+ if (recurrenceDayMatchesFilters(context, candidateAt) && consumeRecurrenceCandidate(context, candidateAt) === "stop") {
307
+ break;
308
+ }
309
+ candidateAt = addUtcDays(candidateAt, context.interval);
310
+ }
311
+ return context.occurrences;
312
+ }
313
+ function buildWeeklyCandidateAt(context, candidateWeekStart, weekday) {
314
+ const dayOffset = weekdayOrderIndex(weekday);
315
+ const candidateDay = addUtcDays(candidateWeekStart, dayOffset);
316
+ const dayDate = new Date(candidateDay);
317
+ return new Date(Date.UTC(dayDate.getUTCFullYear(), dayDate.getUTCMonth(), dayDate.getUTCDate(), context.startDate.getUTCHours(), context.startDate.getUTCMinutes(), context.startDate.getUTCSeconds(), context.startDate.getUTCMilliseconds())).toISOString();
318
+ }
319
+ function expandWeeklyOccurrences(context) {
320
+ const weekStart = startOfUtcWeekMonday(context.startAt);
321
+ for (let step = 0; step < context.maxOccurrences; step += 1) {
322
+ const candidateWeekStart = addUtcDays(weekStart, step * context.interval * 7);
323
+ for (const weekday of context.sortedWeekdays) {
324
+ const candidateAt = buildWeeklyCandidateAt(context, candidateWeekStart, weekday);
325
+ if (!recurrenceDayMatchesFilters(context, candidateAt)) {
326
+ continue;
327
+ }
328
+ if (consumeRecurrenceCandidate(context, candidateAt) === "stop") {
329
+ return context.occurrences;
349
330
  }
350
331
  }
351
- return occurrences;
352
- }
353
- const year = startDate.getUTCFullYear();
354
- const month = startDate.getUTCMonth();
355
- for (let step = 0; step < maxOccurrences; step += 1) {
356
- const candidateYear = year + step * interval;
357
- for (const monthDay of sortedMonthDays) {
358
- const candidateAt = buildUtcTimestamp(candidateYear, month, monthDay, startDate);
359
- if (!candidateAt) {
332
+ }
333
+ return context.occurrences;
334
+ }
335
+ function expandMonthlyOccurrences(context) {
336
+ const startYear = context.startDate.getUTCFullYear();
337
+ const startMonth = context.startDate.getUTCMonth();
338
+ for (let step = 0; step < context.maxOccurrences; step += 1) {
339
+ const monthAnchor = new Date(Date.UTC(startYear, startMonth + step * context.interval, 1, 0, 0, 0, 0));
340
+ for (const monthDay of context.sortedMonthDays) {
341
+ const candidateAt = buildUtcTimestamp(monthAnchor.getUTCFullYear(), monthAnchor.getUTCMonth(), monthDay, context.startDate);
342
+ if (!candidateAt || !recurrenceDayMatchesFilters(context, candidateAt)) {
360
343
  continue;
361
344
  }
362
- const candidateWeekday = weekdayToken(candidateAt);
363
- if (weekdayFilter && !weekdayFilter.has(candidateWeekday)) {
345
+ if (consumeRecurrenceCandidate(context, candidateAt) === "stop") {
346
+ return context.occurrences;
347
+ }
348
+ }
349
+ }
350
+ return context.occurrences;
351
+ }
352
+ function expandYearlyOccurrences(context) {
353
+ const year = context.startDate.getUTCFullYear();
354
+ const month = context.startDate.getUTCMonth();
355
+ for (let step = 0; step < context.maxOccurrences; step += 1) {
356
+ const candidateYear = year + step * context.interval;
357
+ for (const monthDay of context.sortedMonthDays) {
358
+ const candidateAt = buildUtcTimestamp(candidateYear, month, monthDay, context.startDate);
359
+ if (!candidateAt || !recurrenceDayMatchesFilters(context, candidateAt)) {
364
360
  continue;
365
361
  }
366
- const consumed = consumeCandidate(candidateAt);
367
- if (consumed === "stop") {
368
- return occurrences;
362
+ if (consumeRecurrenceCandidate(context, candidateAt) === "stop") {
363
+ return context.occurrences;
369
364
  }
370
365
  }
371
366
  }
372
- return occurrences;
367
+ return context.occurrences;
368
+ }
369
+ function expandRecurringOccurrences(startAt, recurrence, window2, occurrenceLimit) {
370
+ const context = buildRecurrenceExpansionContext(startAt, recurrence, window2, occurrenceLimit);
371
+ if (recurrence.freq === "daily") {
372
+ return expandDailyOccurrences(context);
373
+ }
374
+ if (recurrence.freq === "weekly") {
375
+ return expandWeeklyOccurrences(context);
376
+ }
377
+ if (recurrence.freq === "monthly") {
378
+ return expandMonthlyOccurrences(context);
379
+ }
380
+ return expandYearlyOccurrences(context);
373
381
  }
374
382
  function sortEvents(values) {
375
383
  return [...values].sort((a, b) => {
@@ -391,92 +399,98 @@ function sortEvents(values) {
391
399
  return String(a.reminder_text).localeCompare(String(b.reminder_text));
392
400
  });
393
401
  }
402
+ function buildItemCalendarRowBase(item) {
403
+ return {
404
+ item_id: item.id,
405
+ item_title: item.title,
406
+ item_type: item.type,
407
+ item_status: item.status,
408
+ item_priority: item.priority,
409
+ item_assignee: item.assignee ?? null,
410
+ item_deadline: item.deadline ?? null,
411
+ item_tags: item.tags
412
+ };
413
+ }
414
+ function buildDeadlineRow(item) {
415
+ if (!item.deadline) {
416
+ return null;
417
+ }
418
+ return {
419
+ at: item.deadline,
420
+ date: toUtcDayKey(item.deadline),
421
+ kind: "deadline",
422
+ reminder_text: null,
423
+ event_title: null,
424
+ event_end: null,
425
+ event_location: null,
426
+ event_all_day: null,
427
+ event_timezone: null,
428
+ event_recurring: null,
429
+ event_recurrence_rule: null,
430
+ ...buildItemCalendarRowBase(item),
431
+ item_deadline: item.deadline
432
+ };
433
+ }
434
+ function buildReminderRows(item) {
435
+ return (item.reminders ?? []).map((reminder) => ({
436
+ at: reminder.at,
437
+ date: toUtcDayKey(reminder.at),
438
+ kind: "reminder",
439
+ reminder_text: reminder.text,
440
+ event_title: null,
441
+ event_end: null,
442
+ event_location: null,
443
+ event_all_day: null,
444
+ event_timezone: null,
445
+ event_recurring: null,
446
+ event_recurrence_rule: null,
447
+ ...buildItemCalendarRowBase(item)
448
+ }));
449
+ }
450
+ function recurringDurationMs(startAt, endAt) {
451
+ if (!endAt) {
452
+ return null;
453
+ }
454
+ const duration = Date.parse(endAt) - Date.parse(startAt);
455
+ return Number.isFinite(duration) && duration > 0 ? duration : null;
456
+ }
457
+ function eventOccurrenceEnd(occurrenceAt, event, durationMs) {
458
+ return event.recurrence && durationMs !== null ? new Date(new Date(occurrenceAt).getTime() + durationMs).toISOString() : event.end_at ?? null;
459
+ }
460
+ function buildScheduledEventRows(item, event, recurringWindow, occurrenceLimit) {
461
+ const recurrenceRuleSummary = formatRecurrenceRuleForSummary(event.recurrence);
462
+ const durationMs = recurringDurationMs(event.start_at, event.end_at);
463
+ const occurrences = event.recurrence ? expandRecurringOccurrences(event.start_at, event.recurrence, recurringWindow, occurrenceLimit) : [event.start_at];
464
+ return occurrences.map((occurrenceAt) => ({
465
+ at: occurrenceAt,
466
+ // All-day events are timezone-agnostic calendar dates: bucket by the
467
+ // literal start date. Timed events bucket by their local day in the
468
+ // event's timezone (defaults to UTC when unset).
469
+ date: event.all_day === true ? occurrenceAt.slice(0, 10) : toLocalDayKey(occurrenceAt, event.timezone),
470
+ kind: "event",
471
+ reminder_text: event.description ?? null,
472
+ event_title: event.title ?? item.title,
473
+ event_end: eventOccurrenceEnd(occurrenceAt, event, durationMs),
474
+ event_location: event.location ?? null,
475
+ event_all_day: event.all_day ?? null,
476
+ event_timezone: event.timezone ?? null,
477
+ event_recurring: event.recurrence ? true : false,
478
+ event_recurrence_rule: recurrenceRuleSummary,
479
+ ...buildItemCalendarRowBase(item)
480
+ }));
481
+ }
394
482
  function buildEventSeed(items, recurringWindow, includeSources, occurrenceLimit) {
395
483
  const events = [];
396
484
  for (const item of items) {
397
- if (includeSources.has("deadlines") && item.deadline) {
398
- events.push({
399
- at: item.deadline,
400
- date: toUtcDayKey(item.deadline),
401
- kind: "deadline",
402
- reminder_text: null,
403
- event_title: null,
404
- event_end: null,
405
- event_location: null,
406
- event_all_day: null,
407
- event_timezone: null,
408
- event_recurring: null,
409
- event_recurrence_rule: null,
410
- item_id: item.id,
411
- item_title: item.title,
412
- item_type: item.type,
413
- item_status: item.status,
414
- item_priority: item.priority,
415
- item_assignee: item.assignee ?? null,
416
- item_deadline: item.deadline,
417
- item_tags: item.tags
418
- });
485
+ const deadlineRow = includeSources.has("deadlines") ? buildDeadlineRow(item) : null;
486
+ if (deadlineRow) {
487
+ events.push(deadlineRow);
419
488
  }
420
- for (const reminder of includeSources.has("reminders") ? item.reminders ?? [] : []) {
421
- events.push({
422
- at: reminder.at,
423
- date: toUtcDayKey(reminder.at),
424
- kind: "reminder",
425
- reminder_text: reminder.text,
426
- event_title: null,
427
- event_end: null,
428
- event_location: null,
429
- event_all_day: null,
430
- event_timezone: null,
431
- event_recurring: null,
432
- event_recurrence_rule: null,
433
- item_id: item.id,
434
- item_title: item.title,
435
- item_type: item.type,
436
- item_status: item.status,
437
- item_priority: item.priority,
438
- item_assignee: item.assignee ?? null,
439
- item_deadline: item.deadline ?? null,
440
- item_tags: item.tags
441
- });
489
+ if (includeSources.has("reminders")) {
490
+ events.push(...buildReminderRows(item));
442
491
  }
443
492
  for (const event of includeSources.has("events") ? item.events ?? [] : []) {
444
- const recurrenceRuleSummary = formatRecurrenceRuleForSummary(event.recurrence);
445
- const recurringDurationMs = (() => {
446
- if (!event.end_at) {
447
- return null;
448
- }
449
- const duration = Date.parse(event.end_at) - Date.parse(event.start_at);
450
- return Number.isFinite(duration) && duration > 0 ? duration : null;
451
- })();
452
- const occurrences = event.recurrence ? expandRecurringOccurrences(event.start_at, event.recurrence, recurringWindow, occurrenceLimit) : [event.start_at];
453
- for (const occurrenceAt of occurrences) {
454
- const occurrenceEnd = event.recurrence && recurringDurationMs !== null ? new Date(new Date(occurrenceAt).getTime() + recurringDurationMs).toISOString() : event.end_at ?? null;
455
- events.push({
456
- at: occurrenceAt,
457
- // All-day events are timezone-agnostic calendar dates: bucket by the
458
- // literal start date. Timed events bucket by their local day in the
459
- // event's timezone (defaults to UTC when unset).
460
- date: event.all_day === true ? occurrenceAt.slice(0, 10) : toLocalDayKey(occurrenceAt, event.timezone),
461
- kind: "event",
462
- reminder_text: event.description ?? null,
463
- event_title: event.title ?? item.title,
464
- event_end: occurrenceEnd,
465
- event_location: event.location ?? null,
466
- event_all_day: event.all_day ?? null,
467
- event_timezone: event.timezone ?? null,
468
- event_recurring: event.recurrence ? true : false,
469
- event_recurrence_rule: recurrenceRuleSummary,
470
- item_id: item.id,
471
- item_title: item.title,
472
- item_type: item.type,
473
- item_status: item.status,
474
- item_priority: item.priority,
475
- item_assignee: item.assignee ?? null,
476
- item_deadline: item.deadline ?? null,
477
- item_tags: item.tags
478
- });
479
- }
493
+ events.push(...buildScheduledEventRows(item, event, recurringWindow, occurrenceLimit));
480
494
  }
481
495
  }
482
496
  return sortEvents(events);
@@ -650,11 +664,7 @@ function summarize(events) {
650
664
  recurring_events: recurringEvents
651
665
  };
652
666
  }
653
- async function runCalendar(options, global2) {
654
- const pmRoot = resolvePmRoot(process.cwd(), global2.path);
655
- if (!await pathExists(getSettingsPath(pmRoot))) {
656
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
657
- }
667
+ function resolveCalendarExecutionInputs(options) {
658
668
  const nowValue = nowIso();
659
669
  const view = parseView(options.view);
660
670
  const rangeBounds = buildRange(view, options, nowValue);
@@ -667,59 +677,85 @@ async function runCalendar(options, global2) {
667
677
  throw new PmCliError("Calendar occurrence limit must be >= 1", EXIT_CODE.USAGE);
668
678
  }
669
679
  const eventsOnly = includeSources.has("events") && !includeSources.has("deadlines") && !includeSources.has("reminders");
670
- const hasExplicitBounds = options.to !== void 0 || explicitLookahead !== void 0 || occurrenceLimit !== void 0;
680
+ const hasExplicitBounds = options.to !== void 0 || explicitLookahead !== void 0 || recurrenceLookbackDays !== void 0 || occurrenceLimit !== void 0;
671
681
  const eventsOnlyCapApplied = eventsOnly && !hasExplicitBounds;
672
- const recurrenceLookaheadDays = eventsOnlyCapApplied ? DEFAULT_EVENTS_ONLY_LOOKAHEAD_DAYS : explicitLookahead;
673
- const recurrenceLookbackWindowDays = eventsOnlyCapApplied && recurrenceLookbackDays === void 0 ? 0 : recurrenceLookbackDays;
682
+ return {
683
+ nowValue,
684
+ view,
685
+ rangeBounds,
686
+ limit,
687
+ includeSources,
688
+ occurrenceLimit,
689
+ recurrenceLookaheadDays: eventsOnlyCapApplied ? DEFAULT_EVENTS_ONLY_LOOKAHEAD_DAYS : explicitLookahead,
690
+ recurrenceLookbackWindowDays: eventsOnlyCapApplied && recurrenceLookbackDays === void 0 ? 0 : recurrenceLookbackDays,
691
+ eventsOnlyCapApplied
692
+ };
693
+ }
694
+ function appendCalendarCapWarning(warnings, capApplied) {
695
+ if (!capApplied) {
696
+ return;
697
+ }
698
+ warnings.push(`recurring_events_default_cap_applied:lookback=0d,lookahead=${DEFAULT_EVENTS_ONLY_LOOKAHEAD_DAYS}d -- use --recurrence-lookback-days/--recurrence-lookahead-days or --to for wider range`);
699
+ }
700
+ function buildCalendarFiltersResult(options, runtimeFieldFilters) {
701
+ return {
702
+ type: options.type ?? null,
703
+ tag: options.tag ?? null,
704
+ priority: options.priority ?? null,
705
+ status: options.status ?? null,
706
+ assignee: options.assignee ?? null,
707
+ assignee_filter: options.assigneeFilter ?? null,
708
+ sprint: options.sprint ?? null,
709
+ release: options.release ?? null,
710
+ runtime_filters: runtimeFieldFilters,
711
+ limit: options.limit ?? null,
712
+ include: options.include ?? null,
713
+ full_period: options.fullPeriod === true ? "true" : null,
714
+ recurrence_lookahead_days: options.recurrenceLookaheadDays ?? null,
715
+ recurrence_lookback_days: options.recurrenceLookbackDays ?? null,
716
+ occurrence_limit: options.occurrenceLimit ?? null
717
+ };
718
+ }
719
+ function buildCalendarRangeResult(options, rangeBounds) {
720
+ return {
721
+ start: rangeBounds.start ?? null,
722
+ end: rangeBounds.end ?? null,
723
+ period_start: rangeBounds.periodStart ?? null,
724
+ period_end: rangeBounds.periodEnd ?? null,
725
+ full_period: rangeBounds.fullPeriod,
726
+ past: options.past === true,
727
+ from: options.from ?? null,
728
+ to: options.to ?? null
729
+ };
730
+ }
731
+ async function runCalendar(options, global2) {
732
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
733
+ if (!await pathExists(getSettingsPath(pmRoot))) {
734
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
735
+ }
736
+ const inputs = resolveCalendarExecutionInputs(options);
674
737
  const settings = await readSettings(pmRoot);
675
738
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
676
739
  const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
677
740
  const runtimeFieldFilters = collectRuntimeFilterValues(options, runtimeFieldRegistry, "calendar");
678
741
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
679
742
  const listWarnings = [];
680
- if (eventsOnlyCapApplied) {
681
- listWarnings.push(`recurring_events_default_cap_applied:lookback=0d,lookahead=${DEFAULT_EVENTS_ONLY_LOOKAHEAD_DAYS}d -- use --recurrence-lookback-days/--recurrence-lookahead-days or --to for wider range`);
682
- }
743
+ appendCalendarCapWarning(listWarnings, inputs.eventsOnlyCapApplied);
683
744
  const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, listWarnings, settings.schema);
684
745
  const filteredItems = filterItems(items, options, typeRegistry, statusRegistry, runtimeFieldFilters);
685
- const recurringWindow = buildRecurringEventWindow(rangeBounds.start, rangeBounds.end, nowValue, recurrenceLookbackWindowDays, recurrenceLookaheadDays);
686
- const seededEvents = buildEventSeed(filteredItems, recurringWindow, includeSources, occurrenceLimit);
687
- const rangedEvents = seededEvents.filter((event) => includeEventInWindow(event, rangeBounds.start, rangeBounds.end));
688
- const limitedEvents = limit === void 0 ? rangedEvents : rangedEvents.slice(0, limit);
746
+ const recurringWindow = buildRecurringEventWindow(inputs.rangeBounds.start, inputs.rangeBounds.end, inputs.nowValue, inputs.recurrenceLookbackWindowDays, inputs.recurrenceLookaheadDays);
747
+ const seededEvents = buildEventSeed(filteredItems, recurringWindow, inputs.includeSources, inputs.occurrenceLimit);
748
+ const rangedEvents = seededEvents.filter((event) => includeEventInWindow(event, inputs.rangeBounds.start, inputs.rangeBounds.end));
749
+ const limitedEvents = inputs.limit === void 0 ? rangedEvents : rangedEvents.slice(0, inputs.limit);
689
750
  const days = bucketEventsByDay(limitedEvents);
690
751
  const warnings = [...new Set(listWarnings)].sort((left, right) => left.localeCompare(right));
691
752
  return {
692
- view,
753
+ view: inputs.view,
693
754
  output_default: "markdown",
694
- now: nowValue,
695
- anchor: rangeBounds.anchor,
696
- range: {
697
- start: rangeBounds.start ?? null,
698
- end: rangeBounds.end ?? null,
699
- period_start: rangeBounds.periodStart ?? null,
700
- period_end: rangeBounds.periodEnd ?? null,
701
- full_period: rangeBounds.fullPeriod,
702
- past: options.past === true,
703
- from: options.from ?? null,
704
- to: options.to ?? null
705
- },
706
- filters: {
707
- type: options.type ?? null,
708
- tag: options.tag ?? null,
709
- priority: options.priority ?? null,
710
- status: options.status ?? null,
711
- assignee: options.assignee ?? null,
712
- assignee_filter: options.assigneeFilter ?? null,
713
- sprint: options.sprint ?? null,
714
- release: options.release ?? null,
715
- runtime_filters: runtimeFieldFilters,
716
- limit: options.limit ?? null,
717
- include: options.include ?? null,
718
- full_period: options.fullPeriod === true ? "true" : null,
719
- recurrence_lookahead_days: options.recurrenceLookaheadDays ?? null,
720
- recurrence_lookback_days: options.recurrenceLookbackDays ?? null,
721
- occurrence_limit: options.occurrenceLimit ?? null
722
- },
755
+ now: inputs.nowValue,
756
+ anchor: inputs.rangeBounds.anchor,
757
+ range: buildCalendarRangeResult(options, inputs.rangeBounds),
758
+ filters: buildCalendarFiltersResult(options, runtimeFieldFilters),
723
759
  summary: summarize(limitedEvents),
724
760
  events: limitedEvents,
725
761
  days,
@@ -731,7 +767,7 @@ async function runCalendar(options, global2) {
731
767
  !(function() {
732
768
  try {
733
769
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
734
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "7794eae6-2b67-5061-891e-af78b0682685");
770
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "f244506b-038b-5a3d-8184-f0b73e30f300");
735
771
  } catch (e2) {
736
772
  }
737
773
  })();
@@ -1390,53 +1426,28 @@ function formatAgendaLine(event) {
1390
1426
  }
1391
1427
  return base;
1392
1428
  }
1393
- function renderContextMarkdown(result) {
1394
- const lines = [];
1395
- const focusFields = result.focus_fields;
1396
- const renderFocus = (item) => focusFields ? formatProjectedFocusLine(item, focusFields) : formatFocusLine(item);
1397
- lines.push("# pm context");
1398
- lines.push("");
1399
- lines.push(`- now: ${result.now}`);
1400
- lines.push(`- depth: ${result.depth}`);
1401
- if (result.filters.parent) {
1402
- lines.push(`- scope: subtree of ${result.filters.parent}`);
1403
- }
1404
- lines.push(`- active_items: ${result.summary.active_items} (in_progress: ${result.summary.in_progress}, open: ${result.summary.open})`);
1405
- if (result.summary.total_items !== void 0) {
1406
- lines.push(`- total_items: ${result.summary.total_items} (closed: ${result.summary.closed ?? 0}, canceled: ${result.summary.canceled ?? 0})`);
1407
- }
1408
- lines.push(`- agenda_events: ${result.summary.agenda_events}`);
1409
- lines.push(`- blocked_fallback_used: ${result.summary.blocked_fallback_used}`);
1410
- const renderedSections = result.sections_included.filter((section) => section !== "blockers" || (result.blockers?.length ?? 0) > 0);
1411
- if (renderedSections.length > 0) {
1412
- lines.push(`- sections: ${renderedSections.join(", ")}`);
1413
- }
1414
- lines.push("");
1415
- lines.push("## High-level focus");
1416
- if (result.high_level.length === 0) {
1417
- lines.push("No high-level active items.");
1429
+ function pushContextFocusSection(lines, title, rows, emptyText, renderFocus) {
1430
+ lines.push(`## ${title}`);
1431
+ if (rows.length === 0) {
1432
+ lines.push(emptyText);
1418
1433
  } else {
1419
- for (const item of result.high_level) {
1434
+ for (const item of rows) {
1420
1435
  lines.push(`- ${renderFocus(item)}`);
1421
1436
  }
1422
1437
  }
1423
1438
  lines.push("");
1424
- lines.push("## Low-level focus");
1425
- if (result.low_level.length === 0) {
1426
- lines.push("No low-level active items.");
1427
- } else {
1428
- for (const item of result.low_level) {
1429
- lines.push(`- ${renderFocus(item)}`);
1430
- }
1439
+ }
1440
+ function pushBlockedFallbackSection(lines, result, renderFocus) {
1441
+ if (result.blocked_fallback.length === 0) {
1442
+ return;
1431
1443
  }
1432
- lines.push("");
1433
- if (result.blocked_fallback.length > 0) {
1434
- lines.push("## Blocked fallback");
1435
- for (const item of result.blocked_fallback) {
1436
- lines.push(`- ${renderFocus(item)}`);
1437
- }
1438
- lines.push("");
1444
+ lines.push("## Blocked fallback");
1445
+ for (const item of result.blocked_fallback) {
1446
+ lines.push(`- ${renderFocus(item)}`);
1439
1447
  }
1448
+ lines.push("");
1449
+ }
1450
+ function pushAgendaSection(lines, result) {
1440
1451
  lines.push("## Agenda");
1441
1452
  lines.push(`- events: ${result.agenda.summary.events} (deadlines: ${result.agenda.summary.deadlines}, reminders: ${result.agenda.summary.reminders}, scheduled: ${result.agenda.summary.scheduled})`);
1442
1453
  if (result.agenda.events.length === 0) {
@@ -1447,205 +1458,373 @@ function renderContextMarkdown(result) {
1447
1458
  }
1448
1459
  }
1449
1460
  lines.push("");
1450
- if (result.hierarchy && result.hierarchy.length > 0) {
1451
- lines.push("## Hierarchy");
1452
- for (const node of result.hierarchy) {
1453
- const pct = node.children_total > 0 ? Math.round(node.children_closed / node.children_total * 100) : 0;
1454
- lines.push(`- ${node.id} ${node.type} ${node.status} "${node.title}" [${node.children_closed}/${node.children_total} done ${pct}%]`);
1455
- for (const child of node.children) {
1456
- const cpct = child.children_total > 0 ? Math.round(child.children_closed / child.children_total * 100) : 0;
1457
- lines.push(` - ${child.id} ${child.type} ${child.status} "${child.title}" [${child.children_closed}/${child.children_total} done ${cpct}%]`);
1458
- }
1461
+ }
1462
+ function pushHierarchySection(lines, result) {
1463
+ if (!result.hierarchy || result.hierarchy.length === 0) {
1464
+ return;
1465
+ }
1466
+ lines.push("## Hierarchy");
1467
+ for (const node of result.hierarchy) {
1468
+ const pct = node.children_total > 0 ? Math.round(node.children_closed / node.children_total * 100) : 0;
1469
+ lines.push(`- ${node.id} ${node.type} ${node.status} "${node.title}" [${node.children_closed}/${node.children_total} done ${pct}%]`);
1470
+ for (const child of node.children) {
1471
+ const cpct = child.children_total > 0 ? Math.round(child.children_closed / child.children_total * 100) : 0;
1472
+ lines.push(` - ${child.id} ${child.type} ${child.status} "${child.title}" [${child.children_closed}/${child.children_total} done ${cpct}%]`);
1459
1473
  }
1460
- lines.push("");
1461
1474
  }
1462
- if (result.progress && result.progress.length > 0) {
1463
- lines.push("## Progress");
1464
- for (const entry of result.progress) {
1465
- lines.push(`- ${entry.id} "${entry.title}" ${entry.completion_pct}% (${entry.closed}/${entry.total} closed, ${entry.in_progress} wip, ${entry.open} open, ${entry.blocked} blocked)`);
1466
- }
1467
- lines.push("");
1475
+ lines.push("");
1476
+ }
1477
+ function pushProgressSection(lines, result) {
1478
+ if (!result.progress || result.progress.length === 0) {
1479
+ return;
1468
1480
  }
1469
- if (result.recently_created && result.recently_created.length > 0) {
1470
- lines.push("## Recently created");
1471
- for (const item of result.recently_created) {
1472
- lines.push(focusFields ? `- ${renderFocus(item)}` : `- ${dateTokenForTimestamp(item.created_at)} ${formatFocusLine(item)}`);
1473
- }
1474
- lines.push("");
1481
+ lines.push("## Progress");
1482
+ for (const entry of result.progress) {
1483
+ lines.push(`- ${entry.id} "${entry.title}" ${entry.completion_pct}% (${entry.closed}/${entry.total} closed, ${entry.in_progress} wip, ${entry.open} open, ${entry.blocked} blocked)`);
1475
1484
  }
1476
- if (result.unparented && result.unparented.length > 0) {
1477
- lines.push("## Unparented");
1478
- for (const item of result.unparented) {
1479
- lines.push(`- ${renderFocus(item)}`);
1480
- }
1481
- lines.push("");
1485
+ lines.push("");
1486
+ }
1487
+ function pushRecentlyCreatedSection(lines, result, focusFields, renderFocus) {
1488
+ if (!result.recently_created || result.recently_created.length === 0) {
1489
+ return;
1482
1490
  }
1483
- if (result.activity && result.activity.length > 0) {
1484
- lines.push("## Recent activity");
1485
- for (const entry of result.activity) {
1486
- const msg = entry.msg ? ` ${entry.msg}` : "";
1487
- lines.push(`- ${entry.ts.slice(0, 16)}Z ${entry.id} ${entry.op} by:${entry.author}${msg}`);
1488
- }
1489
- lines.push("");
1490
- }
1491
- if (result.blockers && result.blockers.length > 0) {
1492
- lines.push("## Blockers");
1493
- for (const entry of result.blockers) {
1494
- const by = entry.blocked_by ? `blocked_by:${entry.blocked_by}(${entry.blocked_by_status ?? "?"})` : "blocked_by:-";
1495
- const reason = entry.blocked_reason ? ` reason:"${entry.blocked_reason}"` : "";
1496
- const note = entry.unblock_note ? ` unblock:"${entry.unblock_note}"` : "";
1497
- lines.push(`- ${entry.id} "${entry.title}" ${by}${reason}${note}`);
1498
- }
1499
- lines.push("");
1491
+ lines.push("## Recently created");
1492
+ for (const item of result.recently_created) {
1493
+ lines.push(focusFields ? `- ${renderFocus(item)}` : `- ${dateTokenForTimestamp(item.created_at)} ${formatFocusLine(item)}`);
1500
1494
  }
1501
- if (result.files && result.files.length > 0) {
1502
- lines.push("## Hot files");
1503
- for (const file of result.files) {
1504
- lines.push(`- ${file.path} refs:${file.references} items:[${file.items.join(",")}]`);
1505
- }
1506
- lines.push("");
1495
+ lines.push("");
1496
+ }
1497
+ function pushUnparentedSection(lines, result, renderFocus) {
1498
+ if (!result.unparented || result.unparented.length === 0) {
1499
+ return;
1507
1500
  }
1508
- if (result.workload && result.workload.length > 0) {
1509
- lines.push("## Workload");
1510
- for (const entry of result.workload) {
1511
- const who = entry.assignee ?? "(unassigned)";
1512
- lines.push(`- ${who} active:${entry.active} wip:${entry.in_progress} items:[${entry.items.join(",")}]`);
1513
- }
1514
- lines.push("");
1501
+ lines.push("## Unparented");
1502
+ for (const item of result.unparented) {
1503
+ lines.push(`- ${renderFocus(item)}`);
1515
1504
  }
1516
- if (result.staleness && result.staleness.length > 0) {
1517
- lines.push("## Stale items");
1518
- for (const entry of result.staleness) {
1519
- lines.push(`- ${entry.id} ${entry.status} stale:${entry.stale_days}d last:${entry.updated_at.slice(0, 10)} "${entry.title}"`);
1520
- }
1521
- lines.push("");
1522
- }
1523
- if (result.tests) {
1524
- lines.push("## Test health");
1525
- lines.push(`- items_with_tests: ${result.tests.items_with_tests}`);
1526
- lines.push(`- items_with_recent_runs: ${result.tests.items_with_recent_runs}`);
1527
- lines.push(`- passed: ${result.tests.recent_runs.passed}, failed: ${result.tests.recent_runs.failed}, skipped: ${result.tests.recent_runs.skipped}`);
1528
- if (result.tests.items_failing.length > 0) {
1529
- lines.push(`- items_failing: [${result.tests.items_failing.join(",")}]`);
1530
- }
1531
- lines.push("");
1505
+ lines.push("");
1506
+ }
1507
+ function pushActivitySection(lines, result) {
1508
+ if (!result.activity || result.activity.length === 0) {
1509
+ return;
1532
1510
  }
1511
+ lines.push("## Recent activity");
1512
+ for (const entry of result.activity) {
1513
+ const msg = entry.msg ? ` ${entry.msg}` : "";
1514
+ lines.push(`- ${entry.ts.slice(0, 16)}Z ${entry.id} ${entry.op} by:${entry.author}${msg}`);
1515
+ }
1516
+ lines.push("");
1517
+ }
1518
+ function pushBlockersSection(lines, result) {
1519
+ if (!result.blockers || result.blockers.length === 0) {
1520
+ return;
1521
+ }
1522
+ lines.push("## Blockers");
1523
+ for (const entry of result.blockers) {
1524
+ const by = entry.blocked_by ? `blocked_by:${entry.blocked_by}(${entry.blocked_by_status ?? "?"})` : "blocked_by:-";
1525
+ const reason = entry.blocked_reason ? ` reason:"${entry.blocked_reason}"` : "";
1526
+ const note = entry.unblock_note ? ` unblock:"${entry.unblock_note}"` : "";
1527
+ lines.push(`- ${entry.id} "${entry.title}" ${by}${reason}${note}`);
1528
+ }
1529
+ lines.push("");
1530
+ }
1531
+ function pushFilesSection(lines, result) {
1532
+ if (!result.files || result.files.length === 0) {
1533
+ return;
1534
+ }
1535
+ lines.push("## Hot files");
1536
+ for (const file of result.files) {
1537
+ lines.push(`- ${file.path} refs:${file.references} items:[${file.items.join(",")}]`);
1538
+ }
1539
+ lines.push("");
1540
+ }
1541
+ function pushWorkloadSection(lines, result) {
1542
+ if (!result.workload || result.workload.length === 0) {
1543
+ return;
1544
+ }
1545
+ lines.push("## Workload");
1546
+ for (const entry of result.workload) {
1547
+ const who = entry.assignee ?? "(unassigned)";
1548
+ lines.push(`- ${who} active:${entry.active} wip:${entry.in_progress} items:[${entry.items.join(",")}]`);
1549
+ }
1550
+ lines.push("");
1551
+ }
1552
+ function pushStalenessSection(lines, result) {
1553
+ if (!result.staleness || result.staleness.length === 0) {
1554
+ return;
1555
+ }
1556
+ lines.push("## Stale items");
1557
+ for (const entry of result.staleness) {
1558
+ lines.push(`- ${entry.id} ${entry.status} stale:${entry.stale_days}d last:${entry.updated_at.slice(0, 10)} "${entry.title}"`);
1559
+ }
1560
+ lines.push("");
1561
+ }
1562
+ function pushTestHealthSection(lines, result) {
1563
+ if (!result.tests) {
1564
+ return;
1565
+ }
1566
+ lines.push("## Test health");
1567
+ lines.push(`- items_with_tests: ${result.tests.items_with_tests}`);
1568
+ lines.push(`- items_with_recent_runs: ${result.tests.items_with_recent_runs}`);
1569
+ lines.push(`- passed: ${result.tests.recent_runs.passed}, failed: ${result.tests.recent_runs.failed}, skipped: ${result.tests.recent_runs.skipped}`);
1570
+ if (result.tests.items_failing.length > 0) {
1571
+ lines.push(`- items_failing: [${result.tests.items_failing.join(",")}]`);
1572
+ }
1573
+ lines.push("");
1574
+ }
1575
+ function pushEmptyContextSuggestions(lines, result) {
1533
1576
  const isEmpty = result.summary.active_items === 0 && result.summary.blocked === 0 && result.agenda.summary.events === 0;
1534
- if (isEmpty) {
1535
- lines.push("## Suggestions");
1536
- lines.push("No active work items or upcoming events. Consider:");
1537
- lines.push('- `pm create --type Task --title "..."` to add a new work item');
1538
- lines.push("- `pm list --status closed --limit 5` to review recent completions");
1539
- lines.push("- `pm search <keywords>` to find related past work");
1540
- lines.push("- `pm aggregate` for a full project status overview");
1577
+ if (!isEmpty) {
1578
+ return;
1541
1579
  }
1580
+ lines.push("## Suggestions");
1581
+ lines.push("No active work items or upcoming events. Consider:");
1582
+ lines.push('- `pm create --type Task --title "..."` to add a new work item');
1583
+ lines.push("- `pm list --status closed --limit 5` to review recent completions");
1584
+ lines.push("- `pm search <keywords>` to find related past work");
1585
+ lines.push("- `pm aggregate` for a full project status overview");
1586
+ }
1587
+ function renderContextMarkdown(result) {
1588
+ const lines = [];
1589
+ const focusFields = result.focus_fields;
1590
+ const renderFocus = (item) => focusFields ? formatProjectedFocusLine(item, focusFields) : formatFocusLine(item);
1591
+ lines.push("# pm context");
1592
+ lines.push("");
1593
+ lines.push(`- now: ${result.now}`);
1594
+ lines.push(`- depth: ${result.depth}`);
1595
+ if (result.filters.parent) {
1596
+ lines.push(`- scope: subtree of ${result.filters.parent}`);
1597
+ }
1598
+ lines.push(`- active_items: ${result.summary.active_items} (in_progress: ${result.summary.in_progress}, open: ${result.summary.open})`);
1599
+ if (result.summary.total_items !== void 0) {
1600
+ lines.push(`- total_items: ${result.summary.total_items} (closed: ${result.summary.closed ?? 0}, canceled: ${result.summary.canceled ?? 0})`);
1601
+ }
1602
+ lines.push(`- agenda_events: ${result.summary.agenda_events}`);
1603
+ lines.push(`- blocked_fallback_used: ${result.summary.blocked_fallback_used}`);
1604
+ const renderedSections = result.sections_included.filter((section) => section !== "blockers" || (result.blockers?.length ?? 0) > 0);
1605
+ if (renderedSections.length > 0) {
1606
+ lines.push(`- sections: ${renderedSections.join(", ")}`);
1607
+ }
1608
+ lines.push("");
1609
+ pushContextFocusSection(lines, "High-level focus", result.high_level, "No high-level active items.", renderFocus);
1610
+ pushContextFocusSection(lines, "Low-level focus", result.low_level, "No low-level active items.", renderFocus);
1611
+ pushBlockedFallbackSection(lines, result, renderFocus);
1612
+ pushAgendaSection(lines, result);
1613
+ pushHierarchySection(lines, result);
1614
+ pushProgressSection(lines, result);
1615
+ pushRecentlyCreatedSection(lines, result, focusFields, renderFocus);
1616
+ pushUnparentedSection(lines, result, renderFocus);
1617
+ pushActivitySection(lines, result);
1618
+ pushBlockersSection(lines, result);
1619
+ pushFilesSection(lines, result);
1620
+ pushWorkloadSection(lines, result);
1621
+ pushStalenessSection(lines, result);
1622
+ pushTestHealthSection(lines, result);
1623
+ pushEmptyContextSuggestions(lines, result);
1542
1624
  return lines.join("\n");
1543
1625
  }
1544
- async function runContext(options, global2) {
1626
+ async function resolveContextRuntime(options, global2) {
1545
1627
  const pmRoot = resolvePmRoot(process.cwd(), global2.path);
1546
1628
  const settings = await readSettings(pmRoot);
1547
1629
  const contextSettings = settings.context ?? SETTINGS_DEFAULTS.context;
1548
1630
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
1549
1631
  const depth = parseContextDepth(options.depth, contextSettings);
1550
- const limit = parseContextLimit(options.limit, depth);
1551
- const sectionsIncluded = parseContextSections(options.section, depth, contextSettings);
1552
- const activityLimit = parseActivityLimit(options.activityLimit, contextSettings);
1553
- const staleThresholdDays = parseStaleThresholdDays(options.staleThreshold, contextSettings);
1554
- const parentScope = parseContextParent(options.parent);
1555
- const focusFields = parseContextFocusFields(options.fields);
1556
- const needsAllItems = sectionsIncluded.some((s) => ["hierarchy", "progress", "blockers", "staleness", "recently_created", "unparented"].includes(s));
1557
- const baseListOptions = stripListProjectionFlags(options);
1558
- const unpaginatedListOptions = (extra) => ({
1632
+ return {
1633
+ settings,
1634
+ contextSettings,
1635
+ statusRegistry,
1636
+ depth,
1637
+ limit: parseContextLimit(options.limit, depth),
1638
+ sectionsIncluded: parseContextSections(options.section, depth, contextSettings),
1639
+ activityLimit: parseActivityLimit(options.activityLimit, contextSettings),
1640
+ staleThresholdDays: parseStaleThresholdDays(options.staleThreshold, contextSettings),
1641
+ parentScope: parseContextParent(options.parent),
1642
+ focusFields: parseContextFocusFields(options.fields),
1643
+ baseListOptions: stripListProjectionFlags(options)
1644
+ };
1645
+ }
1646
+ function contextNeedsAllItems(sectionsIncluded) {
1647
+ return sectionsIncluded.some((section) => ["hierarchy", "progress", "blockers", "staleness", "recently_created", "unparented"].includes(section));
1648
+ }
1649
+ function buildUnpaginatedContextListOptions(baseListOptions, extra) {
1650
+ return {
1559
1651
  ...baseListOptions,
1560
1652
  ...extra,
1561
1653
  noTruncate: true,
1562
1654
  limit: void 0,
1563
1655
  offset: void 0
1564
- });
1565
- const listOptions = parentScope === void 0 ? { ...baseListOptions, excludeTerminal: true } : unpaginatedListOptions({ excludeTerminal: true });
1656
+ };
1657
+ }
1658
+ async function loadContextCorpus(options, global2, runtime) {
1659
+ const needsAllItems = contextNeedsAllItems(runtime.sectionsIncluded);
1660
+ const listOptions = runtime.parentScope === void 0 ? { ...runtime.baseListOptions, excludeTerminal: true } : buildUnpaginatedContextListOptions(runtime.baseListOptions, { excludeTerminal: true });
1566
1661
  const listed = await runList(void 0, listOptions, global2);
1567
1662
  let listedFrontMatter = listed.items;
1568
1663
  let allItems = listedFrontMatter;
1569
- if (needsAllItems || parentScope !== void 0) {
1570
- const allListed = await runList(void 0, unpaginatedListOptions({ excludeTerminal: false }), global2);
1664
+ if (needsAllItems || runtime.parentScope !== void 0) {
1665
+ const allListed = await runList(void 0, buildUnpaginatedContextListOptions(runtime.baseListOptions, { excludeTerminal: false }), global2);
1571
1666
  allItems = allListed.items;
1572
1667
  }
1573
1668
  const fullCorpus = allItems;
1574
- let subtreeIds;
1575
- if (parentScope !== void 0) {
1576
- const subtree = collectSubtreeIds(fullCorpus, parentScope);
1577
- if (!subtree.found) {
1578
- throw new PmCliError(`Context --parent item not found: ${parentScope}`, EXIT_CODE.NOT_FOUND);
1579
- }
1580
- subtreeIds = subtree.ids;
1581
- listedFrontMatter = listedFrontMatter.filter((item) => subtreeIds?.has(item.id.trim().toLowerCase()));
1582
- allItems = allItems.filter((item) => subtreeIds?.has(item.id.trim().toLowerCase()));
1669
+ const subtreeIds = resolveContextSubtreeIds(runtime.parentScope, fullCorpus);
1670
+ if (subtreeIds) {
1671
+ listedFrontMatter = listedFrontMatter.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));
1672
+ allItems = allItems.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));
1673
+ }
1674
+ return { listed, listedFrontMatter, allItems, fullCorpus, subtreeIds };
1675
+ }
1676
+ function resolveContextSubtreeIds(parentScope, fullCorpus) {
1677
+ if (parentScope === void 0) {
1678
+ return void 0;
1583
1679
  }
1680
+ const subtree = collectSubtreeIds(fullCorpus, parentScope);
1681
+ if (!subtree.found) {
1682
+ throw new PmCliError(`Context --parent item not found: ${parentScope}`, EXIT_CODE.NOT_FOUND);
1683
+ }
1684
+ return subtree.ids;
1685
+ }
1686
+ function resolveContextFocusGroups(listedFrontMatter, allItems, statusRegistry, sectionsIncluded, limit) {
1584
1687
  const ranked = [...listedFrontMatter].sort((left, right) => compareCriticalItems(left, right, statusRegistry));
1585
- const activeStatuses = statusRegistry.active_statuses.size > 0 ? statusRegistry.active_statuses : /* @__PURE__ */ new Set([statusRegistry.open_status]);
1586
- const blockedStatuses = statusRegistry.blocked_statuses;
1688
+ const activeStatuses = statusRegistry.active_statuses;
1587
1689
  const activeItems = ranked.filter((item) => activeStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1588
- const blockedItems = ranked.filter((item) => blockedStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1690
+ const blockedItems = ranked.filter((item) => statusRegistry.blocked_statuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1589
1691
  const childrenByParent = buildChildrenByParent(allItems);
1590
- const focusChildrenByParent = needsAllItems ? childrenByParent : void 0;
1692
+ const focusChildrenByParent = contextNeedsAllItems(sectionsIncluded) ? childrenByParent : void 0;
1591
1693
  const highLevel = activeItems.filter((item) => HIGH_LEVEL_TYPES.has(item.type)).slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent));
1592
1694
  const lowLevel = activeItems.filter((item) => !HIGH_LEVEL_TYPES.has(item.type)).slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent));
1593
1695
  const blockedFallbackUsed = activeItems.length === 0;
1594
- const blockedFallback = blockedFallbackUsed ? blockedItems.slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent)) : [];
1696
+ return {
1697
+ activeItems,
1698
+ blockedItems,
1699
+ highLevel,
1700
+ lowLevel,
1701
+ blockedFallback: blockedFallbackUsed ? blockedItems.slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent)) : [],
1702
+ blockedFallbackUsed
1703
+ };
1704
+ }
1705
+ async function buildContextAgenda(options, global2, runtime, subtreeIds) {
1595
1706
  const calendarOptions = {
1596
- ...baseListOptions,
1707
+ ...runtime.baseListOptions,
1597
1708
  view: "agenda",
1598
1709
  include: "all",
1599
- // When scoping to a subtree, pull the full agenda so the subtree filter sees
1600
- // every candidate event before the final per-section slice.
1601
- limit: parentScope === void 0 ? String(limit) : void 0
1710
+ limit: runtime.parentScope === void 0 ? String(runtime.limit) : void 0
1602
1711
  };
1603
1712
  const agenda = await runCalendar(calendarOptions, global2);
1604
1713
  const scopedAgenda = subtreeIds === void 0 ? agenda.events : agenda.events.filter((event) => subtreeIds.has(event.item_id.trim().toLowerCase()));
1605
- const agendaEvents = filterTerminalCalendarEvents(scopedAgenda, statusRegistry).slice(0, limit);
1606
- const agendaSummary = summarizeAgenda(agendaEvents);
1607
- const warnings = mergeSortedWarnings(listed.warnings, agenda.warnings);
1608
- const inProgressStatus = normalizeStatusInput("in_progress", statusRegistry);
1609
- const openStatus = normalizeStatusInput("open", statusRegistry);
1610
- const inProgressCount = activeItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === inProgressStatus).length;
1611
- const openCount = activeItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === openStatus).length;
1612
- const now = agenda.now;
1613
- const itemMap = /* @__PURE__ */ new Map();
1614
- for (const item of fullCorpus) {
1615
- itemMap.set(item.id, item);
1714
+ const agendaEvents = filterTerminalCalendarEvents(scopedAgenda, runtime.statusRegistry).slice(0, runtime.limit);
1715
+ return { agenda, agendaEvents, agendaSummary: summarizeAgenda(agendaEvents) };
1716
+ }
1717
+ function countContextStatus(items, status, statusRegistry) {
1718
+ const targetStatus = String(status);
1719
+ return items.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === targetStatus).length;
1720
+ }
1721
+ async function buildOptionalContextSections(params) {
1722
+ const { runtime, allItems, fullCorpus, focusGroups, now, global: global2 } = params;
1723
+ const childrenByParent = buildChildrenByParent(allItems);
1724
+ const itemMap = new Map(fullCorpus.map((item) => [item.id, item]));
1725
+ const allNonTerminal = allItems.filter((item) => !isTerminalStatus(item.status, runtime.statusRegistry));
1726
+ const has = (section) => runtime.sectionsIncluded.includes(section);
1727
+ return {
1728
+ hierarchy: has("hierarchy") ? buildHierarchy(allItems, focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : void 0,
1729
+ activity: has("activity") ? await buildActivity(runtime.activityLimit, global2) : void 0,
1730
+ progress: has("progress") ? buildProgress(allItems, focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : void 0,
1731
+ blockersSection: has("blockers") ? buildBlockers(focusGroups.blockedItems, itemMap, runtime.limit) : void 0,
1732
+ recentlyCreated: has("recently_created") ? buildRecentlyCreated(allNonTerminal, runtime.statusRegistry, childrenByParent, runtime.limit) : void 0,
1733
+ unparented: has("unparented") ? buildUnparented(allNonTerminal, runtime.statusRegistry, childrenByParent, runtime.limit) : void 0,
1734
+ filesSection: has("files") ? buildHotFiles(focusGroups.activeItems, runtime.limit) : void 0,
1735
+ workload: has("workload") ? buildWorkload(focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : void 0,
1736
+ staleness: has("staleness") ? buildStaleness(allNonTerminal, runtime.staleThresholdDays, now, runtime.limit) : void 0,
1737
+ tests: has("tests") ? buildTestHealth(focusGroups.activeItems) : void 0
1738
+ };
1739
+ }
1740
+ function buildContextSummaryExtras(needsAllItems, allItems, statusRegistry) {
1741
+ if (!needsAllItems) {
1742
+ return {};
1616
1743
  }
1617
- const allNonTerminal = allItems.filter((item) => !isTerminalStatus(item.status, statusRegistry));
1618
- const has = (section) => sectionsIncluded.includes(section);
1619
- const hierarchy = has("hierarchy") ? buildHierarchy(allItems, activeItems, statusRegistry, limit) : void 0;
1620
- const activity = has("activity") ? await buildActivity(activityLimit, global2) : void 0;
1621
- const progress = has("progress") ? buildProgress(allItems, activeItems, statusRegistry, limit) : void 0;
1622
- const blockersSection = has("blockers") ? buildBlockers(blockedItems, itemMap, limit) : void 0;
1623
- const recentlyCreated = has("recently_created") ? buildRecentlyCreated(allNonTerminal, statusRegistry, childrenByParent, limit) : void 0;
1624
- const unparented = has("unparented") ? buildUnparented(allNonTerminal, statusRegistry, childrenByParent, limit) : void 0;
1625
- const filesSection = has("files") ? buildHotFiles(activeItems, limit) : void 0;
1626
- const workload = has("workload") ? buildWorkload(activeItems, statusRegistry, limit) : void 0;
1627
- const staleness = has("staleness") ? buildStaleness(allNonTerminal, staleThresholdDays, now, limit) : void 0;
1628
- const tests = has("tests") ? buildTestHealth(activeItems) : void 0;
1629
- const summaryExtras = needsAllItems ? {
1744
+ const canceledStatus = normalizeStatusInput("canceled", statusRegistry);
1745
+ return {
1630
1746
  total_items: allItems.length,
1631
- closed: allItems.filter((i) => isClosedStatus(i.status, statusRegistry)).length,
1632
- canceled: allItems.filter((i) => {
1633
- const canceledStatus = normalizeStatusInput("canceled", statusRegistry);
1634
- return normalizeStatusForRegistry(i.status, statusRegistry) === canceledStatus;
1635
- }).length
1636
- } : {};
1747
+ closed: allItems.filter((item) => isClosedStatus(item.status, statusRegistry)).length,
1748
+ canceled: allItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === canceledStatus).length
1749
+ };
1750
+ }
1751
+ function attachOptionalContextSections(result, sections) {
1752
+ if (sections.hierarchy)
1753
+ result.hierarchy = sections.hierarchy;
1754
+ if (sections.activity)
1755
+ result.activity = sections.activity;
1756
+ if (sections.progress)
1757
+ result.progress = sections.progress;
1758
+ if (sections.blockersSection)
1759
+ result.blockers = sections.blockersSection;
1760
+ if (sections.recentlyCreated)
1761
+ result.recently_created = sections.recentlyCreated;
1762
+ if (sections.unparented)
1763
+ result.unparented = sections.unparented;
1764
+ if (sections.filesSection)
1765
+ result.files = sections.filesSection;
1766
+ if (sections.workload)
1767
+ result.workload = sections.workload;
1768
+ if (sections.staleness)
1769
+ result.staleness = sections.staleness;
1770
+ if (sections.tests)
1771
+ result.tests = sections.tests;
1772
+ }
1773
+ function applyContextFocusProjection(result, focusFields) {
1774
+ if (!focusFields) {
1775
+ return;
1776
+ }
1777
+ result.focus_fields = focusFields;
1778
+ result.high_level = projectContextFocusRows(result.high_level, focusFields);
1779
+ result.low_level = projectContextFocusRows(result.low_level, focusFields);
1780
+ result.blocked_fallback = projectContextFocusRows(result.blocked_fallback, focusFields);
1781
+ if (result.recently_created) {
1782
+ result.recently_created = projectContextFocusRows(result.recently_created, focusFields);
1783
+ }
1784
+ if (result.unparented) {
1785
+ result.unparented = projectContextFocusRows(result.unparented, focusFields);
1786
+ }
1787
+ }
1788
+ function maybeAttachEmptyContextSuggestions(result, activeItems, blockedItems) {
1789
+ if (activeItems.length > 0 || blockedItems.length > 0 || result.agenda.events.length > 0) {
1790
+ return;
1791
+ }
1792
+ result.suggestions = [
1793
+ 'pm create --type Task --title "..." to add a new work item',
1794
+ "pm list --status closed --limit 5 to review recent completions",
1795
+ "pm search <keywords> to find related past work",
1796
+ "pm aggregate for a full project status overview"
1797
+ ];
1798
+ }
1799
+ async function runContext(options, global2) {
1800
+ const runtime = await resolveContextRuntime(options, global2);
1801
+ const corpus = await loadContextCorpus(options, global2, runtime);
1802
+ const focusGroups = resolveContextFocusGroups(corpus.listedFrontMatter, corpus.allItems, runtime.statusRegistry, runtime.sectionsIncluded, runtime.limit);
1803
+ const agendaContext = await buildContextAgenda(options, global2, runtime, corpus.subtreeIds);
1804
+ const warnings = mergeSortedWarnings(corpus.listed.warnings, agendaContext.agenda.warnings);
1805
+ const inProgressCount = countContextStatus(focusGroups.activeItems, normalizeStatusInput("in_progress", runtime.statusRegistry), runtime.statusRegistry);
1806
+ const openCount = countContextStatus(focusGroups.activeItems, normalizeStatusInput("open", runtime.statusRegistry), runtime.statusRegistry);
1807
+ const sections = await buildOptionalContextSections({
1808
+ runtime,
1809
+ allItems: corpus.allItems,
1810
+ fullCorpus: corpus.fullCorpus,
1811
+ focusGroups,
1812
+ now: agendaContext.agenda.now,
1813
+ global: global2
1814
+ });
1815
+ const summaryExtras = buildContextSummaryExtras(contextNeedsAllItems(runtime.sectionsIncluded), corpus.allItems, runtime.statusRegistry);
1637
1816
  const result = {
1638
1817
  output_default: "toon",
1639
- now,
1640
- depth,
1641
- sections_included: sectionsIncluded,
1818
+ now: agendaContext.agenda.now,
1819
+ depth: runtime.depth,
1820
+ sections_included: runtime.sectionsIncluded,
1642
1821
  window: {
1643
- anchor: agenda.anchor,
1644
- start: agenda.range.start,
1645
- end: agenda.range.end,
1646
- past: agenda.range.past,
1647
- from: agenda.range.from,
1648
- to: agenda.range.to
1822
+ anchor: agendaContext.agenda.anchor,
1823
+ start: agendaContext.agenda.range.start,
1824
+ end: agendaContext.agenda.range.end,
1825
+ past: agendaContext.agenda.range.past,
1826
+ from: agendaContext.agenda.range.from,
1827
+ to: agendaContext.agenda.range.to
1649
1828
  },
1650
1829
  filters: {
1651
1830
  type: options.type ?? null,
@@ -1656,71 +1835,34 @@ async function runContext(options, global2) {
1656
1835
  sprint: options.sprint ?? null,
1657
1836
  release: options.release ?? null,
1658
1837
  limit: options.limit ?? null,
1659
- parent: parentScope ?? null,
1838
+ parent: runtime.parentScope ?? null,
1660
1839
  /* c8 ignore next -- listed/calendar runtime filters are always materialized by their command handlers */
1661
- runtime_filters: listed.filters.runtime_filters ?? agenda.filters.runtime_filters ?? {}
1840
+ runtime_filters: corpus.listed.filters.runtime_filters ?? agendaContext.agenda.filters.runtime_filters ?? {}
1662
1841
  },
1663
1842
  summary: {
1664
- active_items: activeItems.length,
1843
+ active_items: focusGroups.activeItems.length,
1665
1844
  in_progress: inProgressCount,
1666
1845
  open: openCount,
1667
- blocked: blockedItems.length,
1668
- blocked_fallback_used: blockedFallbackUsed,
1669
- high_level: highLevel.length,
1670
- low_level: lowLevel.length,
1671
- agenda_events: agendaSummary.events,
1846
+ blocked: focusGroups.blockedItems.length,
1847
+ blocked_fallback_used: focusGroups.blockedFallbackUsed,
1848
+ high_level: focusGroups.highLevel.length,
1849
+ low_level: focusGroups.lowLevel.length,
1850
+ agenda_events: agendaContext.agendaSummary.events,
1672
1851
  ...summaryExtras
1673
1852
  },
1674
- high_level: highLevel,
1675
- low_level: lowLevel,
1676
- blocked_fallback: blockedFallback,
1853
+ high_level: focusGroups.highLevel,
1854
+ low_level: focusGroups.lowLevel,
1855
+ blocked_fallback: focusGroups.blockedFallback,
1677
1856
  agenda: {
1678
- summary: agendaSummary,
1679
- events: agendaEvents
1857
+ summary: agendaContext.agendaSummary,
1858
+ events: agendaContext.agendaEvents
1680
1859
  }
1681
1860
  };
1682
- if (hierarchy)
1683
- result.hierarchy = hierarchy;
1684
- if (activity)
1685
- result.activity = activity;
1686
- if (progress)
1687
- result.progress = progress;
1688
- if (blockersSection)
1689
- result.blockers = blockersSection;
1690
- if (recentlyCreated)
1691
- result.recently_created = recentlyCreated;
1692
- if (unparented)
1693
- result.unparented = unparented;
1694
- if (filesSection)
1695
- result.files = filesSection;
1696
- if (workload)
1697
- result.workload = workload;
1698
- if (staleness)
1699
- result.staleness = staleness;
1700
- if (tests)
1701
- result.tests = tests;
1702
- if (focusFields) {
1703
- result.focus_fields = focusFields;
1704
- result.high_level = projectContextFocusRows(result.high_level, focusFields);
1705
- result.low_level = projectContextFocusRows(result.low_level, focusFields);
1706
- result.blocked_fallback = projectContextFocusRows(result.blocked_fallback, focusFields);
1707
- if (result.recently_created) {
1708
- result.recently_created = projectContextFocusRows(result.recently_created, focusFields);
1709
- }
1710
- if (result.unparented) {
1711
- result.unparented = projectContextFocusRows(result.unparented, focusFields);
1712
- }
1713
- }
1861
+ attachOptionalContextSections(result, sections);
1862
+ applyContextFocusProjection(result, runtime.focusFields);
1714
1863
  if (warnings.length > 0)
1715
1864
  result.warnings = warnings;
1716
- if (activeItems.length === 0 && blockedItems.length === 0 && agendaEvents.length === 0) {
1717
- result.suggestions = [
1718
- 'pm create --type Task --title "..." to add a new work item',
1719
- "pm list --status closed --limit 5 to review recent completions",
1720
- "pm search <keywords> to find related past work",
1721
- "pm aggregate for a full project status overview"
1722
- ];
1723
- }
1865
+ maybeAttachEmptyContextSuggestions(result, focusGroups.activeItems, focusGroups.blockedItems);
1724
1866
  return result;
1725
1867
  }
1726
1868
 
@@ -1739,4 +1881,4 @@ export {
1739
1881
  renderContextMarkdown,
1740
1882
  runContext
1741
1883
  };
1742
- //# sourceMappingURL=chunk-55SNVXRQ.js.map
1884
+ //# sourceMappingURL=chunk-HQAF23Q2.js.map