@unbrained/pm-cli 2026.7.21 → 2026.7.22

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 (506) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +25 -0
  3. package/dist/cli/bundle-integrity.js +3 -3
  4. package/dist/cli/bundle-integrity.js.map +1 -1
  5. package/dist/cli/commands/contracts.d.ts +5 -0
  6. package/dist/cli/commands/contracts.js +8 -6
  7. package/dist/cli/commands/contracts.js.map +1 -1
  8. package/dist/cli/commands/copy.js +36 -20
  9. package/dist/cli/commands/copy.js.map +1 -1
  10. package/dist/cli/commands/create.js +48 -24
  11. package/dist/cli/commands/create.js.map +1 -1
  12. package/dist/cli/commands/merge.d.ts +1 -1
  13. package/dist/cli/commands/merge.js +3 -3
  14. package/dist/cli/commands/merge.js.map +1 -1
  15. package/dist/cli/commands/restore.js +40 -22
  16. package/dist/cli/commands/restore.js.map +1 -1
  17. package/dist/cli/commands/update.js +12 -9
  18. package/dist/cli/commands/update.js.map +1 -1
  19. package/dist/cli/extension-command-help.js +3 -4
  20. package/dist/cli/extension-command-help.js.map +1 -1
  21. package/dist/cli/main.d.ts +3 -2
  22. package/dist/cli/main.js +6 -6
  23. package/dist/cli/main.js.map +1 -1
  24. package/dist/cli/register-list-query.js +33 -21
  25. package/dist/cli/register-list-query.js.map +1 -1
  26. package/dist/cli/register-mutation.js +63 -37
  27. package/dist/cli/register-mutation.js.map +1 -1
  28. package/dist/cli/registration-helpers.d.ts +2 -0
  29. package/dist/cli/registration-helpers.js +3 -2
  30. package/dist/cli/registration-helpers.js.map +1 -1
  31. package/dist/cli-bundle/bundle-manifest.json +349 -341
  32. package/dist/cli-bundle/chunks/{append-7OVFYR3C.js → append-CYMA7RJT.js} +5 -5
  33. package/dist/cli-bundle/chunks/append-H53CAPMP.js +11 -0
  34. package/dist/cli-bundle/chunks/{chunk-PFNHX655.js → chunk-2P7OK4WG.js} +3 -3
  35. package/dist/cli-bundle/chunks/{chunk-EJDGV4GR.js → chunk-3EBGHNNQ.js} +3 -3
  36. package/dist/cli-bundle/chunks/{chunk-DZRV2OPA.js → chunk-3EDFN3VV.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-ZOY5K4D3.js → chunk-3PWJWLLQ.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-VXOOB6YX.js → chunk-3SJAR3CY.js} +4 -4
  39. package/dist/cli-bundle/chunks/{chunk-GTLCVJOE.js → chunk-3WVKMF2A.js} +3 -3
  40. package/dist/cli-bundle/chunks/{chunk-LAV26CQG.js → chunk-42SYYKA4.js} +4 -4
  41. package/dist/cli-bundle/chunks/{chunk-NLR32VFS.js → chunk-4IXLNV7W.js} +2 -2
  42. package/dist/cli-bundle/chunks/{chunk-BKIAH72N.js → chunk-4LTPHDKA.js} +39 -23
  43. package/dist/cli-bundle/chunks/chunk-4LTPHDKA.js.map +1 -0
  44. package/dist/cli-bundle/chunks/{chunk-ABWCF646.js → chunk-4YTQVO3V.js} +5 -5
  45. package/dist/cli-bundle/chunks/{chunk-E5XMKOSB.js → chunk-5EBRMHI6.js} +4 -4
  46. package/dist/cli-bundle/chunks/{chunk-IY6VZ3IW.js → chunk-5FAG2JUC.js} +320 -62
  47. package/dist/cli-bundle/chunks/chunk-5FAG2JUC.js.map +7 -0
  48. package/dist/cli-bundle/chunks/{chunk-GKX4NJ7U.js → chunk-5K5LHZZX.js} +6 -6
  49. package/dist/cli-bundle/chunks/{chunk-T6PPNM7V.js → chunk-5K7BOAB6.js} +4 -4
  50. package/dist/cli-bundle/chunks/{chunk-4QOB7L7I.js → chunk-5MUZ54G2.js} +5 -5
  51. package/dist/cli-bundle/chunks/{chunk-SF3DT5HJ.js → chunk-5QME4KX2.js} +3 -3
  52. package/dist/cli-bundle/chunks/{chunk-RMF7LMBS.js → chunk-6PDGFY3P.js} +27 -17
  53. package/dist/cli-bundle/chunks/{chunk-RMF7LMBS.js.map → chunk-6PDGFY3P.js.map} +2 -2
  54. package/dist/cli-bundle/chunks/{chunk-TRSHFPRZ.js → chunk-6PM6CPPP.js} +5 -5
  55. package/dist/cli-bundle/chunks/{chunk-O4BCOJTZ.js → chunk-7AHRY3ZB.js} +21 -16
  56. package/dist/cli-bundle/chunks/chunk-7AHRY3ZB.js.map +7 -0
  57. package/dist/cli-bundle/chunks/{chunk-OR42SO64.js → chunk-7B36A3VT.js} +4 -4
  58. package/dist/cli-bundle/chunks/{chunk-QWRVBJ4D.js → chunk-7OR2YKKD.js} +2 -2
  59. package/dist/cli-bundle/chunks/{chunk-FPBMLYPI.js → chunk-7QUV54XX.js} +4 -4
  60. package/dist/cli-bundle/chunks/{chunk-WWNL6WMH.js → chunk-7WXW6JHG.js} +2 -2
  61. package/dist/cli-bundle/chunks/{chunk-BXNDKOR2.js → chunk-A2VL5SVG.js} +4 -4
  62. package/dist/cli-bundle/chunks/chunk-AXGDUXJW.js +5 -0
  63. package/dist/cli-bundle/chunks/{chunk-IAQE32BI.js → chunk-B2AVNGG3.js} +4 -4
  64. package/dist/cli-bundle/chunks/{chunk-K36WV5J6.js → chunk-B7O44UBR.js} +71 -8
  65. package/dist/cli-bundle/chunks/chunk-B7O44UBR.js.map +1 -0
  66. package/dist/cli-bundle/chunks/{chunk-HCEBZNC3.js → chunk-BRMPF2RM.js} +4 -4
  67. package/dist/cli-bundle/chunks/{chunk-Z7VWXXJM.js → chunk-BTNKMF2A.js} +4 -4
  68. package/dist/cli-bundle/chunks/{chunk-KH44WBAT.js → chunk-CD4643VW.js} +4 -4
  69. package/dist/cli-bundle/chunks/{chunk-OWXOPDHD.js → chunk-CJEEC5O4.js} +4 -4
  70. package/dist/cli-bundle/chunks/{chunk-PZC2FUOQ.js → chunk-CTPKCZCF.js} +2 -2
  71. package/dist/cli-bundle/chunks/{chunk-7W2UAXXT.js → chunk-D4OBQVL3.js} +10 -10
  72. package/dist/cli-bundle/chunks/{chunk-EWJWSNRU.js → chunk-DM4TYC2A.js} +4 -4
  73. package/dist/cli-bundle/chunks/{chunk-VJQG4BIM.js → chunk-DSFTAQ7T.js} +3 -3
  74. package/dist/cli-bundle/chunks/{chunk-AELMUANP.js → chunk-DVB6SQU7.js} +2 -2
  75. package/dist/cli-bundle/chunks/{chunk-KBLZ3AA5.js → chunk-E3ZWOFSO.js} +4 -4
  76. package/dist/cli-bundle/chunks/chunk-EP25DV6P.js +9 -0
  77. package/dist/cli-bundle/chunks/{chunk-GTK4DTEW.js → chunk-F4VCB4WY.js} +10 -10
  78. package/dist/cli-bundle/chunks/{chunk-V22ZPOKN.js → chunk-F4XAQUQA.js} +6 -6
  79. package/dist/cli-bundle/chunks/{chunk-QOOTOD3W.js → chunk-FGR6IBAF.js} +6 -6
  80. package/dist/cli-bundle/chunks/{chunk-JSLT7WVE.js → chunk-FKBMT2Q6.js} +2 -2
  81. package/dist/cli-bundle/chunks/{chunk-QIH77CAG.js → chunk-G5RLSSIX.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-P7MTHPJQ.js → chunk-GEKRVH3G.js} +2 -2
  83. package/dist/cli-bundle/chunks/{chunk-2L6ZP22J.js → chunk-GSP6IZFU.js} +3 -3
  84. package/dist/cli-bundle/chunks/{chunk-ATBCUC7Y.js → chunk-H3MDK2VU.js} +48 -30
  85. package/dist/cli-bundle/chunks/chunk-H3MDK2VU.js.map +1 -0
  86. package/dist/cli-bundle/chunks/{chunk-ZVZGXPQ5.js → chunk-HYZZM3Q2.js} +2 -2
  87. package/dist/cli-bundle/chunks/{chunk-XJTABV3X.js → chunk-IBWG3OSH.js} +22 -17
  88. package/dist/cli-bundle/chunks/chunk-IBWG3OSH.js.map +1 -0
  89. package/dist/cli-bundle/chunks/{chunk-4XGJLADW.js → chunk-IHY5SX7O.js} +3 -3
  90. package/dist/cli-bundle/chunks/{chunk-UCBDQI5E.js → chunk-IMU7JLUI.js} +7 -7
  91. package/dist/cli-bundle/chunks/{chunk-Z75ONV25.js → chunk-IPAQAJWB.js} +77 -7
  92. package/dist/cli-bundle/chunks/chunk-IPAQAJWB.js.map +7 -0
  93. package/dist/cli-bundle/chunks/{chunk-7RW4JCU2.js → chunk-IQCD6OO3.js} +25 -13
  94. package/dist/cli-bundle/chunks/chunk-IQCD6OO3.js.map +7 -0
  95. package/dist/cli-bundle/chunks/{chunk-YQWCZ5AC.js → chunk-J3ZKFEDM.js} +38 -22
  96. package/dist/cli-bundle/chunks/chunk-J3ZKFEDM.js.map +7 -0
  97. package/dist/cli-bundle/chunks/{chunk-PEQGTJ5Q.js → chunk-JCLXCGIL.js} +3 -3
  98. package/dist/cli-bundle/chunks/{chunk-GROYI4RB.js → chunk-JLTHOYR7.js} +3 -3
  99. package/dist/cli-bundle/chunks/{chunk-JHJSFOAM.js → chunk-JMPVHM44.js} +4 -4
  100. package/dist/cli-bundle/chunks/{chunk-MATHDCGG.js → chunk-JWYG36RV.js} +8 -8
  101. package/dist/cli-bundle/chunks/{chunk-ZTVA4KLN.js → chunk-KEGVMZNA.js} +28 -16
  102. package/dist/cli-bundle/chunks/chunk-KEGVMZNA.js.map +7 -0
  103. package/dist/cli-bundle/chunks/{chunk-VLRGDBLY.js → chunk-KEHOPUHH.js} +4 -4
  104. package/dist/cli-bundle/chunks/{chunk-K55VMLSS.js → chunk-KJ4ZF35M.js} +63 -13
  105. package/dist/cli-bundle/chunks/chunk-KJ4ZF35M.js.map +7 -0
  106. package/dist/cli-bundle/chunks/{chunk-CPX275C6.js → chunk-KPCZL2YK.js} +6 -6
  107. package/dist/cli-bundle/chunks/{chunk-POG76WWZ.js → chunk-L7DZV6EZ.js} +319 -61
  108. package/dist/cli-bundle/chunks/chunk-L7DZV6EZ.js.map +1 -0
  109. package/dist/cli-bundle/chunks/{chunk-FO6OSVEN.js → chunk-LANV45W2.js} +8 -8
  110. package/dist/cli-bundle/chunks/{chunk-LVC72YRD.js → chunk-LC5ZUXWE.js} +7 -7
  111. package/dist/cli-bundle/chunks/{chunk-SY4SFZSD.js → chunk-LE522OXA.js} +55 -30
  112. package/dist/cli-bundle/chunks/chunk-LE522OXA.js.map +7 -0
  113. package/dist/cli-bundle/chunks/{chunk-TVYYO5A7.js → chunk-MBHYQYCS.js} +2 -2
  114. package/dist/cli-bundle/chunks/{chunk-FJIFFBJX.js → chunk-MROP2RNT.js} +66 -74
  115. package/dist/cli-bundle/chunks/chunk-MROP2RNT.js.map +1 -0
  116. package/dist/cli-bundle/chunks/{chunk-7656MAUL.js → chunk-MUAJHL2R.js} +2 -2
  117. package/dist/cli-bundle/chunks/{chunk-R3P6FZJW.js → chunk-N6QCY2AX.js} +43 -25
  118. package/dist/cli-bundle/chunks/chunk-N6QCY2AX.js.map +1 -0
  119. package/dist/cli-bundle/chunks/{chunk-7WCE6Y64.js → chunk-NUQCSV4P.js} +2 -2
  120. package/dist/cli-bundle/chunks/{chunk-SZVB53Y3.js → chunk-O3GFE2PX.js} +3 -3
  121. package/dist/cli-bundle/chunks/{chunk-OY7DMU5P.js → chunk-O43LEUSD.js} +2 -2
  122. package/dist/cli-bundle/chunks/{chunk-AMJPSANK.js → chunk-O7RH6BWP.js} +103 -44
  123. package/dist/cli-bundle/chunks/chunk-O7RH6BWP.js.map +7 -0
  124. package/dist/cli-bundle/chunks/{chunk-NUF7ROFH.js → chunk-OODR5KYF.js} +26 -27
  125. package/dist/cli-bundle/chunks/chunk-OODR5KYF.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-LZYP423P.js → chunk-OZ25YD4Q.js} +3 -3
  127. package/dist/cli-bundle/chunks/{chunk-VZIZB6QH.js → chunk-PKYKQCTJ.js} +4 -4
  128. package/dist/cli-bundle/chunks/{chunk-UZLJOEAC.js → chunk-PMRED6QZ.js} +3 -3
  129. package/dist/cli-bundle/chunks/{chunk-ADBTSVGK.js → chunk-PPATPPI6.js} +65 -73
  130. package/dist/cli-bundle/chunks/chunk-PPATPPI6.js.map +7 -0
  131. package/dist/cli-bundle/chunks/{chunk-K4CI6Y45.js → chunk-PWGJCP2V.js} +2 -2
  132. package/dist/cli-bundle/chunks/{chunk-UVN66B3M.js → chunk-Q3Z2Y5WJ.js} +2 -2
  133. package/dist/cli-bundle/chunks/{chunk-RNPZYNHS.js → chunk-Q6YZ3VCI.js} +104 -45
  134. package/dist/cli-bundle/chunks/chunk-Q6YZ3VCI.js.map +1 -0
  135. package/dist/cli-bundle/chunks/{chunk-7DOJC3HS.js → chunk-QE5EUHKN.js} +28 -18
  136. package/dist/cli-bundle/chunks/chunk-QE5EUHKN.js.map +1 -0
  137. package/dist/cli-bundle/chunks/{chunk-AS4SAZ5R.js → chunk-QKMMWESK.js} +25 -26
  138. package/dist/cli-bundle/chunks/chunk-QKMMWESK.js.map +7 -0
  139. package/dist/cli-bundle/chunks/{chunk-R7QV7ICM.js → chunk-QSXN2FAN.js} +4 -4
  140. package/dist/cli-bundle/chunks/{chunk-5NTE36LD.js → chunk-RBECHH5K.js} +4 -4
  141. package/dist/cli-bundle/chunks/{chunk-JXCW2TI2.js → chunk-RPNC7M63.js} +8 -8
  142. package/dist/cli-bundle/chunks/{chunk-ICDAQ4TD.js → chunk-S2QQNTA6.js} +26 -14
  143. package/dist/cli-bundle/chunks/chunk-S2QQNTA6.js.map +1 -0
  144. package/dist/cli-bundle/chunks/{chunk-JFD5LPMI.js → chunk-SP3BAXFF.js} +29 -17
  145. package/dist/cli-bundle/chunks/chunk-SP3BAXFF.js.map +1 -0
  146. package/dist/cli-bundle/chunks/{chunk-F2LBF7XJ.js → chunk-SUSFH6F7.js} +5 -5
  147. package/dist/cli-bundle/chunks/{chunk-VHXHVTUU.js → chunk-TDOPC7UY.js} +2 -2
  148. package/dist/cli-bundle/chunks/{chunk-HYW67VJ5.js → chunk-TLF52ZDP.js} +30 -25
  149. package/dist/cli-bundle/chunks/chunk-TLF52ZDP.js.map +1 -0
  150. package/dist/cli-bundle/chunks/{chunk-FSE2IKJQ.js → chunk-TWHG646K.js} +2 -2
  151. package/dist/cli-bundle/chunks/{chunk-OCUBRA6D.js → chunk-U7U7WGEC.js} +4 -4
  152. package/dist/cli-bundle/chunks/{chunk-PONKZPCJ.js → chunk-UFRVIIJ2.js} +4 -4
  153. package/dist/cli-bundle/chunks/{chunk-VNTCM3VW.js → chunk-VKX2VZZH.js} +8 -8
  154. package/dist/cli-bundle/chunks/{chunk-7AVEY74G.js → chunk-VTOCZ343.js} +29 -24
  155. package/dist/cli-bundle/chunks/chunk-VTOCZ343.js.map +7 -0
  156. package/dist/cli-bundle/chunks/{chunk-6JUTHVQS.js → chunk-W2JDNTN3.js} +2 -2
  157. package/dist/cli-bundle/chunks/{chunk-PQSEQD6E.js → chunk-W35PHE44.js} +62 -12
  158. package/dist/cli-bundle/chunks/chunk-W35PHE44.js.map +1 -0
  159. package/dist/cli-bundle/chunks/{chunk-4QSQ6XDK.js → chunk-WT4KXBUD.js} +68 -31
  160. package/dist/cli-bundle/chunks/chunk-WT4KXBUD.js.map +1 -0
  161. package/dist/cli-bundle/chunks/{chunk-RPESLSO5.js → chunk-XC5RVKHH.js} +69 -32
  162. package/dist/cli-bundle/chunks/chunk-XC5RVKHH.js.map +7 -0
  163. package/dist/cli-bundle/chunks/{chunk-QG4GFLQ6.js → chunk-XD6UF2NB.js} +42 -24
  164. package/dist/cli-bundle/chunks/chunk-XD6UF2NB.js.map +7 -0
  165. package/dist/cli-bundle/chunks/{chunk-AF2CCM5U.js → chunk-XKRVX4B3.js} +4 -4
  166. package/dist/cli-bundle/chunks/{chunk-JGUKMMRS.js → chunk-XN4NQZJK.js} +3 -3
  167. package/dist/cli-bundle/chunks/{chunk-3P7UJQOX.js → chunk-YKFMLQNK.js} +2 -2
  168. package/dist/cli-bundle/chunks/{chunk-YCIUJJOD.js → chunk-YKWKMGL7.js} +2 -2
  169. package/dist/cli-bundle/chunks/{chunk-TOBGV45Y.js → chunk-YUKIFPWK.js} +2 -2
  170. package/dist/cli-bundle/chunks/{chunk-72LQ4TKV.js → chunk-YYEZEP3E.js} +3 -3
  171. package/dist/cli-bundle/chunks/{chunk-X3W65QK3.js → chunk-ZEY3XSZQ.js} +5 -5
  172. package/dist/cli-bundle/chunks/{chunk-MWQ2HC2A.js → chunk-ZKOQHLJP.js} +59 -34
  173. package/dist/cli-bundle/chunks/chunk-ZKOQHLJP.js.map +1 -0
  174. package/dist/cli-bundle/chunks/{chunk-QJIKE24M.js → chunk-ZQ3UMKWE.js} +2 -2
  175. package/dist/cli-bundle/chunks/{chunk-4PUUNQDV.js → chunk-ZVVEWHWK.js} +58 -33
  176. package/dist/cli-bundle/chunks/chunk-ZVVEWHWK.js.map +7 -0
  177. package/dist/cli-bundle/chunks/{chunk-OG5DVFMA.js → chunk-ZXE6SNKO.js} +5 -5
  178. package/dist/cli-bundle/chunks/close-GAUIGOQC.js +12 -0
  179. package/dist/cli-bundle/chunks/{close-QEMOYZN3.js → close-SJIEKNY4.js} +5 -5
  180. package/dist/cli-bundle/chunks/{close-many-RZVTUGBG.js → close-many-B6AIC5OQ.js} +15 -14
  181. package/dist/cli-bundle/chunks/close-many-QCINT6I2.js +24 -0
  182. package/dist/cli-bundle/chunks/comments-4SK5EUEJ.js +13 -0
  183. package/dist/cli-bundle/chunks/{comments-TPU7QRBL.js → comments-DM5KV2RS.js} +7 -7
  184. package/dist/cli-bundle/chunks/copy-4KCCLTYQ.js +10 -0
  185. package/dist/cli-bundle/chunks/{copy-DKTSSCK7.js → copy-HEP5SZHB.js} +5 -4
  186. package/dist/cli-bundle/chunks/create-BDKQFPRE.js +30 -0
  187. package/dist/cli-bundle/chunks/{create-EIFBIVNQ.js → create-VCGBCYL2.js} +11 -10
  188. package/dist/cli-bundle/chunks/delete-JWDXPR3H.js +10 -0
  189. package/dist/cli-bundle/chunks/{delete-LCS3VPDH.js → delete-ZSPBTVJD.js} +4 -4
  190. package/dist/cli-bundle/chunks/{deps-YG7UF3VR.js → deps-BZTWWOIE.js} +6 -6
  191. package/dist/cli-bundle/chunks/{deps-UH5EQQUY.js → deps-OVAJOQIE.js} +6 -6
  192. package/dist/cli-bundle/chunks/{docs-G32TK6XS.js → docs-3GFMSWLL.js} +6 -6
  193. package/dist/cli-bundle/chunks/docs-SY2NPT6Y.js +14 -0
  194. package/dist/cli-bundle/chunks/{files-4ALMCSKB.js → files-2SEL4QIU.js} +6 -6
  195. package/dist/cli-bundle/chunks/{files-3H32UQ4K.js → files-FYMMJGNN.js} +6 -6
  196. package/dist/cli-bundle/chunks/focus-4A27YJ2Z.js +10 -0
  197. package/dist/cli-bundle/chunks/{focus-7SOUT5PZ.js → focus-TEUJKTAT.js} +5 -5
  198. package/dist/cli-bundle/chunks/history-compact-7QOKL2NB.js +16 -0
  199. package/dist/cli-bundle/chunks/{history-compact-77BT2LUB.js → history-compact-U7A37VR6.js} +6 -6
  200. package/dist/cli-bundle/chunks/{history-redact-LJPZPNFA.js → history-redact-TNKUO4ZE.js} +4 -4
  201. package/dist/cli-bundle/chunks/{history-redact-PWTTJ3XS.js → history-redact-ZWRUWQY3.js} +4 -4
  202. package/dist/cli-bundle/chunks/{history-repair-I7CBNCV3.js → history-repair-6IU5VWHN.js} +7 -7
  203. package/dist/cli-bundle/chunks/history-repair-GWCGJUM2.js +17 -0
  204. package/dist/cli-bundle/chunks/learnings-DDFAUUX3.js +13 -0
  205. package/dist/cli-bundle/chunks/{learnings-KTYW3AL7.js → learnings-GOEZXMKL.js} +7 -7
  206. package/dist/cli-bundle/chunks/{notes-ZERD3KB2.js → notes-BZWODAEK.js} +7 -7
  207. package/dist/cli-bundle/chunks/notes-OBJ6FL36.js +13 -0
  208. package/dist/cli-bundle/chunks/{plan-OFJUBIM5.js → plan-V57VQTAG.js} +12 -11
  209. package/dist/cli-bundle/chunks/plan-ZMOBD6FX.js +27 -0
  210. package/dist/cli-bundle/chunks/{profile-3THJPIQY.js → profile-BG3N4ETA.js} +9 -9
  211. package/dist/cli-bundle/chunks/{profile-XEZAMMBW.js → profile-XLM45FKV.js} +9 -9
  212. package/dist/cli-bundle/chunks/{register-list-query-BR435Q2H.js → register-list-query-EYYNTGMF.js} +48 -38
  213. package/dist/cli-bundle/chunks/register-list-query-EYYNTGMF.js.map +1 -0
  214. package/dist/cli-bundle/chunks/{register-list-query-RWTWLOBE.js → register-list-query-WGXJPXXY.js} +47 -37
  215. package/dist/cli-bundle/chunks/register-list-query-WGXJPXXY.js.map +7 -0
  216. package/dist/cli-bundle/chunks/{register-mutation-HLWC2WNP.js → register-mutation-3YSDDVOL.js} +131 -105
  217. package/dist/cli-bundle/chunks/register-mutation-3YSDDVOL.js.map +1 -0
  218. package/dist/cli-bundle/chunks/{register-mutation-ZJX5AZM5.js → register-mutation-VDGUMMUY.js} +131 -105
  219. package/dist/cli-bundle/chunks/register-mutation-VDGUMMUY.js.map +7 -0
  220. package/dist/cli-bundle/chunks/{register-operations-744YBJMV.js → register-operations-H4URGAHX.js} +36 -35
  221. package/dist/cli-bundle/chunks/{register-operations-744YBJMV.js.map → register-operations-H4URGAHX.js.map} +1 -1
  222. package/dist/cli-bundle/chunks/{register-operations-UEBJH6AN.js → register-operations-HSO7X77D.js} +34 -33
  223. package/dist/cli-bundle/chunks/{register-operations-UEBJH6AN.js.map → register-operations-HSO7X77D.js.map} +1 -1
  224. package/dist/cli-bundle/chunks/{register-setup-5DA4UZXI.js → register-setup-HZ2KKXK4.js} +13 -13
  225. package/dist/cli-bundle/chunks/{register-setup-6H25M3BH.js → register-setup-WCBKJ3H3.js} +13 -13
  226. package/dist/cli-bundle/chunks/{restore-6TDVSATY.js → restore-3NGRFDPX.js} +7 -6
  227. package/dist/cli-bundle/chunks/restore-LNVNUWHE.js +15 -0
  228. package/dist/cli-bundle/chunks/{schema-TPVTIJPO.js → schema-LMFZ742C.js} +6 -6
  229. package/dist/cli-bundle/chunks/{schema-HFXFSGPG.js → schema-O34O33UW.js} +6 -6
  230. package/dist/cli-bundle/chunks/update-BN6VZSYX.js +24 -0
  231. package/dist/cli-bundle/chunks/{update-LJZCL5SI.js → update-FDLPLKOB.js} +14 -13
  232. package/dist/cli-bundle/chunks/update-many-WCKOPN3K.js +35 -0
  233. package/dist/cli-bundle/chunks/update-many-WCKOPN3K.js.map +7 -0
  234. package/dist/cli-bundle/chunks/update-many-X6DVGOMM.js +39 -0
  235. package/dist/cli-bundle/chunks/update-many-X6DVGOMM.js.map +1 -0
  236. package/dist/cli-bundle/main.js +65 -64
  237. package/dist/cli-bundle/main.js.map +2 -2
  238. package/dist/cli-bundle/sdk-runtime.js +53 -52
  239. package/dist/cli-bundle/sdk-testing.js +6 -6
  240. package/dist/cli-bundle/sdk.js +362 -56
  241. package/dist/cli-bundle/sdk.js.map +4 -4
  242. package/dist/cli.js +10 -4
  243. package/dist/cli.js.map +1 -1
  244. package/dist/core/diagnostics/remediation.js +7 -2
  245. package/dist/core/diagnostics/remediation.js.map +1 -1
  246. package/dist/core/search/background-refresh.d.ts +3 -1
  247. package/dist/core/search/background-refresh.js +34 -6
  248. package/dist/core/search/background-refresh.js.map +1 -1
  249. package/dist/core/search/cache.js +28 -5
  250. package/dist/core/search/cache.js.map +1 -1
  251. package/dist/core/shared/constants.d.ts +2 -0
  252. package/dist/core/shared/constants.js +29 -24
  253. package/dist/core/shared/constants.js.map +1 -1
  254. package/dist/core/store/item-metadata-cache.d.ts +32 -1
  255. package/dist/core/store/item-metadata-cache.js +289 -21
  256. package/dist/core/store/item-metadata-cache.js.map +1 -1
  257. package/dist/core/store/item-store.js +71 -34
  258. package/dist/core/store/item-store.js.map +1 -1
  259. package/dist/core/store/settings.js +9 -3
  260. package/dist/core/store/settings.js.map +1 -1
  261. package/dist/sdk/cli-bootstrap.js +68 -76
  262. package/dist/sdk/cli-bootstrap.js.map +1 -1
  263. package/dist/sdk/compile-cache.d.ts +16 -0
  264. package/dist/sdk/compile-cache.js +73 -0
  265. package/dist/sdk/compile-cache.js.map +1 -0
  266. package/dist/sdk/context-relevance.d.ts +16 -1
  267. package/dist/sdk/context-relevance.js +20 -8
  268. package/dist/sdk/context-relevance.js.map +1 -1
  269. package/dist/sdk/context-signal-store.d.ts +77 -0
  270. package/dist/sdk/context-signal-store.js +201 -0
  271. package/dist/sdk/context-signal-store.js.map +1 -0
  272. package/dist/sdk/dependency-provenance.d.ts +12 -0
  273. package/dist/sdk/dependency-provenance.js +38 -0
  274. package/dist/sdk/dependency-provenance.js.map +1 -0
  275. package/dist/sdk/governance/storage-integrity.d.ts +1 -1
  276. package/dist/sdk/governance/storage-integrity.js +47 -6
  277. package/dist/sdk/governance/storage-integrity.js.map +1 -1
  278. package/dist/sdk/graph/assembly.d.ts +2 -0
  279. package/dist/sdk/graph/assembly.js +51 -4
  280. package/dist/sdk/graph/assembly.js.map +1 -1
  281. package/dist/sdk/graph/run.js +12 -13
  282. package/dist/sdk/graph/run.js.map +1 -1
  283. package/dist/sdk/index.d.ts +5 -0
  284. package/dist/sdk/index.js +7 -2
  285. package/dist/sdk/index.js.map +1 -1
  286. package/dist/sdk/item-metadata-index.d.ts +11 -0
  287. package/dist/sdk/item-metadata-index.js +15 -0
  288. package/dist/sdk/item-metadata-index.js.map +1 -0
  289. package/dist/sdk/merge/index.d.ts +1 -0
  290. package/dist/sdk/merge/index.js +3 -2
  291. package/dist/sdk/merge/index.js.map +1 -1
  292. package/dist/sdk/merge/install.js +25 -9
  293. package/dist/sdk/merge/install.js.map +1 -1
  294. package/dist/sdk/merge/reconcile.d.ts +46 -0
  295. package/dist/sdk/merge/reconcile.js +46 -0
  296. package/dist/sdk/merge/reconcile.js.map +1 -0
  297. package/dist/sdk/query/list.d.ts +5 -4
  298. package/dist/sdk/query/list.js +22 -14
  299. package/dist/sdk/query/list.js.map +1 -1
  300. package/dist/sdk/relationship-history.d.ts +30 -0
  301. package/dist/sdk/relationship-history.js +75 -7
  302. package/dist/sdk/relationship-history.js.map +1 -1
  303. package/dist/sdk/relationship-migration.d.ts +42 -0
  304. package/dist/sdk/relationship-migration.js +78 -0
  305. package/dist/sdk/relationship-migration.js.map +1 -0
  306. package/dist/sdk/structured-mutations.js +4 -25
  307. package/dist/sdk/structured-mutations.js.map +1 -1
  308. package/docs/COMMANDS.md +26 -3
  309. package/docs/CONFIGURATION.md +1 -1
  310. package/docs/MERGE_SAFETY.md +14 -5
  311. package/docs/PERFORMANCE.md +28 -0
  312. package/docs/RELATIONSHIP_GRAPH.md +47 -1
  313. package/docs/SDK.md +78 -5
  314. package/marketplace.json +2 -2
  315. package/package.json +2 -2
  316. package/packages/pm-beads/package.json +1 -1
  317. package/packages/pm-calendar/package.json +1 -1
  318. package/packages/pm-command-kit/package.json +1 -1
  319. package/packages/pm-governance-audit/package.json +1 -1
  320. package/packages/pm-guide-shell/package.json +1 -1
  321. package/packages/pm-kanban/package.json +1 -1
  322. package/packages/pm-lifecycle-hooks/package.json +1 -1
  323. package/packages/pm-linked-test-adapters/package.json +1 -1
  324. package/packages/pm-search-advanced/package.json +1 -1
  325. package/packages/pm-templates/package.json +1 -1
  326. package/packages/pm-todos/package.json +1 -1
  327. package/packages/pm-vcs/package.json +1 -1
  328. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  329. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  330. package/dist/cli-bundle/chunks/append-DFETHAZL.js +0 -11
  331. package/dist/cli-bundle/chunks/chunk-4PUUNQDV.js.map +0 -7
  332. package/dist/cli-bundle/chunks/chunk-4QSQ6XDK.js.map +0 -1
  333. package/dist/cli-bundle/chunks/chunk-7AVEY74G.js.map +0 -7
  334. package/dist/cli-bundle/chunks/chunk-7DOJC3HS.js.map +0 -1
  335. package/dist/cli-bundle/chunks/chunk-7RW4JCU2.js.map +0 -7
  336. package/dist/cli-bundle/chunks/chunk-ADBTSVGK.js.map +0 -7
  337. package/dist/cli-bundle/chunks/chunk-AMJPSANK.js.map +0 -7
  338. package/dist/cli-bundle/chunks/chunk-AS4SAZ5R.js.map +0 -7
  339. package/dist/cli-bundle/chunks/chunk-ATBCUC7Y.js.map +0 -1
  340. package/dist/cli-bundle/chunks/chunk-BKIAH72N.js.map +0 -1
  341. package/dist/cli-bundle/chunks/chunk-FJIFFBJX.js.map +0 -1
  342. package/dist/cli-bundle/chunks/chunk-HYW67VJ5.js.map +0 -1
  343. package/dist/cli-bundle/chunks/chunk-ICDAQ4TD.js.map +0 -1
  344. package/dist/cli-bundle/chunks/chunk-IY6VZ3IW.js.map +0 -7
  345. package/dist/cli-bundle/chunks/chunk-JFD5LPMI.js.map +0 -1
  346. package/dist/cli-bundle/chunks/chunk-K36WV5J6.js.map +0 -1
  347. package/dist/cli-bundle/chunks/chunk-K55VMLSS.js.map +0 -7
  348. package/dist/cli-bundle/chunks/chunk-MWQ2HC2A.js.map +0 -1
  349. package/dist/cli-bundle/chunks/chunk-NUF7ROFH.js.map +0 -1
  350. package/dist/cli-bundle/chunks/chunk-O4BCOJTZ.js.map +0 -7
  351. package/dist/cli-bundle/chunks/chunk-POG76WWZ.js.map +0 -1
  352. package/dist/cli-bundle/chunks/chunk-PQSEQD6E.js.map +0 -1
  353. package/dist/cli-bundle/chunks/chunk-QG4GFLQ6.js.map +0 -7
  354. package/dist/cli-bundle/chunks/chunk-R3P6FZJW.js.map +0 -1
  355. package/dist/cli-bundle/chunks/chunk-RNPZYNHS.js.map +0 -1
  356. package/dist/cli-bundle/chunks/chunk-RPESLSO5.js.map +0 -7
  357. package/dist/cli-bundle/chunks/chunk-SY4SFZSD.js.map +0 -7
  358. package/dist/cli-bundle/chunks/chunk-XJTABV3X.js.map +0 -1
  359. package/dist/cli-bundle/chunks/chunk-YQWCZ5AC.js.map +0 -7
  360. package/dist/cli-bundle/chunks/chunk-Z75ONV25.js.map +0 -7
  361. package/dist/cli-bundle/chunks/chunk-ZTVA4KLN.js.map +0 -7
  362. package/dist/cli-bundle/chunks/close-O5QVZ6ET.js +0 -12
  363. package/dist/cli-bundle/chunks/close-many-5RZXVN4J.js +0 -23
  364. package/dist/cli-bundle/chunks/comments-Z4KV6FU3.js +0 -13
  365. package/dist/cli-bundle/chunks/copy-M7DDI6LS.js +0 -9
  366. package/dist/cli-bundle/chunks/create-RGSPN5GD.js +0 -29
  367. package/dist/cli-bundle/chunks/delete-MD7YXQLH.js +0 -10
  368. package/dist/cli-bundle/chunks/docs-JWWNRC27.js +0 -14
  369. package/dist/cli-bundle/chunks/focus-DRQ6FQH6.js +0 -10
  370. package/dist/cli-bundle/chunks/history-compact-VCKGTX64.js +0 -16
  371. package/dist/cli-bundle/chunks/history-repair-YTDZRK5E.js +0 -17
  372. package/dist/cli-bundle/chunks/learnings-CYNOICKR.js +0 -13
  373. package/dist/cli-bundle/chunks/notes-FGO63FXL.js +0 -13
  374. package/dist/cli-bundle/chunks/plan-SGCDDTYR.js +0 -26
  375. package/dist/cli-bundle/chunks/register-list-query-BR435Q2H.js.map +0 -1
  376. package/dist/cli-bundle/chunks/register-list-query-RWTWLOBE.js.map +0 -7
  377. package/dist/cli-bundle/chunks/register-mutation-HLWC2WNP.js.map +0 -1
  378. package/dist/cli-bundle/chunks/register-mutation-ZJX5AZM5.js.map +0 -7
  379. package/dist/cli-bundle/chunks/restore-RSL7C7LO.js +0 -14
  380. package/dist/cli-bundle/chunks/update-SIA7LH5Y.js +0 -23
  381. package/dist/cli-bundle/chunks/update-many-BDBZVGQL.js +0 -38
  382. package/dist/cli-bundle/chunks/update-many-MOY3A5B3.js +0 -34
  383. /package/dist/cli-bundle/chunks/{append-7OVFYR3C.js.map → append-CYMA7RJT.js.map} +0 -0
  384. /package/dist/cli-bundle/chunks/{append-DFETHAZL.js.map → append-H53CAPMP.js.map} +0 -0
  385. /package/dist/cli-bundle/chunks/{chunk-PFNHX655.js.map → chunk-2P7OK4WG.js.map} +0 -0
  386. /package/dist/cli-bundle/chunks/{chunk-EJDGV4GR.js.map → chunk-3EBGHNNQ.js.map} +0 -0
  387. /package/dist/cli-bundle/chunks/{chunk-DZRV2OPA.js.map → chunk-3EDFN3VV.js.map} +0 -0
  388. /package/dist/cli-bundle/chunks/{chunk-ZOY5K4D3.js.map → chunk-3PWJWLLQ.js.map} +0 -0
  389. /package/dist/cli-bundle/chunks/{chunk-VXOOB6YX.js.map → chunk-3SJAR3CY.js.map} +0 -0
  390. /package/dist/cli-bundle/chunks/{chunk-GTLCVJOE.js.map → chunk-3WVKMF2A.js.map} +0 -0
  391. /package/dist/cli-bundle/chunks/{chunk-LAV26CQG.js.map → chunk-42SYYKA4.js.map} +0 -0
  392. /package/dist/cli-bundle/chunks/{chunk-NLR32VFS.js.map → chunk-4IXLNV7W.js.map} +0 -0
  393. /package/dist/cli-bundle/chunks/{chunk-ABWCF646.js.map → chunk-4YTQVO3V.js.map} +0 -0
  394. /package/dist/cli-bundle/chunks/{chunk-E5XMKOSB.js.map → chunk-5EBRMHI6.js.map} +0 -0
  395. /package/dist/cli-bundle/chunks/{chunk-GKX4NJ7U.js.map → chunk-5K5LHZZX.js.map} +0 -0
  396. /package/dist/cli-bundle/chunks/{chunk-T6PPNM7V.js.map → chunk-5K7BOAB6.js.map} +0 -0
  397. /package/dist/cli-bundle/chunks/{chunk-4QOB7L7I.js.map → chunk-5MUZ54G2.js.map} +0 -0
  398. /package/dist/cli-bundle/chunks/{chunk-SF3DT5HJ.js.map → chunk-5QME4KX2.js.map} +0 -0
  399. /package/dist/cli-bundle/chunks/{chunk-TRSHFPRZ.js.map → chunk-6PM6CPPP.js.map} +0 -0
  400. /package/dist/cli-bundle/chunks/{chunk-OR42SO64.js.map → chunk-7B36A3VT.js.map} +0 -0
  401. /package/dist/cli-bundle/chunks/{chunk-QWRVBJ4D.js.map → chunk-7OR2YKKD.js.map} +0 -0
  402. /package/dist/cli-bundle/chunks/{chunk-FPBMLYPI.js.map → chunk-7QUV54XX.js.map} +0 -0
  403. /package/dist/cli-bundle/chunks/{chunk-WWNL6WMH.js.map → chunk-7WXW6JHG.js.map} +0 -0
  404. /package/dist/cli-bundle/chunks/{chunk-BXNDKOR2.js.map → chunk-A2VL5SVG.js.map} +0 -0
  405. /package/dist/cli-bundle/chunks/{close-QEMOYZN3.js.map → chunk-AXGDUXJW.js.map} +0 -0
  406. /package/dist/cli-bundle/chunks/{chunk-IAQE32BI.js.map → chunk-B2AVNGG3.js.map} +0 -0
  407. /package/dist/cli-bundle/chunks/{chunk-HCEBZNC3.js.map → chunk-BRMPF2RM.js.map} +0 -0
  408. /package/dist/cli-bundle/chunks/{chunk-Z7VWXXJM.js.map → chunk-BTNKMF2A.js.map} +0 -0
  409. /package/dist/cli-bundle/chunks/{chunk-KH44WBAT.js.map → chunk-CD4643VW.js.map} +0 -0
  410. /package/dist/cli-bundle/chunks/{chunk-OWXOPDHD.js.map → chunk-CJEEC5O4.js.map} +0 -0
  411. /package/dist/cli-bundle/chunks/{chunk-PZC2FUOQ.js.map → chunk-CTPKCZCF.js.map} +0 -0
  412. /package/dist/cli-bundle/chunks/{chunk-7W2UAXXT.js.map → chunk-D4OBQVL3.js.map} +0 -0
  413. /package/dist/cli-bundle/chunks/{chunk-EWJWSNRU.js.map → chunk-DM4TYC2A.js.map} +0 -0
  414. /package/dist/cli-bundle/chunks/{chunk-VJQG4BIM.js.map → chunk-DSFTAQ7T.js.map} +0 -0
  415. /package/dist/cli-bundle/chunks/{chunk-AELMUANP.js.map → chunk-DVB6SQU7.js.map} +0 -0
  416. /package/dist/cli-bundle/chunks/{chunk-KBLZ3AA5.js.map → chunk-E3ZWOFSO.js.map} +0 -0
  417. /package/dist/cli-bundle/chunks/{close-O5QVZ6ET.js.map → chunk-EP25DV6P.js.map} +0 -0
  418. /package/dist/cli-bundle/chunks/{chunk-GTK4DTEW.js.map → chunk-F4VCB4WY.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{chunk-V22ZPOKN.js.map → chunk-F4XAQUQA.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{chunk-QOOTOD3W.js.map → chunk-FGR6IBAF.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{chunk-JSLT7WVE.js.map → chunk-FKBMT2Q6.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{chunk-QIH77CAG.js.map → chunk-G5RLSSIX.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{chunk-P7MTHPJQ.js.map → chunk-GEKRVH3G.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{chunk-2L6ZP22J.js.map → chunk-GSP6IZFU.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{chunk-ZVZGXPQ5.js.map → chunk-HYZZM3Q2.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-4XGJLADW.js.map → chunk-IHY5SX7O.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-UCBDQI5E.js.map → chunk-IMU7JLUI.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-PEQGTJ5Q.js.map → chunk-JCLXCGIL.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-GROYI4RB.js.map → chunk-JLTHOYR7.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-JHJSFOAM.js.map → chunk-JMPVHM44.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-MATHDCGG.js.map → chunk-JWYG36RV.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-VLRGDBLY.js.map → chunk-KEHOPUHH.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{chunk-CPX275C6.js.map → chunk-KPCZL2YK.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{chunk-FO6OSVEN.js.map → chunk-LANV45W2.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{chunk-LVC72YRD.js.map → chunk-LC5ZUXWE.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{chunk-TVYYO5A7.js.map → chunk-MBHYQYCS.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{chunk-7656MAUL.js.map → chunk-MUAJHL2R.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{chunk-7WCE6Y64.js.map → chunk-NUQCSV4P.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{chunk-SZVB53Y3.js.map → chunk-O3GFE2PX.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{chunk-OY7DMU5P.js.map → chunk-O43LEUSD.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{chunk-LZYP423P.js.map → chunk-OZ25YD4Q.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{chunk-VZIZB6QH.js.map → chunk-PKYKQCTJ.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{chunk-UZLJOEAC.js.map → chunk-PMRED6QZ.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{chunk-K4CI6Y45.js.map → chunk-PWGJCP2V.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{chunk-UVN66B3M.js.map → chunk-Q3Z2Y5WJ.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{chunk-R7QV7ICM.js.map → chunk-QSXN2FAN.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{chunk-5NTE36LD.js.map → chunk-RBECHH5K.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{chunk-JXCW2TI2.js.map → chunk-RPNC7M63.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{chunk-F2LBF7XJ.js.map → chunk-SUSFH6F7.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{chunk-VHXHVTUU.js.map → chunk-TDOPC7UY.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{chunk-FSE2IKJQ.js.map → chunk-TWHG646K.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{chunk-OCUBRA6D.js.map → chunk-U7U7WGEC.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{chunk-PONKZPCJ.js.map → chunk-UFRVIIJ2.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{chunk-VNTCM3VW.js.map → chunk-VKX2VZZH.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{chunk-6JUTHVQS.js.map → chunk-W2JDNTN3.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{chunk-AF2CCM5U.js.map → chunk-XKRVX4B3.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{chunk-JGUKMMRS.js.map → chunk-XN4NQZJK.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{chunk-3P7UJQOX.js.map → chunk-YKFMLQNK.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{chunk-YCIUJJOD.js.map → chunk-YKWKMGL7.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{chunk-TOBGV45Y.js.map → chunk-YUKIFPWK.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{chunk-72LQ4TKV.js.map → chunk-YYEZEP3E.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{chunk-X3W65QK3.js.map → chunk-ZEY3XSZQ.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{chunk-QJIKE24M.js.map → chunk-ZQ3UMKWE.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{chunk-OG5DVFMA.js.map → chunk-ZXE6SNKO.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{close-many-5RZXVN4J.js.map → close-GAUIGOQC.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{close-many-RZVTUGBG.js.map → close-SJIEKNY4.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{comments-TPU7QRBL.js.map → close-many-B6AIC5OQ.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{comments-Z4KV6FU3.js.map → close-many-QCINT6I2.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{copy-M7DDI6LS.js.map → comments-4SK5EUEJ.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{copy-DKTSSCK7.js.map → comments-DM5KV2RS.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{create-RGSPN5GD.js.map → copy-4KCCLTYQ.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{create-EIFBIVNQ.js.map → copy-HEP5SZHB.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{delete-MD7YXQLH.js.map → create-BDKQFPRE.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{delete-LCS3VPDH.js.map → create-VCGBCYL2.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{deps-YG7UF3VR.js.map → delete-JWDXPR3H.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{deps-UH5EQQUY.js.map → delete-ZSPBTVJD.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{docs-JWWNRC27.js.map → deps-BZTWWOIE.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{docs-G32TK6XS.js.map → deps-OVAJOQIE.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{files-3H32UQ4K.js.map → docs-3GFMSWLL.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{files-4ALMCSKB.js.map → docs-SY2NPT6Y.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{focus-DRQ6FQH6.js.map → files-2SEL4QIU.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{focus-7SOUT5PZ.js.map → files-FYMMJGNN.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{history-compact-VCKGTX64.js.map → focus-4A27YJ2Z.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{history-compact-77BT2LUB.js.map → focus-TEUJKTAT.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{history-redact-PWTTJ3XS.js.map → history-compact-7QOKL2NB.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{history-redact-LJPZPNFA.js.map → history-compact-U7A37VR6.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{history-repair-I7CBNCV3.js.map → history-redact-TNKUO4ZE.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{history-repair-YTDZRK5E.js.map → history-redact-ZWRUWQY3.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{learnings-KTYW3AL7.js.map → history-repair-6IU5VWHN.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{learnings-CYNOICKR.js.map → history-repair-GWCGJUM2.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{notes-FGO63FXL.js.map → learnings-DDFAUUX3.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{notes-ZERD3KB2.js.map → learnings-GOEZXMKL.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{plan-OFJUBIM5.js.map → notes-BZWODAEK.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{plan-SGCDDTYR.js.map → notes-OBJ6FL36.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{profile-3THJPIQY.js.map → plan-V57VQTAG.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{profile-XEZAMMBW.js.map → plan-ZMOBD6FX.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{restore-6TDVSATY.js.map → profile-BG3N4ETA.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{restore-RSL7C7LO.js.map → profile-XLM45FKV.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{register-setup-5DA4UZXI.js.map → register-setup-HZ2KKXK4.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{register-setup-6H25M3BH.js.map → register-setup-WCBKJ3H3.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{schema-TPVTIJPO.js.map → restore-3NGRFDPX.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{schema-HFXFSGPG.js.map → restore-LNVNUWHE.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{update-LJZCL5SI.js.map → schema-LMFZ742C.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{update-SIA7LH5Y.js.map → schema-O34O33UW.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{update-many-MOY3A5B3.js.map → update-BN6VZSYX.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{update-many-BDBZVGQL.js.map → update-FDLPLKOB.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["core/shared/constants.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/shared/constants\n *\n * Provides shared primitives and utilities for Constants.\n */\nimport type {\n BuiltinItemType,\n GovernancePreset,\n GovernanceSettings,\n ItemMetadata,\n PmSettings,\n RuntimeStatusDefinition,\n RuntimeWorkflowDefinition,\n} from \"../../types/index.js\";\nimport { createDefaultExtensionGovernancePolicy } from \"../extensions/extension-types.js\";\n\n/**\n * Canonical default lifecycle status model and workflow role mapping.\n *\n * Single source of truth: `SETTINGS_DEFAULTS.schema` references these, and\n * `src/core/schema/runtime-schema.ts` re-exports them as\n * `DEFAULT_RUNTIME_STATUS_DEFINITIONS` / `DEFAULT_RUNTIME_WORKFLOW`.\n */\nexport const DEFAULT_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> =\n Object.freeze([\n {\n id: \"draft\",\n roles: [\"draft\"],\n },\n {\n id: \"open\",\n roles: [\"active\", \"default_open\"],\n },\n {\n id: \"in_progress\",\n aliases: [\"in-progress\"],\n roles: [\"active\"],\n },\n {\n id: \"blocked\",\n roles: [\"blocked\"],\n },\n {\n id: \"closed\",\n roles: [\"terminal\", \"terminal_done\", \"default_close\"],\n },\n {\n id: \"canceled\",\n aliases: [\"cancelled\"],\n roles: [\"terminal\", \"terminal_canceled\", \"default_cancel\"],\n },\n ]);\n\n/** Fallback workflow definition used when callers do not provide an override. */\nexport const DEFAULT_WORKFLOW_DEFINITION: RuntimeWorkflowDefinition =\n Object.freeze({\n draft_status: \"draft\",\n open_status: \"open\",\n in_progress_status: \"in_progress\",\n blocked_status: \"blocked\",\n close_status: \"closed\",\n canceled_status: \"canceled\",\n });\n\n/** Public contract for pm dirname, shared by SDK and presentation-layer consumers. */\nexport const PM_DIRNAME = \".agents/pm\";\n/** Public contract for settings filename, shared by SDK and presentation-layer consumers. */\nexport const SETTINGS_FILENAME = \"settings.json\";\n\n/** GH-249: placeholder close reason recorded when `pm create --status closed` lands an item directly in the close status under `governance.require_close_reason` and no --message/--resolution text is available. Mirrors `pm update --status closed`'s \"Closed via pm update\" default so all three closure paths record a reason. */\nexport const CREATE_DIRECT_CLOSE_REASON_DEFAULT =\n \"Closed at creation via pm create\";\n\n/** Public contract for pm core required subdirs, shared by SDK and presentation-layer consumers. */\nexport const PM_CORE_REQUIRED_SUBDIRS = [\n \"\",\n \"epics\",\n \"features\",\n \"tasks\",\n \"chores\",\n \"issues\",\n \"schema\",\n \"history\",\n \"search\",\n \"extensions\",\n \"locks\",\n] as const;\n\n/** Public contract for pm optional type subdirs, shared by SDK and presentation-layer consumers. */\nexport const PM_OPTIONAL_TYPE_SUBDIRS = [\n \"decisions\",\n \"events\",\n \"reminders\",\n \"milestones\",\n \"meetings\",\n \"plans\",\n] as const;\n\n/** Public contract for pm required subdirs, shared by SDK and presentation-layer consumers. */\nexport const PM_REQUIRED_SUBDIRS = [\n ...PM_CORE_REQUIRED_SUBDIRS,\n ...PM_OPTIONAL_TYPE_SUBDIRS,\n] as const;\n\n/** Public contract for type to folder, shared by SDK and presentation-layer consumers. */\nexport const TYPE_TO_FOLDER: Record<BuiltinItemType, string> = {\n Epic: \"epics\",\n Feature: \"features\",\n Task: \"tasks\",\n Chore: \"chores\",\n Issue: \"issues\",\n Decision: \"decisions\",\n Event: \"events\",\n Reminder: \"reminders\",\n Milestone: \"milestones\",\n Meeting: \"meetings\",\n Plan: \"plans\",\n};\n\n/** Public contract for item metadata key order, shared by SDK and presentation-layer consumers. */\nexport const ITEM_METADATA_KEY_ORDER: ReadonlyArray<string> = [\n \"id\",\n \"title\",\n \"description\",\n \"type\",\n \"pm_format_version\",\n \"source_type\",\n \"type_options\",\n \"status\",\n \"priority\",\n \"tags\",\n \"created_at\",\n \"updated_at\",\n \"deadline\",\n \"reminders\",\n \"events\",\n \"closed_at\",\n \"assignee\",\n \"source_owner\",\n \"author\",\n \"estimated_minutes\",\n \"acceptance_criteria\",\n \"design\",\n \"external_ref\",\n \"definition_of_ready\",\n \"order\",\n \"goal\",\n \"objective\",\n \"value\",\n \"impact\",\n \"outcome\",\n \"why_now\",\n \"parent\",\n \"reviewer\",\n \"risk\",\n \"confidence\",\n \"sprint\",\n \"release\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n \"reporter\",\n \"severity\",\n \"environment\",\n \"repro_steps\",\n \"resolution\",\n \"expected_result\",\n \"actual_result\",\n \"affected_version\",\n \"fixed_version\",\n \"component\",\n \"regression\",\n \"customer_impact\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"close_reason\",\n \"duplicate_of\",\n \"plan_mode\",\n \"plan_scope\",\n \"plan_harness\",\n \"plan_resume_context\",\n \"plan_validation\",\n \"plan_decisions\",\n \"plan_discoveries\",\n \"plan_steps\",\n];\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\n\n/** Public contract for governance preset defaults, shared by SDK and presentation-layer consumers. */\nexport const GOVERNANCE_PRESET_DEFAULTS: Record<\n BuiltinGovernancePreset,\n Omit<GovernanceSettings, \"preset\">\n> = {\n minimal: {\n ownership_enforcement: \"none\",\n create_mode_default: \"progressive\",\n close_validation_default: \"off\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: false,\n },\n default: {\n ownership_enforcement: \"warn\",\n create_mode_default: \"progressive\",\n close_validation_default: \"warn\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: true,\n },\n strict: {\n ownership_enforcement: \"strict\",\n create_mode_default: \"strict\",\n close_validation_default: \"strict\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"strict\",\n force_required_for_stale_lock: true,\n },\n};\n\n/** Fallback validate stale blocker reason patterns used when callers do not provide an override. */\nexport const DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS = [\n \"no active blocker\",\n \"ready for planned execution sequencing\",\n \"work completed\",\n \"work is closed\",\n] as const;\n\n/** Fallback validate closure like metadata field patterns used when callers do not provide an override. */\nexport const DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS = {\n blocked_reason: [\n \"no active blocker because work is closed\",\n \"work is closed\",\n ],\n resolution: [\n \"closed with implementation evidence\",\n \"closed with verification evidence\",\n \"work completed and recorded\",\n \"work is closed\",\n ],\n actual_result: [\n \"closed and recorded\",\n \"work completed\",\n \"work completed and recorded\",\n ],\n} as const;\n\nfunction cloneOptionalArray<T>(\n values: readonly T[] | undefined,\n): T[] | undefined {\n return values ? [...values] : undefined;\n}\n\n/** Public contract for settings defaults, shared by SDK and presentation-layer consumers. */\nexport const SETTINGS_DEFAULTS: PmSettings = {\n version: 1,\n id_prefix: \"pm-\",\n ids: {\n token_length: 4,\n },\n author_default: \"\",\n item_format: \"toon\",\n locks: {\n ttl_seconds: 1800,\n wait_ms: 3000,\n },\n checkpoints: {\n retention_days: 14,\n },\n output: {\n default_format: \"toon\",\n },\n history: {\n missing_stream: \"auto_create\",\n compact_policy: {\n enabled: false,\n max_entries: 500,\n trigger: \"health_warn\",\n },\n },\n validation: {\n sprint_release_format: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n metadata_required_fields: [],\n lifecycle_stale_blocker_reason_patterns: [\n ...DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS,\n ],\n lifecycle_closure_like_blocked_reason_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.blocked_reason,\n ],\n lifecycle_closure_like_resolution_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.resolution,\n ],\n lifecycle_closure_like_actual_result_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.actual_result,\n ],\n estimate_defaults_by_type: {},\n },\n governance: {\n preset: \"minimal\",\n ...GOVERNANCE_PRESET_DEFAULTS.minimal,\n },\n workflow: {\n definition_of_done: [],\n },\n testing: {\n record_results_to_items: false,\n },\n telemetry: {\n enabled: true,\n first_run_prompt_completed: false,\n capture_level: \"redacted\",\n endpoint: \"https://pm-cli.unbrained.dev/v1/events\",\n installation_id: \"\",\n retention_days: 365,\n },\n agent_guidance: {\n prompt_completed: false,\n declined: false,\n declined_at: \"\",\n template_version: 1,\n last_checked_files: [],\n },\n item_types: {\n definitions: [],\n },\n schema: {\n version: 1,\n files: {\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n },\n statuses: DEFAULT_STATUS_DEFINITIONS.map((definition) => ({\n ...definition,\n aliases: cloneOptionalArray(definition.aliases),\n roles: cloneOptionalArray(definition.roles),\n })),\n fields: [],\n workflow: { ...DEFAULT_WORKFLOW_DEFINITION },\n unknown_field_policy: \"allow\",\n },\n extensions: {\n enabled: [],\n disabled: [],\n policy: createDefaultExtensionGovernancePolicy(),\n },\n search: {\n score_threshold: 0,\n hybrid_semantic_weight: 0.7,\n max_results: 50,\n embedding_model: \"\",\n embedding_batch_size: 32,\n embedding_timeout_ms: 30_000,\n scanner_max_batch_retries: 3,\n provider: \"\",\n mutation_refresh_policy: \"semantic_configured\",\n query_expansion: {\n enabled: false,\n provider: \"\",\n },\n rerank: {\n enabled: false,\n model: \"\",\n top_k: 20,\n },\n },\n providers: {\n openai: {\n base_url: \"\",\n api_key: \"\",\n model: \"\",\n },\n ollama: {\n base_url: \"\",\n model: \"\",\n },\n },\n context: {\n default_depth: \"brief\",\n activity_limit: 10,\n stale_threshold_days: 7,\n sections: {\n hierarchy: true,\n activity: true,\n progress: true,\n recently_created: true,\n unparented: true,\n blockers: true,\n files: true,\n workload: true,\n staleness: true,\n tests: true,\n },\n },\n vector_store: {\n adapter: \"\",\n collection_name: \"pm_items\",\n qdrant: {\n url: \"\",\n api_key: \"\",\n },\n lancedb: {\n path: \"\",\n },\n },\n};\n\n/** Public contract for empty canonical document, shared by SDK and presentation-layer consumers. */\nexport const EMPTY_CANONICAL_DOCUMENT = {\n metadata: {},\n body: \"\",\n};\n\n/** Public contract for exit code, shared by SDK and presentation-layer consumers. */\nexport const EXIT_CODE = {\n SUCCESS: 0,\n GENERIC_FAILURE: 1,\n USAGE: 2,\n NOT_FOUND: 3,\n CONFLICT: 4,\n DEPENDENCY_FAILED: 5,\n} as const;\n\n/** Restricts telemetry error category values accepted by command, SDK, and storage contracts. */\nexport type TelemetryErrorCategory =\n | \"usage\"\n | \"validation\"\n | \"conflict\"\n | \"runtime\"\n | \"unknown\";\n\n/** Public contract for telemetry error category by code, shared by SDK and presentation-layer consumers. */\nexport const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<\n Record<string, TelemetryErrorCategory>\n> = Object.freeze({\n unknown_command: \"usage\",\n unknown_option: \"usage\",\n missing_required_option: \"usage\",\n missing_required_argument: \"usage\",\n invalid_command_usage: \"usage\",\n linked_test_value_not_quoted: \"usage\",\n invalid_argument_value: \"validation\",\n health_findings: \"validation\",\n validation_findings: \"validation\",\n close_through_update: \"validation\",\n no_update_fields: \"validation\",\n unsupported_update_option: \"validation\",\n tracker_not_initialized: \"validation\",\n item_not_found: \"validation\",\n ownership_conflict: \"conflict\",\n lock_conflict: \"conflict\",\n terminal_state_conflict: \"conflict\",\n dependency_failed: \"runtime\",\n command_failed: \"runtime\",\n unknown_error: \"runtime\",\n});\n\n/** Implements resolve telemetry error category for the public runtime surface of this module. */\nexport function resolveTelemetryErrorCategory(\n errorCode: string | undefined,\n): TelemetryErrorCategory {\n const normalized = (errorCode ?? \"\").trim().toLowerCase();\n if (normalized.length === 0) {\n return \"unknown\";\n }\n const explicit = TELEMETRY_ERROR_CATEGORY_BY_CODE[normalized];\n if (typeof explicit === \"string\") {\n return explicit;\n }\n if (normalized.includes(\"conflict\") || normalized.includes(\"locked\")) {\n return \"conflict\";\n }\n if (\n normalized.startsWith(\"unknown_\") ||\n normalized.startsWith(\"missing_required_\")\n ) {\n return \"usage\";\n }\n if (\n normalized.startsWith(\"invalid_\") ||\n normalized.endsWith(\"_not_found\") ||\n normalized.includes(\"validation\")\n ) {\n return \"validation\";\n }\n if (normalized.endsWith(\"_error\") || normalized.endsWith(\"_failed\")) {\n return \"runtime\";\n }\n return \"unknown\";\n}\n"],"names":[],"mappings":";;AAcA,OAAO,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,MAAM,CAAC,MAAM,CAAC;IACZ;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,CAAC,OAAO,CAAC;KACjB;IACD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC;KAClC;IACD;QACE,EAAE,EAAE,aAAa;QACjB,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,KAAK,EAAE,CAAC,QAAQ,CAAC;KAClB;IACD;QACE,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,CAAC,SAAS,CAAC;KACnB;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,CAAC;KACtD;IACD;QACE,EAAE,EAAE,UAAU;QACd,OAAO,EAAE,CAAC,WAAW,CAAC;QACtB,KAAK,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,CAAC;KAC3D;CACF,CAAC,CAAC;AAEL,iFAAiF;AACjF,MAAM,CAAC,MAAM,2BAA2B,GACtC,MAAM,CAAC,MAAM,CAAC;IACZ,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,MAAM;IACnB,kBAAkB,EAAE,aAAa;IACjC,cAAc,EAAE,SAAS;IACzB,YAAY,EAAE,QAAQ;IACtB,eAAe,EAAE,UAAU;CAC5B,CAAC,CAAC;AAEL,sFAAsF;AACtF,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD,sUAAsU;AACtU,MAAM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OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IACE,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;QACjC,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAC1C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IACE,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EACjC,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","debugId":"54677a0e-1944-5c10-bfa9-2840cb3630cd"}
1
+ {"version":3,"file":"constants.js","sources":["core/shared/constants.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/shared/constants\n *\n * Provides shared primitives and utilities for Constants.\n */\nimport type {\n BuiltinItemType,\n GovernancePreset,\n GovernanceSettings,\n ItemMetadata,\n PmSettings,\n RuntimeStatusDefinition,\n RuntimeWorkflowDefinition,\n} from \"../../types/index.js\";\nimport { createDefaultExtensionGovernancePolicy } from \"../extensions/extension-types.js\";\n\n/**\n * Canonical default lifecycle status model and workflow role mapping.\n *\n * Single source of truth: `SETTINGS_DEFAULTS.schema` references these, and\n * `src/core/schema/runtime-schema.ts` re-exports them as\n * `DEFAULT_RUNTIME_STATUS_DEFINITIONS` / `DEFAULT_RUNTIME_WORKFLOW`.\n */\nexport const DEFAULT_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> =\n Object.freeze([\n {\n id: \"draft\",\n roles: [\"draft\"],\n },\n {\n id: \"open\",\n roles: [\"active\", \"default_open\"],\n },\n {\n id: \"in_progress\",\n aliases: [\"in-progress\"],\n roles: [\"active\"],\n },\n {\n id: \"blocked\",\n roles: [\"blocked\"],\n },\n {\n id: \"closed\",\n roles: [\"terminal\", \"terminal_done\", \"default_close\"],\n },\n {\n id: \"canceled\",\n aliases: [\"cancelled\"],\n roles: [\"terminal\", \"terminal_canceled\", \"default_cancel\"],\n },\n ]);\n\n/** Fallback workflow definition used when callers do not provide an override. */\nexport const DEFAULT_WORKFLOW_DEFINITION: RuntimeWorkflowDefinition =\n Object.freeze({\n draft_status: \"draft\",\n open_status: \"open\",\n in_progress_status: \"in_progress\",\n blocked_status: \"blocked\",\n close_status: \"closed\",\n canceled_status: \"canceled\",\n });\n\n/** Public contract for pm dirname, shared by SDK and presentation-layer consumers. */\nexport const PM_DIRNAME = \".agents/pm\";\n/** Public contract for settings filename, shared by SDK and presentation-layer consumers. */\nexport const SETTINGS_FILENAME = \"settings.json\";\n\n/** GH-249: placeholder close reason recorded when `pm create --status closed` lands an item directly in the close status under `governance.require_close_reason` and no --message/--resolution text is available. Mirrors `pm update --status closed`'s \"Closed via pm update\" default so all three closure paths record a reason. */\nexport const CREATE_DIRECT_CLOSE_REASON_DEFAULT =\n \"Closed at creation via pm create\";\n\n/** Public contract for pm core required subdirs, shared by SDK and presentation-layer consumers. */\nexport const PM_CORE_REQUIRED_SUBDIRS = [\n \"\",\n \"epics\",\n \"features\",\n \"tasks\",\n \"chores\",\n \"issues\",\n \"schema\",\n \"history\",\n \"search\",\n \"extensions\",\n \"locks\",\n] as const;\n\n/** Public contract for pm optional type subdirs, shared by SDK and presentation-layer consumers. */\nexport const PM_OPTIONAL_TYPE_SUBDIRS = [\n \"decisions\",\n \"events\",\n \"reminders\",\n \"milestones\",\n \"meetings\",\n \"plans\",\n] as const;\n\n/** Public contract for pm required subdirs, shared by SDK and presentation-layer consumers. */\nexport const PM_REQUIRED_SUBDIRS = [\n ...PM_CORE_REQUIRED_SUBDIRS,\n ...PM_OPTIONAL_TYPE_SUBDIRS,\n] as const;\n\n/** Public contract for type to folder, shared by SDK and presentation-layer consumers. */\nexport const TYPE_TO_FOLDER: Record<BuiltinItemType, string> = {\n Epic: \"epics\",\n Feature: \"features\",\n Task: \"tasks\",\n Chore: \"chores\",\n Issue: \"issues\",\n Decision: \"decisions\",\n Event: \"events\",\n Reminder: \"reminders\",\n Milestone: \"milestones\",\n Meeting: \"meetings\",\n Plan: \"plans\",\n};\n\n/** Portable project-context fields shared by storage order and structured mutation IO. */\nexport const ITEM_PROJECT_CONTEXT_KEYS = [\n \"goal\",\n \"objective\",\n \"value\",\n \"impact\",\n \"outcome\",\n \"why_now\",\n \"parent\",\n \"reviewer\",\n \"risk\",\n \"confidence\",\n \"sprint\",\n \"release\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n \"reporter\",\n \"severity\",\n \"environment\",\n \"repro_steps\",\n \"resolution\",\n \"expected_result\",\n \"actual_result\",\n] as const;\n\n/** Public contract for item metadata key order, shared by SDK and presentation-layer consumers. */\nexport const ITEM_METADATA_KEY_ORDER: ReadonlyArray<string> = [\n \"id\",\n \"title\",\n \"description\",\n \"type\",\n \"pm_format_version\",\n \"source_type\",\n \"type_options\",\n \"status\",\n \"priority\",\n \"tags\",\n \"created_at\",\n \"updated_at\",\n \"deadline\",\n \"reminders\",\n \"events\",\n \"closed_at\",\n \"assignee\",\n \"source_owner\",\n \"author\",\n \"estimated_minutes\",\n \"acceptance_criteria\",\n \"design\",\n \"external_ref\",\n \"definition_of_ready\",\n \"order\",\n ...ITEM_PROJECT_CONTEXT_KEYS,\n \"affected_version\",\n \"fixed_version\",\n \"component\",\n \"regression\",\n \"customer_impact\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"close_reason\",\n \"duplicate_of\",\n \"plan_mode\",\n \"plan_scope\",\n \"plan_harness\",\n \"plan_resume_context\",\n \"plan_validation\",\n \"plan_decisions\",\n \"plan_discoveries\",\n \"plan_steps\",\n];\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\n\n/** Public contract for governance preset defaults, shared by SDK and presentation-layer consumers. */\nexport const GOVERNANCE_PRESET_DEFAULTS: Record<\n BuiltinGovernancePreset,\n Omit<GovernanceSettings, \"preset\">\n> = {\n minimal: {\n ownership_enforcement: \"none\",\n create_mode_default: \"progressive\",\n close_validation_default: \"off\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: false,\n },\n default: {\n ownership_enforcement: \"warn\",\n create_mode_default: \"progressive\",\n close_validation_default: \"warn\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: true,\n },\n strict: {\n ownership_enforcement: \"strict\",\n create_mode_default: \"strict\",\n close_validation_default: \"strict\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"strict\",\n force_required_for_stale_lock: true,\n },\n};\n\n/** Fallback validate stale blocker reason patterns used when callers do not provide an override. */\nexport const DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS = [\n \"no active blocker\",\n \"ready for planned execution sequencing\",\n \"work completed\",\n \"work is closed\",\n] as const;\n\n/** Fallback validate closure like metadata field patterns used when callers do not provide an override. */\nexport const DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS = {\n blocked_reason: [\n \"no active blocker because work is closed\",\n \"work is closed\",\n ],\n resolution: [\n \"closed with implementation evidence\",\n \"closed with verification evidence\",\n \"work completed and recorded\",\n \"work is closed\",\n ],\n actual_result: [\n \"closed and recorded\",\n \"work completed\",\n \"work completed and recorded\",\n ],\n} as const;\n\nfunction cloneOptionalArray<T>(\n values: readonly T[] | undefined,\n): T[] | undefined {\n return values ? [...values] : undefined;\n}\n\n/** Public contract for settings defaults, shared by SDK and presentation-layer consumers. */\nexport const SETTINGS_DEFAULTS: PmSettings = {\n version: 1,\n id_prefix: \"pm-\",\n ids: {\n token_length: 4,\n },\n author_default: \"\",\n item_format: \"toon\",\n locks: {\n ttl_seconds: 1800,\n wait_ms: 3000,\n },\n checkpoints: {\n retention_days: 14,\n },\n output: {\n default_format: \"toon\",\n },\n history: {\n missing_stream: \"auto_create\",\n compact_policy: {\n enabled: false,\n max_entries: 500,\n trigger: \"health_warn\",\n },\n },\n validation: {\n sprint_release_format: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n metadata_required_fields: [],\n lifecycle_stale_blocker_reason_patterns: [\n ...DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS,\n ],\n lifecycle_closure_like_blocked_reason_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.blocked_reason,\n ],\n lifecycle_closure_like_resolution_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.resolution,\n ],\n lifecycle_closure_like_actual_result_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.actual_result,\n ],\n estimate_defaults_by_type: {},\n },\n governance: {\n preset: \"minimal\",\n ...GOVERNANCE_PRESET_DEFAULTS.minimal,\n },\n workflow: {\n definition_of_done: [],\n },\n testing: {\n record_results_to_items: false,\n },\n telemetry: {\n enabled: true,\n first_run_prompt_completed: false,\n capture_level: \"redacted\",\n endpoint: \"https://pm-cli.unbrained.dev/v1/events\",\n installation_id: \"\",\n retention_days: 365,\n },\n agent_guidance: {\n prompt_completed: false,\n declined: false,\n declined_at: \"\",\n template_version: 1,\n last_checked_files: [],\n },\n item_types: {\n definitions: [],\n },\n schema: {\n version: 1,\n files: {\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n },\n statuses: DEFAULT_STATUS_DEFINITIONS.map((definition) => ({\n ...definition,\n aliases: cloneOptionalArray(definition.aliases),\n roles: cloneOptionalArray(definition.roles),\n })),\n fields: [],\n workflow: { ...DEFAULT_WORKFLOW_DEFINITION },\n unknown_field_policy: \"allow\",\n },\n extensions: {\n enabled: [],\n disabled: [],\n policy: createDefaultExtensionGovernancePolicy(),\n },\n search: {\n score_threshold: 0,\n hybrid_semantic_weight: 0.7,\n max_results: 50,\n embedding_model: \"\",\n embedding_batch_size: 32,\n embedding_timeout_ms: 30_000,\n scanner_max_batch_retries: 3,\n provider: \"\",\n mutation_refresh_policy: \"semantic_configured\",\n query_expansion: {\n enabled: false,\n provider: \"\",\n },\n rerank: {\n enabled: false,\n model: \"\",\n top_k: 20,\n },\n },\n providers: {\n openai: {\n base_url: \"\",\n api_key: \"\",\n model: \"\",\n },\n ollama: {\n base_url: \"\",\n model: \"\",\n },\n },\n context: {\n default_depth: \"brief\",\n activity_limit: 10,\n stale_threshold_days: 7,\n sections: {\n hierarchy: true,\n activity: true,\n progress: true,\n recently_created: true,\n unparented: true,\n blockers: true,\n files: true,\n workload: true,\n staleness: true,\n tests: true,\n },\n },\n vector_store: {\n adapter: \"\",\n collection_name: \"pm_items\",\n qdrant: {\n url: \"\",\n api_key: \"\",\n },\n lancedb: {\n path: \"\",\n },\n },\n};\n\n/** Public contract for empty canonical document, shared by SDK and presentation-layer consumers. */\nexport const EMPTY_CANONICAL_DOCUMENT = {\n metadata: {},\n body: \"\",\n};\n\n/** Public contract for exit code, shared by SDK and presentation-layer consumers. */\nexport const EXIT_CODE = {\n SUCCESS: 0,\n GENERIC_FAILURE: 1,\n USAGE: 2,\n NOT_FOUND: 3,\n CONFLICT: 4,\n DEPENDENCY_FAILED: 5,\n} as const;\n\n/** Restricts telemetry error category values accepted by command, SDK, and storage contracts. */\nexport type TelemetryErrorCategory =\n | \"usage\"\n | \"validation\"\n | \"conflict\"\n | \"runtime\"\n | \"unknown\";\n\n/** Public contract for telemetry error category by code, shared by SDK and presentation-layer consumers. */\nexport const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<\n Record<string, TelemetryErrorCategory>\n> = Object.freeze({\n unknown_command: \"usage\",\n unknown_option: \"usage\",\n missing_required_option: \"usage\",\n missing_required_argument: \"usage\",\n invalid_command_usage: \"usage\",\n linked_test_value_not_quoted: \"usage\",\n invalid_argument_value: \"validation\",\n health_findings: \"validation\",\n validation_findings: \"validation\",\n close_through_update: \"validation\",\n no_update_fields: \"validation\",\n unsupported_update_option: \"validation\",\n tracker_not_initialized: \"validation\",\n item_not_found: \"validation\",\n ownership_conflict: \"conflict\",\n lock_conflict: \"conflict\",\n terminal_state_conflict: \"conflict\",\n dependency_failed: \"runtime\",\n merge_git_config_unwritable: \"runtime\",\n command_failed: \"runtime\",\n unknown_error: \"runtime\",\n});\n\n/** Implements resolve telemetry error category for the public runtime surface of this module. */\nexport function resolveTelemetryErrorCategory(\n errorCode: string | undefined,\n): TelemetryErrorCategory {\n const normalized = (errorCode ?? \"\").trim().toLowerCase();\n if (normalized.length === 0) {\n return \"unknown\";\n }\n const explicit = TELEMETRY_ERROR_CATEGORY_BY_CODE[normalized];\n if (typeof explicit === \"string\") {\n return explicit;\n }\n if (normalized.includes(\"conflict\") || normalized.includes(\"locked\")) {\n return \"conflict\";\n }\n if (\n normalized.startsWith(\"unknown_\") ||\n normalized.startsWith(\"missing_required_\")\n ) {\n return \"usage\";\n }\n if (\n normalized.startsWith(\"invalid_\") ||\n normalized.endsWith(\"_not_found\") ||\n normalized.includes(\"validation\")\n ) {\n return \"validation\";\n }\n if (normalized.endsWith(\"_error\") || normalized.endsWith(\"_failed\")) {\n return \"runtime\";\n }\n return \"unknown\";\n}\n"],"names":[],"mappings":";;AAcA,OAAO,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,MAAM,CAAC,MAAM,CAAC;IACZ;QACE,EAAE,EAAE,OAAO;QACX,K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E,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;QACjC,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAC1C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IACE,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EACjC,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","debugId":"3f35f57d-c4cd-5508-8860-c6bcd0d56eeb"}
@@ -1,4 +1,6 @@
1
1
  import type { ItemDocument, ItemFormat, ItemMetadata, RuntimeSchemaSettings } from "../../types/index.js";
2
+ /** Minimum item count at which derived-index mutations use cross-process locking. */
3
+ export declare const DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS = 500;
2
4
  /** Heavy "collection" item-metadata fields. These arrays dominate the on-disk cache (e.g. a single item's comment thread can be hundreds of KB) yet the hot list path (`pm list`, stats, deps, activity, calendar, close) never reads them. They are stored in a separate collections cache that is parsed only when a caller opts in (`includeCollections`), keeping the always-loaded light cache an order of magnitude smaller and its JSON.parse correspondingly cheaper. */
3
5
  export declare const HEAVY_METADATA_KEYS: readonly ["comments", "notes", "learnings", "files", "tests", "test_runs", "docs"];
4
6
  /** Documents the cached document candidate payload exchanged by command, SDK, and package integrations. */
@@ -32,6 +34,35 @@ export declare function clearItemMetadataEnvelopeMemo(): void;
32
34
  export declare function shouldReplaceCachedDocumentCandidate(existingFormat: ItemFormat, candidateFormat: ItemFormat, preferredFormat: ItemFormat | undefined): boolean;
33
35
  /** Decide whether a scanned candidate should be recorded for its item id. An unseen id is always recorded; duplicate ids delegate to the deterministic cross-format preference rule. Keeping the short-circuit in this pure helper makes both outcomes testable without relying on filesystem enumeration or concurrent read completion order. */
34
36
  export declare function shouldRecordCachedDocumentCandidate(existingFormat: ItemFormat | undefined, candidateFormat: ItemFormat, preferredFormat: ItemFormat | undefined): boolean;
37
+ /** Acquire the cross-process derived-index writer lock when an index exists. */
38
+ export declare function acquireItemMetadataDerivedIndexLock(pmRoot: string, author: string): Promise<() => Promise<void>>;
39
+ /** One authoritative item commit projected into the rebuildable index. */
40
+ export interface ItemMetadataDerivedIndexMutation {
41
+ /** Tracker root containing the derived cache. */
42
+ pmRoot: string;
43
+ /** Preferred item format folded into the cache schema fingerprint. */
44
+ preferredFormat: ItemFormat | undefined;
45
+ /** Runtime item-type folder mapping. */
46
+ typeToFolder: Record<string, string>;
47
+ /** Runtime schema folded into the cache schema fingerprint. */
48
+ schema: RuntimeSchemaSettings | undefined;
49
+ /** Committed item path, or deleted item path when document is null. */
50
+ itemPath: string;
51
+ /** Previous path removed by a format or type migration. */
52
+ previousItemPath?: string;
53
+ /** Committed document, or null for deletion. */
54
+ document: ItemDocument | null;
55
+ }
56
+ /**
57
+ * Project one already-committed authoritative item write into every compatible
58
+ * derived-index tier. Callers hold {@link acquireItemMetadataDerivedIndexLock}
59
+ * from before the item write until this function finishes, so independent pm
60
+ * mutations cannot publish a cursor that omits a concurrent write. One small
61
+ * atomic delta carries the shared source cursor and all tier projections, so
62
+ * mutation cost is bounded by changed items instead of total workspace size.
63
+ * Any refresh failure deletes the rebuildable cache so the next read scans.
64
+ */
65
+ export declare function refreshItemMetadataDerivedIndex(mutation: ItemMetadataDerivedIndexMutation): Promise<string[]>;
35
66
  /** Documents the list cache options payload exchanged by command, SDK, and package integrations. */
36
67
  export interface ListCacheOptions {
37
68
  /** When false, item bodies are neither loaded from nor written to the separate body cache. Metadata-only callers (`pm list`, stats, deps, activity, …) skip the large body cache entirely; only body consumers (search/reindex) pay for it. */
@@ -40,7 +71,7 @@ export interface ListCacheOptions {
40
71
  includeCollections?: boolean;
41
72
  /** Force canonical item enumeration and stat validation even when a fresh derived index is available. Validation, repair, migration, and equivalence tests use this correctness path. */
42
73
  forceSourceScan?: boolean;
43
- /** Minimum item count required before the directory-signature derived-index fast path is used. Defaults to 10,000 so small workspaces preserve per-file external-edit detection; tests and specialized SDK hosts may lower it explicitly. */
74
+ /** Minimum item count required before the directory-signature derived-index fast path is used. Defaults to 500 so small workspaces preserve per-file external-edit detection; tests and specialized SDK hosts may lower it explicitly. */
44
75
  derivedIndexMinimumItems?: number;
45
76
  }
46
77
  /**
@@ -4,21 +4,26 @@
4
4
  * Reads and writes tracker storage with format-aware helpers for the item metadata cache.
5
5
  */
6
6
 
7
- !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]="9af59769-ef30-5386-a290-593fe42d119f")}catch(e){}}();
7
+ !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]="b956bd21-1ad5-5d38-a03c-fe613b5a8aab")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
- import { createHash } from "node:crypto";
10
+ import { createHash, randomUUID } from "node:crypto";
11
11
  import { getActiveExtensionRegistrations, hasActiveOnReadHooks, runActiveOnReadHooks, } from "../extensions/index.js";
12
12
  import { collectRegisteredItemFieldNames } from "../extensions/item-fields.js";
13
13
  import { parseItemDocument } from "../item/item-format.js";
14
14
  import { evictOldestMemoEntries } from "../shared/memo.js";
15
15
  import { writeFileAtomic } from "../fs/fs-utils.js";
16
+ import { acquireLock } from "../lock/lock.js";
16
17
  import { ITEM_FILE_EXTENSIONS, getItemFormatFromPath } from "./paths.js";
17
- const CACHE_VERSION = 7;
18
- const DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS = 10_000;
18
+ const CACHE_VERSION = 8;
19
+ /** Minimum item count at which derived-index mutations use cross-process locking. */
20
+ export const DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS = 500;
21
+ const DERIVED_INDEX_LOCK_ID = "metadata-derived-index";
19
22
  const CACHE_FILENAME = "metadata-cache.json";
20
23
  const BODY_CACHE_FILENAME = "metadata-cache-bodies.json";
21
24
  const COLLECTIONS_CACHE_FILENAME = "metadata-cache-collections.json";
25
+ const DELTA_CACHE_FILENAME = "metadata-cache-delta.json";
26
+ const MANIFEST_CACHE_FILENAME = "metadata-cache-manifest.json";
22
27
  /** Heavy "collection" item-metadata fields. These arrays dominate the on-disk cache (e.g. a single item's comment thread can be hundreds of KB) yet the hot list path (`pm list`, stats, deps, activity, calendar, close) never reads them. They are stored in a separate collections cache that is parsed only when a caller opts in (`includeCollections`), keeping the always-loaded light cache an order of magnitude smaller and its JSON.parse correspondingly cheaper. */
23
28
  export const HEAVY_METADATA_KEYS = [
24
29
  "comments",
@@ -76,6 +81,12 @@ function getBodyCachePath(pmRoot) {
76
81
  function getCollectionsCachePath(pmRoot) {
77
82
  return path.join(pmRoot, "runtime", COLLECTIONS_CACHE_FILENAME);
78
83
  }
84
+ function getDeltaCachePath(pmRoot) {
85
+ return path.join(pmRoot, "runtime", DELTA_CACHE_FILENAME);
86
+ }
87
+ function getManifestCachePath(pmRoot) {
88
+ return path.join(pmRoot, "runtime", MANIFEST_CACHE_FILENAME);
89
+ }
79
90
  /**
80
91
  * In-process memo of parsed cache envelopes keyed by cache file path and validated
81
92
  * against the file's stat signature on every load. Commands that scan the corpus more
@@ -91,6 +102,70 @@ function getCollectionsCachePath(pmRoot) {
91
102
  */
92
103
  const ENVELOPE_MEMO_MAX_ENTRIES = 24;
93
104
  const envelopeMemo = new Map();
105
+ const projectedBaseCursor = new WeakMap();
106
+ function baseCursorFor(envelope) {
107
+ return projectedBaseCursor.get(envelope) ?? envelope.source_cursor;
108
+ }
109
+ function applyMetadataDelta(envelope, delta) {
110
+ const baseCursor = baseCursorFor(envelope);
111
+ if (delta.base_source_cursor !== baseCursor ||
112
+ envelope.source_cursor === delta.source_cursor) {
113
+ return;
114
+ }
115
+ projectedBaseCursor.set(envelope, baseCursor);
116
+ for (const [relativePath, change] of Object.entries(delta.changes)) {
117
+ if (change.entry)
118
+ envelope.entries[relativePath] = change.entry;
119
+ else
120
+ delete envelope.entries[relativePath];
121
+ }
122
+ envelope.directory_signatures = delta.directory_signatures;
123
+ envelope.source_cursor = delta.source_cursor;
124
+ }
125
+ function applyBodyDelta(envelope, delta) {
126
+ if (!envelope)
127
+ return;
128
+ const baseCursor = baseCursorFor(envelope);
129
+ if (delta.base_source_cursor !== baseCursor ||
130
+ envelope.source_cursor === delta.source_cursor) {
131
+ return;
132
+ }
133
+ projectedBaseCursor.set(envelope, baseCursor);
134
+ for (const [relativePath, change] of Object.entries(delta.changes)) {
135
+ if (change.body)
136
+ envelope.bodies[relativePath] = change.body;
137
+ else
138
+ delete envelope.bodies[relativePath];
139
+ }
140
+ envelope.source_cursor = delta.source_cursor;
141
+ }
142
+ function applyCollectionsDelta(envelope, delta) {
143
+ if (!envelope)
144
+ return;
145
+ const baseCursor = baseCursorFor(envelope);
146
+ if (delta.base_source_cursor !== baseCursor ||
147
+ envelope.source_cursor === delta.source_cursor) {
148
+ return;
149
+ }
150
+ projectedBaseCursor.set(envelope, baseCursor);
151
+ for (const [relativePath, change] of Object.entries(delta.changes)) {
152
+ if (change.collections)
153
+ envelope.collections[relativePath] = change.collections;
154
+ else
155
+ delete envelope.collections[relativePath];
156
+ }
157
+ envelope.source_cursor = delta.source_cursor;
158
+ }
159
+ function applyDerivedIndexDelta(metadata, bodies, collections, delta) {
160
+ if (!metadata ||
161
+ !delta ||
162
+ metadata.context_fingerprint !== delta.context_fingerprint) {
163
+ return;
164
+ }
165
+ applyMetadataDelta(metadata, delta);
166
+ applyBodyDelta(bodies, delta);
167
+ applyCollectionsDelta(collections, delta);
168
+ }
94
169
  function memoizeEnvelope(cachePath, entry) {
95
170
  if (envelopeMemo.size >= ENVELOPE_MEMO_MAX_ENTRIES &&
96
171
  !envelopeMemo.has(cachePath)) {
@@ -143,6 +218,7 @@ async function loadCache(pmRoot) {
143
218
  return await loadEnvelopeMemoized(getCachePath(pmRoot), (raw) => {
144
219
  const parsed = JSON.parse(raw);
145
220
  if (parsed.version !== CACHE_VERSION ||
221
+ typeof parsed.source_cursor !== "string" ||
146
222
  typeof parsed.entries !== "object" ||
147
223
  parsed.entries === null) {
148
224
  return null;
@@ -154,6 +230,7 @@ async function loadBodyCache(pmRoot) {
154
230
  return await loadEnvelopeMemoized(getBodyCachePath(pmRoot), (raw) => {
155
231
  const parsed = JSON.parse(raw);
156
232
  if (parsed.version !== CACHE_VERSION ||
233
+ typeof parsed.source_cursor !== "string" ||
157
234
  typeof parsed.bodies !== "object" ||
158
235
  parsed.bodies === null) {
159
236
  return null;
@@ -165,6 +242,7 @@ async function loadCollectionsCache(pmRoot) {
165
242
  return await loadEnvelopeMemoized(getCollectionsCachePath(pmRoot), (raw) => {
166
243
  const parsed = JSON.parse(raw);
167
244
  if (parsed.version !== CACHE_VERSION ||
245
+ typeof parsed.source_cursor !== "string" ||
168
246
  typeof parsed.collections !== "object" ||
169
247
  parsed.collections === null) {
170
248
  return null;
@@ -172,6 +250,53 @@ async function loadCollectionsCache(pmRoot) {
172
250
  return parsed;
173
251
  });
174
252
  }
253
+ async function loadDerivedIndexDelta(pmRoot) {
254
+ const deltaPath = getDeltaCachePath(pmRoot);
255
+ const envelope = await loadEnvelopeMemoized(deltaPath, (raw) => {
256
+ const parsed = JSON.parse(raw);
257
+ if (parsed.version !== CACHE_VERSION ||
258
+ typeof parsed.base_source_cursor !== "string" ||
259
+ typeof parsed.source_cursor !== "string" ||
260
+ typeof parsed.changes !== "object" ||
261
+ parsed.changes === null) {
262
+ return null;
263
+ }
264
+ return parsed;
265
+ });
266
+ if (envelope)
267
+ return { envelope, invalid: false };
268
+ try {
269
+ await fs.stat(deltaPath);
270
+ return { envelope: null, invalid: true };
271
+ }
272
+ catch {
273
+ return { envelope: null, invalid: false };
274
+ }
275
+ }
276
+ async function loadDerivedIndexManifest(pmRoot) {
277
+ const manifestPath = getManifestCachePath(pmRoot);
278
+ const manifest = await loadEnvelopeMemoized(manifestPath, (raw) => {
279
+ const parsed = JSON.parse(raw);
280
+ if (parsed.version !== CACHE_VERSION ||
281
+ typeof parsed.context_fingerprint !== "string" ||
282
+ typeof parsed.source_cursor !== "string" ||
283
+ !Number.isInteger(parsed.entry_count) ||
284
+ parsed.entry_count < 0) {
285
+ return null;
286
+ }
287
+ return parsed;
288
+ });
289
+ if (manifest)
290
+ return manifest;
291
+ try {
292
+ await fs.stat(manifestPath);
293
+ await removeDerivedIndexFiles(pmRoot);
294
+ }
295
+ catch {
296
+ // Missing manifests are the normal pre-index and small-workspace state.
297
+ }
298
+ return null;
299
+ }
175
300
  async function persistCache(cachePath, envelope) {
176
301
  await fs.mkdir(path.dirname(cachePath), { recursive: true });
177
302
  await writeFileAtomic(cachePath, JSON.stringify(envelope));
@@ -256,10 +381,7 @@ async function readDirectorySignature(pmRoot, folder) {
256
381
  ];
257
382
  }
258
383
  catch {
259
- return [
260
- folder,
261
- { exists: false, mtime_ms: 0, ctime_ms: 0, size: 0 },
262
- ];
384
+ return [folder, { exists: false, mtime_ms: 0, ctime_ms: 0, size: 0 }];
263
385
  }
264
386
  }
265
387
  async function readDirectorySignatures(pmRoot, folders) {
@@ -464,12 +586,24 @@ async function persistMetadataCacheIfNeeded(params) {
464
586
  params.existingCache.context_fingerprint === params.contextFingerprint) {
465
587
  return;
466
588
  }
467
- await persistCache(getCachePath(params.pmRoot), {
468
- version: CACHE_VERSION,
469
- context_fingerprint: params.contextFingerprint,
470
- directory_signatures: params.directorySignatures,
471
- entries: params.state.newEntries,
472
- }).catch(() => { });
589
+ try {
590
+ await persistCache(getCachePath(params.pmRoot), {
591
+ version: CACHE_VERSION,
592
+ context_fingerprint: params.contextFingerprint,
593
+ source_cursor: params.sourceCursor,
594
+ directory_signatures: params.directorySignatures,
595
+ entries: params.state.newEntries,
596
+ });
597
+ await persistCache(getManifestCachePath(params.pmRoot), {
598
+ version: CACHE_VERSION,
599
+ context_fingerprint: params.contextFingerprint,
600
+ source_cursor: params.sourceCursor,
601
+ entry_count: Object.keys(params.state.newEntries).length,
602
+ });
603
+ }
604
+ catch {
605
+ // Cache persistence is best-effort; authoritative item reads rebuild it.
606
+ }
473
607
  }
474
608
  async function persistBodyCacheIfNeeded(params) {
475
609
  const bodyDirty = params.state.misses.body ||
@@ -483,6 +617,7 @@ async function persistBodyCacheIfNeeded(params) {
483
617
  await persistCache(getBodyCachePath(params.pmRoot), {
484
618
  version: CACHE_VERSION,
485
619
  context_fingerprint: params.contextFingerprint,
620
+ source_cursor: params.sourceCursor,
486
621
  bodies: params.state.newBodies,
487
622
  }).catch(() => { });
488
623
  }
@@ -499,16 +634,135 @@ async function persistCollectionsCacheIfNeeded(params) {
499
634
  await persistCache(getCollectionsCachePath(params.pmRoot), {
500
635
  version: CACHE_VERSION,
501
636
  context_fingerprint: params.contextFingerprint,
637
+ source_cursor: params.sourceCursor,
502
638
  collections: params.state.newCollections,
503
639
  }).catch(() => { });
504
640
  }
641
+ /** Acquire the cross-process derived-index writer lock when an index exists. */
642
+ export async function acquireItemMetadataDerivedIndexLock(pmRoot, author) {
643
+ const cache = await loadDerivedIndexManifest(pmRoot);
644
+ if (cache === null ||
645
+ cache.entry_count < DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS) {
646
+ return async () => { };
647
+ }
648
+ return acquireLock(pmRoot, DERIVED_INDEX_LOCK_ID, 30, author, false, false, 3_000);
649
+ }
650
+ function relativeIndexPath(pmRoot, itemPath) {
651
+ const relative = path.relative(pmRoot, itemPath);
652
+ return relative === "" ||
653
+ relative === ".." ||
654
+ relative.startsWith(`..${path.sep}`) ||
655
+ path.isAbsolute(relative)
656
+ ? null
657
+ : relative;
658
+ }
659
+ async function removeDerivedIndexFiles(pmRoot) {
660
+ await Promise.all([
661
+ getCachePath(pmRoot),
662
+ getBodyCachePath(pmRoot),
663
+ getCollectionsCachePath(pmRoot),
664
+ getDeltaCachePath(pmRoot),
665
+ getManifestCachePath(pmRoot),
666
+ ].map(async (cachePath) => {
667
+ await fs.rm(cachePath, { force: true });
668
+ envelopeMemo.delete(cachePath);
669
+ }));
670
+ }
671
+ async function createDerivedIndexDeltaChange(params) {
672
+ if (params.mutation.document === null) {
673
+ return { entry: null, body: null, collections: null };
674
+ }
675
+ const stat = await fs.stat(params.mutation.itemPath);
676
+ const split = splitHeavyMetadata(params.mutation.document.metadata);
677
+ const signature = {
678
+ mtime_ms: stat.mtimeMs,
679
+ ctime_ms: stat.ctimeMs,
680
+ size: stat.size,
681
+ };
682
+ return {
683
+ entry: {
684
+ ...signature,
685
+ metadata: split.light,
686
+ body_length: params.mutation.document.body.length,
687
+ },
688
+ body: { ...signature, body: params.mutation.document.body },
689
+ collections: {
690
+ ...signature,
691
+ collections: split.heavy,
692
+ },
693
+ };
694
+ }
695
+ function selectDerivedIndexDeltaChanges(delta, contextFingerprint, baseSourceCursor) {
696
+ return delta?.context_fingerprint === contextFingerprint &&
697
+ delta.base_source_cursor === baseSourceCursor
698
+ ? structuredClone(delta.changes)
699
+ : {};
700
+ }
701
+ /**
702
+ * Project one already-committed authoritative item write into every compatible
703
+ * derived-index tier. Callers hold {@link acquireItemMetadataDerivedIndexLock}
704
+ * from before the item write until this function finishes, so independent pm
705
+ * mutations cannot publish a cursor that omits a concurrent write. One small
706
+ * atomic delta carries the shared source cursor and all tier projections, so
707
+ * mutation cost is bounded by changed items instead of total workspace size.
708
+ * Any refresh failure deletes the rebuildable cache so the next read scans.
709
+ */
710
+ export async function refreshItemMetadataDerivedIndex(mutation) {
711
+ const relativePath = relativeIndexPath(mutation.pmRoot, mutation.itemPath);
712
+ const previousRelativePath = mutation.previousItemPath
713
+ ? relativeIndexPath(mutation.pmRoot, mutation.previousItemPath)
714
+ : undefined;
715
+ if (relativePath === null || previousRelativePath === null) {
716
+ await removeDerivedIndexFiles(mutation.pmRoot);
717
+ return ["metadata_derived_index_path_invalidated"];
718
+ }
719
+ try {
720
+ const contextFingerprint = computeContextFingerprint(mutation.preferredFormat, mutation.typeToFolder, mutation.schema, resolveActiveExtensionFieldNames());
721
+ const existingCache = await loadDerivedIndexManifest(mutation.pmRoot);
722
+ if (existingCache === null ||
723
+ existingCache.context_fingerprint !== contextFingerprint) {
724
+ return [];
725
+ }
726
+ const baseSourceCursor = existingCache.source_cursor;
727
+ const delta = await loadDerivedIndexDelta(mutation.pmRoot);
728
+ if (delta.invalid) {
729
+ await removeDerivedIndexFiles(mutation.pmRoot);
730
+ return ["metadata_derived_index_refresh_failed"];
731
+ }
732
+ const changes = selectDerivedIndexDeltaChanges(delta.envelope, contextFingerprint, baseSourceCursor);
733
+ if (previousRelativePath !== undefined) {
734
+ changes[previousRelativePath] = {
735
+ entry: null,
736
+ body: null,
737
+ collections: null,
738
+ };
739
+ }
740
+ changes[relativePath] = await createDerivedIndexDeltaChange({ mutation });
741
+ await persistCache(getDeltaCachePath(mutation.pmRoot), {
742
+ version: CACHE_VERSION,
743
+ context_fingerprint: contextFingerprint,
744
+ base_source_cursor: baseSourceCursor,
745
+ source_cursor: randomUUID(),
746
+ directory_signatures: await readDirectorySignatures(mutation.pmRoot, [
747
+ ...new Set(Object.values(mutation.typeToFolder)),
748
+ ]),
749
+ changes,
750
+ });
751
+ return [];
752
+ }
753
+ catch {
754
+ await removeDerivedIndexFiles(mutation.pmRoot).catch(() => { });
755
+ return ["metadata_derived_index_refresh_failed"];
756
+ }
757
+ }
505
758
  function sortedCachedDocumentCandidates(state) {
506
759
  return [...state.documentsById.values()]
507
760
  .sort((left, right) => left.candidate.metadata.id.localeCompare(right.candidate.metadata.id))
508
761
  .map((entry) => entry.candidate);
509
762
  }
510
- function cacheTierMatchesContext(envelope, contextFingerprint) {
511
- return envelope?.context_fingerprint === contextFingerprint;
763
+ function cacheTierMatchesContext(envelope, contextFingerprint, sourceCursor) {
764
+ return (envelope?.context_fingerprint === contextFingerprint &&
765
+ envelope.source_cursor === sourceCursor);
512
766
  }
513
767
  function hasEveryDerivedIndexPart(keys, includeBody, includeCollections, previousBodies, previousCollections) {
514
768
  return keys.every((key) => (!includeBody || previousBodies[key] !== undefined) &&
@@ -553,9 +807,9 @@ function canUseDerivedIndex(params) {
553
807
  }
554
808
  const requiredTiersMatch = [
555
809
  !params.includeBody ||
556
- cacheTierMatchesContext(params.existingBodyCache, params.contextFingerprint),
810
+ cacheTierMatchesContext(params.existingBodyCache, params.contextFingerprint, params.existingCache.source_cursor),
557
811
  !params.includeCollections ||
558
- cacheTierMatchesContext(params.existingCollectionsCache, params.contextFingerprint),
812
+ cacheTierMatchesContext(params.existingCollectionsCache, params.contextFingerprint, params.existingCache.source_cursor),
559
813
  ];
560
814
  return (requiredTiersMatch.every(Boolean) &&
561
815
  hasEveryDerivedIndexPart(params.entryKeys, params.includeBody, params.includeCollections, params.previousBodies, params.previousCollections));
@@ -575,13 +829,17 @@ export async function listAllDocumentCandidatesCached(pmRoot, preferredFormat, t
575
829
  const includeCollections = options.includeCollections !== false;
576
830
  const extensionFieldNames = resolveActiveExtensionFieldNames();
577
831
  const contextFingerprint = computeContextFingerprint(preferredFormat, typeToFolder, schema, extensionFieldNames);
832
+ const delta = await loadDerivedIndexDelta(pmRoot);
833
+ if (delta.invalid)
834
+ await removeDerivedIndexFiles(pmRoot);
578
835
  const existingCache = await loadCache(pmRoot);
579
- const previousEntries = selectPreviousMetadataEntries(existingCache, contextFingerprint);
580
836
  const existingBodyCache = includeBody ? await loadBodyCache(pmRoot) : null;
581
- const previousBodies = selectPreviousBodyEntries(existingBodyCache, contextFingerprint);
582
837
  const existingCollectionsCache = includeCollections
583
838
  ? await loadCollectionsCache(pmRoot)
584
839
  : null;
840
+ applyDerivedIndexDelta(existingCache, existingBodyCache, existingCollectionsCache, delta.envelope);
841
+ const previousEntries = selectPreviousMetadataEntries(existingCache, contextFingerprint);
842
+ const previousBodies = selectPreviousBodyEntries(existingBodyCache, contextFingerprint);
585
843
  const previousCollections = selectPreviousCollectionEntries(existingCollectionsCache, contextFingerprint);
586
844
  const folders = [...new Set(Object.values(typeToFolder))];
587
845
  const directorySignaturesBefore = await readDirectorySignatures(pmRoot, folders);
@@ -633,11 +891,19 @@ export async function listAllDocumentCandidatesCached(pmRoot, preferredFormat, t
633
891
  const stableDirectorySignatures = directorySignaturesMatch(directorySignaturesBefore, directorySignaturesAfter)
634
892
  ? directorySignaturesAfter
635
893
  : {};
894
+ const metadataChanged = state.misses.metadata ||
895
+ Object.keys(previousEntries).length !==
896
+ Object.keys(state.newEntries).length ||
897
+ !directorySignaturesMatch(existingCache?.directory_signatures, stableDirectorySignatures);
898
+ const sourceCursor = metadataChanged || existingCache === null
899
+ ? randomUUID()
900
+ : existingCache.source_cursor;
636
901
  // Rewrite a cache file only when its contents changed: any re-parsed (missing or
637
902
  // stale) entry, or a different set of keys (additions/deletions).
638
903
  await persistMetadataCacheIfNeeded({
639
904
  pmRoot,
640
905
  contextFingerprint,
906
+ sourceCursor,
641
907
  existingCache,
642
908
  previousEntries,
643
909
  directorySignatures: stableDirectorySignatures,
@@ -647,6 +913,7 @@ export async function listAllDocumentCandidatesCached(pmRoot, preferredFormat, t
647
913
  await persistBodyCacheIfNeeded({
648
914
  pmRoot,
649
915
  contextFingerprint,
916
+ sourceCursor,
650
917
  existingBodyCache,
651
918
  previousBodies,
652
919
  state,
@@ -656,6 +923,7 @@ export async function listAllDocumentCandidatesCached(pmRoot, preferredFormat, t
656
923
  await persistCollectionsCacheIfNeeded({
657
924
  pmRoot,
658
925
  contextFingerprint,
926
+ sourceCursor,
659
927
  existingCollectionsCache,
660
928
  previousCollections,
661
929
  state,
@@ -690,4 +958,4 @@ export async function listAllDocumentsCachedLight(pmRoot, preferredFormat, typeT
690
958
  }));
691
959
  }
692
960
  //# sourceMappingURL=item-metadata-cache.js.map
693
- //# debugId=9af59769-ef30-5386-a290-593fe42d119f
961
+ //# debugId=b956bd21-1ad5-5d38-a03c-fe613b5a8aab