prjct-cli 3.96.0 → 3.97.0

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 (503) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/bin/prjct.cjs +14 -0
  3. package/dist/bin/core-chunks/agent-HCP5FF77.mjs +31 -0
  4. package/dist/bin/core-chunks/agent-codenames-7N4DU62I.mjs +7 -0
  5. package/dist/bin/core-chunks/agent-identity-4KFRR5OU.mjs +7 -0
  6. package/dist/bin/core-chunks/agent-runtime-registry-3RMVBEV2.mjs +7 -0
  7. package/dist/bin/core-chunks/agent-switch-AVSX6SLY.mjs +7 -0
  8. package/dist/bin/core-chunks/agents-OAQXBGH3.mjs +10 -0
  9. package/dist/bin/core-chunks/ai-provider-RVXK7D7R.mjs +7 -0
  10. package/dist/bin/core-chunks/analysis-3A7ODSSI.mjs +41 -0
  11. package/dist/bin/core-chunks/auth-config-KWLVKHCY.mjs +7 -0
  12. package/dist/bin/core-chunks/auto-flush-EWSVMKQN.mjs +7 -0
  13. package/dist/bin/core-chunks/auto-updater-PKYQRBGQ.mjs +8 -0
  14. package/dist/bin/core-chunks/bin-commands-LLHG2NSY.mjs +21 -0
  15. package/dist/bin/core-chunks/capture-7LQ52T6L.mjs +7 -0
  16. package/dist/bin/core-chunks/capture-gate-M4HM7WAI.mjs +7 -0
  17. package/dist/bin/core-chunks/ceremonies-4OZ3FKRE.mjs +19 -0
  18. package/dist/bin/core-chunks/changelog-CUNVCEL5.mjs +10 -0
  19. package/dist/bin/core-chunks/chunk-225DWS4D.mjs +7 -0
  20. package/dist/bin/core-chunks/chunk-24EN5Y62.mjs +48 -0
  21. package/dist/bin/core-chunks/chunk-2EEMQV7N.mjs +9 -0
  22. package/dist/bin/core-chunks/chunk-2I5PUQWY.mjs +7 -0
  23. package/dist/bin/core-chunks/chunk-2JJM3YMW.mjs +44 -0
  24. package/dist/bin/core-chunks/chunk-2NI4EEK2.mjs +8 -0
  25. package/dist/bin/core-chunks/chunk-2TJRTFIS.mjs +9 -0
  26. package/dist/bin/core-chunks/chunk-2ZPM4Z6W.mjs +17 -0
  27. package/dist/bin/core-chunks/chunk-3FXNIJCS.mjs +8 -0
  28. package/dist/bin/core-chunks/chunk-3JD6KRNJ.mjs +8 -0
  29. package/dist/bin/core-chunks/chunk-3TRXQAU4.mjs +7 -0
  30. package/dist/bin/core-chunks/chunk-3USVY66O.mjs +7 -0
  31. package/dist/bin/core-chunks/chunk-45LKWJ5D.mjs +7 -0
  32. package/dist/bin/core-chunks/chunk-4IE7LRH3.mjs +7 -0
  33. package/dist/bin/core-chunks/chunk-4MR5XSLO.mjs +8 -0
  34. package/dist/bin/core-chunks/chunk-4PPIE6GA.mjs +102 -0
  35. package/dist/bin/core-chunks/chunk-4PRD4EU2.mjs +7 -0
  36. package/dist/bin/core-chunks/chunk-4T7NGLNQ.mjs +16 -0
  37. package/dist/bin/core-chunks/chunk-53ZPEZLU.mjs +8 -0
  38. package/dist/bin/core-chunks/chunk-56FW4P6U.mjs +10 -0
  39. package/dist/bin/core-chunks/chunk-5EF5EOCL.mjs +7 -0
  40. package/dist/bin/core-chunks/chunk-5MN22JFI.mjs +19 -0
  41. package/dist/bin/core-chunks/chunk-5ONMON5L.mjs +13 -0
  42. package/dist/bin/core-chunks/chunk-5UUITMRX.mjs +9 -0
  43. package/dist/bin/core-chunks/chunk-5YLI5V3Q.mjs +8 -0
  44. package/dist/bin/core-chunks/chunk-5YSPND5J.mjs +9 -0
  45. package/dist/bin/core-chunks/chunk-623SNKDH.mjs +7 -0
  46. package/dist/bin/core-chunks/chunk-6AFXUX2M.mjs +9 -0
  47. package/dist/bin/core-chunks/chunk-6FFOWWH2.mjs +17 -0
  48. package/dist/bin/core-chunks/chunk-6FUCOGOW.mjs +7 -0
  49. package/dist/bin/core-chunks/chunk-6OYLZ4NM.mjs +10 -0
  50. package/dist/bin/core-chunks/chunk-6P4GMVUZ.mjs +18 -0
  51. package/dist/bin/core-chunks/chunk-6RT2P22O.mjs +7 -0
  52. package/dist/bin/core-chunks/chunk-6XTLPAPZ.mjs +15 -0
  53. package/dist/bin/core-chunks/chunk-76YMLNLF.mjs +7 -0
  54. package/dist/bin/core-chunks/chunk-7CI4AMVO.mjs +7 -0
  55. package/dist/bin/core-chunks/chunk-7QMBIMEX.mjs +64 -0
  56. package/dist/bin/core-chunks/chunk-7QTE6X4J.mjs +7 -0
  57. package/dist/bin/core-chunks/chunk-7ZHWJSW5.mjs +8 -0
  58. package/dist/bin/core-chunks/chunk-AJTBFIH2.mjs +9 -0
  59. package/dist/bin/core-chunks/chunk-AJXELVNH.mjs +7 -0
  60. package/dist/bin/core-chunks/chunk-ANVCA6LF.mjs +7 -0
  61. package/dist/bin/core-chunks/chunk-AS3LWTQ4.mjs +16 -0
  62. package/dist/bin/core-chunks/chunk-B7AQHL7B.mjs +7 -0
  63. package/dist/bin/core-chunks/chunk-BQKDJ3U6.mjs +8 -0
  64. package/dist/bin/core-chunks/chunk-BSR3XUBD.mjs +24 -0
  65. package/dist/bin/core-chunks/chunk-BTCCUMKI.mjs +12 -0
  66. package/dist/bin/core-chunks/chunk-BTSHD3XJ.mjs +9 -0
  67. package/dist/bin/core-chunks/chunk-C35JQUWD.mjs +8 -0
  68. package/dist/bin/core-chunks/chunk-C7YBUD4K.mjs +10 -0
  69. package/dist/bin/core-chunks/chunk-CDLZLTRY.mjs +10 -0
  70. package/dist/bin/core-chunks/chunk-CEOTHJIY.mjs +10 -0
  71. package/dist/bin/core-chunks/chunk-CFD6CW7T.mjs +46 -0
  72. package/dist/bin/core-chunks/chunk-CKYBGRCF.mjs +8 -0
  73. package/dist/bin/core-chunks/chunk-CNWEQUB7.mjs +7 -0
  74. package/dist/bin/core-chunks/chunk-CUIB6CTG.mjs +20 -0
  75. package/dist/bin/core-chunks/chunk-CWLGRKA7.mjs +6 -0
  76. package/dist/bin/core-chunks/chunk-CXNVDJNN.mjs +7 -0
  77. package/dist/bin/core-chunks/chunk-D62TAZG6.mjs +9 -0
  78. package/dist/bin/core-chunks/chunk-DCVPNFS4.mjs +8 -0
  79. package/dist/bin/core-chunks/chunk-DEYAQEF5.mjs +7 -0
  80. package/dist/bin/core-chunks/chunk-DIEPWXJJ.mjs +7 -0
  81. package/dist/bin/core-chunks/chunk-DMO3ZFUG.mjs +1259 -0
  82. package/dist/bin/core-chunks/chunk-DN46DLU3.mjs +10 -0
  83. package/dist/bin/core-chunks/chunk-DOJPSIMG.mjs +7 -0
  84. package/dist/bin/core-chunks/chunk-DZVOFEM5.mjs +7 -0
  85. package/dist/bin/core-chunks/chunk-E5QQDYBR.mjs +7 -0
  86. package/dist/bin/core-chunks/chunk-E73HSXCX.mjs +7 -0
  87. package/dist/bin/core-chunks/chunk-EFSPBB4S.mjs +8 -0
  88. package/dist/bin/core-chunks/chunk-EHVU2SMR.mjs +34 -0
  89. package/dist/bin/core-chunks/chunk-ESB4ALH2.mjs +7 -0
  90. package/dist/bin/core-chunks/chunk-EZRNQXCC.mjs +7 -0
  91. package/dist/bin/core-chunks/chunk-F2FKQUYE.mjs +19 -0
  92. package/dist/bin/core-chunks/chunk-F7OOBAJO.mjs +30 -0
  93. package/dist/bin/core-chunks/chunk-FATYLG3L.mjs +14 -0
  94. package/dist/bin/core-chunks/chunk-FOWTB762.mjs +7 -0
  95. package/dist/bin/core-chunks/chunk-GDLAQV3Q.mjs +14 -0
  96. package/dist/bin/core-chunks/chunk-GGGDYL4P.mjs +7 -0
  97. package/dist/bin/core-chunks/chunk-GHSRH4GL.mjs +8 -0
  98. package/dist/bin/core-chunks/chunk-GOIBJ7PV.mjs +7 -0
  99. package/dist/bin/core-chunks/chunk-GSNQKBHZ.mjs +11 -0
  100. package/dist/bin/core-chunks/chunk-GTG67Z45.mjs +11 -0
  101. package/dist/bin/core-chunks/chunk-H2KNJUPN.mjs +23 -0
  102. package/dist/bin/core-chunks/chunk-HCPQZRR3.mjs +7 -0
  103. package/dist/bin/core-chunks/chunk-HEXSVBUP.mjs +8 -0
  104. package/dist/bin/core-chunks/chunk-HPCSSJXH.mjs +7 -0
  105. package/dist/bin/core-chunks/chunk-HU5ERAAV.mjs +8 -0
  106. package/dist/bin/core-chunks/chunk-HYIT7MF5.mjs +8 -0
  107. package/dist/bin/core-chunks/chunk-HYMJVHAX.mjs +13 -0
  108. package/dist/bin/core-chunks/chunk-ID2C2S33.mjs +18 -0
  109. package/dist/bin/core-chunks/chunk-ID5KE74L.mjs +7 -0
  110. package/dist/bin/core-chunks/chunk-IFLBZKKK.mjs +14 -0
  111. package/dist/bin/core-chunks/chunk-IMQCXC3R.mjs +30 -0
  112. package/dist/bin/core-chunks/chunk-INJ5WT2D.mjs +7 -0
  113. package/dist/bin/core-chunks/chunk-INM5COWM.mjs +7 -0
  114. package/dist/bin/core-chunks/chunk-IOFCSTGM.mjs +7 -0
  115. package/dist/bin/core-chunks/chunk-IVGWOY3U.mjs +8 -0
  116. package/dist/bin/core-chunks/chunk-J7T5IEFJ.mjs +15 -0
  117. package/dist/bin/core-chunks/chunk-JCWA7NLM.mjs +7 -0
  118. package/dist/bin/core-chunks/chunk-JPMUJY42.mjs +7 -0
  119. package/dist/bin/core-chunks/chunk-JT4RNQ67.mjs +15 -0
  120. package/dist/bin/core-chunks/chunk-K25HGTC3.mjs +10 -0
  121. package/dist/bin/core-chunks/chunk-KIRU4QFX.mjs +7 -0
  122. package/dist/bin/core-chunks/chunk-KKIJAEYU.mjs +7 -0
  123. package/dist/bin/core-chunks/chunk-KPR5TWSN.mjs +7 -0
  124. package/dist/bin/core-chunks/chunk-KUQLXY2P.mjs +11 -0
  125. package/dist/bin/core-chunks/chunk-KWC2PCPC.mjs +10 -0
  126. package/dist/bin/core-chunks/chunk-L4TUXFCL.mjs +7 -0
  127. package/dist/bin/core-chunks/chunk-L5LFLI4R.mjs +7 -0
  128. package/dist/bin/core-chunks/chunk-LZC6NGB6.mjs +50 -0
  129. package/dist/bin/core-chunks/chunk-MCY7OXED.mjs +10 -0
  130. package/dist/bin/core-chunks/chunk-MDONTD7O.mjs +21 -0
  131. package/dist/bin/core-chunks/chunk-MG3YN3AI.mjs +7 -0
  132. package/dist/bin/core-chunks/chunk-MR5XXHRK.mjs +8 -0
  133. package/dist/bin/core-chunks/chunk-MTDCRYLP.mjs +7 -0
  134. package/dist/bin/core-chunks/chunk-MXJKULJY.mjs +9 -0
  135. package/dist/bin/core-chunks/chunk-NINFE7GS.mjs +9 -0
  136. package/dist/bin/core-chunks/chunk-NNOX3UU4.mjs +7 -0
  137. package/dist/bin/core-chunks/chunk-NOHSLOLL.mjs +7 -0
  138. package/dist/bin/core-chunks/chunk-NXUIMC22.mjs +13 -0
  139. package/dist/bin/core-chunks/chunk-NZKUCQZK.mjs +8 -0
  140. package/dist/bin/core-chunks/chunk-O5N6XYPU.mjs +8 -0
  141. package/dist/bin/core-chunks/chunk-OIE3AKKO.mjs +7 -0
  142. package/dist/bin/core-chunks/chunk-OYXQRBVM.mjs +10 -0
  143. package/dist/bin/core-chunks/chunk-P2KU4FFA.mjs +11 -0
  144. package/dist/bin/core-chunks/chunk-P53YMOKR.mjs +7 -0
  145. package/dist/bin/core-chunks/chunk-PIA26GWG.mjs +7 -0
  146. package/dist/bin/core-chunks/chunk-PPERWRFS.mjs +13 -0
  147. package/dist/bin/core-chunks/chunk-PPSVWUXC.mjs +15 -0
  148. package/dist/bin/core-chunks/chunk-PWL3KS7Y.mjs +7 -0
  149. package/dist/bin/core-chunks/chunk-Q3LUL6LL.mjs +7 -0
  150. package/dist/bin/core-chunks/chunk-Q6C27OL7.mjs +7 -0
  151. package/dist/bin/core-chunks/chunk-QAIEAOJF.mjs +7 -0
  152. package/dist/bin/core-chunks/chunk-QLMZW4K7.mjs +7 -0
  153. package/dist/bin/core-chunks/chunk-QZ7T2EYR.mjs +25 -0
  154. package/dist/bin/core-chunks/chunk-R7LLMJDP.mjs +7 -0
  155. package/dist/bin/core-chunks/chunk-RACISWUV.mjs +10 -0
  156. package/dist/bin/core-chunks/chunk-RCIWCKL7.mjs +9 -0
  157. package/dist/bin/core-chunks/chunk-ROOCBUKH.mjs +8 -0
  158. package/dist/bin/core-chunks/chunk-RP7F67ZT.mjs +7 -0
  159. package/dist/bin/core-chunks/chunk-RXXXA7Z6.mjs +7 -0
  160. package/dist/bin/core-chunks/chunk-RXZJB43D.mjs +7 -0
  161. package/dist/bin/core-chunks/chunk-S6FBPXQL.mjs +9 -0
  162. package/dist/bin/core-chunks/chunk-SLYLGDX7.mjs +8 -0
  163. package/dist/bin/core-chunks/chunk-SO3ZPNWT.mjs +7 -0
  164. package/dist/bin/core-chunks/chunk-SRJEX6XF.mjs +12 -0
  165. package/dist/bin/core-chunks/chunk-SROBBOJB.mjs +11 -0
  166. package/dist/bin/core-chunks/chunk-TDTPDVUM.mjs +8 -0
  167. package/dist/bin/core-chunks/chunk-TGNZI4KF.mjs +28 -0
  168. package/dist/bin/core-chunks/chunk-TIBYHZFA.mjs +8 -0
  169. package/dist/bin/core-chunks/chunk-TILUQF6L.mjs +8 -0
  170. package/dist/bin/core-chunks/chunk-TTN2CFZC.mjs +7 -0
  171. package/dist/bin/core-chunks/chunk-U24YKPYX.mjs +7 -0
  172. package/dist/bin/core-chunks/chunk-U55OPVYR.mjs +9 -0
  173. package/dist/bin/core-chunks/chunk-UE3XKXWM.mjs +7 -0
  174. package/dist/bin/core-chunks/chunk-UHXV7MDW.mjs +12 -0
  175. package/dist/bin/core-chunks/chunk-UNNY2IWZ.mjs +9 -0
  176. package/dist/bin/core-chunks/chunk-UT425KVX.mjs +10 -0
  177. package/dist/bin/core-chunks/chunk-UYMZ3NAF.mjs +8 -0
  178. package/dist/bin/core-chunks/chunk-V3Y3G2DE.mjs +8 -0
  179. package/dist/bin/core-chunks/chunk-V5VCXMKO.mjs +52 -0
  180. package/dist/bin/core-chunks/chunk-V6L5PLD7.mjs +18 -0
  181. package/dist/bin/core-chunks/chunk-V7R3L54M.mjs +7 -0
  182. package/dist/bin/core-chunks/chunk-V7VA4EQX.mjs +7 -0
  183. package/dist/bin/core-chunks/chunk-VCSESVZ4.mjs +9 -0
  184. package/dist/bin/core-chunks/chunk-VCYVYFWE.mjs +9 -0
  185. package/dist/bin/core-chunks/chunk-VDXTMAMO.mjs +7 -0
  186. package/dist/bin/core-chunks/chunk-VILH3VYH.mjs +103 -0
  187. package/dist/bin/core-chunks/chunk-VRFYDYQY.mjs +7 -0
  188. package/dist/bin/core-chunks/chunk-VWFVSNQT.mjs +7 -0
  189. package/dist/bin/core-chunks/chunk-WGDE3L33.mjs +7 -0
  190. package/dist/bin/core-chunks/chunk-WP5IU4W4.mjs +7 -0
  191. package/dist/bin/core-chunks/chunk-WSVMQYYU.mjs +12 -0
  192. package/dist/bin/core-chunks/chunk-WTDUJB4I.mjs +8 -0
  193. package/dist/bin/core-chunks/chunk-WZXUFSVT.mjs +25 -0
  194. package/dist/bin/core-chunks/chunk-X35YYOFE.mjs +18 -0
  195. package/dist/bin/core-chunks/chunk-X4FR5S7E.mjs +9 -0
  196. package/dist/bin/core-chunks/chunk-XC6YAP36.mjs +7 -0
  197. package/dist/bin/core-chunks/chunk-XLFEWZRA.mjs +7 -0
  198. package/dist/bin/core-chunks/chunk-XPRLQIVQ.mjs +7 -0
  199. package/dist/bin/core-chunks/chunk-XSZG3CBO.mjs +7 -0
  200. package/dist/bin/core-chunks/chunk-XU3BQPBU.mjs +7 -0
  201. package/dist/bin/core-chunks/chunk-XYDLXF5A.mjs +8 -0
  202. package/dist/bin/core-chunks/chunk-Y5SEUYET.mjs +7 -0
  203. package/dist/bin/core-chunks/chunk-Y7XOKG4O.mjs +7 -0
  204. package/dist/bin/core-chunks/chunk-YEALP3WX.mjs +7 -0
  205. package/dist/bin/core-chunks/chunk-YJOC2JJK.mjs +12 -0
  206. package/dist/bin/core-chunks/chunk-YLYAYRSJ.mjs +8 -0
  207. package/dist/bin/core-chunks/chunk-YOGI4WE6.mjs +8 -0
  208. package/dist/bin/core-chunks/chunk-YQ6HM3YO.mjs +10 -0
  209. package/dist/bin/core-chunks/chunk-YZEO5DZA.mjs +7 -0
  210. package/dist/bin/core-chunks/chunk-ZBBNCCGV.mjs +12 -0
  211. package/dist/bin/core-chunks/chunk-ZHTYSYZC.mjs +7 -0
  212. package/dist/bin/core-chunks/chunk-ZK7BMUMR.mjs +7 -0
  213. package/dist/bin/core-chunks/chunk-ZKJZDOPT.mjs +14 -0
  214. package/dist/bin/core-chunks/chunk-ZQHSJ6FF.mjs +20 -0
  215. package/dist/bin/core-chunks/chunk-ZS7XJUPE.mjs +7 -0
  216. package/dist/bin/core-chunks/chunk-ZXTJLMVZ.mjs +7 -0
  217. package/dist/bin/core-chunks/cleanup-installs-WHXUGAHM.mjs +7 -0
  218. package/dist/bin/core-chunks/client-D43KKUYH.mjs +8 -0
  219. package/dist/bin/core-chunks/closest-command-YYNABM7V.mjs +7 -0
  220. package/dist/bin/core-chunks/cloud-FFUJZLDV.mjs +14 -0
  221. package/dist/bin/core-chunks/code-SU7GCPH6.mjs +12 -0
  222. package/dist/bin/core-chunks/code-graph-cloud-G3WQBICY.mjs +7 -0
  223. package/dist/bin/core-chunks/codex-hooks-GOLMCL2Q.mjs +7 -0
  224. package/dist/bin/core-chunks/codex-mcp-K4X2UIQF.mjs +7 -0
  225. package/dist/bin/core-chunks/codex-skill-3HNVU4T4.mjs +7 -0
  226. package/dist/bin/core-chunks/command-installer-XIQK2G6W.mjs +7 -0
  227. package/dist/bin/core-chunks/config-W3RHV3GK.mjs +8 -0
  228. package/dist/bin/core-chunks/config-manager-QVFHXIKI.mjs +7 -0
  229. package/dist/bin/core-chunks/content-bound-stamp-2PJNI4JC.mjs +7 -0
  230. package/dist/bin/core-chunks/context-4KGTUAC4.mjs +38 -0
  231. package/dist/bin/core-chunks/context-DDHC7VIC.mjs +10 -0
  232. package/dist/bin/core-chunks/context-checkpoint-4CEUPEVG.mjs +27 -0
  233. package/dist/bin/core-chunks/context-pressure-5URQVNBC.mjs +7 -0
  234. package/dist/bin/core-chunks/context-tiers-4S6H22NP.mjs +7 -0
  235. package/dist/bin/core-chunks/context7-service-AZWDYK5Z.mjs +7 -0
  236. package/dist/bin/core-chunks/core-PR5WEQCS.mjs +70 -0
  237. package/dist/bin/core-chunks/crew-JQCG6NS3.mjs +24 -0
  238. package/dist/bin/core-chunks/cursor-hooks-DGDJVAI6.mjs +7 -0
  239. package/dist/bin/core-chunks/custom-workflow-storage-EBEIG54R.mjs +7 -0
  240. package/dist/bin/core-chunks/cwd-changed-ODKZVSPB.mjs +7 -0
  241. package/dist/bin/core-chunks/cycle-budget-card-H37XRAIX.mjs +7 -0
  242. package/dist/bin/core-chunks/daemon-2NQTBFVR.mjs +13 -0
  243. package/dist/bin/core-chunks/database-UU2ZXSD4.mjs +7 -0
  244. package/dist/bin/core-chunks/delivery-geometry-GSJ6LXUC.mjs +7 -0
  245. package/dist/bin/core-chunks/detect-changes-2YIEX7AY.mjs +7 -0
  246. package/dist/bin/core-chunks/detection-KKDZYWVD.mjs +7 -0
  247. package/dist/bin/core-chunks/developer-evolution-AVAXGDKQ.mjs +11 -0
  248. package/dist/bin/core-chunks/developer-profile-MRPBWL2K.mjs +7 -0
  249. package/dist/bin/core-chunks/discuss-lock-CWXKBBYJ.mjs +7 -0
  250. package/dist/bin/core-chunks/distill-MLDZG5RA.mjs +7 -0
  251. package/dist/bin/core-chunks/doctor-heal-ZUZ2RHGY.mjs +7 -0
  252. package/dist/bin/core-chunks/doctor-service-WXLB2FEE.mjs +8 -0
  253. package/dist/bin/core-chunks/drift-refresh-XPJAO2B3.mjs +7 -0
  254. package/dist/bin/core-chunks/dynasty-outcomes-H2O546OL.mjs +11 -0
  255. package/dist/bin/core-chunks/editors-config-ELAQA6RV.mjs +7 -0
  256. package/dist/bin/core-chunks/embeddings-7A5Z5I67.mjs +7 -0
  257. package/dist/bin/core-chunks/enriched-recall-YXK7EIKH.mjs +7 -0
  258. package/dist/bin/core-chunks/eval-4YFUBFLV.mjs +76 -0
  259. package/dist/bin/core-chunks/exec-34V6SJYO.mjs +7 -0
  260. package/dist/bin/core-chunks/file-helper-LLQKU6YF.mjs +7 -0
  261. package/dist/bin/core-chunks/format-5V6GF6JJ.mjs +7 -0
  262. package/dist/bin/core-chunks/gemini-settings-ZTU3VQU3.mjs +7 -0
  263. package/dist/bin/core-chunks/git-context-ZSWE3KWM.mjs +8 -0
  264. package/dist/bin/core-chunks/git-helpers-UC53D4FT.mjs +7 -0
  265. package/dist/bin/core-chunks/grok-mcp-F3SRFMCW.mjs +7 -0
  266. package/dist/bin/core-chunks/grok-plugin-4CE2WUYI.mjs +7 -0
  267. package/dist/bin/core-chunks/grok-skill-GLSBOOKW.mjs +7 -0
  268. package/dist/bin/core-chunks/guard-FJBJ6IAE.mjs +13 -0
  269. package/dist/bin/core-chunks/guards-LFUFKVVH.mjs +7 -0
  270. package/dist/bin/core-chunks/handoff-storage-NGUA4Y2L.mjs +7 -0
  271. package/dist/bin/core-chunks/harness-FN3HASSA.mjs +43 -0
  272. package/dist/bin/core-chunks/health-W2VWME7Z.mjs +11 -0
  273. package/dist/bin/core-chunks/help-I37I3V2R.mjs +14 -0
  274. package/dist/bin/core-chunks/hooks-service-C2P5DRCH.mjs +91 -0
  275. package/dist/bin/core-chunks/infer-memory-file-ATP7PSAQ.mjs +7 -0
  276. package/dist/bin/core-chunks/install-XP4S6HWQ.mjs +9 -0
  277. package/dist/bin/core-chunks/judgment-GJE332LF.mjs +21 -0
  278. package/dist/bin/core-chunks/judgment-ledger-storage-ZTYXPMM4.mjs +7 -0
  279. package/dist/bin/core-chunks/judgment-orchestrator-E3SO3NVE.mjs +7 -0
  280. package/dist/bin/core-chunks/judgment-receipt-WT4EMCAV.mjs +7 -0
  281. package/dist/bin/core-chunks/kimi-hooks-2UEUIKXV.mjs +7 -0
  282. package/dist/bin/core-chunks/kimi-mcp-DJCXZ2JY.mjs +7 -0
  283. package/dist/bin/core-chunks/land-cue-5USQ64MS.mjs +8 -0
  284. package/dist/bin/core-chunks/land-rho-ISNVEPVC.mjs +8 -0
  285. package/dist/bin/core-chunks/land-synthesis-CHARJMUP.mjs +7 -0
  286. package/dist/bin/core-chunks/lean-L53CKZNH.mjs +34 -0
  287. package/dist/bin/core-chunks/legacy-crew-sweep-2TLKJTHI.mjs +23 -0
  288. package/dist/bin/core-chunks/living-context-contract-HZIVBMXX.mjs +7 -0
  289. package/dist/bin/core-chunks/llm-XMH7WTHV.mjs +18 -0
  290. package/dist/bin/core-chunks/mcp-FLVIZBV2.mjs +17 -0
  291. package/dist/bin/core-chunks/memory-dream-EJWI4FJO.mjs +14 -0
  292. package/dist/bin/core-chunks/memory-export-27HTNNFI.mjs +13 -0
  293. package/dist/bin/core-chunks/memory-index-BRZDZ2BY.mjs +7 -0
  294. package/dist/bin/core-chunks/notification-KJ4FQJAW.mjs +7 -0
  295. package/dist/bin/core-chunks/notify-76B7AICZ.mjs +9 -0
  296. package/dist/bin/core-chunks/nyquist-lite-A23B7G4B.mjs +9 -0
  297. package/dist/bin/core-chunks/one-breath-install-LVNIVN6S.mjs +7 -0
  298. package/dist/bin/core-chunks/opencode-mcp-5YSIYDI3.mjs +7 -0
  299. package/dist/bin/core-chunks/output-D27IOQXR.mjs +7 -0
  300. package/dist/bin/core-chunks/pack-integrity-GXN67LJB.mjs +9 -0
  301. package/dist/bin/core-chunks/pack-manager-46SPIPPD.mjs +7 -0
  302. package/dist/bin/core-chunks/package-DCGCOAGQ.mjs +7 -0
  303. package/dist/bin/core-chunks/package-legitimacy-VHHGI4P7.mjs +7 -0
  304. package/dist/bin/core-chunks/path-manager-E5DCU5LP.mjs +7 -0
  305. package/dist/bin/core-chunks/performance-tracker-BFBNR3LY.mjs +7 -0
  306. package/dist/bin/core-chunks/pi-skill-SDHTUK3V.mjs +7 -0
  307. package/dist/bin/core-chunks/planning-S3MYVWH6.mjs +8 -0
  308. package/dist/bin/core-chunks/post-edit-5YSNEMK7.mjs +7 -0
  309. package/dist/bin/core-chunks/pr-convention-37YHTUKM.mjs +7 -0
  310. package/dist/bin/core-chunks/pre-bash-GLDILCRF.mjs +10 -0
  311. package/dist/bin/core-chunks/pre-commit-U6HPPNIC.mjs +7 -0
  312. package/dist/bin/core-chunks/pre-edit-PEYQA6P6.mjs +8 -0
  313. package/dist/bin/core-chunks/pre-package-76JR5GLO.mjs +7 -0
  314. package/dist/bin/core-chunks/pre-search-5EHNUOP3.mjs +8 -0
  315. package/dist/bin/core-chunks/pre-secrets-RJELPDFY.mjs +7 -0
  316. package/dist/bin/core-chunks/precision-classifier-AV75OEVA.mjs +7 -0
  317. package/dist/bin/core-chunks/precision-judgment-MCX4MIIG.mjs +7 -0
  318. package/dist/bin/core-chunks/preferences-BTSYWYUM.mjs +31 -0
  319. package/dist/bin/core-chunks/primitives-IXAYLX7U.mjs +13 -0
  320. package/dist/bin/core-chunks/prjct-md-SUDFWDCS.mjs +7 -0
  321. package/dist/bin/core-chunks/product-KKGJ6MMF.mjs +68 -0
  322. package/dist/bin/core-chunks/project-agent-surfaces-I2CUZUIN.mjs +7 -0
  323. package/dist/bin/core-chunks/project-alignment-ADKW3ZWQ.mjs +17 -0
  324. package/dist/bin/core-chunks/project-file-inventory-XIHHJZUP.mjs +7 -0
  325. package/dist/bin/core-chunks/project-memory-GYLYIJQD.mjs +7 -0
  326. package/dist/bin/core-chunks/project-style-evolution-5W25UPPN.mjs +7 -0
  327. package/dist/bin/core-chunks/prompt-SW5XDRMX.mjs +23 -0
  328. package/dist/bin/core-chunks/protocol-4AJ4J5SI.mjs +7 -0
  329. package/dist/bin/core-chunks/provider-cache-IWVTFLGT.mjs +7 -0
  330. package/dist/bin/core-chunks/provider-status-HQUBKMH5.mjs +7 -0
  331. package/dist/bin/core-chunks/publish-helper-2T2EHM3V.mjs +7 -0
  332. package/dist/bin/core-chunks/purge-5EPJV25P.mjs +7 -0
  333. package/dist/bin/core-chunks/queue-storage-BKH5XX2E.mjs +7 -0
  334. package/dist/bin/core-chunks/registry-LK6IQ5UX.mjs +7 -0
  335. package/dist/bin/core-chunks/reliability-repair-JMPZWDD4.mjs +20 -0
  336. package/dist/bin/core-chunks/removed-verbs-EU3WPRNK.mjs +7 -0
  337. package/dist/bin/core-chunks/retention-S22T3SPT.mjs +7 -0
  338. package/dist/bin/core-chunks/retro-CLKOHAN6.mjs +13 -0
  339. package/dist/bin/core-chunks/review-risk-LLLBKUXT.mjs +12 -0
  340. package/dist/bin/core-chunks/run-recorder-EZQ32M55.mjs +7 -0
  341. package/dist/bin/core-chunks/safe-artifacts-RW5WQUUJ.mjs +9 -0
  342. package/dist/bin/core-chunks/sdd-HE7O6N5S.mjs +9 -0
  343. package/dist/bin/core-chunks/seed-JX7W53E5.mjs +10 -0
  344. package/dist/bin/core-chunks/self-heal-DFUEKNF3.mjs +7 -0
  345. package/dist/bin/core-chunks/session-continuity-BFSW4OL6.mjs +10 -0
  346. package/dist/bin/core-chunks/session-start-HVYUKJL2.mjs +7 -0
  347. package/dist/bin/core-chunks/session-tracker-RG2FBWMS.mjs +7 -0
  348. package/dist/bin/core-chunks/settings-installer-4XHM3HAZ.mjs +7 -0
  349. package/dist/bin/core-chunks/setup-GHS24ER5.mjs +140 -0
  350. package/dist/bin/core-chunks/setup-J4JFYT63.mjs +38 -0
  351. package/dist/bin/core-chunks/shipping-I4D4AVTE.mjs +12 -0
  352. package/dist/bin/core-chunks/signals-digest-V44KYN6Z.mjs +7 -0
  353. package/dist/bin/core-chunks/skill-adherence-MHY4BZL4.mjs +13 -0
  354. package/dist/bin/core-chunks/skill-generator-LKS5BNMY.mjs +7 -0
  355. package/dist/bin/core-chunks/skill-index-L4UWQCQE.mjs +11 -0
  356. package/dist/bin/core-chunks/spec-2XXPLHUZ.mjs +27 -0
  357. package/dist/bin/core-chunks/spec-context-inference-THFMXC7S.mjs +9 -0
  358. package/dist/bin/core-chunks/spec-inventory-2TT7BTFZ.mjs +9 -0
  359. package/dist/bin/core-chunks/spec-service-I23KJKKP.mjs +7 -0
  360. package/dist/bin/core-chunks/spec-task-breakdown-HTG6ME6G.mjs +7 -0
  361. package/dist/bin/core-chunks/state-storage-6CGFWW5D.mjs +7 -0
  362. package/dist/bin/core-chunks/stdin-spill-Y2A6WOOW.mjs +7 -0
  363. package/dist/bin/core-chunks/stop-2H57XCGZ.mjs +15 -0
  364. package/dist/bin/core-chunks/subagent-start-5LPASXOS.mjs +7 -0
  365. package/dist/bin/core-chunks/subagent-stop-ANLSG3KN.mjs +7 -0
  366. package/dist/bin/core-chunks/surface-attribution-WL7S53XX.mjs +7 -0
  367. package/dist/bin/core-chunks/symbol-graph-PCS43SHZ.mjs +7 -0
  368. package/dist/bin/core-chunks/sync-analyzer-M37Q4LE4.mjs +7 -0
  369. package/dist/bin/core-chunks/sync-client-6TAOTJWR.mjs +7 -0
  370. package/dist/bin/core-chunks/sync-cursor-storage-GKO4X2QN.mjs +18 -0
  371. package/dist/bin/core-chunks/task-orchestration-GS4J4KGS.mjs +7 -0
  372. package/dist/bin/core-chunks/task-overview-XSMK7YEN.mjs +7 -0
  373. package/dist/bin/core-chunks/task-service-FK7FC3PE.mjs +7 -0
  374. package/dist/bin/core-chunks/tdd-NQDHU62B.mjs +9 -0
  375. package/dist/bin/core-chunks/team-XZ4Q6UBV.mjs +42 -0
  376. package/dist/bin/core-chunks/template-loader-33OVJ4G5.mjs +7 -0
  377. package/dist/bin/core-chunks/token-backfill-WPXXD5MP.mjs +12 -0
  378. package/dist/bin/core-chunks/token-economics-JZAQJUET.mjs +7 -0
  379. package/dist/bin/core-chunks/transcript-jsonl-OC7TH4Q3.mjs +7 -0
  380. package/dist/bin/core-chunks/trust-boundary-24F662RM.mjs +7 -0
  381. package/dist/bin/core-chunks/uninstall-6NFON7FO.mjs +13 -0
  382. package/dist/bin/core-chunks/update-4IE6SA6M.mjs +11 -0
  383. package/dist/bin/core-chunks/update-checker-FK7MWNWN.mjs +7 -0
  384. package/dist/bin/core-chunks/usefulness-A3GRKFL3.mjs +7 -0
  385. package/dist/bin/core-chunks/user-home-BODIAXR4.mjs +7 -0
  386. package/dist/bin/core-chunks/vault-retire-notice-FDRT7BJG.mjs +8 -0
  387. package/dist/bin/core-chunks/velocity-storage-5T7RYOWH.mjs +7 -0
  388. package/dist/bin/core-chunks/verb-names-QWGYABFH.mjs +7 -0
  389. package/dist/bin/core-chunks/version-252QLBN2.mjs +7 -0
  390. package/dist/bin/core-chunks/watch-service-7ZERG7RC.mjs +9 -0
  391. package/dist/bin/core-chunks/weak-frontier-demo-5C4FR3OA.mjs +7 -0
  392. package/dist/bin/core-chunks/weak-model-mode-DH66XMD2.mjs +7 -0
  393. package/dist/bin/core-chunks/work-graph-JGJWE3AV.mjs +16 -0
  394. package/dist/bin/core-chunks/work-graph-WHMCFN6U.mjs +7 -0
  395. package/dist/bin/core-chunks/work-scope-3LXOEIUX.mjs +7 -0
  396. package/dist/bin/core-chunks/workflow-FGJVLRQ3.mjs +61 -0
  397. package/dist/bin/core-chunks/workflows-reference-UWKRZ6BJ.mjs +7 -0
  398. package/dist/bin/core-chunks/workspace-occupancy-JUXKZBUZ.mjs +7 -0
  399. package/dist/bin/core-chunks/worktree-service-YRRPFU57.mjs +11 -0
  400. package/dist/bin/core-chunks/world-model-impact-RH5WH2B3.mjs +7 -0
  401. package/dist/bin/hook-chunks/{agent-switch-I4MTVE56.mjs → agent-switch-7GOGG4KG.mjs} +1 -1
  402. package/dist/bin/hook-chunks/{analysis-VN7APBHR.mjs → analysis-UI2JRLJO.mjs} +2 -2
  403. package/dist/bin/hook-chunks/{auto-flush-DX3FVSQE.mjs → auto-flush-JKIXTI2I.mjs} +1 -1
  404. package/dist/bin/hook-chunks/{capture-gate-MEIQD7ZS.mjs → capture-gate-DIPHPNIC.mjs} +1 -1
  405. package/dist/bin/hook-chunks/chunk-25OGCQTR.mjs +69 -0
  406. package/dist/bin/hook-chunks/{chunk-OLQAMCYV.mjs → chunk-63P5VOR6.mjs} +5 -5
  407. package/dist/bin/hook-chunks/{chunk-EI6VQZOX.mjs → chunk-6LU777GI.mjs} +1 -1
  408. package/dist/bin/hook-chunks/chunk-6NMHVPAI.mjs +35 -0
  409. package/dist/bin/hook-chunks/{chunk-3AHW4XQH.mjs → chunk-6RS7PNAN.mjs} +1 -1
  410. package/dist/bin/hook-chunks/{chunk-ZZBNFNMG.mjs → chunk-6WDRJ7J7.mjs} +1 -1
  411. package/dist/bin/hook-chunks/{chunk-PVCEWFHS.mjs → chunk-7PA4KPSR.mjs} +2 -2
  412. package/dist/bin/hook-chunks/{chunk-EXVL2OFE.mjs → chunk-A6LRNS6R.mjs} +1 -1
  413. package/dist/bin/hook-chunks/{chunk-IJ523YO2.mjs → chunk-AEDB75AK.mjs} +1 -1
  414. package/dist/bin/hook-chunks/chunk-AFGXKRRP.mjs +12 -0
  415. package/dist/bin/hook-chunks/{chunk-LF3S3MYE.mjs → chunk-ANSRNEEI.mjs} +1 -1
  416. package/dist/bin/hook-chunks/{chunk-YLOK4WRR.mjs → chunk-B2ZA5ZAO.mjs} +1 -1
  417. package/dist/bin/hook-chunks/{chunk-KDNUQPAK.mjs → chunk-B7MHIUFA.mjs} +1 -1
  418. package/dist/bin/hook-chunks/{chunk-RT2DFIWF.mjs → chunk-F3PNT2DQ.mjs} +2 -2
  419. package/dist/bin/hook-chunks/{chunk-XYKVWO23.mjs → chunk-FBEDUKMG.mjs} +1 -1
  420. package/dist/bin/hook-chunks/{chunk-DB226JIV.mjs → chunk-GER6HFWV.mjs} +1 -1
  421. package/dist/bin/hook-chunks/{chunk-NLL5AV2G.mjs → chunk-HNZ24HIK.mjs} +2 -2
  422. package/dist/bin/hook-chunks/{chunk-LR24AIEW.mjs → chunk-IDPBMN3Q.mjs} +1 -1
  423. package/dist/bin/hook-chunks/{chunk-EGCYDLSO.mjs → chunk-IFIENAZU.mjs} +1 -1
  424. package/dist/bin/hook-chunks/{chunk-KV4NXLPT.mjs → chunk-IHEOOJJT.mjs} +1 -1
  425. package/dist/bin/hook-chunks/{chunk-H2DGDAQP.mjs → chunk-IL36ER4U.mjs} +1 -1
  426. package/dist/bin/hook-chunks/{chunk-33BHU4OM.mjs → chunk-JF6DFOQK.mjs} +1 -1
  427. package/dist/bin/hook-chunks/{chunk-LQLCYBFF.mjs → chunk-KOLXYWOA.mjs} +2 -2
  428. package/dist/bin/hook-chunks/{chunk-XV2LJVYB.mjs → chunk-MIJZT4ZR.mjs} +1 -1
  429. package/dist/bin/hook-chunks/{chunk-SWJ7TLBD.mjs → chunk-NMB6YSAH.mjs} +1 -1
  430. package/dist/bin/hook-chunks/{chunk-Y3RHBU2R.mjs → chunk-NSTXHVTH.mjs} +2 -2
  431. package/dist/bin/hook-chunks/{chunk-ADYTBOCZ.mjs → chunk-ONGVBXBD.mjs} +1 -1
  432. package/dist/bin/hook-chunks/{chunk-7PBWIO4K.mjs → chunk-PFORBQBF.mjs} +2 -2
  433. package/dist/bin/hook-chunks/{chunk-WL6PKX3U.mjs → chunk-PQJ64L6U.mjs} +1 -1
  434. package/dist/bin/hook-chunks/{chunk-FZS3XGEA.mjs → chunk-RLKYEL3F.mjs} +1 -1
  435. package/dist/bin/hook-chunks/{chunk-WJV24WE6.mjs → chunk-UBWUQ64A.mjs} +1 -1
  436. package/dist/bin/hook-chunks/{chunk-64ZEBHDX.mjs → chunk-UI25YRTY.mjs} +1 -1
  437. package/dist/bin/hook-chunks/{chunk-YHOZTAZH.mjs → chunk-V6GGH6H5.mjs} +1 -1
  438. package/dist/bin/hook-chunks/chunk-WIA6ORIY.mjs +16 -0
  439. package/dist/bin/hook-chunks/{chunk-UVATSTRF.mjs → chunk-XXVHUYL7.mjs} +1 -1
  440. package/dist/bin/hook-chunks/{chunk-E7NA34VQ.mjs → chunk-Y7RDBMNC.mjs} +1 -1
  441. package/dist/bin/hook-chunks/{chunk-JZDZH6IV.mjs → chunk-YATXTHDL.mjs} +1 -1
  442. package/dist/bin/hook-chunks/{chunk-DCHIPMOG.mjs → chunk-ZF2EVMY7.mjs} +1 -1
  443. package/dist/bin/hook-chunks/{chunk-MW54MTLB.mjs → chunk-ZH2MF7H7.mjs} +1 -1
  444. package/dist/bin/hook-chunks/{chunk-ZQI4TJ5C.mjs → chunk-ZXON2U5F.mjs} +1 -1
  445. package/dist/bin/hook-chunks/{codex-skill-6CRFUF3A.mjs → codex-skill-UZZCACMB.mjs} +1 -1
  446. package/dist/bin/hook-chunks/{command-installer-MUHZWDZA.mjs → command-installer-FJ73C2ZW.mjs} +1 -1
  447. package/dist/bin/hook-chunks/{config-manager-2JJPCLKC.mjs → config-manager-XDKOTIJM.mjs} +1 -1
  448. package/dist/bin/hook-chunks/{cwd-changed-UTD6Y4MS.mjs → cwd-changed-STP3LH6Y.mjs} +1 -1
  449. package/dist/bin/hook-chunks/{distill-5TNAM3LY.mjs → distill-63BHUJAC.mjs} +1 -1
  450. package/dist/bin/hook-chunks/{enriched-recall-6VOIUNLN.mjs → enriched-recall-6F6LBYAB.mjs} +1 -1
  451. package/dist/bin/hook-chunks/{format-IIOFTSBF.mjs → format-VJ2YQ4XQ.mjs} +1 -1
  452. package/dist/bin/hook-chunks/{judgment-receipt-QLV3MYFT.mjs → judgment-receipt-LSJCAYBT.mjs} +1 -1
  453. package/dist/bin/hook-chunks/{land-cue-57B23PEL.mjs → land-cue-DEO2AZW4.mjs} +1 -1
  454. package/dist/bin/hook-chunks/{land-synthesis-ZVPFJERV.mjs → land-synthesis-GTMFIGDM.mjs} +1 -1
  455. package/dist/bin/hook-chunks/{legacy-crew-sweep-GR6HRSHX.mjs → legacy-crew-sweep-QPKU7ITU.mjs} +2 -2
  456. package/dist/bin/hook-chunks/{memory-index-XE2MWKQS.mjs → memory-index-KCMXQGKX.mjs} +1 -1
  457. package/dist/bin/hook-chunks/{notification-GU2ZJP5K.mjs → notification-DX6ZHOUC.mjs} +1 -1
  458. package/dist/bin/hook-chunks/{pack-integrity-WV5U3AFF.mjs → pack-integrity-UMLIB5RQ.mjs} +1 -1
  459. package/dist/bin/hook-chunks/{pack-manager-QLFQKP24.mjs → pack-manager-YXRK2TJ4.mjs} +1 -1
  460. package/dist/bin/hook-chunks/{planning-VPAX5DZL.mjs → planning-JR7O5MYW.mjs} +2 -2
  461. package/dist/bin/hook-chunks/{post-edit-UXCFSR3Y.mjs → post-edit-IPTVSRVG.mjs} +1 -1
  462. package/dist/bin/hook-chunks/{pre-bash-MB4JNNYG.mjs → pre-bash-5WWTH36N.mjs} +1 -1
  463. package/dist/bin/hook-chunks/{pre-commit-U7TRFKWX.mjs → pre-commit-KZ5TNTPW.mjs} +1 -1
  464. package/dist/bin/hook-chunks/{pre-edit-MDCQXI5F.mjs → pre-edit-XHPYBXRU.mjs} +1 -1
  465. package/dist/bin/hook-chunks/{pre-package-A6ZI5R64.mjs → pre-package-U3HDW3SX.mjs} +1 -1
  466. package/dist/bin/hook-chunks/{pre-search-ZZO3LGXJ.mjs → pre-search-R5CRK66E.mjs} +1 -1
  467. package/dist/bin/hook-chunks/{prjct-md-MS52YLI2.mjs → prjct-md-IBQTJBK7.mjs} +1 -1
  468. package/dist/bin/hook-chunks/{project-agent-surfaces-6AIW7KL6.mjs → project-agent-surfaces-TPZO73ZV.mjs} +1 -1
  469. package/dist/bin/hook-chunks/{project-memory-UDH56VFP.mjs → project-memory-YQLZX5RG.mjs} +1 -1
  470. package/dist/bin/hook-chunks/{project-style-evolution-IJXT2MCP.mjs → project-style-evolution-NOFCIIZZ.mjs} +1 -1
  471. package/dist/bin/hook-chunks/{prompt-7VZLYONO.mjs → prompt-DJWONMTZ.mjs} +2 -2
  472. package/dist/bin/hook-chunks/{purge-N2WN6NDB.mjs → purge-5W3K2MZL.mjs} +1 -1
  473. package/dist/bin/hook-chunks/{retention-RET4P2RO.mjs → retention-GWJ4AX7I.mjs} +1 -1
  474. package/dist/bin/hook-chunks/{sdd-PB6WKSLE.mjs → sdd-GWBRD4KI.mjs} +1 -1
  475. package/dist/bin/hook-chunks/{session-continuity-BIJXMN44.mjs → session-continuity-VH645RGR.mjs} +1 -1
  476. package/dist/bin/hook-chunks/{session-start-R2VMKW2L.mjs → session-start-4TYTI27B.mjs} +1 -1
  477. package/dist/bin/hook-chunks/{setup-PPIZHVXS.mjs → setup-VF4UHUBX.mjs} +2 -2
  478. package/dist/bin/hook-chunks/{shipping-C637PCOF.mjs → shipping-2ULWBGRX.mjs} +4 -4
  479. package/dist/bin/hook-chunks/{spec-context-inference-RTTDOZZO.mjs → spec-context-inference-HVENYOIO.mjs} +1 -1
  480. package/dist/bin/hook-chunks/{spec-service-ENLAAMVL.mjs → spec-service-4XGQQPGP.mjs} +2 -2
  481. package/dist/bin/hook-chunks/{spec-task-breakdown-RUDEP3AY.mjs → spec-task-breakdown-JXF556UH.mjs} +1 -1
  482. package/dist/bin/hook-chunks/{state-storage-AJUPG7J5.mjs → state-storage-EMWLIFQJ.mjs} +1 -1
  483. package/dist/bin/hook-chunks/{stop-DPXAWJFN.mjs → stop-NJDYIIXR.mjs} +2 -2
  484. package/dist/bin/hook-chunks/{subagent-start-AFHPXL2S.mjs → subagent-start-2YMGD4SY.mjs} +1 -1
  485. package/dist/bin/hook-chunks/{subagent-stop-5BMV63ML.mjs → subagent-stop-4TZJ2NSJ.mjs} +1 -1
  486. package/dist/bin/hook-chunks/{surface-attribution-EGIKCVMF.mjs → surface-attribution-UNK4J5W2.mjs} +1 -1
  487. package/dist/bin/hook-chunks/{task-overview-F3GB77OA.mjs → task-overview-P3VRH2FD.mjs} +1 -1
  488. package/dist/bin/hook-chunks/{task-service-FZABHPFV.mjs → task-service-SPUES5DO.mjs} +1 -1
  489. package/dist/bin/hook-chunks/{tdd-TAMBOPN3.mjs → tdd-MYF7I5FS.mjs} +1 -1
  490. package/dist/bin/hook-chunks/{template-loader-MXOMU4XH.mjs → template-loader-4SYVR2UB.mjs} +1 -1
  491. package/dist/bin/hook-chunks/{weak-model-mode-BMSPGEQY.mjs → weak-model-mode-TYJJT6JJ.mjs} +1 -1
  492. package/dist/bin/hook-chunks/{work-scope-YCS4GTXW.mjs → work-scope-A6XPENFE.mjs} +1 -1
  493. package/dist/bin/hook-chunks/{workspace-occupancy-JOBYNNXV.mjs → workspace-occupancy-3NEAXILW.mjs} +1 -1
  494. package/dist/bin/prjct-core.mjs +9 -3323
  495. package/dist/bin/prjct-hooks.mjs +1 -1
  496. package/dist/bin/prjct.mjs +7 -1
  497. package/dist/daemon/entry.mjs +514 -513
  498. package/dist/mcp/server.mjs +234 -233
  499. package/package.json +3 -2
  500. package/dist/bin/hook-chunks/chunk-3UB6SFRA.mjs +0 -11
  501. package/dist/bin/hook-chunks/chunk-D7DQABWO.mjs +0 -35
  502. package/dist/bin/hook-chunks/chunk-M4YM7Z3F.mjs +0 -69
  503. package/dist/bin/hook-chunks/chunk-TB57OYGW.mjs +0 -16
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as a}from"./chunk-GDLAQV3Q.mjs";import{a as c,f as i,g as p}from"./chunk-UT425KVX.mjs";import{b as o,c as k}from"./chunk-DOJPSIMG.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";k();import m from"node:fs/promises";import j from"node:path";var f="# prjct:mcp:start - managed by prjct, do not edit between markers",M="# prjct:mcp:end";function u(){return process.env.PRJCT_TEST_MODE==="1"?j.join(o(".prjct-tests"),"grok","config.toml"):o(".grok","config.toml")}e(u,"getGrokConfigTomlPath");async function h(t=u(),r=c.prjct){let n=await m.readFile(t,"utf-8").catch(()=>""),l=a(r),s=i(n,l,f,M,"prjct"),g=s.next,d=s.skipped;return{...await p(t,n,g),skipped:d}}e(h,"ensureGrokMcpServer");async function v(t=u()){try{let r=await m.readFile(t,"utf-8");return/^\s*\[mcp_servers\.prjct\]/m.test(r)||r.includes(f)}catch{return!1}}e(v,"grokHasPrjctMcpServer");export{u as a,h as b,v as c};
@@ -0,0 +1,9 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{E as h,x as a}from"./chunk-HU5ERAAV.mjs";import{c as s,d as n,i as l}from"./chunk-VWFVSNQT.mjs";import{a as r}from"./chunk-3TRXQAU4.mjs";h();l();var p={strategic:{label:"scope sanity",rubric:"Review it for strategic soundness. Does it solve a real problem? Is the goal worth the cost? Is out_of_scope coherent with goal? Is the spec OVER- or UNDER-scoped? Cross-reference relevant prior memory via `prjct context memory <topic>` if useful."},architecture:{label:"eng feasibility",rubric:"Then read the codebase paths listed above (Read tool, cap 10 files). Can this be built ON TOP of what exists? Does the spec contradict an existing state machine, schema, or contract? What failure modes / dependencies / edge cases are missing? Include a short ASCII diagram + cite at least one concrete symbol from the codebase in notes when applicable."},design:{label:"UX/DX",rubric:"Rate 0-10 across {clarity, ergonomics, consistency, accessibility} for the user-facing or developer-facing surface. If scope touches existing UI/CLI patterns (read the listed paths), consistency must be judged against those \u2014 not against your priors. Pass only if all dimensions \u22656; include the four scores in notes.",capabilityClass:"fast"},security:{label:"threat surface",rubric:"Threat-model the surface this spec defines: authn/authz, secret handling, input validation & injection, sandbox/exec boundaries, network egress, PII. Name the highest-severity gap and whether the acceptance criteria mitigate it. Pass only if no high-severity gap is left unmitigated."},data:{label:"data integrity",rubric:"Review the data design. Are schema / migration changes backward-compatible and reversible? Index / query implications, write amplification, migration idempotency, data-loss risk on partial failure. Pass only if the migration path is safe and rollbackable."},performance:{label:"perf profile",rubric:"Identify the hottest path this spec touches and its expected complexity / allocation / IO profile. Do the acceptance criteria bound latency or throughput where it matters? Name the single biggest perf risk. Pass only if no hot-path regression is left unbounded."}},u="Review the spec through this lens. Identify the most important risk or gap it implies and whether the acceptance criteria address it.";function g(e){return`You are the \`${e.name}\` domain specialist (${e.description}). Judge whether this change respects the existing patterns, contracts, and invariants of the \`${e.name}\` domain. Pull \`prjct context memory ${e.name}\` to ground the verdict in what the project already knows. Pass only if the change is consistent with how \`${e.name}\` already works.`}r(g,"domainLensRubric");var o="architecture";function c(){return Object.entries(p).map(([e,t])=>`\`${e}\` (${t.label})`).join(", ")}r(c,"reviewLensMenu");var R=[{name:"leader",role:"orchestrator",kind:"orchestrate"},{name:"implementer",role:"implementer",kind:"implement"},{name:"reviewer",role:"reviewer",kind:"review"}];function d(){return{native:!0,modelDirective:r((e,t)=>n(e,void 0,t),"modelDirective"),runLine:r(e=>e===1?"Run this review subagent via the Agent tool. It reads the spec FROM prjct (command below), reads the relevant codebase paths, applies its rubric, then returns a structured verdict.":`Run these ${e} review subagents IN PARALLEL via the Agent tool \u2014 one tool-use block per lens, all in the SAME message so they run concurrently. Each subagent reads the spec FROM prjct (command below), reads the relevant codebase paths, applies its rubric, then returns a structured verdict.`,"runLine")}}r(d,"claudeMechanism");function m(e){return{native:!1,modelDirective:r((t,i)=>s(t,e,void 0,i),"modelDirective"),runLine:r(t=>t===1?`This rig (${e}) has no native subagent tool. Run this review as ONE focused, fresh pass: read the spec FROM prjct (command below) and the relevant codebase paths, apply the rubric, return a structured verdict \u2014 do not carry over assumptions from the planning context.`:`This rig (${e}) has no native subagent tool, so EMULATE the fan-out: run the ${t} reviews ONE AT A TIME, each as a fresh, independent pass. For each \u2014 reset your working assumptions, state the lens you are playing, read the spec FROM prjct (command below) + the relevant paths, apply that lens's rubric, return its verdict, then move on. Keep them isolated: a later lens must not inherit an earlier lens's framing.`,"runLine")}}r(m,"emulatedMechanism");async function E(e){let t=(await a(e)).name,i=t==="claude"?d():m(t);return{provider:t,...i}}r(E,"resolveDispatchMechanism");function D(e,t){let i=t.trim();return`${[`# prjct crew \u2014 emulated on ${e.provider}`,"","This rig has no native subagent tool, so the crew runs as ONE agent playing roles IN SEQUENCE \u2014 each a fresh, isolated pass. Reset your working assumptions between roles; a later role must never inherit an earlier one's framing.","","The roster is **composed per task, not a fixed trio**: the leader decides how many implementers and which review specialists the change actually needs.","","## Roles (run in order)","",`1. **Leader \u2014 orchestrate, do not write code.** Run \`prjct work --md\` for the cycle + related context. Decompose into slices with DISJOINT file scope, and decide the roster: how many implementers, which review specialists the change raises, and whether investigation is needed first. ${e.modelDirective("orchestrator")}`,`2. **Explore \u2014 only if investigation is needed.** One fresh, read-only pass per narrow question; persist findings with \`prjct remember learning\`. ${e.modelDirective("orchestrator")}`,`3. **Implementer(s) \u2014 one per disjoint slice.** Implement the slice + its tests and self-verify (run the project's test command) before handing off. Fan out only over non-overlapping file scopes. ${e.modelDirective("implementer")}`,`4. **Review specialists \u2014 compose, do NOT default to one generic reviewer.** Always include \`${o}\`; add the specialists the diff raises \u2014 ${c()} \u2014 and invent one the change demands (open vocabulary). Run ONE fresh pass per specialist over the combined diff; each replies \`VERDICT: APPROVED\` or \`VERDICT: CHANGES_REQUESTED\` with notes. (Same catalog \`prjct spec audit\` selects from.) ${e.modelDirective("reviewer")}`,"","## Checkpoints every review specialist applies","",i.length>0?i:"_No project checkpoints set \u2014 review against the project conventions. Set them with `prjct crew checkpoints set`._","","## Rules","- Point, don't carry: the plan/work/memory live in prjct \u2014 read them in each role (`prjct work --md`, `prjct spec show <id> --md`, `prjct context memory <topic>`), never paste them between roles.","- Advance only when EVERY selected specialist returns APPROVED: run `prjct crew record-run \u2026` (one durable row), THEN close the work cycle. If any returns CHANGES_REQUESTED, loop back to the implementer with the notes.","- Persist ONLY through prjct verbs \u2014 SQLite is the only allowed surface. Never write reports/audits to disk."].join(`
8
+ `)}
9
+ `}r(D,"buildEmulatedCrewProtocol");export{p as a,u as b,g as c,R as d,E as e,D as f};
@@ -0,0 +1,9 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as k,p as w}from"./chunk-D62TAZG6.mjs";import{a}from"./chunk-3TRXQAU4.mjs";w();import{existsSync as g}from"node:fs";import{readFile as P}from"node:fs/promises";import u from"node:path";function v(n){let e=n.trim();if(!e)return null;let s=(e.split(/&&|\|\||;/)[0]?.trim()??e).split(/\s+/).filter(Boolean);if(s.length<2)return null;let r=s[0].replace(/\.cmd$/i,""),o=r==="npm"||r==="npx"?"npm":r==="pnpm"?"pnpm":r==="yarn"?"yarn":r==="bun"?"bun":null;if(!o)return null;let i=s[1];if(!(i==="install"||i==="i"||i==="add"||o==="npm"&&i==="install"||o==="yarn"&&(i==="add"||i==="install")))return null;let m=[];for(let y of s.slice(2).keys()){let c=s[y+2];if(c.startsWith("-")||c.startsWith(".")||c.startsWith("/")||c.startsWith("file:")||c.startsWith("http"))continue;let f=D(c);f&&m.push(f)}let d=[...new Set(m)];return d.length===0?null:{manager:o,packages:d}}a(v,"parsePackageInstallCommand");function D(n){if(n.startsWith("@")){let t=n.match(/^(@[\w.-]+\/[\w.-]+)/);return t?t[1]:null}let e=n.split("@")[0]??"";return!e||!/^[\w.-]+$/.test(e)?null:e}a(D,"normalizePackageToken");function I(n,e){let t=n.filter(s=>!e.has(s)).sort();return t.length===0?{risky:!1,newPackages:[],message:null}:{risky:!0,newPackages:t,message:[`Package legitimacy (pre-install): ${t.length} new package${t.length===1?"":"s"} not in package.json:`,...t.map(s=>` - ${s}`),"Verify each on the registry (age, downloads, maintainers). Do not install look-alike names.","Strict packs DENY the install until verified. Override ship later with `prjct ship --allow-new-deps` only after human consent."].join(`
8
+ `)}}a(I,"decidePackageInstall");async function $(n){let e=u.join(n,"package.json");if(!g(e))return new Set;let t=await h(e);return p(t)}a($,"loadKnownDependencyNames");function p(n){let e=new Set;if(!n)return e;for(let t of["dependencies","devDependencies","optionalDependencies","peerDependencies"]){let s=n[t];if(s)for(let r of Object.keys(s))e.add(r)}return e}a(p,"depNames");async function h(n){try{let e=await P(n,"utf-8");return JSON.parse(e)}catch{return null}}a(h,"readJsonFile");async function b(n){try{let{stdout:e}=await k("git",["show","HEAD:package.json"],{cwd:n});return JSON.parse(e)}catch{return null}}a(b,"headPackageJson");async function R(n){let e=u.join(n,"package.json");if(!g(e))return{newDependencies:[],risky:!1,message:null};if(!g(u.join(n,".git")))return{newDependencies:[],risky:!1,message:null};let t=await h(e),s=await b(n),r=p(t),o=p(s),i=[...r].filter(l=>!o.has(l)).sort();return i.length===0?{newDependencies:[],risky:!1,message:null}:{newDependencies:i,risky:!0,message:[`Package legitimacy: ${i.length} new dependenc${i.length===1?"y":"ies"} vs HEAD:`,...i.map(l=>` - ${l}`),"Verify each on the registry (age, downloads, source). Do not substitute similar names.","Strict packs block ship until you confirm or revert.","Override with explicit consent: `prjct ship --allow-new-deps` (not `--no-spec-gate`)."].join(`
9
+ `)}}a(R,"checkPackageLegitimacy");export{v as a,I as b,$ as c,R as d};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as n,b as u,c as t}from"./chunk-3TRXQAU4.mjs";function r(){return typeof globalThis<"u"&&"Bun"in globalThis?"bun":"node"}function i(){return r()==="bun"}function b(){if(r()==="bun")return!0;try{let{execFileSync:e}=u("node:child_process");return e("bun",["--version"],{stdio:"ignore"}),!0}catch{return!1}}var o=t(()=>{"use strict";n(r,"detectRuntime");n(i,"isBun");n(b,"isBunAvailable")});export{i as a,b,o as c};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{z as e}from"zod";var n=e.enum(["skip","standard","full"]),i=e.enum(["blocker","critical","warning","suggestion"]),o=e.enum(["candidate","stands","refuted","info","fixed","verified","open"]),r=e.enum(["stands","refuted"]),a=e.enum(["in_progress","approved","escalated","blocked"]),s=e.enum(["red","blue","solo"]),m=e.object({id:e.string().min(1),severity:i,status:o,title:e.string().min(1),file:e.string().optional(),line:e.number().int().positive().optional(),evidence:e.string().optional(),judge:e.string().optional(),role:s.optional(),dna:e.string().optional(),evidenceScore:e.number().int().min(0).max(3).optional(),blast:e.number().optional(),knownFalsePositive:e.boolean().optional(),agreedBy:e.array(e.string()).optional(),refuteVotes:e.array(r).optional()}),t=2,g=e.object({id:e.string().min(1),target:e.string().min(1),intensity:n,maxFixRounds:e.literal(t).default(t),fixRound:e.number().int().min(0).max(t),findings:e.array(m),verdict:a,createdAt:e.string().min(1),updatedAt:e.string().min(1),baseSha:e.string().optional(),headSha:e.string().optional(),escalateReason:e.string().optional(),deliveryTier:e.enum(["trivial","normal","large"]).optional(),merge:e.object({agreed:e.number().int().min(0),onlyRed:e.number().int().min(0),onlyBlue:e.number().int().min(0),contradicted:e.number().int().min(0)}).optional(),precisionHint:e.number().min(0).max(1).optional(),scopePaths:e.array(e.string().min(1)).optional(),scopeFrozenAt:e.string().optional(),contentBound:e.object({version:e.literal(1),treeHash:e.string().min(8),pathCount:e.number().int().min(0),paths:e.array(e.object({path:e.string().min(1),blobHash:e.string().min(1)})),stampedAt:e.string().min(1),headSha:e.string().optional()}).optional()}),p=e.object({dna:e.string().min(1),title:e.string().min(1),times:e.number().int().positive(),lastSeenAt:e.string().min(1),lastReason:e.string().optional()}),c=e.object({ghosts:e.array(p),updatedAt:e.string().min(1)});export{i as a,r as b,t as c,g as d,c as e};
@@ -0,0 +1,13 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{g as r,i as S}from"./chunk-DMO3ZFUG.mjs";import{F as a,G as _,e as o,l}from"./chunk-HU5ERAAV.mjs";import{f as p,g,p as m}from"./chunk-HYIT7MF5.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";_();l();S();var c=class{static{s(this,"SyncPendingStorage")}append(n,e){let t=o(),u=JSON.stringify(e);return e.entityType&&e.entityId&&e.contentHash&&r.run(n,`DELETE FROM sync_pending
8
+ WHERE project_id = ?
9
+ AND entity_type = ?
10
+ AND entity_id = ?
11
+ AND content_hash = ?`,n,e.entityType,e.entityId,e.contentHash),r.run(n,`INSERT INTO sync_pending
12
+ (project_id, entity_type, entity_id, event_type, content_hash, payload, enqueued_at)
13
+ VALUES (?, ?, ?, ?, ?, ?, ?)`,n,e.entityType??null,e.entityId??null,e.eventType??null,e.contentHash??null,u,t),{id:r.get(n,"SELECT last_insert_rowid() AS id")?.id??0,event:e,enqueuedAt:t}}list(n,e){let t=e?"SELECT * FROM sync_pending WHERE project_id = ? ORDER BY id ASC LIMIT ?":"SELECT * FROM sync_pending WHERE project_id = ? ORDER BY id ASC";return(e?r.query(n,t,n,e):r.query(n,t,n)).map(d=>this.rowToEntry(d))}count(n){return r.get(n,"SELECT COUNT(*) AS n FROM sync_pending WHERE project_id = ?",n)?.n??0}clearUpTo(n,e){if(e<=0)return 0;let t=this.count(n);return r.run(n,"DELETE FROM sync_pending WHERE project_id = ? AND id <= ?",n,e),t-this.count(n)}clearAll(n){r.run(n,"DELETE FROM sync_pending WHERE project_id = ?",n)}clearByIds(n,e){if(e.length===0)return;let t=e.map(()=>"?").join(",");r.run(n,`DELETE FROM sync_pending WHERE project_id = ? AND id IN (${t})`,n,...e)}rowToEntry(n){let e=(()=>{try{return JSON.parse(n.payload)}catch{return{type:"unknown.corrupt",path:[],data:null,timestamp:n.enqueued_at,projectId:n.project_id}}})();return{id:n.id,event:e,enqueuedAt:n.enqueued_at}}},i=new c;l();m();var y=class{static{s(this,"SyncEventBus")}async publish(n){i.append(n.projectId,n)}async getPending(n){return i.list(n).map(e=>e.event)}async clearPending(n){i.clearAll(n)}async getPendingEntries(n){return i.list(n)}async clearPendingUpTo(n,e){return i.clearUpTo(n,e)}async clearPendingByIds(n,e){i.clearByIds(n,e)}async updateLastSync(n){let e=a.getLastSyncPath(n),t={timestamp:o(),success:!0};await g(e,t)}async getLastSync(n){let e=a.getLastSyncPath(n);return await p(e,null)}},L=new y;export{L as a};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as f}from"./chunk-UYMZ3NAF.mjs";import{b as m}from"./chunk-Q6C27OL7.mjs";import{f as r,i as g}from"./chunk-DMO3ZFUG.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";g();var _=["hook","gate","step","instruction"];function d(o){let t=o.trust_source==="imported"?"imported":"local",e=_.includes(o.type)?o.type:"step";return{id:o.id,type:e,command:o.command,position:o.position,action:o.action,description:o.description,enabled:o.enabled===1,timeoutMs:o.timeout_ms,createdAt:o.created_at,sortOrder:o.sort_order,whenExpr:o.when_expr??null,parallel:o.parallel===null?!0:o.parallel===1,trustSource:t}}i(d,"rowToRule");var p=class{static{i(this,"WorkflowRuleStorage")}addRule(t,e){let n=r.get(t,"SELECT MAX(sort_order) as m FROM workflow_rules WHERE command = ?",e.command),u=e.sortOrder||(n?.m??-1)+1;r.run(t,`INSERT INTO workflow_rules (type, command, position, action, description, enabled, timeout_ms, created_at, sort_order, when_expr, parallel, trust_source)
8
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,e.type,e.command,e.position,e.action,e.description??null,e.enabled?1:0,e.timeoutMs,e.createdAt,u,e.whenExpr??null,e.parallel===!1?0:1,e.trustSource??"local");let l=r.get(t,"SELECT last_insert_rowid() as id")?.id??0;return l>0&&m({projectId:t,entityType:"workflow_rules",entityId:String(l),eventType:"upsert",data:{id:l,type:e.type,command:e.command,position:e.position,action:e.action,description:e.description??null,enabled:e.enabled?1:0,timeout_ms:e.timeoutMs,sort_order:u,when_expr:e.whenExpr??null,parallel:e.parallel===!1?0:1,trust_source:e.trustSource??"local",created_at:e.createdAt}}),l}removeRule(t,e){return r.get(t,"SELECT id FROM workflow_rules WHERE id = ?",e)?(r.run(t,"DELETE FROM workflow_rules WHERE id = ?",e),m({projectId:t,entityType:"workflow_rules",entityId:String(e),eventType:"delete",data:{id:e}}),!0):!1}updateRule(t,e,n){if(!r.get(t,"SELECT id FROM workflow_rules WHERE id = ?",e))return!1;let w={type:{column:"type"},command:{column:"command"},position:{column:"position"},action:{column:"action"},description:{column:"description"},enabled:{column:"enabled",transform:i(s=>s?1:0,"transform")},timeoutMs:{column:"timeout_ms"},createdAt:{column:"created_at"},sortOrder:{column:"sort_order"},whenExpr:{column:"when_expr"},parallel:{column:"parallel",transform:i(s=>s===!1?0:1,"transform")},trustSource:{column:"trust_source"}},l=[],c=[];for(let[s,E]of Object.entries(n)){let a=w[s];if(!a)continue;l.push(`${a.column} = ?`);let R=E;c.push(a.transform?a.transform(R):R)}return l.length===0||(c.push(e),r.run(t,`UPDATE workflow_rules SET ${l.join(", ")} WHERE id = ?`,...c)),!0}getRuleById(t,e){let n=r.get(t,"SELECT * FROM workflow_rules WHERE id = ?",e);return n?d(n):null}getRulesForCommand(t,e){let n=f.getWorkflow(t,e);return!n||!n.enabled?[]:r.query(t,"SELECT * FROM workflow_rules WHERE command = ? AND enabled = 1 ORDER BY sort_order ASC",e).map(d)}getAllRules(t){return r.query(t,"SELECT * FROM workflow_rules ORDER BY command ASC, sort_order ASC").map(d)}resetRules(t){let e=r.get(t,"SELECT COUNT(*) as c FROM workflow_rules");return r.run(t,"DELETE FROM workflow_rules"),e?.c??0}},S=new p;export{S as a};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{e as r,p as c}from"./chunk-D62TAZG6.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";c();var s=5e3;async function g(t){let n=await r(["branch","--show-current"],{cwd:t,timeoutMs:s});if(n.ok)return n.stdout.trim()||void 0}e(g,"getGitBranch");async function m(t,n=20){let o=e(i=>i.trim().split(`
8
+ `).filter(f=>f.length>0).slice(0,n),"parse"),u=await r(["diff","--name-only","HEAD"],{cwd:t,timeoutMs:s});if(u.ok){let i=o(u.stdout);if(i.length>0)return i}let d=await r(["diff","--name-only"],{cwd:t,timeoutMs:s});return d.ok?o(d.stdout):[]}e(m,"getModifiedFiles");export{g as a,m as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{f as a,i as h}from"./chunk-DMO3ZFUG.mjs";import{b as u,p as l}from"./chunk-D62TAZG6.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";h();l();function d(n){let t=n.toLowerCase();return t.includes("github")?"github":t.includes("gitlab")?"gitlab":t.includes("bitbucket")?"bitbucket":"other"}e(d,"providerForHost");function p(n){let t=n.trim();if(!t)return{};let r=t.match(/^[^/@]+@([^:/]+):(.+?)(?:\.git)?\/?$/);if(r)return{provider:d(r[1]),repoSlug:r[2]};try{let o=new URL(t),c=o.pathname.replace(/^\/+/,"").replace(/\.git$/,"").replace(/\/+$/,"");return!o.host||!c?{}:{provider:d(o.host),repoSlug:c}}catch{return{}}}e(p,"parseRemote");async function y(n){try{let{stdout:t}=await u("git",["remote","get-url","origin"],{cwd:n});return t.trim()||void 0}catch{return}}e(y,"gitRemoteUrl");async function b(n){try{let{stdout:t}=await u("git",["symbolic-ref","--short","refs/remotes/origin/HEAD"],{cwd:n});return t.trim().replace(/^origin\//,"")||void 0}catch{return}}e(b,"gitDefaultBranch");function i(n){return typeof n=="string"&&n.length>0?n:void 0}e(i,"str");function g(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}e(g,"num");function P(n){return Object.fromEntries(Object.entries(n).filter(([,t])=>t!==void 0))}e(P,"compact");async function S(n){let t=a.getDoc(n,"project")||{},r=i(t.repoPath),{provider:o,repoSlug:c}=r?p(await y(r)||""):{},f=r?await b(r):void 0,s=Array.isArray(t.techStack)?t.techStack.filter(m=>typeof m=="string"):void 0;return P({provider:o,repoSlug:c,currentBranch:i(t.currentBranch),defaultBranch:f,stack:i(t.stack),techStack:s&&s.length>0?s:void 0,version:i(t.version),commitCount:g(t.commitCount),fileCount:g(t.fileCount),lastCommit:i(t.lastSyncCommit),hasUncommitted:typeof t.hasUncommittedChanges=="boolean"?t.hasUncommittedChanges:void 0,cliVersion:i(t.cliVersion),syncedAt:i(t.lastSync)})}e(S,"buildProjectMeta");export{p as a,S as b};
@@ -0,0 +1,10 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{D as F,E as M,x as j}from"./chunk-HU5ERAAV.mjs";import{b as k,f as G}from"./chunk-XYDLXF5A.mjs";import{a as b,b as S}from"./chunk-2EEMQV7N.mjs";import{f as L,g as N}from"./chunk-TTN2CFZC.mjs";import{a as E,b as a,c as _}from"./chunk-DOJPSIMG.mjs";import{i as A,l as I,p as O}from"./chunk-HYIT7MF5.mjs";import{e as l,g as R}from"./chunk-225DWS4D.mjs";import{a as c,e as C}from"./chunk-3TRXQAU4.mjs";R();O();M();import s from"node:fs/promises";import o from"node:path";G();R();O();S();import P from"node:fs/promises";import D from"node:path";var y='<!-- prjct:start - DO NOT REMOVE THIS MARKER -->\n# p/ \u2014 Project knowledge layer\n\nprjct stores project memory (decisions, learnings, gotchas, patterns, ships, analyses) per project in SQLite and serves it to you through tools. **Query it \u2014 don\'t re-read source from scratch.**\n\nprjct remembers and shows the path; it does not own execution. Treat prjct output as durable signals (task state, memories, specs, workflows, risks, recent learnings). Claude, GPT, and other agents decide the concrete HOW with their own native tools and judgment, then persist meaningful outcomes back to prjct.\n\nYou are in a prjct project when `.prjct/` is in cwd OR `~/.prjct-cli/projects/` has an entry for the current path.\n\n## Lookup FIRST, source LAST\n\nBefore reading source code or running broad searches for ANY question about the project (architecture, conventions, decisions, recent ships, bugs, patterns, tech debt, past analyses), QUERY prjct first \u2014 bounded, ranked answers from SQLite, no markdown trees to wade through:\n\n- `prjct context memory <topic>` / `prjct search "<q>"` \u2014 captured decisions, gotchas, learnings, facts\n- `prjct context --md` \u2014 current state: active cycle, ships, recent learnings\n- architecture / conventions / patterns / anti-patterns / tech-debt / insights \u2192 MCP `prjct_analysis` (add `mode:archive` for history)\n- developer preferences \u2192 MCP `prjct_developer`; machine signals \u2192 MCP `prjct_signals`\n- specs \u2192 MCP `prjct_spec_list` / `prjct_spec_get`; per-file traps before editing \u2192 `prjct guard <file>`\n\nOnly fall through to source/repo reading when prjct does not contain the answer.\n\n**Skill \u2260 project identity.** The prjct skill is a portable multi-LLM contract (L0). Live name/stack/branch come from SessionStart + `prjct context --md` for **this cwd**. If skill text and the tree disagree, trust the cwd and the tree.\n\n## Capture analyses BACK to prjct\n\nWhen you complete substantive work \u2014 analysis, decision, learning, gotcha \u2014 persist it: `prjct remember <decision|learning|gotcha|fact> "..."` or `prjct capture "<text>" --tags k:v`. **Author every entry in ENGLISH**, whatever language the user speaks. **Default to capturing \u2014 under-capture is the failure mode that makes prjct useless.** The full verb map and task workflow live in the `prjct` skill.\n\n## Where things live\n\n- Source of truth: SQLite at `~/.prjct-cli/projects/<id>/` (don\'t read directly \u2014 use `prjct` CLI / MCP tools)\n- Project config: `.prjct/prjct.config.json` in repo root\n\n**Auto-managed by prjct-cli** | https://prjct.app\n<!-- prjct:end - DO NOT REMOVE THIS MARKER -->\n';async function v(d){let t=(M(),C(F)),e=d??await t.getActiveProvider(),i=e.name;if(d){if(!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"}}else if(!(await t.detectProvider(i)).installed&&!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"};try{await P.mkdir(e.configDir,{recursive:!0});let n=D.join(e.configDir,e.contextFile),m=await(async()=>{if(i==="claude")return y;let u=k(`global/${e.contextFile}`);if(u)return u;let{PACKAGE_ROOT:g}=(N(),C(L)),T=D.join(g,"templates","global",e.contextFile);return P.readFile(T,"utf-8").catch(()=>i==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await A(n),p="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",x=(()=>{if(!r.content.includes(p)||!r.content.includes(f))return r.content;let u=r.content.substring(0,r.content.indexOf(p)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(u+g).replace(/\n{3,}/g,`
8
+
9
+ `).trim()}
10
+ `})(),h=b(r.exists?x:"",m,"<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");return r.exists&&r.content===h.content?{success:!0,action:"unchanged",path:n}:(await P.writeFile(n,h.content,"utf-8"),{success:!0,action:h.action,path:n})}catch(n){return{success:!1,error:l(n),action:"failed"}}}c(v,"installGlobalConfig");_();async function ot(d){return v(d)}c(ot,"installGlobalConfig");var w=class{static{c(this,"CommandInstaller")}commandsPath="";configPath="";_initialized=!1;async ensureInit(t){if(this._initialized)return;let e=t??await j();this.configPath=e.configDir??"",this.commandsPath=this.configPath?o.join(this.configPath,"commands"):"",this._initialized=!0}async detectActiveProvider(t){return await this.ensureInit(t),I(this.configPath)}async installCommands(){let t=await this.detectActiveProvider(),e=await j();return t?(await this.cleanupRouter(),{success:!0,installed:[],path:this.commandsPath}):{success:!1,error:`${e.displayName} not detected. Please install it first.`}}async uninstallCommands(){try{let t=[];await this.ensureInit();for(let e of["p.md","p.toml"]){let i=o.join(this.commandsPath,e);try{await s.unlink(i),t.push(e)}catch(n){if(n.code!=="ENOENT")return{success:!1,error:l(n)}}}return{success:!0,uninstalled:t}}catch(t){return{success:!1,error:l(t)}}}async checkInstallation(){return await this.detectActiveProvider()?{installed:!0,providerDetected:!0,commands:[],path:this.commandsPath}:{installed:!1,providerDetected:!1}}async getInstallPath(){return await this.ensureInit(),this.commandsPath}async syncCommands(t){if(!await this.detectActiveProvider(t))return{success:!1,error:"AI agent not detected",added:0,updated:0,removed:0};try{return{success:!0,added:0,updated:0,removed:await this.cleanupRouter()?1:0}}catch(i){return{success:!1,error:l(i),added:0,updated:0,removed:0}}}async cleanupRouter(){return await this.ensureInit(),(await Promise.all(["p.md","p.toml"].map(async e=>{try{return await s.unlink(o.join(this.commandsPath,e)),!0}catch{return!1}}))).some(Boolean)}async cleanupLegacyCommands(){await this.ensureInit();let t=o.join(this.commandsPath,"p");try{if((await s.stat(t).catch(()=>null))?.isDirectory())return await s.rm(t,{recursive:!0,force:!0}),!0}catch{}return!1}async installGlobalConfig(t){return v(t)}async cleanupAllLegacy(){let t=E(),e=[],i=[o.join(t,".claude","commands","p.md"),o.join(t,".claude","commands","p.toml"),o.join(t,".gemini","commands","p.md"),o.join(t,".gemini","commands","p.toml")];for(let r of i)try{await s.unlink(r),e.push(r)}catch{}let n=[o.join(t,".claude","commands","p"),o.join(t,".gemini","commands","p")];for(let r of n)try{(await s.stat(r).catch(()=>null))?.isDirectory()&&(await s.rm(r,{recursive:!0,force:!0}),e.push(r))}catch{}let m=[o.join(t,".prjct-cli","config","homebrew-migrated")];for(let r of m)try{await s.unlink(r),e.push(r)}catch{}return{cleaned:e}}};function it(){return{claude:{commands:a(".claude","commands"),config:a(".claude"),router:a(".claude","commands","p.md")},gemini:{commands:a(".gemini","commands"),config:a(".gemini"),router:a(".gemini","commands","p.toml")}}}c(it,"getProviderPaths");var H=new w,st=H;export{ot as a,w as b,it as c,st as d};
@@ -0,0 +1,11 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as f,b as R}from"./chunk-RP7F67ZT.mjs";import{a as l,p as P}from"./chunk-D62TAZG6.mjs";import{d as k,e as j}from"./chunk-623SNKDH.mjs";import{d as x,f as D,l as g,p as S}from"./chunk-HYIT7MF5.mjs";import{a}from"./chunk-3TRXQAU4.mjs";j();P();S();R();import y from"node:path";S();import C from"node:fs/promises";import F from"node:path";var d=class{static{a(this,"StackDetector")}projectPath;constructor(t){this.projectPath=t}async detect(){let t={hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]},e=await this.readPackageJson();if(e){let s={...e.dependencies,...e.devDependencies};this.detectFrontend(s,t),this.detectBackend(s,t),this.detectDatabase(s,t),this.detectTesting(s,e,t),this.collectFrameworks(s,t)}return t.hasDocker=await this.detectDocker(),t}detectFrontend(t,e){(t.react||t.vue||t.svelte||t["@angular/core"])&&(e.hasFrontend=!0,e.frontendType="web"),(t["react-native"]||t.expo)&&(e.hasFrontend=!0,e.frontendType=e.frontendType==="web"?"both":"mobile")}detectBackend(t,e){["express","fastify","hono","koa","@nestjs/core","nest","@hapi/hapi","restify","polka"].some(o=>t[o])&&(e.hasBackend=!0)}detectDatabase(t,e){["prisma","@prisma/client","mongoose","pg","mysql2","sequelize","typeorm","drizzle-orm","knex","better-sqlite3","mongodb","redis","ioredis"].some(o=>t[o])&&(e.hasDatabase=!0)}detectTesting(t,e,s){["jest","vitest","mocha","@testing-library/react","@testing-library/vue","cypress","playwright","@playwright/test","ava","tap","bun-types"].some(c=>t[c]||e.devDependencies?.[c])&&(s.hasTesting=!0)}async detectDocker(){let t=["Dockerfile","docker-compose.yml","docker-compose.yaml",".dockerignore"];for(let e of t)if(await this.fileExistsInProject(e))return!0;return!1}collectFrameworks(t,e){t.react&&e.frameworks.push("React"),t.next&&e.frameworks.push("Next.js"),t.vue&&e.frameworks.push("Vue"),t.nuxt&&e.frameworks.push("Nuxt"),t.svelte&&e.frameworks.push("Svelte"),t["@angular/core"]&&e.frameworks.push("Angular"),t["react-native"]&&e.frameworks.push("React Native"),t.expo&&e.frameworks.push("Expo"),t.express&&e.frameworks.push("Express"),t.fastify&&e.frameworks.push("Fastify"),t.hono&&e.frameworks.push("Hono"),t.koa&&e.frameworks.push("Koa"),(t["@nestjs/core"]||t.nest)&&e.frameworks.push("NestJS"),t.astro&&e.frameworks.push("Astro"),t.remix&&e.frameworks.push("Remix"),t.gatsby&&e.frameworks.push("Gatsby")}async readPackageJson(){try{let t=F.join(this.projectPath,"package.json"),e=await C.readFile(t,"utf-8");return JSON.parse(e)}catch{return null}}async fileExistsInProject(t){return g(F.join(this.projectPath,t))}};async function L(r){let t={branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0},e={cwd:r},s=a(i=>i.catch(()=>null),"safe"),[o,c,w,h,b,v]=await Promise.all([s(l("git branch --show-current",e)),s(l("git rev-list --count HEAD",e)),s(l("git shortlog -sn --all",e)),s(l("git status --porcelain",e)),s(l('git log --oneline -20 --pretty=format:"%h|%s|%ad" --date=short',e)),s(l('git log --oneline --since="1 week ago"',e))]);if(o&&(t.branch=o.stdout.trim()||"main"),c&&(t.commits=parseInt(c.stdout.trim(),10)||0),w&&(t.contributors=w.stdout.split(`
8
+ `).filter(i=>i.trim()).length),h){let i=h.stdout.trim().split(`
9
+ `).filter(Boolean);t.hasChanges=i.length>0;for(let p of i){let m=p.substring(0,2),u=p.substring(3);m.startsWith("A")||m.startsWith("M ")?t.stagedFiles.push(u):m.includes("M")?t.modifiedFiles.push(u):m.startsWith("??")&&t.untrackedFiles.push(u)}}return b&&(t.recentCommits=b.stdout.split(`
10
+ `).filter(Boolean).map(i=>{let[p,m,u]=i.split("|");return{hash:p,message:m,date:u}})),v&&(t.weeklyCommits=v.stdout.split(`
11
+ `).filter(i=>i.trim()).length),!o&&!c&&!h&&f.debug("Git analysis failed (not a git repo?)"),t}a(L,"analyzeGit");async function n(r,t){let e=await g(y.join(r,t));return e||f.debug("File not found",{filename:t}),e}a(n,"fileExistsInProject");async function M(r){let t={fileCount:0,version:"0.0.0",name:y.basename(r),ecosystem:"unknown",projectType:"simple",languages:[],frameworks:[]};try{let e=[".js",".ts",".tsx",".py",".go",".rs"],s=await x(r,{skipDotfiles:!0});t.fileCount=s.filter(o=>e.some(c=>o.endsWith(c))).length}catch(e){f.debug("File count failed",{path:r,error:k(e)}),t.fileCount=0}try{let e=y.join(r,"package.json"),s=await D(e);if(!s)throw new Error("No package.json found");t.version=s.version||"0.0.0",t.name=s.name||t.name,t.ecosystem="JavaScript",s.devDependencies?.typescript||await n(r,"tsconfig.json")?t.languages.push("TypeScript"):t.languages.push("JavaScript")}catch(e){f.debug("No package.json found",{path:r,error:k(e)})}return await n(r,"Cargo.toml")?(t.ecosystem="Rust",t.languages.push("Rust")):await n(r,"go.mod")?(t.ecosystem="Go",t.languages.push("Go")):(await n(r,"requirements.txt")||await n(r,"pyproject.toml"))&&(t.ecosystem="Python",t.languages.push("Python")),t.fileCount>300||t.frameworks.length>=3?t.projectType="enterprise":(t.fileCount>50||t.frameworks.length>=2)&&(t.projectType="complex"),t}a(M,"gatherStats");async function H(r){let t={install:"npm install",run:"npm run",test:"npm test",build:"npm run build",dev:"npm run dev",lint:"npm run lint",format:"npm run format"};return await n(r,"bun.lockb")||await n(r,"bun.lock")?(t.install="bun install",t.run="bun run",t.test="bun test",t.build="bun run build",t.dev="bun run dev",t.lint="bun run lint",t.format="bun run format"):await n(r,"pnpm-lock.yaml")?(t.install="pnpm install",t.run="pnpm run",t.test="pnpm test",t.build="pnpm run build",t.dev="pnpm run dev",t.lint="pnpm run lint",t.format="pnpm run format"):await n(r,"yarn.lock")&&(t.install="yarn",t.run="yarn",t.test="yarn test",t.build="yarn build",t.dev="yarn dev",t.lint="yarn lint",t.format="yarn format"),await n(r,"Cargo.toml")&&(t.install="cargo build",t.run="cargo run",t.test="cargo test",t.build="cargo build --release",t.dev="cargo run",t.lint="cargo clippy",t.format="cargo fmt"),await n(r,"go.mod")&&(t.install="go mod download",t.run="go run .",t.test="go test ./...",t.build="go build",t.dev="go run .",t.lint="golangci-lint run",t.format="go fmt ./..."),t}a(H,"detectCommands");async function K(r){return new d(r).detect()}a(K,"detectStack");export{L as a,M as b,H as c,K as d};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{c as y}from"./chunk-F2FKQUYE.mjs";import{m as T}from"./chunk-WSVMQYYU.mjs";import{b as g}from"./chunk-LZC6NGB6.mjs";import{b as A}from"./chunk-EHVU2SMR.mjs";import{b as _}from"./chunk-3USVY66O.mjs";import{d as b,g as M,j as R}from"./chunk-KPR5TWSN.mjs";import{a as x}from"./chunk-3TRXQAU4.mjs";R();var D=new Set(["decision","gotcha","learning","fact","feedback","spec"]);async function B(C,r,p={}){let{topic:c,types:i,tags:a}=p,l=p.limit??30,w=c?(()=>{let e=c.split(/\s+/).filter(Boolean);try{return g.searchFts(r,e,l).filter(t=>(!i||i.includes(t.type))&&(!a||M(t,a)))}catch{return[]}})():[],m=w.length>0?w:g.recall(r,{topic:c,types:i,tags:a,limit:l}).slice(0,l),d=(c?await(async()=>{try{let e=await _.readConfig(C);if(e&&T.isEnabled(e)){let n=await T.semanticSearch(r,c,e,10);if(n.length>0){let t=new Set(m.map(o=>o.id));return[...n.filter(o=>!t.has(o.id)&&(!i||i.includes(o.type))&&(!a||M(o,a))),...m].slice(0,l)}}return m}catch{return m}})():m).filter(e=>b(e)||(i?.includes(e.type)??!1)),h=i?.includes("improvement-signal")?d:await(async()=>{try{let{isAutoSource:e}=await import("./purge-5EPJV25P.mjs"),n=45*864e5,t=Date.now(),u=d.filter(s=>{if(!e(s.tags?.source)||D.has(s.type)&&!e(s.tags?.source))return!0;let S=Date.parse(s.rememberedAt);return Number.isFinite(S)?t-S<n:!0}),o=u.filter(s=>!e(s.tags?.source)),O=u.filter(s=>e(s.tags?.source));return[...o,...O].slice(0,Math.max(l,u.length))}catch{return d}})(),f=h.length>1?y.rerank(r,h):h,k=p.expandLinks!==!1&&f.length>0?g.expandWithLinks(r,f,5):[],E=k.length>0?f.concat(k):f;try{let e=await A.getCurrentTask(r),n=new Date().toISOString();e?.id&&y.recordSurfaced(r,E.map(t=>t.id),e.id,n,{queryText:c,surface:"context-memory"});for(let t of E)y.recordFetch(r,t.id,n)}catch{}return E}x(B,"enrichedRecall");export{B as a};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as r,b as f}from"./chunk-RP7F67ZT.mjs";import{e as l,g}from"./chunk-225DWS4D.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";g();f();import s from"node:fs/promises";async function m(a){let{skillMdPath:t,skillExists:n,templateContent:o,build:c,logLabel:u}=a;try{let e=c(o);return n&&await s.readFile(t,"utf-8").catch(()=>"")===e.content?{success:!0,action:"unchanged",path:t}:(await s.writeFile(t,e.content,"utf-8"),{success:!0,action:n?"updated":"created",path:t})}catch(e){return r.warn(`${u} skill warning: ${l(e)}`),{success:!1,action:null}}}i(m,"writeSkillIfChanged");export{m as a};
@@ -0,0 +1,13 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as T,c as E}from"./chunk-XC6YAP36.mjs";import{a as L}from"./chunk-J7T5IEFJ.mjs";import{a as M}from"./chunk-VRFYDYQY.mjs";import{a as D,b as x,d as A,e as H,f as N}from"./chunk-6XTLPAPZ.mjs";import{a as P}from"./chunk-AS3LWTQ4.mjs";import{i as $}from"./chunk-7QMBIMEX.mjs";import{c as C,d as w}from"./chunk-H2KNJUPN.mjs";import{b as R,c as y,d as S}from"./chunk-ESB4ALH2.mjs";import{b as h}from"./chunk-EHVU2SMR.mjs";import{b as k}from"./chunk-3USVY66O.mjs";import{f as g,i as z}from"./chunk-DMO3ZFUG.mjs";import{E as W,t as v}from"./chunk-HU5ERAAV.mjs";import{b,e as O}from"./chunk-6RT2P22O.mjs";import{a as f}from"./chunk-3TRXQAU4.mjs";W();import{spawn as F}from"node:child_process";z();O();async function K(t,n,i,e){let o=await k.readConfig(n).catch(()=>null),r=await $(t,n).catch(()=>null),d=r?.turnCount??0,a=M(o,r),c=P(o,r),s=(()=>{try{return e?g.query(t,`SELECT DISTINCT json_extract(data, '$.file') AS file
8
+ FROM events
9
+ WHERE type = 'memory.post_edit' AND timestamp >= ?
10
+ LIMIT 20`,e).map(u=>u.file).filter(Boolean):[]}catch{return[]}})(),l=(()=>{try{return g.query(t,"SELECT content FROM task_log WHERE task_id = ? ORDER BY id DESC LIMIT 5",i).map(u=>u.content).filter(Boolean)}catch{return[]}})();return{turns:d,files:s,pressure:c.level!=="ok"?c.level:void 0,loopStopped:a.stopped||void 0,journal:l.length>0?l:void 0}}f(K,"buildEvidence");function Y(t,n,i){let e=t?.trim();if(e)return e.slice(0,500);let o=[`Yielded cycle "${i.slice(0,80)}"`];return n.turns&&n.turns>0&&o.push(`after ${n.turns} turns`),n.loopStopped&&o.push("loop-guard stopped"),n.pressure&&o.push(`context pressure ${n.pressure}`),n.files&&n.files.length>0&&o.push(`files: ${n.files.slice(0,5).join(", ")}`),o.push("\u2014 continue from current branch state; do not restart from zero"),o.join(" ").slice(0,500)}f(Y,"composeReason");function q(t){let n=[t.fromAgent,t.fromIdentity].filter(Boolean).join("/");return[`# prjct handoff \u2192 ${t.toAgent}`,"",`Task: \`${t.taskId}\` \u2014 ${t.taskDescription}`,`From: ${n} \xB7 handoff \`${t.id}\``,`Reason: ${t.reason}`,t.branch?`Branch: \`${t.branch}\``:null,t.worktreePath?`Path: \`${t.worktreePath}\``:null,"","## Accept (target agent)","","```bash",`cd ${t.worktreePath??"."}`,`prjct accept ${t.id} --md`,"```","","Then continue the cycle \u2014 do not start a new `prjct work` for the same intent."].filter(i=>i!==null).join(`
11
+ `)}f(q,"formatResumeCard");function G(t,n){let i=[t.fromAgent,t.fromIdentity].filter(Boolean).join("/"),e=t.evidence,o=[`# Handoff accepted \u2014 ${t.taskDescription}`,"",`- Task id: \`${t.taskId}\``,`- Handoff: \`${t.id}\``,`- Started by: ${i}`,`- Accepted by: ${n.agent}/${n.identity}`,`- Why yielded: ${t.reason}`];return e?.turns&&o.push(`- Turns spent: ${e.turns}`),e?.pressure&&o.push(`- Context pressure: ${e.pressure}`),e?.files&&e.files.length>0&&o.push(`- Hot files: ${e.files.slice(0,8).map(r=>`\`${r}\``).join(", ")}`),e?.journal&&e.journal.length>0&&o.push("","## Prior journal",...e.journal.map(r=>`- ${r.slice(0,120)}`)),o.push("","## Next","","1. `prjct work --md` \u2014 same cycle is still active (now yours)","2. Read hot files + `prjct guard <file>` before editing","3. Continue implementation \u2014 do **not** restart from zero"),o.join(`
12
+ `)}f(G,"formatAcceptBrief");async function j(t,n,i){let e=await w(n);if(e.gitError)throw new Error(`git ${e.gitError}: workspace identity unknown \u2014 refusing to update task fields on the main fallback.`);let o=i;e.isMain?await h.updateCurrentTask(t,o):await h.updateWorkspaceTask(t,e.workspaceId,o)}f(j,"rebindTaskOwner");async function dt(t,n,i,e={}){let o=S(i);if(!o)return{ok:!1,error:'Usage: prjct switch <agent> [--reason "\u2026"] [--launch]'};let r=await $(t,n);if(!r)return{ok:!1,error:'No active work cycle in this workspace. Start one with `prjct work "<intent>"` first.'};let d=y(r.description),a=r.ownerAgent||d.agent,c=r.ownerIdentity||d.identity,s=await w(n);if(s.gitError)return{ok:!1,error:`git ${s.gitError}: workspace identity unknown \u2014 refusing to switch agents on the main fallback. Re-run when git is healthy.`};let l=await k.readConfig(n).catch(()=>null),m=await K(t,n,r.id,r.startedAt),u=Y(e.reason,m,r.description),B=l?.multiAgent?.handoffTtlHours??24,p=D({projectId:t,taskId:r.id,taskDescription:r.description,fromAgent:a,fromIdentity:c,toAgent:o,reason:u,evidence:m,workspaceId:s.isMain?C:s.workspaceId,worktreePath:s.worktreePath,branch:s.branch??r.branch,ttlHours:B});await j(t,n,{yieldStatus:"yielded",pendingHandoffId:p.id});try{await L({projectId:t,projectPath:n,cycleDescription:r.description,cycleId:r.id,author:c})}catch{}try{g.appendEvent(t,"task.handoff.yielded",{handoffId:p.id,taskId:r.id,fromAgent:a,toAgent:o,reason:u})}catch{}T(l)==="on"&&await E(`prjct \u2192 ${o}`,`Handoff: ${r.description.slice(0,80)} \u2014 prjct accept ${p.id.slice(0,16)}`);let _=q(p),I=e.launch===!0||l?.multiAgent?.switchLaunch===!0?await U(o,p,s.worktreePath):{ok:!1,error:void 0};return{ok:!0,handoff:p,resumeCard:_,launched:I.ok,launchError:I.error}}f(dt,"switchAgent");async function lt(t,n,i){let e=y(n),o=i?.trim()?[]:H(t,e.agent),r=o.length>0?o:A(t,{status:"pending",limit:5}),d=i?.trim()||r[0]?.id||"";if(!d)return{ok:!1,error:"No pending handoff for this agent. List with `prjct handoffs`."};let a=x(t,d);if(!a)return{ok:!1,error:`Handoff not found: ${d}`};if(a.status!=="pending")return{ok:!1,error:`Handoff ${a.id.slice(0,16)} is already ${a.status}`};let c=`${e.agent}/${e.identity}`,s=N(t,a.id,c);if(!s)return{ok:!1,error:`Claim lost \u2014 ${a.id.slice(0,16)} was taken or expired`};await j(t,n,{ownerAgent:e.agent,ownerIdentity:e.identity,ownerSessionId:e.sessionId,yieldStatus:"active",pendingHandoffId:null});try{g.appendEvent(t,"task.handoff.accepted",{handoffId:s.id,taskId:s.taskId,acceptedBy:c,fromAgent:s.fromAgent})}catch{}return T(await k.readConfig(n).catch(()=>null))==="on"&&await E("prjct handoff accepted",`${c} took over: ${s.taskDescription.slice(0,80)}`),{ok:!0,handoff:s,brief:G(s,e)}}f(lt,"acceptAgentHandoff");function ut(t,n){let i=n??R(),e=H(t,i),o=e.length>0?e:i==="unknown"?A(t,{status:"pending",limit:2}):[];return o.length===0?null:o.map(r=>`\u2194 Handoff pending for ${r.toAgent}: \`${r.taskId.slice(0,8)}\` \u2014 "${r.reason.slice(0,80)}" \xB7 accept: \`prjct accept ${r.id}\``).join(`
13
+ `)}f(ut,"formatPendingHandoffCue");async function U(t,n,i){let r=v[t]?.cliCommand;if(!r)return{ok:!1,error:`No CLI for ${t} \u2014 paste the resume card into that terminal instead.`};if(!await b(r))return{ok:!1,error:`${r} not on PATH`};let a=[`You are accepting a prjct handoff from ${n.fromAgent}.`,`Run: prjct accept ${n.id} --md`,`Then continue task ${n.taskId}: ${n.taskDescription}.`,`Reason yielded: ${n.reason}`,"Do not restart from zero. Work from the current branch state."].join(" ");try{return F(r,[a],{cwd:i,detached:!0,stdio:"ignore",env:{...process.env,PRJCT_AGENT_RUNTIME:t}}).unref(),{ok:!0}}catch(c){return{ok:!1,error:c instanceof Error?c.message:"spawn failed"}}}f(U,"launchTargetAgent");export{dt as a,lt as b,ut as c,U as d};
@@ -0,0 +1,15 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as _,c as b}from"./chunk-TIBYHZFA.mjs";import{a as J,b as se}from"./chunk-U24YKPYX.mjs";import{b as P,p as ae}from"./chunk-D62TAZG6.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";function le(t){let e=t.trim();if(e){if(/^sk-or-/i.test(e))return{wire:"openai-compatible",baseUrl:"https://openrouter.ai/api/v1",providerLabel:"OpenRouter",defaultModel:"openai/gpt-4o-mini"};if(/^sk-ant-/i.test(e))return{wire:"anthropic",baseUrl:"https://api.anthropic.com",providerLabel:"Anthropic",defaultModel:"claude-sonnet-4-20250514"};if(/^xai-/i.test(e))return{wire:"openai-compatible",baseUrl:"https://api.x.ai/v1",providerLabel:"xAI",defaultModel:"grok-3-mini"};if(/^sk-/i.test(e))return{wire:"openai-compatible",baseUrl:"https://api.openai.com/v1",providerLabel:"OpenAI",defaultModel:"gpt-4o-mini"}}}i(le,"detectBrainFromKey");function me(t){let e=t.trim().replace(/\/+$/,"");if(e){if(/localhost:11434|127\.0\.0\.1:11434/i.test(e))return{wire:"openai-compatible",baseUrl:w(e),providerLabel:"Ollama",defaultModel:"qwen3.5:4b",weakHint:!0};if(/localhost:1234|127\.0\.0\.1:1234/i.test(e))return{wire:"openai-compatible",baseUrl:w(e),providerLabel:"LM Studio",defaultModel:"local-model",weakHint:!0};if(/api\.anthropic\.com/i.test(e))return{wire:"anthropic",baseUrl:"https://api.anthropic.com",providerLabel:"Anthropic",defaultModel:"claude-sonnet-4-20250514"};if(/openrouter\.ai/i.test(e))return{wire:"openai-compatible",baseUrl:e.includes("/api")?w(e.replace(/\/chat\/completions$/i,"")):"https://openrouter.ai/api/v1",providerLabel:"OpenRouter",defaultModel:"openai/gpt-4o-mini"};if(/api\.x\.ai/i.test(e))return{wire:"openai-compatible",baseUrl:w(e),providerLabel:"xAI",defaultModel:"grok-3-mini"};if(/api\.openai\.com/i.test(e))return{wire:"openai-compatible",baseUrl:w(e),providerLabel:"OpenAI",defaultModel:"gpt-4o-mini"}}}i(me,"detectBrainFromBaseUrl");function w(t){let e=t.replace(/\/+$/,"");return/\/v1$/i.test(e)?e:/\/v1\//i.test(e)?e.replace(/\/v1\/.*$/i,"/v1"):`${e}/v1`}i(w,"ensureV1");function M(t,e){return/openrouter\.ai/i.test(e)&&t&&!t.includes("/")?`openai/${t}`:t}i(M,"normalizeChatModelForBaseUrl");function c(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"default"}i(c,"slugifyProfileName");function d(t){return/localhost|127\.0\.0\.1/i.test(t)}i(d,"isLocalBaseUrl");var Y="PRJCT_OWNED_LLM",U="owned-llm";function ue(){let t=process.env[Y]?.trim().toLowerCase();return t==="0"||t==="false"||t==="off"?!1:t==="1"||t==="true"||t==="on"?!0:_(U)==="on"}i(ue,"isOwnedLlmEnabled");function ce(t){b(U,t?"on":"off")}i(ce,"setOwnedLlmEnabled");function fe(){return`Owned LLM is opt-in and OFF by default (no change to guest harnesses).
8
+ Enable: prjct llm enable
9
+ or: PRJCT_OWNED_LLM=1 prjct llm \u2026
10
+ Disable: prjct llm disable`}i(fe,"ownedLlmEnableHint");var G="llm.active",V="llm.profiles",z="PRJCT_LLM_PROFILE";function pe(t){if(typeof t!="string"||!t.trim())return[];try{let e=JSON.parse(t);if(!Array.isArray(e))return[];let n=[];for(let r of e){let o=de(r);o&&n.push(o)}return n}catch{return[]}}i(pe,"parseProfiles");function de(t){if(!t||typeof t!="object")return null;let e=t,n=typeof e.name=="string"?c(e.name):"",r=typeof e.baseUrl=="string"?e.baseUrl.trim().replace(/\/+$/,""):"",o=typeof e.model=="string"?e.model.trim():"";if(!n||!r||!o)return null;let s=e.wire==="anthropic"?"anthropic":"openai-compatible",a={name:n,wire:s,providerLabel:typeof e.providerLabel=="string"?e.providerLabel:s,baseUrl:r,model:M(o,r)};return typeof e.authHeader=="string"&&(a.authHeader=e.authHeader),typeof e.authScheme=="string"&&(a.authScheme=e.authScheme),e.extraHeaders&&typeof e.extraHeaders=="object"&&!Array.isArray(e.extraHeaders)&&(a.extraHeaders=e.extraHeaders),e.weak===!0&&(a.weak=!0),e.weak===!1&&(a.weak=!1),a}i(de,"coerceProfile");function v(t,e){b(V,JSON.stringify(t)),b(G,e??void 0)}i(v,"persist");function y(){let t=pe(_(V)),e=_(G),n=typeof e=="string"&&e.trim()?c(e):t[0]?.name??null;return{active:n&&t.some(o=>o.name===n)?n:t[0]?.name??null,profiles:t}}i(y,"listLlmProfiles");function A(t){let e=c(t);return y().profiles.find(n=>n.name===e)??null}i(A,"getLlmProfile");function E(){let t=y();if(t.profiles.length===0)return null;let e=process.env[z]?.trim();if(e){let n=t.profiles.find(r=>r.name===c(e));if(n)return n}return t.active?t.profiles.find(n=>n.name===t.active)??null:null}i(E,"getActiveLlmProfile");function X(t,e){let n=c(t.name),r=(t.baseUrl??e?.baseUrl)?.trim().replace(/\/+$/,""),o=(t.model??e?.model)?.trim(),s=t.wire??e?.wire,a=t.providerLabel??e?.providerLabel,m=[];if(r||m.push("baseUrl"),o||m.push("model"),s||m.push("wire"),m.length)return{ok:!1,missing:m};let u=M(o,r),l={name:n,wire:s,providerLabel:a??s,baseUrl:r,model:u};return t.authHeader===null||(typeof t.authHeader=="string"?l.authHeader=t.authHeader:e?.authHeader!==void 0&&(l.authHeader=e.authHeader)),t.authScheme===null||(typeof t.authScheme=="string"?l.authScheme=t.authScheme:e?.authScheme!==void 0&&(l.authScheme=e.authScheme)),t.extraHeaders===null||(t.extraHeaders?l.extraHeaders=t.extraHeaders:e?.extraHeaders&&(l.extraHeaders=e.extraHeaders)),t.weak===null||(t.weak===!0||t.weak===!1?l.weak=t.weak:(e?.weak===!0||e?.weak===!1)&&(l.weak=e.weak)),{ok:!0,profile:l}}i(X,"canCompleteProfile");function ge(t,e={}){let n=c(t.name),r=y(),o=r.profiles.find(p=>p.name===n)??null,s=X({...t,name:n},o);if(!s.ok)throw new Error(`Incomplete LLM profile '${n}' \u2014 missing: ${s.missing.join(", ")}. Provide --base-url and --model (or --key for auto-detect), or set a full profile first.`);let a=s.profile,m=r.profiles.filter(p=>p.name!==n);m.push(a),m.sort((p,ie)=>p.name.localeCompare(ie.name));let u=!o,l=e.activate===!0||e.activate!==!1&&(u||!r.active)?n:r.active,f=l&&m.some(p=>p.name===l)?l:m[0]?.name??null;return v(m,f),a}i(ge,"upsertLlmProfile");function he(t){let e=c(t),n=A(e);if(!n)throw new Error(`Unknown LLM profile '${e}'. Run: prjct llm status`);let r=y();return v(r.profiles,e),n}i(he,"setActiveLlmProfile");function Le(t){let e=c(t),n=y(),r=n.profiles.filter(s=>s.name!==e);if(r.length===n.profiles.length)return!1;let o=n.active===e?r[0]?.name??null:n.active;return v(r,o),!0}i(Le,"removeLlmProfile");function ye(){let t=y().profiles.map(e=>e.name);return v([],null),t}i(ye,"clearAllLlmProfiles");function Z(t){return t.weak===!0?!0:t.weak===!1?!1:!!(d(t.baseUrl)||/\b([1-7])b\b/i.test(t.model)&&/ollama|lm studio|local/i.test(t.providerLabel))}i(Z,"profileImpliesWeakMode");se();ae();import g from"node:fs";import Q from"node:path";var O="PRJCT_LLM_API_KEY",H="prjct-llm",x="ollama";function K(){return process.platform==="darwin"}i(K,"isDarwin");function T(){return process.env.PRJCT_TEST_MODE==="1"||process.env.PRJCT_LLM_FORCE_FILE==="1"}i(T,"preferFileStore");function I(){return Q.join(J(),"config","llm-keys")}i(I,"keyDir");function $(t){let e=c(t).replace(/[^a-zA-Z0-9._-]+/g,"_").slice(0,64);return Q.join(I(),`${e}.key`)}i($,"keyFilePath");function N(t){let e=c(t).toUpperCase().replace(/-/g,"_");return`${O}_${e}`}i(N,"profileKeyEnvName");var k=new Map;async function q(t){try{let{stdout:e}=await P("security",["find-generic-password","-a",t,"-s",H,"-w"]);return e.trim()||null}catch{return null}}i(q,"readKeychain");function ee(t){try{return g.readFileSync($(t),"utf-8").trim()||null}catch{return null}}i(ee,"readFileKey");async function D(t,e={}){let n=c(t),r=process.env[N(n)]?.trim();if(r)return r;if(e.isActive){let s=process.env[O]?.trim();if(s)return s}if(k.has(n))return k.get(n)??null;let o=(!T()&&K()?await q(n):null)??ee(n);return k.set(n,o),o}i(D,"getLlmKey");async function _e(t,e={}){let n=c(t);if(process.env[N(n)]?.trim())return"env-profile";if(e.isActive&&process.env[O]?.trim())return"env";if(!T()&&K()&&await q(n))return"keychain";let r=ee(n);return r?r===x?"dummy":"file":"none"}i(_e,"getLlmKeyLocation");async function be(t,e){let n=c(t),r=e.trim();if(!r)throw new Error("API key must not be empty");if(k.set(n,r),!T()&&K())try{return await P("security",["add-generic-password","-U","-a",n,"-s",H,"-w",r]),"keychain"}catch{}g.mkdirSync(I(),{recursive:!0,mode:448});let o=$(n);g.writeFileSync(o,`${r}
11
+ `,{mode:384});try{g.chmodSync(o,384)}catch{}return"file"}i(be,"setLlmKey");async function R(t){let e=c(t);if(k.delete(e),!T()&&K())try{await P("security",["delete-generic-password","-a",e,"-s",H])}catch{}try{g.unlinkSync($(e))}catch{}}i(R,"clearLlmKey");async function we(t=[]){let e=new Set;for(let n of t)await R(n),e.add(c(n));try{let n=I();if(g.existsSync(n)){for(let r of g.readdirSync(n)){if(!r.endsWith(".key"))continue;let o=r.replace(/\.key$/,"");await R(o),e.add(o)}try{g.rmdirSync(n)}catch{}}}catch{}return[...e]}i(we,"clearAllLlmKeys");function F(t){return t===x}i(F,"isDummyKey");var h=class extends Error{constructor(n,r,o){super(n);this.status=r;this.bodySnippet=o;this.name="LlmHttpError"}status;bodySnippet;static{i(this,"LlmHttpError")}};async function C(t,e,n=fetch){let r=e.timeoutMs??6e4,{timeoutMs:o,...s}=e,a=new AbortController,m=setTimeout(()=>a.abort(),r),u=i(()=>a.abort(),"onCallerAbort");s.signal&&(s.signal.aborted?a.abort():s.signal.addEventListener("abort",u,{once:!0}));try{let l=await n(t,{...s,signal:a.signal}),f=await l.text();if(!l.ok)throw new h(`LLM HTTP ${l.status} from ${t}: ${f.slice(0,400)}`,l.status,f.slice(0,400));let p=(()=>{try{return f?JSON.parse(f):{}}catch{throw new h(`LLM returned non-JSON from ${t}: ${f.slice(0,200)}`,l.status,f.slice(0,200))}})();return{status:l.status,json:p,text:f}}catch(l){if(l instanceof h)throw l;let f=l instanceof Error?l.message:String(l);throw/abort/i.test(f)?new h(`LLM request timed out after ${r}ms (${t})`):new h(`LLM request failed (${t}): ${f}`)}finally{clearTimeout(m),s.signal&&s.signal.removeEventListener("abort",u)}}i(C,"fetchJson");function B(t){if(t==null)return null;if(typeof t=="string")return t;if(Array.isArray(t)){let e=[];for(let n of t)if(typeof n=="string")e.push(n);else if(n&&typeof n=="object"){let r=n;typeof r.text=="string"&&e.push(r.text)}return e.length?e.join(`
12
+ `):null}return String(t)}i(B,"normalizeMessageContent");var ke="2023-06-01";function ne(t){let e=[],n=[],r=i((o,s)=>{let a=n[n.length-1];if(a?.role===o){a.content=xe(a.content,s);return}n.push({role:o,content:s})},"push");for(let o of t){if(o.role==="system"){let s=o.content??"";s&&e.push(s);continue}if(o.role==="tool"){r("user",[{type:"tool_result",tool_use_id:o.tool_call_id??"tool",content:o.content??""}]);continue}if(o.role==="assistant"&&o.tool_calls?.length){let s=[];o.content&&s.push({type:"text",text:o.content});for(let a of o.tool_calls){let m=(()=>{try{return JSON.parse(a.function.arguments||"{}")}catch{return{raw:a.function.arguments}}})();s.push({type:"tool_use",id:a.id,name:a.function.name,input:m})}r("assistant",s);continue}if(o.role==="user"){r("user",o.content??"");continue}o.role==="assistant"&&r("assistant",o.content??"")}return n.length>0&&n[0]?.role==="assistant"&&n.unshift({role:"user",content:"(continue)"}),{system:e.join(`
13
+
14
+ `)||void 0,messages:n}}i(ne,"toAnthropicMessages");function xe(t,e){return[...te(t),...te(e)]}i(xe,"mergeContent");function te(t){return Array.isArray(t)?t:typeof t=="string"?t?[{type:"text",text:t}]:[]:t==null?[]:[t]}i(te,"toBlockArray");function Ce(t){if(t?.length)return t.map(e=>({name:e.function.name,description:e.function.description,input_schema:e.function.parameters??{type:"object",properties:{}}}))}i(Ce,"toAnthropicTools");async function j(t,e,n,r=fetch){let{system:o,messages:s}=ne(e.messages),a={model:t.model,max_tokens:e.max_tokens??4096,messages:s};o&&(a.system=o),e.temperature!==void 0&&(a.temperature=e.temperature);let m=Ce(e.tools);m&&(a.tools=m);let u=t.baseUrl.replace(/\/+$/,""),l=u.includes("/v1/messages")?u:`${u}/v1/messages`,{json:f}=await C(l,{method:"POST",headers:{"content-type":"application/json","x-api-key":n,"anthropic-version":ke,...t.extraHeaders??{}},body:JSON.stringify(a),timeoutMs:e.timeoutMs??6e4},r);return re(f,t.model)}i(j,"anthropicChat");function re(t,e){let n=t,r=n.content??[],o=[],s=[];for(let u of r)u.type==="text"&&u.text&&o.push(u.text),u.type==="tool_use"&&u.name&&s.push({id:u.id??`toolu_${s.length}`,type:"function",function:{name:u.name,arguments:JSON.stringify(u.input??{})}});let a=n.usage?.input_tokens??0,m=n.usage?.output_tokens??0;return{content:o.length?o.join(`
15
+ `):null,tool_calls:s,model:n.model??e,usage:n.usage?{prompt_tokens:n.usage.input_tokens,completion_tokens:n.usage.output_tokens,total_tokens:a+m>0?a+m:void 0}:void 0,finish_reason:n.stop_reason??null,raw:t}}i(re,"parseAnthropicResponse");function Pe(t){let e={"content-type":"application/json",...t.extraHeaders??{}};if(t.apiKey){let n=t.authHeader?.trim()||"Authorization",r=t.authScheme===void 0?"Bearer":t.authScheme;e[n]=r?`${r} ${t.apiKey}`.trim():t.apiKey}return e}i(Pe,"buildHeaders");function Me(t){let e=t.replace(/\/+$/,"");return e.endsWith("/chat/completions")?e:`${e}/chat/completions`}i(Me,"chatUrl");async function W(t,e,n,r=fetch){let o=e.model??t.model,s={model:o,messages:e.messages};e.tools?.length&&(s.tools=e.tools),e.temperature!==void 0&&(s.temperature=e.temperature),e.max_tokens!==void 0&&(s.max_tokens=e.max_tokens),d(t.baseUrl)&&(s.think=!1,s.reasoning_effort="none");let{json:a}=await C(Me(t.baseUrl),{method:"POST",headers:Pe(n),body:JSON.stringify(s),timeoutMs:e.timeoutMs??6e4},r);return oe(a,o)}i(W,"openaiCompatibleChat");function oe(t,e){let n=t,r=n.choices?.[0],o=r?.message,s=(o?.tool_calls??[]).filter(a=>a.function?.name).map((a,m)=>({id:a.id??`call_${m}`,type:"function",function:{name:a.function?.name??"",arguments:a.function?.arguments??"{}"}}));return{content:B(o?.content),tool_calls:s,model:n.model??e,usage:n.usage,finish_reason:r?.finish_reason??null,raw:t}}i(oe,"parseOpenAiChatResponse");var S=class{constructor(e,n,r=fetch,o=6e4){this.profile=e;this.apiKey=n;this.fetchImpl=r;this.defaultTimeoutMs=o}profile;apiKey;fetchImpl;defaultTimeoutMs;static{i(this,"ProfileLlmProvider")}async generate(e){let n=e.timeoutMs??this.defaultTimeoutMs;if(this.profile.wire==="anthropic"){if(!this.apiKey||F(this.apiKey))throw new Error(`Anthropic profile '${this.profile.name}' has no API key. Set with: prjct llm set --name ${this.profile.name} --key <sk-ant-\u2026>`);return j(this.profile,{messages:e.messages,tools:e.tools,temperature:e.temperature,max_tokens:e.max_tokens,timeoutMs:n},this.apiKey,this.fetchImpl)}let r=this.apiKey??(d(this.profile.baseUrl)?x:null);if(!r&&!d(this.profile.baseUrl))throw new Error(`Profile '${this.profile.name}' has no API key. Set with: prjct llm set --name ${this.profile.name} --key <api-key>`);return W(this.profile,{messages:e.messages,tools:e.tools,temperature:e.temperature,max_tokens:e.max_tokens,timeoutMs:n},{apiKey:r,authHeader:this.profile.authHeader,authScheme:this.profile.authScheme,extraHeaders:this.profile.extraHeaders},this.fetchImpl)}};async function ve(t={}){let e=t.profile?A(t.profile):E();if(!e)return null;let n=E()?.name,r=e.name===n,o=t.apiKey!==void 0?t.apiKey:await D(e.name,{isActive:r});return new S(e,o,t.fetchImpl,t.defaultTimeoutMs)}i(ve,"resolveLlmProvider");function Ae(t){return(t.content??"").trim().length>0||t.tool_calls.length>0}i(Ae,"isUsableCompletion");function Ee(t,e){let n=t.usage?.total_tokens??t.usage?.completion_tokens,r=d(e.baseUrl);return["Model returned empty content (and no tool calls).",n!=null?`Tokens used: ${n}.`:null,t.finish_reason?`finish_reason=${t.finish_reason}.`:null,r?"Local/thinking models often burn the budget on hidden reasoning \u2014 try a non-thinking model, raise num_ctx, or set reasoning_effort=none on the server alias.":"Check the model id and that the key has access."].filter(Boolean).join(" ")}i(Ee,"explainUnusableCompletion");export{le as a,me as b,c,d,ue as e,ce as f,fe as g,y as h,A as i,E as j,ge as k,he as l,Le as m,ye as n,Z as o,x as p,_e as q,be as r,R as s,we as t,ve as u,Ae as v,Ee as w};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as r}from"./chunk-MCY7OXED.mjs";import{b as t}from"./chunk-RACISWUV.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";function u(o){let n=t(o);return n.allow?null:{deny:n.denyMessage}}e(u,"decideSecrets");function l(o=process.cwd(),n){return r({event:"PreToolUse",projectPath:o,decide:e(async c=>{try{return u(c)}catch{return null}},"decide")},n)}e(l,"runPreSecretsHook");var p={decideSecrets:u};export{u as a,l as b,p as c};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as c}from"./chunk-C7YBUD4K.mjs";import{g as l,h as f,i as u}from"./chunk-SO3ZPNWT.mjs";import{a as o}from"./chunk-3TRXQAU4.mjs";var m={none:0,frame:1,reviewed:2},y={none:0,after:1,first:2},p=o((e,n)=>m[e]>=m[n]?e:n,"maxSpec"),g=o((e,n)=>y[e]>=y[n]?e:n,"maxTest");function x(e){return e!=="docs"&&e!=="chore"}o(x,"isCodeKind");function E(e,n,t){let r=x(n);if(n==="research")return{model:"balanced",effort:"medium",spec:"none",tests:"none",fanout:"parallel",quality:"none",expectedPoints:2,directive:"",cast:[]};switch(e){case"H0":return{model:"fast",effort:"low",spec:"none",tests:"none",fanout:"direct",quality:"none",expectedPoints:1,directive:"",cast:[]};case"H1":return{model:"balanced",effort:"medium",spec:"none",tests:r?"after":"none",fanout:"direct",quality:r?"standard":"none",expectedPoints:2,directive:"",cast:[]};case"H2":return{model:"frontier",effort:"medium",spec:r?"frame":"none",tests:r?"first":"none",fanout:"parallel",quality:r?"standard":"none",expectedPoints:5,directive:"",cast:[]};default:return{model:"frontier",effort:t==="high"?"high":"medium",spec:r?"reviewed":"none",tests:r?"first":"none",fanout:"crew",quality:n==="security"||t==="high"||r?"full":"none",expectedPoints:8,directive:"",cast:[]}}}o(E,"baseline");function H(e,n,t,r){if(!x(n))return e;let s=t==="strict"?p(e.spec,"reviewed"):p(e.spec,t==="advisory"?"frame":"none"),a=r==="strict"?g(e.tests,"first"):g(e.tests,r==="assist"?"after":"none");return{...e,spec:s,tests:a}}o(H,"applyModeFloors");var h={none:"no spec",frame:'frame a lightweight spec (`prjct spec "<title>"`)',reviewed:'reviewed spec + audit panel (`prjct spec "<title>"` \u2192 `prjct spec audit <id>`)'},T={none:"no test ceremony",after:"leave a regression test behind",first:"tests BEFORE implementation"},w={direct:"do it yourself \u2014 no subagents",parallel:"DEFAULT multi-agent geometry: explore (fast) \u2192 implement (frontier) \u2192 review (balanced dual-blind); set EACH subagent model explicitly (they inherit yours otherwise: mem_3432). Stay single-thread only for a truly atomic one-file fix",crew:"DEFAULT crew geometry (`prjct crew`): leader + implementer + review lenses. Set EACH subagent model (Explore\u2192fast, implementer\u2192frontier, reviewers\u2192balanced) \u2014 they inherit your expensive model unless you fix it"},v={none:"no judgment tax (trivial)",standard:"quality auto: ledger opened; follow injected `prjct judgment next` card (one review + batch challenge)",full:"quality auto: ledger opened; follow injected next card (RED+BLUE dual-blind + batch refuters)"},S={fast:"fast/cheap model (e.g. haiku)",balanced:"balanced model (e.g. sonnet)",frontier:"frontier model (e.g. opus)"},O="Before implementing, forecast the diff size: if it will exceed ~400 changed lines, decide the delivery strategy NOW (split into stacked PRs / ship a first slice) instead of producing one unreviewable diff.";function P(e,n,t){let r=t.effort==="high"?", HIGH effort":t.effort==="low"?", low effort":"";if(e==="H0")return`Orchestrate (${e} ${n}): trivial \u2014 do it directly on a ${S[t.model]}${r}. ${h[t.spec]}, ${T[t.tests]}, ${w[t.fanout]}. ${v[t.quality]}. Don\u2019t burn frontier tokens on this. ${c}`;let s=e==="H2"||e==="H3"?` ${O}`:"",a=t.fanout==="parallel"||t.fanout==="crew"?" Multi-agent is the DEFAULT geometry for this harness class \u2014 do not collapse to a single-thread monologue unless the change is truly atomic.":"",i=t.cast.length>0?` ${l(t.cast)}. ${f(t.cast)}`:"";return`Orchestrate (${e} ${n}/${t.model}${r}): ${h[t.spec]}; ${T[t.tests]}; ${w[t.fanout]}; ${v[t.quality]}.${s}${a}${i} ${c}`}o(P,"renderDirective");function q(e){return e<50?1:e<150?2:e<400?5:8}o(q,"pointsFromDiffLines");function A(e){return e>=8?`\u26A0 Delegation trigger: ${e} files edited this cycle. This is no longer one change \u2014 split the remainder into its own cycle/PR and run a FRESH-context review of what's already written before \`prjct status done\`.`:e>=4?`\u21B3 Delegation trigger: ${e} files edited this cycle. Keep ONE writer thread; before closing, review the full diff with fresh eyes (subagent or re-read) \u2014 multi-file changes hide cross-file breaks.`:null}o(A,"renderDelegationTrigger");function D(e,n="off",t="off",r="off",s){let a=E(e.level,e.kind,e.risk),i=H(a,e.kind,n,t),b=r==="on"&&i.quality==="none"?"standard":r==="on"&&i.quality==="standard"?"full":i.quality,$=(s??`${e.level}:${e.kind}:${e.risk}`).trim(),C=u(i.fanout,$),d={...i,quality:b,cast:C};return{...d,directive:P(e.level,e.kind,d)}}o(D,"orchestrationFor");export{q as a,A as b,D as c};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as d}from"./chunk-NXUIMC22.mjs";import{d as r}from"./chunk-INJ5WT2D.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";var u={upsert:"updated",delete:"deleted"},o={value:null};async function p(){if(o.value)return o.value;try{let{default:e}=await import("./auth-config-KWLVKHCY.mjs"),t=e;if(typeof t.getDeviceId=="function"){let n=await t.getDeviceId();return o.value=n,n}return"unknown-device"}catch{return"unknown-device"}}i(p,"resolveDeviceId");async function v(e){try{let t=await p(),n=r(e.data),c={type:`${e.entityType}.${u[e.eventType]}`,path:[e.entityType,e.entityId],data:e.data,timestamp:new Date().toISOString(),projectId:e.projectId,entityType:e.entityType,entityId:e.entityId,eventType:e.eventType,contentHash:n,deviceId:t,originDeviceId:e.originDeviceId??t,revisionCount:e.revisionCount??1};await d.publish(c)}catch{}}i(v,"publishCRUD");function a(e){v(e)}i(a,"publishCRUDSync");export{v as a,a as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as f}from"./chunk-76YMLNLF.mjs";import{a as m}from"./chunk-3TRXQAU4.mjs";function C(r){let e=r.toLowerCase(),s=f.reduce((n,i)=>{let o=i.name;if(Math.abs(o.length-e.length)>2)return n;let t=g(e,o.toLowerCase());return t<n.distance?{name:o,distance:t}:n},{name:null,distance:1/0});return s.distance<=2?s.name:null}m(C,"findClosestCommand");function g(r,e){let s=r.length,n=e.length;if(Math.abs(s-n)>2)return 3;let i=Array.from({length:n+1},(t,c)=>c);return Array.from(r).reduce((t,c,u)=>{let l=[u+1];for(let[a,d]of Array.from(e).entries())l.push(c===d?t[a]:1+Math.min(t[a+1],l[a],t[a]));return l},i)[n]}m(g,"editDistance");export{C as a};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as y}from"./chunk-F7OOBAJO.mjs";import{c}from"./chunk-4PPIE6GA.mjs";import{F as a,G as j}from"./chunk-HU5ERAAV.mjs";import{f as g,g as u,n as h,p as P}from"./chunk-HYIT7MF5.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";j();P();import x from"node:path";function d(){return x.join(a.getStatePath(),"cloud-linked.json")}s(d,"registryPath");async function l(){let i=await g(d(),[]);return Array.isArray(i)?i.filter(t=>t?.projectId&&t?.projectPath):[]}s(l,"listLinkedProjects");async function _(i,t){let n=(await l()).filter(r=>r.projectId!==i);n.push({projectId:i,projectPath:t}),await h(a.getStatePath()),await u(d(),n)}s(_,"addLinkedProject");async function I(i){let t=await l();await h(a.getStatePath()),await u(d(),t.filter(e=>e.projectId!==i))}s(I,"removeLinkedProject");function v(){return typeof globalThis.WebSocket=="function"}s(v,"hasGlobalWebSocket");function R(i,t,e,n){let r=i.replace(/\/$/,"").replace(/^http/,"ws"),o=new URLSearchParams({key:e,device:n,project:t});return`${r}/ws?${o.toString()}`}s(R,"buildRealtimeUrl");function M(i,t,e){let n=Math.min(e,t*2**i);return Math.round(Math.random()*n)}s(M,"backoffDelay");var p=class{static{s(this,"RealtimeClient")}opts;ws=null;_state="idle";attempt=0;stopped=!1;reconnectTimer=null;constructor(t){this.opts={...t,wsFactory:t.wsFactory??(e=>new globalThis.WebSocket(e)),baseDelayMs:t.baseDelayMs??1e3,maxDelayMs:t.maxDelayMs??3e4}}get state(){return this._state}start(){this.stopped||this._state==="connecting"||this._state==="open"||this.connect()}stop(){this.stopped=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSocket(),this._state="closed"}connect(){this._state=this.attempt===0?"connecting":"reconnecting";let t=R(this.opts.apiUrl,this.opts.projectId,this.opts.apiKey,this.opts.deviceId),e=(()=>{try{return this.opts.wsFactory(t)}catch{return null}})();if(!e){this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{this._state="open",this.attempt=0},e.onmessage=n=>{this.handleMessage(n?.data)},e.onerror=()=>{},e.onclose=()=>{this.stopped||this.scheduleReconnect()}}async handleMessage(t){let e=(()=>{try{return typeof t=="string"?JSON.parse(t):t}catch{return null}})();if(!e||typeof e!="object")return;let n=e;if(n.type==="event"&&n.event&&typeof n.event=="object")try{await this.opts.apply(this.opts.projectId,n.event)}catch{}}scheduleReconnect(){if(this.stopped)return;this.closeSocket(),this._state="reconnecting";let t=M(this.attempt,this.opts.baseDelayMs,this.opts.maxDelayMs);this.attempt+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.stopped||this.connect()},t),this.reconnectTimer?.unref?.()}closeSocket(){if(!this.ws)return;let t=this.ws;t.onopen=null,t.onmessage=null,t.onclose=null,t.onerror=null;try{t.close()}catch{}this.ws=null}};var m=class{static{s(this,"RealtimeManager")}clients=new Map;available(){return process.env.PRJCT_IN_DAEMON==="1"&&v()}async startAll(){if(!this.available())return;let t=await l();for(let e of t)try{await this.start(e.projectId,e.projectPath)}catch{}}async start(t,e){if(!this.available()||this.clients.has(t))return;let{default:n}=await import("./config-manager-QVFHXIKI.mjs"),r=await n.readConfig(e).catch(()=>null);if(!r?.cloud?.enabled||r.cloud.paused)return;let o=await c.read();if(!o.apiKey)return;let[w,b]=await Promise.all([c.getApiUrl(),c.getDeviceId()]),f=new p({projectId:t,apiUrl:w,apiKey:o.apiKey,deviceId:b,apply:s((k,S)=>y.applyRealtimeEvent(k,S),"apply")});this.clients.set(t,f),f.start()}stop(t){let e=this.clients.get(t);e&&(e.stop(),this.clients.delete(t))}stopAll(){for(let t of this.clients.values())t.stop();this.clients.clear()}status(t){return this.clients.get(t)?.state??"disabled"}},T=new m,N=T;export{l as a,_ as b,I as c,T as d,N as e};
@@ -0,0 +1,25 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{g as S,i as G}from"./chunk-DMO3ZFUG.mjs";import{a as B,c as te,d as W,e as $,p as ne}from"./chunk-HYIT7MF5.mjs";import{a as d}from"./chunk-3TRXQAU4.mjs";te();import N from"node:fs/promises";import E from"node:path";G();function j(e,n){S.transaction(e,t=>{t.prepare("DELETE FROM code_symbols").run(),t.prepare("DELETE FROM code_symbol_edges").run();let s=t.prepare(`INSERT INTO code_symbols (id, file, kind, name, qname, start_line, end_line, exported)
8
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`),i=t.prepare(`INSERT OR IGNORE INTO code_symbol_edges (src, dst, edge_type, confidence)
9
+ VALUES (?, ?, ?, ?)`);for(let r of n.symbols)s.run(r.id,r.file,r.kind,r.name,r.qname,r.startLine,r.endLine,r.exported?1:0);for(let r of n.edges)i.run(r.src,r.dst,r.edgeType,r.confidence)})}d(j,"replaceCodeGraph");function we(e){try{return S.query(e,"SELECT src, dst, edge_type, confidence FROM code_symbol_edges").map(n=>({src:n.src,dst:n.dst,edgeType:n.edge_type,confidence:n.confidence}))}catch{return[]}}d(we,"loadCodeSymbolEdges");G();ne();var D="symbol-graph",se=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".go",".rs",".java"]),re=new Set(["if","for","while","switch","catch","function","class","return","typeof","new","throw","await","void","super","this","import","require","console","Math","JSON","Object","Array","Promise","Map","Set","Date","Error","Buffer","process","describe","it","test","expect","beforeEach","afterEach","beforeAll","afterAll"]),oe=new Set(["if","for","while","switch","catch","return","await","typeof","new","throw","else","case","from","import","export","class","function","const","let","var","get","set","constructor","async","static","public","private","protected","readonly","abstract","extends","implements","interface","type","enum","default","as","of","in","do","try","finally","yield","with"]);function L(e,n){return e.slice(0,Math.min(n,e.length)).split(`
10
+ `).length}d(L,"lineOf");function ie(e,n,t,s){return`${e}#${n}:${t}@${s}`}d(ie,"symbolId");function H(e,n){return`${e.replace(/\.[^.]+$/,"").replace(/[/\\]/g,".")}.${n}`}d(H,"qnameOf");function I(e){let n=E.extname(e).toLowerCase();return se.has(n)}d(I,"isSourceFile");function O(e){let n=/\/\/[^\n]*(?:\n|$)|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$)|'(?:\\[\s\S]|[^'\\])*(?:'|$)|"(?:\\[\s\S]|[^"\\])*(?:"|$)|`(?:\\[\s\S]|[^`\\])*(?:`|$)/g;return e.replace(n,t=>t.replace(/[^\n]/g," "))}d(O,"stripNoise");function K(e){return{filePath:e,symbols:[],callNames:[],calls:[],importBindings:new Map,resolvedImports:new Map}}d(K,"emptyExtract");function z(e){let n=[...new Set(e.map(t=>t.name))];return{calls:e,callNames:n}}d(z,"finalizeCalls");function ae(e,n){let t=[],s=[],i=new Map,r=O(e),a=[{re:/export\s+(?:async\s+)?function\s+(\w+)/g,kind:"function",nameIdx:1,exported:!0},{re:/(?:^|[^\w.])(?:async\s+)?function\s+(\w+)/g,kind:"function",nameIdx:1},{re:/export\s+(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_]\w*)\s*=>/g,kind:"function",nameIdx:1,exported:!0},{re:/(?:^|[\n;])(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_]\w*)\s*=>/g,kind:"function",nameIdx:1},{re:/export\s+(?:abstract\s+)?class\s+(\w+)/g,kind:"class",nameIdx:1,exported:!0},{re:/(?:^|[^\w.])(?:abstract\s+)?class\s+(\w+)/g,kind:"class",nameIdx:1},{re:/export\s+interface\s+(\w+)/g,kind:"interface",nameIdx:1,exported:!0},{re:/(?:^|[^\w.])interface\s+(\w+)/g,kind:"interface",nameIdx:1},{re:/export\s+type\s+(\w+)\s*[=<]/g,kind:"type",nameIdx:1,exported:!0},{re:/(?:^|[^\w.])type\s+(\w+)\s*[=<]/g,kind:"type",nameIdx:1},{re:/export\s+enum\s+(\w+)/g,kind:"enum",nameIdx:1,exported:!0},{re:/(?:^|[^\w.])enum\s+(\w+)/g,kind:"enum",nameIdx:1},{re:/export\s+(?:const|let|var)\s+(\w+)\s*[:=]/g,kind:"const",nameIdx:1,exported:!0},{re:/(?:^|\n)[ \t]+(?:(?:public|private|protected|static|async|readonly)\s+)*(\w+)\s*\([^)]{0,200}\)\s*[:{]/g,kind:"method",nameIdx:1}],o=new Set;for(let{re:m,kind:y,nameIdx:b,exported:C}of a){m.lastIndex=0;for(let _ of r.matchAll(m)){let x=_[b];if(!x||x.length<2||oe.has(x))continue;let h=L(r,_.index),T=`${y}:${x}@${h}`;o.has(T)||(o.add(T),t.push({kind:y,name:x,startLine:h,endLine:null,exported:C===!0}))}}let c=/import\s+(?:type\s+)?(?:\{([^}]+)\}|(\w+)(?:\s*,\s*\{([^}]+)\})?|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/g;for(let m of e.matchAll(c)){let y=m[5],b=d(C=>{if(C)for(let _ of C.split(",")){let x=_.trim().replace(/^type\s+/,"").split(/\s+as\s+/),h=(x[1]??x[0])?.trim();h&&/^[A-Za-z_][\w]*$/.test(h)&&i.set(h,y)}},"bindNamed");b(m[1]),b(m[3]),m[2]&&i.set(m[2],y),m[4]&&i.set(m[4],y)}let l=/(?:const|let|var)\s+(\w+)\s*=\s*require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;for(let m of e.matchAll(l))i.set(m[1],m[2]);let f=/\b([A-Za-z_][\w]*)\s*\(/g,p=400;for(let m of r.matchAll(f)){let y=m[1];if(re.has(y)||y.length<2)continue;let b=L(r,m.index);if(s.push({name:y,line:b}),s.length>=p)break}let g=/\.(?:get|post|put|patch|delete|options|head|all)\s*\(\s*['"`](\/[^'"`]*)['"`]/gi;for(let m of e.matchAll(g)){let b=m[1].replace(/[^\w/.-]/g,"").slice(0,64)||"route";t.push({kind:"route",name:b,startLine:L(e,m.index),endLine:null,exported:!0})}let w=/@(?:app|router|api|bp)\.(?:get|post|put|patch|delete|options|head|api_route)\s*\(\s*['"`](\/[^'"`]*)['"`]/gi;for(let m of e.matchAll(w)){let b=m[1].replace(/[^\w/.-]/g,"").slice(0,64)||"route";t.push({kind:"route",name:b,startLine:L(e,m.index),endLine:null,exported:!0})}if(/(?:^|\/)route\.(ts|js|tsx|jsx)$/.test(n.replace(/\\/g,"/"))){let m=/\bexport\s+(?:async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\b/g;for(let y of e.matchAll(m))t.push({kind:"route",name:`${y[1]} ${n.replace(/\\/g,"/")}`,startLine:L(e,y.index),endLine:null,exported:!0})}let u=z(s);return{filePath:n,symbols:t,callNames:u.callNames,calls:u.calls,importBindings:i,resolvedImports:new Map}}d(ae,"extractTsJs");function ce(e,n){let t=[],s=[],i=O(e),r=/^(?:async\s+)?def\s+(\w+)\s*\(/gm,a=/^class\s+(\w+)/gm;for(let l of i.matchAll(r))t.push({kind:"function",name:l[1],startLine:L(i,l.index),endLine:null,exported:!l[1].startsWith("_")});for(let l of i.matchAll(a))t.push({kind:"class",name:l[1],startLine:L(i,l.index),endLine:null,exported:!l[1].startsWith("_")});let o=/\b([A-Za-z_][\w]*)\s*\(/g;for(let l of i.matchAll(o)){let f=l[1];/^(if|for|while|return|print|len|range|str|int|list|dict|set|super|self)$/.test(f)||s.push({name:f,line:L(i,l.index)})}let c=z(s);return{filePath:n,symbols:t,callNames:c.callNames,calls:c.calls,importBindings:new Map,resolvedImports:new Map}}d(ce,"extractPython");function le(e,n){let t=[],s=O(e),i=/^func\s+(?:\([^)]+\)\s+)?(\w+)\s*\(/gm,r=/^type\s+(\w+)\s+(?:struct|interface)/gm;for(let a of s.matchAll(i)){let o=a[1];t.push({kind:"function",name:o,startLine:L(s,a.index),endLine:null,exported:o[0]===o[0].toUpperCase()})}for(let a of s.matchAll(r))t.push({kind:"type",name:a[1],startLine:L(s,a.index),endLine:null,exported:a[1][0]===a[1][0].toUpperCase()});return{filePath:n,symbols:t,callNames:[],calls:[],importBindings:new Map,resolvedImports:new Map}}d(le,"extractGo");function de(e,n){let t=[],s=O(e),i=/^(?:pub\s+)?(?:async\s+)?fn\s+(\w+)/gm,r=/^(?:pub\s+)?struct\s+(\w+)/gm,a=/^(?:pub\s+)?trait\s+(\w+)/gm,o=/^(?:pub\s+)?enum\s+(\w+)/gm;for(let[c,l]of[[i,"function"],[r,"class"],[a,"interface"],[o,"enum"]])for(let f of s.matchAll(c))t.push({kind:l,name:f[1],startLine:L(s,f.index),endLine:null,exported:/^pub\b/.test(f[0])});return{filePath:n,symbols:t,callNames:[],calls:[],importBindings:new Map,resolvedImports:new Map}}d(de,"extractRust");function me(e,n){let t=[],s=O(e),i=/(?:public\s+|private\s+|protected\s+)?(?:abstract\s+|final\s+)?class\s+(\w+)/g,r=/(?:public\s+)?interface\s+(\w+)/g,a=/(?:public|private|protected)\s+(?:static\s+)?(?:final\s+)?[\w.<>,[\]\s]+\s+(\w+)\s*\(/g;for(let o of s.matchAll(i))t.push({kind:"class",name:o[1],startLine:L(s,o.index),endLine:null,exported:!0});for(let o of s.matchAll(r))t.push({kind:"interface",name:o[1],startLine:L(s,o.index),endLine:null,exported:!0});for(let o of s.matchAll(a))/^(if|for|while|switch|catch|return|new)$/.test(o[1])||t.push({kind:"method",name:o[1],startLine:L(s,o.index),endLine:null,exported:!0});return{filePath:n,symbols:t,callNames:[],calls:[],importBindings:new Map,resolvedImports:new Map}}d(me,"extractJava");function ue(e,n){let t=E.extname(n).toLowerCase();return[".ts",".tsx",".js",".jsx",".mjs",".cjs"].includes(t)?ae(e,n):t===".py"?ce(e,n):t===".go"?le(e,n):t===".rs"?de(e,n):t===".java"?me(e,n):K(n)}d(ue,"extractFile");async function fe(e){let n=[];for(let t of["tsconfig.json","jsconfig.json"])try{let i=(await N.readFile(E.join(e,t),"utf-8")).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,""),r=JSON.parse(i),a=r.compilerOptions?.paths,o=r.compilerOptions?.baseUrl??".";if(!a)continue;for(let[c,l]of Object.entries(a))n.push({pattern:c,targets:l.map(f=>E.posix.join(o.replace(/\\/g,"/"),f))});break}catch{}return n}d(fe,"loadTsPathMap");function ge(e,n){let t=[];for(let{pattern:s,targets:i}of n)if(s.endsWith("/*")){let r=s.slice(0,-1),a=s.slice(0,-2);if(e===a||e.startsWith(`${a}/`)){let o=e.slice(a.length).replace(/^\//,"");for(let c of i){let l=c.endsWith("/*")?c.slice(0,-1):c;t.push(E.posix.join(l.replace(/\*$/,""),o).replace(/\\/g,"/"))}}}else if(e===s)for(let r of i)t.push(r.replace(/\*$/,""));return t}d(ge,"applyTsPath");async function pe(e,n,t,s){let i=[];if(t.startsWith(".")){let r=E.dirname(E.join(e,n));i.push(E.resolve(r,t))}else if(t.startsWith("@/"))i.push(E.join(e,"src",t.slice(2))),i.push(E.join(e,t.slice(2)));else{for(let r of ge(t,s))i.push(E.join(e,r));i.push(E.join(e,"packages",t)),i.push(E.join(e,"src",t))}for(let r of i)for(let a of B){let o=r+a;try{if((await N.stat(o)).isFile())return E.relative(e,o).replace(/\\/g,"/")}catch{}}return null}d(pe,"resolveSpecifierToFile");async function ye(e,n,t){for(let[s,i]of n.importBindings){let r=await pe(e,n.filePath,i,t);r&&n.resolvedImports.set(s,r)}}d(ye,"resolveImportsForExtract");function U(e,n){let t=e.replace(/\\/g,"/"),s=n.replace(/\\/g,"/").replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"");return t===n||t.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"")===s||t===`${s}.ts`||t===`${s}.tsx`||t===`${s}.js`||t===`${s}.jsx`||t===`${s}/index.ts`||t===`${s}/index.tsx`||t===`${s}/index.js`}d(U,"matchFileToMod");function Y(e,n){return e.filter(s=>s.kind==="function"||s.kind==="method"||s.kind==="class").reduce((s,i)=>i.startLine<=n&&(!s||i.startLine>s.startLine)?i:s,null)}d(Y,"enclosingSymbol");function Z(e,n,t,s){let i=t.filter(o=>o.name===e);if(i.length===1)return{targets:i,confidence:.95};if(i.length>1){let o=i.filter(c=>c.exported);if(o.length===1)return{targets:o,confidence:.9}}let r=n.resolvedImports.get(e);if(r){let o=(s.get(e)??[]).filter(f=>U(f.file,r));if(o.length>0)return{targets:o,confidence:.9};let c=[...s.values()].flat().filter(f=>U(f.file,r)&&f.exported),l=c.find(f=>f.kind==="function"||f.kind==="class")??c[0];if(l)return{targets:[l],confidence:.65}}let a=s.get(e)??[];if(a.length===1)return{targets:a,confidence:.75};if(a.length>1){let o=a.filter(c=>c.exported);if(o.length===1)return{targets:o,confidence:.7}}return{targets:[],confidence:0}}d(Z,"resolveCallTargets");function J(e){let n=[],t=[],s=new Map,i=new Map;for(let o of e){let c=[];for(let l of o.symbols){let f=ie(o.filePath,l.kind,l.name,l.startLine),p={id:f,file:o.filePath,kind:l.kind,name:l.name,qname:H(o.filePath,l.name),startLine:l.startLine,endLine:l.endLine,exported:l.exported};n.push(p),c.push(p);let g=s.get(l.name)??[];g.push(p),s.set(l.name,g),t.push({src:`file:${o.filePath}`,dst:f,edgeType:"DEFINES",confidence:1})}i.set(o.filePath,c)}for(let o of e){let c=i.get(o.filePath)??[],l=new Set;for(let f of o.calls){if(c.some(m=>m.name===f.name&&m.startLine===f.line))continue;let{targets:p,confidence:g}=Z(f.name,o,c,s);if(p.length===0)continue;let u=Y(c,f.line)?.id??`file:${o.filePath}`;for(let m of p){if(m.id===u)continue;let y=`${u}|${m.id}`;l.has(y)||(l.add(y),t.push({src:u,dst:m.id,edgeType:"CALLS",confidence:g}))}}}let r=new Set,a=[];for(let o of t){let c=`${o.src}|${o.dst}|${o.edgeType}`;r.has(c)||(r.add(c),a.push(o))}return{symbols:n,edges:a,fileCount:e.length}}d(J,"buildFromExtracts");async function V(e,n){let s=(n??(await W(e)).filter(a=>I(a)&&!a.includes(".d.ts"))).filter(a=>I(a)&&!a.endsWith(".d.ts")),i=await fe(e),r=await $(s,40,async a=>{try{let o=await N.readFile(E.join(e,a),"utf-8"),c=o.length>4e5?o.slice(0,4e5):o;return ue(c,a)}catch{return K(a)}});return await $(r,40,async a=>(await ye(e,a,i),a)),r}d(V,"extractProject");function be(e,n){j(e,n);let t={symbolCount:n.symbols.length,edgeCount:n.edges.length,fileCount:n.fileCount,builtAt:new Date().toISOString()};S.setDoc(e,D,t)}d(be,"persistGraph");function he(e,n,t){let s=new Set([...n.map(c=>c.filePath),...t]);if(s.size===0)return Q(e);let i=xe(e).filter(c=>!s.has(c.file)),r=J(n);S.transaction(e,c=>{let l=c.prepare("DELETE FROM code_symbols WHERE file = ?");for(let u of s)c.prepare("DELETE FROM code_symbol_edges WHERE src LIKE ? OR dst LIKE ? OR src = ? OR dst = ?").run(`${u}#%`,`${u}#%`,`file:${u}`,`file:${u}`),l.run(u);let f=c.prepare(`INSERT INTO code_symbols (id, file, kind, name, qname, start_line, end_line, exported)
11
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`),p=c.prepare(`INSERT OR IGNORE INTO code_symbol_edges (src, dst, edge_type, confidence)
12
+ VALUES (?, ?, ?, ?)`);for(let u of r.symbols)f.run(u.id,u.file,u.kind,u.name,u.qname,u.startLine,u.endLine,u.exported?1:0);let g=new Map;for(let u of[...i,...r.symbols]){let m=g.get(u.name)??[];m.push(u),g.set(u.name,m)}let w=new Map;for(let u of[...i,...r.symbols])w.has(u.file)||w.set(u.file,[]),w.get(u.file).push(u);for(let u of n){let m=w.get(u.filePath)??[];for(let b of m.filter(C=>C.file===u.filePath))p.run(`file:${u.filePath}`,b.id,"DEFINES",1);let y=new Set;for(let b of u.calls){if(m.some(T=>T.name===b.name&&T.startLine===b.line))continue;let{targets:C,confidence:_}=Z(b.name,u,m,g);if(C.length===0)continue;let h=Y(m,b.line)?.id??`file:${u.filePath}`;for(let T of C){if(T.id===h)continue;let R=`${h}|${T.id}`;y.has(R)||(y.add(R),p.run(h,T.id,"CALLS",_))}}}});let a=S.get(e,`SELECT
13
+ (SELECT COUNT(*) FROM code_symbols) AS sc,
14
+ (SELECT COUNT(*) FROM code_symbol_edges) AS ec,
15
+ (SELECT COUNT(DISTINCT file) FROM code_symbols) AS fc`),o={symbolCount:a?.sc??0,edgeCount:a?.ec??0,fileCount:a?.fc??0,builtAt:new Date().toISOString()};return S.setDoc(e,D,o),o}d(he,"patchGraph");async function Se(e,n){let t=await V(e),s=J(t);return be(n,s),{symbolCount:s.symbols.length,edgeCount:s.edges.length,fileCount:s.fileCount,builtAt:new Date().toISOString()}}d(Se,"indexSymbols");async function Re(e,n,t,s=[]){if(!X(n))return Se(e,n);let i=t.filter(o=>I(o)&&!o.endsWith(".d.ts")),r=s.filter(o=>I(o));if(i.length===0&&r.length===0)return Q(n)??{symbolCount:0,edgeCount:0,fileCount:0,builtAt:new Date().toISOString()};let a=await V(e,i);return he(n,a,r)??{symbolCount:0,edgeCount:0,fileCount:0,builtAt:new Date().toISOString()}}d(Re,"updateSymbols");function X(e){try{return(S.get(e,"SELECT COUNT(*) AS n FROM code_symbols")?.n??0)>0}catch{return!1}}d(X,"hasSymbolIndex");function Q(e){return S.getDoc(e,D)}d(Q,"loadMeta");function A(e){return{id:e.id,file:e.file,kind:e.kind,name:e.name,qname:e.qname??H(e.file,e.name),startLine:e.start_line,endLine:e.end_line,exported:e.exported===1}}d(A,"rowToSymbol");function xe(e){try{return S.query(e,"SELECT * FROM code_symbols ORDER BY file, start_line").map(A)}catch{return[]}}d(xe,"listAllSymbols");function v(e,n,t={}){let s=t.limit??30,i=`%${n.replace(/[%_]/g,"")}%`;try{return t.kind?S.query(e,`SELECT * FROM code_symbols
16
+ WHERE name LIKE ? COLLATE NOCASE AND kind = ?
17
+ ORDER BY exported DESC, name
18
+ LIMIT ?`,i,t.kind,s).map(A):S.query(e,`SELECT * FROM code_symbols
19
+ WHERE name LIKE ? COLLATE NOCASE OR qname LIKE ? COLLATE NOCASE
20
+ ORDER BY exported DESC, name
21
+ LIMIT ?`,i,i,s).map(A)}catch{return[]}}d(v,"searchSymbols");function Ie(e,n,t=20){let s=n.split(/[^A-Za-z0-9_]+/).flatMap(r=>r.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/)).map(r=>r.trim()).filter(r=>r.length>2);if(s.length===0||!X(e))return[];let i=new Map;for(let r of s){let a=v(e,r,{limit:40});for(let o of a){let c=o.name.toLowerCase()===r.toLowerCase()?1:.55,l=o.exported?1.15:1,f=o.kind==="function"||o.kind==="class"||o.kind==="route"?1.1:1,p=c*l*f,g=i.get(o.file)??{score:0,names:new Set};g.score+=p,g.names.add(o.name),i.set(o.file,g)}}return Array.from(i.entries()).map(([r,a])=>({path:r,score:a.score,matchedNames:[...a.names]})).sort((r,a)=>a.score-r.score).slice(0,t)}d(Ie,"scoreFilesFromQuery");function q(e,n){try{return S.query(e,"SELECT * FROM code_symbols WHERE file = ? ORDER BY start_line",n).map(A)}catch{return[]}}d(q,"symbolsInFile");function P(e,n="CALLS"){let t=new Map,s=new Map;try{let i=S.query(e,"SELECT src, dst FROM code_symbol_edges WHERE edge_type = ?",n);for(let r of i)t.has(r.src)||t.set(r.src,[]),t.get(r.src).push(r.dst),s.has(r.dst)||s.set(r.dst,[]),s.get(r.dst).push(r.src)}catch{}return{forward:t,reverse:s}}d(P,"loadEdges");function ee(e,n){try{let t=S.get(e,"SELECT * FROM code_symbols WHERE id = ?",n);return t?A(t):null}catch{return null}}d(ee,"symbolById");function Fe(e,n,t={}){let s=t.direction??"both",i=Math.min(Math.max(t.depth??3,1),5),r=v(e,n,{limit:10}).filter(w=>w.name.toLowerCase()===n.toLowerCase()),a=r.length>0?r:v(e,n,{limit:5});if(a.length===0)return null;let{forward:o,reverse:c}=P(e,"CALLS"),l=[],f=[],p=d((w,u,m,y)=>{let b=new Set(w),C=w.map(_=>({id:_,depth:0}));for(let{id:_,depth:x}of C)if(!(x>=y))for(let h of u.get(_)??[]){if(b.has(h))continue;if(b.add(h),h.startsWith("file:")){let R=h.slice(5),F=q(e,R),k=F.find(M=>M.exported&&(M.kind==="function"||M.kind==="class"))??F.find(M=>M.kind==="function"||M.kind==="class")??F[0];k&&!b.has(k.id)&&(b.add(k.id),m.push({symbol:k,depth:x+1,via:"CALLS"}),C.push({id:k.id,depth:x+1})),C.push({id:h,depth:x+1});continue}let T=ee(e,h);T&&(m.push({symbol:T,depth:x+1,via:"CALLS"}),C.push({id:h,depth:x+1}))}},"bfs"),g=a.map(w=>w.id);return(s==="inbound"||s==="both")&&p(g,c,l,i),(s==="outbound"||s==="both")&&p(g,o,f,i),{root:a,inbound:l,outbound:f}}d(Fe,"tracePath");function $e(e,n){let t=q(e,n);if(t.length===0)return 0;let{reverse:s}=P(e,"CALLS"),i=new Set;for(let r of t)for(let a of s.get(r.id)??[])i.add(a);return i.size}d($e,"fileFanIn");function ve(e){try{let n=S.query(e,`SELECT target.file AS file, COUNT(DISTINCT edge.src) AS caller_count
22
+ FROM code_symbol_edges AS edge
23
+ JOIN code_symbols AS target ON target.id = edge.dst
24
+ WHERE edge.edge_type = 'CALLS'
25
+ GROUP BY target.file`);return new Map(n.map(t=>[t.file,t.caller_count]))}catch{return new Map}}d(ve,"fileFanInByFile");function Ne(e,n,t=2){let s=new Set(n),{reverse:i}=P(e,"CALLS"),r=new Set;for(let c of n)for(let l of q(e,c))r.add(l.id);let a=new Set,o=new Set(r);return Array.from({length:t}).reduce(c=>{let l=[];for(let f of c)for(let p of i.get(f)??[])if(!o.has(p))if(o.add(p),l.push(p),p.startsWith("file:")){let g=p.slice(5);s.has(g)||a.add(g)}else{let g=ee(e,p);g&&!s.has(g.file)&&a.add(g.file)}return l},[...r]),[...a]}d(Ne,"filesCallingInto");export{j as a,we as b,O as c,ue as d,Se as e,Re as f,X as g,Q as h,xe as i,v as j,Ie as k,q as l,Fe as m,$e as n,ve as o,Ne as p};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as o,c,e as s}from"./chunk-UT425KVX.mjs";import{b as i,c as d}from"./chunk-DOJPSIMG.mjs";import{a as n}from"./chunk-3TRXQAU4.mjs";d();import{existsSync as p}from"node:fs";import m from"node:path";function a(){return process.env.PRJCT_TEST_MODE==="1"?[i(".prjct-tests","kimi-code"),i(".prjct-tests","kimi")]:[i(".kimi-code"),i(".kimi")]}n(a,"kimiHomeDirs");function v(){return a().map(t=>m.join(t,"mcp.json"))}n(v,"getKimiMcpConfigPaths");function g(){let[t,e]=a(),r=p(e)&&!p(t)?e:t;return m.join(r,"mcp.json")}n(g,"getKimiMcpConfigPath");async function l(t=g()){let e=await c("context7",o.context7,t),r=await c("prjct",o.prjct,t);return{path:t,changed:e.changed||r.changed}}n(l,"ensureKimiMcpServer");async function S(){let t=await Promise.all(v().map(async e=>{let r=await s("prjct",e),u=await s("context7",e,o.context7);return{path:e,removed:(r.changed?1:0)+(u.changed?1:0)}}));return{paths:t.filter(e=>e.removed>0).map(e=>e.path),serversRemoved:t.reduce((e,r)=>e+r.removed,0)}}n(S,"uninstallKimiMcpServer");export{v as a,g as b,l as c,S as d};
@@ -0,0 +1,10 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as h}from"./chunk-DIEPWXJJ.mjs";import{b as k}from"./chunk-NINFE7GS.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";var _=[{name:"sk-\u2026 token",re:/\bsk-[A-Za-z0-9_-]{16,}/},{name:"prjct live token",re:/\bprjct_sk_(?:live|test)_[A-Za-z0-9_-]{8,}/},{name:"GitHub PAT",re:/\bghp_[A-Za-z0-9]{30,}/},{name:"GitHub server PAT",re:/\bghs_[A-Za-z0-9]{30,}/},{name:"GitHub fine-grained PAT",re:/\bgithub_pat_[A-Za-z0-9_]{20,}/},{name:"AWS access key",re:/\bAKIA[0-9A-Z]{16}\b/},{name:"Slack token",re:/\bxox[abps]-[A-Za-z0-9-]{10,}/},{name:"Supabase access token",re:/\bsbp_[A-Za-z0-9]{20,}/},{name:"OpenAI project key",re:/\bsk-proj-[A-Za-z0-9_-]{20,}/},{name:"bearer JWT-ish",re:/\beyJ[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\b/},{name:"PEM private key",re:/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/}];function p(n){if(!n)return[];let o=[];for(let{name:e,re:s}of _)s.test(n)&&o.push(e);return o}i(p,"scanForSecrets");function A(n,o=2e5){let e=Math.max(0,o),s=Math.ceil(e/2),r=Math.floor(e/2),t={head:"",tail:"",full:"",totalChars:0,hasPart:!1},c=i(a=>{if(!a||e===0)return;let l=`${t.hasPart?`
8
+ `:""}${a}`;t.hasPart=!0,t.totalChars+=l.length,t.full!==null&&(t.totalChars<=e?t.full+=l:t.full=null),t.head.length<s&&(t.head+=l.slice(0,s-t.head.length)),r>0&&(t.tail=l.length>=r?l.slice(-r):`${t.tail}${l}`.slice(-r))},"push"),u=i((a,l)=>{if(!(l>8)){if(typeof a=="string"){c(a);return}if(Array.isArray(a)){for(let f of a)u(f,l+1);return}if(a&&typeof a=="object")for(let[f,d]of Object.entries(a))/token|secret|password|api[_-]?key|authorization/i.test(f)&&typeof d=="string"?c(`${f}=${d}`):u(d,l+1)}},"walk");return u(n,0),t.full!==null?t.full:t.totalChars>e?`${t.head}
9
+ ${t.tail}`:t.head}i(A,"flattenToolInputText");var m=64*1024,T=512;function y(n,o){if(!n)return;if(n.length<=2e5){for(let r of p(A(n)))o.add(r);return}let e=m-T,s=Array.from({length:Math.ceil(n.length/e)},(r,t)=>t*e);for(let r of s){let t=Math.min(n.length,r+m);for(let c of p(n.slice(r,t)))o.add(c);if(t===n.length)break}}i(y,"addSecretHits");function b(n,o){let e=[n],s=new WeakSet;for(;e.length>0;){let r=e.pop();if(typeof r=="string"){y(r,o);continue}if(!r||typeof r!="object"||s.has(r))continue;if(s.add(r),Array.isArray(r)){for(let c of[...r].reverse())e.push(c);continue}let t=Object.entries(r);for(let[c,u]of t.reverse())/token|secret|password|api[_-]?key|authorization/i.test(c)&&typeof u=="string"?e.push(`${c}=${u}`):e.push(u)}}i(b,"scanUnknownStrings");function w(n){if(n==null)return[];let o=n,e=o.tool_input??o.toolInput??o.parameters??n,s=new Set;b(e,s);for(let r of[o.command,o.prompt,o.content])typeof r=="string"&&y(r,s);return[...s]}i(w,"scanHookToolInput");var g={allow:!0};function x(n,o={}){let e=n??"";if(!e.trim())return{allow:!1,kind:"memory_content",reason:"empty content",hits:[],denyMessage:"refusing empty memory content"};if(o.force)return g;let s=p(e);if(s.length>0){let t=s.join(", ");return{allow:!1,kind:"secrets",reason:"secret-like content",hits:s,denyMessage:`refusing to store memory that looks like a secret (${t}). Re-run with --force if intentional.`}}let r=h(e);if(r.length>0){let t=r.join(", ");return{allow:!1,kind:"prompt_injection",reason:"prompt-injection-like content",hits:r,denyMessage:`refusing to store memory that looks like prompt injection (${t}). Entries are inlined into LLM context \u2014 re-run with --force if intentional.`}}return g}i(x,"evaluateMemoryContent");function $(n){let o=w(n);if(o.length===0)return g;let e=o.join(", ");return{allow:!1,kind:"secrets",reason:"secret pattern in tool input",hits:o,denyMessage:`\u26D4 prjct credential guard: tool input matches secret pattern(s): ${e}. Refusing to run this tool so credentials are not exposed. Remove the secret from the command/content and retry. (This MUST runs on every host \u2014 no PPID / host-env dependency.)`}}i($,"evaluateToolInputSecrets");function M(n,o){let e=k(n,o);return!e.risky||!e.message?{allow:!0,decision:e}:{allow:!1,kind:"package_install",reason:"unknown new packages",hits:e.newPackages,denyMessage:`\u26D4 ${e.message}
10
+ Install denied (strict pack). Verify packages before adding them.`,decision:e}}i(M,"evaluatePackageInstallTrust");function E(n,o){if(n==="imported"){let e=o?.trim()||"workflow rule";return{allow:!1,kind:"workflow_rule",reason:"imported trust_source",hits:["imported"],denyMessage:`Refusing to run imported rule without approval: ${e}. Re-create the rule locally if you trust it.`}}return g}i(E,"evaluateWorkflowRuleExecutable");function Z(n){return n==="imported"}i(Z,"isImportedWorkflowTrust");export{x as a,$ as b,M as c,E as d,Z as e};
@@ -0,0 +1,9 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{n as y,p as h}from"./chunk-D62TAZG6.mjs";import{a as o}from"./chunk-3TRXQAU4.mjs";h();var b=2,v=20,p=10,u=400;function k(e){return e.files<=b&&e.loc<=v?"trivial":e.files<=p&&e.loc<=u?"normal":"large"}o(k,"tierOf");function x(e){return e==="trivial"?"direct":e==="normal"?"single":"split"}o(x,"geometryOf");async function l(e,r){return y(e,r)}o(l,"safeGit");function d(e){let r=e.match(/(\d+) files? changed/),t=e.match(/(\d+) insertions?/),s=e.match(/(\d+) deletions?/),i=r?Number.parseInt(r[1],10):0,n=(t?Number.parseInt(t[1],10):0)+(s?Number.parseInt(s[1],10):0);return{files:i,loc:n}}o(d,"parseShortstat");async function G(e){let r=await l(e,["rev-parse","--abbrev-ref","origin/HEAD"]),t=r&&r!=="origin/HEAD"?r:await(async()=>{for(let c of["main","master"])if(await l(e,["rev-parse","--verify","--quiet",c])!==null)return c;return""})();if(!t)return null;let s=await l(e,["merge-base",t,"HEAD"]);if(!s)return null;let i=await l(e,["rev-parse","HEAD"]);if(!i||i===s)return null;let n=await l(e,["diff","--shortstat",`${s}..HEAD`]);if(n===null)return null;let{files:a,loc:m}=d(n),f=await l(e,["diff","--name-only",`${s}..HEAD`])??"",g=[...new Set(f.split(`
8
+ `).filter(Boolean).map(c=>c.includes("/")?c.slice(0,c.indexOf("/")):"."))].sort();return{base:s.slice(0,7),files:a,loc:m,dirs:g,source:"committed"}}o(G,"computeCommittedChangeset");async function w(e){let r=await l(e,["diff","--shortstat","HEAD"]),t=await l(e,["diff","--shortstat","--cached"]);if(r===null&&t===null)return null;let s=d(r??""),i=d(t??""),n=Math.max(s.files,i.files),a=s.loc+i.loc;if(n===0&&a===0)return null;let m=await l(e,["diff","--name-only","HEAD"])??await l(e,["diff","--name-only","--cached"])??"",f=[...new Set(m.split(`
9
+ `).filter(Boolean).map(g=>g.includes("/")?g.slice(0,g.indexOf("/")):"."))].sort();return{base:"HEAD",files:n,loc:a,dirs:f,source:"working-tree"}}o(w,"computeWorkingTreeChangeset");function L(e,r){let t=e.dirs.length>1?` Natural split lines: ${e.dirs.slice(0,6).join(", ")}.`:"";return`Delivery geometry gate: ${e.loc} LOC / ${e.files} files (${e.source}) \u2192 suggested \`${r}\`.${t} Decide explicitly: \`prjct work "<intent>" --geometry split|single|direct\` or split the tree before continuing. (Relax: \`prjct config\` deliveryGeometry off.)`}o(L,"geometryBlockMessage");function $(e){let r=e.harnessLevel,t=e.harnessRisk==="high",s=r==="H3"||r==="H2"&&t,i=!!e.treeLarge||s,n=r==="H3"||t||e.treeLarge?"split":"single";if(e.explicitGeometry)return{blocked:!1,message:null,reason:"has-geometry",geometry:e.explicitGeometry};if(!i)return{blocked:!1,message:null,reason:"not-large",geometry:"direct"};let a=`Delivery geometry (intent): ${r}`+(t?" high-risk":"")+(e.treeLarge?" + large working tree":"")+` \u2192 plan as \`${n}\` before coding. Pass \`prjct work "<intent>" --geometry split|single|direct\` (or stamp geometry on the linked intent/spec). Dynasty: geometry is first-class plan, not only a ship-time afterthought.`;return e.mode==="strict"?{blocked:!0,message:a,reason:e.treeLarge?"tree-strict":"h2-intent-strict",geometry:n}:{blocked:!1,message:`\u26A0\uFE0F ${a}`,reason:"h2-intent-advisory",geometry:n}}o($,"intentGeometryVerdict");function A(e){if(e.mode==="off"||!e.changeset)return{blocked:!1,message:null,tier:"trivial",geometry:"direct",reason:"none"};let r=e.locThreshold??u,t=k(e.changeset),s=x(t);if(e.changeset.loc<r&&t!=="large")return{blocked:!1,message:null,tier:t,geometry:s,reason:"ok-small"};if(e.explicitGeometry)return{blocked:!1,message:null,tier:t,geometry:e.explicitGeometry,reason:"override"};let i=e.changeset.dirs&&e.changeset.dirs.length>1?` Natural split lines: ${e.changeset.dirs.slice(0,6).join(", ")}.`:"",n=`Delivery geometry (ship): ${e.changeset.loc} LOC / ${e.changeset.files} files (${e.changeset.source}) \u2192 suggested \`${s}\`.${i} Decide with \`prjct ship --geometry split|single|direct\` before publishing. (SUPERIOR to silent large PRs \u2014 gentle-ai forecast with teeth.)`;return e.mode==="strict"?{blocked:!0,message:n,tier:t,geometry:s,reason:"strict-block"}:{blocked:!1,message:`\u26A0\uFE0F ${n}`,tier:t,geometry:s,reason:"advisory"}}o(A,"shipGeometryVerdict");export{b as a,v as b,p as c,u as d,k as e,x as f,G as g,w as h,L as i,$ as j,A as k};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a}from"./chunk-3TRXQAU4.mjs";function T(n){let e=new Set;for(let t of n){let s=c(t.message)?.model??t.model;typeof s=="string"&&s.trim()&&e.add(s.trim().slice(0,120))}return e.size===0?"unknown":e.size>1?"mixed":[...e][0]}a(T,"identifyTranscriptModel");function h(n){let e=[];for(let t of n.split(`
8
+ `)){let o=t.trim();if(o)try{let s=JSON.parse(o);s&&typeof s=="object"&&e.push(s)}catch{}}return e}a(h,"parseTranscriptJsonl");function c(n){return n&&typeof n=="object"?n:null}a(c,"asRecord");function r(n){return typeof n=="number"&&Number.isFinite(n)?n:0}a(r,"num");function f(n){let e=r(n.input_tokens)+r(n.cache_creation_input_tokens)+r(n.prompt_tokens)+r(n.promptTokenCount)+r(n.inputOther)+r(n.inputCacheCreation),t=r(n.output_tokens)+r(n.completion_tokens)+r(n.candidatesTokenCount)+r(n.output),o=r(n.cache_read_input_tokens)+r(n.inputCacheRead);return{tokensIn:e,tokensOut:t,cacheRead:o}}a(f,"usagePairFrom");function l(n){return typeof n.timestamp=="string"?Date.parse(n.timestamp):typeof n.time=="number"?n.time:Number.NaN}a(l,"lineTimeMs");function g(n,e){if(!e?.sinceIso&&!e?.untilIso)return!0;let t=l(n);return!(!Number.isFinite(t)||e.sinceIso&&t<Date.parse(e.sinceIso)||e.untilIso&&t>=Date.parse(e.untilIso))}a(g,"inWindow");function I(n,e){let t=n.reduce((u,p)=>{if(!g(p,e))return u;let d=c(c(p.message)?.usage)??c(p.usage)??c(p.usageMetadata);if(!d)return u;let m=f(d);return{tokensInNew:u.tokensInNew+m.tokensIn,tokensOut:u.tokensOut+m.tokensOut,maxCacheRead:Math.max(u.maxCacheRead,m.cacheRead)}},{tokensInNew:0,tokensOut:0,maxCacheRead:0}),{tokensInNew:o,tokensOut:s,maxCacheRead:i}=t;return{tokensInNew:o,cacheReadMax:i,tokensIn:o+i,tokensOut:s}}a(I,"sumTranscriptUsageDetailed");function x(n,e){let t=I(n,e);return{tokensIn:t.tokensIn,tokensOut:t.tokensOut}}a(x,"sumTranscriptUsage");function R(n,e){let t=new Map;for(let s of n){if(!g(s,e))continue;let i=c(s.message),u=c(i?.usage)??c(s.usage)??c(s.usageMetadata);if(!u)continue;let p=i?.model??s.model,d=typeof p=="string"&&p?p:"unknown",m=f(u),k=t.get(d)??{tokensIn:0,tokensOut:0,maxCacheRead:0};k.tokensIn+=m.tokensIn,k.tokensOut+=m.tokensOut,m.cacheRead>k.maxCacheRead&&(k.maxCacheRead=m.cacheRead),t.set(d,k)}let o=new Map;for(let[s,i]of t)o.set(s,{tokensIn:i.tokensIn+i.maxCacheRead,tokensOut:i.tokensOut});return o}a(R,"sumTranscriptUsageByModel");export{T as a,h as b,I as c,x as d,R as e};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as r,c as u}from"./chunk-3TRXQAU4.mjs";function s(){let e=process.env.PRJCT_DEBUG||process.env.DEBUG||"";if(!e)return{level:-1,name:"disabled"};if(a.has(e)||e.includes("prjct"))return{level:n.debug,name:"debug"};let o=n[e]??-1,t=o>=0?e:"disabled";return{level:o,name:t}}function l(e,o,t){return g>=e?(...c)=>console[t](o,...c):v}var n,a,g,L,v,d,b,i=u(()=>{"use strict";n={error:0,warn:1,info:2,debug:3},a=new Set(["1","true","*"]);r(s,"getLogLevel");({level:g,name:L}=s()),v=r(()=>{},"noop");r(l,"createLogMethod");d={error:l(n.error,"[prjct:error]","error"),warn:l(n.warn,"[prjct:warn]","warn"),info:l(n.info,"[prjct:info]","log"),debug:l(n.debug,"[prjct:debug]","log"),isEnabled:r(()=>g>=0,"isEnabled"),level:r(()=>L,"level")},b=d});export{b as a,i as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as k}from"./chunk-CNWEQUB7.mjs";import{b as P}from"./chunk-AJXELVNH.mjs";import{b as O,c as U}from"./chunk-F2FKQUYE.mjs";import{a as Y}from"./chunk-BTCCUMKI.mjs";import{c as A,f as T,g as C}from"./chunk-KKIJAEYU.mjs";import{a as $,b as x}from"./chunk-LZC6NGB6.mjs";import{b as D}from"./chunk-B7AQHL7B.mjs";import{a as I,h as L}from"./chunk-UNNY2IWZ.mjs";import{a as F,b as G,g as S,i as z}from"./chunk-DMO3ZFUG.mjs";import{d as M,i as w,j as H}from"./chunk-KPR5TWSN.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";G();H();z();var X=new Set(["decision","gotcha","learning","feedback","fact","shipped","spec"]),J=30,q=50,K=20,Q=45,Z=25,j=15,ee=180,V=90,te=25,ne=.12,re=40,se=40,oe=30,ie=20,ce=35,ae=.12,de=864e5,ue=100,le=50,pe=25,me=15,fe=/\b[\w.-]+(?:\/[\w.-]+)+\.(?:ts|tsx|js|jsx|mjs|cjs|json|md|sh|toml|yml|yaml)\b/g;function he(e,t){let s=x.allEntriesForIndex(e),r=new Set;for(let a of s)for(let p of O(a.tags))r.add(p);let n=(()=>{try{let a=P(e);return a?new Set(Object.keys(a.documents)):null}catch{return null}})(),i=A(s),c=T(i);return{entries:s,usefulness:U.decayedScores(e,t),supersededIds:w(s),correctedIds:r,indexedPaths:n,nowMs:t,refIndex:c}}l(he,"collectRetentionInputs");function ge(e){let t=new Map,s=new Set,r=[...e].sort((n,i)=>i.rememberedAt.localeCompare(n.rememberedAt));for(let n of r){let i=F(n.content);t.has(i)?s.add(n.id):t.set(i,n)}return s}l(ge,"collectDuplicateIds");function xe(e,t){let s=e.content.match(fe);return!s||s.length===0?!1:!s.some(r=>t.has(r))}l(xe,"isUngrounded");function Ee(e,t,s){let r=[],n=C(e.content,t.refIndex,e.id),i=s.has(e.id);i&&!n.exactDup&&r.push("duplicate of newer entry"),r.push(`excess ${n.excess.toFixed(2)} (sim ${n.maxSim.toFixed(2)})`);let c=n.exactDup||n.nearDup||n.excess<ae;c&&r.push(n.exactDup?`exact dup of ${n.nearestId}`:n.nearDup?`near-dup of ${n.nearestId}`:"low excess vs reference");let a=t.usefulness.get(e.id)??0,p=Math.min(Z,Math.max(0,a*8));a>0&&r.push(`used (+${Math.round(p)})`);let u=Math.max(0,(t.nowMs-Date.parse(e.rememberedAt))/de),h=Number.isFinite(u)?Math.max(0,j*(1-u/ee)):0,o=a<=0&&Number.isFinite(u)&&u>V?Math.min(te,(u-V)*ne):0;o>0&&r.push(`idle ${Math.round(u)}d`);let f=t.supersededIds.has(e.id);f&&r.push("superseded");let m=t.correctedIds.has(e.id);m&&r.push("corrected");let b=!M(e)||k(e);b&&r.push("generated noise");let E=!!(t.indexedPaths&&xe(e,t.indexedPaths));E&&r.push("cites files missing at HEAD");let g=Math.max(0,Math.min(100,n.excess*Q+p+h-(c?ce:0)-o-(f?re:0)-(m?se:0)-(b?oe:0)-(E?ie:0)-(i?20:0))),R=g>=q?"active":g>=K?"archive":"delete",_=i||n.exactDup||n.nearDup||f,y=R!=="active"&&u<J&&!_?"active":R;y!==R&&r.push("grace period");let d=y==="delete"&&X.has(e.type)?"archive":y;return d!==y&&r.push("protected type"),{id:e.id,type:e.type,verdict:d,score:Math.round(g),reasons:r,excess:n.excess,maxSim:n.maxSim,nearestId:n.nearestId}}l(Ee,"scoreEntry");function ye(e,t){let s=he(e,t),r=ge(s.entries),n={evaluated:s.entries.length,active:0,archive:0,delete:0,referenceSize:s.refIndex.entries.length,flagged:[],byId:new Map};for(let i of s.entries){let c=Ee(i,s,r);n[c.verdict]++,n.byId.set(c.id,c),c.verdict!=="active"&&n.flagged.push(c)}return n.flagged.sort((i,c)=>i.score-c.score),n}l(ye,"evaluateRetention");var Re=6e4,W=new Map;function B(e,t){let s=Math.floor(t/Re),r=(()=>{try{return $(e)}catch{return null}})();if(r!==null){let i=W.get(e);if(i&&i.bucket===s&&i.stamp===r)return i.report}let n=ye(e,t);return r!==null&&W.set(e,{bucket:s,stamp:r,report:n}),n}l(B,"evaluateRetentionShared");function He(e,t){return!(!M(e)||e.content.trim().length===0||t&&t.verdict!=="active"||t&&t.excess!==void 0&&t.excess<.05)}l(He,"shouldEmbedEntry");function v(e,t){if(t.startsWith("ship_"))return ve(e,t);if(x.forget(e,t))return!0;try{return(S.run(e,"UPDATE memory_entries SET deleted_at = ? WHERE id = ? AND deleted_at IS NULL",Date.now(),t).changes??0)>0}catch{return!1}}l(v,"forgetEntry");function N(e){return e.startsWith("mem_")||e.startsWith("ship_")||/^\d+$/.test(e)}l(N,"isRetentionRemovableId");function ve(e,t){let s=t.startsWith("ship_")?t.slice(5):t;if(!s)return!1;try{let r=S.get(e,"SELECT * FROM shipped_features WHERE id = ?",s);if(!r)return!1;try{D.archive(e,{entityType:"shipped",entityId:s,entityData:r,summary:`retention archive shipped [${r.name}]`,reason:"retention-archive"})}catch{}return(S.run(e,"DELETE FROM shipped_features WHERE id = ?",s).changes??0)>0}catch{return!1}}l(ve,"forgetShippedFeature");function be(e,t={}){let s=t.dryRun===!0,r=t.nowMs??Date.now(),n=t.maxArchive??ue,i=t.maxDelete??le,c=B(e,r),a=c.flagged.filter(o=>o.verdict==="archive"&&N(o.id)),p=c.flagged.filter(o=>o.verdict==="delete"&&N(o.id)),u=c.flagged.filter(o=>(o.verdict==="archive"||o.verdict==="delete")&&!N(o.id)).length,h=s?{archived:0,deleted:0,skipped:u}:(()=>{let o=a.slice(0,n),f=o.map(d=>{if(!d.id.startsWith("ship_"))try{D.archive(e,{entityType:"memory_entry",entityId:d.id,entityData:{id:d.id,type:d.type,score:d.score,excess:d.excess,reasons:d.reasons,verdict:d.verdict},summary:`retention archive [${d.type}] excess=${d.excess?.toFixed(2)??"?"} score=${d.score}`,reason:"retention-archive"})}catch{}return v(e,d.id)}),m=f.filter(Boolean).length,b=Math.max(0,a.length-o.length)+f.filter(d=>!d).length,E=p.slice(0,i),g=E.filter(d=>!X.has(d.type)).map(d=>d.id),R=E.length-g.length,_=g.length>0?Y(e,g):0,y=Math.max(0,p.length-E.length)+R+g.length-_;return{archived:m,deleted:_,skipped:u+b+y}})();return{evaluated:c.evaluated,active:c.active,wouldArchive:a.length,wouldDelete:p.length,archived:h.archived,deleted:h.deleted,skipped:h.skipped,dryRun:s,samples:c.flagged.slice(0,10),referenceSize:c.referenceSize}}l(be,"applyRetention");function Ge(e){return be(e,{maxArchive:pe,maxDelete:me})}l(Ge,"applyRetentionIncremental");function ze(e,t={}){let s=t.max??50,r=t.types??["inbox","context","idea","todo","question","gotcha","spec"],n=[],i=[];try{let c=x.allEntriesForIndex(e);for(let a of c){if(n.length>=s)break;if(!r.includes(a.type))continue;let p=I(a.content,a.type),u=L(a.content,a.type);(p.junk||u.action==="refuse"||a.type==="gotcha"&&u.action==="demote")&&v(e,a.id)&&(n.push(a),i.length<8&&i.push(`${a.id}:${p.junk?p.reason:u.reasonCode}`))}}catch{return{forgotten:0,samples:[]}}return{forgotten:n.length,samples:i}}l(ze,"forgetJunkCaptures");function Je(e,t=Date.now()){let r=x.allEntriesForIndex(e).filter(o=>o.type==="inbox");if(r.length===0)return{merged:0,archived:0,junkForgotten:0};let n=r.filter(o=>I(o.content,o.type).junk&&v(e,o.id)).length,i=x.allEntriesForIndex(e).filter(o=>o.type==="inbox");if(i.length===0)return{merged:0,archived:0,junkForgotten:n};let c=A(x.allEntriesForIndex(e)),a=T(c),p=B(e,t),u=[],h=[];for(let o of i){let f=C(o.content,a);if(f.exactDup||f.nearDup||f.excess<.15){v(e,o.id)&&u.push(o.id);continue}let m=p.byId.get(o.id);if(m&&m.verdict!=="active"){try{D.archive(e,{entityType:"memory_entry",entityId:o.id,entityData:{id:o.id,type:"inbox",score:m.score,excess:m.excess,reasons:m.reasons},summary:`inbox triage excess=${m.excess?.toFixed(2)??"?"}`,reason:"retention-inbox"})}catch{}v(e,o.id)&&h.push(o.id)}}return{merged:u.length,archived:h.length,junkForgotten:n}}l(Je,"triageInbox");export{X as a,he as b,ge as c,Ee as d,ye as e,B as f,He as g,N as h,ve as i,be as j,Ge as k,ze as l,Je as m};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as e}from"./chunk-3TRXQAU4.mjs";var t={suggestedPersona:{role:"DEV",mcps:["github"]},memoryTypes:["fact","decision","learning","gotcha","pattern","anti-pattern","shipped"],workflowSlots:{ship:{description:"Publish finished work \u2014 tests, commit, push, PR."},review:{description:"Pre-commit or pre-PR review pass."}},hookSignals:[]},i={code:{name:"code",version:"1.1.0",description:"Coding work: features, bugs, refactors, TDD, shipping.",...t,suggestedTags:{domain:["auth","api","frontend","infra","data"]},configDefaults:{sdd:"advisory",tdd:"assist",maxTurnsPerCycle:25,deliveryGeometry:"advisory",land:"strict",conflictMode:"advisory"}},"code-strict":{name:"code-strict",version:"1.1.0",description:"Ship-grade coding: SDD+TDD strict, delivery-geometry gate, forced land. Opt-in.",...t,configDefaults:{sdd:"strict",tdd:"strict",maxTurnsPerCycle:25,deliveryGeometry:"strict",land:"strict",conflictMode:"strict"}},daily:{name:"daily",version:"1.0.0",description:"Day-to-day capture + review. GTD-style inbox + weekly review.",memoryTypes:["inbox","todo","idea"],workflowSlots:{morning:{description:"Morning briefing \u2014 pull open todos + upcoming commitments."},clarify:{description:"Reclassify inbox entries to real memory types."},review:{description:"Weekly/biweekly review across memory."}},hookSignals:[]},pm:{name:"pm",version:"1.0.0",description:"Product Management: specs, user interviews, roadmap, backlog triage.",suggestedPersona:{role:"PM",mcps:["linear","posthog"]},memoryTypes:["insight","question","stakeholder","decision","source"],workflowSlots:{spec:{description:"Draft a technical/product spec from captured insights."},triage:{description:"Review Linear backlog and prioritize."},interview:{description:"User interview pre-brief + post-synthesis."}},hookSignals:[{event:"UserPromptSubmit",ifMatches:"spec|requirements?|prd",inject:["type=insight","type=question"]}],suggestedTags:{audience:["team","stakeholders"],quarter:["q1","q2","q3","q4"]}},founder:{name:"founder",version:"1.0.0",description:"Founder ops: strategy, fundraising, hiring, stakeholder comms.",suggestedPersona:{role:"Founder",mcps:["gmail","linear","posthog"]},memoryTypes:["goal","okr","person","stakeholder","decision","shipped"],workflowSlots:{"investor-update":{description:"Monthly investor update draft."},"1on1":{description:"1:1 prep + synthesis."},strategy:{description:"Strategy checkpoint \u2014 OKR progress + pivots."}},hookSignals:[{event:"UserPromptSubmit",ifMatches:"investor|board|update|fundrais",inject:["type=okr","type=shipped","type=stakeholder"]}],suggestedTags:{audience:["board","investors","team"]}},lean:{name:"lean",version:"1.0.0",description:"Anti-over-engineering: minimal-code review, debt ledger, intensity modes.",memoryTypes:["over-engineering","lean-debt"],workflowSlots:{review:{description:"Flag over-engineering in the current diff."},audit:{description:"Repo-wide over-engineering assessment."},debt:{description:"Harvest deferred-simplification (lean:) markers."}},hookSignals:[{event:"UserPromptSubmit",ifMatches:"simplif|over-?engineer|yagni|too complex|leaner",inject:["type=over-engineering","type=lean-debt"]}],suggestedTags:{intensity:["lite","full","ultra"]}},research:{name:"research",version:"1.0.0",description:"Research: deep-dives, literature review, competitive scans.",suggestedPersona:{role:"Research",mcps:["web"]},memoryTypes:["source","claim","question","insight"],workflowSlots:{"lit-review":{description:"Literature review across captured sources."},analyze:{description:"Data analysis run via MCP, persist findings."}},hookSignals:[],suggestedTags:{confidence:["high","medium","low"]}}},s=Object.keys(i);function o(r){return i[r]??null}e(o,"getPackManifest");export{i as a,s as b,o as c};