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
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{p as j,t as L,u as I}from"./chunk-A6K4H3YT.mjs";import{a as A,b as a,c as S}from"./chunk-JQE2F2RK.mjs";import{i as R,k,o as E}from"./chunk-UH4MD3F3.mjs";import{c as M}from"./chunk-EXVL2OFE.mjs";import{a as O}from"./chunk-SYHDEUVU.mjs";import{d as N,e as G}from"./chunk-IJ523YO2.mjs";import{e as l,f as b}from"./chunk-BUDZL4DW.mjs";import{a as c,e as C}from"./chunk-E66B27AL.mjs";b();E();I();import s from"node:fs/promises";import o from"node:path";import P from"node:fs/promises";import D from"node:path";b();E();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=(I(),C(L)),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=M(`global/${e.contextFile}`);if(u)return u;let{PACKAGE_ROOT:g}=(G(),C(N)),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 R(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
+ import{p as j,t as L,u as I}from"./chunk-A6K4H3YT.mjs";import{a as A,b as a,c as S}from"./chunk-JQE2F2RK.mjs";import{i as R,k,o as E}from"./chunk-UH4MD3F3.mjs";import{c as M}from"./chunk-A6LRNS6R.mjs";import{a as O}from"./chunk-SYHDEUVU.mjs";import{d as N,e as G}from"./chunk-AEDB75AK.mjs";import{e as l,f as b}from"./chunk-BUDZL4DW.mjs";import{a as c,e as C}from"./chunk-E66B27AL.mjs";b();E();I();import s from"node:fs/promises";import o from"node:path";import P from"node:fs/promises";import D from"node:path";b();E();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=(I(),C(L)),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=M(`global/${e.contextFile}`);if(u)return u;let{PACKAGE_ROOT:g}=(G(),C(N)),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 R(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,`
9
9
 
10
10
  `).trim()}
11
11
  `})(),h=O(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");S();async function rt(d){return v(d)}c(rt,"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),k(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=A(),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 nt(){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(nt,"getProviderPaths");var _=new w,ot=_;export{rt as a,w as b,nt as c,ot as d};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{d as p}from"./chunk-XYKVWO23.mjs";import{e as f}from"./chunk-RT2DFIWF.mjs";import{b as g}from"./chunk-PVCEWFHS.mjs";import{e as m,g as _}from"./chunk-TKXOMN4K.mjs";import{a as l}from"./chunk-E66B27AL.mjs";_();var S=8,y=140;function h(d,r){if(r.length===0)return 0;let n=[];try{m.transaction(d,s=>{let i=s.prepare("DELETE FROM memory_embeddings WHERE memory_id = ?"),c=s.prepare("DELETE FROM memory_entries WHERE id = ?"),t=s.prepare("DELETE FROM events WHERE id = ? AND type LIKE 'memory.remember.%'");for(let e of r){try{i.run(e)}catch{}c.run(e).changes&&n.push(e);let a=e.match(/^mem_(\d+)$/);if(a)try{t.run(Number(a[1]))}catch{}}})}catch{return n.length}return n.length}l(h,"hardDeleteEntries");function w(d,r,n){let s=new Map;for(let e of r)s.set(e.type,(s.get(e.type)??0)+1);let i=[...s.entries()].sort((e,o)=>o[1]-e[1]).map(([e,o])=>`${e}\xD7${o}`).join(", "),c=r.map(e=>p(e).replace(/\s+/g," ").trim()).filter(e=>e.length>20).slice(0,S).map(e=>`- ${e.length>y?`${e.slice(0,y-1)}\u2026`:e}`),t=[`Distill of discarded auto-history (${d}).`,`Context synthesis: ${r.length} low-value rows collapsed \u2014 raw history deleted; only this digest remains for the project model.`,`Key data: source=retention-distill; discarded=${r.length}; types=${i}; at=${n}`,"What happened: purged auto-generated / redundant captures that added no excess vs the reference model.","Why it mattered: prevent vault bloat; agents must not re-read detector noise.",`Outcome: ${r.length} raw entries hard-deleted after distillation.`,"Next implication: prefer high-excess judgment; re-run detectors only when code/model changes."];return c.length>0&&t.push(`Sample cues (not full bodies):
8
+ import{d as p}from"./chunk-FBEDUKMG.mjs";import{e as f}from"./chunk-F3PNT2DQ.mjs";import{b as g}from"./chunk-7PA4KPSR.mjs";import{e as m,g as _}from"./chunk-TKXOMN4K.mjs";import{a as l}from"./chunk-E66B27AL.mjs";_();var S=8,y=140;function h(d,r){if(r.length===0)return 0;let n=[];try{m.transaction(d,s=>{let i=s.prepare("DELETE FROM memory_embeddings WHERE memory_id = ?"),c=s.prepare("DELETE FROM memory_entries WHERE id = ?"),t=s.prepare("DELETE FROM events WHERE id = ? AND type LIKE 'memory.remember.%'");for(let e of r){try{i.run(e)}catch{}c.run(e).changes&&n.push(e);let a=e.match(/^mem_(\d+)$/);if(a)try{t.run(Number(a[1]))}catch{}}})}catch{return n.length}return n.length}l(h,"hardDeleteEntries");function w(d,r,n){let s=new Map;for(let e of r)s.set(e.type,(s.get(e.type)??0)+1);let i=[...s.entries()].sort((e,o)=>o[1]-e[1]).map(([e,o])=>`${e}\xD7${o}`).join(", "),c=r.map(e=>p(e).replace(/\s+/g," ").trim()).filter(e=>e.length>20).slice(0,S).map(e=>`- ${e.length>y?`${e.slice(0,y-1)}\u2026`:e}`),t=[`Distill of discarded auto-history (${d}).`,`Context synthesis: ${r.length} low-value rows collapsed \u2014 raw history deleted; only this digest remains for the project model.`,`Key data: source=retention-distill; discarded=${r.length}; types=${i}; at=${n}`,"What happened: purged auto-generated / redundant captures that added no excess vs the reference model.","Why it mattered: prevent vault bloat; agents must not re-read detector noise.",`Outcome: ${r.length} raw entries hard-deleted after distillation.`,"Next implication: prefer high-excess judgment; re-run detectors only when code/model changes."];return c.length>0&&t.push(`Sample cues (not full bodies):
9
9
  ${c.join(`
10
10
  `)}`),t.join(" ")}l(w,"buildDistillContent");async function A(d,r,n,s,i){if(s.length<=i)return{discarded:0,digested:!1};let t=[...s].sort((u,b)=>b.rememberedAt.localeCompare(u.rememberedAt)).slice(i);if(t.length===0)return{discarded:0,digested:!1};let e=new Date().toISOString(),o=`auto-distill:${n}`,a=w(n,t,e),E=await g.remember(d,{type:"learning",content:a,tags:{source:"retention-distill",topic:o,capture:"distill-discard-v1",context_schema:"living-v2",synthesis:"deterministic",discarded_count:String(t.length),auto_source:n},provenance:"inferred",projectId:r}).then(()=>!0).catch(()=>!1),D=t.map(u=>u.id);return{discarded:h(r,D),digested:E,digestTopic:o}}l(A,"distillAndDiscardAutoSource");async function v(d,r,n){let s=g.allEntriesForIndex(r),i=new Map;for(let t of s){let e=t.tags?.source;if(!f(e)||e==="retention-distill"||t.tags?.source==="retention-distill")continue;let o=i.get(e)??[];o.push(t),i.set(e,o)}let c=[];for(let[t,e]of i){if(e.length<=n)continue;let o=await A(d,r,t,e,n);c.push(o)}return{discarded:c.reduce((t,e)=>t+e.discarded,0),digests:c.filter(t=>t.digested).length}}l(v,"distillAndDiscardAllAutoSources");function x(d,r,n=1e3){let s=Date.now()-r*864e5;try{let i=m.query(d,`SELECT id, type, content FROM memory_entries
11
11
  WHERE deleted_at IS NOT NULL AND deleted_at < ?
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as j,b as f,d as x,e as I}from"./chunk-ZYCNW75E.mjs";import{a as D}from"./chunk-JR542RI2.mjs";import{b as v}from"./chunk-CPR4FPXG.mjs";import{g as C,h as M,i as w,j as E,o as R}from"./chunk-3HGQPUKG.mjs";import{b}from"./chunk-PVCEWFHS.mjs";import{a as S,b as K,d as m,g as U}from"./chunk-TKXOMN4K.mjs";import{a as c}from"./chunk-E66B27AL.mjs";K();import g from"node:fs/promises";import d from"node:path";U();var q=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default)$/i;function L(t){let e=M(t);if(!C(t))return{ready:!1,builtAt:e?.builtAt??null,symbols:0,edges:0,files:0,languages:[],kinds:[],routes:[],hotspots:[],entryCandidates:[],packages:[],note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let o=w(t),n=new Map,r=new Map,a=new Map,u=[],p=[];for(let i of o){n.set(i.kind,(n.get(i.kind)??0)+1),r.set(i.file,(r.get(i.file)??0)+1);let l=i.file.includes(".")?i.file.slice(i.file.lastIndexOf(".")):"(none)";a.set(l,(a.get(l)??0)+1),i.kind==="route"&&u.push({name:i.name,file:i.file,line:i.startLine}),i.exported&&q.test(i.name)&&(i.kind==="function"||i.kind==="class")&&!/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(i.file)&&p.push({name:i.name,file:i.file,kind:i.kind})}let y=[...r.keys()],h=[],Y=R(t),J=y.length>400?y.slice(0,400):y;for(let i of J){let l=Y.get(i)??0;l>0&&h.push({file:i,fanIn:l,symbolCount:r.get(i)??0})}h.sort((i,l)=>l.fanIn-i.fanIn);let k=new Set,A=v(t);if(A)for(let i of Object.keys(A.forward).slice(0,2e3)){let l=i.includes("/")?i.slice(0,i.indexOf("/")):i;l&&!l.startsWith(".")&&k.add(l)}for(let i of y.slice(0,2e3)){let l=i.includes("/")?i.slice(0,i.indexOf("/")):".";l&&l!=="."&&k.add(l)}if(p.length<8)for(let i of o){if(p.length>=12)break;i.exported&&i.kind==="class"&&!p.some(l=>l.file===i.file)&&p.push({name:i.name,file:i.file,kind:i.kind})}return{ready:!0,builtAt:e?.builtAt??null,symbols:e?.symbolCount??o.length,edges:e?.edgeCount??0,files:e?.fileCount??r.size,languages:[...a.entries()].map(([i,l])=>({ext:i,count:l})).sort((i,l)=>l.count-i.count).slice(0,12),kinds:[...n.entries()].map(([i,l])=>({kind:i,count:l})).sort((i,l)=>l.count-i.count),routes:u.slice(0,30),hotspots:h.slice(0,15),entryCandidates:p.slice(0,15),packages:[...k].sort().slice(0,40),note:"Structural only (symbol + import graphs). Narrative architecture lives in prjct analysis / memory decisions."}}c(L,"buildArchitectureSnapshot");function O(t,e){let s=[];if(!t)return{hasChanges:!0,items:[{field:"Project style",type:"added",after:e.summary}],summary:{added:1,removed:0,changed:0},beforeCommit:null,afterCommit:e.commitHash};let o=t.payload,n=e.payload;return o.stack.ecosystem!==n.stack.ecosystem&&s.push({field:"Ecosystem",type:"changed",before:o.stack.ecosystem,after:n.stack.ecosystem}),(o.stack.packageManager??"")!==(n.stack.packageManager??"")&&s.push({field:"Package manager",type:"changed",before:o.stack.packageManager??"(none)",after:n.stack.packageManager??"(none)"}),P("Languages",o.stack.languages,n.stack.languages,s),P("Frameworks",o.stack.frameworks,n.stack.frameworks,s),P("Key libraries",o.stack.keyLibraries,n.stack.keyLibraries,s),o.stack.hasTests!==n.stack.hasTests&&s.push({field:"Has tests",type:"changed",before:String(o.stack.hasTests),after:String(n.stack.hasTests)}),_("Pattern",o.patterns.map(r=>[r.key,r.name]),n.patterns.map(r=>[r.key,r.name]),s),_("Anti-pattern",o.antiPatterns.map(r=>[r.key,r.issue]),n.antiPatterns.map(r=>[r.key,r.issue]),s),_("Convention",o.conventions.map(r=>[r.key,r.rule]),n.conventions.map(r=>[r.key,r.rule]),s),o.structural.symbols!==n.structural.symbols&&(o.structural.symbols>0||n.structural.symbols>0)&&s.push({field:"Symbols",type:"changed",before:String(o.structural.symbols),after:String(n.structural.symbols)}),o.structural.files!==n.structural.files&&s.push({field:"Files",type:"changed",before:String(o.structural.files),after:String(n.structural.files)}),D(s,t.commitHash,e.commitHash)}c(O,"generateProjectStyleDiff");function F(t){if(!t.hasChanges)return`## Project evolution
8
+ import{a as j,b as f,d as x,e as I}from"./chunk-ZYCNW75E.mjs";import{a as D}from"./chunk-JR542RI2.mjs";import{b as v}from"./chunk-CPR4FPXG.mjs";import{g as C,h as M,i as w,j as E,o as R}from"./chunk-3HGQPUKG.mjs";import{b}from"./chunk-7PA4KPSR.mjs";import{a as S,b as K,d as m,g as U}from"./chunk-TKXOMN4K.mjs";import{a as c}from"./chunk-E66B27AL.mjs";K();import g from"node:fs/promises";import d from"node:path";U();var q=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default)$/i;function L(t){let e=M(t);if(!C(t))return{ready:!1,builtAt:e?.builtAt??null,symbols:0,edges:0,files:0,languages:[],kinds:[],routes:[],hotspots:[],entryCandidates:[],packages:[],note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let o=w(t),n=new Map,r=new Map,a=new Map,u=[],p=[];for(let i of o){n.set(i.kind,(n.get(i.kind)??0)+1),r.set(i.file,(r.get(i.file)??0)+1);let l=i.file.includes(".")?i.file.slice(i.file.lastIndexOf(".")):"(none)";a.set(l,(a.get(l)??0)+1),i.kind==="route"&&u.push({name:i.name,file:i.file,line:i.startLine}),i.exported&&q.test(i.name)&&(i.kind==="function"||i.kind==="class")&&!/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(i.file)&&p.push({name:i.name,file:i.file,kind:i.kind})}let y=[...r.keys()],h=[],Y=R(t),J=y.length>400?y.slice(0,400):y;for(let i of J){let l=Y.get(i)??0;l>0&&h.push({file:i,fanIn:l,symbolCount:r.get(i)??0})}h.sort((i,l)=>l.fanIn-i.fanIn);let k=new Set,A=v(t);if(A)for(let i of Object.keys(A.forward).slice(0,2e3)){let l=i.includes("/")?i.slice(0,i.indexOf("/")):i;l&&!l.startsWith(".")&&k.add(l)}for(let i of y.slice(0,2e3)){let l=i.includes("/")?i.slice(0,i.indexOf("/")):".";l&&l!=="."&&k.add(l)}if(p.length<8)for(let i of o){if(p.length>=12)break;i.exported&&i.kind==="class"&&!p.some(l=>l.file===i.file)&&p.push({name:i.name,file:i.file,kind:i.kind})}return{ready:!0,builtAt:e?.builtAt??null,symbols:e?.symbolCount??o.length,edges:e?.edgeCount??0,files:e?.fileCount??r.size,languages:[...a.entries()].map(([i,l])=>({ext:i,count:l})).sort((i,l)=>l.count-i.count).slice(0,12),kinds:[...n.entries()].map(([i,l])=>({kind:i,count:l})).sort((i,l)=>l.count-i.count),routes:u.slice(0,30),hotspots:h.slice(0,15),entryCandidates:p.slice(0,15),packages:[...k].sort().slice(0,40),note:"Structural only (symbol + import graphs). Narrative architecture lives in prjct analysis / memory decisions."}}c(L,"buildArchitectureSnapshot");function O(t,e){let s=[];if(!t)return{hasChanges:!0,items:[{field:"Project style",type:"added",after:e.summary}],summary:{added:1,removed:0,changed:0},beforeCommit:null,afterCommit:e.commitHash};let o=t.payload,n=e.payload;return o.stack.ecosystem!==n.stack.ecosystem&&s.push({field:"Ecosystem",type:"changed",before:o.stack.ecosystem,after:n.stack.ecosystem}),(o.stack.packageManager??"")!==(n.stack.packageManager??"")&&s.push({field:"Package manager",type:"changed",before:o.stack.packageManager??"(none)",after:n.stack.packageManager??"(none)"}),P("Languages",o.stack.languages,n.stack.languages,s),P("Frameworks",o.stack.frameworks,n.stack.frameworks,s),P("Key libraries",o.stack.keyLibraries,n.stack.keyLibraries,s),o.stack.hasTests!==n.stack.hasTests&&s.push({field:"Has tests",type:"changed",before:String(o.stack.hasTests),after:String(n.stack.hasTests)}),_("Pattern",o.patterns.map(r=>[r.key,r.name]),n.patterns.map(r=>[r.key,r.name]),s),_("Anti-pattern",o.antiPatterns.map(r=>[r.key,r.issue]),n.antiPatterns.map(r=>[r.key,r.issue]),s),_("Convention",o.conventions.map(r=>[r.key,r.rule]),n.conventions.map(r=>[r.key,r.rule]),s),o.structural.symbols!==n.structural.symbols&&(o.structural.symbols>0||n.structural.symbols>0)&&s.push({field:"Symbols",type:"changed",before:String(o.structural.symbols),after:String(n.structural.symbols)}),o.structural.files!==n.structural.files&&s.push({field:"Files",type:"changed",before:String(o.structural.files),after:String(n.structural.files)}),D(s,t.commitHash,e.commitHash)}c(O,"generateProjectStyleDiff");function F(t){if(!t.hasChanges)return`## Project evolution
9
9
 
10
10
  No style changes since last sync.`;let e=["## Project evolution (this sync)"];(t.beforeCommit||t.afterCommit)&&e.push(`> \`${T(t.beforeCommit)}\` \u2192 \`${T(t.afterCommit)}\``),e.push(""),e.push(`+${t.summary.added} \xB7 \u2212${t.summary.removed} \xB7 ~${t.summary.changed}`),e.push("");for(let s of t.items.slice(0,20)){let o=s.type==="added"?"+":s.type==="removed"?"\u2212":"~";s.type==="changed"?e.push(`- ${o} **${s.field}**: ${s.before} \u2192 ${s.after}`):s.type==="added"?e.push(`- ${o} **${s.field}**: ${s.after}`):e.push(`- ${o} **${s.field}**: ${s.before}`)}return e.join(`
11
11
  `)}c(F,"formatProjectStyleDiffMd");function T(t){return t?t.length>7?t.slice(0,7):t:"(none)"}c(T,"short");function P(t,e,s,o){let n=new Set(e.map(a=>a.toLowerCase())),r=new Set(s.map(a=>a.toLowerCase()));for(let a of s)n.has(a.toLowerCase())||o.push({field:t,type:"added",after:a});for(let a of e)r.has(a.toLowerCase())||o.push({field:t,type:"removed",before:a})}c(P,"diffStringArray");function _(t,e,s,o){let n=new Map(e),r=new Map(s);for(let[a,u]of r)n.has(a)?n.get(a)!==u&&o.push({field:t,type:"changed",before:n.get(a),after:u}):o.push({field:t,type:"added",after:u});for(let[a,u]of n)r.has(a)||o.push({field:t,type:"removed",before:u})}c(_,"diffKeyed");var H=50;function W(t){let e=(()=>{try{return JSON.parse(t.payload_json)}catch{return z()}})();return{id:t.id,capturedAt:t.captured_at,commitHash:t.commit_hash,source:t.source||"sync-mechanical",patternCount:t.pattern_count,antiPatternCount:t.anti_pattern_count,conventionCount:t.convention_count,frameworkCount:t.framework_count,symbolCount:t.symbol_count,fileCount:t.file_count,summary:t.summary,payload:e}}c(W,"rowToSnapshot");function z(){return{payloadVersion:1,stack:{ecosystem:"unknown",languages:[],frameworks:[],keyLibraries:[],hasTests:!1,hasDocker:!1},commands:{},conventions:[],patterns:[],antiPatterns:[],structural:{symbols:0,files:0,packages:[]},metrics:{}}}c(z,"emptyPayload");function N(t){try{let e=m.get(t,"SELECT * FROM project_style_snapshots WHERE is_active = 1 ORDER BY captured_at DESC LIMIT 1");return e?W(e):null}catch{return null}}c(N,"getActiveProjectStyle");function G(t,e=12){try{return m.query(t,"SELECT * FROM project_style_snapshots ORDER BY captured_at DESC LIMIT ?",e).map(W)}catch{return[]}}c(G,"getProjectEvolution");function jt(t,e=6){let s=G(t,e);if(s.length===0)return null;let o=["## Project evolution"];if(s.length>=2){let n=s[0],r=s[s.length-1],a=n.patternCount-r.patternCount,u=n.conventionCount-r.conventionCount,p=n.fileCount-r.fileCount;o.push(`Over ${s.length} snapshots: patterns ${$(a)}, conventions ${$(u)}, files ${$(p)}.`)}for(let n of s)o.push(`- ${n.capturedAt.slice(0,10)} \u2014 ${n.summary}`);return o.join(`
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as Tt}from"./chunk-QOQZHR3E.mjs";import{a as bt,b as Pt,c as Ct,d as xt,e as Dt}from"./chunk-TXJT3G53.mjs";import{a as St}from"./chunk-UMJ5D5I6.mjs";import{a as Ze}from"./chunk-JZDZH6IV.mjs";import{a as Xe}from"./chunk-XV2LJVYB.mjs";import{a as et}from"./chunk-YHOZTAZH.mjs";import{a as tt,b as Mt}from"./chunk-Y3RHBU2R.mjs";import{a as wt,b as kt}from"./chunk-NLL5AV2G.mjs";import{d as vt}from"./chunk-UVATSTRF.mjs";import{a as jt,b as At,c as It,d as Et}from"./chunk-LNB2GLYI.mjs";import{a as p}from"./chunk-DYHYDHCW.mjs";import{a as gt}from"./chunk-JR542RI2.mjs";import{b as Y,c as it,d as ct}from"./chunk-CPR4FPXG.mjs";import{a as lt,b as dt,e as ut,f as mt,g as ie,h as pt,i as ft}from"./chunk-3HGQPUKG.mjs";import{a as ht}from"./chunk-ZQI4TJ5C.mjs";import{i as yt}from"./chunk-IWUF2LGO.mjs";import{a as ot}from"./chunk-YLOK4WRR.mjs";import{b as st,c as nt,d as at}from"./chunk-3CKNJ5RA.mjs";import{b as ae}from"./chunk-R4ILCXKE.mjs";import{a as rt}from"./chunk-LR24AIEW.mjs";import{a as oe,b as I}from"./chunk-D7DQABWO.mjs";import{a as Qe}from"./chunk-ETTDRXQ6.mjs";import{c as Ye}from"./chunk-FZS3XGEA.mjs";import{b as Ke}from"./chunk-7WO5CEH3.mjs";import{a as Be,b as qe}from"./chunk-M5E2YOZ4.mjs";import{b as F}from"./chunk-ZZBNFNMG.mjs";import{d as b,e as R,g as K}from"./chunk-TKXOMN4K.mjs";import{d as ne}from"./chunk-KV4NXLPT.mjs";import{b as v,h as se,p as We,r as Ve,u as Tr,v as q,w as Ue}from"./chunk-A6K4H3YT.mjs";import{b as ze,f as Er}from"./chunk-HDSS6UB3.mjs";import{d as He,e as Le,f as Ge,k as N,o as B}from"./chunk-UH4MD3F3.mjs";import{a as Oe,p as Ir}from"./chunk-QWQFF2UG.mjs";import{a as Je}from"./chunk-EXVL2OFE.mjs";import{d as w}from"./chunk-PKDYFXMI.mjs";import{a as M,d as Ne,e as k,f as O}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";function Rt(r,e){let t=[];H("Languages",r.languages,e.languages,t),H("Frameworks",r.frameworks,e.frameworks,t),(r.packageManager??"")!==(e.packageManager??"")&&t.push({field:"Package manager",type:"changed",before:r.packageManager??"(none)",after:e.packageManager??"(none)"}),(r.sourceDir??"")!==(e.sourceDir??"")&&t.push({field:"Source directory",type:"changed",before:r.sourceDir??"(none)",after:e.sourceDir??"(none)"}),(r.testDir??"")!==(e.testDir??"")&&t.push({field:"Test directory",type:"changed",before:r.testDir??"(none)",after:e.testDir??"(none)"}),H("Config files",r.configFiles,e.configFiles,t),r.fileCount!==e.fileCount&&t.push({field:"File count",type:"changed",before:String(r.fileCount),after:String(e.fileCount)});let s=r.patterns.map(c=>c.name),a=e.patterns.map(c=>c.name);H("Patterns",s,a,t);let o=r.antiPatterns.map(c=>c.issue),n=e.antiPatterns.map(c=>c.issue);return H("Anti-patterns",o,n,t),gt(t,r.commitHash??null,e.commitHash??null)}i(Rt,"generateAnalysisDiff");function Cs(r){if(!r.hasChanges)return`## Analysis Diff
8
+ import{b as Tt}from"./chunk-QOQZHR3E.mjs";import{a as bt,b as Pt,c as Ct,d as xt,e as Dt}from"./chunk-TXJT3G53.mjs";import{a as St}from"./chunk-UMJ5D5I6.mjs";import{a as Ze}from"./chunk-YATXTHDL.mjs";import{a as Xe}from"./chunk-MIJZT4ZR.mjs";import{a as et}from"./chunk-V6GGH6H5.mjs";import{a as tt,b as Mt}from"./chunk-NSTXHVTH.mjs";import{a as wt,b as kt}from"./chunk-HNZ24HIK.mjs";import{d as vt}from"./chunk-XXVHUYL7.mjs";import{a as jt,b as At,c as It,d as Et}from"./chunk-LNB2GLYI.mjs";import{a as p}from"./chunk-DYHYDHCW.mjs";import{a as gt}from"./chunk-JR542RI2.mjs";import{b as Y,c as it,d as ct}from"./chunk-CPR4FPXG.mjs";import{a as lt,b as dt,e as ut,f as mt,g as ie,h as pt,i as ft}from"./chunk-3HGQPUKG.mjs";import{a as ht}from"./chunk-ZXON2U5F.mjs";import{i as yt}from"./chunk-IWUF2LGO.mjs";import{a as ot}from"./chunk-B2ZA5ZAO.mjs";import{b as st,c as nt,d as at}from"./chunk-3CKNJ5RA.mjs";import{b as ae}from"./chunk-R4ILCXKE.mjs";import{a as rt}from"./chunk-IDPBMN3Q.mjs";import{a as oe,b as I}from"./chunk-6NMHVPAI.mjs";import{a as Qe}from"./chunk-ETTDRXQ6.mjs";import{c as Ye}from"./chunk-RLKYEL3F.mjs";import{b as Ke}from"./chunk-7WO5CEH3.mjs";import{a as Be,b as qe}from"./chunk-M5E2YOZ4.mjs";import{b as F}from"./chunk-6WDRJ7J7.mjs";import{d as b,e as R,g as K}from"./chunk-TKXOMN4K.mjs";import{d as ne}from"./chunk-IHEOOJJT.mjs";import{b as v,h as se,p as We,r as Ve,u as Tr,v as q,w as Ue}from"./chunk-A6K4H3YT.mjs";import{b as ze,f as Er}from"./chunk-HDSS6UB3.mjs";import{d as He,e as Le,f as Ge,k as N,o as B}from"./chunk-UH4MD3F3.mjs";import{a as Oe,p as Ir}from"./chunk-QWQFF2UG.mjs";import{a as Je}from"./chunk-A6LRNS6R.mjs";import{d as w}from"./chunk-PKDYFXMI.mjs";import{a as M,d as Ne,e as k,f as O}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";function Rt(r,e){let t=[];H("Languages",r.languages,e.languages,t),H("Frameworks",r.frameworks,e.frameworks,t),(r.packageManager??"")!==(e.packageManager??"")&&t.push({field:"Package manager",type:"changed",before:r.packageManager??"(none)",after:e.packageManager??"(none)"}),(r.sourceDir??"")!==(e.sourceDir??"")&&t.push({field:"Source directory",type:"changed",before:r.sourceDir??"(none)",after:e.sourceDir??"(none)"}),(r.testDir??"")!==(e.testDir??"")&&t.push({field:"Test directory",type:"changed",before:r.testDir??"(none)",after:e.testDir??"(none)"}),H("Config files",r.configFiles,e.configFiles,t),r.fileCount!==e.fileCount&&t.push({field:"File count",type:"changed",before:String(r.fileCount),after:String(e.fileCount)});let s=r.patterns.map(c=>c.name),a=e.patterns.map(c=>c.name);H("Patterns",s,a,t);let o=r.antiPatterns.map(c=>c.issue),n=e.antiPatterns.map(c=>c.issue);return H("Anti-patterns",o,n,t),gt(t,r.commitHash??null,e.commitHash??null)}i(Rt,"generateAnalysisDiff");function Cs(r){if(!r.hasChanges)return`## Analysis Diff
9
9
 
10
10
  No changes between runs.`;let e=[];e.push("## Analysis Diff"),(r.beforeCommit||r.afterCommit)&&e.push(`> \`${r.beforeCommit?.substring(0,7)??"(none)"}\` \u2192 \`${r.afterCommit?.substring(0,7)??"(none)"}\``),e.push(""),e.push("| Change | Field | Detail |"),e.push("|--------|-------|--------|");for(let s of r.items){let a=s.type==="added"?"+":s.type==="removed"?"-":"~",o=s.type==="changed"?`${s.before} \u2192 ${s.after}`:s.after??s.before??"";e.push(`| ${a} | ${s.field} | ${o} |`)}e.push("");let t=[];return r.summary.added>0&&t.push(`${r.summary.added} added`),r.summary.removed>0&&t.push(`${r.summary.removed} removed`),r.summary.changed>0&&t.push(`${r.summary.changed} changed`),e.push(`**Summary**: ${t.join(", ")}`),e.join(`
11
11
  `)}i(Cs,"formatAnalysisDiffMd");function xs(r){if(!r.hasChanges)return"No changes between analysis runs.";let e=[];(r.beforeCommit||r.afterCommit)&&(e.push(` ${r.beforeCommit?.substring(0,7)??"(none)"} \u2192 ${r.afterCommit?.substring(0,7)??"(none)"}`),e.push(""));for(let t of r.items)t.type==="added"?e.push(` + ${t.field}: ${t.after}`):t.type==="removed"?e.push(` - ${t.field}: ${t.before}`):e.push(` ~ ${t.field}: ${t.before} \u2192 ${t.after}`);return e.join(`
@@ -32,5 +32,5 @@ ${r.body()}`}i(Qr,"buildSkillContent");function Gt(){return process.env.HOME||Kr
32
32
  COALESCE(SUM(total_duration), 0) AS duration,
33
33
  COALESCE(SUM(avg_compression_rate * syncs), 0) AS weighted_rate
34
34
  FROM metrics_daily`),s=t?.syncs??0,a=t?.tokens??0,o=i((m,h)=>b.get(e,h?"SELECT COALESCE(SUM(tokens_saved), 0) AS t FROM metrics_daily WHERE date >= ? AND date < ?":"SELECT COALESCE(SUM(tokens_saved), 0) AS t FROM metrics_daily WHERE date >= ?",...h?[m,h]:[m])?.t??0,"rangeTokens"),n=o(Z(30)),c=o(Z(60),Z(30)),l=c>0?(n-c)/c*100:0,d=b.query(e,"SELECT * FROM metrics_agent_usage ORDER BY usage_count DESC LIMIT 5").map(m=>({agentName:m.agent_name,usageCount:m.usage_count,tokensSaved:m.tokens_saved}));return{totalTokensSaved:a,estimatedCostSaved:Kt(a),compressionRate:s>0?(t?.weighted_rate??0)/s:0,syncCount:s,avgSyncDuration:s>0?(t?.duration??0)/s:0,topAgents:d,last30DaysTokens:n,trend:l}}async getDailyStats(e,t=30){return b.query(e,"SELECT * FROM metrics_daily WHERE date >= ? ORDER BY date ASC",Z(t)).map(is)}async getFirstSyncDate(e){return b.get(e,"SELECT MIN(date) AS d FROM metrics_daily")?.d??""}},Yt=new ve;O();se();import cs from"node:path";function ls(r){return qe(cs.resolve(r))}i(ls,"repoHash");function L(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"")}i(L,"normalizeKey");function ds(r){return ae(r,e=>`${L(e.name)}::${L(e.source)}`)}i(ds,"dedupePatterns");function us(r){return ae(r,e=>`${L(e.issue)}::${L(e.file)}::${L(e.source)}`)}i(us,"dedupeAntiPatterns");var be=class{static{i(this,"PatternExtractor")}async extract(e){let t=ls(e.projectPath),s=[];if(e.context7Verified)for(let l of e.frameworks)s.push({name:`${l} API validation via Context7`,description:`Validate ${l} APIs against current documentation through Context7 before implementation.`,framework:l,source:"context7",confidence:.7});let a=(e.feedback?.patternsDiscovered||[]).map(l=>({name:l,description:`Confirmed during completed tasks: ${l}`,source:"feedback",confidence:.75})),o=(e.feedback?.knownGotchas||[]).map(l=>({issue:l,file:"multiple",suggestion:`Recurring gotcha. Prevent this pattern during implementation: ${l}`,source:"feedback",severity:"medium",confidence:.7})),n=ds([...s,...a]),c=us([...o]);return{patterns:n,antiPatterns:c,repoPathHash:t}}},ms=new be,Qt=ms;var Xt=200;async function Zt(r,e,t){let{bm25Index:s,originalSize:a}=(()=>{try{let d=st(r),m=d?Object.values(d.documents).reduce((h,y)=>h+y.length,0):0;return{bm25Index:d,originalSize:m||e.fileCount*Xt}}catch(d){return p.debug("Could not load BM25 index for metrics",{error:k(d)}),{bm25Index:null,originalSize:e.fileCount*Xt}}})(),o=0,n=a>0?Math.max(0,(a-o)/a):0;try{await Yt.recordSync(r,{originalSize:a,filteredSize:o,duration:t,isWatch:!1})}catch(d){p.debug("Failed to record sync metrics",{error:k(d)})}try{let{velocityStorage:d}=await import("./velocity-storage-IOCVK2LU.mjs");await d.recompute(r)}catch(d){p.debug("Failed to recompute velocity",{error:k(d)})}let c=await import("./developer-evolution-UTY3CWOK.mjs").then(({captureDeveloperSnapshot:d})=>d(r)).catch(d=>(p.debug("Failed to capture dev snapshot",{error:k(d)}),!1)),l={};try{let d=s;d&&(l.bm25Files=d.totalDocs,l.bm25AvgTokens=Math.round(d.avgDocLength),l.bm25VocabSize=Object.keys(d.invertedIndex).length);let m=Y(r);m&&(l.importEdges=m.edgeCount,l.importFiles=m.fileCount);let h=wt(r);h&&(l.cochangeCommits=h.commitsAnalyzed,l.cochangeFiles=h.filesAnalyzed)}catch(d){p.debug("Could not load index stats",{error:k(d)})}return{duration:t,originalSize:a,filteredSize:o,compressionRate:n,indexes:l,developerSnapshotCaptured:c}}i(Zt,"recordSyncMetrics");async function er(r,e,t,s,a,o){try{let n=t.recentCommits[0]?.hash||null,c=await I.getAggregatedFeedback(r).catch(()=>{});try{let{refreshSkillIndex:d}=await import("./skill-index-55I3HLAI.mjs");await d(r,e)}catch{}let l=await Qt.extract({projectId:r,projectPath:e,languages:s.languages,frameworks:Array.from(new Set([...s.frameworks,...a.frameworks])),feedback:c,context7Verified:o});await X.saveDraft(r,{projectId:r,languages:s.languages,frameworks:s.frameworks,configFiles:[],fileCount:s.fileCount,patterns:l.patterns,antiPatterns:l.antiPatterns,analyzedAt:v(),status:"draft",commitHash:n??void 0})}catch(n){p.debug("Failed to save draft analysis (non-critical)",{error:k(n)})}}i(er,"saveDraftAnalysis");async function tr(r){try{let[e,t,s,a,o]=await Promise.all([Xe.archiveOldShipped(r).catch(()=>0),Ze.markDormantIdeas(r).catch(()=>0),et.removeStaleCompleted(r).catch(()=>0),I.archiveStalePausedTasks(r).catch(()=>[]),rt.capEntries(r).catch(()=>0)]),n=e+t+s+a.length+o;if(n>0){p.info("Archived stale data",{shipped:e,dormant:t,staleQueue:s,stalePaused:a.length,memoryCapped:o,total:n});let c=Ye.getStats(r);p.debug("Archive stats",c)}}catch(e){p.debug("Archival failed (non-critical)",{error:k(e)})}}i(tr,"archiveStaleData");var fs=6e4,Pe=class extends Error{static{i(this,"SyncPhaseTimeoutError")}phase;timeoutMs;constructor(e,t){super(`sync phase '${e}' timed out after ${t}ms. Set PRJCT_SYNC_PHASE_TIMEOUT_MS to tune this guard, or run \`prjct sync --full --md\` if incremental state looks stale.`),this.name="SyncPhaseTimeoutError",this.phase=e,this.timeoutMs=t}};function gs(){return Number(process.env.PRJCT_SYNC_PHASE_TIMEOUT_MS)||fs}i(gs,"syncPhaseTimeoutMs");function rr(r,e){let t=gs(),s=(()=>{let a=Promise.withResolvers(),o=setTimeout(()=>a.reject(new Pe(e,t)),t);return{promise:a.promise,cancel:i(()=>clearTimeout(o),"cancel")}})();return Promise.race([r,s.promise]).finally(s.cancel)}i(rr,"withPhaseTimeout");async function sr(r,e,t){let s=Date.now();p.debug("sync phase start",{phase:r});try{let a=await e(),o=Date.now()-s;return p.debug("sync phase done",{phase:r,ms:o}),t?.push({phase:r,ms:o}),a}catch(a){let o=Date.now()-s;throw p.debug("sync phase failed",{phase:r,ms:o,error:w(a)}),t?.push({phase:r,ms:o}),a}}i(sr,"runSyncPhase");function Ce(r,e={}){let t=e.now??Date.now,s=t(),o=(()=>{try{return r().then(()=>({}),n=>({error:n}))}catch(n){return Promise.resolve({error:n})}})().then(n=>{try{e.onComplete?.({totalMs:t()-s,...n})}catch{}});return{async settle(){await o}}}i(Ce,"startPostIndexWork");K();import hs from"node:fs/promises";import ys from"node:path";O();se();O();B();import xe from"node:fs/promises";import ee from"node:path";var De=".prjct/.prjct-state.md",je=class{static{i(this,"LocalStateGenerator")}async generate(e,t){let s=ee.join(e,De);await xe.mkdir(ee.dirname(s),{recursive:!0});let a=this.toMarkdown(t);await xe.writeFile(s,a,"utf-8")}async remove(e){try{await xe.unlink(ee.join(e,De))}catch(t){if(!M(t))throw t}}async exists(e){let t=ee.join(e,De);return N(t)}toMarkdown(e){let t=["<!-- Auto-generated by prjct - DO NOT EDIT -->","<!-- This file provides local state persistence for AI tools -->","","# prjct State",""];if(e.currentTask){let s=e.currentTask;if(t.push("## Current Work Cycle"),t.push(""),t.push(`**${s.description}**`),t.push(""),t.push(`- Started: ${s.startedAt}`),s.linearId&&t.push(`- Linear: ${s.linearId}`),s.branch&&t.push(`- Branch: ${s.branch}`),t.push(`- Status: ${s.status||"active"}`),t.push(""),s.subtasks&&s.subtasks.length>0){t.push("### Subtasks"),t.push(""),s.subtasks.forEach((c,l)=>{let d=c.status==="completed"?"\u2705":c.status==="in_progress"?"\u25B6\uFE0F":"\u23F3",m=l===s.currentSubtaskIndex?" \u2190 **Active**":"";t.push(`${l+1}. ${d} ${c.description}${m}`)}),t.push("");let a=s.subtasks.filter(c=>c.status==="completed").length,o=s.subtasks.length,n=Math.round(a/o*100);t.push(`**Progress**: ${a}/${o} (${n}%)`),t.push("")}}else t.push("*No active work cycle*"),t.push(""),t.push('Start work with `p. work "intent"`'),t.push("");if(e.previousTask){let s=e.previousTask;t.push("---"),t.push(""),t.push("## Previous Work Cycle"),t.push(""),t.push(`**${s.description}**`),t.push(""),t.push(`- Status: ${s.status}`),s.prUrl&&t.push(`- PR: ${s.prUrl}`),t.push("")}return t.push("---"),t.push(`*Last updated: ${e.lastUpdated||new Date().toISOString()}*`),t.push(""),t.join(`
35
- `)}},nr=new je;var Ss=["storage","context","memory","analysis","config","sync"];async function ar(r){try{await Promise.all(Ss.map(e=>hs.mkdir(ys.join(r,e),{recursive:!0})))}catch(e){throw new Error(Ne(e,r,"project directories"))}}i(ar,"ensureProjectDirectories");async function or(r){let{projectId:e,projectPath:t,cliVersion:s,git:a,stats:o}=r,n=b.getDoc(e,"project")||{},c={...n,projectId:e,repoPath:t,name:o.name,version:o.version,cliVersion:s,techStack:o.frameworks,fileCount:o.fileCount,commitCount:a.commits,stack:o.ecosystem,currentBranch:a.branch,hasUncommittedChanges:a.hasChanges,createdAt:n.createdAt||v(),lastSync:v(),lastSyncCommit:a.recentCommits[0]?.hash||null,lastSyncBranch:a.branch};b.setDoc(e,"project",c)}i(or,"updateProjectDoc");async function ir(r){let{projectId:e,projectPath:t,stats:s,stack:a}=r,n={...await I.read(e)};n.projectId=e,n.stack={language:s.languages[0]||"Unknown",framework:s.frameworks[0]||null},n.domains={hasFrontend:a.hasFrontend,hasBackend:a.hasBackend,hasDatabase:a.hasDatabase,hasTesting:a.hasTesting,hasDocker:a.hasDocker},n.projectType=s.projectType,n.metrics={totalFiles:s.fileCount},n.lastSync=v(),n.lastUpdated=v(),n.context={...n.context||{},lastSession:v(),lastAction:"Synced project",nextAction:'Run `p. work "intent"` to start a work cycle'},await I.write(e,n);try{await nr.remove(t)}catch(c){p.debug("Legacy local state cleanup failed (optional)",{error:k(c)})}}i(ir,"updateStateDoc");function cr(r,e,t){b.appendEvent(r,"sync",{branch:e.branch,uncommitted:e.hasChanges,fileCount:t.fileCount,commitCount:e.commits})}i(cr,"logSyncEvent");import lr from"node:fs/promises";import Ae from"node:path";O();Ir();var dr={async jsonFilesValid(r){let e=Date.now(),t=[],s=Ae.basename(r);try{await I.read(s)}catch(a){M(a)||t.push(`state: ${k(a)}`)}return{name:"State data valid",passed:t.length===0,output:t.length===0?"1 store validated":void 0,error:t.length>0?t.join("; "):void 0,durationMs:Date.now()-e}},async noSensitiveData(r){let e=Date.now(),t=Ae.join(r,"context"),s=[/(?:api[_-]?key|apikey)\s*[:=]\s*['"][^'"]{10,}/i,/(?:password|passwd|pwd)\s*[:=]\s*['"][^'"]{4,}/i,/(?:secret|token)\s*[:=]\s*['"][^'"]{10,}/i],a=[];try{let o=await lr.readdir(t);for(let n of o){if(!n.endsWith(".md"))continue;let c=await lr.readFile(Ae.join(t,n),"utf-8");for(let l of s)if(l.test(c)){a.push(`${n}: potential sensitive data detected`);break}}}catch(o){if(!M(o))return{name:"No sensitive data",passed:!1,error:`Could not scan: ${k(o)}`,durationMs:Date.now()-e}}return{name:"No sensitive data",passed:a.length===0,output:a.length===0?"No sensitive patterns found":void 0,error:a.length>0?a.join("; "):void 0,durationMs:Date.now()-e}}},Ie=class{static{i(this,"SyncVerifier")}async verify(e,t,s){let a=Date.now(),o=[],n=s?.failFast??!1,c=[],l=[dr.jsonFilesValid(t),dr.noSensitiveData(t)];for(let m of l){let h=await m;if(o.push(h),!h.passed&&n){c.push(...s?.checks?.filter(y=>y.enabled!==!1).map(y=>y.name)??[]);break}}if((!n||o.every(m=>m.passed))&&s?.checks)for(let m of s.checks){if(m.enabled===!1){c.push(m.name);continue}let h=await this.runCustomCheck(m,e);if(o.push(h),!h.passed&&n){let y=s.checks.slice(s.checks.indexOf(m)+1);c.push(...y.filter(P=>P.enabled!==!1).map(P=>P.name));break}}return{...Q(o,a),skippedCount:c.length}}async runCustomCheck(e,t){let s=Date.now(),a=e.command||(e.script?`sh ${e.script}`:null);if(!a)return{name:e.name,passed:!1,error:"No command or script specified",durationMs:Date.now()-s};try{let{stdout:o,stderr:n}=await Oe(a,{cwd:t,timeout:3e4});return{name:e.name,passed:!0,output:(o.trim()||n.trim()).slice(0,200)||void 0,durationMs:Date.now()-s}}catch(o){let n=o;return{name:e.name,passed:!1,error:(n.stderr?.trim()||n.message).slice(0,200),durationMs:Date.now()-s}}}},ur=new Ie;var Ee=class{static{i(this,"SyncService")}projectPath;projectId=null;globalPath="";cliVersion="0.0.0";constructor(){this.projectPath=process.cwd()}async sync(e=process.cwd(),t={}){this.projectPath=e;let s=Date.now(),a=[],o=i((l,d)=>sr(l,d,a),"phase"),n={installed:!1,verified:!1,configPath:"",message:""},c=[];try{if(this.projectId=await F.getProjectId(e),!this.projectId)return{success:!1,projectId:"",cliVersion:"",git:fe(),stats:ge(),commands:he(),stack:ye(),context7:{installed:!1,verified:!1},error:"No prjct project. Run p. init first."};if(this.globalPath=q.getGlobalProjectPath(this.projectId),this.cliVersion=await this.getCliVersion(),await ws.rm(te.join(this.globalPath,"agents"),{recursive:!0,force:!0}).catch(()=>{}),(await Ve()).installed){let u=await vt({autoRepair:!0});u.verified||p.warn(`Codex p. router not ready: ${u.message||"verification failed"}`)}await o("mcp-defaults",()=>St({silent:!0,verifyContext7:!1}));let d=await We().catch(()=>null),m=d?.name??"claude";try{Object.assign(n,await o("context7",()=>yt.ensureReady(m)))}catch(u){let f=w(u);p.warn(`Context7 MCP not ready (continuing sync): ${f}`),Object.assign(n,{verified:!1,message:f})}await ar(this.globalPath),process.env.PRJCT_SKIP_CREW_SWEEP!=="1"&&await o("legacy-crew-sweep",async()=>{try{let{legacyCrewSweep:u}=await import("./legacy-crew-sweep-GR6HRSHX.mjs"),f=await u(this.projectPath,this.projectId);(f.checkpointsMigrated||f.teamMigrated||f.checkpointsHandEditWarned||f.teamHandEditWarned||f.ghostDirsPurged.length>0||f.agentFilesRepaired.length>0||f.clientPrjctJunkPurged.length>0||f.errors.length>0)&&p.info("Legacy crew sweep ran",{checkpointsMigrated:f.checkpointsMigrated,teamMigrated:f.teamMigrated,checkpointsHandEditWarned:f.checkpointsHandEditWarned,teamHandEditWarned:f.teamHandEditWarned,ghostDirsPurged:f.ghostDirsPurged,agentFilesRepaired:f.agentFilesRepaired,ghostFilesIngested:f.ghostFilesIngested,clientPrjctJunkPurged:f.clientPrjctJunkPurged,errors:f.errors.length})}catch(u){p.debug("Legacy crew sweep failed (non-critical)",{error:w(u)})}});let[y,P,Re,G]=await o("gather",()=>rr(Promise.all([jt(this.projectPath),At(this.projectPath),It(this.projectPath),Et(this.projectPath)]),"gather")),{shouldRebuildIndexes:fr,changedDomains:bs,incrementalInfo:Fe,changedSourceFiles:z,deletedSourceFiles:W}=await o("incremental",()=>Bt({projectId:this.projectId,projectPath:this.projectPath,isFullSync:t.full===!0,changedFilesHint:t.changedFiles}));try{let{refreshFileInventory:u}=await import("./project-file-inventory-HHURZTMH.mjs");await u(this.projectId,this.projectPath)}catch{}try{await Nt(this.projectId)}catch{}fr&&await o("index",async()=>{try{let u=Fe?.isIncremental&&(z.length>0||W.length>0);await Promise.all([u?at(this.projectPath,this.projectId,z,W):nt(this.projectPath,this.projectId),u?ct(this.projectPath,this.projectId,z,W):it(this.projectPath,this.projectId),u?mt(this.projectPath,this.projectId,z,W):ut(this.projectPath,this.projectId),kt(this.projectPath,this.projectId)]);let f=this.projectId,S=this.projectPath,T=await F.readConfig(S).catch(()=>null),C=Ht(T);c.push(Ce(()=>Lt(f,{uploadToCloud:C}),{onComplete:i(({totalMs:D,error:J})=>{p.debug("sync post-index work settled",{projectId:f,uploadToCloud:C,totalMs:D,...J===void 0?{}:{error:w(J)}})},"onComplete")}))}catch(u){p.debug("File ranking index build failed (non-critical)",{error:w(u)})}});let gr=Date.now();p.debug("sync phase start",{phase:"skills"});let hr=await zt.generateAndInstall().catch(u=>{p.debug("Native skill generation failed (non-critical)",{error:w(u)})});p.debug("sync phase done",{phase:"skills",ms:Date.now()-gr}),await o("update-files",()=>Promise.all([or({projectId:this.projectId,projectPath:this.projectPath,cliVersion:this.cliVersion,git:y,stats:P}),ir({projectId:this.projectId,projectPath:this.projectPath,stats:P,stack:G}),Promise.resolve(cr(this.projectId,y,P)),er(this.projectId,this.projectPath,y,P,G,n.verified)]));let re=await X.getActive(this.projectId),yr={patterns:re?.patterns?.length||0,antiPatterns:re?.antiPatterns?.length||0,criticalAntiPatterns:re?.antiPatterns?.filter(u=>u.severity==="high").length||0},Sr=await(async()=>{try{let{recomputeProjectStyle:u,formatProjectStyleForSync:f}=await import("./project-style-evolution-IJXT2MCP.mjs"),S=await o("project-style",()=>u({projectId:this.projectId,projectPath:this.projectPath,stats:P,stack:G,commands:Re,commitHash:y.recentCommits[0]?.hash??null,source:"sync-mechanical"})),T=f(S),C=S.snapshot.payload.metrics.styleCoverage;return{summary:S.snapshot.summary,evolutionMd:T.evolutionMd,patternCount:S.snapshot.patternCount,antiPatternCount:S.snapshot.antiPatternCount,conventionCount:S.snapshot.conventionCount,styleCoverage:typeof C=="number"?C:Number(C)||0,isFirst:S.isFirst,hasChanges:S.delta.hasChanges}}catch(u){p.debug("Project style recompute failed (non-critical)",{error:w(u)});return}})(),_e=[],V={},U=i((u,f,S)=>{_e.push(Ce(async()=>{S(await o(u,f))},{onComplete:i(({totalMs:T,error:C})=>{p.debug("sync floating phase settled",{phase:u,overlapped:!0,totalMs:T,...C===void 0?{}:{error:w(C)}})},"onComplete")}))},"floatPhase"),wr=Date.now()-s;U("metrics",()=>Zt(this.projectId,P,wr),u=>{V.syncMetrics=u}),U("install-global",async()=>{await ne.installGlobalConfig(d??void 0),await ne.syncCommands(d??void 0)},()=>{}),U("install-agent-surfaces",async()=>{let{detectInstalledAgents:u}=await import("./detection-QRVSNMKL.mjs"),f=await u(this.projectPath).catch(()=>[]);await ht(this.projectPath,{refreshIfAdopted:!0,agents:f})},()=>{}),U("verify",async()=>{try{let u=await F.readConfig(this.projectPath);return await ur.verify(this.projectPath,this.globalPath,u?.verification)}catch(u){p.debug("Verification failed (non-critical)",{error:w(u)});return}},u=>{V.verification=u});let kr=await o("work-cost",()=>Tt(this.projectId));await o("archive",()=>tr(this.projectId));let vr=await o("context-quality",()=>ot(this.projectPath,this.projectId)),br=await o("retention",async()=>{try{let u=await F.readConfig(this.projectPath).catch(()=>null),f=u?.retention?.mode??"apply";if(f==="off")return;let S=f==="dry-run",{applyRetention:T,triageInbox:C}=await import("./retention-RET4P2RO.mjs"),D=T(this.projectId,{dryRun:S,maxArchive:u?.retention?.maxArchive,maxDelete:u?.retention?.maxDelete}),{inboxMerged:J,inboxArchived:xr}=S?{inboxMerged:0,inboxArchived:0}:(()=>{let A=C(this.projectId);return{inboxMerged:A.merged,inboxArchived:A.archived}})(),{runVaultPurge:Dr,vaultHealth:jr}=await import("./purge-N2WN6NDB.mjs"),$=await Dr(this.projectId,{projectPath:this.projectPath,dryRun:S,softDeletedPurgeDays:u?.retention?.softDeletedPurgeDays,archivePruneDays:u?.retention?.archivePruneDays,autoSourceMaxLive:u?.retention?.autoSourceMaxLive}),Ar=jr(this.projectId);return{evaluated:D.evaluated,active:D.active,archive:D.wouldArchive,delete:D.wouldDelete,archived:D.archived,deleted:D.deleted,inboxMerged:J,inboxArchived:xr,dryRun:S,samples:D.samples.map(A=>({id:A.id,type:A.type,verdict:A.verdict,score:A.score,reasons:A.reasons,excess:A.excess})),referenceSize:D.referenceSize,vault:{...Ar,softDeletedPurged:$.softDeletedPurged,orphanEventsPurged:$.orphanEventsPurged,archivesPruned:$.archivesPruned,autoSourceTrimmed:$.autoSourceTrimmed,distilledDiscarded:$.distilledDiscarded,digestsWritten:$.digestsWritten}}}catch(u){p.debug("retention phase failed",{error:w(u)});return}});if(process.env.PRJCT_WORLD_MODEL_REFRESH==="1"||process.env.PRJCT_DRIFT_REFRESH==="1")try{let u=await import("node:os"),{markDriftRefreshApplied:f}=await import("./drift-refresh-TD3PYPJN.mjs"),S=process.env.PRJCT_CLI_HOME?te.resolve(process.env.PRJCT_CLI_HOME):te.join(u.homedir(),".prjct-cli");f(S)}catch{}await Promise.all([...c.map(u=>u.settle()),..._e.map(u=>u.settle())]);let $e=V.syncMetrics,Pr=V.verification,Cr=$e?.developerSnapshotCaptured===!0;return{success:!0,projectId:this.projectId,cliVersion:this.cliVersion,git:y,stats:P,commands:Re,stack:G,context7:{installed:n.installed,verified:n.verified,message:n.message},analysisSummary:yr,contextQuality:vr,retentionDryRun:br,syncMetrics:$e,workCost:kr,verification:Pr,incremental:Fe,projectStyle:Sr,developerSnapshotCaptured:Cr,generatedSkills:hr,phaseTimings:a}}catch(l){return{success:!1,projectId:this.projectId||"",cliVersion:this.cliVersion,git:fe(),stats:ge(),commands:he(),stack:ye(),context7:{installed:n.installed,verified:n.verified,message:n.message},error:w(l)}}}async getCliVersion(){try{let e=te.join(__dirname,"..","..","package.json");return(await Ge(e))?.version||"0.0.0"}catch(e){return p.debug("Failed to read CLI version",{error:w(e)}),"0.0.0"}}},mo=new Ee;import Te from"chalk";var mr={task:"Start new work cycle",done:"Complete current work",pause:"Pause and switch context",resume:"Continue paused task",ship:"Ship the feature",reopen:"Reopen for rework",next:"View task queue",sync:"Analyze project",bug:"Report a bug",idea:"Capture an idea"},ks={task:"work"};function Me(r){return ks[r]??r}i(Me,"publicCommand");var pr={task:"working",done:"completed","done-subtask":"working",pause:"paused",resume:"working",ship:"shipped",reopen:"working",next:"idle",sync:"idle",init:"idle",bug:"working",idea:"idle"};function yo(r,e={}){if(e.quiet)return;let t=pr[r]||"idle",s=oe.getValidCommands(t);if(s.length===0)return;let a=s.map(o=>({cmd:`p. ${Me(o)}`,desc:mr[o]||o}));console.log(Te.dim(`
35
+ `)}},nr=new je;var Ss=["storage","context","memory","analysis","config","sync"];async function ar(r){try{await Promise.all(Ss.map(e=>hs.mkdir(ys.join(r,e),{recursive:!0})))}catch(e){throw new Error(Ne(e,r,"project directories"))}}i(ar,"ensureProjectDirectories");async function or(r){let{projectId:e,projectPath:t,cliVersion:s,git:a,stats:o}=r,n=b.getDoc(e,"project")||{},c={...n,projectId:e,repoPath:t,name:o.name,version:o.version,cliVersion:s,techStack:o.frameworks,fileCount:o.fileCount,commitCount:a.commits,stack:o.ecosystem,currentBranch:a.branch,hasUncommittedChanges:a.hasChanges,createdAt:n.createdAt||v(),lastSync:v(),lastSyncCommit:a.recentCommits[0]?.hash||null,lastSyncBranch:a.branch};b.setDoc(e,"project",c)}i(or,"updateProjectDoc");async function ir(r){let{projectId:e,projectPath:t,stats:s,stack:a}=r,n={...await I.read(e)};n.projectId=e,n.stack={language:s.languages[0]||"Unknown",framework:s.frameworks[0]||null},n.domains={hasFrontend:a.hasFrontend,hasBackend:a.hasBackend,hasDatabase:a.hasDatabase,hasTesting:a.hasTesting,hasDocker:a.hasDocker},n.projectType=s.projectType,n.metrics={totalFiles:s.fileCount},n.lastSync=v(),n.lastUpdated=v(),n.context={...n.context||{},lastSession:v(),lastAction:"Synced project",nextAction:'Run `p. work "intent"` to start a work cycle'},await I.write(e,n);try{await nr.remove(t)}catch(c){p.debug("Legacy local state cleanup failed (optional)",{error:k(c)})}}i(ir,"updateStateDoc");function cr(r,e,t){b.appendEvent(r,"sync",{branch:e.branch,uncommitted:e.hasChanges,fileCount:t.fileCount,commitCount:e.commits})}i(cr,"logSyncEvent");import lr from"node:fs/promises";import Ae from"node:path";O();Ir();var dr={async jsonFilesValid(r){let e=Date.now(),t=[],s=Ae.basename(r);try{await I.read(s)}catch(a){M(a)||t.push(`state: ${k(a)}`)}return{name:"State data valid",passed:t.length===0,output:t.length===0?"1 store validated":void 0,error:t.length>0?t.join("; "):void 0,durationMs:Date.now()-e}},async noSensitiveData(r){let e=Date.now(),t=Ae.join(r,"context"),s=[/(?:api[_-]?key|apikey)\s*[:=]\s*['"][^'"]{10,}/i,/(?:password|passwd|pwd)\s*[:=]\s*['"][^'"]{4,}/i,/(?:secret|token)\s*[:=]\s*['"][^'"]{10,}/i],a=[];try{let o=await lr.readdir(t);for(let n of o){if(!n.endsWith(".md"))continue;let c=await lr.readFile(Ae.join(t,n),"utf-8");for(let l of s)if(l.test(c)){a.push(`${n}: potential sensitive data detected`);break}}}catch(o){if(!M(o))return{name:"No sensitive data",passed:!1,error:`Could not scan: ${k(o)}`,durationMs:Date.now()-e}}return{name:"No sensitive data",passed:a.length===0,output:a.length===0?"No sensitive patterns found":void 0,error:a.length>0?a.join("; "):void 0,durationMs:Date.now()-e}}},Ie=class{static{i(this,"SyncVerifier")}async verify(e,t,s){let a=Date.now(),o=[],n=s?.failFast??!1,c=[],l=[dr.jsonFilesValid(t),dr.noSensitiveData(t)];for(let m of l){let h=await m;if(o.push(h),!h.passed&&n){c.push(...s?.checks?.filter(y=>y.enabled!==!1).map(y=>y.name)??[]);break}}if((!n||o.every(m=>m.passed))&&s?.checks)for(let m of s.checks){if(m.enabled===!1){c.push(m.name);continue}let h=await this.runCustomCheck(m,e);if(o.push(h),!h.passed&&n){let y=s.checks.slice(s.checks.indexOf(m)+1);c.push(...y.filter(P=>P.enabled!==!1).map(P=>P.name));break}}return{...Q(o,a),skippedCount:c.length}}async runCustomCheck(e,t){let s=Date.now(),a=e.command||(e.script?`sh ${e.script}`:null);if(!a)return{name:e.name,passed:!1,error:"No command or script specified",durationMs:Date.now()-s};try{let{stdout:o,stderr:n}=await Oe(a,{cwd:t,timeout:3e4});return{name:e.name,passed:!0,output:(o.trim()||n.trim()).slice(0,200)||void 0,durationMs:Date.now()-s}}catch(o){let n=o;return{name:e.name,passed:!1,error:(n.stderr?.trim()||n.message).slice(0,200),durationMs:Date.now()-s}}}},ur=new Ie;var Ee=class{static{i(this,"SyncService")}projectPath;projectId=null;globalPath="";cliVersion="0.0.0";constructor(){this.projectPath=process.cwd()}async sync(e=process.cwd(),t={}){this.projectPath=e;let s=Date.now(),a=[],o=i((l,d)=>sr(l,d,a),"phase"),n={installed:!1,verified:!1,configPath:"",message:""},c=[];try{if(this.projectId=await F.getProjectId(e),!this.projectId)return{success:!1,projectId:"",cliVersion:"",git:fe(),stats:ge(),commands:he(),stack:ye(),context7:{installed:!1,verified:!1},error:"No prjct project. Run p. init first."};if(this.globalPath=q.getGlobalProjectPath(this.projectId),this.cliVersion=await this.getCliVersion(),await ws.rm(te.join(this.globalPath,"agents"),{recursive:!0,force:!0}).catch(()=>{}),(await Ve()).installed){let u=await vt({autoRepair:!0});u.verified||p.warn(`Codex p. router not ready: ${u.message||"verification failed"}`)}await o("mcp-defaults",()=>St({silent:!0,verifyContext7:!1}));let d=await We().catch(()=>null),m=d?.name??"claude";try{Object.assign(n,await o("context7",()=>yt.ensureReady(m)))}catch(u){let f=w(u);p.warn(`Context7 MCP not ready (continuing sync): ${f}`),Object.assign(n,{verified:!1,message:f})}await ar(this.globalPath),process.env.PRJCT_SKIP_CREW_SWEEP!=="1"&&await o("legacy-crew-sweep",async()=>{try{let{legacyCrewSweep:u}=await import("./legacy-crew-sweep-QPKU7ITU.mjs"),f=await u(this.projectPath,this.projectId);(f.checkpointsMigrated||f.teamMigrated||f.checkpointsHandEditWarned||f.teamHandEditWarned||f.ghostDirsPurged.length>0||f.agentFilesRepaired.length>0||f.clientPrjctJunkPurged.length>0||f.errors.length>0)&&p.info("Legacy crew sweep ran",{checkpointsMigrated:f.checkpointsMigrated,teamMigrated:f.teamMigrated,checkpointsHandEditWarned:f.checkpointsHandEditWarned,teamHandEditWarned:f.teamHandEditWarned,ghostDirsPurged:f.ghostDirsPurged,agentFilesRepaired:f.agentFilesRepaired,ghostFilesIngested:f.ghostFilesIngested,clientPrjctJunkPurged:f.clientPrjctJunkPurged,errors:f.errors.length})}catch(u){p.debug("Legacy crew sweep failed (non-critical)",{error:w(u)})}});let[y,P,Re,G]=await o("gather",()=>rr(Promise.all([jt(this.projectPath),At(this.projectPath),It(this.projectPath),Et(this.projectPath)]),"gather")),{shouldRebuildIndexes:fr,changedDomains:bs,incrementalInfo:Fe,changedSourceFiles:z,deletedSourceFiles:W}=await o("incremental",()=>Bt({projectId:this.projectId,projectPath:this.projectPath,isFullSync:t.full===!0,changedFilesHint:t.changedFiles}));try{let{refreshFileInventory:u}=await import("./project-file-inventory-HHURZTMH.mjs");await u(this.projectId,this.projectPath)}catch{}try{await Nt(this.projectId)}catch{}fr&&await o("index",async()=>{try{let u=Fe?.isIncremental&&(z.length>0||W.length>0);await Promise.all([u?at(this.projectPath,this.projectId,z,W):nt(this.projectPath,this.projectId),u?ct(this.projectPath,this.projectId,z,W):it(this.projectPath,this.projectId),u?mt(this.projectPath,this.projectId,z,W):ut(this.projectPath,this.projectId),kt(this.projectPath,this.projectId)]);let f=this.projectId,S=this.projectPath,T=await F.readConfig(S).catch(()=>null),C=Ht(T);c.push(Ce(()=>Lt(f,{uploadToCloud:C}),{onComplete:i(({totalMs:D,error:J})=>{p.debug("sync post-index work settled",{projectId:f,uploadToCloud:C,totalMs:D,...J===void 0?{}:{error:w(J)}})},"onComplete")}))}catch(u){p.debug("File ranking index build failed (non-critical)",{error:w(u)})}});let gr=Date.now();p.debug("sync phase start",{phase:"skills"});let hr=await zt.generateAndInstall().catch(u=>{p.debug("Native skill generation failed (non-critical)",{error:w(u)})});p.debug("sync phase done",{phase:"skills",ms:Date.now()-gr}),await o("update-files",()=>Promise.all([or({projectId:this.projectId,projectPath:this.projectPath,cliVersion:this.cliVersion,git:y,stats:P}),ir({projectId:this.projectId,projectPath:this.projectPath,stats:P,stack:G}),Promise.resolve(cr(this.projectId,y,P)),er(this.projectId,this.projectPath,y,P,G,n.verified)]));let re=await X.getActive(this.projectId),yr={patterns:re?.patterns?.length||0,antiPatterns:re?.antiPatterns?.length||0,criticalAntiPatterns:re?.antiPatterns?.filter(u=>u.severity==="high").length||0},Sr=await(async()=>{try{let{recomputeProjectStyle:u,formatProjectStyleForSync:f}=await import("./project-style-evolution-NOFCIIZZ.mjs"),S=await o("project-style",()=>u({projectId:this.projectId,projectPath:this.projectPath,stats:P,stack:G,commands:Re,commitHash:y.recentCommits[0]?.hash??null,source:"sync-mechanical"})),T=f(S),C=S.snapshot.payload.metrics.styleCoverage;return{summary:S.snapshot.summary,evolutionMd:T.evolutionMd,patternCount:S.snapshot.patternCount,antiPatternCount:S.snapshot.antiPatternCount,conventionCount:S.snapshot.conventionCount,styleCoverage:typeof C=="number"?C:Number(C)||0,isFirst:S.isFirst,hasChanges:S.delta.hasChanges}}catch(u){p.debug("Project style recompute failed (non-critical)",{error:w(u)});return}})(),_e=[],V={},U=i((u,f,S)=>{_e.push(Ce(async()=>{S(await o(u,f))},{onComplete:i(({totalMs:T,error:C})=>{p.debug("sync floating phase settled",{phase:u,overlapped:!0,totalMs:T,...C===void 0?{}:{error:w(C)}})},"onComplete")}))},"floatPhase"),wr=Date.now()-s;U("metrics",()=>Zt(this.projectId,P,wr),u=>{V.syncMetrics=u}),U("install-global",async()=>{await ne.installGlobalConfig(d??void 0),await ne.syncCommands(d??void 0)},()=>{}),U("install-agent-surfaces",async()=>{let{detectInstalledAgents:u}=await import("./detection-QRVSNMKL.mjs"),f=await u(this.projectPath).catch(()=>[]);await ht(this.projectPath,{refreshIfAdopted:!0,agents:f})},()=>{}),U("verify",async()=>{try{let u=await F.readConfig(this.projectPath);return await ur.verify(this.projectPath,this.globalPath,u?.verification)}catch(u){p.debug("Verification failed (non-critical)",{error:w(u)});return}},u=>{V.verification=u});let kr=await o("work-cost",()=>Tt(this.projectId));await o("archive",()=>tr(this.projectId));let vr=await o("context-quality",()=>ot(this.projectPath,this.projectId)),br=await o("retention",async()=>{try{let u=await F.readConfig(this.projectPath).catch(()=>null),f=u?.retention?.mode??"apply";if(f==="off")return;let S=f==="dry-run",{applyRetention:T,triageInbox:C}=await import("./retention-GWJ4AX7I.mjs"),D=T(this.projectId,{dryRun:S,maxArchive:u?.retention?.maxArchive,maxDelete:u?.retention?.maxDelete}),{inboxMerged:J,inboxArchived:xr}=S?{inboxMerged:0,inboxArchived:0}:(()=>{let A=C(this.projectId);return{inboxMerged:A.merged,inboxArchived:A.archived}})(),{runVaultPurge:Dr,vaultHealth:jr}=await import("./purge-5W3K2MZL.mjs"),$=await Dr(this.projectId,{projectPath:this.projectPath,dryRun:S,softDeletedPurgeDays:u?.retention?.softDeletedPurgeDays,archivePruneDays:u?.retention?.archivePruneDays,autoSourceMaxLive:u?.retention?.autoSourceMaxLive}),Ar=jr(this.projectId);return{evaluated:D.evaluated,active:D.active,archive:D.wouldArchive,delete:D.wouldDelete,archived:D.archived,deleted:D.deleted,inboxMerged:J,inboxArchived:xr,dryRun:S,samples:D.samples.map(A=>({id:A.id,type:A.type,verdict:A.verdict,score:A.score,reasons:A.reasons,excess:A.excess})),referenceSize:D.referenceSize,vault:{...Ar,softDeletedPurged:$.softDeletedPurged,orphanEventsPurged:$.orphanEventsPurged,archivesPruned:$.archivesPruned,autoSourceTrimmed:$.autoSourceTrimmed,distilledDiscarded:$.distilledDiscarded,digestsWritten:$.digestsWritten}}}catch(u){p.debug("retention phase failed",{error:w(u)});return}});if(process.env.PRJCT_WORLD_MODEL_REFRESH==="1"||process.env.PRJCT_DRIFT_REFRESH==="1")try{let u=await import("node:os"),{markDriftRefreshApplied:f}=await import("./drift-refresh-TD3PYPJN.mjs"),S=process.env.PRJCT_CLI_HOME?te.resolve(process.env.PRJCT_CLI_HOME):te.join(u.homedir(),".prjct-cli");f(S)}catch{}await Promise.all([...c.map(u=>u.settle()),..._e.map(u=>u.settle())]);let $e=V.syncMetrics,Pr=V.verification,Cr=$e?.developerSnapshotCaptured===!0;return{success:!0,projectId:this.projectId,cliVersion:this.cliVersion,git:y,stats:P,commands:Re,stack:G,context7:{installed:n.installed,verified:n.verified,message:n.message},analysisSummary:yr,contextQuality:vr,retentionDryRun:br,syncMetrics:$e,workCost:kr,verification:Pr,incremental:Fe,projectStyle:Sr,developerSnapshotCaptured:Cr,generatedSkills:hr,phaseTimings:a}}catch(l){return{success:!1,projectId:this.projectId||"",cliVersion:this.cliVersion,git:fe(),stats:ge(),commands:he(),stack:ye(),context7:{installed:n.installed,verified:n.verified,message:n.message},error:w(l)}}}async getCliVersion(){try{let e=te.join(__dirname,"..","..","package.json");return(await Ge(e))?.version||"0.0.0"}catch(e){return p.debug("Failed to read CLI version",{error:w(e)}),"0.0.0"}}},mo=new Ee;import Te from"chalk";var mr={task:"Start new work cycle",done:"Complete current work",pause:"Pause and switch context",resume:"Continue paused task",ship:"Ship the feature",reopen:"Reopen for rework",next:"View task queue",sync:"Analyze project",bug:"Report a bug",idea:"Capture an idea"},ks={task:"work"};function Me(r){return ks[r]??r}i(Me,"publicCommand");var pr={task:"working",done:"completed","done-subtask":"working",pause:"paused",resume:"working",ship:"shipped",reopen:"working",next:"idle",sync:"idle",init:"idle",bug:"working",idea:"idle"};function yo(r,e={}){if(e.quiet)return;let t=pr[r]||"idle",s=oe.getValidCommands(t);if(s.length===0)return;let a=s.map(o=>({cmd:`p. ${Me(o)}`,desc:mr[o]||o}));console.log(Te.dim(`
36
36
  Next:`));for(let o of a){let n=Te.cyan(o.cmd.padEnd(12));console.log(Te.dim(` ${n} \u2192 ${o.desc}`))}}i(yo,"showNextSteps");function So(r,e=!1){let t=pr[r]||"idle";return oe.getValidCommands(t).map(a=>({cmd:e?`prjct ${Me(a)} --md`:`p. ${Me(a)}`,desc:mr[a]||a}))}i(So,"getNextSteps");async function vs(r,e={}){let t=await F.getProjectId(r);return t?{ok:!0,value:t}:(e.md?console.log("> No project ID found. Run `prjct init` first."):tt.failWithHint("NO_PROJECT_ID"),{ok:!1,result:{success:!1,error:"No project ID found"}})}i(vs,"requireProjectId");async function Mo(r,e={}){let t=await Mt.ensureInit(r);return t.success?vs(r,e):{ok:!1,result:t}}i(Mo,"requireProject");export{Cs as a,xs as b,X as c,Mn as d,Yt as e,mo as f,yo as g,So as h,Mo as i};
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as S}from"./chunk-ETTDRXQ6.mjs";import{a as m,b as c,c as g}from"./chunk-FZS3XGEA.mjs";import{d as p,g as D}from"./chunk-TKXOMN4K.mjs";import{b as d,c as l,h as b}from"./chunk-A6K4H3YT.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import{z as e}from"zod";var F=e.enum(["feature","fix","improvement","refactor"]),E=e.enum(["pass","warning","fail","skipped"]),_=e.enum(["added","changed","fixed","removed"]),v=e.object({hours:e.number(),minutes:e.number(),totalMinutes:e.number()}),O=e.object({filesChanged:e.number().nullable().optional(),linesAdded:e.number().nullable().optional(),linesRemoved:e.number().nullable().optional(),commits:e.number().nullable().optional()}),A=e.object({description:e.string(),type:_.optional()}),C=e.object({lintStatus:E.nullable().optional(),lintDetails:e.string().optional(),testStatus:E.nullable().optional(),testDetails:e.string().optional()}),T=e.object({hash:e.string().optional(),message:e.string().optional(),branch:e.string().optional()}),I=e.object({id:e.string(),name:e.string(),version:e.string().nullable().optional(),type:F,agent:e.string().optional(),description:e.string().optional(),changes:e.array(A).optional(),codeSnippets:e.array(e.string()).optional(),commit:T.optional(),codeMetrics:O.optional(),qualityMetrics:C.optional(),quantitativeImpact:e.string().optional(),duration:v.optional(),tasksCompleted:e.number().nullable().optional(),shippedAt:e.string(),featureId:e.string().optional()}),y=e.object({shipped:e.array(I),lastUpdated:e.string()});b();D();var f="shipped:backfilled:v1";function r(a){let s={...(()=>{if(!a.data)return{};try{return JSON.parse(a.data)}catch{return{}}})(),id:a.id,name:a.name,shippedAt:a.shipped_at,version:a.version};return a.description!=null&&(s.description=a.description),a.type!=null&&(s.type=a.type),a.duration!=null&&(s.duration=a.duration),s}o(r,"rowToFeature");var u=class extends S{static{o(this,"ShippedStorage")}constructor(){super("shipped.json",y)}getDefault(){return{shipped:[],lastUpdated:""}}getEventType(t){return`shipped.${t}d`}async getAll(t){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC").map(r)}async republishShips(t){if(p.getDoc(t,f))return 0;let s=await this.getAll(t);for(let i of s)await this.publishEvent(t,"shipped_item.created",{id:i.id,shipId:i.id,name:i.name,version:i.version,shippedAt:i.shippedAt});return p.setDoc(t,f,{at:d(),count:s.length}),s.length}async getRecent(t,s=5){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC LIMIT ?",s).map(r)}async addShipped(t,s,i){let n={...s,id:m(),shippedAt:i||d()};if(p.run(t,`INSERT OR IGNORE INTO shipped_features
8
+ import{a as S}from"./chunk-ETTDRXQ6.mjs";import{a as m,b as c,c as g}from"./chunk-RLKYEL3F.mjs";import{d as p,g as D}from"./chunk-TKXOMN4K.mjs";import{b as d,c as l,h as b}from"./chunk-A6K4H3YT.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import{z as e}from"zod";var F=e.enum(["feature","fix","improvement","refactor"]),E=e.enum(["pass","warning","fail","skipped"]),_=e.enum(["added","changed","fixed","removed"]),v=e.object({hours:e.number(),minutes:e.number(),totalMinutes:e.number()}),O=e.object({filesChanged:e.number().nullable().optional(),linesAdded:e.number().nullable().optional(),linesRemoved:e.number().nullable().optional(),commits:e.number().nullable().optional()}),A=e.object({description:e.string(),type:_.optional()}),C=e.object({lintStatus:E.nullable().optional(),lintDetails:e.string().optional(),testStatus:E.nullable().optional(),testDetails:e.string().optional()}),T=e.object({hash:e.string().optional(),message:e.string().optional(),branch:e.string().optional()}),I=e.object({id:e.string(),name:e.string(),version:e.string().nullable().optional(),type:F,agent:e.string().optional(),description:e.string().optional(),changes:e.array(A).optional(),codeSnippets:e.array(e.string()).optional(),commit:T.optional(),codeMetrics:O.optional(),qualityMetrics:C.optional(),quantitativeImpact:e.string().optional(),duration:v.optional(),tasksCompleted:e.number().nullable().optional(),shippedAt:e.string(),featureId:e.string().optional()}),y=e.object({shipped:e.array(I),lastUpdated:e.string()});b();D();var f="shipped:backfilled:v1";function r(a){let s={...(()=>{if(!a.data)return{};try{return JSON.parse(a.data)}catch{return{}}})(),id:a.id,name:a.name,shippedAt:a.shipped_at,version:a.version};return a.description!=null&&(s.description=a.description),a.type!=null&&(s.type=a.type),a.duration!=null&&(s.duration=a.duration),s}o(r,"rowToFeature");var u=class extends S{static{o(this,"ShippedStorage")}constructor(){super("shipped.json",y)}getDefault(){return{shipped:[],lastUpdated:""}}getEventType(t){return`shipped.${t}d`}async getAll(t){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC").map(r)}async republishShips(t){if(p.getDoc(t,f))return 0;let s=await this.getAll(t);for(let i of s)await this.publishEvent(t,"shipped_item.created",{id:i.id,shipId:i.id,name:i.name,version:i.version,shippedAt:i.shippedAt});return p.setDoc(t,f,{at:d(),count:s.length}),s.length}async getRecent(t,s=5){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC LIMIT ?",s).map(r)}async addShipped(t,s,i){let n={...s,id:m(),shippedAt:i||d()};if(p.run(t,`INSERT OR IGNORE INTO shipped_features
9
9
  (id, name, shipped_at, version, description, type, duration, data)
10
10
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,n.id,n.name,n.shippedAt,n.version??"",n.description??null,n.type??null,n.duration??null,JSON.stringify(n)).changes===0){let h=p.get(t,"SELECT * FROM shipped_features WHERE name = ? AND version = ? AND shipped_at = ?",n.name,n.version??"",n.shippedAt);return h?r(h):n}return await this.publishEvent(t,"shipped_item.created",{id:n.id,shipId:n.id,name:n.name,version:n.version,shippedAt:n.shippedAt}),n}async getByVersion(t,s){let i=p.get(t,"SELECT * FROM shipped_features WHERE version = ? ORDER BY shipped_at DESC LIMIT 1",s);return i?r(i):void 0}async getCount(t){return p.get(t,"SELECT COUNT(*) AS c FROM shipped_features")?.c??0}async getByDateRange(t,s,i){return p.query(t,"SELECT * FROM shipped_features WHERE shipped_at >= ? AND shipped_at <= ? ORDER BY shipped_at DESC",s.toISOString(),i.toISOString()).map(r)}async getStats(t,s="month"){let i=new Date,n=s==="week"?new Date(i.getTime()-10080*60*1e3):s==="month"?new Date(i.getFullYear(),i.getMonth(),1):new Date(i.getFullYear(),0,1);return{count:(await this.getByDateRange(t,n,i)).length,period:s}}async archiveOldShipped(t){let s=l(c.SHIPPED_RETENTION_DAYS).toISOString(),i=p.query(t,"SELECT * FROM shipped_features WHERE shipped_at < ? ORDER BY shipped_at DESC",s).map(r);return i.length===0?0:(g.archiveMany(t,i.map(n=>({entityType:"shipped",entityId:n.id,entityData:n,summary:`${n.name} v${n.version}`,reason:"age"}))),p.run(t,"DELETE FROM shipped_features WHERE shipped_at < ?",s),await this.publishEvent(t,"shipped.archived",{count:i.length,oldestShippedAt:i[i.length-1]?.shippedAt}),i.length)}},Y=new u;export{Y as a};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as y,b as N}from"./chunk-KEJ5RMAI.mjs";import{b as u}from"./chunk-ZZBNFNMG.mjs";import{f as d,h as l,k as m,o as j}from"./chunk-UH4MD3F3.mjs";import{b as f,c as g,d as p,e as k}from"./chunk-SYHDEUVU.mjs";import{a}from"./chunk-E66B27AL.mjs";j();import c from"node:path";var P=[{scriptName:"typecheck",kind:"typecheck"},{scriptName:"lint",kind:"lint"},{scriptName:"test",kind:"test"},{scriptName:"build",kind:"build"},{scriptName:"dev",kind:"dev"},{scriptName:"format",kind:"format"}],A=[{file:"bun.lock",manager:"bun"},{file:"bun.lockb",manager:"bun"},{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];async function R(t){for(let{file:n,manager:e}of A)if(await m(c.join(t,n)))return e;return null}a(R,"detectPackageManager");async function w(t){let n=c.join(t,"package.json");if(!await m(n))return[];let r=(await d(n,null))?.scripts??{};return P.filter(({scriptName:i})=>!!r[i]).map(({scriptName:i,kind:o})=>{let s=r[i];return{scriptName:i,command:s,kind:o,mutating:S(s)}})}a(w,"detectNodeCommands");async function M(t){return await m(c.join(t,"Cargo.toml"))?[{scriptName:"test",command:"cargo test",kind:"test",mutating:!1},{scriptName:"build",command:"cargo build",kind:"build",mutating:!1},{scriptName:"lint",command:"cargo clippy",kind:"lint",mutating:!1},{scriptName:"format",command:"cargo fmt",kind:"format",mutating:!0}]:[]}a(M,"detectCargoCommands");async function _(t){return await m(c.join(t,"go.mod"))?[{scriptName:"test",command:"go test ./...",kind:"test",mutating:!1},{scriptName:"build",command:"go build ./...",kind:"build",mutating:!1},{scriptName:"format",command:"gofmt -l .",kind:"format",mutating:!1}]:[]}a(_,"detectGoCommands");var h=[{marker:/\[tool\.pytest\b/,scriptName:"test",command:"pytest",kind:"test",mutating:!1},{marker:/\[tool\.ruff\b/,scriptName:"lint",command:"ruff check .",kind:"lint",mutating:!1},{marker:/\[tool\.black\b/,scriptName:"format",command:"black .",kind:"format",mutating:!0},{marker:/\[tool\.mypy\b/,scriptName:"typecheck",command:"mypy .",kind:"typecheck",mutating:!1}];async function V(t){let n=c.join(t,"pyproject.toml");if(!await m(n))return[];let e=await l(n,"");return h.filter(({marker:r})=>r.test(e)).map(({marker:r,...i})=>i)}a(V,"detectPythonCommands");async function C(t){let[n,e,r,i,o]=await Promise.all([w(t),M(t),_(t),V(t),R(t)]);return{packageManager:o,commands:[...n,...e,...r,...i]}}a(C,"detectVerifiedCommands");var T=/^(?:--fix|--write|--update|-w|--fix-type)$/,E=new Set(["migrate","push","publish","deploy","release","commit"]);function S(t){for(let n of y(t)){let e=N(n);if(e.some(r=>T.test(r))||e.some(r=>E.has(r.toLowerCase())))return!0}return!1}a(S,"classifyCommandMutation");var x=6,O=3,I=80;function G(t){let n=new Set;return t.filter(e=>n.has(e.kind)?!1:(n.add(e.kind),!0))}a(G,"dedupeByKind");function K(t,n){let e=t.replace(/\s+/g," ").trim();return e.length>n?`${e.slice(0,n-1)}\u2026`:e}a(K,"truncate");async function L(t){try{let n=await u.getProjectId(t),{getActiveProjectStyle:e}=await import("./project-style-evolution-IJXT2MCP.mjs"),r=e(n);if(!r)return null;let i=r.payload.stack,o=[i.ecosystem&&i.ecosystem!=="unknown"?i.ecosystem:null,i.languages.slice(0,O).join(", ")||null,i.frameworks.slice(0,x).join(", ")||null].filter(s=>!!s);return o.length>0?o.join(" \xB7 "):null}catch{return null}}a(L,"buildStackLine");async function b(t){let[n,e]=await Promise.all([L(t),C(t)]),r=G(e.commands);if(!n&&r.length===0)return null;let i=[];n&&i.push(`- stack: ${n}`);for(let o of r){let s=o.mutating?"mutating":"read-only";i.push(`- ${o.kind}: \`${K(o.command,I)}\` (${s})`)}return i.push("- deeper: `prjct context --md` \xB7 `prjct_analysis` MCP \xB7 `prjct_relevant_files` MCP"),i.join(`
8
+ import{a as y,b as N}from"./chunk-KEJ5RMAI.mjs";import{b as u}from"./chunk-6WDRJ7J7.mjs";import{f as d,h as l,k as m,o as j}from"./chunk-UH4MD3F3.mjs";import{b as f,c as g,d as p,e as k}from"./chunk-SYHDEUVU.mjs";import{a}from"./chunk-E66B27AL.mjs";j();import c from"node:path";var P=[{scriptName:"typecheck",kind:"typecheck"},{scriptName:"lint",kind:"lint"},{scriptName:"test",kind:"test"},{scriptName:"build",kind:"build"},{scriptName:"dev",kind:"dev"},{scriptName:"format",kind:"format"}],A=[{file:"bun.lock",manager:"bun"},{file:"bun.lockb",manager:"bun"},{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];async function R(t){for(let{file:n,manager:e}of A)if(await m(c.join(t,n)))return e;return null}a(R,"detectPackageManager");async function w(t){let n=c.join(t,"package.json");if(!await m(n))return[];let r=(await d(n,null))?.scripts??{};return P.filter(({scriptName:i})=>!!r[i]).map(({scriptName:i,kind:o})=>{let s=r[i];return{scriptName:i,command:s,kind:o,mutating:S(s)}})}a(w,"detectNodeCommands");async function M(t){return await m(c.join(t,"Cargo.toml"))?[{scriptName:"test",command:"cargo test",kind:"test",mutating:!1},{scriptName:"build",command:"cargo build",kind:"build",mutating:!1},{scriptName:"lint",command:"cargo clippy",kind:"lint",mutating:!1},{scriptName:"format",command:"cargo fmt",kind:"format",mutating:!0}]:[]}a(M,"detectCargoCommands");async function _(t){return await m(c.join(t,"go.mod"))?[{scriptName:"test",command:"go test ./...",kind:"test",mutating:!1},{scriptName:"build",command:"go build ./...",kind:"build",mutating:!1},{scriptName:"format",command:"gofmt -l .",kind:"format",mutating:!1}]:[]}a(_,"detectGoCommands");var h=[{marker:/\[tool\.pytest\b/,scriptName:"test",command:"pytest",kind:"test",mutating:!1},{marker:/\[tool\.ruff\b/,scriptName:"lint",command:"ruff check .",kind:"lint",mutating:!1},{marker:/\[tool\.black\b/,scriptName:"format",command:"black .",kind:"format",mutating:!0},{marker:/\[tool\.mypy\b/,scriptName:"typecheck",command:"mypy .",kind:"typecheck",mutating:!1}];async function V(t){let n=c.join(t,"pyproject.toml");if(!await m(n))return[];let e=await l(n,"");return h.filter(({marker:r})=>r.test(e)).map(({marker:r,...i})=>i)}a(V,"detectPythonCommands");async function C(t){let[n,e,r,i,o]=await Promise.all([w(t),M(t),_(t),V(t),R(t)]);return{packageManager:o,commands:[...n,...e,...r,...i]}}a(C,"detectVerifiedCommands");var T=/^(?:--fix|--write|--update|-w|--fix-type)$/,E=new Set(["migrate","push","publish","deploy","release","commit"]);function S(t){for(let n of y(t)){let e=N(n);if(e.some(r=>T.test(r))||e.some(r=>E.has(r.toLowerCase())))return!0}return!1}a(S,"classifyCommandMutation");var x=6,O=3,I=80;function G(t){let n=new Set;return t.filter(e=>n.has(e.kind)?!1:(n.add(e.kind),!0))}a(G,"dedupeByKind");function K(t,n){let e=t.replace(/\s+/g," ").trim();return e.length>n?`${e.slice(0,n-1)}\u2026`:e}a(K,"truncate");async function L(t){try{let n=await u.getProjectId(t),{getActiveProjectStyle:e}=await import("./project-style-evolution-NOFCIIZZ.mjs"),r=e(n);if(!r)return null;let i=r.payload.stack,o=[i.ecosystem&&i.ecosystem!=="unknown"?i.ecosystem:null,i.languages.slice(0,O).join(", ")||null,i.frameworks.slice(0,x).join(", ")||null].filter(s=>!!s);return o.length>0?o.join(" \xB7 "):null}catch{return null}}a(L,"buildStackLine");async function b(t){let[n,e]=await Promise.all([L(t),C(t)]),r=G(e.commands);if(!n&&r.length===0)return null;let i=[];n&&i.push(`- stack: ${n}`);for(let o of r){let s=o.mutating?"mutating":"read-only";i.push(`- ${o.kind}: \`${K(o.command,I)}\` (${s})`)}return i.push("- deeper: `prjct context --md` \xB7 `prjct_analysis` MCP \xB7 `prjct_relevant_files` MCP"),i.join(`
9
9
  `)}a(b,"buildProjectFactsSection");async function $(t){let n=await b(t),e=[p];return n&&e.push("","## This project",n),e.join(`
10
10
  `)}a($,"buildPrjctMdBody");async function J(t){let n=await $(t),e=`${f}
11
11
  ${n}
@@ -5,9 +5,9 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-ZZBNFNMG.mjs";import{q as E,u as _,v as T,w as S}from"./chunk-A6K4H3YT.mjs";import{n as I,o as P}from"./chunk-UH4MD3F3.mjs";import{a as A}from"./chunk-PKDYFXMI.mjs";import{a as y,e as $,f as O}from"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import i from"chalk";_();import m from"chalk";var j=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],x=80,v={name:"prjct",icon:"\u26A1",signature:"\u26A1 prjct",spinner:{frames:j,speed:x},cli:{header:c(()=>`${m.cyan.bold("\u26A1")} ${m.cyan("prjct")}`,"header"),footer:c(()=>m.dim("\u26A1 prjct"),"footer"),spin:c((e,t)=>`${m.cyan("\u26A1")} ${m.cyan("prjct")} ${m.cyan(j[e%10])} ${m.dim(t||"")}`,"spin")},template:{header:"\u26A1 prjct",footer:"\u26A1 prjct"},commitFooter:"Generated with [p/](https://www.prjct.app/)",urls:{website:"https://prjct.app",docs:"https://prjct.app/docs"},getCommitFooter:c((e="claude")=>E(e).commitFooter,"getCommitFooter"),getSignature:c((e="claude")=>E(e).signature,"getSignature")},l=v;var w={NO_PROJECT:{message:"No prjct project found in this directory",hint:"Run 'prjct init' to set up a new project",file:".prjct/prjct.config.json"},NO_PROJECT_ID:{message:"Project ID not found",hint:"Run 'prjct init' or check .prjct/prjct.config.json",file:".prjct/prjct.config.json"},CONFIG_NOT_FOUND:{message:"Configuration file not found",hint:"Run 'prjct init' to create project configuration",file:".prjct/prjct.config.json"},CONFIG_INVALID:{message:"Invalid configuration file",hint:"Check JSON syntax or delete .prjct/ and run init again",file:".prjct/prjct.config.json"},GIT_NOT_FOUND:{message:"Git repository not detected",hint:"Run 'git init' first, then 'prjct init'"},GIT_NO_COMMITS:{message:"No commits in repository",hint:"Make an initial commit before using prjct"},GIT_DIRTY:{message:"Working directory has uncommitted changes",hint:"Commit or stash changes, or use '--force' to override"},GIT_ON_MAIN:{message:"Cannot ship from main/master branch",hint:"Create a feature branch first: git checkout -b feature/your-feature"},GIT_OPERATION_FAILED:{message:"Git operation failed",hint:"Check git status and resolve any conflicts"},GH_NOT_AUTHENTICATED:{message:"GitHub CLI not authenticated",hint:"Run 'gh auth login' to authenticate",docs:"https://cli.github.com/manual/gh_auth_login"},LINEAR_NOT_CONFIGURED:{message:"Linear integration not configured",hint:"Configure the Linear MCP server in your AI client"},LINEAR_API_ERROR:{message:"Linear API error",hint:"Check your API key or network connection"},NO_ACTIVE_TASK:{message:"No active work cycle",hint:`Start work with 'p. work "intent"'`},TASK_ALREADY_ACTIVE:{message:"A work cycle is already in progress",hint:"Use 'p. work' to inspect it or ship when complete"},SYNC_FAILED:{message:"Project sync failed",hint:"Check file permissions and try again"},NOTHING_TO_SHIP:{message:"Nothing to ship",hint:"Make some changes first, then run ship"},PR_CREATE_FAILED:{message:"Failed to create pull request",hint:"Check GitHub auth and remote configuration"},NO_AI_PROVIDER:{message:"No AI provider detected",hint:"Install Claude Code or Gemini CLI, then run 'prjct start'",docs:"https://prjct.app/docs"},PROVIDER_NOT_CONFIGURED:{message:"AI provider not configured for prjct",hint:"Run 'prjct start' to configure your provider"},UNKNOWN_COMMAND:{message:"Unknown command",hint:"Run 'prjct --help' to see available commands"},MISSING_PARAM:{message:"Missing required parameter",hint:"Check command usage below"},UNKNOWN:{message:"An unexpected error occurred",hint:"Check the error details and try again"}};function R(e,t){return{...w[e],...t}}c(R,"getError");var b=l.spinner.speed,L={silent:{maxLines:0,maxCharsPerLine:0,showMetrics:!1},minimal:{maxLines:1,maxCharsPerLine:65,showMetrics:!1},compact:{maxLines:4,maxCharsPerLine:80,showMetrics:!0},verbose:{maxLines:1/0,maxCharsPerLine:1/0,showMetrics:!0}},s={currentTier:"compact",interval:null,frame:0,quietMode:!1};function k(){return L[s.currentTier]}c(k,"getTierConfig");var h={success:i.green("\u2713"),fail:i.red("\u2717"),warn:i.yellow("\u26A0"),info:i.blue("\u2139"),debug:i.dim("\u{1F527}"),bullet:i.dim("\u2022"),arrow:i.dim("\u2192"),check:i.green("\u2713"),cross:i.red("\u2717"),spinner:i.cyan("\u25D0")};var g=c((e,t)=>{if(!process.stdout.isTTY&&!process.stderr.isTTY)return e||"";let r=t??(k().maxCharsPerLine||u.FALLBACK_TRUNCATE);return e&&e.length>r?`${e.slice(0,r-1)}\u2026`:e||""},"truncate");var G=c(()=>process.stdout.isTTY?process.stdout.write(`\r${" ".repeat(u.CLEAR_WIDTH)}\r`):!0,"clear"),D={start(){return s.quietMode||console.log(l.cli.header()),this},end(){return s.quietMode||console.log(l.cli.footer()),this},spin(e){return s.quietMode?this:(this.stop(),process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,g(e,u.SPINNER_MSG))}`)},b),this):(process.stdout.write(`${l.cli.spin(0,g(e,u.SPINNER_MSG))}
8
+ import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-6WDRJ7J7.mjs";import{q as E,u as _,v as T,w as S}from"./chunk-A6K4H3YT.mjs";import{n as I,o as P}from"./chunk-UH4MD3F3.mjs";import{a as A}from"./chunk-PKDYFXMI.mjs";import{a as y,e as $,f as O}from"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import i from"chalk";_();import m from"chalk";var j=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],x=80,v={name:"prjct",icon:"\u26A1",signature:"\u26A1 prjct",spinner:{frames:j,speed:x},cli:{header:c(()=>`${m.cyan.bold("\u26A1")} ${m.cyan("prjct")}`,"header"),footer:c(()=>m.dim("\u26A1 prjct"),"footer"),spin:c((e,t)=>`${m.cyan("\u26A1")} ${m.cyan("prjct")} ${m.cyan(j[e%10])} ${m.dim(t||"")}`,"spin")},template:{header:"\u26A1 prjct",footer:"\u26A1 prjct"},commitFooter:"Generated with [p/](https://www.prjct.app/)",urls:{website:"https://prjct.app",docs:"https://prjct.app/docs"},getCommitFooter:c((e="claude")=>E(e).commitFooter,"getCommitFooter"),getSignature:c((e="claude")=>E(e).signature,"getSignature")},l=v;var w={NO_PROJECT:{message:"No prjct project found in this directory",hint:"Run 'prjct init' to set up a new project",file:".prjct/prjct.config.json"},NO_PROJECT_ID:{message:"Project ID not found",hint:"Run 'prjct init' or check .prjct/prjct.config.json",file:".prjct/prjct.config.json"},CONFIG_NOT_FOUND:{message:"Configuration file not found",hint:"Run 'prjct init' to create project configuration",file:".prjct/prjct.config.json"},CONFIG_INVALID:{message:"Invalid configuration file",hint:"Check JSON syntax or delete .prjct/ and run init again",file:".prjct/prjct.config.json"},GIT_NOT_FOUND:{message:"Git repository not detected",hint:"Run 'git init' first, then 'prjct init'"},GIT_NO_COMMITS:{message:"No commits in repository",hint:"Make an initial commit before using prjct"},GIT_DIRTY:{message:"Working directory has uncommitted changes",hint:"Commit or stash changes, or use '--force' to override"},GIT_ON_MAIN:{message:"Cannot ship from main/master branch",hint:"Create a feature branch first: git checkout -b feature/your-feature"},GIT_OPERATION_FAILED:{message:"Git operation failed",hint:"Check git status and resolve any conflicts"},GH_NOT_AUTHENTICATED:{message:"GitHub CLI not authenticated",hint:"Run 'gh auth login' to authenticate",docs:"https://cli.github.com/manual/gh_auth_login"},LINEAR_NOT_CONFIGURED:{message:"Linear integration not configured",hint:"Configure the Linear MCP server in your AI client"},LINEAR_API_ERROR:{message:"Linear API error",hint:"Check your API key or network connection"},NO_ACTIVE_TASK:{message:"No active work cycle",hint:`Start work with 'p. work "intent"'`},TASK_ALREADY_ACTIVE:{message:"A work cycle is already in progress",hint:"Use 'p. work' to inspect it or ship when complete"},SYNC_FAILED:{message:"Project sync failed",hint:"Check file permissions and try again"},NOTHING_TO_SHIP:{message:"Nothing to ship",hint:"Make some changes first, then run ship"},PR_CREATE_FAILED:{message:"Failed to create pull request",hint:"Check GitHub auth and remote configuration"},NO_AI_PROVIDER:{message:"No AI provider detected",hint:"Install Claude Code or Gemini CLI, then run 'prjct start'",docs:"https://prjct.app/docs"},PROVIDER_NOT_CONFIGURED:{message:"AI provider not configured for prjct",hint:"Run 'prjct start' to configure your provider"},UNKNOWN_COMMAND:{message:"Unknown command",hint:"Run 'prjct --help' to see available commands"},MISSING_PARAM:{message:"Missing required parameter",hint:"Check command usage below"},UNKNOWN:{message:"An unexpected error occurred",hint:"Check the error details and try again"}};function R(e,t){return{...w[e],...t}}c(R,"getError");var b=l.spinner.speed,L={silent:{maxLines:0,maxCharsPerLine:0,showMetrics:!1},minimal:{maxLines:1,maxCharsPerLine:65,showMetrics:!1},compact:{maxLines:4,maxCharsPerLine:80,showMetrics:!0},verbose:{maxLines:1/0,maxCharsPerLine:1/0,showMetrics:!0}},s={currentTier:"compact",interval:null,frame:0,quietMode:!1};function k(){return L[s.currentTier]}c(k,"getTierConfig");var h={success:i.green("\u2713"),fail:i.red("\u2717"),warn:i.yellow("\u26A0"),info:i.blue("\u2139"),debug:i.dim("\u{1F527}"),bullet:i.dim("\u2022"),arrow:i.dim("\u2192"),check:i.green("\u2713"),cross:i.red("\u2717"),spinner:i.cyan("\u25D0")};var g=c((e,t)=>{if(!process.stdout.isTTY&&!process.stderr.isTTY)return e||"";let r=t??(k().maxCharsPerLine||u.FALLBACK_TRUNCATE);return e&&e.length>r?`${e.slice(0,r-1)}\u2026`:e||""},"truncate");var G=c(()=>process.stdout.isTTY?process.stdout.write(`\r${" ".repeat(u.CLEAR_WIDTH)}\r`):!0,"clear"),D={start(){return s.quietMode||console.log(l.cli.header()),this},end(){return s.quietMode||console.log(l.cli.footer()),this},spin(e){return s.quietMode?this:(this.stop(),process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,g(e,u.SPINNER_MSG))}`)},b),this):(process.stdout.write(`${l.cli.spin(0,g(e,u.SPINNER_MSG))}
9
9
  `),this))},done(e,t){if(this.stop(),!s.quietMode){let r=[];t?.agents!==void 0&&r.push(`${t.agents}a`),t?.reduction!==void 0&&r.push(`${t.reduction}%`),t?.tokens!==void 0&&r.push(`${Math.round(t.tokens)}K`);let o=r.length>0?i.dim(` [${r.join(" | ")}]`):"";console.log(`${h.success} ${g(e,u.DONE_MSG)}${o}`)}return this},fail(e){return this.stop(),console.error(`${h.fail} ${g(e,u.FAIL_MSG)}`),this},failWithHint(e){this.stop();let t=typeof e=="string"?R(e):e;return console.error(),console.error(`${h.fail} ${t.message}`),t.file&&console.error(i.dim(` File: ${t.file}`)),t.hint&&console.error(i.yellow(` \u{1F4A1} ${t.hint}`)),t.docs&&console.error(i.dim(` Docs: ${t.docs}`)),console.error(),this},warn(e){return this.stop(),s.quietMode||console.log(`${h.warn} ${g(e,u.WARN_MSG)}`),this},info(e){return this.stop(),s.quietMode||console.log(`${h.info} ${e}`),this},debug(e){this.stop();let t=process.env.DEBUG==="1"||process.env.DEBUG==="true";return!s.quietMode&&t&&console.log(`${h.debug} ${i.dim(e)}`),this},success(e,t){return this.done(e,t)},list(e,t={}){if(this.stop(),s.quietMode)return this;let r=t.bullet||h.bullet,o=" ".repeat(t.indent||0);for(let n of e)console.log(`${o}${r} ${n}`);return this},table(e,t={}){if(this.stop(),s.quietMode||e.length===0)return this;let r=Object.keys(e[0]),o={};for(let n of r){o[n]=n.length;for(let a of e){let p=String(a[n]??"");p.length>o[n]&&(o[n]=p.length)}}if(t.header!==!1){let n=r.map(a=>a.padEnd(o[a])).join(" ");console.log(i.dim(n)),console.log(i.dim("\u2500".repeat(n.length)))}for(let n of e){let a=r.map(p=>String(n[p]??"").padEnd(o[p])).join(" ");console.log(a)}return this},box(e,t){if(this.stop(),s.quietMode)return this;let r=t.split(`
10
10
  `),o=Math.max(e.length,...r.map(a=>a.length)),n="\u2500".repeat(o+2);console.log(i.dim(`\u250C${n}\u2510`)),console.log(`${i.dim("\u2502")} ${i.bold(e.padEnd(o))} ${i.dim("\u2502")}`),console.log(i.dim(`\u251C${n}\u2524`));for(let a of r)console.log(`${i.dim("\u2502")} ${a.padEnd(o)} ${i.dim("\u2502")}`);return console.log(i.dim(`\u2514${n}\u2518`)),this},section(e){return this.stop(),s.quietMode?this:(console.log(`
11
11
  ${i.bold(e)}`),console.log(i.dim("\u2500".repeat(e.length))),this)},stop(){return s.interval&&(clearInterval(s.interval),s.interval=null,G()),this},step(e,t,r){if(s.quietMode)return this;this.stop();let o=i.dim(`[${e}/${t}]`);return process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,`${o} ${g(r,u.STEP_MSG)}`)}`)},b),this):(process.stdout.write(`${l.cli.spin(0,`${o} ${g(r,u.STEP_MSG)}`)}
12
12
  `),this)},progress(e,t,r){if(s.quietMode)return this;this.stop();let o=Math.round(e/t*100),n=Math.round(o/10),a=10-n,p=i.cyan("\u2588".repeat(n))+i.dim("\u2591".repeat(a)),d=r?` ${g(r,u.PROGRESS_TEXT)}`:"";return process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,`[${p}] ${o}%${d}`)}`)},b),this):(process.stdout.write(`${l.cli.spin(0,`[${p}] ${o}%${d}`)}
13
- `),this)}},M=D;S();O();P();var C=class{static{c(this,"ProjectService")}currentAuthor=null;async ensureInit(t){if(await f.isConfigured(t))return{success:!0};try{let{worktreeService:a}=await import("./worktree-service-AS7JVBK5.mjs");if(await a.detect(t)){let d=await a.getMainWorktree(t);if(d&&d!==t&&await f.isConfigured(d))return await a.setup(t,d),{success:!0}}}catch{}M.spin("initializing project...");let{PlanningCommands:r}=await import("./planning-VPAX5DZL.mjs"),n=await new r().init(null,t);return n.success?{success:!0}:n}async getProjectId(t){let r=await f.getProjectId(t);if(!r)throw A.notInitialized();return r}async getGlobalPath(t){let r=await this.getProjectId(t);return await T.ensureProjectStructure(r),T.getGlobalProjectPath(r)}async ensureAuthor(){if(this.currentAuthor)return this.currentAuthor;let t=await N();return this.currentAuthor={name:t.name??void 0,email:t.email??void 0,github:t.github??void 0},this.currentAuthor}getCurrentAuthor(){return this.currentAuthor}clearAuthorCache(){this.currentAuthor=null}async isEmptyDirectory(t){try{return(await I(t)).filter(n=>!n.startsWith(".")&&n!=="node_modules"&&n!=="package.json"&&n!=="package-lock.json"&&n!=="README.md").length===0}catch(r){return y(r)||console.error(`Directory check error: ${$(r)}`),!0}}async hasExistingCode(t){try{let r=["src","lib","app","components","pages","api","main.go","main.rs","main.py"];return(await I(t)).some(n=>r.includes(n))}catch(r){return y(r)||console.error(`Code check error: ${$(r)}`),!1}}async isConfigured(t){return await f.isConfigured(t)}async needsMigration(t){return await f.needsMigration(t)}},F=new C,ct=F;export{M as a,F as b,ct as c};
13
+ `),this)}},M=D;S();O();P();var C=class{static{c(this,"ProjectService")}currentAuthor=null;async ensureInit(t){if(await f.isConfigured(t))return{success:!0};try{let{worktreeService:a}=await import("./worktree-service-AS7JVBK5.mjs");if(await a.detect(t)){let d=await a.getMainWorktree(t);if(d&&d!==t&&await f.isConfigured(d))return await a.setup(t,d),{success:!0}}}catch{}M.spin("initializing project...");let{PlanningCommands:r}=await import("./planning-JR7O5MYW.mjs"),n=await new r().init(null,t);return n.success?{success:!0}:n}async getProjectId(t){let r=await f.getProjectId(t);if(!r)throw A.notInitialized();return r}async getGlobalPath(t){let r=await this.getProjectId(t);return await T.ensureProjectStructure(r),T.getGlobalProjectPath(r)}async ensureAuthor(){if(this.currentAuthor)return this.currentAuthor;let t=await N();return this.currentAuthor={name:t.name??void 0,email:t.email??void 0,github:t.github??void 0},this.currentAuthor}getCurrentAuthor(){return this.currentAuthor}clearAuthorCache(){this.currentAuthor=null}async isEmptyDirectory(t){try{return(await I(t)).filter(n=>!n.startsWith(".")&&n!=="node_modules"&&n!=="package.json"&&n!=="package-lock.json"&&n!=="README.md").length===0}catch(r){return y(r)||console.error(`Directory check error: ${$(r)}`),!0}}async hasExistingCode(t){try{let r=["src","lib","app","components","pages","api","main.go","main.rs","main.py"];return(await I(t)).some(n=>r.includes(n))}catch(r){return y(r)||console.error(`Code check error: ${$(r)}`),!1}}async isConfigured(t){return await f.isConfigured(t)}async needsMigration(t){return await f.needsMigration(t)}},F=new C,ct=F;export{M as a,F as b,ct as c};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{c as t}from"./chunk-TF6PN7IB.mjs";import{a as e}from"./chunk-E66B27AL.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-FZABHPFV.mjs"),c=await s(r,o);c?.id&&t.recordSurfaced(r,i,c.id);for(let n of i)t.recordFetch(r,n)}catch{}}e(f,"recordSurfacedForActiveTask");export{f as a};
8
+ import{c as t}from"./chunk-TF6PN7IB.mjs";import{a as e}from"./chunk-E66B27AL.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-SPUES5DO.mjs"),c=await s(r,o);c?.id&&t.recordSurfaced(r,i,c.id);for(let n of i)t.recordFetch(r,n)}catch{}}e(f,"recordSurfacedForActiveTask");export{f as a};
@@ -5,9 +5,9 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as f}from"./chunk-Y5NQV46G.mjs";import{b as v}from"./chunk-PVCEWFHS.mjs";import{e as p,g as I}from"./chunk-TKXOMN4K.mjs";import{a as H,b as K}from"./chunk-WUHGODSQ.mjs";import{b as N,p as q}from"./chunk-QWQFF2UG.mjs";import{b as A}from"./chunk-GCKILEXJ.mjs";import{a as s}from"./chunk-E66B27AL.mjs";I();var L="https://api.openai.com/v1";function M(r,e){return/openrouter\.ai/i.test(e)&&r&&!r.includes("/")?`openai/${r}`:r}s(M,"normalizeModelForBaseUrl");var G="embeddings.provider",V="embeddings.baseUrl",$="embeddings.model",Y="embeddings.authHeader",j="embeddings.authScheme",z="embeddings.headers",W="embeddings.query";function J(r){if(!(typeof r!="string"||!r.trim()))try{let e=JSON.parse(r);if(e&&typeof e=="object"&&!Array.isArray(e)){let n={};for(let[t,i]of Object.entries(e))n[t]=String(i);return Object.keys(n).length?n:void 0}}catch{}}s(J,"parseHeaders");function w(){let r=f(G),e=f($);if(r!=="openai-compatible"||!e)return null;let n=f(j),t=f(Y),i=f(W),o=String(f(V)??L);return{provider:"openai-compatible",baseUrl:o,model:M(String(e),o),authHeader:t!=null?String(t):void 0,authScheme:n!=null?String(n):void 0,extraHeaders:J(f(z)),query:i!=null?String(i):void 0}}s(w,"resolveGlobalEmbeddings");K();q();import X from"node:fs";import Q from"node:path";var U="PRJCT_EMBEDDINGS_API_KEY",Z="prjct-embeddings",ee="prjct";function re(){return Q.join(H(),"config","embeddings.key")}s(re,"keyFilePath");var S={value:void 0};function ne(){return process.platform==="darwin"}s(ne,"isDarwin");async function te(){try{let{stdout:r}=await N("security",["find-generic-password","-a",ee,"-s",Z,"-w"]);return r.trim()||null}catch{return null}}s(te,"readKeychain");function ie(){try{return X.readFileSync(re(),"utf-8").trim()||null}catch{return null}}s(ie,"readFileKey");async function D(){if(S.value!==void 0)return S.value;let r=process.env[U]?.trim();if(r)return S.value=r,r;let e=(ne()?await te():null)??ie();return S.value=e,e}s(D,"getEmbeddingsKey");function oe(r){let e=r?.embeddings;return!e||!e.provider||!e.model?null:e.provider==="openai-compatible"?new _(e.baseUrl??"https://api.openai.com/v1",e.model,{authHeader:e.authHeader,authScheme:e.authScheme,extraHeaders:e.headers,query:e.query}):null}s(oe,"resolveProvider");function se(r,e,n,t,i={}){let o=r.replace(/\/+$/,""),a=i.query?.trim().replace(/^\?/,""),u=`${o}/embeddings${a?`?${a}`:""}`,l=M(e,o),g={"content-type":"application/json",...i.extraHeaders??{}};if(t){let b=i.authHeader?.trim()||"authorization",m=i.authScheme??"Bearer";g[b]=m?`${m} ${t}`:t}return{url:u,init:{method:"POST",headers:g,body:JSON.stringify({model:l,input:n})}}}s(se,"buildEmbeddingsRequest");var _=class{constructor(e,n,t={}){this.baseUrl=e;this.model=n;this.auth=t}baseUrl;model;auth;static{s(this,"HttpEmbeddingProvider")}async embed(e){if(e.length===0)return[];let n=await D(),{url:t,init:i}=se(this.baseUrl,this.model,e,n,this.auth),o=await fetch(t,i);if(!o.ok)throw new Error(`embeddings endpoint ${o.status}: ${await o.text().catch(()=>"")}`);return((await o.json()).data??[]).map(u=>u.embedding)}},de="local-subword-v1",O=256,ae=800;function ce(r){return Array.from({length:r.length},(n,t)=>r.charCodeAt(t)).reduce((n,t)=>Math.imul(n^t,16777619),2166136261)>>>0}s(ce,"fnv1a");function ue(r,e,n){let t=[];if(r.length<e)return t.push(r),t;for(let i of Array.from({length:n-e+1},(o,a)=>e+a))t.push(...Array.from({length:Math.max(0,r.length-i+1)},(o,a)=>r.slice(a,a+i)));return t}s(ue,"charNGrams");function k(r){let e=new Float64Array(O),n=(r.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).slice(0,ae);for(let i of n){let o=ue(`<${i}>`,3,5);o.push(i);for(let a of o){let u=ce(a),l=u%O,g=u&65536?1:-1;e[l]+=g}}let t=Math.sqrt(e.reduce((i,o)=>i+o*o,0))||1;return Array.from(e,i=>i/t)}s(k,"embedLocal");function Ce(r){return k(r)}s(Ce,"embedLocalText");var R=class{static{s(this,"LocalSubwordEmbeddingProvider")}model=de;isLocal=!0;async embed(e){return e.map(n=>k(n))}};function C(r){let e=oe(r);if(e)return e;let n=w();return n?new _(n.baseUrl,n.model,{authHeader:n.authHeader,authScheme:n.authScheme,extraHeaders:n.extraHeaders,query:n.query}):new R}s(C,"resolveActiveProvider");function me(r){return Buffer.from(new Float32Array(r).buffer)}s(me,"packVector");function le(r){let e=Uint8Array.from(r);return new Float32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}s(le,"unpackVector");function Pe(r,e){let n=E(r)*E(e);return n===0?0:F(r,e)/n}s(Pe,"cosineSimilarity");function E(r){return Math.sqrt(r.reduce((e,n)=>e+n*n,0))}s(E,"l2Norm");function F(r,e){let n=Math.min(r.length,e.length);return r.reduce((t,i,o)=>o<n?t+i*e[o]:t,0)}s(F,"dot");var ge=2e3,fe=10,P=new Map,ke={isEnabled(r){return!0},store(r,e,n,t,i){p.run(r,`INSERT INTO memory_embeddings (memory_id, vector, model, dims, norm, created_at)
8
+ import{a as f}from"./chunk-Y5NQV46G.mjs";import{b as v}from"./chunk-7PA4KPSR.mjs";import{e as p,g as I}from"./chunk-TKXOMN4K.mjs";import{a as H,b as K}from"./chunk-WUHGODSQ.mjs";import{b as N,p as q}from"./chunk-QWQFF2UG.mjs";import{b as A}from"./chunk-GCKILEXJ.mjs";import{a as s}from"./chunk-E66B27AL.mjs";I();var L="https://api.openai.com/v1";function M(r,e){return/openrouter\.ai/i.test(e)&&r&&!r.includes("/")?`openai/${r}`:r}s(M,"normalizeModelForBaseUrl");var G="embeddings.provider",V="embeddings.baseUrl",$="embeddings.model",Y="embeddings.authHeader",j="embeddings.authScheme",z="embeddings.headers",W="embeddings.query";function J(r){if(!(typeof r!="string"||!r.trim()))try{let e=JSON.parse(r);if(e&&typeof e=="object"&&!Array.isArray(e)){let n={};for(let[t,i]of Object.entries(e))n[t]=String(i);return Object.keys(n).length?n:void 0}}catch{}}s(J,"parseHeaders");function w(){let r=f(G),e=f($);if(r!=="openai-compatible"||!e)return null;let n=f(j),t=f(Y),i=f(W),o=String(f(V)??L);return{provider:"openai-compatible",baseUrl:o,model:M(String(e),o),authHeader:t!=null?String(t):void 0,authScheme:n!=null?String(n):void 0,extraHeaders:J(f(z)),query:i!=null?String(i):void 0}}s(w,"resolveGlobalEmbeddings");K();q();import X from"node:fs";import Q from"node:path";var U="PRJCT_EMBEDDINGS_API_KEY",Z="prjct-embeddings",ee="prjct";function re(){return Q.join(H(),"config","embeddings.key")}s(re,"keyFilePath");var S={value:void 0};function ne(){return process.platform==="darwin"}s(ne,"isDarwin");async function te(){try{let{stdout:r}=await N("security",["find-generic-password","-a",ee,"-s",Z,"-w"]);return r.trim()||null}catch{return null}}s(te,"readKeychain");function ie(){try{return X.readFileSync(re(),"utf-8").trim()||null}catch{return null}}s(ie,"readFileKey");async function D(){if(S.value!==void 0)return S.value;let r=process.env[U]?.trim();if(r)return S.value=r,r;let e=(ne()?await te():null)??ie();return S.value=e,e}s(D,"getEmbeddingsKey");function oe(r){let e=r?.embeddings;return!e||!e.provider||!e.model?null:e.provider==="openai-compatible"?new _(e.baseUrl??"https://api.openai.com/v1",e.model,{authHeader:e.authHeader,authScheme:e.authScheme,extraHeaders:e.headers,query:e.query}):null}s(oe,"resolveProvider");function se(r,e,n,t,i={}){let o=r.replace(/\/+$/,""),a=i.query?.trim().replace(/^\?/,""),u=`${o}/embeddings${a?`?${a}`:""}`,l=M(e,o),g={"content-type":"application/json",...i.extraHeaders??{}};if(t){let b=i.authHeader?.trim()||"authorization",m=i.authScheme??"Bearer";g[b]=m?`${m} ${t}`:t}return{url:u,init:{method:"POST",headers:g,body:JSON.stringify({model:l,input:n})}}}s(se,"buildEmbeddingsRequest");var _=class{constructor(e,n,t={}){this.baseUrl=e;this.model=n;this.auth=t}baseUrl;model;auth;static{s(this,"HttpEmbeddingProvider")}async embed(e){if(e.length===0)return[];let n=await D(),{url:t,init:i}=se(this.baseUrl,this.model,e,n,this.auth),o=await fetch(t,i);if(!o.ok)throw new Error(`embeddings endpoint ${o.status}: ${await o.text().catch(()=>"")}`);return((await o.json()).data??[]).map(u=>u.embedding)}},de="local-subword-v1",O=256,ae=800;function ce(r){return Array.from({length:r.length},(n,t)=>r.charCodeAt(t)).reduce((n,t)=>Math.imul(n^t,16777619),2166136261)>>>0}s(ce,"fnv1a");function ue(r,e,n){let t=[];if(r.length<e)return t.push(r),t;for(let i of Array.from({length:n-e+1},(o,a)=>e+a))t.push(...Array.from({length:Math.max(0,r.length-i+1)},(o,a)=>r.slice(a,a+i)));return t}s(ue,"charNGrams");function k(r){let e=new Float64Array(O),n=(r.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).slice(0,ae);for(let i of n){let o=ue(`<${i}>`,3,5);o.push(i);for(let a of o){let u=ce(a),l=u%O,g=u&65536?1:-1;e[l]+=g}}let t=Math.sqrt(e.reduce((i,o)=>i+o*o,0))||1;return Array.from(e,i=>i/t)}s(k,"embedLocal");function Ce(r){return k(r)}s(Ce,"embedLocalText");var R=class{static{s(this,"LocalSubwordEmbeddingProvider")}model=de;isLocal=!0;async embed(e){return e.map(n=>k(n))}};function C(r){let e=oe(r);if(e)return e;let n=w();return n?new _(n.baseUrl,n.model,{authHeader:n.authHeader,authScheme:n.authScheme,extraHeaders:n.extraHeaders,query:n.query}):new R}s(C,"resolveActiveProvider");function me(r){return Buffer.from(new Float32Array(r).buffer)}s(me,"packVector");function le(r){let e=Uint8Array.from(r);return new Float32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}s(le,"unpackVector");function Pe(r,e){let n=E(r)*E(e);return n===0?0:F(r,e)/n}s(Pe,"cosineSimilarity");function E(r){return Math.sqrt(r.reduce((e,n)=>e+n*n,0))}s(E,"l2Norm");function F(r,e){let n=Math.min(r.length,e.length);return r.reduce((t,i,o)=>o<n?t+i*e[o]:t,0)}s(F,"dot");var ge=2e3,fe=10,P=new Map,ke={isEnabled(r){return!0},store(r,e,n,t,i){p.run(r,`INSERT INTO memory_embeddings (memory_id, vector, model, dims, norm, created_at)
9
9
  VALUES (?, ?, ?, ?, ?, ?)
10
10
  ON CONFLICT(memory_id) DO UPDATE SET
11
11
  vector = excluded.vector, model = excluded.model,
12
- dims = excluded.dims, norm = excluded.norm, created_at = excluded.created_at`,e,me(n),t,n.length,E(n),i)},embeddedIds(r,e){try{let n=p.query(r,"SELECT memory_id FROM memory_embeddings WHERE model = ?",e);return new Set(n.map(t=>t.memory_id))}catch{return new Set}},async backfill(r,e,n,t={}){let i=t.provider??C(e),o=t.batchSize??64,a=await(async()=>{try{let{evaluateRetention:d}=await import("./retention-RET4P2RO.mjs");return d(r,Date.now()).byId}catch{return null}})(),u=v.unembeddedEntriesForIndex(r,i.model).filter(d=>{if(!A(d)||d.content.trim().length===0)return!1;let c=a?.get(d.id);return!(c&&c.verdict!=="active")});if(this.shouldPruneThisRun(r)){let c=v.allEntriesForIndex(r).filter(h=>{if(!A(h))return!0;let y=a?.get(h.id);return y!=null&&y.verdict!=="active"}).map(h=>h.id);this.pruneNonModelVectors(r,c)}let l=this.countByModel(r,i.model),g=Array.from({length:Math.ceil(u.length/o)},(d,c)=>u.slice(c*o,(c+1)*o)),b=[];for(let d of g)try{let c=await i.embed(d.map(y=>y.content)),h=d.reduce((y,T,B)=>{let x=c[B];return!x||x.length===0?y:(this.store(r,T.id,x,i.model,n),y+1)},0);b.push(h)}catch{}return{embedded:b.reduce((d,c)=>d+c,0),skipped:l,total:l+u.length}},countByModel(r,e){try{return p.get(r,"SELECT COUNT(*) AS n FROM memory_embeddings WHERE model = ?",e)?.n??0}catch{return 0}},shouldPruneThisRun(r){let e=P.get(r)??0;return P.set(r,(e+1)%fe),e===0},pruneNonModelVectors(r,e){if(e.length!==0)try{let n=e.map(()=>"?").join(",");p.run(r,`DELETE FROM memory_embeddings WHERE memory_id IN (${n})`,...e)}catch{}},async semanticSearch(r,e,n,t=10,i){let o=i??C(n);if(!e.trim())return[];let a=await(async()=>{try{return(await o.embed([e]))[0]}catch{return}})();if(!a||a.length===0)return[];let u=(()=>{try{return p.query(r,`SELECT memory_id, vector, norm FROM memory_embeddings
12
+ dims = excluded.dims, norm = excluded.norm, created_at = excluded.created_at`,e,me(n),t,n.length,E(n),i)},embeddedIds(r,e){try{let n=p.query(r,"SELECT memory_id FROM memory_embeddings WHERE model = ?",e);return new Set(n.map(t=>t.memory_id))}catch{return new Set}},async backfill(r,e,n,t={}){let i=t.provider??C(e),o=t.batchSize??64,a=await(async()=>{try{let{evaluateRetention:d}=await import("./retention-GWJ4AX7I.mjs");return d(r,Date.now()).byId}catch{return null}})(),u=v.unembeddedEntriesForIndex(r,i.model).filter(d=>{if(!A(d)||d.content.trim().length===0)return!1;let c=a?.get(d.id);return!(c&&c.verdict!=="active")});if(this.shouldPruneThisRun(r)){let c=v.allEntriesForIndex(r).filter(h=>{if(!A(h))return!0;let y=a?.get(h.id);return y!=null&&y.verdict!=="active"}).map(h=>h.id);this.pruneNonModelVectors(r,c)}let l=this.countByModel(r,i.model),g=Array.from({length:Math.ceil(u.length/o)},(d,c)=>u.slice(c*o,(c+1)*o)),b=[];for(let d of g)try{let c=await i.embed(d.map(y=>y.content)),h=d.reduce((y,T,B)=>{let x=c[B];return!x||x.length===0?y:(this.store(r,T.id,x,i.model,n),y+1)},0);b.push(h)}catch{}return{embedded:b.reduce((d,c)=>d+c,0),skipped:l,total:l+u.length}},countByModel(r,e){try{return p.get(r,"SELECT COUNT(*) AS n FROM memory_embeddings WHERE model = ?",e)?.n??0}catch{return 0}},shouldPruneThisRun(r){let e=P.get(r)??0;return P.set(r,(e+1)%fe),e===0},pruneNonModelVectors(r,e){if(e.length!==0)try{let n=e.map(()=>"?").join(",");p.run(r,`DELETE FROM memory_embeddings WHERE memory_id IN (${n})`,...e)}catch{}},async semanticSearch(r,e,n,t=10,i){let o=i??C(n);if(!e.trim())return[];let a=await(async()=>{try{return(await o.embed([e]))[0]}catch{return}})();if(!a||a.length===0)return[];let u=(()=>{try{return p.query(r,`SELECT memory_id, vector, norm FROM memory_embeddings
13
13
  WHERE model = ? ORDER BY rowid DESC LIMIT ?`,o.model,ge)}catch{return null}})();if(!u)return[];let l=E(a);if(l===0)return[];let g=u.map(m=>{let d=le(m.vector),c=l*(m.norm??E(d));return{id:m.memory_id,score:c===0?0:F(a,d)/c}}).sort((m,d)=>d.score-m.score).slice(0,t),b=[];for(let m of g){let d=v.getById(r,m.id);d&&b.push(d)}return b}};export{Ce as a,Pe as b,F as c,ke as d};
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as f}from"./chunk-WUOVBBPC.mjs";import{g as m}from"./chunk-XYKVWO23.mjs";import{b as a}from"./chunk-PVCEWFHS.mjs";import{i as l}from"./chunk-JGZ3QGWX.mjs";import{b as u}from"./chunk-ZZBNFNMG.mjs";import{a as i}from"./chunk-E66B27AL.mjs";import{execSync as d}from"node:child_process";var h=1200,y=3;function C(t){try{return d("git diff --cached --name-only",{cwd:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split(`
8
+ import{a as f}from"./chunk-WUOVBBPC.mjs";import{g as m}from"./chunk-FBEDUKMG.mjs";import{b as a}from"./chunk-7PA4KPSR.mjs";import{i as l}from"./chunk-JGZ3QGWX.mjs";import{b as u}from"./chunk-6WDRJ7J7.mjs";import{a as i}from"./chunk-E66B27AL.mjs";import{execSync as d}from"node:child_process";var h=1200,y=3;function C(t){try{return d("git diff --cached --name-only",{cwd:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split(`
9
9
  `).map(o=>o.trim()).filter(Boolean)}catch{return[]}}i(C,"stagedFiles");function b(t){let o=new Set;for(let r of t){let n=r.split("/").filter(Boolean);for(let s of n){let e=s.replace(/\.[^.]+$/,"").toLowerCase();e.length>=3&&o.add(e)}}return[...o]}i(b,"pathFragments");function k(t,o){let r=t.content.toLowerCase();if(o.some(n=>r.includes(n)))return!0;for(let n of Object.values(t.tags)){let s=n.toLowerCase();if(o.some(e=>s.includes(e)))return!0}return!1}i(k,"mentionsFragment");async function I(t){let o=await u.readConfig(t);if(!o?.projectId)return null;let r=C(t);if(r.length===0)return null;let n=b(r);if(n.length===0)return null;let s=(()=>{try{return a.recall(o.projectId,{types:["anti-pattern","gotcha"],limit:50})}catch{return null}})();if(!s)return null;let e=s.filter(g=>k(g,n)).slice(0,y);if(e.length===0)return null;let c=["# prjct: heads-up for this commit",""];c.push(`${e.length} anti-pattern/gotcha entr${e.length===1?"y":"ies"} match the staged files.`),c.push(""),c.push(m(e)),c.push(""),c.push("> Nudge, not block. Proceed if you think it still applies.");let p=c.join(`
10
10
  `);return l(p,h)}i(I,"buildPreCommitContext");function _(t=process.cwd(),o){return f({event:"PreToolUse",projectPath:t,build:i(async(r,n)=>w(r)?I(n):null,"build")},o)}i(_,"runPreCommitHook");function w(t){return/\bgit\s+commit\b/.test(t.tool_input?.command??"")}i(w,"isCommitInput");export{I as a,_ as b,w as c};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as u}from"./chunk-7WO5CEH3.mjs";import{d as i,g as T}from"./chunk-TKXOMN4K.mjs";import{b as y,h as _}from"./chunk-A6K4H3YT.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import g from"node:crypto";function E(){return g.randomUUID()}o(E,"generateUUID");_();T();function v(d,t,e){return{id:d,entity_type:t.entityType,entity_id:t.entityId,entity_data:JSON.stringify(t.entityData),summary:t.summary??null,reason:t.reason,archived_at:e,created_at:e}}o(v,"archiveSyncPayload");var l={SHIPPED_RETENTION_DAYS:90,IDEA_DORMANT_DAYS:180,QUEUE_COMPLETED_DAYS:7,PAUSED_TASK_DAYS:30,MEMORY_MAX_ENTRIES:500},h=class{static{o(this,"ArchiveStorage")}archive(t,e){let r=E(),n=y();return i.run(t,"INSERT INTO archives (id, entity_type, entity_id, entity_data, summary, archived_at, reason) VALUES (?, ?, ?, ?, ?, ?, ?)",r,e.entityType,e.entityId,JSON.stringify(e.entityData),e.summary??null,n,e.reason),u({projectId:t,entityType:"archives",entityId:r,eventType:"upsert",data:v(r,e,n)}),r}archiveMany(t,e){if(e.length===0)return 0;let r=y(),n=[];i.transaction(t,a=>{let c=a.prepare("INSERT INTO archives (id, entity_type, entity_id, entity_data, summary, archived_at, reason) VALUES (?, ?, ?, ?, ?, ?, ?)");for(let s of e){let p=E();c.run(p,s.entityType,s.entityId,JSON.stringify(s.entityData),s.summary??null,r,s.reason),n.push({id:p,item:s})}});for(let{id:a,item:c}of n)u({projectId:t,entityType:"archives",entityId:a,eventType:"upsert",data:v(a,c,r)});return e.length}getArchived(t,e,r=50){return e?i.query(t,"SELECT * FROM archives WHERE entity_type = ? ORDER BY archived_at DESC LIMIT ?",e,r):i.query(t,"SELECT * FROM archives ORDER BY archived_at DESC LIMIT ?",r)}getStats(t){let e=i.query(t,"SELECT entity_type, COUNT(*) as count FROM archives GROUP BY entity_type"),r={shipped:0,idea:0,queue_task:0,paused_task:0,memory_entry:0,total:0};for(let n of e){let a=n.entity_type;a in r&&(r[a]=n.count),r.total+=n.count}return r}restore(t,e){let r=i.get(t,"SELECT * FROM archives WHERE id = ?",e);return r?(i.run(t,"DELETE FROM archives WHERE id = ?",e),JSON.parse(r.entity_data)):null}pruneOldArchives(t,e){let r=new Date(Date.now()-e*24*60*60*1e3).toISOString(),n=this.getTotalCount(t);i.run(t,"DELETE FROM archives WHERE archived_at < ?",r);let a=this.getTotalCount(t);return n-a}getTotalCount(t){return i.get(t,"SELECT COUNT(*) as count FROM archives")?.count??0}},I=new h;export{E as a,l as b,I as c};
8
+ import{b as u}from"./chunk-7WO5CEH3.mjs";import{d as i,g as T}from"./chunk-TKXOMN4K.mjs";import{b as y,h as _}from"./chunk-A6K4H3YT.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import g from"node:crypto";function E(){return g.randomUUID()}o(E,"generateUUID");_();T();function v(p,t,e){return{id:p,entity_type:t.entityType,entity_id:t.entityId,entity_data:JSON.stringify(t.entityData),summary:t.summary??null,reason:t.reason,archived_at:e,created_at:e}}o(v,"archiveSyncPayload");var l={SHIPPED_RETENTION_DAYS:90,IDEA_DORMANT_DAYS:180,QUEUE_COMPLETED_DAYS:7,PAUSED_TASK_DAYS:30,MEMORY_MAX_ENTRIES:500},h=class{static{o(this,"ArchiveStorage")}archive(t,e){let r=E(),n=y();return i.run(t,"INSERT INTO archives (id, entity_type, entity_id, entity_data, summary, archived_at, reason) VALUES (?, ?, ?, ?, ?, ?, ?)",r,e.entityType,e.entityId,JSON.stringify(e.entityData),e.summary??null,n,e.reason),u({projectId:t,entityType:"archives",entityId:r,eventType:"upsert",data:v(r,e,n)}),r}archiveMany(t,e){if(e.length===0)return 0;let r=y(),n=[];i.transaction(t,a=>{let c=a.prepare("INSERT INTO archives (id, entity_type, entity_id, entity_data, summary, archived_at, reason) VALUES (?, ?, ?, ?, ?, ?, ?)");for(let s of e){let d=E();c.run(d,s.entityType,s.entityId,JSON.stringify(s.entityData),s.summary??null,r,s.reason),n.push({id:d,item:s})}});for(let{id:a,item:c}of n)u({projectId:t,entityType:"archives",entityId:a,eventType:"upsert",data:v(a,c,r)});return e.length}getArchived(t,e,r=50){return e?i.query(t,"SELECT * FROM archives WHERE entity_type = ? ORDER BY archived_at DESC LIMIT ?",e,r):i.query(t,"SELECT * FROM archives ORDER BY archived_at DESC LIMIT ?",r)}getStats(t){let e=i.query(t,"SELECT entity_type, COUNT(*) as count FROM archives GROUP BY entity_type"),r={shipped:0,idea:0,queue_task:0,paused_task:0,memory_entry:0,workspace_task:0,total:0};for(let n of e){let a=n.entity_type;a in r&&(r[a]=n.count),r.total+=n.count}return r}restore(t,e){let r=i.get(t,"SELECT * FROM archives WHERE id = ?",e);return r?(i.run(t,"DELETE FROM archives WHERE id = ?",e),JSON.parse(r.entity_data)):null}pruneOldArchives(t,e){let r=new Date(Date.now()-e*24*60*60*1e3).toISOString(),n=this.getTotalCount(t);i.run(t,"DELETE FROM archives WHERE archived_at < ?",r);let a=this.getTotalCount(t);return n-a}getTotalCount(t){return i.get(t,"SELECT COUNT(*) as count FROM archives")?.count??0}},I=new h;export{E as a,l as b,I as c};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as s}from"./chunk-MW54MTLB.mjs";import{b as i}from"./chunk-ZZBNFNMG.mjs";import{a as e}from"./chunk-E66B27AL.mjs";function d(t,n){let o=((t??"").trim().split(/\s+/).filter(Boolean)[0]??"").toLowerCase();return!o||o==="status"||o==="show"?{kind:"status"}:n.includes(o)?{kind:"mode",mode:o}:{kind:"unknown",sub:o}}e(d,"parseModeSubcommand");async function m(t,n={}){let r=await i.readConfig(t).catch(()=>null);return r?.projectId?{ok:!0,value:r}:{ok:!1,result:s("No prjct project here \u2014 run `prjct init` first.",n)}}e(m,"requireProjectConfig");export{d as a,m as b};
8
+ import{b as s}from"./chunk-ZH2MF7H7.mjs";import{b as i}from"./chunk-6WDRJ7J7.mjs";import{a as e}from"./chunk-E66B27AL.mjs";function d(t,n){let o=((t??"").trim().split(/\s+/).filter(Boolean)[0]??"").toLowerCase();return!o||o==="status"||o==="show"?{kind:"status"}:n.includes(o)?{kind:"mode",mode:o}:{kind:"unknown",sub:o}}e(d,"parseModeSubcommand");async function m(t,n={}){let r=await i.readConfig(t).catch(()=>null);return r?.projectId?{ok:!0,value:r}:{ok:!1,result:s("No prjct project here \u2014 run `prjct init` first.",n)}}e(m,"requireProjectConfig");export{d as a,m as b};
@@ -5,5 +5,5 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as l}from"./chunk-WUOVBBPC.mjs";import{c as u}from"./chunk-XS45K7ZQ.mjs";import{a as s,c}from"./chunk-4KVPAHFV.mjs";import{b as i}from"./chunk-ZZBNFNMG.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function g(n){let e=n.tool_input??n.toolInput;return e&&typeof e.command=="string"?e.command:typeof n.command=="string"?n.command:e&&typeof e.command_line=="string"?e.command_line:""}o(g,"extractCommand");function k(n){return n?n.sdd?.mode==="strict"||n.tdd?.mode==="strict"||n.deliveryGeometry?.mode==="strict":!1}o(k,"isStrictPackageMode");async function m(n,e){let a=s(g(e));if(!a)return null;let t=await c(n),r=u(a.packages,t);if(r.allow)return null;let d=await i.readConfig(n).catch(()=>null);return{strict:k(d),message:r.decision?.message??r.denyMessage}}o(m,"evaluatePrePackageInput");function w(n=process.cwd(),e){return l({event:"PreToolUse",projectPath:n,decide:o(async a=>{try{let t=await m(n,a);return t?.strict?{deny:t.message}:null}catch{return null}},"decide"),build:o(async a=>{try{let t=await m(n,a);return!t||t.strict?null:`# prjct: package legitimacy (advisory)
8
+ import{a as l}from"./chunk-WUOVBBPC.mjs";import{c as u}from"./chunk-XS45K7ZQ.mjs";import{a as s,c}from"./chunk-4KVPAHFV.mjs";import{b as i}from"./chunk-6WDRJ7J7.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function g(n){let e=n.tool_input??n.toolInput;return e&&typeof e.command=="string"?e.command:typeof n.command=="string"?n.command:e&&typeof e.command_line=="string"?e.command_line:""}o(g,"extractCommand");function k(n){return n?n.sdd?.mode==="strict"||n.tdd?.mode==="strict"||n.deliveryGeometry?.mode==="strict":!1}o(k,"isStrictPackageMode");async function m(n,e){let a=s(g(e));if(!a)return null;let t=await c(n),r=u(a.packages,t);if(r.allow)return null;let d=await i.readConfig(n).catch(()=>null);return{strict:k(d),message:r.decision?.message??r.denyMessage}}o(m,"evaluatePrePackageInput");function w(n=process.cwd(),e){return l({event:"PreToolUse",projectPath:n,decide:o(async a=>{try{let t=await m(n,a);return t?.strict?{deny:t.message}:null}catch{return null}},"decide"),build:o(async a=>{try{let t=await m(n,a);return!t||t.strict?null:`# prjct: package legitimacy (advisory)
9
9
  ${t.message}`}catch{return null}},"build")},e)}o(w,"runPrePackageHook");export{m as a,w as b};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as f}from"./chunk-R4ILCXKE.mjs";import{c as _}from"./chunk-OUAS3LZ3.mjs";import{a as k}from"./chunk-ETTDRXQ6.mjs";import{a as d,b as E,c as y}from"./chunk-FZS3XGEA.mjs";import{d as r,g as R}from"./chunk-TKXOMN4K.mjs";import{b as a,c as T,h as A}from"./chunk-A6K4H3YT.mjs";import{a as c}from"./chunk-E66B27AL.mjs";A();R();function o(s){let e={id:s.id,description:s.description,priority:s.priority??"medium",type:s.type??"feature",section:s.section??"backlog",completed:s.completed===1,createdAt:s.created_at};return s.completed_at!=null&&(e.completedAt=s.completed_at),s.feature_id!=null&&(e.featureId=s.feature_id),s.feature_name!=null&&(e.originFeature=s.feature_name),s.body!=null&&(e.body=s.body),s.agent!=null&&(e.agent=s.agent),s.group_name!=null&&(e.groupName=s.group_name),s.group_id!=null&&(e.groupId=s.group_id),e}c(o,"rowToTask");var p=`INSERT INTO queue_tasks
8
+ import{a as f}from"./chunk-R4ILCXKE.mjs";import{c as _}from"./chunk-OUAS3LZ3.mjs";import{a as k}from"./chunk-ETTDRXQ6.mjs";import{a as d,b as E,c as y}from"./chunk-RLKYEL3F.mjs";import{d as r,g as R}from"./chunk-TKXOMN4K.mjs";import{b as a,c as T,h as A}from"./chunk-A6K4H3YT.mjs";import{a as c}from"./chunk-E66B27AL.mjs";A();R();function o(s){let e={id:s.id,description:s.description,priority:s.priority??"medium",type:s.type??"feature",section:s.section??"backlog",completed:s.completed===1,createdAt:s.created_at};return s.completed_at!=null&&(e.completedAt=s.completed_at),s.feature_id!=null&&(e.featureId=s.feature_id),s.feature_name!=null&&(e.originFeature=s.feature_name),s.body!=null&&(e.body=s.body),s.agent!=null&&(e.agent=s.agent),s.group_name!=null&&(e.groupName=s.group_name),s.group_id!=null&&(e.groupId=s.group_id),e}c(o,"rowToTask");var p=`INSERT INTO queue_tasks
9
9
  (id, description, type, priority, section, created_at, completed, completed_at,
10
10
  feature_id, feature_name, body, agent, group_name, group_id)
11
11
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;function m(s){return[s.id,s.description,s.type??null,s.priority??null,s.section??"backlog",s.createdAt,s.completed?1:0,s.completedAt??null,s.featureId??null,s.originFeature??null,s.body??null,s.agent??null,s.groupName??null,s.groupId??null]}c(m,"insertParams");var g=class extends k{static{c(this,"QueueStorage")}constructor(){super("queue.json",_)}getDefault(){return{tasks:[],lastUpdated:""}}getEventType(e){return`queue.${e}d`}async getTasks(e){return r.query(e,"SELECT * FROM queue_tasks ORDER BY created_at ASC").map(o)}async getActiveTasks(e){return r.query(e,"SELECT * FROM queue_tasks WHERE section = 'active' AND completed = 0 ORDER BY created_at ASC").map(o)}async getBacklog(e){return r.query(e,"SELECT * FROM queue_tasks WHERE section = 'backlog' AND completed = 0 ORDER BY created_at ASC").map(o)}async getNextTask(e){let t=await this.getActiveTasks(e);return f(t)[0]||null}async addTask(e,t){let i={...t,id:d(),createdAt:a(),completed:!1};return r.run(e,p,...m(i)),await this.publishEvent(e,"queue.task_added",{taskId:i.id,description:i.description,priority:i.priority,section:i.section,created_at:i.createdAt}),i}async addTasks(e,t){let i=a(),u=t.map(n=>({...n,id:d(),createdAt:i,completed:!1}));for(let n of u)r.run(e,p,...m(n));return await this.publishEvent(e,"queue.tasks_added",{count:u.length,tasks:u.map(n=>({id:n.id,description:n.description,created_at:n.createdAt}))}),u}async upsertTask(e,t){let i=await this.getTask(e,t.id);if(i){let n={...i};for(let l of["description","type","priority","section"])t[l]!==void 0&&(n[l]=t[l]);r.run(e,`UPDATE queue_tasks SET description = ?, type = ?, priority = ?, section = ?
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as u,e as g}from"./chunk-AEDB75AK.mjs";import{a as r}from"./chunk-E66B27AL.mjs";g();function p(...n){let t=d(...n.filter(Boolean));return process.env.PRJCT_DEBUG?d(t,`---
9
+ prjct v${u()}`):t}r(p,"mdOutput");function c(n,t){let i=`| ${n.join(" | ")} |`,e=`|${n.map(()=>"---").join("|")}|`,o=t.map(s=>`| ${s.join(" | ")} |`);return[i,e,...o].join(`
10
+ `)}r(c,"mdTable");function m(n,t,i=3){return`### ${n}
11
+ ${t}`}r(m,"mdSection");function f(n,t=!1){return n.map((i,e)=>t?`${e+1}. ${i}`:`- ${i}`).join(`
12
+ `)}r(f,"mdList");function l(n){let t=["Command","Action"],i=n.map(e=>[`\`${e.command}\``,e.label]);return`### Next
13
+ ${c(t,i)}`}r(l,"mdNextSteps");function $(n){let t=Object.entries(n).filter(([,o])=>o!=null);if(t.length===0)return"";let i=["Metric","Value"],e=t.map(([o,s])=>[o,String(s)]);return c(i,e)}r($,"mdStats");function h(n,t){return t?`## ${n}
14
+ > ${t}`:`## ${n}`}r(h,"mdDone");function x(n){return`> **WARNING:** ${n}`}r(x,"mdWarn");function d(...n){return n.filter(Boolean).join(`
15
+
16
+ `)}r(d,"mdJoin");export{p as a,m as b,f as c,l as d,$ as e,h as f,x as g};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as l}from"./chunk-DYHYDHCW.mjs";import{a as x}from"./chunk-M5E2YOZ4.mjs";import{r as g,u as j}from"./chunk-A6K4H3YT.mjs";import{k as d,o as H}from"./chunk-UH4MD3F3.mjs";import{c as h}from"./chunk-EXVL2OFE.mjs";import{b as m,e as E}from"./chunk-IJ523YO2.mjs";import{e as c,f as p}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";import w from"node:fs/promises";import P from"node:os";import y from"node:path";p();H();E();j();p();import C from"node:fs/promises";async function k(e){let{skillMdPath:t,skillExists:r,templateContent:a,build:s,logLabel:o}=e;try{let n=s(a);return r&&await C.readFile(t,"utf-8").catch(()=>"")===n.content?{success:!0,action:"unchanged",path:t}:(await C.writeFile(t,n.content,"utf-8"),{success:!0,action:r?"updated":"created",path:t})}catch(n){return l.warn(`${o} skill warning: ${c(n)}`),{success:!1,action:null}}}i(k,"writeSkillIfChanged");var L="prjct-codex-router",S=1024;function b(){return y.join(P.homedir(),".codex","skills","prjct","SKILL.md")}i(b,"getCodexSkillPath");function K(e){return`<!-- ${L}: ${JSON.stringify({v:m,h:e})} -->`}i(K,"getCodexSkillMetadata");function M(e){let t=e.match(new RegExp(`<!--\\s*${L}:\\s*(\\{[\\s\\S]*?\\})\\s*-->`));if(!t)return null;try{let r=JSON.parse(t[1]);return{version:r.v??r.version,templateHash:r.h??r.templateHash}}catch{return null}}i(M,"parseCodexSkillMetadata");function $(e){return x(e).slice(0,12)}i($,"hashContent");async function I(){return h("codex/SKILL.md")}i(I,"loadCodexSkillTemplate");function R(e){let t=e.trimEnd(),r=$(t),a=K(r);return{content:`${t}
8
+ import{a as l}from"./chunk-DYHYDHCW.mjs";import{a as x}from"./chunk-M5E2YOZ4.mjs";import{r as g,u as j}from"./chunk-A6K4H3YT.mjs";import{k as d,o as H}from"./chunk-UH4MD3F3.mjs";import{c as h}from"./chunk-A6LRNS6R.mjs";import{b as m,e as E}from"./chunk-AEDB75AK.mjs";import{e as c,f as p}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";import w from"node:fs/promises";import P from"node:os";import y from"node:path";p();H();E();j();p();import C from"node:fs/promises";async function k(e){let{skillMdPath:t,skillExists:r,templateContent:a,build:s,logLabel:o}=e;try{let n=s(a);return r&&await C.readFile(t,"utf-8").catch(()=>"")===n.content?{success:!0,action:"unchanged",path:t}:(await C.writeFile(t,n.content,"utf-8"),{success:!0,action:r?"updated":"created",path:t})}catch(n){return l.warn(`${o} skill warning: ${c(n)}`),{success:!1,action:null}}}i(k,"writeSkillIfChanged");var L="prjct-codex-router",S=1024;function b(){return y.join(P.homedir(),".codex","skills","prjct","SKILL.md")}i(b,"getCodexSkillPath");function K(e){return`<!-- ${L}: ${JSON.stringify({v:m,h:e})} -->`}i(K,"getCodexSkillMetadata");function M(e){let t=e.match(new RegExp(`<!--\\s*${L}:\\s*(\\{[\\s\\S]*?\\})\\s*-->`));if(!t)return null;try{let r=JSON.parse(t[1]);return{version:r.v??r.version,templateHash:r.h??r.templateHash}}catch{return null}}i(M,"parseCodexSkillMetadata");function $(e){return x(e).slice(0,12)}i($,"hashContent");async function I(){return h("codex/SKILL.md")}i(I,"loadCodexSkillTemplate");function R(e){let t=e.trimEnd(),r=$(t),a=K(r);return{content:`${t}
9
9
 
10
10
  ${a}
11
11
  `,templateHash:r}}i(R,"buildCodexSkillContent");async function D(){try{let e=b(),t=y.dirname(e);await w.mkdir(t,{recursive:!0});let r=await d(e),a=await I();return a?await k({skillMdPath:e,skillExists:r,templateContent:a,build:i(s=>{let o=R(s),n=Buffer.byteLength(o.content,"utf-8");return n>S&&l.warn(`Codex SKILL.md is ${n} bytes \u2014 over Codex's ~${S}-byte hard limit; the skill may be rejected. Trim editor-surfaces.ts.`),o},"build"),logLabel:"Codex"}):(l.warn("Codex SKILL.md template not found"),{success:!1,action:null})}catch(e){return l.warn(`Codex skill warning: ${c(e)}`),{success:!1,action:null}}}i(D,"installCodexSkill");async function U(e={}){let t=b();if(!(await g()).installed)return{installed:!1,verified:!0,skillPath:t,message:"Codex not detected"};let a=await I();if(!a)return{installed:!0,verified:!1,skillPath:t,message:"Codex SKILL.md template missing from prjct installation",fix:["Reinstall prjct-cli package","Run `prjct setup`"]};let s=R(a),o=i(async()=>e.autoRepair?(await D()).success:!1,"maybeRepair");if(!await d(t)&&!await o())return{installed:!0,verified:!1,skillPath:t,templateHash:s.templateHash,message:"Codex skill missing at ~/.codex/skills/prjct/SKILL.md",fix:["Run `prjct start` to install Codex skill"]};let n=i(async()=>{let u=await w.readFile(t,"utf-8").catch(()=>""),f=M(u);return{matches:f?.version===m&&f?.templateHash===s.templateHash}},"readVerification");if(!(await n()).matches){if(!await o())return{installed:!0,verified:!1,skillPath:t,templateHash:s.templateHash,message:"Codex skill metadata mismatch (outdated router)",fix:["Run `prjct start` or `prjct setup` to refresh Codex skill"]};if(!(await n()).matches)return{installed:!0,verified:!1,skillPath:t,templateHash:s.templateHash,message:"Codex skill could not be repaired automatically",fix:["Delete ~/.codex/skills/prjct/SKILL.md","Run `prjct setup`"]}}return{installed:!0,verified:!0,skillPath:t,templateHash:s.templateHash,message:"Codex p. router ready"}}i(U,"verifyCodexPRouterReady");export{S as a,R as b,D as c,U as d};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as R}from"./chunk-HGZQWYBL.mjs";import{a}from"./chunk-ZMLA5SKR.mjs";import{b as h}from"./chunk-PVCEWFHS.mjs";import{d as l,g as E}from"./chunk-TKXOMN4K.mjs";import{a as c}from"./chunk-E66B27AL.mjs";E();var _="land-receipt",k="judgment-receipt",g="receipt-v1";function D(e){let s=e.trapsSurfaced??[],t=e.decisions??[],n=(e.journal??[]).filter(r=>r.trim()),o=(e.openRisksNext??[]).filter(r=>r.trim()),u=e.cycleDescription?.trim()||null,y=e.tokensIn!=null||e.tokensOut!=null||!!e.model;if(!u&&s.length===0&&t.length===0&&n.length===0&&o.length===0&&!y)return null;let i=["# Judgment Receipt",""],m=[];if(u&&m.push(`cycle: "${a(u,100)}"`),n.length>0&&m.push(`journal: ${n.slice(0,4).map(r=>a(r,70)).join(" \xB7 ")}`),m.length>0&&i.push("## Applied judgment",...m.map(r=>`- ${r}`),""),s.length>0&&i.push("## Traps re-surfaced",...s.slice(0,8).map(r=>`- **[${r.type}]** ${a(r.title,100)} \`${r.id}\``),""),t.length>0&&i.push("## Decisions contested or honored",...t.slice(0,8).map(r=>`- **${r.status}** [${r.type}] ${a(r.title,100)} \`${r.id}\``),""),o.length>0||u){let r=o.length>0?o.slice(0,5).map(d=>`- ${a(d,120)}`):["- Finish or pause open cycle; next agent: `prjct prime` / `prjct work --md`."];i.push("## Open risks / next",...r,"")}if(y){let r=[];if(e.tokensIn!=null||e.tokensOut!=null){let d=e.tokensIn??0,f=e.tokensOut??0;r.push(`tokens in=${d} out=${f} total=${d+f}`)}e.model&&r.push(`model=${e.model}`),e.author&&r.push(`author=${e.author}`),i.push("## Session economics",`- ${r.join(" \xB7 ")}`,"")}return i.push("_Closed-loop judgment continuity \u2014 not bulk memory. Proof of traps prevented and decisions applied._"),i.join(`
8
+ import{a as R}from"./chunk-HGZQWYBL.mjs";import{a}from"./chunk-ZMLA5SKR.mjs";import{b as h}from"./chunk-7PA4KPSR.mjs";import{d as l,g as E}from"./chunk-TKXOMN4K.mjs";import{a as c}from"./chunk-E66B27AL.mjs";E();var _="land-receipt",k="judgment-receipt",g="receipt-v1";function D(e){let s=e.trapsSurfaced??[],t=e.decisions??[],n=(e.journal??[]).filter(r=>r.trim()),o=(e.openRisksNext??[]).filter(r=>r.trim()),u=e.cycleDescription?.trim()||null,y=e.tokensIn!=null||e.tokensOut!=null||!!e.model;if(!u&&s.length===0&&t.length===0&&n.length===0&&o.length===0&&!y)return null;let i=["# Judgment Receipt",""],m=[];if(u&&m.push(`cycle: "${a(u,100)}"`),n.length>0&&m.push(`journal: ${n.slice(0,4).map(r=>a(r,70)).join(" \xB7 ")}`),m.length>0&&i.push("## Applied judgment",...m.map(r=>`- ${r}`),""),s.length>0&&i.push("## Traps re-surfaced",...s.slice(0,8).map(r=>`- **[${r.type}]** ${a(r.title,100)} \`${r.id}\``),""),t.length>0&&i.push("## Decisions contested or honored",...t.slice(0,8).map(r=>`- **${r.status}** [${r.type}] ${a(r.title,100)} \`${r.id}\``),""),o.length>0||u){let r=o.length>0?o.slice(0,5).map(d=>`- ${a(d,120)}`):["- Finish or pause open cycle; next agent: `prjct prime` / `prjct work --md`."];i.push("## Open risks / next",...r,"")}if(y){let r=[];if(e.tokensIn!=null||e.tokensOut!=null){let d=e.tokensIn??0,f=e.tokensOut??0;r.push(`tokens in=${d} out=${f} total=${d+f}`)}e.model&&r.push(`model=${e.model}`),e.author&&r.push(`author=${e.author}`),i.push("## Session economics",`- ${r.join(" \xB7 ")}`,"")}return i.push("_Closed-loop judgment continuity \u2014 not bulk memory. Proof of traps prevented and decisions applied._"),i.join(`
9
9
  `).trim()}c(D,"buildJudgmentReceipt");function I(e){if(!e)return null;let s=(e.match(/## Traps re-surfaced/g)||[]).length,t=p(e,"Traps re-surfaced"),n=p(e,"Decisions contested or honored"),o=[];return t>0&&o.push(`${t} trap(s) re-surfaced`),n>0&&o.push(`${n} decision(s) tracked`),o.length===0&&o.push("session judgment landed"),`Judgment receipt: ${o.join(", ")}`}c(I,"summarizeJudgmentReceipt");function p(e,s){let t=new RegExp(`## ${s}\\n([\\s\\S]*?)(?=\\n## |\\n_|$)`),n=e.match(t);return n?(n[1].match(/^- /gm)||[]).length:0}c(p,"countSectionBullets");async function S(e,s,t){let n=D(t);if(!n)return{wrote:!1,content:null,summary:null,reason:"nothing-to-receipt"};try{return await h.remember(e,{type:"context",content:n,tags:{source:_,topic:k,capture:g,synthesis:"deterministic"},provenance:"extracted",projectId:s}),{wrote:!0,content:n,summary:I(n)}}catch(o){return{wrote:!1,content:n,summary:I(n),reason:`remember-failed: ${o.message}`}}}c(S,"persistJudgmentReceipt");async function b(e){let s=R(e.projectId,e.cycleId),t=O(e.projectId),n=j(e.projectId);return S(e.projectPath,e.projectId,{cycleDescription:e.cycleDescription,cycleId:e.cycleId,journal:s,trapsSurfaced:t,decisions:n,tokensIn:e.tokensIn,tokensOut:e.tokensOut,model:e.model,author:e.author,openRisksNext:e.cycleDescription?["Open cycle still needs finish or pause before context dies."]:[]})}c(b,"synthesizeJudgmentReceipt");function C(e){try{let s=Date.now()-864e5,n=l.query(e,`SELECT me.id, me.content
10
10
  FROM memory_entries me
11
11
  JOIN memory_entry_tags t ON t.entry_id = me.id
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as E}from"./chunk-ETTDRXQ6.mjs";import{a as m,b as l,c as y}from"./chunk-FZS3XGEA.mjs";import{d as s,g as v}from"./chunk-TKXOMN4K.mjs";import{b as u,c as p,h as S}from"./chunk-A6K4H3YT.mjs";import{a as d}from"./chunk-E66B27AL.mjs";import{z as t}from"zod";var T=t.enum(["low","medium","high"]),R=t.enum(["pending","converted","completed","archived","dormant"]),I=t.enum(["high","medium","low"]),P=t.object({impact:I,effort:I}),f=t.object({frontend:t.string().optional(),backend:t.string().optional(),payments:t.string().optional(),ai:t.string().optional(),deploy:t.string().optional(),other:t.array(t.string()).optional()}),A=t.object({name:t.string(),description:t.string()}),D=t.object({name:t.string(),description:t.string().optional()}),O=t.object({id:t.string(),text:t.string(),details:t.string().optional(),priority:T,status:R,tags:t.array(t.string()),addedAt:t.string(),completedAt:t.string().optional(),convertedTo:t.string().optional(),source:t.string().optional(),sourceFiles:t.array(t.string()).optional(),painPoints:t.array(t.string()).optional(),solutions:t.array(t.string()).optional(),filesAffected:t.array(t.string()).optional(),impactEffort:P.optional(),implementationNotes:t.string().optional(),stack:f.optional(),modules:t.array(A).optional(),roles:t.array(D).optional(),risks:t.array(t.string()).optional(),risksCount:t.number().optional()}),h=t.object({ideas:t.array(O),lastUpdated:t.string()});S();v();function o(n){let e=(()=>{if(!n.tags)return[];try{let i=JSON.parse(n.tags);return Array.isArray(i)?i:[]}catch{return[]}})(),r={...(()=>{if(!n.data)return{};try{return JSON.parse(n.data)}catch{return{}}})(),id:n.id,text:n.text,status:n.status,priority:n.priority,tags:e,addedAt:n.added_at};return n.converted_to!=null&&(r.convertedTo=n.converted_to),n.details!=null&&(r.details=n.details),r}d(o,"rowToIdea");var g=class extends E{static{d(this,"IdeasStorage")}constructor(){super("ideas.json",h)}getDefault(){return{ideas:[],lastUpdated:""}}getEventType(e){return`ideas.${e}d`}async getAll(e){return s.query(e,"SELECT * FROM ideas ORDER BY added_at DESC").map(o)}async getPending(e){return s.query(e,"SELECT * FROM ideas WHERE status = 'pending' ORDER BY added_at DESC").map(o)}async addIdea(e,a,r={}){let i={id:m(),text:a,status:"pending",priority:r.priority||"medium",tags:r.tags||[],addedAt:u()};return s.run(e,`INSERT INTO ideas (id, text, status, priority, tags, added_at, converted_to, details, data)
8
+ import{a as E}from"./chunk-ETTDRXQ6.mjs";import{a as m,b as l,c as y}from"./chunk-RLKYEL3F.mjs";import{d as s,g as v}from"./chunk-TKXOMN4K.mjs";import{b as u,c as p,h as S}from"./chunk-A6K4H3YT.mjs";import{a as d}from"./chunk-E66B27AL.mjs";import{z as t}from"zod";var T=t.enum(["low","medium","high"]),R=t.enum(["pending","converted","completed","archived","dormant"]),I=t.enum(["high","medium","low"]),P=t.object({impact:I,effort:I}),f=t.object({frontend:t.string().optional(),backend:t.string().optional(),payments:t.string().optional(),ai:t.string().optional(),deploy:t.string().optional(),other:t.array(t.string()).optional()}),A=t.object({name:t.string(),description:t.string()}),D=t.object({name:t.string(),description:t.string().optional()}),O=t.object({id:t.string(),text:t.string(),details:t.string().optional(),priority:T,status:R,tags:t.array(t.string()),addedAt:t.string(),completedAt:t.string().optional(),convertedTo:t.string().optional(),source:t.string().optional(),sourceFiles:t.array(t.string()).optional(),painPoints:t.array(t.string()).optional(),solutions:t.array(t.string()).optional(),filesAffected:t.array(t.string()).optional(),impactEffort:P.optional(),implementationNotes:t.string().optional(),stack:f.optional(),modules:t.array(A).optional(),roles:t.array(D).optional(),risks:t.array(t.string()).optional(),risksCount:t.number().optional()}),h=t.object({ideas:t.array(O),lastUpdated:t.string()});S();v();function o(n){let e=(()=>{if(!n.tags)return[];try{let i=JSON.parse(n.tags);return Array.isArray(i)?i:[]}catch{return[]}})(),r={...(()=>{if(!n.data)return{};try{return JSON.parse(n.data)}catch{return{}}})(),id:n.id,text:n.text,status:n.status,priority:n.priority,tags:e,addedAt:n.added_at};return n.converted_to!=null&&(r.convertedTo=n.converted_to),n.details!=null&&(r.details=n.details),r}d(o,"rowToIdea");var g=class extends E{static{d(this,"IdeasStorage")}constructor(){super("ideas.json",h)}getDefault(){return{ideas:[],lastUpdated:""}}getEventType(e){return`ideas.${e}d`}async getAll(e){return s.query(e,"SELECT * FROM ideas ORDER BY added_at DESC").map(o)}async getPending(e){return s.query(e,"SELECT * FROM ideas WHERE status = 'pending' ORDER BY added_at DESC").map(o)}async addIdea(e,a,r={}){let i={id:m(),text:a,status:"pending",priority:r.priority||"medium",tags:r.tags||[],addedAt:u()};return s.run(e,`INSERT INTO ideas (id, text, status, priority, tags, added_at, converted_to, details, data)
9
9
  VALUES (?, ?, ?, ?, ?, ?, NULL, NULL, NULL)`,i.id,i.text,i.status,i.priority,i.tags.length?JSON.stringify(i.tags):null,i.addedAt),await this.publishEvent(e,"idea.created",{ideaId:i.id,text:i.text,priority:i.priority}),i}async upsertIdea(e,a){s.run(e,`INSERT INTO ideas (id, text, status, priority, tags, added_at)
10
10
  VALUES (?, ?, ?, ?, NULL, ?)
11
11
  ON CONFLICT(id) DO UPDATE SET