@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,31 +1,31 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e7cb2510-fa36-55ab-b096-7ce46e2ac4b6")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="95fd55ba-b62a-5ca4-8d6a-02955d7b5692")}catch(e){}}();
3
3
  import {
4
4
  runActivity
5
- } from "./chunk-22WKIL3H.js";
5
+ } from "./chunk-LCWQP6NM.js";
6
6
  import {
7
7
  collectRuntimeFilterValues,
8
8
  matchesRuntimeFilters,
9
9
  runList
10
- } from "./chunk-5CGRF3L5.js";
10
+ } from "./chunk-AIKU3IIL.js";
11
11
  import {
12
12
  parseIntegerLimit,
13
13
  parsePriority,
14
14
  parseType
15
- } from "./chunk-UZIWVBE6.js";
15
+ } from "./chunk-YSGTMDWC.js";
16
16
  import {
17
17
  listAllFrontMatterLight
18
- } from "./chunk-JSU5P7VS.js";
18
+ } from "./chunk-4WB6S4YX.js";
19
19
  import {
20
20
  isTerminalStatus,
21
21
  normalizeStatusForRegistry,
22
22
  normalizeStatusInput
23
- } from "./chunk-QCWF6IYD.js";
23
+ } from "./chunk-YSDFIY7N.js";
24
24
  import {
25
25
  compareTimestampStrings,
26
26
  nowIso,
27
27
  resolveIsoOrRelative
28
- } from "./chunk-AXIDKKAT.js";
28
+ } from "./chunk-CXR3CMBQ.js";
29
29
  import {
30
30
  CONTEXT_DEPTH_VALUES,
31
31
  CONTEXT_SECTION_VALUES,
@@ -42,7 +42,7 @@ import {
42
42
  resolveRuntimeFieldRegistry,
43
43
  resolveRuntimeStatusRegistry,
44
44
  weekdayOrderIndex
45
- } from "./chunk-7R4QEMZZ.js";
45
+ } from "./chunk-L4SLHV6G.js";
46
46
 
47
47
  // dist/cli/commands/calendar.js
48
48
  import { encode as encodeToon } from "@toon-format/toon";
@@ -249,122 +249,130 @@ function buildRecurringEventWindow(start, end, nowValue, lookbackDays, lookahead
249
249
  end: compareTimestampStrings(windowEnd, windowStart) > 0 ? windowEnd : addUtcDays(windowStart, 1)
250
250
  };
251
251
  }
252
- function expandRecurringOccurrences(startAt, recurrence, window, occurrenceLimit) {
253
- const maxOccurrences = occurrenceLimit ?? MAX_RECURRENCE_OCCURRENCES;
254
- const interval = recurrence.interval ?? 1;
255
- const countLimit = recurrence.count ?? Number.POSITIVE_INFINITY;
256
- const until = recurrence.until;
257
- const excluded = buildExcludedInstantSet(recurrence.exdates);
258
- const recurrenceWeekdays = recurrence.by_weekday && recurrence.by_weekday.length > 0 ? [...recurrence.by_weekday] : [weekdayToken(startAt)];
259
- const recurrenceMonthDays = recurrence.by_month_day && recurrence.by_month_day.length > 0 ? [...recurrence.by_month_day] : [new Date(startAt).getUTCDate()];
260
- const weekdayFilter = recurrence.by_weekday ? new Set(recurrence.by_weekday) : void 0;
261
- const monthDayFilter = recurrence.by_month_day ? new Set(recurrence.by_month_day) : void 0;
262
- const sortedWeekdays = [...new Set(recurrenceWeekdays)].sort((left, right) => weekdayOrderIndex(left) - weekdayOrderIndex(right));
263
- const sortedMonthDays = [...new Set(recurrenceMonthDays)].sort((left, right) => left - right);
264
- const occurrences = [];
265
- let produced = 0;
266
- const consumeCandidate = (candidateAt) => {
267
- if (compareTimestampStrings(candidateAt, startAt) < 0) {
268
- return "continue";
269
- }
270
- if (until && compareTimestampStrings(candidateAt, until) > 0) {
271
- return "stop";
272
- }
273
- if (compareTimestampStrings(candidateAt, window.end) >= 0) {
274
- return "stop";
275
- }
276
- if (excluded.has(candidateAt)) {
277
- return "continue";
278
- }
279
- produced += 1;
280
- if (compareTimestampStrings(candidateAt, window.start) >= 0) {
281
- occurrences.push(candidateAt);
282
- }
283
- if (produced >= countLimit) {
284
- return "stop";
285
- }
286
- return "continue";
252
+ function buildRecurrenceExpansionContext(startAt, recurrence, window, occurrenceLimit) {
253
+ const recurrenceWeekdays = recurrence.by_weekday !== void 0 ? [...recurrence.by_weekday] : [weekdayToken(startAt)];
254
+ const recurrenceMonthDays = recurrence.by_month_day !== void 0 ? [...recurrence.by_month_day] : [new Date(startAt).getUTCDate()];
255
+ return {
256
+ startAt,
257
+ startDate: new Date(startAt),
258
+ window,
259
+ maxOccurrences: occurrenceLimit ?? MAX_RECURRENCE_OCCURRENCES,
260
+ interval: recurrence.interval ?? 1,
261
+ countLimit: recurrence.count ?? Number.POSITIVE_INFINITY,
262
+ until: recurrence.until,
263
+ excluded: buildExcludedInstantSet(recurrence.exdates),
264
+ weekdayFilter: recurrence.by_weekday !== void 0 ? new Set(recurrence.by_weekday) : void 0,
265
+ monthDayFilter: recurrence.by_month_day !== void 0 ? new Set(recurrence.by_month_day) : void 0,
266
+ sortedWeekdays: [...new Set(recurrenceWeekdays)].sort((left, right) => weekdayOrderIndex(left) - weekdayOrderIndex(right)),
267
+ sortedMonthDays: [...new Set(recurrenceMonthDays)].sort((left, right) => left - right),
268
+ occurrences: [],
269
+ produced: 0
287
270
  };
288
- const startDate = new Date(startAt);
289
- if (recurrence.freq === "daily") {
290
- let candidateAt = startAt;
291
- for (let iteration = 0; iteration < maxOccurrences; iteration += 1) {
292
- const candidateWeekday = weekdayToken(candidateAt);
293
- const candidateMonthDay = new Date(candidateAt).getUTCDate();
294
- const weekdayMatches = !weekdayFilter || weekdayFilter.has(candidateWeekday);
295
- const monthDayMatches = !monthDayFilter || monthDayFilter.has(candidateMonthDay);
296
- if (weekdayMatches && monthDayMatches && consumeCandidate(candidateAt) === "stop") {
297
- break;
298
- }
299
- candidateAt = addUtcDays(candidateAt, interval);
300
- }
301
- return occurrences;
271
+ }
272
+ function consumeRecurrenceCandidate(context, candidateAt) {
273
+ if (compareTimestampStrings(candidateAt, context.startAt) < 0) {
274
+ return "continue";
302
275
  }
303
- if (recurrence.freq === "weekly") {
304
- const weekStart = startOfUtcWeekMonday(startAt);
305
- for (let step = 0; step < maxOccurrences; step += 1) {
306
- const candidateWeekStart = addUtcDays(weekStart, step * interval * 7);
307
- for (const weekday of sortedWeekdays) {
308
- const dayOffset = weekdayOrderIndex(weekday);
309
- const candidateDay = addUtcDays(candidateWeekStart, dayOffset);
310
- const dayDate = new Date(candidateDay);
311
- const candidateAt = new Date(Date.UTC(dayDate.getUTCFullYear(), dayDate.getUTCMonth(), dayDate.getUTCDate(), startDate.getUTCHours(), startDate.getUTCMinutes(), startDate.getUTCSeconds(), startDate.getUTCMilliseconds())).toISOString();
312
- const candidateMonthDay = dayDate.getUTCDate();
313
- if (monthDayFilter && !monthDayFilter.has(candidateMonthDay)) {
314
- continue;
315
- }
316
- const consumed = consumeCandidate(candidateAt);
317
- if (consumed === "stop") {
318
- return occurrences;
319
- }
320
- }
321
- }
322
- return occurrences;
276
+ if (context.until && compareTimestampStrings(candidateAt, context.until) > 0) {
277
+ return "stop";
323
278
  }
324
- if (recurrence.freq === "monthly") {
325
- const startYear = startDate.getUTCFullYear();
326
- const startMonth = startDate.getUTCMonth();
327
- for (let step = 0; step < maxOccurrences; step += 1) {
328
- const monthAnchor = new Date(Date.UTC(startYear, startMonth + step * interval, 1, 0, 0, 0, 0));
329
- const year2 = monthAnchor.getUTCFullYear();
330
- const month2 = monthAnchor.getUTCMonth();
331
- for (const monthDay of sortedMonthDays) {
332
- const candidateAt = buildUtcTimestamp(year2, month2, monthDay, startDate);
333
- if (!candidateAt) {
334
- continue;
335
- }
336
- const candidateWeekday = weekdayToken(candidateAt);
337
- if (weekdayFilter && !weekdayFilter.has(candidateWeekday)) {
338
- continue;
339
- }
340
- const consumed = consumeCandidate(candidateAt);
341
- if (consumed === "stop") {
342
- return occurrences;
343
- }
279
+ if (compareTimestampStrings(candidateAt, context.window.end) >= 0) {
280
+ return "stop";
281
+ }
282
+ if (context.excluded.has(candidateAt)) {
283
+ return "continue";
284
+ }
285
+ context.produced += 1;
286
+ if (compareTimestampStrings(candidateAt, context.window.start) >= 0) {
287
+ context.occurrences.push(candidateAt);
288
+ }
289
+ return context.produced >= context.countLimit || context.occurrences.length >= context.maxOccurrences ? "stop" : "continue";
290
+ }
291
+ function recurrenceDayMatchesFilters(context, candidateAt) {
292
+ const candidateWeekday = weekdayToken(candidateAt);
293
+ const candidateMonthDay = new Date(candidateAt).getUTCDate();
294
+ const weekdayMatches = !context.weekdayFilter || context.weekdayFilter.has(candidateWeekday);
295
+ const monthDayMatches = !context.monthDayFilter || context.monthDayFilter.has(candidateMonthDay);
296
+ return weekdayMatches && monthDayMatches;
297
+ }
298
+ function expandDailyOccurrences(context) {
299
+ let candidateAt = context.startAt;
300
+ for (let iteration = 0; iteration < context.maxOccurrences; iteration += 1) {
301
+ if (recurrenceDayMatchesFilters(context, candidateAt) && consumeRecurrenceCandidate(context, candidateAt) === "stop") {
302
+ break;
303
+ }
304
+ candidateAt = addUtcDays(candidateAt, context.interval);
305
+ }
306
+ return context.occurrences;
307
+ }
308
+ function buildWeeklyCandidateAt(context, candidateWeekStart, weekday) {
309
+ const dayOffset = weekdayOrderIndex(weekday);
310
+ const candidateDay = addUtcDays(candidateWeekStart, dayOffset);
311
+ const dayDate = new Date(candidateDay);
312
+ return new Date(Date.UTC(dayDate.getUTCFullYear(), dayDate.getUTCMonth(), dayDate.getUTCDate(), context.startDate.getUTCHours(), context.startDate.getUTCMinutes(), context.startDate.getUTCSeconds(), context.startDate.getUTCMilliseconds())).toISOString();
313
+ }
314
+ function expandWeeklyOccurrences(context) {
315
+ const weekStart = startOfUtcWeekMonday(context.startAt);
316
+ for (let step = 0; step < context.maxOccurrences; step += 1) {
317
+ const candidateWeekStart = addUtcDays(weekStart, step * context.interval * 7);
318
+ for (const weekday of context.sortedWeekdays) {
319
+ const candidateAt = buildWeeklyCandidateAt(context, candidateWeekStart, weekday);
320
+ if (!recurrenceDayMatchesFilters(context, candidateAt)) {
321
+ continue;
322
+ }
323
+ if (consumeRecurrenceCandidate(context, candidateAt) === "stop") {
324
+ return context.occurrences;
344
325
  }
345
326
  }
346
- return occurrences;
347
- }
348
- const year = startDate.getUTCFullYear();
349
- const month = startDate.getUTCMonth();
350
- for (let step = 0; step < maxOccurrences; step += 1) {
351
- const candidateYear = year + step * interval;
352
- for (const monthDay of sortedMonthDays) {
353
- const candidateAt = buildUtcTimestamp(candidateYear, month, monthDay, startDate);
354
- if (!candidateAt) {
327
+ }
328
+ return context.occurrences;
329
+ }
330
+ function expandMonthlyOccurrences(context) {
331
+ const startYear = context.startDate.getUTCFullYear();
332
+ const startMonth = context.startDate.getUTCMonth();
333
+ for (let step = 0; step < context.maxOccurrences; step += 1) {
334
+ const monthAnchor = new Date(Date.UTC(startYear, startMonth + step * context.interval, 1, 0, 0, 0, 0));
335
+ for (const monthDay of context.sortedMonthDays) {
336
+ const candidateAt = buildUtcTimestamp(monthAnchor.getUTCFullYear(), monthAnchor.getUTCMonth(), monthDay, context.startDate);
337
+ if (!candidateAt || !recurrenceDayMatchesFilters(context, candidateAt)) {
355
338
  continue;
356
339
  }
357
- const candidateWeekday = weekdayToken(candidateAt);
358
- if (weekdayFilter && !weekdayFilter.has(candidateWeekday)) {
340
+ if (consumeRecurrenceCandidate(context, candidateAt) === "stop") {
341
+ return context.occurrences;
342
+ }
343
+ }
344
+ }
345
+ return context.occurrences;
346
+ }
347
+ function expandYearlyOccurrences(context) {
348
+ const year = context.startDate.getUTCFullYear();
349
+ const month = context.startDate.getUTCMonth();
350
+ for (let step = 0; step < context.maxOccurrences; step += 1) {
351
+ const candidateYear = year + step * context.interval;
352
+ for (const monthDay of context.sortedMonthDays) {
353
+ const candidateAt = buildUtcTimestamp(candidateYear, month, monthDay, context.startDate);
354
+ if (!candidateAt || !recurrenceDayMatchesFilters(context, candidateAt)) {
359
355
  continue;
360
356
  }
361
- const consumed = consumeCandidate(candidateAt);
362
- if (consumed === "stop") {
363
- return occurrences;
357
+ if (consumeRecurrenceCandidate(context, candidateAt) === "stop") {
358
+ return context.occurrences;
364
359
  }
365
360
  }
366
361
  }
367
- return occurrences;
362
+ return context.occurrences;
363
+ }
364
+ function expandRecurringOccurrences(startAt, recurrence, window, occurrenceLimit) {
365
+ const context = buildRecurrenceExpansionContext(startAt, recurrence, window, occurrenceLimit);
366
+ if (recurrence.freq === "daily") {
367
+ return expandDailyOccurrences(context);
368
+ }
369
+ if (recurrence.freq === "weekly") {
370
+ return expandWeeklyOccurrences(context);
371
+ }
372
+ if (recurrence.freq === "monthly") {
373
+ return expandMonthlyOccurrences(context);
374
+ }
375
+ return expandYearlyOccurrences(context);
368
376
  }
369
377
  function sortEvents(values) {
370
378
  return [...values].sort((a, b) => {
@@ -386,92 +394,98 @@ function sortEvents(values) {
386
394
  return String(a.reminder_text).localeCompare(String(b.reminder_text));
387
395
  });
388
396
  }
397
+ function buildItemCalendarRowBase(item) {
398
+ return {
399
+ item_id: item.id,
400
+ item_title: item.title,
401
+ item_type: item.type,
402
+ item_status: item.status,
403
+ item_priority: item.priority,
404
+ item_assignee: item.assignee ?? null,
405
+ item_deadline: item.deadline ?? null,
406
+ item_tags: item.tags
407
+ };
408
+ }
409
+ function buildDeadlineRow(item) {
410
+ if (!item.deadline) {
411
+ return null;
412
+ }
413
+ return {
414
+ at: item.deadline,
415
+ date: toUtcDayKey(item.deadline),
416
+ kind: "deadline",
417
+ reminder_text: null,
418
+ event_title: null,
419
+ event_end: null,
420
+ event_location: null,
421
+ event_all_day: null,
422
+ event_timezone: null,
423
+ event_recurring: null,
424
+ event_recurrence_rule: null,
425
+ ...buildItemCalendarRowBase(item),
426
+ item_deadline: item.deadline
427
+ };
428
+ }
429
+ function buildReminderRows(item) {
430
+ return (item.reminders ?? []).map((reminder) => ({
431
+ at: reminder.at,
432
+ date: toUtcDayKey(reminder.at),
433
+ kind: "reminder",
434
+ reminder_text: reminder.text,
435
+ event_title: null,
436
+ event_end: null,
437
+ event_location: null,
438
+ event_all_day: null,
439
+ event_timezone: null,
440
+ event_recurring: null,
441
+ event_recurrence_rule: null,
442
+ ...buildItemCalendarRowBase(item)
443
+ }));
444
+ }
445
+ function recurringDurationMs(startAt, endAt) {
446
+ if (!endAt) {
447
+ return null;
448
+ }
449
+ const duration = Date.parse(endAt) - Date.parse(startAt);
450
+ return Number.isFinite(duration) && duration > 0 ? duration : null;
451
+ }
452
+ function eventOccurrenceEnd(occurrenceAt, event, durationMs) {
453
+ return event.recurrence && durationMs !== null ? new Date(new Date(occurrenceAt).getTime() + durationMs).toISOString() : event.end_at ?? null;
454
+ }
455
+ function buildScheduledEventRows(item, event, recurringWindow, occurrenceLimit) {
456
+ const recurrenceRuleSummary = formatRecurrenceRuleForSummary(event.recurrence);
457
+ const durationMs = recurringDurationMs(event.start_at, event.end_at);
458
+ const occurrences = event.recurrence ? expandRecurringOccurrences(event.start_at, event.recurrence, recurringWindow, occurrenceLimit) : [event.start_at];
459
+ return occurrences.map((occurrenceAt) => ({
460
+ at: occurrenceAt,
461
+ // All-day events are timezone-agnostic calendar dates: bucket by the
462
+ // literal start date. Timed events bucket by their local day in the
463
+ // event's timezone (defaults to UTC when unset).
464
+ date: event.all_day === true ? occurrenceAt.slice(0, 10) : toLocalDayKey(occurrenceAt, event.timezone),
465
+ kind: "event",
466
+ reminder_text: event.description ?? null,
467
+ event_title: event.title ?? item.title,
468
+ event_end: eventOccurrenceEnd(occurrenceAt, event, durationMs),
469
+ event_location: event.location ?? null,
470
+ event_all_day: event.all_day ?? null,
471
+ event_timezone: event.timezone ?? null,
472
+ event_recurring: event.recurrence ? true : false,
473
+ event_recurrence_rule: recurrenceRuleSummary,
474
+ ...buildItemCalendarRowBase(item)
475
+ }));
476
+ }
389
477
  function buildEventSeed(items, recurringWindow, includeSources, occurrenceLimit) {
390
478
  const events = [];
391
479
  for (const item of items) {
392
- if (includeSources.has("deadlines") && item.deadline) {
393
- events.push({
394
- at: item.deadline,
395
- date: toUtcDayKey(item.deadline),
396
- kind: "deadline",
397
- reminder_text: null,
398
- event_title: null,
399
- event_end: null,
400
- event_location: null,
401
- event_all_day: null,
402
- event_timezone: null,
403
- event_recurring: null,
404
- event_recurrence_rule: null,
405
- item_id: item.id,
406
- item_title: item.title,
407
- item_type: item.type,
408
- item_status: item.status,
409
- item_priority: item.priority,
410
- item_assignee: item.assignee ?? null,
411
- item_deadline: item.deadline,
412
- item_tags: item.tags
413
- });
480
+ const deadlineRow = includeSources.has("deadlines") ? buildDeadlineRow(item) : null;
481
+ if (deadlineRow) {
482
+ events.push(deadlineRow);
414
483
  }
415
- for (const reminder of includeSources.has("reminders") ? item.reminders ?? [] : []) {
416
- events.push({
417
- at: reminder.at,
418
- date: toUtcDayKey(reminder.at),
419
- kind: "reminder",
420
- reminder_text: reminder.text,
421
- event_title: null,
422
- event_end: null,
423
- event_location: null,
424
- event_all_day: null,
425
- event_timezone: null,
426
- event_recurring: null,
427
- event_recurrence_rule: null,
428
- item_id: item.id,
429
- item_title: item.title,
430
- item_type: item.type,
431
- item_status: item.status,
432
- item_priority: item.priority,
433
- item_assignee: item.assignee ?? null,
434
- item_deadline: item.deadline ?? null,
435
- item_tags: item.tags
436
- });
484
+ if (includeSources.has("reminders")) {
485
+ events.push(...buildReminderRows(item));
437
486
  }
438
487
  for (const event of includeSources.has("events") ? item.events ?? [] : []) {
439
- const recurrenceRuleSummary = formatRecurrenceRuleForSummary(event.recurrence);
440
- const recurringDurationMs = (() => {
441
- if (!event.end_at) {
442
- return null;
443
- }
444
- const duration = Date.parse(event.end_at) - Date.parse(event.start_at);
445
- return Number.isFinite(duration) && duration > 0 ? duration : null;
446
- })();
447
- const occurrences = event.recurrence ? expandRecurringOccurrences(event.start_at, event.recurrence, recurringWindow, occurrenceLimit) : [event.start_at];
448
- for (const occurrenceAt of occurrences) {
449
- const occurrenceEnd = event.recurrence && recurringDurationMs !== null ? new Date(new Date(occurrenceAt).getTime() + recurringDurationMs).toISOString() : event.end_at ?? null;
450
- events.push({
451
- at: occurrenceAt,
452
- // All-day events are timezone-agnostic calendar dates: bucket by the
453
- // literal start date. Timed events bucket by their local day in the
454
- // event's timezone (defaults to UTC when unset).
455
- date: event.all_day === true ? occurrenceAt.slice(0, 10) : toLocalDayKey(occurrenceAt, event.timezone),
456
- kind: "event",
457
- reminder_text: event.description ?? null,
458
- event_title: event.title ?? item.title,
459
- event_end: occurrenceEnd,
460
- event_location: event.location ?? null,
461
- event_all_day: event.all_day ?? null,
462
- event_timezone: event.timezone ?? null,
463
- event_recurring: event.recurrence ? true : false,
464
- event_recurrence_rule: recurrenceRuleSummary,
465
- item_id: item.id,
466
- item_title: item.title,
467
- item_type: item.type,
468
- item_status: item.status,
469
- item_priority: item.priority,
470
- item_assignee: item.assignee ?? null,
471
- item_deadline: item.deadline ?? null,
472
- item_tags: item.tags
473
- });
474
- }
488
+ events.push(...buildScheduledEventRows(item, event, recurringWindow, occurrenceLimit));
475
489
  }
476
490
  }
477
491
  return sortEvents(events);
@@ -645,11 +659,7 @@ function summarize(events) {
645
659
  recurring_events: recurringEvents
646
660
  };
647
661
  }
648
- async function runCalendar(options, global) {
649
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
650
- if (!await pathExists(getSettingsPath(pmRoot))) {
651
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
652
- }
662
+ function resolveCalendarExecutionInputs(options) {
653
663
  const nowValue = nowIso();
654
664
  const view = parseView(options.view);
655
665
  const rangeBounds = buildRange(view, options, nowValue);
@@ -662,59 +672,85 @@ async function runCalendar(options, global) {
662
672
  throw new PmCliError("Calendar occurrence limit must be >= 1", EXIT_CODE.USAGE);
663
673
  }
664
674
  const eventsOnly = includeSources.has("events") && !includeSources.has("deadlines") && !includeSources.has("reminders");
665
- const hasExplicitBounds = options.to !== void 0 || explicitLookahead !== void 0 || occurrenceLimit !== void 0;
675
+ const hasExplicitBounds = options.to !== void 0 || explicitLookahead !== void 0 || recurrenceLookbackDays !== void 0 || occurrenceLimit !== void 0;
666
676
  const eventsOnlyCapApplied = eventsOnly && !hasExplicitBounds;
667
- const recurrenceLookaheadDays = eventsOnlyCapApplied ? DEFAULT_EVENTS_ONLY_LOOKAHEAD_DAYS : explicitLookahead;
668
- const recurrenceLookbackWindowDays = eventsOnlyCapApplied && recurrenceLookbackDays === void 0 ? 0 : recurrenceLookbackDays;
677
+ return {
678
+ nowValue,
679
+ view,
680
+ rangeBounds,
681
+ limit,
682
+ includeSources,
683
+ occurrenceLimit,
684
+ recurrenceLookaheadDays: eventsOnlyCapApplied ? DEFAULT_EVENTS_ONLY_LOOKAHEAD_DAYS : explicitLookahead,
685
+ recurrenceLookbackWindowDays: eventsOnlyCapApplied && recurrenceLookbackDays === void 0 ? 0 : recurrenceLookbackDays,
686
+ eventsOnlyCapApplied
687
+ };
688
+ }
689
+ function appendCalendarCapWarning(warnings, capApplied) {
690
+ if (!capApplied) {
691
+ return;
692
+ }
693
+ 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`);
694
+ }
695
+ function buildCalendarFiltersResult(options, runtimeFieldFilters) {
696
+ return {
697
+ type: options.type ?? null,
698
+ tag: options.tag ?? null,
699
+ priority: options.priority ?? null,
700
+ status: options.status ?? null,
701
+ assignee: options.assignee ?? null,
702
+ assignee_filter: options.assigneeFilter ?? null,
703
+ sprint: options.sprint ?? null,
704
+ release: options.release ?? null,
705
+ runtime_filters: runtimeFieldFilters,
706
+ limit: options.limit ?? null,
707
+ include: options.include ?? null,
708
+ full_period: options.fullPeriod === true ? "true" : null,
709
+ recurrence_lookahead_days: options.recurrenceLookaheadDays ?? null,
710
+ recurrence_lookback_days: options.recurrenceLookbackDays ?? null,
711
+ occurrence_limit: options.occurrenceLimit ?? null
712
+ };
713
+ }
714
+ function buildCalendarRangeResult(options, rangeBounds) {
715
+ return {
716
+ start: rangeBounds.start ?? null,
717
+ end: rangeBounds.end ?? null,
718
+ period_start: rangeBounds.periodStart ?? null,
719
+ period_end: rangeBounds.periodEnd ?? null,
720
+ full_period: rangeBounds.fullPeriod,
721
+ past: options.past === true,
722
+ from: options.from ?? null,
723
+ to: options.to ?? null
724
+ };
725
+ }
726
+ async function runCalendar(options, global) {
727
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
728
+ if (!await pathExists(getSettingsPath(pmRoot))) {
729
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
730
+ }
731
+ const inputs = resolveCalendarExecutionInputs(options);
669
732
  const settings = await readSettings(pmRoot);
670
733
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
671
734
  const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
672
735
  const runtimeFieldFilters = collectRuntimeFilterValues(options, runtimeFieldRegistry, "calendar");
673
736
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
674
737
  const listWarnings = [];
675
- if (eventsOnlyCapApplied) {
676
- 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`);
677
- }
738
+ appendCalendarCapWarning(listWarnings, inputs.eventsOnlyCapApplied);
678
739
  const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, listWarnings, settings.schema);
679
740
  const filteredItems = filterItems(items, options, typeRegistry, statusRegistry, runtimeFieldFilters);
680
- const recurringWindow = buildRecurringEventWindow(rangeBounds.start, rangeBounds.end, nowValue, recurrenceLookbackWindowDays, recurrenceLookaheadDays);
681
- const seededEvents = buildEventSeed(filteredItems, recurringWindow, includeSources, occurrenceLimit);
682
- const rangedEvents = seededEvents.filter((event) => includeEventInWindow(event, rangeBounds.start, rangeBounds.end));
683
- const limitedEvents = limit === void 0 ? rangedEvents : rangedEvents.slice(0, limit);
741
+ const recurringWindow = buildRecurringEventWindow(inputs.rangeBounds.start, inputs.rangeBounds.end, inputs.nowValue, inputs.recurrenceLookbackWindowDays, inputs.recurrenceLookaheadDays);
742
+ const seededEvents = buildEventSeed(filteredItems, recurringWindow, inputs.includeSources, inputs.occurrenceLimit);
743
+ const rangedEvents = seededEvents.filter((event) => includeEventInWindow(event, inputs.rangeBounds.start, inputs.rangeBounds.end));
744
+ const limitedEvents = inputs.limit === void 0 ? rangedEvents : rangedEvents.slice(0, inputs.limit);
684
745
  const days = bucketEventsByDay(limitedEvents);
685
746
  const warnings = [...new Set(listWarnings)].sort((left, right) => left.localeCompare(right));
686
747
  return {
687
- view,
748
+ view: inputs.view,
688
749
  output_default: "markdown",
689
- now: nowValue,
690
- anchor: rangeBounds.anchor,
691
- range: {
692
- start: rangeBounds.start ?? null,
693
- end: rangeBounds.end ?? null,
694
- period_start: rangeBounds.periodStart ?? null,
695
- period_end: rangeBounds.periodEnd ?? null,
696
- full_period: rangeBounds.fullPeriod,
697
- past: options.past === true,
698
- from: options.from ?? null,
699
- to: options.to ?? null
700
- },
701
- filters: {
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
- },
750
+ now: inputs.nowValue,
751
+ anchor: inputs.rangeBounds.anchor,
752
+ range: buildCalendarRangeResult(options, inputs.rangeBounds),
753
+ filters: buildCalendarFiltersResult(options, runtimeFieldFilters),
718
754
  summary: summarize(limitedEvents),
719
755
  events: limitedEvents,
720
756
  days,
@@ -1378,53 +1414,28 @@ function formatAgendaLine(event) {
1378
1414
  }
1379
1415
  return base;
1380
1416
  }
1381
- function renderContextMarkdown(result) {
1382
- const lines = [];
1383
- const focusFields = result.focus_fields;
1384
- const renderFocus = (item) => focusFields ? formatProjectedFocusLine(item, focusFields) : formatFocusLine(item);
1385
- lines.push("# pm context");
1386
- lines.push("");
1387
- lines.push(`- now: ${result.now}`);
1388
- lines.push(`- depth: ${result.depth}`);
1389
- if (result.filters.parent) {
1390
- lines.push(`- scope: subtree of ${result.filters.parent}`);
1391
- }
1392
- lines.push(`- active_items: ${result.summary.active_items} (in_progress: ${result.summary.in_progress}, open: ${result.summary.open})`);
1393
- if (result.summary.total_items !== void 0) {
1394
- lines.push(`- total_items: ${result.summary.total_items} (closed: ${result.summary.closed ?? 0}, canceled: ${result.summary.canceled ?? 0})`);
1395
- }
1396
- lines.push(`- agenda_events: ${result.summary.agenda_events}`);
1397
- lines.push(`- blocked_fallback_used: ${result.summary.blocked_fallback_used}`);
1398
- const renderedSections = result.sections_included.filter((section) => section !== "blockers" || (result.blockers?.length ?? 0) > 0);
1399
- if (renderedSections.length > 0) {
1400
- lines.push(`- sections: ${renderedSections.join(", ")}`);
1401
- }
1402
- lines.push("");
1403
- lines.push("## High-level focus");
1404
- if (result.high_level.length === 0) {
1405
- lines.push("No high-level active items.");
1417
+ function pushContextFocusSection(lines, title, rows, emptyText, renderFocus) {
1418
+ lines.push(`## ${title}`);
1419
+ if (rows.length === 0) {
1420
+ lines.push(emptyText);
1406
1421
  } else {
1407
- for (const item of result.high_level) {
1422
+ for (const item of rows) {
1408
1423
  lines.push(`- ${renderFocus(item)}`);
1409
1424
  }
1410
1425
  }
1411
1426
  lines.push("");
1412
- lines.push("## Low-level focus");
1413
- if (result.low_level.length === 0) {
1414
- lines.push("No low-level active items.");
1415
- } else {
1416
- for (const item of result.low_level) {
1417
- lines.push(`- ${renderFocus(item)}`);
1418
- }
1427
+ }
1428
+ function pushBlockedFallbackSection(lines, result, renderFocus) {
1429
+ if (result.blocked_fallback.length === 0) {
1430
+ return;
1419
1431
  }
1420
- lines.push("");
1421
- if (result.blocked_fallback.length > 0) {
1422
- lines.push("## Blocked fallback");
1423
- for (const item of result.blocked_fallback) {
1424
- lines.push(`- ${renderFocus(item)}`);
1425
- }
1426
- lines.push("");
1432
+ lines.push("## Blocked fallback");
1433
+ for (const item of result.blocked_fallback) {
1434
+ lines.push(`- ${renderFocus(item)}`);
1427
1435
  }
1436
+ lines.push("");
1437
+ }
1438
+ function pushAgendaSection(lines, result) {
1428
1439
  lines.push("## Agenda");
1429
1440
  lines.push(`- events: ${result.agenda.summary.events} (deadlines: ${result.agenda.summary.deadlines}, reminders: ${result.agenda.summary.reminders}, scheduled: ${result.agenda.summary.scheduled})`);
1430
1441
  if (result.agenda.events.length === 0) {
@@ -1435,205 +1446,373 @@ function renderContextMarkdown(result) {
1435
1446
  }
1436
1447
  }
1437
1448
  lines.push("");
1438
- if (result.hierarchy && result.hierarchy.length > 0) {
1439
- lines.push("## Hierarchy");
1440
- for (const node of result.hierarchy) {
1441
- const pct = node.children_total > 0 ? Math.round(node.children_closed / node.children_total * 100) : 0;
1442
- lines.push(`- ${node.id} ${node.type} ${node.status} "${node.title}" [${node.children_closed}/${node.children_total} done ${pct}%]`);
1443
- for (const child of node.children) {
1444
- const cpct = child.children_total > 0 ? Math.round(child.children_closed / child.children_total * 100) : 0;
1445
- lines.push(` - ${child.id} ${child.type} ${child.status} "${child.title}" [${child.children_closed}/${child.children_total} done ${cpct}%]`);
1446
- }
1449
+ }
1450
+ function pushHierarchySection(lines, result) {
1451
+ if (!result.hierarchy || result.hierarchy.length === 0) {
1452
+ return;
1453
+ }
1454
+ lines.push("## Hierarchy");
1455
+ for (const node of result.hierarchy) {
1456
+ const pct = node.children_total > 0 ? Math.round(node.children_closed / node.children_total * 100) : 0;
1457
+ lines.push(`- ${node.id} ${node.type} ${node.status} "${node.title}" [${node.children_closed}/${node.children_total} done ${pct}%]`);
1458
+ for (const child of node.children) {
1459
+ const cpct = child.children_total > 0 ? Math.round(child.children_closed / child.children_total * 100) : 0;
1460
+ lines.push(` - ${child.id} ${child.type} ${child.status} "${child.title}" [${child.children_closed}/${child.children_total} done ${cpct}%]`);
1447
1461
  }
1448
- lines.push("");
1449
1462
  }
1450
- if (result.progress && result.progress.length > 0) {
1451
- lines.push("## Progress");
1452
- for (const entry of result.progress) {
1453
- lines.push(`- ${entry.id} "${entry.title}" ${entry.completion_pct}% (${entry.closed}/${entry.total} closed, ${entry.in_progress} wip, ${entry.open} open, ${entry.blocked} blocked)`);
1454
- }
1455
- lines.push("");
1463
+ lines.push("");
1464
+ }
1465
+ function pushProgressSection(lines, result) {
1466
+ if (!result.progress || result.progress.length === 0) {
1467
+ return;
1456
1468
  }
1457
- if (result.recently_created && result.recently_created.length > 0) {
1458
- lines.push("## Recently created");
1459
- for (const item of result.recently_created) {
1460
- lines.push(focusFields ? `- ${renderFocus(item)}` : `- ${dateTokenForTimestamp(item.created_at)} ${formatFocusLine(item)}`);
1461
- }
1462
- lines.push("");
1469
+ lines.push("## Progress");
1470
+ for (const entry of result.progress) {
1471
+ lines.push(`- ${entry.id} "${entry.title}" ${entry.completion_pct}% (${entry.closed}/${entry.total} closed, ${entry.in_progress} wip, ${entry.open} open, ${entry.blocked} blocked)`);
1463
1472
  }
1464
- if (result.unparented && result.unparented.length > 0) {
1465
- lines.push("## Unparented");
1466
- for (const item of result.unparented) {
1467
- lines.push(`- ${renderFocus(item)}`);
1468
- }
1469
- lines.push("");
1473
+ lines.push("");
1474
+ }
1475
+ function pushRecentlyCreatedSection(lines, result, focusFields, renderFocus) {
1476
+ if (!result.recently_created || result.recently_created.length === 0) {
1477
+ return;
1470
1478
  }
1471
- if (result.activity && result.activity.length > 0) {
1472
- lines.push("## Recent activity");
1473
- for (const entry of result.activity) {
1474
- const msg = entry.msg ? ` ${entry.msg}` : "";
1475
- lines.push(`- ${entry.ts.slice(0, 16)}Z ${entry.id} ${entry.op} by:${entry.author}${msg}`);
1476
- }
1477
- lines.push("");
1478
- }
1479
- if (result.blockers && result.blockers.length > 0) {
1480
- lines.push("## Blockers");
1481
- for (const entry of result.blockers) {
1482
- const by = entry.blocked_by ? `blocked_by:${entry.blocked_by}(${entry.blocked_by_status ?? "?"})` : "blocked_by:-";
1483
- const reason = entry.blocked_reason ? ` reason:"${entry.blocked_reason}"` : "";
1484
- const note = entry.unblock_note ? ` unblock:"${entry.unblock_note}"` : "";
1485
- lines.push(`- ${entry.id} "${entry.title}" ${by}${reason}${note}`);
1486
- }
1487
- lines.push("");
1479
+ lines.push("## Recently created");
1480
+ for (const item of result.recently_created) {
1481
+ lines.push(focusFields ? `- ${renderFocus(item)}` : `- ${dateTokenForTimestamp(item.created_at)} ${formatFocusLine(item)}`);
1488
1482
  }
1489
- if (result.files && result.files.length > 0) {
1490
- lines.push("## Hot files");
1491
- for (const file of result.files) {
1492
- lines.push(`- ${file.path} refs:${file.references} items:[${file.items.join(",")}]`);
1493
- }
1494
- lines.push("");
1483
+ lines.push("");
1484
+ }
1485
+ function pushUnparentedSection(lines, result, renderFocus) {
1486
+ if (!result.unparented || result.unparented.length === 0) {
1487
+ return;
1495
1488
  }
1496
- if (result.workload && result.workload.length > 0) {
1497
- lines.push("## Workload");
1498
- for (const entry of result.workload) {
1499
- const who = entry.assignee ?? "(unassigned)";
1500
- lines.push(`- ${who} active:${entry.active} wip:${entry.in_progress} items:[${entry.items.join(",")}]`);
1501
- }
1502
- lines.push("");
1489
+ lines.push("## Unparented");
1490
+ for (const item of result.unparented) {
1491
+ lines.push(`- ${renderFocus(item)}`);
1503
1492
  }
1504
- if (result.staleness && result.staleness.length > 0) {
1505
- lines.push("## Stale items");
1506
- for (const entry of result.staleness) {
1507
- lines.push(`- ${entry.id} ${entry.status} stale:${entry.stale_days}d last:${entry.updated_at.slice(0, 10)} "${entry.title}"`);
1508
- }
1509
- lines.push("");
1510
- }
1511
- if (result.tests) {
1512
- lines.push("## Test health");
1513
- lines.push(`- items_with_tests: ${result.tests.items_with_tests}`);
1514
- lines.push(`- items_with_recent_runs: ${result.tests.items_with_recent_runs}`);
1515
- lines.push(`- passed: ${result.tests.recent_runs.passed}, failed: ${result.tests.recent_runs.failed}, skipped: ${result.tests.recent_runs.skipped}`);
1516
- if (result.tests.items_failing.length > 0) {
1517
- lines.push(`- items_failing: [${result.tests.items_failing.join(",")}]`);
1518
- }
1519
- lines.push("");
1493
+ lines.push("");
1494
+ }
1495
+ function pushActivitySection(lines, result) {
1496
+ if (!result.activity || result.activity.length === 0) {
1497
+ return;
1520
1498
  }
1499
+ lines.push("## Recent activity");
1500
+ for (const entry of result.activity) {
1501
+ const msg = entry.msg ? ` ${entry.msg}` : "";
1502
+ lines.push(`- ${entry.ts.slice(0, 16)}Z ${entry.id} ${entry.op} by:${entry.author}${msg}`);
1503
+ }
1504
+ lines.push("");
1505
+ }
1506
+ function pushBlockersSection(lines, result) {
1507
+ if (!result.blockers || result.blockers.length === 0) {
1508
+ return;
1509
+ }
1510
+ lines.push("## Blockers");
1511
+ for (const entry of result.blockers) {
1512
+ const by = entry.blocked_by ? `blocked_by:${entry.blocked_by}(${entry.blocked_by_status ?? "?"})` : "blocked_by:-";
1513
+ const reason = entry.blocked_reason ? ` reason:"${entry.blocked_reason}"` : "";
1514
+ const note = entry.unblock_note ? ` unblock:"${entry.unblock_note}"` : "";
1515
+ lines.push(`- ${entry.id} "${entry.title}" ${by}${reason}${note}`);
1516
+ }
1517
+ lines.push("");
1518
+ }
1519
+ function pushFilesSection(lines, result) {
1520
+ if (!result.files || result.files.length === 0) {
1521
+ return;
1522
+ }
1523
+ lines.push("## Hot files");
1524
+ for (const file of result.files) {
1525
+ lines.push(`- ${file.path} refs:${file.references} items:[${file.items.join(",")}]`);
1526
+ }
1527
+ lines.push("");
1528
+ }
1529
+ function pushWorkloadSection(lines, result) {
1530
+ if (!result.workload || result.workload.length === 0) {
1531
+ return;
1532
+ }
1533
+ lines.push("## Workload");
1534
+ for (const entry of result.workload) {
1535
+ const who = entry.assignee ?? "(unassigned)";
1536
+ lines.push(`- ${who} active:${entry.active} wip:${entry.in_progress} items:[${entry.items.join(",")}]`);
1537
+ }
1538
+ lines.push("");
1539
+ }
1540
+ function pushStalenessSection(lines, result) {
1541
+ if (!result.staleness || result.staleness.length === 0) {
1542
+ return;
1543
+ }
1544
+ lines.push("## Stale items");
1545
+ for (const entry of result.staleness) {
1546
+ lines.push(`- ${entry.id} ${entry.status} stale:${entry.stale_days}d last:${entry.updated_at.slice(0, 10)} "${entry.title}"`);
1547
+ }
1548
+ lines.push("");
1549
+ }
1550
+ function pushTestHealthSection(lines, result) {
1551
+ if (!result.tests) {
1552
+ return;
1553
+ }
1554
+ lines.push("## Test health");
1555
+ lines.push(`- items_with_tests: ${result.tests.items_with_tests}`);
1556
+ lines.push(`- items_with_recent_runs: ${result.tests.items_with_recent_runs}`);
1557
+ lines.push(`- passed: ${result.tests.recent_runs.passed}, failed: ${result.tests.recent_runs.failed}, skipped: ${result.tests.recent_runs.skipped}`);
1558
+ if (result.tests.items_failing.length > 0) {
1559
+ lines.push(`- items_failing: [${result.tests.items_failing.join(",")}]`);
1560
+ }
1561
+ lines.push("");
1562
+ }
1563
+ function pushEmptyContextSuggestions(lines, result) {
1521
1564
  const isEmpty = result.summary.active_items === 0 && result.summary.blocked === 0 && result.agenda.summary.events === 0;
1522
- if (isEmpty) {
1523
- lines.push("## Suggestions");
1524
- lines.push("No active work items or upcoming events. Consider:");
1525
- lines.push('- `pm create --type Task --title "..."` to add a new work item');
1526
- lines.push("- `pm list --status closed --limit 5` to review recent completions");
1527
- lines.push("- `pm search <keywords>` to find related past work");
1528
- lines.push("- `pm aggregate` for a full project status overview");
1565
+ if (!isEmpty) {
1566
+ return;
1529
1567
  }
1568
+ lines.push("## Suggestions");
1569
+ lines.push("No active work items or upcoming events. Consider:");
1570
+ lines.push('- `pm create --type Task --title "..."` to add a new work item');
1571
+ lines.push("- `pm list --status closed --limit 5` to review recent completions");
1572
+ lines.push("- `pm search <keywords>` to find related past work");
1573
+ lines.push("- `pm aggregate` for a full project status overview");
1574
+ }
1575
+ function renderContextMarkdown(result) {
1576
+ const lines = [];
1577
+ const focusFields = result.focus_fields;
1578
+ const renderFocus = (item) => focusFields ? formatProjectedFocusLine(item, focusFields) : formatFocusLine(item);
1579
+ lines.push("# pm context");
1580
+ lines.push("");
1581
+ lines.push(`- now: ${result.now}`);
1582
+ lines.push(`- depth: ${result.depth}`);
1583
+ if (result.filters.parent) {
1584
+ lines.push(`- scope: subtree of ${result.filters.parent}`);
1585
+ }
1586
+ lines.push(`- active_items: ${result.summary.active_items} (in_progress: ${result.summary.in_progress}, open: ${result.summary.open})`);
1587
+ if (result.summary.total_items !== void 0) {
1588
+ lines.push(`- total_items: ${result.summary.total_items} (closed: ${result.summary.closed ?? 0}, canceled: ${result.summary.canceled ?? 0})`);
1589
+ }
1590
+ lines.push(`- agenda_events: ${result.summary.agenda_events}`);
1591
+ lines.push(`- blocked_fallback_used: ${result.summary.blocked_fallback_used}`);
1592
+ const renderedSections = result.sections_included.filter((section) => section !== "blockers" || (result.blockers?.length ?? 0) > 0);
1593
+ if (renderedSections.length > 0) {
1594
+ lines.push(`- sections: ${renderedSections.join(", ")}`);
1595
+ }
1596
+ lines.push("");
1597
+ pushContextFocusSection(lines, "High-level focus", result.high_level, "No high-level active items.", renderFocus);
1598
+ pushContextFocusSection(lines, "Low-level focus", result.low_level, "No low-level active items.", renderFocus);
1599
+ pushBlockedFallbackSection(lines, result, renderFocus);
1600
+ pushAgendaSection(lines, result);
1601
+ pushHierarchySection(lines, result);
1602
+ pushProgressSection(lines, result);
1603
+ pushRecentlyCreatedSection(lines, result, focusFields, renderFocus);
1604
+ pushUnparentedSection(lines, result, renderFocus);
1605
+ pushActivitySection(lines, result);
1606
+ pushBlockersSection(lines, result);
1607
+ pushFilesSection(lines, result);
1608
+ pushWorkloadSection(lines, result);
1609
+ pushStalenessSection(lines, result);
1610
+ pushTestHealthSection(lines, result);
1611
+ pushEmptyContextSuggestions(lines, result);
1530
1612
  return lines.join("\n");
1531
1613
  }
1532
- async function runContext(options, global) {
1614
+ async function resolveContextRuntime(options, global) {
1533
1615
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
1534
1616
  const settings = await readSettings(pmRoot);
1535
1617
  const contextSettings = settings.context ?? SETTINGS_DEFAULTS.context;
1536
1618
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
1537
1619
  const depth = parseContextDepth(options.depth, contextSettings);
1538
- const limit = parseContextLimit(options.limit, depth);
1539
- const sectionsIncluded = parseContextSections(options.section, depth, contextSettings);
1540
- const activityLimit = parseActivityLimit(options.activityLimit, contextSettings);
1541
- const staleThresholdDays = parseStaleThresholdDays(options.staleThreshold, contextSettings);
1542
- const parentScope = parseContextParent(options.parent);
1543
- const focusFields = parseContextFocusFields(options.fields);
1544
- const needsAllItems = sectionsIncluded.some((s) => ["hierarchy", "progress", "blockers", "staleness", "recently_created", "unparented"].includes(s));
1545
- const baseListOptions = stripListProjectionFlags(options);
1546
- const unpaginatedListOptions = (extra) => ({
1620
+ return {
1621
+ settings,
1622
+ contextSettings,
1623
+ statusRegistry,
1624
+ depth,
1625
+ limit: parseContextLimit(options.limit, depth),
1626
+ sectionsIncluded: parseContextSections(options.section, depth, contextSettings),
1627
+ activityLimit: parseActivityLimit(options.activityLimit, contextSettings),
1628
+ staleThresholdDays: parseStaleThresholdDays(options.staleThreshold, contextSettings),
1629
+ parentScope: parseContextParent(options.parent),
1630
+ focusFields: parseContextFocusFields(options.fields),
1631
+ baseListOptions: stripListProjectionFlags(options)
1632
+ };
1633
+ }
1634
+ function contextNeedsAllItems(sectionsIncluded) {
1635
+ return sectionsIncluded.some((section) => ["hierarchy", "progress", "blockers", "staleness", "recently_created", "unparented"].includes(section));
1636
+ }
1637
+ function buildUnpaginatedContextListOptions(baseListOptions, extra) {
1638
+ return {
1547
1639
  ...baseListOptions,
1548
1640
  ...extra,
1549
1641
  noTruncate: true,
1550
1642
  limit: void 0,
1551
1643
  offset: void 0
1552
- });
1553
- const listOptions = parentScope === void 0 ? { ...baseListOptions, excludeTerminal: true } : unpaginatedListOptions({ excludeTerminal: true });
1644
+ };
1645
+ }
1646
+ async function loadContextCorpus(options, global, runtime) {
1647
+ const needsAllItems = contextNeedsAllItems(runtime.sectionsIncluded);
1648
+ const listOptions = runtime.parentScope === void 0 ? { ...runtime.baseListOptions, excludeTerminal: true } : buildUnpaginatedContextListOptions(runtime.baseListOptions, { excludeTerminal: true });
1554
1649
  const listed = await runList(void 0, listOptions, global);
1555
1650
  let listedFrontMatter = listed.items;
1556
1651
  let allItems = listedFrontMatter;
1557
- if (needsAllItems || parentScope !== void 0) {
1558
- const allListed = await runList(void 0, unpaginatedListOptions({ excludeTerminal: false }), global);
1652
+ if (needsAllItems || runtime.parentScope !== void 0) {
1653
+ const allListed = await runList(void 0, buildUnpaginatedContextListOptions(runtime.baseListOptions, { excludeTerminal: false }), global);
1559
1654
  allItems = allListed.items;
1560
1655
  }
1561
1656
  const fullCorpus = allItems;
1562
- let subtreeIds;
1563
- if (parentScope !== void 0) {
1564
- const subtree = collectSubtreeIds(fullCorpus, parentScope);
1565
- if (!subtree.found) {
1566
- throw new PmCliError(`Context --parent item not found: ${parentScope}`, EXIT_CODE.NOT_FOUND);
1567
- }
1568
- subtreeIds = subtree.ids;
1569
- listedFrontMatter = listedFrontMatter.filter((item) => subtreeIds?.has(item.id.trim().toLowerCase()));
1570
- allItems = allItems.filter((item) => subtreeIds?.has(item.id.trim().toLowerCase()));
1657
+ const subtreeIds = resolveContextSubtreeIds(runtime.parentScope, fullCorpus);
1658
+ if (subtreeIds) {
1659
+ listedFrontMatter = listedFrontMatter.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));
1660
+ allItems = allItems.filter((item) => subtreeIds.has(item.id.trim().toLowerCase()));
1661
+ }
1662
+ return { listed, listedFrontMatter, allItems, fullCorpus, subtreeIds };
1663
+ }
1664
+ function resolveContextSubtreeIds(parentScope, fullCorpus) {
1665
+ if (parentScope === void 0) {
1666
+ return void 0;
1571
1667
  }
1668
+ const subtree = collectSubtreeIds(fullCorpus, parentScope);
1669
+ if (!subtree.found) {
1670
+ throw new PmCliError(`Context --parent item not found: ${parentScope}`, EXIT_CODE.NOT_FOUND);
1671
+ }
1672
+ return subtree.ids;
1673
+ }
1674
+ function resolveContextFocusGroups(listedFrontMatter, allItems, statusRegistry, sectionsIncluded, limit) {
1572
1675
  const ranked = [...listedFrontMatter].sort((left, right) => compareCriticalItems(left, right, statusRegistry));
1573
- const activeStatuses = statusRegistry.active_statuses.size > 0 ? statusRegistry.active_statuses : /* @__PURE__ */ new Set([statusRegistry.open_status]);
1574
- const blockedStatuses = statusRegistry.blocked_statuses;
1676
+ const activeStatuses = statusRegistry.active_statuses;
1575
1677
  const activeItems = ranked.filter((item) => activeStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1576
- const blockedItems = ranked.filter((item) => blockedStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1678
+ const blockedItems = ranked.filter((item) => statusRegistry.blocked_statuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1577
1679
  const childrenByParent = buildChildrenByParent(allItems);
1578
- const focusChildrenByParent = needsAllItems ? childrenByParent : void 0;
1680
+ const focusChildrenByParent = contextNeedsAllItems(sectionsIncluded) ? childrenByParent : void 0;
1579
1681
  const highLevel = activeItems.filter((item) => HIGH_LEVEL_TYPES.has(item.type)).slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent));
1580
1682
  const lowLevel = activeItems.filter((item) => !HIGH_LEVEL_TYPES.has(item.type)).slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent));
1581
1683
  const blockedFallbackUsed = activeItems.length === 0;
1582
- const blockedFallback = blockedFallbackUsed ? blockedItems.slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent)) : [];
1684
+ return {
1685
+ activeItems,
1686
+ blockedItems,
1687
+ highLevel,
1688
+ lowLevel,
1689
+ blockedFallback: blockedFallbackUsed ? blockedItems.slice(0, limit).map((item) => toContextFocusItem(item, statusRegistry, focusChildrenByParent)) : [],
1690
+ blockedFallbackUsed
1691
+ };
1692
+ }
1693
+ async function buildContextAgenda(options, global, runtime, subtreeIds) {
1583
1694
  const calendarOptions = {
1584
- ...baseListOptions,
1695
+ ...runtime.baseListOptions,
1585
1696
  view: "agenda",
1586
1697
  include: "all",
1587
- // When scoping to a subtree, pull the full agenda so the subtree filter sees
1588
- // every candidate event before the final per-section slice.
1589
- limit: parentScope === void 0 ? String(limit) : void 0
1698
+ limit: runtime.parentScope === void 0 ? String(runtime.limit) : void 0
1590
1699
  };
1591
1700
  const agenda = await runCalendar(calendarOptions, global);
1592
1701
  const scopedAgenda = subtreeIds === void 0 ? agenda.events : agenda.events.filter((event) => subtreeIds.has(event.item_id.trim().toLowerCase()));
1593
- const agendaEvents = filterTerminalCalendarEvents(scopedAgenda, statusRegistry).slice(0, limit);
1594
- const agendaSummary = summarizeAgenda(agendaEvents);
1595
- const warnings = mergeSortedWarnings(listed.warnings, agenda.warnings);
1596
- const inProgressStatus = normalizeStatusInput("in_progress", statusRegistry);
1597
- const openStatus = normalizeStatusInput("open", statusRegistry);
1598
- const inProgressCount = activeItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === inProgressStatus).length;
1599
- const openCount = activeItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === openStatus).length;
1600
- const now = agenda.now;
1601
- const itemMap = /* @__PURE__ */ new Map();
1602
- for (const item of fullCorpus) {
1603
- itemMap.set(item.id, item);
1702
+ const agendaEvents = filterTerminalCalendarEvents(scopedAgenda, runtime.statusRegistry).slice(0, runtime.limit);
1703
+ return { agenda, agendaEvents, agendaSummary: summarizeAgenda(agendaEvents) };
1704
+ }
1705
+ function countContextStatus(items, status, statusRegistry) {
1706
+ const targetStatus = String(status);
1707
+ return items.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === targetStatus).length;
1708
+ }
1709
+ async function buildOptionalContextSections(params) {
1710
+ const { runtime, allItems, fullCorpus, focusGroups, now, global } = params;
1711
+ const childrenByParent = buildChildrenByParent(allItems);
1712
+ const itemMap = new Map(fullCorpus.map((item) => [item.id, item]));
1713
+ const allNonTerminal = allItems.filter((item) => !isTerminalStatus(item.status, runtime.statusRegistry));
1714
+ const has = (section) => runtime.sectionsIncluded.includes(section);
1715
+ return {
1716
+ hierarchy: has("hierarchy") ? buildHierarchy(allItems, focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : void 0,
1717
+ activity: has("activity") ? await buildActivity(runtime.activityLimit, global) : void 0,
1718
+ progress: has("progress") ? buildProgress(allItems, focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : void 0,
1719
+ blockersSection: has("blockers") ? buildBlockers(focusGroups.blockedItems, itemMap, runtime.limit) : void 0,
1720
+ recentlyCreated: has("recently_created") ? buildRecentlyCreated(allNonTerminal, runtime.statusRegistry, childrenByParent, runtime.limit) : void 0,
1721
+ unparented: has("unparented") ? buildUnparented(allNonTerminal, runtime.statusRegistry, childrenByParent, runtime.limit) : void 0,
1722
+ filesSection: has("files") ? buildHotFiles(focusGroups.activeItems, runtime.limit) : void 0,
1723
+ workload: has("workload") ? buildWorkload(focusGroups.activeItems, runtime.statusRegistry, runtime.limit) : void 0,
1724
+ staleness: has("staleness") ? buildStaleness(allNonTerminal, runtime.staleThresholdDays, now, runtime.limit) : void 0,
1725
+ tests: has("tests") ? buildTestHealth(focusGroups.activeItems) : void 0
1726
+ };
1727
+ }
1728
+ function buildContextSummaryExtras(needsAllItems, allItems, statusRegistry) {
1729
+ if (!needsAllItems) {
1730
+ return {};
1604
1731
  }
1605
- const allNonTerminal = allItems.filter((item) => !isTerminalStatus(item.status, statusRegistry));
1606
- const has = (section) => sectionsIncluded.includes(section);
1607
- const hierarchy = has("hierarchy") ? buildHierarchy(allItems, activeItems, statusRegistry, limit) : void 0;
1608
- const activity = has("activity") ? await buildActivity(activityLimit, global) : void 0;
1609
- const progress = has("progress") ? buildProgress(allItems, activeItems, statusRegistry, limit) : void 0;
1610
- const blockersSection = has("blockers") ? buildBlockers(blockedItems, itemMap, limit) : void 0;
1611
- const recentlyCreated = has("recently_created") ? buildRecentlyCreated(allNonTerminal, statusRegistry, childrenByParent, limit) : void 0;
1612
- const unparented = has("unparented") ? buildUnparented(allNonTerminal, statusRegistry, childrenByParent, limit) : void 0;
1613
- const filesSection = has("files") ? buildHotFiles(activeItems, limit) : void 0;
1614
- const workload = has("workload") ? buildWorkload(activeItems, statusRegistry, limit) : void 0;
1615
- const staleness = has("staleness") ? buildStaleness(allNonTerminal, staleThresholdDays, now, limit) : void 0;
1616
- const tests = has("tests") ? buildTestHealth(activeItems) : void 0;
1617
- const summaryExtras = needsAllItems ? {
1732
+ const canceledStatus = normalizeStatusInput("canceled", statusRegistry);
1733
+ return {
1618
1734
  total_items: allItems.length,
1619
- closed: allItems.filter((i) => isClosedStatus(i.status, statusRegistry)).length,
1620
- canceled: allItems.filter((i) => {
1621
- const canceledStatus = normalizeStatusInput("canceled", statusRegistry);
1622
- return normalizeStatusForRegistry(i.status, statusRegistry) === canceledStatus;
1623
- }).length
1624
- } : {};
1735
+ closed: allItems.filter((item) => isClosedStatus(item.status, statusRegistry)).length,
1736
+ canceled: allItems.filter((item) => normalizeStatusForRegistry(item.status, statusRegistry) === canceledStatus).length
1737
+ };
1738
+ }
1739
+ function attachOptionalContextSections(result, sections) {
1740
+ if (sections.hierarchy)
1741
+ result.hierarchy = sections.hierarchy;
1742
+ if (sections.activity)
1743
+ result.activity = sections.activity;
1744
+ if (sections.progress)
1745
+ result.progress = sections.progress;
1746
+ if (sections.blockersSection)
1747
+ result.blockers = sections.blockersSection;
1748
+ if (sections.recentlyCreated)
1749
+ result.recently_created = sections.recentlyCreated;
1750
+ if (sections.unparented)
1751
+ result.unparented = sections.unparented;
1752
+ if (sections.filesSection)
1753
+ result.files = sections.filesSection;
1754
+ if (sections.workload)
1755
+ result.workload = sections.workload;
1756
+ if (sections.staleness)
1757
+ result.staleness = sections.staleness;
1758
+ if (sections.tests)
1759
+ result.tests = sections.tests;
1760
+ }
1761
+ function applyContextFocusProjection(result, focusFields) {
1762
+ if (!focusFields) {
1763
+ return;
1764
+ }
1765
+ result.focus_fields = focusFields;
1766
+ result.high_level = projectContextFocusRows(result.high_level, focusFields);
1767
+ result.low_level = projectContextFocusRows(result.low_level, focusFields);
1768
+ result.blocked_fallback = projectContextFocusRows(result.blocked_fallback, focusFields);
1769
+ if (result.recently_created) {
1770
+ result.recently_created = projectContextFocusRows(result.recently_created, focusFields);
1771
+ }
1772
+ if (result.unparented) {
1773
+ result.unparented = projectContextFocusRows(result.unparented, focusFields);
1774
+ }
1775
+ }
1776
+ function maybeAttachEmptyContextSuggestions(result, activeItems, blockedItems) {
1777
+ if (activeItems.length > 0 || blockedItems.length > 0 || result.agenda.events.length > 0) {
1778
+ return;
1779
+ }
1780
+ result.suggestions = [
1781
+ 'pm create --type Task --title "..." to add a new work item',
1782
+ "pm list --status closed --limit 5 to review recent completions",
1783
+ "pm search <keywords> to find related past work",
1784
+ "pm aggregate for a full project status overview"
1785
+ ];
1786
+ }
1787
+ async function runContext(options, global) {
1788
+ const runtime = await resolveContextRuntime(options, global);
1789
+ const corpus = await loadContextCorpus(options, global, runtime);
1790
+ const focusGroups = resolveContextFocusGroups(corpus.listedFrontMatter, corpus.allItems, runtime.statusRegistry, runtime.sectionsIncluded, runtime.limit);
1791
+ const agendaContext = await buildContextAgenda(options, global, runtime, corpus.subtreeIds);
1792
+ const warnings = mergeSortedWarnings(corpus.listed.warnings, agendaContext.agenda.warnings);
1793
+ const inProgressCount = countContextStatus(focusGroups.activeItems, normalizeStatusInput("in_progress", runtime.statusRegistry), runtime.statusRegistry);
1794
+ const openCount = countContextStatus(focusGroups.activeItems, normalizeStatusInput("open", runtime.statusRegistry), runtime.statusRegistry);
1795
+ const sections = await buildOptionalContextSections({
1796
+ runtime,
1797
+ allItems: corpus.allItems,
1798
+ fullCorpus: corpus.fullCorpus,
1799
+ focusGroups,
1800
+ now: agendaContext.agenda.now,
1801
+ global
1802
+ });
1803
+ const summaryExtras = buildContextSummaryExtras(contextNeedsAllItems(runtime.sectionsIncluded), corpus.allItems, runtime.statusRegistry);
1625
1804
  const result = {
1626
1805
  output_default: "toon",
1627
- now,
1628
- depth,
1629
- sections_included: sectionsIncluded,
1806
+ now: agendaContext.agenda.now,
1807
+ depth: runtime.depth,
1808
+ sections_included: runtime.sectionsIncluded,
1630
1809
  window: {
1631
- anchor: agenda.anchor,
1632
- start: agenda.range.start,
1633
- end: agenda.range.end,
1634
- past: agenda.range.past,
1635
- from: agenda.range.from,
1636
- to: agenda.range.to
1810
+ anchor: agendaContext.agenda.anchor,
1811
+ start: agendaContext.agenda.range.start,
1812
+ end: agendaContext.agenda.range.end,
1813
+ past: agendaContext.agenda.range.past,
1814
+ from: agendaContext.agenda.range.from,
1815
+ to: agendaContext.agenda.range.to
1637
1816
  },
1638
1817
  filters: {
1639
1818
  type: options.type ?? null,
@@ -1644,71 +1823,34 @@ async function runContext(options, global) {
1644
1823
  sprint: options.sprint ?? null,
1645
1824
  release: options.release ?? null,
1646
1825
  limit: options.limit ?? null,
1647
- parent: parentScope ?? null,
1826
+ parent: runtime.parentScope ?? null,
1648
1827
  /* c8 ignore next -- listed/calendar runtime filters are always materialized by their command handlers */
1649
- runtime_filters: listed.filters.runtime_filters ?? agenda.filters.runtime_filters ?? {}
1828
+ runtime_filters: corpus.listed.filters.runtime_filters ?? agendaContext.agenda.filters.runtime_filters ?? {}
1650
1829
  },
1651
1830
  summary: {
1652
- active_items: activeItems.length,
1831
+ active_items: focusGroups.activeItems.length,
1653
1832
  in_progress: inProgressCount,
1654
1833
  open: openCount,
1655
- blocked: blockedItems.length,
1656
- blocked_fallback_used: blockedFallbackUsed,
1657
- high_level: highLevel.length,
1658
- low_level: lowLevel.length,
1659
- agenda_events: agendaSummary.events,
1834
+ blocked: focusGroups.blockedItems.length,
1835
+ blocked_fallback_used: focusGroups.blockedFallbackUsed,
1836
+ high_level: focusGroups.highLevel.length,
1837
+ low_level: focusGroups.lowLevel.length,
1838
+ agenda_events: agendaContext.agendaSummary.events,
1660
1839
  ...summaryExtras
1661
1840
  },
1662
- high_level: highLevel,
1663
- low_level: lowLevel,
1664
- blocked_fallback: blockedFallback,
1841
+ high_level: focusGroups.highLevel,
1842
+ low_level: focusGroups.lowLevel,
1843
+ blocked_fallback: focusGroups.blockedFallback,
1665
1844
  agenda: {
1666
- summary: agendaSummary,
1667
- events: agendaEvents
1845
+ summary: agendaContext.agendaSummary,
1846
+ events: agendaContext.agendaEvents
1668
1847
  }
1669
1848
  };
1670
- if (hierarchy)
1671
- result.hierarchy = hierarchy;
1672
- if (activity)
1673
- result.activity = activity;
1674
- if (progress)
1675
- result.progress = progress;
1676
- if (blockersSection)
1677
- result.blockers = blockersSection;
1678
- if (recentlyCreated)
1679
- result.recently_created = recentlyCreated;
1680
- if (unparented)
1681
- result.unparented = unparented;
1682
- if (filesSection)
1683
- result.files = filesSection;
1684
- if (workload)
1685
- result.workload = workload;
1686
- if (staleness)
1687
- result.staleness = staleness;
1688
- if (tests)
1689
- result.tests = tests;
1690
- if (focusFields) {
1691
- result.focus_fields = focusFields;
1692
- result.high_level = projectContextFocusRows(result.high_level, focusFields);
1693
- result.low_level = projectContextFocusRows(result.low_level, focusFields);
1694
- result.blocked_fallback = projectContextFocusRows(result.blocked_fallback, focusFields);
1695
- if (result.recently_created) {
1696
- result.recently_created = projectContextFocusRows(result.recently_created, focusFields);
1697
- }
1698
- if (result.unparented) {
1699
- result.unparented = projectContextFocusRows(result.unparented, focusFields);
1700
- }
1701
- }
1849
+ attachOptionalContextSections(result, sections);
1850
+ applyContextFocusProjection(result, runtime.focusFields);
1702
1851
  if (warnings.length > 0)
1703
1852
  result.warnings = warnings;
1704
- if (activeItems.length === 0 && blockedItems.length === 0 && agendaEvents.length === 0) {
1705
- result.suggestions = [
1706
- 'pm create --type Task --title "..." to add a new work item',
1707
- "pm list --status closed --limit 5 to review recent completions",
1708
- "pm search <keywords> to find related past work",
1709
- "pm aggregate for a full project status overview"
1710
- ];
1711
- }
1853
+ maybeAttachEmptyContextSuggestions(result, focusGroups.activeItems, focusGroups.blockedItems);
1712
1854
  return result;
1713
1855
  }
1714
1856
 
@@ -1727,6 +1869,6 @@ export {
1727
1869
  renderContextMarkdown,
1728
1870
  runContext
1729
1871
  };
1730
- //# sourceMappingURL=chunk-JWXRETDF.js.map
1872
+ //# sourceMappingURL=chunk-SYE6WMV6.js.map
1731
1873
 
1732
- //# debugId=e7cb2510-fa36-55ab-b096-7ce46e2ac4b6
1874
+ //# debugId=95fd55ba-b62a-5ca4-8d6a-02955d7b5692