prjct-cli 3.96.0 → 3.98.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 (511) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/bin/prjct.cjs +14 -0
  3. package/dist/bin/core-chunks/agent-3N2MSSGT.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-4SE6GF7R.mjs +7 -0
  8. package/dist/bin/core-chunks/agents-ZPNNCOH7.mjs +10 -0
  9. package/dist/bin/core-chunks/ai-provider-RVXK7D7R.mjs +7 -0
  10. package/dist/bin/core-chunks/analysis-OARMM4AH.mjs +41 -0
  11. package/dist/bin/core-chunks/auth-config-KWLVKHCY.mjs +7 -0
  12. package/dist/bin/core-chunks/auto-flush-XA3V7BJ6.mjs +7 -0
  13. package/dist/bin/core-chunks/auto-updater-PKYQRBGQ.mjs +8 -0
  14. package/dist/bin/core-chunks/bin-commands-FYID6EYI.mjs +21 -0
  15. package/dist/bin/core-chunks/capture-3JJPWIF3.mjs +7 -0
  16. package/dist/bin/core-chunks/capture-gate-G5LGVDME.mjs +7 -0
  17. package/dist/bin/core-chunks/ceremonies-B565WDCA.mjs +19 -0
  18. package/dist/bin/core-chunks/changelog-LPJ4GKB6.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-2FRLIQKX.mjs +10 -0
  23. package/dist/bin/core-chunks/chunk-2I5PUQWY.mjs +7 -0
  24. package/dist/bin/core-chunks/chunk-2JJM3YMW.mjs +44 -0
  25. package/dist/bin/core-chunks/chunk-2NI4EEK2.mjs +8 -0
  26. package/dist/bin/core-chunks/chunk-2TJRTFIS.mjs +9 -0
  27. package/dist/bin/core-chunks/chunk-2VRS5CUH.mjs +9 -0
  28. package/dist/bin/core-chunks/chunk-2VXPFULA.mjs +7 -0
  29. package/dist/bin/core-chunks/chunk-3OWKIRK6.mjs +7 -0
  30. package/dist/bin/core-chunks/chunk-3TRXQAU4.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-5DZ2LTII.mjs +52 -0
  38. package/dist/bin/core-chunks/chunk-5EF5EOCL.mjs +7 -0
  39. package/dist/bin/core-chunks/chunk-5OWPZWEU.mjs +13 -0
  40. package/dist/bin/core-chunks/chunk-5TGZSK4C.mjs +10 -0
  41. package/dist/bin/core-chunks/chunk-5YLI5V3Q.mjs +8 -0
  42. package/dist/bin/core-chunks/chunk-5ZBACKED.mjs +14 -0
  43. package/dist/bin/core-chunks/chunk-623SNKDH.mjs +7 -0
  44. package/dist/bin/core-chunks/chunk-6FUCOGOW.mjs +7 -0
  45. package/dist/bin/core-chunks/chunk-6KNMT46X.mjs +18 -0
  46. package/dist/bin/core-chunks/chunk-6OYLZ4NM.mjs +10 -0
  47. package/dist/bin/core-chunks/chunk-6POAOY5C.mjs +19 -0
  48. package/dist/bin/core-chunks/chunk-6RT2P22O.mjs +7 -0
  49. package/dist/bin/core-chunks/chunk-6U3CYLY5.mjs +7 -0
  50. package/dist/bin/core-chunks/chunk-6U3MV7KZ.mjs +15 -0
  51. package/dist/bin/core-chunks/chunk-6XTLPAPZ.mjs +15 -0
  52. package/dist/bin/core-chunks/chunk-76YMLNLF.mjs +7 -0
  53. package/dist/bin/core-chunks/chunk-7BU6SJBC.mjs +17 -0
  54. package/dist/bin/core-chunks/chunk-7QTE6X4J.mjs +7 -0
  55. package/dist/bin/core-chunks/chunk-7ZHWJSW5.mjs +8 -0
  56. package/dist/bin/core-chunks/chunk-ACIOJQSI.mjs +14 -0
  57. package/dist/bin/core-chunks/chunk-AJXELVNH.mjs +7 -0
  58. package/dist/bin/core-chunks/chunk-ALTQ3KL4.mjs +7 -0
  59. package/dist/bin/core-chunks/chunk-ANBDOI53.mjs +8 -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-B2HY22OD.mjs +50 -0
  63. package/dist/bin/core-chunks/chunk-B7AQHL7B.mjs +7 -0
  64. package/dist/bin/core-chunks/chunk-BSR3XUBD.mjs +24 -0
  65. package/dist/bin/core-chunks/chunk-BTSHD3XJ.mjs +9 -0
  66. package/dist/bin/core-chunks/chunk-BUD3R6LF.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-CA2VFWFP.mjs +21 -0
  70. package/dist/bin/core-chunks/chunk-CB3CNJTL.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-CUIB6CTG.mjs +20 -0
  74. package/dist/bin/core-chunks/chunk-CVKMV22J.mjs +17 -0
  75. package/dist/bin/core-chunks/chunk-CWLGRKA7.mjs +6 -0
  76. package/dist/bin/core-chunks/chunk-CXKDKMYE.mjs +9 -0
  77. package/dist/bin/core-chunks/chunk-CXNVDJNN.mjs +7 -0
  78. package/dist/bin/core-chunks/chunk-D62TAZG6.mjs +9 -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-DOJPSIMG.mjs +7 -0
  83. package/dist/bin/core-chunks/chunk-DTMZBK4E.mjs +7 -0
  84. package/dist/bin/core-chunks/chunk-DW4QMD6J.mjs +10 -0
  85. package/dist/bin/core-chunks/chunk-DZDEBDAB.mjs +10 -0
  86. package/dist/bin/core-chunks/chunk-DZVOFEM5.mjs +7 -0
  87. package/dist/bin/core-chunks/chunk-E5QQDYBR.mjs +7 -0
  88. package/dist/bin/core-chunks/chunk-E73HSXCX.mjs +7 -0
  89. package/dist/bin/core-chunks/chunk-EFSPBB4S.mjs +8 -0
  90. package/dist/bin/core-chunks/chunk-EHVU2SMR.mjs +34 -0
  91. package/dist/bin/core-chunks/chunk-ESB4ALH2.mjs +7 -0
  92. package/dist/bin/core-chunks/chunk-EZRNQXCC.mjs +7 -0
  93. package/dist/bin/core-chunks/chunk-F2FKQUYE.mjs +19 -0
  94. package/dist/bin/core-chunks/chunk-F7OOBAJO.mjs +30 -0
  95. package/dist/bin/core-chunks/chunk-FATYLG3L.mjs +14 -0
  96. package/dist/bin/core-chunks/chunk-FOUBHU4X.mjs +7 -0
  97. package/dist/bin/core-chunks/chunk-FOWTB762.mjs +7 -0
  98. package/dist/bin/core-chunks/chunk-GGGDYL4P.mjs +7 -0
  99. package/dist/bin/core-chunks/chunk-GHSRH4GL.mjs +8 -0
  100. package/dist/bin/core-chunks/chunk-GSNQKBHZ.mjs +11 -0
  101. package/dist/bin/core-chunks/chunk-GTG67Z45.mjs +11 -0
  102. package/dist/bin/core-chunks/chunk-H2KNJUPN.mjs +23 -0
  103. package/dist/bin/core-chunks/chunk-HA7Y76GF.mjs +7 -0
  104. package/dist/bin/core-chunks/chunk-HCPQZRR3.mjs +7 -0
  105. package/dist/bin/core-chunks/chunk-HPCSSJXH.mjs +7 -0
  106. package/dist/bin/core-chunks/chunk-HU5ERAAV.mjs +8 -0
  107. package/dist/bin/core-chunks/chunk-HVXWQ2XZ.mjs +7 -0
  108. package/dist/bin/core-chunks/chunk-HYIT7MF5.mjs +8 -0
  109. package/dist/bin/core-chunks/chunk-HYMJVHAX.mjs +13 -0
  110. package/dist/bin/core-chunks/chunk-ID2C2S33.mjs +18 -0
  111. package/dist/bin/core-chunks/chunk-ID5KE74L.mjs +7 -0
  112. package/dist/bin/core-chunks/chunk-IJNKHQIS.mjs +10 -0
  113. package/dist/bin/core-chunks/chunk-INJ5WT2D.mjs +7 -0
  114. package/dist/bin/core-chunks/chunk-IOFCSTGM.mjs +7 -0
  115. package/dist/bin/core-chunks/chunk-J6Y7IVFQ.mjs +7 -0
  116. package/dist/bin/core-chunks/chunk-JCWA7NLM.mjs +7 -0
  117. package/dist/bin/core-chunks/chunk-JGGQSMZC.mjs +8 -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-KI4OY3UQ.mjs +18 -0
  121. package/dist/bin/core-chunks/chunk-KPR5TWSN.mjs +7 -0
  122. package/dist/bin/core-chunks/chunk-KUQLXY2P.mjs +11 -0
  123. package/dist/bin/core-chunks/chunk-L3DJN3XD.mjs +12 -0
  124. package/dist/bin/core-chunks/chunk-L4TUXFCL.mjs +7 -0
  125. package/dist/bin/core-chunks/chunk-L5LFLI4R.mjs +7 -0
  126. package/dist/bin/core-chunks/chunk-LFOQ7FCR.mjs +10 -0
  127. package/dist/bin/core-chunks/chunk-LGX2GM45.mjs +7 -0
  128. package/dist/bin/core-chunks/chunk-LTKUTRRL.mjs +7 -0
  129. package/dist/bin/core-chunks/chunk-LZILSE5H.mjs +8 -0
  130. package/dist/bin/core-chunks/chunk-MCY7OXED.mjs +10 -0
  131. package/dist/bin/core-chunks/chunk-MG3YN3AI.mjs +7 -0
  132. package/dist/bin/core-chunks/chunk-MPU3VM6Z.mjs +7 -0
  133. package/dist/bin/core-chunks/chunk-MR5XXHRK.mjs +8 -0
  134. package/dist/bin/core-chunks/chunk-MXJF3FA7.mjs +7 -0
  135. package/dist/bin/core-chunks/chunk-MXJKULJY.mjs +9 -0
  136. package/dist/bin/core-chunks/chunk-NINFE7GS.mjs +9 -0
  137. package/dist/bin/core-chunks/chunk-NNILF7R3.mjs +7 -0
  138. package/dist/bin/core-chunks/chunk-NNOX3UU4.mjs +7 -0
  139. package/dist/bin/core-chunks/chunk-NOHSLOLL.mjs +7 -0
  140. package/dist/bin/core-chunks/chunk-NXUIMC22.mjs +13 -0
  141. package/dist/bin/core-chunks/chunk-NZKUCQZK.mjs +8 -0
  142. package/dist/bin/core-chunks/chunk-O5N6XYPU.mjs +8 -0
  143. package/dist/bin/core-chunks/chunk-O5VCBMEK.mjs +25 -0
  144. package/dist/bin/core-chunks/chunk-OE27RFLJ.mjs +8 -0
  145. package/dist/bin/core-chunks/chunk-OGM34Z6W.mjs +8 -0
  146. package/dist/bin/core-chunks/chunk-OIE3AKKO.mjs +7 -0
  147. package/dist/bin/core-chunks/chunk-OXKGN3HG.mjs +7 -0
  148. package/dist/bin/core-chunks/chunk-P2KU4FFA.mjs +11 -0
  149. package/dist/bin/core-chunks/chunk-PIA26GWG.mjs +7 -0
  150. package/dist/bin/core-chunks/chunk-PPSVWUXC.mjs +15 -0
  151. package/dist/bin/core-chunks/chunk-PQTR6XVW.mjs +7 -0
  152. package/dist/bin/core-chunks/chunk-PWL3KS7Y.mjs +7 -0
  153. package/dist/bin/core-chunks/chunk-Q3LUL6LL.mjs +7 -0
  154. package/dist/bin/core-chunks/chunk-Q6C27OL7.mjs +7 -0
  155. package/dist/bin/core-chunks/chunk-Q7GJIU6D.mjs +8 -0
  156. package/dist/bin/core-chunks/chunk-QAIEAOJF.mjs +7 -0
  157. package/dist/bin/core-chunks/chunk-QWRPJARA.mjs +14 -0
  158. package/dist/bin/core-chunks/chunk-QZ7T2EYR.mjs +25 -0
  159. package/dist/bin/core-chunks/chunk-RACISWUV.mjs +10 -0
  160. package/dist/bin/core-chunks/chunk-RCIWCKL7.mjs +9 -0
  161. package/dist/bin/core-chunks/chunk-ROOCBUKH.mjs +8 -0
  162. package/dist/bin/core-chunks/chunk-RP7F67ZT.mjs +7 -0
  163. package/dist/bin/core-chunks/chunk-RXZJB43D.mjs +7 -0
  164. package/dist/bin/core-chunks/chunk-S6FBPXQL.mjs +9 -0
  165. package/dist/bin/core-chunks/chunk-SLYLGDX7.mjs +8 -0
  166. package/dist/bin/core-chunks/chunk-SO3ZPNWT.mjs +7 -0
  167. package/dist/bin/core-chunks/chunk-SRJEX6XF.mjs +12 -0
  168. package/dist/bin/core-chunks/chunk-SROBBOJB.mjs +11 -0
  169. package/dist/bin/core-chunks/chunk-STFUT7R7.mjs +28 -0
  170. package/dist/bin/core-chunks/chunk-SUXIKMTS.mjs +30 -0
  171. package/dist/bin/core-chunks/chunk-TDTPDVUM.mjs +8 -0
  172. package/dist/bin/core-chunks/chunk-TIBYHZFA.mjs +8 -0
  173. package/dist/bin/core-chunks/chunk-TILUQF6L.mjs +8 -0
  174. package/dist/bin/core-chunks/chunk-TOORPP6K.mjs +7 -0
  175. package/dist/bin/core-chunks/chunk-U24YKPYX.mjs +7 -0
  176. package/dist/bin/core-chunks/chunk-U55OPVYR.mjs +9 -0
  177. package/dist/bin/core-chunks/chunk-UAYTDSYG.mjs +64 -0
  178. package/dist/bin/core-chunks/chunk-UHXV7MDW.mjs +12 -0
  179. package/dist/bin/core-chunks/chunk-UNIBFM6J.mjs +13 -0
  180. package/dist/bin/core-chunks/chunk-UNNY2IWZ.mjs +9 -0
  181. package/dist/bin/core-chunks/chunk-UX2ORID4.mjs +9 -0
  182. package/dist/bin/core-chunks/chunk-UYMZ3NAF.mjs +8 -0
  183. package/dist/bin/core-chunks/chunk-V6L5PLD7.mjs +18 -0
  184. package/dist/bin/core-chunks/chunk-V7R3L54M.mjs +7 -0
  185. package/dist/bin/core-chunks/chunk-V7VA4EQX.mjs +7 -0
  186. package/dist/bin/core-chunks/chunk-VCSESVZ4.mjs +9 -0
  187. package/dist/bin/core-chunks/chunk-VCYVYFWE.mjs +9 -0
  188. package/dist/bin/core-chunks/chunk-VJCTTFKP.mjs +8 -0
  189. package/dist/bin/core-chunks/chunk-VRFYDYQY.mjs +7 -0
  190. package/dist/bin/core-chunks/chunk-VWFVSNQT.mjs +7 -0
  191. package/dist/bin/core-chunks/chunk-W23JLJJZ.mjs +109 -0
  192. package/dist/bin/core-chunks/chunk-WCTVZQBG.mjs +8 -0
  193. package/dist/bin/core-chunks/chunk-WTDUJB4I.mjs +8 -0
  194. package/dist/bin/core-chunks/chunk-WZ6W5ZQ5.mjs +7 -0
  195. package/dist/bin/core-chunks/chunk-X433BB6F.mjs +7 -0
  196. package/dist/bin/core-chunks/chunk-XBR63NJA.mjs +7 -0
  197. package/dist/bin/core-chunks/chunk-XC6YAP36.mjs +7 -0
  198. package/dist/bin/core-chunks/chunk-XJTEPHLC.mjs +7 -0
  199. package/dist/bin/core-chunks/chunk-XLAGA5B7.mjs +10 -0
  200. package/dist/bin/core-chunks/chunk-XLFEWZRA.mjs +7 -0
  201. package/dist/bin/core-chunks/chunk-XSZOHNL4.mjs +7 -0
  202. package/dist/bin/core-chunks/chunk-XWLTEAGN.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-YOWW4LHK.mjs +8 -0
  209. package/dist/bin/core-chunks/chunk-YPLFWN62.mjs +7 -0
  210. package/dist/bin/core-chunks/chunk-YQ6HM3YO.mjs +10 -0
  211. package/dist/bin/core-chunks/chunk-YZEO5DZA.mjs +7 -0
  212. package/dist/bin/core-chunks/chunk-ZAUJWUUN.mjs +20 -0
  213. package/dist/bin/core-chunks/chunk-ZBBNCCGV.mjs +12 -0
  214. package/dist/bin/core-chunks/chunk-ZQ2XH76U.mjs +12 -0
  215. package/dist/bin/core-chunks/chunk-ZSANMA7K.mjs +7 -0
  216. package/dist/bin/core-chunks/chunk-ZXTJLMVZ.mjs +7 -0
  217. package/dist/bin/core-chunks/chunk-ZZR3LXCK.mjs +9 -0
  218. package/dist/bin/core-chunks/cleanup-installs-LD43GI4K.mjs +7 -0
  219. package/dist/bin/core-chunks/client-D43KKUYH.mjs +8 -0
  220. package/dist/bin/core-chunks/closest-command-YYNABM7V.mjs +7 -0
  221. package/dist/bin/core-chunks/cloud-RXHFZ7MX.mjs +14 -0
  222. package/dist/bin/core-chunks/code-IYK65A62.mjs +12 -0
  223. package/dist/bin/core-chunks/code-graph-cloud-G3WQBICY.mjs +7 -0
  224. package/dist/bin/core-chunks/codex-hooks-N5UHKK5B.mjs +7 -0
  225. package/dist/bin/core-chunks/codex-mcp-G7WNAT6T.mjs +7 -0
  226. package/dist/bin/core-chunks/codex-skill-IZNP76BJ.mjs +7 -0
  227. package/dist/bin/core-chunks/command-installer-4ENM4GZR.mjs +7 -0
  228. package/dist/bin/core-chunks/config-UVF7YOR6.mjs +8 -0
  229. package/dist/bin/core-chunks/config-manager-QY73WM5U.mjs +7 -0
  230. package/dist/bin/core-chunks/content-bound-stamp-2PJNI4JC.mjs +7 -0
  231. package/dist/bin/core-chunks/context-4GB6ICXK.mjs +38 -0
  232. package/dist/bin/core-chunks/context-MPHOQPXF.mjs +10 -0
  233. package/dist/bin/core-chunks/context-checkpoint-NBI5HKPV.mjs +27 -0
  234. package/dist/bin/core-chunks/context-pressure-5URQVNBC.mjs +7 -0
  235. package/dist/bin/core-chunks/context-tiers-NOKJ75QP.mjs +7 -0
  236. package/dist/bin/core-chunks/context7-service-2MYRUNKY.mjs +7 -0
  237. package/dist/bin/core-chunks/core-WMEHDCOK.mjs +70 -0
  238. package/dist/bin/core-chunks/crew-EYVSIX4L.mjs +24 -0
  239. package/dist/bin/core-chunks/cursor-hooks-DGDJVAI6.mjs +7 -0
  240. package/dist/bin/core-chunks/custom-workflow-storage-EBEIG54R.mjs +7 -0
  241. package/dist/bin/core-chunks/cwd-changed-EUJZOBIC.mjs +7 -0
  242. package/dist/bin/core-chunks/cycle-budget-card-H37XRAIX.mjs +7 -0
  243. package/dist/bin/core-chunks/daemon-QARP3RVX.mjs +13 -0
  244. package/dist/bin/core-chunks/database-UU2ZXSD4.mjs +7 -0
  245. package/dist/bin/core-chunks/delivery-geometry-GSJ6LXUC.mjs +7 -0
  246. package/dist/bin/core-chunks/detect-changes-2YIEX7AY.mjs +7 -0
  247. package/dist/bin/core-chunks/detection-KKDZYWVD.mjs +7 -0
  248. package/dist/bin/core-chunks/developer-evolution-AVAXGDKQ.mjs +11 -0
  249. package/dist/bin/core-chunks/developer-profile-2VSFJGCU.mjs +7 -0
  250. package/dist/bin/core-chunks/discuss-lock-CWXKBBYJ.mjs +7 -0
  251. package/dist/bin/core-chunks/distill-ZF7WHGCZ.mjs +7 -0
  252. package/dist/bin/core-chunks/doctor-heal-XFSVPSEY.mjs +7 -0
  253. package/dist/bin/core-chunks/doctor-service-6ZJBWIXR.mjs +8 -0
  254. package/dist/bin/core-chunks/drift-refresh-XPJAO2B3.mjs +7 -0
  255. package/dist/bin/core-chunks/dynasty-outcomes-KDWIEA4Y.mjs +11 -0
  256. package/dist/bin/core-chunks/editors-config-ELAQA6RV.mjs +7 -0
  257. package/dist/bin/core-chunks/embeddings-354ZYFKX.mjs +7 -0
  258. package/dist/bin/core-chunks/enriched-recall-MKBOXB7M.mjs +7 -0
  259. package/dist/bin/core-chunks/eval-O4YD6YOV.mjs +76 -0
  260. package/dist/bin/core-chunks/exec-34V6SJYO.mjs +7 -0
  261. package/dist/bin/core-chunks/file-helper-LLQKU6YF.mjs +7 -0
  262. package/dist/bin/core-chunks/format-SYVL4CV5.mjs +7 -0
  263. package/dist/bin/core-chunks/gemini-settings-RGD7JLSP.mjs +7 -0
  264. package/dist/bin/core-chunks/git-context-ZSWE3KWM.mjs +8 -0
  265. package/dist/bin/core-chunks/git-helpers-UC53D4FT.mjs +7 -0
  266. package/dist/bin/core-chunks/grok-mcp-IE2RRRRW.mjs +7 -0
  267. package/dist/bin/core-chunks/grok-plugin-SSANHBS7.mjs +7 -0
  268. package/dist/bin/core-chunks/grok-skill-7ZP7R7KO.mjs +7 -0
  269. package/dist/bin/core-chunks/guard-RT7U3LJX.mjs +13 -0
  270. package/dist/bin/core-chunks/guards-AXH6V2IJ.mjs +7 -0
  271. package/dist/bin/core-chunks/handoff-storage-NGUA4Y2L.mjs +7 -0
  272. package/dist/bin/core-chunks/harness-V7J7WIT2.mjs +43 -0
  273. package/dist/bin/core-chunks/health-TNB5OC37.mjs +11 -0
  274. package/dist/bin/core-chunks/help-P7EYELVK.mjs +14 -0
  275. package/dist/bin/core-chunks/hooks-service-REI56DDC.mjs +91 -0
  276. package/dist/bin/core-chunks/infer-memory-file-ATP7PSAQ.mjs +7 -0
  277. package/dist/bin/core-chunks/install-FZQJJWT5.mjs +9 -0
  278. package/dist/bin/core-chunks/judgment-G5KH6QFC.mjs +21 -0
  279. package/dist/bin/core-chunks/judgment-ledger-storage-ZTYXPMM4.mjs +7 -0
  280. package/dist/bin/core-chunks/judgment-orchestrator-E3SO3NVE.mjs +7 -0
  281. package/dist/bin/core-chunks/judgment-receipt-GO6QEZQC.mjs +7 -0
  282. package/dist/bin/core-chunks/kimi-hooks-TR6J3OVG.mjs +7 -0
  283. package/dist/bin/core-chunks/kimi-mcp-ETG7O6O5.mjs +7 -0
  284. package/dist/bin/core-chunks/land-cue-3BUD3KJJ.mjs +8 -0
  285. package/dist/bin/core-chunks/land-rho-MCTQDPRH.mjs +8 -0
  286. package/dist/bin/core-chunks/land-synthesis-MU4EZEYL.mjs +7 -0
  287. package/dist/bin/core-chunks/lean-26BWCUOR.mjs +34 -0
  288. package/dist/bin/core-chunks/legacy-crew-sweep-G5UJT2PM.mjs +23 -0
  289. package/dist/bin/core-chunks/living-context-contract-HZIVBMXX.mjs +7 -0
  290. package/dist/bin/core-chunks/llm-KMVXVBHG.mjs +18 -0
  291. package/dist/bin/core-chunks/mcp-BD5TOTCK.mjs +17 -0
  292. package/dist/bin/core-chunks/memory-dream-6GFV2GXN.mjs +14 -0
  293. package/dist/bin/core-chunks/memory-export-WJ4H7CFV.mjs +13 -0
  294. package/dist/bin/core-chunks/memory-index-7NIU34EI.mjs +7 -0
  295. package/dist/bin/core-chunks/notification-G654IX3O.mjs +7 -0
  296. package/dist/bin/core-chunks/notify-EWYUBKGO.mjs +9 -0
  297. package/dist/bin/core-chunks/nyquist-lite-A23B7G4B.mjs +9 -0
  298. package/dist/bin/core-chunks/one-breath-install-LVNIVN6S.mjs +7 -0
  299. package/dist/bin/core-chunks/opencode-mcp-L7NC77JF.mjs +7 -0
  300. package/dist/bin/core-chunks/output-D27IOQXR.mjs +7 -0
  301. package/dist/bin/core-chunks/pack-integrity-X277OVRB.mjs +9 -0
  302. package/dist/bin/core-chunks/pack-manager-VN7F6R47.mjs +7 -0
  303. package/dist/bin/core-chunks/package-R4FUTGOE.mjs +7 -0
  304. package/dist/bin/core-chunks/package-legitimacy-VHHGI4P7.mjs +7 -0
  305. package/dist/bin/core-chunks/path-manager-E5DCU5LP.mjs +7 -0
  306. package/dist/bin/core-chunks/performance-tracker-BFBNR3LY.mjs +7 -0
  307. package/dist/bin/core-chunks/pi-skill-IZQEUILZ.mjs +7 -0
  308. package/dist/bin/core-chunks/planning-NOWLKZDS.mjs +8 -0
  309. package/dist/bin/core-chunks/post-edit-GTBY32JU.mjs +7 -0
  310. package/dist/bin/core-chunks/pr-convention-37YHTUKM.mjs +7 -0
  311. package/dist/bin/core-chunks/pre-bash-32ZOGNSP.mjs +10 -0
  312. package/dist/bin/core-chunks/pre-commit-7TU2A7H4.mjs +7 -0
  313. package/dist/bin/core-chunks/pre-edit-ASEWA5TS.mjs +8 -0
  314. package/dist/bin/core-chunks/pre-package-ZTZACEBB.mjs +7 -0
  315. package/dist/bin/core-chunks/pre-search-MKDRFJSE.mjs +8 -0
  316. package/dist/bin/core-chunks/pre-secrets-RJELPDFY.mjs +7 -0
  317. package/dist/bin/core-chunks/precision-classifier-AV75OEVA.mjs +7 -0
  318. package/dist/bin/core-chunks/precision-judgment-MCX4MIIG.mjs +7 -0
  319. package/dist/bin/core-chunks/preferences-KO5U2ELK.mjs +31 -0
  320. package/dist/bin/core-chunks/primitives-GNUMBYOK.mjs +13 -0
  321. package/dist/bin/core-chunks/prjct-md-BSFV7OQQ.mjs +7 -0
  322. package/dist/bin/core-chunks/product-GUHSUNIH.mjs +68 -0
  323. package/dist/bin/core-chunks/project-agent-surfaces-BXCJJXB7.mjs +7 -0
  324. package/dist/bin/core-chunks/project-alignment-ADKW3ZWQ.mjs +17 -0
  325. package/dist/bin/core-chunks/project-file-inventory-XIHHJZUP.mjs +7 -0
  326. package/dist/bin/core-chunks/project-memory-L5MDZYST.mjs +7 -0
  327. package/dist/bin/core-chunks/project-style-evolution-HIMSJQQB.mjs +7 -0
  328. package/dist/bin/core-chunks/prompt-47YP5JIR.mjs +25 -0
  329. package/dist/bin/core-chunks/protocol-4AJ4J5SI.mjs +7 -0
  330. package/dist/bin/core-chunks/provider-cache-IWVTFLGT.mjs +7 -0
  331. package/dist/bin/core-chunks/provider-status-HQUBKMH5.mjs +7 -0
  332. package/dist/bin/core-chunks/publish-helper-2T2EHM3V.mjs +7 -0
  333. package/dist/bin/core-chunks/purge-6SJKHKIY.mjs +7 -0
  334. package/dist/bin/core-chunks/queue-storage-BKH5XX2E.mjs +7 -0
  335. package/dist/bin/core-chunks/registry-YM2EYUXY.mjs +7 -0
  336. package/dist/bin/core-chunks/reliability-repair-JMPZWDD4.mjs +20 -0
  337. package/dist/bin/core-chunks/removed-verbs-EU3WPRNK.mjs +7 -0
  338. package/dist/bin/core-chunks/retention-QSXWKE4H.mjs +7 -0
  339. package/dist/bin/core-chunks/retro-B2EBN4TA.mjs +13 -0
  340. package/dist/bin/core-chunks/review-risk-LBPY5M3K.mjs +12 -0
  341. package/dist/bin/core-chunks/run-recorder-EZQ32M55.mjs +7 -0
  342. package/dist/bin/core-chunks/safe-artifacts-PE2TMEZQ.mjs +9 -0
  343. package/dist/bin/core-chunks/sdd-3WNZJ6FU.mjs +9 -0
  344. package/dist/bin/core-chunks/seed-MMDJE2UO.mjs +10 -0
  345. package/dist/bin/core-chunks/self-heal-R5FBXEVQ.mjs +7 -0
  346. package/dist/bin/core-chunks/session-continuity-OQDB5UYI.mjs +10 -0
  347. package/dist/bin/core-chunks/session-start-FM6UL7MT.mjs +7 -0
  348. package/dist/bin/core-chunks/session-tracker-RG2FBWMS.mjs +7 -0
  349. package/dist/bin/core-chunks/settings-installer-4XHM3HAZ.mjs +7 -0
  350. package/dist/bin/core-chunks/setup-BL36ZWPW.mjs +140 -0
  351. package/dist/bin/core-chunks/setup-V75BWRHU.mjs +38 -0
  352. package/dist/bin/core-chunks/shipping-NZVM57JJ.mjs +12 -0
  353. package/dist/bin/core-chunks/signals-digest-P5BG6MZF.mjs +7 -0
  354. package/dist/bin/core-chunks/skill-adherence-JE3N3Y67.mjs +13 -0
  355. package/dist/bin/core-chunks/skill-generator-LKS5BNMY.mjs +7 -0
  356. package/dist/bin/core-chunks/skill-index-L4UWQCQE.mjs +11 -0
  357. package/dist/bin/core-chunks/spec-VC3VTUI3.mjs +27 -0
  358. package/dist/bin/core-chunks/spec-context-inference-KOINWBC7.mjs +9 -0
  359. package/dist/bin/core-chunks/spec-inventory-2TT7BTFZ.mjs +9 -0
  360. package/dist/bin/core-chunks/spec-service-UZ53XL6X.mjs +7 -0
  361. package/dist/bin/core-chunks/spec-task-breakdown-3Y7YXCIQ.mjs +7 -0
  362. package/dist/bin/core-chunks/state-storage-6CGFWW5D.mjs +7 -0
  363. package/dist/bin/core-chunks/stdin-spill-Y2A6WOOW.mjs +7 -0
  364. package/dist/bin/core-chunks/stop-6SH36ULT.mjs +15 -0
  365. package/dist/bin/core-chunks/subagent-start-TVGBV2V2.mjs +7 -0
  366. package/dist/bin/core-chunks/subagent-stop-APWY6KMX.mjs +7 -0
  367. package/dist/bin/core-chunks/surface-attribution-CQVM2SWY.mjs +7 -0
  368. package/dist/bin/core-chunks/symbol-graph-PCS43SHZ.mjs +7 -0
  369. package/dist/bin/core-chunks/sync-analyzer-M37Q4LE4.mjs +7 -0
  370. package/dist/bin/core-chunks/sync-client-6TAOTJWR.mjs +7 -0
  371. package/dist/bin/core-chunks/sync-cursor-storage-GKO4X2QN.mjs +18 -0
  372. package/dist/bin/core-chunks/task-orchestration-GS4J4KGS.mjs +7 -0
  373. package/dist/bin/core-chunks/task-overview-XSMK7YEN.mjs +7 -0
  374. package/dist/bin/core-chunks/task-service-KFYL5NT4.mjs +7 -0
  375. package/dist/bin/core-chunks/tdd-P2PP4RR4.mjs +9 -0
  376. package/dist/bin/core-chunks/team-WKAAOEFE.mjs +42 -0
  377. package/dist/bin/core-chunks/template-loader-H4FE37HV.mjs +7 -0
  378. package/dist/bin/core-chunks/token-backfill-WPXXD5MP.mjs +12 -0
  379. package/dist/bin/core-chunks/token-economics-JZAQJUET.mjs +7 -0
  380. package/dist/bin/core-chunks/transcript-jsonl-OC7TH4Q3.mjs +7 -0
  381. package/dist/bin/core-chunks/trust-boundary-24F662RM.mjs +7 -0
  382. package/dist/bin/core-chunks/uninstall-W6EAUS7N.mjs +13 -0
  383. package/dist/bin/core-chunks/update-PSHEJJI5.mjs +11 -0
  384. package/dist/bin/core-chunks/update-checker-LZCUPWQB.mjs +7 -0
  385. package/dist/bin/core-chunks/usefulness-A3GRKFL3.mjs +7 -0
  386. package/dist/bin/core-chunks/user-home-BODIAXR4.mjs +7 -0
  387. package/dist/bin/core-chunks/vault-retire-notice-FDRT7BJG.mjs +8 -0
  388. package/dist/bin/core-chunks/velocity-storage-5T7RYOWH.mjs +7 -0
  389. package/dist/bin/core-chunks/verb-names-QWGYABFH.mjs +7 -0
  390. package/dist/bin/core-chunks/version-B5DBRVGQ.mjs +7 -0
  391. package/dist/bin/core-chunks/watch-service-7V3O52TW.mjs +9 -0
  392. package/dist/bin/core-chunks/weak-frontier-demo-ZCDTMYRO.mjs +7 -0
  393. package/dist/bin/core-chunks/weak-model-mode-LOAPFJPQ.mjs +7 -0
  394. package/dist/bin/core-chunks/work-graph-WHMCFN6U.mjs +7 -0
  395. package/dist/bin/core-chunks/work-graph-ZNV7S6EU.mjs +16 -0
  396. package/dist/bin/core-chunks/work-scope-XXPUH6TU.mjs +7 -0
  397. package/dist/bin/core-chunks/workflow-XM77QYRF.mjs +61 -0
  398. package/dist/bin/core-chunks/workflows-reference-T7RH7IGJ.mjs +7 -0
  399. package/dist/bin/core-chunks/workspace-occupancy-JUXKZBUZ.mjs +7 -0
  400. package/dist/bin/core-chunks/worktree-service-YRRPFU57.mjs +11 -0
  401. package/dist/bin/core-chunks/world-model-impact-FAGGNUGN.mjs +7 -0
  402. package/dist/bin/hook-chunks/{agent-switch-I4MTVE56.mjs → agent-switch-TAJWH2ZD.mjs} +1 -1
  403. package/dist/bin/hook-chunks/{analysis-VN7APBHR.mjs → analysis-34WDLUXK.mjs} +2 -2
  404. package/dist/bin/hook-chunks/{auto-flush-DX3FVSQE.mjs → auto-flush-7TIEBPPQ.mjs} +1 -1
  405. package/dist/bin/hook-chunks/{capture-gate-MEIQD7ZS.mjs → capture-gate-JFVGG7RB.mjs} +1 -1
  406. package/dist/bin/hook-chunks/{chunk-UVATSTRF.mjs → chunk-22CBVTZ3.mjs} +1 -1
  407. package/dist/bin/hook-chunks/{chunk-MW54MTLB.mjs → chunk-3JOZN7YJ.mjs} +1 -1
  408. package/dist/bin/hook-chunks/{chunk-E7NA34VQ.mjs → chunk-4X3KUIXK.mjs} +1 -1
  409. package/dist/bin/hook-chunks/{chunk-3AHW4XQH.mjs → chunk-5ALQBNIZ.mjs} +1 -1
  410. package/dist/bin/hook-chunks/{chunk-H2DGDAQP.mjs → chunk-5VPZI2ZF.mjs} +1 -1
  411. package/dist/bin/hook-chunks/{chunk-XYKVWO23.mjs → chunk-6EHYPQ5U.mjs} +1 -1
  412. package/dist/bin/hook-chunks/chunk-6NMHVPAI.mjs +35 -0
  413. package/dist/bin/hook-chunks/chunk-7H5UVM6X.mjs +9 -0
  414. package/dist/bin/hook-chunks/{chunk-LR24AIEW.mjs → chunk-A3R47SP6.mjs} +1 -1
  415. package/dist/bin/hook-chunks/chunk-AFGXKRRP.mjs +12 -0
  416. package/dist/bin/hook-chunks/{chunk-64ZEBHDX.mjs → chunk-CGAKJDKT.mjs} +1 -1
  417. package/dist/bin/hook-chunks/{chunk-EI6VQZOX.mjs → chunk-CJY4Y5SO.mjs} +1 -1
  418. package/dist/bin/hook-chunks/chunk-FSFURDAE.mjs +16 -0
  419. package/dist/bin/hook-chunks/{chunk-ZZBNFNMG.mjs → chunk-FTBBQHI4.mjs} +1 -1
  420. package/dist/bin/hook-chunks/chunk-G4VJKPG7.mjs +69 -0
  421. package/dist/bin/hook-chunks/{chunk-7PBWIO4K.mjs → chunk-GAJOSSB4.mjs} +2 -2
  422. package/dist/bin/hook-chunks/{chunk-DB226JIV.mjs → chunk-GER6HFWV.mjs} +1 -1
  423. package/dist/bin/hook-chunks/{chunk-LQLCYBFF.mjs → chunk-H3GIYI4Q.mjs} +2 -2
  424. package/dist/bin/hook-chunks/{chunk-KDNUQPAK.mjs → chunk-HRU2KNEB.mjs} +1 -1
  425. package/dist/bin/hook-chunks/{chunk-33BHU4OM.mjs → chunk-LCGWETJ6.mjs} +1 -1
  426. package/dist/bin/hook-chunks/{chunk-WL6PKX3U.mjs → chunk-MG2DNP4Z.mjs} +1 -1
  427. package/dist/bin/hook-chunks/{chunk-XV2LJVYB.mjs → chunk-MIJZT4ZR.mjs} +1 -1
  428. package/dist/bin/hook-chunks/chunk-NGB6JNSB.mjs +18 -0
  429. package/dist/bin/hook-chunks/{chunk-IJ523YO2.mjs → chunk-OALZUWC6.mjs} +1 -1
  430. package/dist/bin/hook-chunks/{chunk-EGCYDLSO.mjs → chunk-PZMBZ6GE.mjs} +1 -1
  431. package/dist/bin/hook-chunks/{chunk-RT2DFIWF.mjs → chunk-QIB6Y6AH.mjs} +2 -2
  432. package/dist/bin/hook-chunks/{chunk-ZQI4TJ5C.mjs → chunk-QMNZPNVY.mjs} +1 -1
  433. package/dist/bin/hook-chunks/{chunk-YLOK4WRR.mjs → chunk-R4YDE3GU.mjs} +1 -1
  434. package/dist/bin/hook-chunks/{chunk-WJV24WE6.mjs → chunk-RFKRKUHB.mjs} +1 -1
  435. package/dist/bin/hook-chunks/{chunk-SWJ7TLBD.mjs → chunk-RGOTJCZU.mjs} +1 -1
  436. package/dist/bin/hook-chunks/{chunk-FZS3XGEA.mjs → chunk-RLKYEL3F.mjs} +1 -1
  437. package/dist/bin/hook-chunks/{chunk-LF3S3MYE.mjs → chunk-T2KVL6PZ.mjs} +1 -1
  438. package/dist/bin/hook-chunks/{chunk-NLL5AV2G.mjs → chunk-T7DRHVK3.mjs} +2 -2
  439. package/dist/bin/hook-chunks/{chunk-KV4NXLPT.mjs → chunk-TWFLW6OJ.mjs} +1 -1
  440. package/dist/bin/hook-chunks/{chunk-ADYTBOCZ.mjs → chunk-UJIOGFNP.mjs} +1 -1
  441. package/dist/bin/hook-chunks/{chunk-Y3RHBU2R.mjs → chunk-UK24P7PV.mjs} +2 -2
  442. package/dist/bin/hook-chunks/{chunk-OLQAMCYV.mjs → chunk-ULNGKZB6.mjs} +5 -5
  443. package/dist/bin/hook-chunks/{chunk-UMJ5D5I6.mjs → chunk-UWHVPO6X.mjs} +2 -2
  444. package/dist/bin/hook-chunks/{chunk-YHOZTAZH.mjs → chunk-V6GGH6H5.mjs} +1 -1
  445. package/dist/bin/hook-chunks/{chunk-EXVL2OFE.mjs → chunk-XC2BSGWF.mjs} +1 -1
  446. package/dist/bin/hook-chunks/{chunk-JZDZH6IV.mjs → chunk-YATXTHDL.mjs} +1 -1
  447. package/dist/bin/hook-chunks/{chunk-DCHIPMOG.mjs → chunk-ZF2EVMY7.mjs} +1 -1
  448. package/dist/bin/hook-chunks/{chunk-PVCEWFHS.mjs → chunk-ZPAY2NSF.mjs} +2 -2
  449. package/dist/bin/hook-chunks/{codex-skill-6CRFUF3A.mjs → codex-skill-BFRU5FTP.mjs} +1 -1
  450. package/dist/bin/hook-chunks/{command-installer-MUHZWDZA.mjs → command-installer-3XOZGKOQ.mjs} +1 -1
  451. package/dist/bin/hook-chunks/{config-manager-2JJPCLKC.mjs → config-manager-UPB7NEXF.mjs} +1 -1
  452. package/dist/bin/hook-chunks/{context7-service-NH4BMGSJ.mjs → context7-service-7VFXEQVN.mjs} +1 -1
  453. package/dist/bin/hook-chunks/{cwd-changed-UTD6Y4MS.mjs → cwd-changed-USNJYUH7.mjs} +1 -1
  454. package/dist/bin/hook-chunks/{distill-5TNAM3LY.mjs → distill-47YVL7IH.mjs} +1 -1
  455. package/dist/bin/hook-chunks/{enriched-recall-6VOIUNLN.mjs → enriched-recall-CVYI52NO.mjs} +1 -1
  456. package/dist/bin/hook-chunks/{format-IIOFTSBF.mjs → format-DPIN45EG.mjs} +1 -1
  457. package/dist/bin/hook-chunks/{judgment-receipt-QLV3MYFT.mjs → judgment-receipt-G2DKQR7U.mjs} +1 -1
  458. package/dist/bin/hook-chunks/{land-cue-57B23PEL.mjs → land-cue-3JD2TXFP.mjs} +1 -1
  459. package/dist/bin/hook-chunks/{land-synthesis-ZVPFJERV.mjs → land-synthesis-5C4KGCTB.mjs} +1 -1
  460. package/dist/bin/hook-chunks/{legacy-crew-sweep-GR6HRSHX.mjs → legacy-crew-sweep-XQNXNZES.mjs} +2 -2
  461. package/dist/bin/hook-chunks/{memory-index-XE2MWKQS.mjs → memory-index-LL6SQJ2N.mjs} +1 -1
  462. package/dist/bin/hook-chunks/{notification-GU2ZJP5K.mjs → notification-ACQBRJG3.mjs} +1 -1
  463. package/dist/bin/hook-chunks/{pack-integrity-WV5U3AFF.mjs → pack-integrity-DCXVRRJZ.mjs} +1 -1
  464. package/dist/bin/hook-chunks/{pack-manager-QLFQKP24.mjs → pack-manager-KYWKNYUY.mjs} +1 -1
  465. package/dist/bin/hook-chunks/{planning-VPAX5DZL.mjs → planning-KOU3XKWS.mjs} +2 -2
  466. package/dist/bin/hook-chunks/{post-edit-UXCFSR3Y.mjs → post-edit-CK2MYQEN.mjs} +1 -1
  467. package/dist/bin/hook-chunks/{pre-bash-MB4JNNYG.mjs → pre-bash-W5A5CTR3.mjs} +1 -1
  468. package/dist/bin/hook-chunks/{pre-commit-U7TRFKWX.mjs → pre-commit-5Q24RM4S.mjs} +1 -1
  469. package/dist/bin/hook-chunks/{pre-edit-MDCQXI5F.mjs → pre-edit-YIJ4BCYL.mjs} +1 -1
  470. package/dist/bin/hook-chunks/{pre-package-A6ZI5R64.mjs → pre-package-O4RMVA4T.mjs} +1 -1
  471. package/dist/bin/hook-chunks/{pre-search-ZZO3LGXJ.mjs → pre-search-WYOWC3D6.mjs} +1 -1
  472. package/dist/bin/hook-chunks/{prjct-md-MS52YLI2.mjs → prjct-md-2UVHFYTJ.mjs} +1 -1
  473. package/dist/bin/hook-chunks/{project-agent-surfaces-6AIW7KL6.mjs → project-agent-surfaces-BKFYUMRV.mjs} +1 -1
  474. package/dist/bin/hook-chunks/{project-memory-UDH56VFP.mjs → project-memory-OC5GTJPY.mjs} +1 -1
  475. package/dist/bin/hook-chunks/{project-style-evolution-IJXT2MCP.mjs → project-style-evolution-2IFJCACQ.mjs} +1 -1
  476. package/dist/bin/hook-chunks/prompt-JIWMP563.mjs +26 -0
  477. package/dist/bin/hook-chunks/{purge-N2WN6NDB.mjs → purge-FQK3Z4QS.mjs} +1 -1
  478. package/dist/bin/hook-chunks/{retention-RET4P2RO.mjs → retention-2FETBJFG.mjs} +1 -1
  479. package/dist/bin/hook-chunks/{sdd-PB6WKSLE.mjs → sdd-V43TSJ2P.mjs} +1 -1
  480. package/dist/bin/hook-chunks/{session-continuity-BIJXMN44.mjs → session-continuity-RO2ACICF.mjs} +1 -1
  481. package/dist/bin/hook-chunks/{session-start-R2VMKW2L.mjs → session-start-FKKFMKQ5.mjs} +1 -1
  482. package/dist/bin/hook-chunks/{setup-PPIZHVXS.mjs → setup-YV2DKG5L.mjs} +2 -2
  483. package/dist/bin/hook-chunks/{shipping-C637PCOF.mjs → shipping-SCNFEXBY.mjs} +4 -4
  484. package/dist/bin/hook-chunks/{spec-context-inference-RTTDOZZO.mjs → spec-context-inference-BD3ANTXA.mjs} +1 -1
  485. package/dist/bin/hook-chunks/{spec-service-ENLAAMVL.mjs → spec-service-OWYOAGXS.mjs} +2 -2
  486. package/dist/bin/hook-chunks/{spec-task-breakdown-RUDEP3AY.mjs → spec-task-breakdown-HOTLUFDM.mjs} +1 -1
  487. package/dist/bin/hook-chunks/{state-storage-AJUPG7J5.mjs → state-storage-EMWLIFQJ.mjs} +1 -1
  488. package/dist/bin/hook-chunks/{stop-DPXAWJFN.mjs → stop-MIXT7WXA.mjs} +3 -3
  489. package/dist/bin/hook-chunks/{subagent-start-AFHPXL2S.mjs → subagent-start-NO3TN65K.mjs} +1 -1
  490. package/dist/bin/hook-chunks/{subagent-stop-5BMV63ML.mjs → subagent-stop-CKWIXX7W.mjs} +1 -1
  491. package/dist/bin/hook-chunks/{surface-attribution-EGIKCVMF.mjs → surface-attribution-BYESPLXM.mjs} +1 -1
  492. package/dist/bin/hook-chunks/{task-overview-F3GB77OA.mjs → task-overview-P3VRH2FD.mjs} +1 -1
  493. package/dist/bin/hook-chunks/{task-service-FZABHPFV.mjs → task-service-5ONSBKKP.mjs} +1 -1
  494. package/dist/bin/hook-chunks/{tdd-TAMBOPN3.mjs → tdd-SESB4IG3.mjs} +1 -1
  495. package/dist/bin/hook-chunks/{template-loader-MXOMU4XH.mjs → template-loader-KO67FVHO.mjs} +1 -1
  496. package/dist/bin/hook-chunks/{weak-model-mode-BMSPGEQY.mjs → weak-model-mode-HPXBKXJT.mjs} +1 -1
  497. package/dist/bin/hook-chunks/{work-scope-YCS4GTXW.mjs → work-scope-RNPGACPA.mjs} +1 -1
  498. package/dist/bin/hook-chunks/{workspace-occupancy-JOBYNNXV.mjs → workspace-occupancy-3NEAXILW.mjs} +1 -1
  499. package/dist/bin/prjct-core.mjs +9 -3323
  500. package/dist/bin/prjct-hooks.mjs +1 -1
  501. package/dist/bin/prjct.mjs +7 -1
  502. package/dist/daemon/entry.mjs +591 -582
  503. package/dist/mcp/server.mjs +320 -313
  504. package/package.json +4 -2
  505. package/dist/bin/hook-chunks/chunk-3UB6SFRA.mjs +0 -11
  506. package/dist/bin/hook-chunks/chunk-D7DQABWO.mjs +0 -35
  507. package/dist/bin/hook-chunks/chunk-IWUF2LGO.mjs +0 -18
  508. package/dist/bin/hook-chunks/chunk-M4YM7Z3F.mjs +0 -69
  509. package/dist/bin/hook-chunks/chunk-TB57OYGW.mjs +0 -16
  510. package/dist/bin/hook-chunks/chunk-ZYCNW75E.mjs +0 -9
  511. package/dist/bin/hook-chunks/prompt-7VZLYONO.mjs +0 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "3.96.0",
3
+ "version": "3.98.0",
4
4
  "description": "The agentic harness for AI coding agents — work cycles, bounded RAG context, persistent memory, guardrails, and performance evals.",
5
5
  "main": "dist/bin/prjct.mjs",
6
6
  "bin": {
@@ -21,7 +21,8 @@
21
21
  "update": "./scripts/update.sh",
22
22
  "test": "bun test",
23
23
  "test:unit": "bun test --path-ignore-patterns='**/e2e/**'",
24
- "test:fast": "bun test --path-ignore-patterns='**/e2e/**' --dots",
24
+ "test:fast": "bun scripts/test-sharded.ts",
25
+ "test:sharded": "bun scripts/test-sharded.ts",
25
26
  "test:watch": "bun test --watch",
26
27
  "test:coverage": "bun test --coverage",
27
28
  "typecheck": "tsc --noEmit -p core/tsconfig.json",
@@ -39,6 +40,7 @@
39
40
  "test:e2e": "bun test core/__tests__/e2e/",
40
41
  "bench:ab": "bun scripts/bench-ab.ts",
41
42
  "bench:weak-model": "bun scripts/bench-weak-model.ts",
43
+ "bench:token-cost": "bun scripts/bench-token-cost.ts",
42
44
  "demo:weak-vs-frontier": "bun scripts/demo-weak-vs-frontier.ts",
43
45
  "harness:score": "bun bin/prjct.ts harness score --md",
44
46
  "gate:dominance": "bun test core/__tests__/services/weak-model-bench.test.ts core/__tests__/services/weak-frontier-demo.test.ts core/__tests__/services/harness-score.test.ts core/__tests__/services/dynasty-outcomes.test.ts core/__tests__/services/content-bound-stamp.test.ts core/__tests__/services/sot-bind.test.ts core/__tests__/services/trap-surface-slo.test.ts core/__tests__/services/impact-ready.test.ts core/__tests__/services/delivery-geometry.test.ts core/__tests__/services/cycle-budget-card.test.ts core/__tests__/services/land-rho.test.ts core/__tests__/services/one-breath-install.test.ts core/__tests__/services/doctor-heal.test.ts && bun run bench:weak-model && bun run demo:weak-vs-frontier"
@@ -1,11 +0,0 @@
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{b as l,c as i,d as k}from"./chunk-XSJ7SPVR.mjs";import{b as d}from"./chunk-D7DQABWO.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function u(t,n){let r=t===i?i:t.slice(0,6);return{shortId:r,label:`${r} \xB7 ${n??"(detached)"}`}}o(u,"labelFor");async function b(t,n){let r=await k(n),a=[],p=await d.getTaskSnapshot(t),s=p.currentTask;if(s){let{shortId:e,label:c}=u(i,s.branch);a.push({id:s.id,description:s.description,workspaceId:i,shortId:e,label:c,branch:s.branch,linearId:s.linearId,harness:s.harness,startedAt:s.startedAt,isCurrent:r.workspaceId===i,pipeline:l(t,s.id,i)??void 0})}for(let e of p.activeTasks){if(e.workspaceId===i)continue;let{shortId:c,label:h}=u(e.workspaceId,e.branch);a.push({id:e.id,description:e.description,workspaceId:e.workspaceId,shortId:c,label:h,branch:e.branch,linearId:e.linearId,harness:e.harness,startedAt:e.startedAt,isCurrent:r.workspaceId===e.workspaceId,pipeline:l(t,e.id,e.workspaceId)??void 0})}return a.sort((e,c)=>Number(c.isCurrent)-Number(e.isCurrent)),{current:a.find(e=>e.isCurrent)??null,all:a,mainTaskRaw:s}}o(b,"collectActiveTasks");function T(t){let n=t.isCurrent?"\u2192":" ",r=t.isCurrent?" (this worktree)":"";return`${n} ${t.label} ${t.description}${r}`}o(T,"formatActiveTaskLine");function m(t){if(t.all.length===0)return"No active work cycle.";if(t.all.length===1&&t.current){let r=t.current,a=r.pipeline?`
9
- Pipeline: ${r.pipeline.station}`:"";return`Active: ${r.description}
10
- Workspace: ${r.label}${a}`}let n=[`Active work cycles (${t.all.length})`];for(let r of t.all)n.push(T(r));return n.join(`
11
- `)}o(m,"formatActiveTaskList");export{b as a,T as b,m as c};
@@ -1,35 +0,0 @@
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 W,b as R}from"./chunk-OUAS3LZ3.mjs";import{a as I}from"./chunk-ETTDRXQ6.mjs";import{a as _,c as B}from"./chunk-FZS3XGEA.mjs";import{d as x,e as b,g as E}from"./chunk-TKXOMN4K.mjs";import{b as d,h as g}from"./chunk-A6K4H3YT.mjs";import{a as u}from"./chunk-E66B27AL.mjs";g();var f={idle:{transitions:["task"],prompt:"prjct work <intent> Start working",description:"No active work cycle"},working:{transitions:["done","pause"],prompt:"prjct status done Complete work | prjct status paused Switch context",description:"Work in progress"},paused:{transitions:["resume","task","ship"],prompt:"prjct status active Continue | prjct work <new> Start different | prjct ship Ship directly",description:"Task paused"},completed:{transitions:["ship","task","pause","reopen"],prompt:"prjct ship Ship it | prjct work <next> Start next | prjct status active Reopen",description:"Task completed"},shipped:{transitions:["task"],prompt:"prjct work <intent> Start new work cycle",description:"Feature shipped"}},h=class{static{u(this,"WorkflowStateMachine")}getCurrentState(t,s){if(s){let a=(t?.activeTasks??[]).find(n=>n.workspaceId===s);return a?this.statusToState(a):"idle"}let e=t?.currentTask;return e?this.statusToState(e):(t?.pausedTasks?.length||0)>0||t?.previousTask?.status==="paused"?"paused":"idle"}statusToState(t){switch((typeof t.status=="string"?t.status:"").toLowerCase()){case"in_progress":case"working":return"working";case"paused":return"paused";case"completed":case"done":return"completed";case"shipped":return"shipped";default:return"working"}}canTransition(t,s){if(f[t].transitions.includes(s))return{valid:!0};let a=this.formatNextSteps(t).join(" | ");return{valid:!1,error:`Cannot transition to '${s}' from '${t}' state`,suggestion:`Valid next steps: ${a}`}}getNextState(t,s){switch(s){case"task":return"working";case"done":return"completed";case"pause":return"paused";case"resume":return"working";case"ship":return"shipped";case"reopen":return"working";default:return t}}getStateInfo(t){return f[t]}getPrompt(t){return f[t].prompt}getValidCommands(t){return f[t].transitions}formatNextSteps(t){return f[t].transitions.map(e=>{switch(e){case"task":return"prjct work <intent> Start new work cycle";case"done":return"prjct status done Complete current work";case"pause":return"prjct status paused Pause and switch context";case"resume":return"prjct status active Continue paused task";case"ship":return"prjct ship Ship the feature";case"reopen":return"prjct status active Reopen completed task";default:return`prjct ${e}`}})}},S=new h;E();g();async function H(r,t,s){let e={pausedCount:0};if(await r.update(t,n=>{if(!n.currentTask)return n;r.validateTransition(n,"pause"),e.pausedTask={...n.currentTask,status:"paused",pausedAt:d(),pauseReason:s};let i=[e.pausedTask,...r.getPausedTasksFromState(n)].slice(0,r.maxPausedTasks);return e.pausedCount=i.length,{...n,currentTask:null,previousTask:null,pausedTasks:i,lastUpdated:d()}}),!e.pausedTask)return null;let a=e.pausedTask;return await r.publish(t,"task.paused",{taskId:a.id,description:a.description,pausedAt:a.pausedAt,reason:s,pausedCount:e.pausedCount}),a}u(H,"pauseTask");async function O(r,t,s){let e={remainingPaused:0};if(await r.update(t,n=>{let i=r.getPausedTasksFromState(n);if(i.length===0)return n;r.validateTransition(n,"resume");let o=s?i.findIndex(A=>A.id===s):0;if(o===-1)return n;let c=i[o],k=i.filter((A,lt)=>lt!==o),{status:l,pausedAt:T,pauseReason:p,...m}=c;return e.currentTask={...m,startedAt:d(),sessionId:c.sessionId??_()},e.remainingPaused=k.length,{...n,currentTask:e.currentTask,previousTask:null,pausedTasks:k,lastUpdated:d()}}),!e.currentTask)return null;let a=e.currentTask;return await r.publish(t,"task.resumed",{taskId:a.id,description:a.description,resumedAt:a.startedAt,remainingPaused:e.remainingPaused}),a}u(O,"resumeTask");async function D(r,t){let s=await r.read(t),e=r.getPausedTasksFromState(s),a=Date.now()-r.stalenessThresholdDays*24*60*60*1e3;return e.filter(n=>new Date(n.pausedAt).getTime()<a)}u(D,"getStalePausedTasks");async function F(r,t){let s=Date.now()-r.stalenessThresholdDays*24*60*60*1e3,e=[];await r.update(t,n=>{let i=r.getPausedTasksFromState(n),o=i.filter(k=>new Date(k.pausedAt).getTime()<s);if(e.push(o),o.length===0)return n;let c=i.filter(k=>new Date(k.pausedAt).getTime()>=s);return{...n,pausedTasks:c,previousTask:null,lastUpdated:d()}});let a=e[0]??[];if(a.length===0)return[];B.archiveMany(t,a.map(n=>({entityType:"paused_task",entityId:n.id,entityData:n,summary:n.description,reason:"staleness"})));for(let n of a)await r.publish(t,"task.archived",{taskId:n.id,description:n.description,pausedAt:n.pausedAt,reason:"staleness"});return a}u(F,"archiveStalePausedTasks");g();E();var mt=20;function Tt(r){let t=(()=>{if(!r.data)return{};try{return JSON.parse(r.data)}catch{return{}}})(),s={taskId:r.id,title:t.title??r.description,classification:r.type??"improvement",startedAt:r.started_at,completedAt:r.completed_at,subtaskCount:t.subtaskCount??0,subtaskSummaries:t.subtaskSummaries??[],outcome:t.outcome??"Task completed",branchName:r.branch??"unknown"};return r.linear_id!=null&&(s.linearId=r.linear_id),t.linearUuid!=null&&(s.linearUuid=t.linearUuid),r.pr_url!=null&&(s.prUrl=r.pr_url),t.feedback&&(s.feedback=t.feedback),t.harness&&(s.harness=t.harness),r.tokens_in&&(s.tokensIn=r.tokens_in),r.tokens_out&&(s.tokensOut=r.tokens_out),s}u(Tt,"rowToHistoryEntry");function w(r,t="",...s){try{return x.query(r,`SELECT id, description, type, branch, linear_id, pr_url, started_at, completed_at, tokens_in, tokens_out, data
9
- FROM tasks
10
- WHERE status = 'completed' AND completed_at IS NOT NULL ${t}
11
- ORDER BY completed_at DESC, rowid DESC LIMIT ${mt}`,...s).map(Tt)}catch{return[]}}u(w,"queryHistory");async function N(r,t){await r.update(t,()=>({currentTask:null,previousTask:null,pausedTasks:[],activeTasks:[],lastUpdated:d()}))}u(N,"clearTask");async function U(r,t){let s=await r.read(t),e=r.getPausedTasksFromState(s);return s.currentTask!==null||e.length>0}u(U,"hasTask");async function J(r,t){let s=await r.read(t);return r.getPausedTasksFromState(s)[0]||null}u(J,"getPausedTask");async function L(r,t){let s=await r.read(t);return r.getPausedTasksFromState(s)}u(L,"getAllPausedTasks");async function P(r,t){return w(t)}u(P,"getTaskHistory");async function q(r,t){return w(t)[0]||null}u(q,"getMostRecentTask");async function M(r,t,s){return w(t,"AND type = ?",s)}u(M,"getTaskHistoryByType");async function $(r,t){let e=(await P(r,t)).filter(p=>p.feedback),a=[],n=[],i=[],o=[];for(let p of e){let m=p.feedback;Array.isArray(m.stackConfirmed)&&a.push(...m.stackConfirmed),Array.isArray(m.patternsDiscovered)&&n.push(...m.patternsDiscovered),Array.isArray(m.agentAccuracy)&&i.push(...m.agentAccuracy),Array.isArray(m.issuesEncountered)&&o.push(...m.issuesEncountered)}let c=[...new Set(a)],k=[...new Set(n)],l=new Map;for(let p of o)l.set(p,(l.get(p)||0)+1);let T=[...l.entries()].filter(([p,m])=>m>=2).map(([p])=>p);return{stackConfirmed:c,patternsDiscovered:k,agentAccuracy:i,issuesEncountered:[...new Set(o)],knownGotchas:T}}u($,"getAggregatedFeedback");g();var ft=u(r=>r.filter(t=>t.status==="completed").length,"countCompleted"),j=u(r=>r.filter(t=>t.status==="completed"||t.status==="failed"||t.status==="skipped").length,"countResolved");async function y(r,t,s,e){let a={};return await r.update(t,n=>{if(!n.currentTask?.subtasks)return n;let i=n.currentTask.currentSubtaskIndex||0,o=n.currentTask.subtasks[i];if(!o)return n;let c=[...n.currentTask.subtasks];c[i]=s(o);let k=i+1,l=c.length;k<l&&(c[k]={...c[k],status:"in_progress",startedAt:d()});let T=k<l?c[k]:null,p=e?Q(e(c),l):void 0;return a.value={taskId:n.currentTask.id,current:c[i],next:T,...p?{progress:p}:{}},{...n,currentTask:{...n.currentTask,subtasks:c,currentSubtaskIndex:k<l?k:i,...p?{subtaskProgress:p}:{}},lastUpdated:d()}}),a.value??null}u(y,"mutateCurrentSubtask");function Q(r,t){return{completed:r,total:t,percentage:t>0?Math.round(r/t*100):0}}u(Q,"progressFrom");async function V(r,t,s){let e=await r.update(t,i=>{if(!i.currentTask)return i;let o=s.map((c,k)=>({...c,status:k===0?"in_progress":"pending",startedAt:k===0?d():void 0,dependsOn:c.dependsOn||[]}));return{...i,currentTask:{...i.currentTask,subtasks:o,currentSubtaskIndex:0,subtaskProgress:Q(0,o.length)},lastUpdated:d()}}),a=e.currentTask?.id??null,n=e.currentTask?.subtasks??[];a&&await r.publish(t,"subtasks.created",{taskId:a,subtaskCount:n.length,subtasks:n.map(i=>({id:i.id,description:i.description,domain:i.domain}))})}u(V,"createSubtasks");async function G(r,t,s){let e=W.safeParse(s);if(!e.success){let o=e.error.issues.map(c=>`${c.path.join(".")}: ${c.message}`);throw new Error(`Subtask completion requires handoff data:
12
- ${o.join(`
13
- `)}`)}let{output:a,summary:n}=e.data,i=await y(r,t,o=>({...o,status:"completed",completedAt:d(),output:a,summary:n}),ft);return i?(await r.publish(t,"subtask.completed",{taskId:i.taskId,subtaskId:i.current.id,description:i.current.description,output:a,handoff:n.outputForNextAgent,filesChanged:n.filesChanged.length,progress:i.progress}),i.next):null}u(G,"completeSubtask");async function Y(r,t){let s=await r.read(t);if(!s.currentTask?.subtasks)return null;let e=s.currentTask.currentSubtaskIndex||0;return s.currentTask.subtasks[e]||null}u(Y,"getCurrentSubtask");async function K(r,t){let s=await r.read(t);if(!s.currentTask?.subtasks)return null;let e=(s.currentTask.currentSubtaskIndex||0)+1;return s.currentTask.subtasks[e]||null}u(K,"getNextSubtask");async function v(r,t){let s=await r.read(t);if(!s.currentTask?.subtasks)return null;let e=(s.currentTask.currentSubtaskIndex||0)-1;return e<0?null:s.currentTask.subtasks[e]||null}u(v,"getPreviousSubtask");async function z(r,t){let s=await v(r,t);return s?.summary?.outputForNextAgent?{fromSubtask:s.description,outputForNextAgent:s.summary.outputForNextAgent,filesChanged:s.summary.filesChanged,whatWasDone:s.summary.whatWasDone}:null}u(z,"getPreviousHandoff");async function X(r,t){return(await r.read(t)).currentTask?.subtasks||[]}u(X,"getSubtasks");async function Z(r,t){return(await r.read(t)).currentTask?.subtaskProgress||null}u(Z,"getSubtaskProgress");async function tt(r,t){return((await r.read(t)).currentTask?.subtasks?.length||0)>0}u(tt,"hasSubtasks");async function st(r,t){let s=await r.read(t);return s.currentTask?.subtasks?s.currentTask.subtasks.every(e=>e.status==="completed"||e.status==="failed"||e.status==="skipped"):!0}u(st,"areAllSubtasksComplete");async function et(r,t,s){let e=await y(r,t,a=>({...a,status:"failed",completedAt:d(),output:`Failed: ${s}`}),j);return e?(await r.publish(t,"subtask.failed",{taskId:e.taskId,subtaskId:e.current.id,description:e.current.description,error:s}),e.next):null}u(et,"failSubtask");async function rt(r,t,s){let e=await y(r,t,a=>({...a,status:"skipped",completedAt:d(),output:`Skipped: ${s}`,skipReason:s}),j);return e?(await r.publish(t,"subtask.skipped",{taskId:e.taskId,subtaskId:e.current.id,description:e.current.description,reason:s}),e.next):null}u(rt,"skipSubtask");async function at(r,t,s){let e=await y(r,t,a=>({...a,status:"blocked",output:`Blocked: ${s}`,blockReason:s}));return e?(await r.publish(t,"subtask.blocked",{taskId:e.taskId,subtaskId:e.current.id,description:e.current.description,blocker:s}),e.next):null}u(at,"blockSubtask");g();async function nt(r,t,s,e){let a={...s,workspaceId:e,startedAt:d()};return await r.update(t,n=>{if((n.activeTasks||[]).some(i=>i.workspaceId===e))throw new Error("A task is already active in this workspace");return{...n,activeTasks:[...n.activeTasks||[],a],lastUpdated:d()}}),await r.publish(t,"task.started",{taskId:a.id,description:a.description,startedAt:a.startedAt,sessionId:a.sessionId,workspaceId:e}),a}u(nt,"startTaskInWorkspace");async function it(r,t,s){return((await r.read(t)).activeTasks||[]).find(a=>a.workspaceId===s)??null}u(it,"getCurrentTaskForWorkspace");async function ut(r,t,s,e){let n=((await r.read(t)).activeTasks||[]).find(c=>c.workspaceId===s);if(!n)return null;let i=d(),o=[];return await r.update(t,c=>(o.push((c.activeTasks||[]).find(k=>k.workspaceId===s)??n),{...c,activeTasks:(c.activeTasks||[]).filter(k=>k.workspaceId!==s),lastUpdated:i})),r.persistHistoryEntry(t,r.createTaskHistoryEntry(o.at(-1)??n,i,e)),await r.publish(t,"task.completed",{taskId:n.id,description:n.description,startedAt:n.startedAt,completedAt:i,workspaceId:s}),n}u(ut,"completeTaskInWorkspace");async function ot(r,t){return(await r.read(t)).activeTasks||[]}u(ot,"getActiveTasks");async function ct(r,t){return((await r.read(t)).activeTasks||[]).length}u(ct,"getActiveTaskCount");async function kt(r,t,s,e){let n=((await r.read(t)).activeTasks||[]).find(c=>c.workspaceId===s);if(!n)return null;let i=u(c=>{let k={...c};for(let[l,T]of Object.entries(e))T===null?delete k[l]:T!==void 0&&(k[l]=T);return k.workspaceId=s,k},"merge"),o=[];return await r.update(t,c=>({...c,activeTasks:(c.activeTasks||[]).map(k=>{if(k.workspaceId!==s)return k;let l=i(k);return o.push(l),l}),lastUpdated:d()})),o.at(-1)??n}u(kt,"updateWorkspaceTask");async function dt(r,t,s,e,a){let n=await r.read(t);if(a){if(!(n.activeTasks||[]).some(c=>c.workspaceId===a))return null;let o=[];return await r.update(t,c=>({...c,activeTasks:(c.activeTasks||[]).map(k=>{if(k.workspaceId!==a)return k;let l=(k.tokensIn||0)+s,T=(k.tokensOut||0)+e;return o.push({tokensIn:l,tokensOut:T}),{...k,tokensIn:l,tokensOut:T}}),lastUpdated:d()})),o.at(-1)??null}if(!n.currentTask)return null;let i=[];return await r.update(t,o=>{if(!o.currentTask)return o;let c=(o.currentTask.tokensIn||0)+s,k=(o.currentTask.tokensOut||0)+e;return i.push({tokensIn:c,tokensOut:k}),{...o,currentTask:{...o.currentTask,tokensIn:c,tokensOut:k},lastUpdated:d()}}),i.at(-1)??null}u(dt,"addTokens");var C=class extends I{static{u(this,"StateStorage")}constructor(){super("state.json",R)}getDefault(){return{currentTask:null,previousTask:null,pausedTasks:[],taskHistory:[],activeTasks:[],lastUpdated:""}}getEventType(t){return`state.${t}d`}validateTransition(t,s,e){let a=S.getCurrentState(t,e),n=S.canTransition(a,s);if(!n.valid)throw new Error(`${n.error}. ${n.suggestion||""}`.trim())}async getCurrentTask(t){return(await this.read(t)).currentTask}async getTaskSnapshot(t){let s=await this.read(t);return{currentTask:s.currentTask,activeTasks:s.activeTasks||[]}}async bumpTurnCount(t){let s={count:0,task:null};return await this.update(t,e=>{if(!e.currentTask)return e;let a=(e.currentTask.turnCount??0)+1,n={...e.currentTask,turnCount:a};return s.count=a,s.task=n,{...e,currentTask:n}}),s}async acknowledgeTurnLimit(t,s){let e={ok:!1};return await this.update(t,a=>a.currentTask?(e.ok=!0,{...a,currentTask:{...a.currentTask,turnLimitAcknowledgedAt:s}}):a),e.ok}async getPausedTasks(t){let s=await this.read(t);return this.getPausedTasksFromState(s)}async startTask(t,s){let e={};if(await this.update(t,n=>(this.validateTransition(n,"task"),e.currentTask={...s,startedAt:d()},{...n,currentTask:e.currentTask,lastUpdated:d()})),!e.currentTask)throw new Error("Failed to start task");let a=e.currentTask;return this.mirrorTaskRow(t,a,"in_progress"),await this.publishEvent(t,"task.started",{taskId:a.id,description:a.description,startedAt:a.startedAt,sessionId:a.sessionId}),a}mirrorTaskRow(t,s,e,a={}){try{b.run(t,`INSERT INTO tasks (id, description, type, status, branch, linked_spec_id, session_id, feature_id, started_at, completed_at, paused_at, pause_reason)
14
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
15
- ON CONFLICT(id) DO UPDATE SET
16
- description = excluded.description,
17
- status = excluded.status,
18
- branch = COALESCE(excluded.branch, tasks.branch),
19
- linked_spec_id = COALESCE(excluded.linked_spec_id, tasks.linked_spec_id),
20
- completed_at = COALESCE(excluded.completed_at, tasks.completed_at),
21
- paused_at = excluded.paused_at,
22
- pause_reason = excluded.pause_reason`,s.id,s.description,s.type??null,e,s.branch??null,s.linkedSpecId??null,s.sessionId??null,s.featureId??null,s.startedAt??null,a.completedAt??null,a.pausedAt??null,a.pauseReason??null)}catch{}}mirrorHistoryEntry(t,s){try{let e=JSON.stringify({title:s.title,outcome:s.outcome,subtaskCount:s.subtaskCount,subtaskSummaries:s.subtaskSummaries,feedback:s.feedback,harness:s.harness,linearUuid:s.linearUuid});b.run(t,`INSERT INTO tasks (id, description, type, status, branch, linear_id, pr_url, started_at, completed_at, tokens_in, tokens_out, data)
23
- VALUES (?, ?, ?, 'completed', ?, ?, ?, ?, ?, ?, ?, ?)
24
- ON CONFLICT(id) DO UPDATE SET
25
- description = excluded.description,
26
- type = excluded.type,
27
- status = 'completed',
28
- branch = COALESCE(excluded.branch, tasks.branch),
29
- linear_id = COALESCE(excluded.linear_id, tasks.linear_id),
30
- started_at = COALESCE(excluded.started_at, tasks.started_at),
31
- completed_at = excluded.completed_at,
32
- pr_url = COALESCE(excluded.pr_url, tasks.pr_url),
33
- tokens_in = CASE WHEN excluded.tokens_in > 0 THEN excluded.tokens_in ELSE tasks.tokens_in END,
34
- tokens_out = CASE WHEN excluded.tokens_out > 0 THEN excluded.tokens_out ELSE tasks.tokens_out END,
35
- data = excluded.data`,s.taskId,s.title,s.classification,s.branchName==="unknown"?null:s.branchName,s.linearId??null,s.prUrl??null,s.startedAt,s.completedAt,s.tokensIn??0,s.tokensOut??0,e)}catch{}}async updateCurrentTask(t,s){return(await this.update(t,a=>{if(!a.currentTask)return a;let n={...a.currentTask};for(let[o,c]of Object.entries(s))c===null?delete n[o]:c!==void 0&&(n[o]=c);return{...a,currentTask:n,lastUpdated:d()}})).currentTask}async completeTask(t,s){let e=d(),a={};if(await this.update(t,i=>i.currentTask?(this.validateTransition(i,"done"),a.completedTask=i.currentTask,{...i,currentTask:null,previousTask:null,lastUpdated:e}):i),!a.completedTask)return null;let n=a.completedTask;return this.mirrorTaskRow(t,n,"completed",{completedAt:e}),this.mirrorHistoryEntry(t,this.createTaskHistoryEntry(n,e,s)),await this.publishEvent(t,"task.completed",{taskId:n.id,description:n.description,startedAt:n.startedAt,completedAt:e}),n}createTaskHistoryEntry(t,s,e){let a=(t.subtasks||[]).filter(o=>o.status==="completed"&&o.summary).map(o=>o.summary),n=a.length>0?a.map(o=>o.title).join(", "):"Task completed",i={taskId:t.id,title:t.parentDescription||t.description,classification:t.type||"improvement",startedAt:t.startedAt,completedAt:s,subtaskCount:t.subtasks?.length||0,subtaskSummaries:a,outcome:n,branchName:t.branch||"unknown",linearId:t.linearId,linearUuid:t.linearUuid,prUrl:t.prUrl,harness:t.harness};return e&&(i.feedback=e),t.tokensIn&&(i.tokensIn=t.tokensIn),t.tokensOut&&(i.tokensOut=t.tokensOut),i}maxPausedTasks=5;stalenessThresholdDays=30;lifecycleBackend(){return{read:this.read.bind(this),update:this.update.bind(this),publish:this.publishEvent.bind(this),validateTransition:this.validateTransition.bind(this),getPausedTasksFromState:this.getPausedTasksFromState.bind(this),maxPausedTasks:this.maxPausedTasks,stalenessThresholdDays:this.stalenessThresholdDays}}async pauseTask(t,s){let e=await H(this.lifecycleBackend(),t,s);return e&&this.mirrorTaskRow(t,e,"paused",{pausedAt:e.pausedAt,pauseReason:e.pauseReason}),e}async resumeTask(t,s){let e=await O(this.lifecycleBackend(),t,s);return e&&this.mirrorTaskRow(t,e,"in_progress"),e}getPausedTasksFromState(t){return Array.isArray(t.pausedTasks)&&t.pausedTasks.length>0?t.pausedTasks:t.previousTask?[t.previousTask]:[]}async getStalePausedTasks(t){return D(this.lifecycleBackend(),t)}async archiveStalePausedTasks(t){return F(this.lifecycleBackend(),t)}queryBackend(){return{read:this.read.bind(this),update:this.update.bind(this),getPausedTasksFromState:this.getPausedTasksFromState.bind(this)}}async clearTask(t){return N(this.queryBackend(),t)}async hasTask(t){return U(this.queryBackend(),t)}async getPausedTask(t){return J(this.queryBackend(),t)}async getAllPausedTasks(t){return L(this.queryBackend(),t)}async getTaskHistory(t){return P(this.queryBackend(),t)}async getMostRecentTask(t){return q(this.queryBackend(),t)}async getTaskHistoryByType(t,s){return M(this.queryBackend(),t,s)}async getAggregatedFeedback(t){return $(this.queryBackend(),t)}workspaceBackend(){return{read:this.read.bind(this),update:this.update.bind(this),publish:this.publishEvent.bind(this),createTaskHistoryEntry:this.createTaskHistoryEntry.bind(this),persistHistoryEntry:this.mirrorHistoryEntry.bind(this)}}async startTaskInWorkspace(t,s,e){let a=await this.read(t);this.validateTransition(a,"task",e);let n=await nt(this.workspaceBackend(),t,s,e);return this.mirrorTaskRow(t,n,"in_progress"),n}async getCurrentTaskForWorkspace(t,s){return it(this.workspaceBackend(),t,s)}async completeTaskInWorkspace(t,s,e){let a=await ut(this.workspaceBackend(),t,s,e);return a&&this.mirrorTaskRow(t,a,"completed",{completedAt:d()}),a}async getActiveTasks(t){return ot(this.workspaceBackend(),t)}async getActiveTaskCount(t){return ct(this.workspaceBackend(),t)}async updateWorkspaceTask(t,s,e){return kt(this.workspaceBackend(),t,s,e)}async addTokens(t,s,e,a){return dt(this.workspaceBackend(),t,s,e,a)}subtaskBackend(){return{read:this.read.bind(this),update:this.update.bind(this),publish:this.publishEvent.bind(this)}}async createSubtasks(t,s){return V(this.subtaskBackend(),t,s)}async completeSubtask(t,s){return G(this.subtaskBackend(),t,s)}async getCurrentSubtask(t){return Y(this.subtaskBackend(),t)}async getNextSubtask(t){return K(this.subtaskBackend(),t)}async getPreviousSubtask(t){return v(this.subtaskBackend(),t)}async getPreviousHandoff(t){return z(this.subtaskBackend(),t)}async getSubtasks(t){return X(this.subtaskBackend(),t)}async getSubtaskProgress(t){return Z(this.subtaskBackend(),t)}async hasSubtasks(t){return tt(this.subtaskBackend(),t)}async areAllSubtasksComplete(t){return st(this.subtaskBackend(),t)}async failSubtask(t,s){return et(this.subtaskBackend(),t,s)}async skipSubtask(t,s){return rt(this.subtaskBackend(),t,s)}async blockSubtask(t,s){return at(this.subtaskBackend(),t,s)}},Ut=new C;export{S as a,Ut as b};
@@ -1,18 +0,0 @@
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{b as y,c as ne,d as re}from"./chunk-JQE2F2RK.mjs";import{a as N,b as ee}from"./chunk-WUHGODSQ.mjs";import{g as P,o as V}from"./chunk-UH4MD3F3.mjs";import{b as A,p as te}from"./chunk-QWQFF2UG.mjs";import{a as D,e as g,f as I}from"./chunk-BUDZL4DW.mjs";import{a as o,b as O}from"./chunk-E66B27AL.mjs";re();ee();I();import{constants as de}from"node:fs";import d from"node:fs/promises";import j from"node:os";import a from"node:path";ne();import k from"node:fs/promises";import ae from"node:path";I();V();import m from"node:fs";import _ from"node:fs/promises";import M from"node:os";import p from"node:path";var w="mcp-remote@0.1.38";var E="prjct: agentic harness with project memory, workflow gates, intent briefs, and performance context. Use prjct_task_start as the MCP entrypoint for a work cycle; prjct retrieves focused context, persists evidence stations, and keeps humans in the loop for risky gates. Agents resume from prjct_task_status/workflow output, create or link reviewed intent/spec briefs when required, and persist synthesized learning instead of raw transcript fragments.";function se(){let t=oe();if(t)return t;if(process.env.PRJCT_MCP_ALLOW_LOCAL==="1"){let e=ie();if(e)return{command:e,args:["mcp-server"],description:E}}return{command:"npx",args:["-y","prjct-cli@latest","mcp-server"],description:E}}o(se,"getPrjctMcpConfig");function $(t){let e=t.replace(/\\/g,"/");return!!(e.includes("/.worktrees/")||e.includes("/prjct-cli/bin/prjct")&&!e.includes("/node_modules/prjct-cli/"))}o($,"isNonProductionPrjctPath");function oe(){let t=[];try{t.push(p.dirname(O.resolve("prjct-cli/package.json")))}catch{}let e=M.homedir();for(let n of[process.env.NVM_BIN?p.resolve(process.env.NVM_BIN,".."):"",p.join(e,".nvm","versions","node",process.version,"lib"),"/opt/homebrew/lib","/usr/local/lib"].filter(Boolean))t.push(p.join(n,"node_modules","prjct-cli"));for(let n of t){if($(n))continue;let r=p.join(n,"bin","prjct.cjs"),i=m.existsSync(p.join(n,"dist","bin","prjct.mjs"))||m.existsSync(p.join(n,"dist","bin","prjct-core.mjs"));if(!m.existsSync(r)||!i)continue;let c=[process.execPath,p.join(p.dirname(process.execPath),"node"),p.join(n,"..","..","bin","node")].find(x=>x&&m.existsSync(x)),u=p.resolve(n,"..","..","..","bin","node"),f=m.existsSync(u)?u:c??process.execPath;return{command:f,args:[r,"mcp-server"],env:{PATH:`${p.dirname(f)}${p.delimiter}/usr/bin${p.delimiter}/bin`},description:E}}return null}o(oe,"resolvePublishedPrjctMcpConfig");function ie(){let t=process.argv[1],e=[t?p.resolve(p.dirname(t),"prjct"):"",t?p.resolve(p.dirname(t),"..","bin","prjct"):"",p.resolve(process.cwd(),"bin","prjct")].filter(Boolean);for(let n of e){if(!m.existsSync(n))continue;let r=(()=>{try{return m.realpathSync(n)}catch{return n}})();if(!$(r))return r}return null}o(ie,"resolveLocalPrjctBin");var h={context7:{command:"npx",args:["-y","@upstash/context7-mcp@latest"],description:"Library documentation lookup"},prjct:se(),linear:{command:"npx",args:["-y",w,"https://mcp.linear.app/mcp"],description:"Linear MCP server (OAuth)"},jira:{command:"npx",args:["-y",w,"https://mcp.atlassian.com/v1/mcp"],description:"Atlassian MCP server for Jira (OAuth)"}};function S(){return process.env.PRJCT_TEST_MODE==="1"?p.join(M.tmpdir(),"prjct-context7-test","mcp.json"):p.join(M.homedir(),".claude","mcp.json")}o(S,"getClaudeMcpConfigPath");async function L(t=S()){try{let e=await _.readFile(t,"utf-8");return JSON.parse(e)}catch(e){let n=g(e).toLowerCase();if(n.includes("no such file")||n.includes("enoent"))return{};throw new Error(`Failed to read MCP config at ${t}: ${g(e)}`)}}o(L,"readMcpConfig");async function ce(t,e=S()){await P(e,t)}o(ce,"writeMcpConfig");async function Oe(t,e,n=S()){let r=await L(n),i={...r.mcpServers||{}},s=i[t];i[t]=e,r.mcpServers=i;let c=JSON.stringify(s)!==JSON.stringify(e);return await ce(r,n),{path:n,changed:c}}o(Oe,"upsertMcpServer");async function Ne(t,e=S()){return!!(await L(e)).mcpServers?.[t]}o(Ne,"hasMcpServer");function b(t,e,n,r,i){let s=t.indexOf(n),c=t.indexOf(r);if(s!==-1&&c!==-1&&c>s){let u=t.slice(0,s),f=t.slice(c+r.length),x=f.startsWith(`
9
- `)?f.slice(1):f;return{next:u+e+x}}return new RegExp(`^\\s*\\[mcp_servers\\.${i}\\]`,"m").test(t)?{next:t,skipped:"user-managed"}:t.trim().length>0?{next:`${t.trimEnd()}
10
-
11
- ${e}`}:{next:e}}o(b,"upsertMarkedBlock");async function T(t,e,n){return n===e?{path:t,changed:!1}:(await _.mkdir(p.dirname(t),{recursive:!0}),await _.writeFile(t,n,"utf-8"),{path:t,changed:!0})}o(T,"writeConfigIfChanged");var J="# prjct:mcp:start - managed by prjct, do not edit between markers",F="# prjct:mcp:end",B="# prjct:mcp:context7:start - managed by prjct, do not edit between markers",X="# prjct:mcp:context7:end",H=["model-with-reasoning","current-dir","git-branch","context-remaining","five-hour-limit","weekly-limit","task-progress"];function C(){return process.env.PRJCT_TEST_MODE==="1"?ae.join(y(".prjct-tests"),"codex","config.toml"):y(".codex","config.toml")}o(C,"getCodexConfigTomlPath");function v(t){return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}o(v,"tomlString");function K(t,e,n,r){let i=(e.args??[]).map(v).join(", "),s=[n,`[mcp_servers.${t}]`,`command = ${v(e.command)}`,`args = [${i}]`];if(e.env&&Object.keys(e.env).length>0){let c=Object.entries(e.env).map(([u,f])=>`${u} = ${v(f)}`).join(", ");s.push(`env = { ${c} }`)}return s.push(r,""),s.join(`
12
- `)}o(K,"buildMcpTomlBlock");function ue(t=h.prjct){return K("prjct",t,J,F)}o(ue,"buildPrjctMcpTomlBlock");function pe(t=h.context7){return K("context7",t,B,X)}o(pe,"buildContext7McpTomlBlock");function fe(){return["[tui]",`status_line = [${H.map(v).join(", ")}]`,""].join(`
13
- `)}o(fe,"buildCodexStatusLineToml");function le(t){return/^\s*(?:tui\.)?status_line\s*=/m.test(t)}o(le,"hasCodexStatusLine");function me(t){if(le(t))return{toml:t,changed:!1};let n=`status_line = [${H.map(v).join(", ")}]
14
- `,r=/^\s*\[tui\]\s*$/m.exec(t);if(r){let s=r.index+r[0].length,c=t.slice(0,s),u=t.slice(s),f=u.startsWith(`
15
- `)?u.slice(1):u;return{toml:`${c}
16
- ${n}${f}`,changed:!0}}let i=fe();return{toml:t.trim().length>0?`${t.trimEnd()}
17
-
18
- ${i}`:i,changed:!0}}o(me,"ensureCodexStatusLineToml");async function Je(t=C()){let e=await k.readFile(t,"utf-8").catch(()=>""),n=ue(),r=b(e,n,J,F,"prjct"),i=r.skipped,s=me(r.next),c=s.toml,u=await T(t,e,c);return{...u,skipped:i,...u.changed?{statusLineChanged:s.changed}:{}}}o(Je,"ensureCodexMcpServer");async function U(t=C()){let e=await k.readFile(t,"utf-8").catch(()=>""),n=pe(),{next:r,skipped:i}=b(e,n,B,X,"context7");return{...await T(t,e,r),skipped:i}}o(U,"ensureCodexContext7Server");async function q(t=C()){try{let e=await k.readFile(t,"utf-8");return/^\s*\[mcp_servers\.context7\]/m.test(e)}catch{return!1}}o(q,"codexHasContext7Server");te();V();function Q(){return process.env.NODE_ENV==="test"?a.join(j.tmpdir(),"prjct-context7-test","verify-cache.json"):a.join(N(),"state","context7-verify.json")}o(Q,"getVerifyCachePath");async function ge(){try{let t=await d.readFile(Q(),"utf-8"),e=JSON.parse(t);if(typeof e?.at=="number"&&e.status)return{...e,provider:e.provider??"claude"}}catch{}return null}o(ge,"readPersistedVerify");async function he(t,e,n){let r=Q();try{await d.mkdir(a.dirname(r),{recursive:!0}),await d.writeFile(r,JSON.stringify({at:t,provider:e,status:n}),"utf-8")}catch{}}o(he,"writePersistedVerify");var Z=h.context7,l={value:null},ve=[a.dirname(process.execPath),"/opt/homebrew/bin","/usr/local/bin","/opt/local/bin","/usr/bin","/bin"],Ce=[[".bun","bin"],[".local","bin"],[".volta","bin"],[".asdf","shims"],[".local","share","mise","shims"],[".rtx","shims"],[".npm-global","bin"]];async function G(t){try{return(await d.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name)}catch{return[]}}o(G,"listChildDirs");async function xe(t){let e=[],n=process.env.NVM_DIR||a.join(t,".nvm"),r=a.join(n,"versions","node");for(let c of await G(r))e.push(a.join(r,c,"bin"));let i=process.env.FNM_DIR||a.join(t,".local","share","fnm"),s=a.join(i,"node-versions");for(let c of await G(s))e.push(a.join(s,c,"installation","bin"));return e}o(xe,"discoverNodeManagerBinDirs");async function Pe(t=process.env.PATH||"",e=j.homedir()){let n=new Set,r=[],i=Ce.map(c=>a.join(e,...c)),s=[...ve,...i,...process.env.NVM_BIN?[process.env.NVM_BIN]:[],...process.env.VOLTA_HOME?[a.join(process.env.VOLTA_HOME,"bin")]:[],...process.env.ASDF_DIR?[a.join(process.env.ASDF_DIR,"shims")]:[],...process.env.MISE_DATA_DIR?[a.join(process.env.MISE_DATA_DIR,"shims")]:[],...await xe(e)];for(let c of[...t.split(a.delimiter),...s]){let u=c.trim();!u||n.has(u)||(n.add(u),r.push(u))}return r.join(a.delimiter)}o(Pe,"buildContext7SmokePath");async function Se(t,e){if(a.isAbsolute(t)||t.includes(a.sep))return t;let n=process.platform==="win32"?(process.env.PATHEXT||".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean):[""];for(let r of e.split(a.delimiter))if(r)for(let i of n){let s=a.join(r,t+i);try{return await d.access(s,de.X_OK),s}catch{}}return t}o(Se,"resolveExecutable");function Y(){return process.env.PRJCT_CONTEXT7_CONFIG?process.env.PRJCT_CONTEXT7_CONFIG:process.env.NODE_ENV==="test"?a.join(j.tmpdir(),"prjct-context7-test","mcp.json"):a.join(j.homedir(),".claude","mcp.json")}o(Y,"getConfigPath");async function z(t){try{let e=await d.readFile(t,"utf-8");return JSON.parse(e)}catch(e){if(D(e))return{};throw e}}o(z,"readConfig");async function je(){if(process.env.PRJCT_SKIP_CONTEXT7_SMOKE==="1"||process.env.NODE_ENV==="test")return;let t=Z,e=[...t.args||[],"--help"],n=await Pe(),r=await Se(t.command||"npx",n);await A(r,e,{timeout:15e3,env:{...process.env,PATH:n}})}o(je,"runSmokeCheck");var R=class{static{o(this,"Context7Service")}async install(e="claude"){if(e==="codex")return this.installCodex();if(e!=="claude")return{installed:!1,verified:!1,configPath:"",message:`Context7 auto-config not supported for ${e}; skipping`};let n=Y(),r=a.dirname(n);await d.mkdir(r,{recursive:!0});let i=await z(n),s=i.mcpServers||{},c=Z,u=s.context7;return u&&JSON.stringify(u)===JSON.stringify(c)?{installed:!0,verified:!1,configPath:n,message:"Context7 MCP already configured"}:(s.context7=c,i.mcpServers=s,await P(n,i),l.value=null,{installed:!0,verified:!1,configPath:n,message:"Context7 MCP configured"})}async installCodex(){let e=await U();return e.changed&&(l.value=null),{installed:!0,verified:!1,configPath:e.path,message:e.skipped==="user-managed"?"Context7 MCP user-managed in config.toml":"Context7 MCP configured in config.toml"}}async resolveConfigured(e){if(e==="codex"){let c=C();return await q(c)?{ok:!0,configPath:c}:{ok:!1,configPath:c,message:"Context7 MCP not configured in ~/.codex/config.toml"}}if(e!=="claude")return{ok:!1,configPath:"",message:`Context7 not managed for ${e}`};let n=Y(),s=((await z(n)).mcpServers||{}).context7;return!s?.command||!Array.isArray(s.args)||s.args.length===0?{ok:!1,configPath:n,message:"Context7 MCP not configured in ~/.claude/mcp.json"}:{ok:!0,configPath:n}}async verify(e="claude"){let n=Date.now();if(l.value&&l.value.provider===e&&n-l.value.at<864e5)return l.value.status;let r=await ge();if(r?.status.verified&&r.provider===e&&n-r.at<864e5)return l.value=r,r.status;let i=await this.resolveConfigured(e);if(!i.ok)return{installed:!1,verified:!1,configPath:i.configPath,message:i.message};try{await je();let s={installed:!0,verified:!0,configPath:i.configPath};return l.value={at:n,provider:e,status:s},await he(n,e,s),s}catch(s){let c={installed:!0,verified:!1,configPath:i.configPath,message:`Context7 smoke check failed: ${g(s)}`};return l.value={at:n,provider:e,status:c},c}}async ensureReady(e="claude"){await this.install(e);let n=await this.verify(e);if(!n.verified){let r=n.message||"Context7 MCP is required but not ready. Run `prjct start` to repair configuration.";throw new Error(r)}return n}},ye=new R,et=ye;export{h as a,S as b,Oe as c,Ne as d,Je as e,U as f,Q as g,Pe as h,et as i};
@@ -1,69 +0,0 @@
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 ge}from"./chunk-LF3S3MYE.mjs";import{a as Ne}from"./chunk-PPWPUEBH.mjs";import{a as De}from"./chunk-H4CA3XZ6.mjs";import{c as Be}from"./chunk-Y3RHBU2R.mjs";import{a as We,c as Ge,d as X}from"./chunk-XSJ7SPVR.mjs";import{c as fe}from"./chunk-Y7MZA2G4.mjs";import{a as ae}from"./chunk-FEFP6JOL.mjs";import{a as Fe,b as Le}from"./chunk-SJ75V4WG.mjs";import{b as He,c as Me,d as _e}from"./chunk-XYKVWO23.mjs";import{b as Ie}from"./chunk-PVCEWFHS.mjs";import{a as N}from"./chunk-LR24AIEW.mjs";import{c as qe,f as I,h as Oe}from"./chunk-UUULLTQV.mjs";import{b as w}from"./chunk-D7DQABWO.mjs";import{a as L}from"./chunk-FZS3XGEA.mjs";import{b as me}from"./chunk-ZZBNFNMG.mjs";import{e as F,g as Ae}from"./chunk-TKXOMN4K.mjs";import{a as Ce,b as ne,h as pe}from"./chunk-A6K4H3YT.mjs";import{f as de,g as Pe,h as $,j as H,k as Ee,n as Re,o as $e}from"./chunk-UH4MD3F3.mjs";import{a as ue,b as S,e as K,i as re,l as Y,o as je,p as se}from"./chunk-QWQFF2UG.mjs";import{e as R,f as wt}from"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var ie=[{name:"intent",group:"core",surface:"ai-agile",routing:{group:"spec",method:"draft"},routingMode:"cold-only",optionSchema:{strings:["goal","tags"]},description:"Frame the work brief: objective, constraints, risks, and success signal",usage:{claude:'p. intent "<title>"',terminal:'prjct intent "<title>" [--goal "..."] [--tags k:v,...]'},params:'"<title>" [--goal] [--tags]',implemented:!0,hasTemplate:!1,requiresProject:!0,features:["v3 work-cycle replacement for ticket-style planning","Stores the durable brief in SQLite","Sub-verbs mirror spec for compatibility: list, show, update, audit, link-work, ship"]},{name:"work",group:"core",surface:"ai-agile",routing:{group:"workflow",method:"now"},optionSchema:{strings:["spec","geometry"],booleans:["extend"]},description:"Start or inspect a work cycle with context and evidence",usage:{claude:'p. work "<intent>"',terminal:'prjct work "<intent>" [--geometry split|single|direct]'},params:"[intent] [--geometry]",implemented:!0,hasTemplate:!0,requiresProject:!0,features:["v3 name for the execution cycle formerly exposed as task","No arg \u2192 shows the active work cycle","Surfaces related context before planning/editing","Captures harness/evidence expectations for the cycle"]},{name:"init",group:"core",surface:"support",routing:{group:"planning",method:"init"},description:"Deep project analysis and initialization",usage:{claude:'p. init "[idea]"',terminal:'prjct init "[idea]" [--yes] [--pack code,daily]'},params:"[idea] [--yes]",implemented:!0,hasTemplate:!0,requiresProject:!1,requiresLlm:!0,features:["Architect mode for blank projects","Auto tech stack recommendation","Analyzes existing codebases","`--yes` skips wizard (CI / 60s quickstart)"]},{name:"quickstart",group:"core",surface:"support",routing:{group:"planning",method:"quickstart"},optionSchema:{strings:["pack"]},description:"One-shot init + packs + agent surfaces (\u224860s install)",usage:{claude:"p. quickstart",terminal:"prjct quickstart [--pack code,daily]"},params:"[--pack]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Non-interactive init --yes","Default packs + AGENTS/CLAUDE routing","Prints three next verbs for the agent"]},{name:"task",group:"legacy",surface:"legacy",routing:{group:"workflow",method:"now"},optionSchema:{strings:["spec"],booleans:["extend"]},description:"Compatibility alias for `work`",usage:{claude:null,terminal:'prjct task "<description>"'},params:"[description]",implemented:!0,hasTemplate:!0,requiresProject:!0,features:["No arg \u2192 shows the active task (or none)","Deprecated public language: use `prjct work` for the v3 work cycle","Auto-harness classifies H0-H3 and stores expected evidence on the task","Writes to stateStorage; runs before/after workflow rules","Optional Linear issue link when the arg matches `[A-Z]+-\\d+`"]},{name:"ship",group:"core",surface:"ai-agile",routing:{group:"shipping",method:"ship"},optionSchema:{booleans:["skipHooks","noSpecGate","noTestGate","allowNewDeps","forcePressure","noJudgmentGate"],strings:["intent","geometry"]},description:"Commit, push, and celebrate shipped feature",usage:{claude:'p. ship ["feature"]',terminal:'prjct ship ["feature"]'},params:"[feature]",implemented:!0,hasTemplate:!0,requiresProject:!0,requiresLlm:!0,features:["No arg \u2192 ships the active task description, or derives a summary from the branch"]},{name:"sync",group:"core",surface:"ai-agile",routing:{group:"analysis",method:"sync"},description:"Sync project state and update workflow agents",usage:{claude:"p. sync",terminal:"prjct sync [--package=<name>] [--full]"},implemented:!0,hasTemplate:!0,requiresProject:!0,requiresLlm:!0,features:["Incremental sync: only re-analyzes changed files (default)","Force full sync: --full bypasses incremental cache","Monorepo support: --package=<name> for single package sync","Nested PRJCT.md inheritance","Per-package CLAUDE.md generation"]},{name:"eval",group:"optional",surface:"support",routing:{group:"eval",method:"eval"},optionSchema:{booleans:["publish","dryRun","json"],strings:["baseline","candidate","source","target","file"]},description:"Run product evals, compare versions, and publish actionable results",usage:{claude:"p. eval run [--candidate <version>] [--publish]",terminal:"prjct eval <run|compare|report|publish> [--baseline <version>] [--candidate <version>] [--target cloud] [--dry-run]"},params:"[run|compare|report|publish]",implemented:!0,hasTemplate:!1,requiresProject:!1,requiresLlm:!1,features:["Deterministic local eval runs stored under PRJCT_CLI_HOME/evals","Version comparisons with regression/improvement actionables","Cloud publication for shared benchmark history with server-side ownership and subscription checks"]},{name:"status",group:"legacy",surface:"legacy",routing:{group:"primitives",method:"status"},optionSchema:{strings:["tokensIn","tokensOut"]},description:"Compatibility lifecycle escape hatch; prefer `work` outcomes",usage:{claude:null,terminal:"prjct status <value>"},params:"[value]",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["No args \u2192 prints active task + current status","Workflows are the primary status-change mechanism; this is the escape"]},{name:"tag",group:"legacy",surface:"legacy",routing:{group:"primitives",method:"tag"},optionSchema:{},description:"Compatibility metadata escape hatch; prefer synthesized context tags",usage:{claude:null,terminal:"prjct tag type:bug domain:auth"},params:"<pairs...>",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Claude decides what to tag \u2014 no heuristic classifier","type:<feature|bug|improvement|chore> promotes to tasks.type"]},{name:"remember",group:"core",surface:"ai-agile",routing:{group:"primitives",method:"remember"},optionSchema:{strings:["tags"],booleans:["force","global"]},description:"Capture a project memory entry (fact, decision, learning, gotcha, \u2026)",usage:{claude:'p. remember learning "message"',terminal:'prjct remember learning "message" --tags domain:auth'},params:'<type> "<content>" [--tags k:v,...]',implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Types: fact, decision, learning, gotcha, pattern, anti-pattern, shipped, inbox, todo, idea, insight, question, source, person \u2014 plus user-defined","Grows the project memory consumable via `prjct context memory`"]},{name:"forget",group:"core",surface:"ai-agile",routing:{group:"primitives",method:"forget"},optionSchema:{},description:"Delete a project memory entry by id (the delete half of `remember`)",usage:{claude:"p. forget mem_1234",terminal:"prjct forget mem_1234 [--md]"},params:"<id>",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Accepts `mem_1234`, `mem-1234`, or a bare `1234`","Hard-deletes the source event + drops the FTS mirror and any embedding \u2014 cannot resurface lexically or semantically"]},{name:"close",group:"core",surface:"ai-agile",routing:{group:"primitives",method:"close"},optionSchema:{strings:["reason"]},description:"Resolve/close a memory entry (inbox, signal, trap) so it leaves rotation \u2014 soft-delete + closed tag",usage:{claude:'p. close mem_1234 --reason "fixed in PR"',terminal:'prjct close mem_1234 [--reason "..."] [--md]'},params:"<id>",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Soft-removes from recall/FTS/embeddings; records status:closed for audit","Use for resolved inbox/improvement-signals \u2014 prefer over silent forget when the resolution matters"]},{name:"capture",group:"legacy",surface:"legacy",routing:{group:"capture",method:"capture"},optionSchema:{strings:["tags"],booleans:["force","fromCurrent"]},description:"Compatibility inbox fallback; prefer synthesized `remember context`",usage:{claude:null,terminal:'prjct capture "call Ana re pricing" --tags domain:sales'},params:'"<content>" [--tags k:v,...]',implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Writes memory type=inbox; Claude retypes later via a clarify workflow","No task id, no branch, no worktree \u2014 just persists",'Bare `prjct "<text>"` auto-routes to `capture`']},{name:"seed",group:"setup",surface:"support",routing:{group:"seed",method:"seed"},routingMode:"bin-only",optionSchema:{},description:"Manage declarative packs (persona, memory types, workflow slots, hook signals)",usage:{claude:"p. seed list",terminal:"prjct seed add pm,daily"},params:"[add|remove|list|suggest] [pack,pack,...]",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Packs declare signals only \u2014 no bash is written","Add or remove multi-persona contexts per project","Auto-detect suggestion from project stack"]},{name:"mcp",group:"setup",surface:"support",routing:{group:"mcp",method:"mcp"},routingMode:"bin-only",optionSchema:{},description:"Toggle MCP servers per-project \u2014 interactive multi-select in your terminal, list/deny/allow for scripts",usage:{claude:"p. mcp list",terminal:"prjct mcp"},params:"[list|status|deny|allow] [serverName]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Interactive multi-select with live tool-cost delta (default UX in TTY)","Project-local \u2014 writes only to .claude/settings.local.json","Knows the well-known cloud MCPs from claude.ai (PostHog, Atlassian, etc.)","Headless list/deny/allow for LLM agents and scripts (--md flag)"]},{name:"install",group:"setup",surface:"support",routing:{group:"install",method:"install"},routingMode:"bin-only",optionSchema:{},description:"Install universal agent surfaces, Claude hooks, and Codex config",usage:{claude:"p. install",terminal:"prjct install"},params:"",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Inside a prjct project, refreshes AGENTS.md as the portable baseline","Writes Claude passive hooks: SessionStart, UserPromptSubmit, \u2026","Repairs detected Codex config.toml with prjct MCP and TUI status_line","Idempotent; existing non-prjct hooks stay intact","Audit agent support with `prjct agents doctor`"]},{name:"help",group:"setup",surface:"support",routingMode:"bin-only",description:"Contextual help and guidance",usage:{claude:"p. help [topic]",terminal:"prjct help [topic]"},params:"[topic]",implemented:!0,hasTemplate:!0,requiresProject:!1},{name:"analysis-save-llm",group:"optional",surface:"internal",routing:{group:"analysis",method:"saveLlmAnalysis"},description:"Persist analysis notes produced by an LLM run",usage:{claude:null,terminal:"prjct analysis-save-llm <file|text|json>"},params:"<file|text|json>",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0},{name:"analyze",group:"legacy",surface:"legacy",routing:{group:"analysis",method:"analyze"},description:"Compatibility alias for sync analysis",usage:{claude:null,terminal:"prjct analyze"},implemented:!0,hasTemplate:!0,requiresProject:!0,isOptional:!0,requiresLlm:!0},{name:"code",group:"optional",surface:"support",routing:{group:"code",method:"code"},optionSchema:{},description:"Structural code graph: symbols, trace, impact/risk, architecture (run after sync)",usage:{claude:"p. code [symbols|trace|impact|architecture|dead|export|import|push-graph|reindex|cbm]",terminal:"prjct code [symbols|trace|impact|architecture|dead|export|import|push-graph|reindex|cbm]"},params:"[symbols|trace|impact|architecture|dead|export|import|push-graph|reindex|cbm] [args]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Symbol index on sync; 4th work-scope signal; CALLS with enclosing + imports","trace / impact (hunk-level) / architecture / dead one-shots","Per-project cache under ~/.prjct-cli/projects/<id>/ (never in client repo)","push-graph: full Function/Class/File + CALLS/IMPORTS graph \u2192 cloud 3D (no node/link caps)","PreToolUse Grep|Glob augment; ship structural risk cue; optional CBM cli"]},{name:"lean",group:"optional",surface:"support",routing:{group:"lean",method:"lean"},optionSchema:{},description:"Anti-over-engineering: set intensity, review/audit/debt (read-only)",usage:{claude:"p. lean [review|audit|debt|off|lite|full|ultra]",terminal:"prjct lean [sub]"},params:"[review|audit|debt|off|lite|full|ultra]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["No arg \u2192 show active intensity mode + a one-screen summary","review/audit/debt are advisory \u2014 no gate, no source writes","off|lite|full|ultra sets the intensity (mirrors ponytail modes)"]},{name:"tdd",group:"optional",surface:"support",routing:{group:"tdd",method:"tdd"},optionSchema:{},description:"Test-Driven Development: set intensity, run the test command (check)",usage:{claude:"p. tdd [check|off|assist|strict]",terminal:"prjct tdd [sub]"},params:"[check|off|assist|strict]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["No arg \u2192 show mode + the auto-detected test command","off|assist|strict sets the intensity (opt-in, like lean)","check runs the detected test command now (red/green) \u2014 the real gate"]},{name:"judgment",group:"optional",surface:"support",routing:{group:"judgment",method:"judgment"},optionSchema:{booleans:["md"]},description:"Precision judgment v2: evidence tax, DNA, RED/BLUE merge, ghosts, next card, ship gate",usage:{claude:"p. judgment [plan|open|add|merge|challenge|next|approve|\u2026]",terminal:"prjct judgment [sub]"},params:"[plan|open|add|merge|challenge|fix-round|fixed|verify|brief|next|ghosts|approve|escalate|status|clear]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["next \u2192 machine directive card (agent loop never re-derives state)","evidence tax + finding DNA + project ghost FP memory","RED/BLUE dual-blind merge; contradiction auto-escalates","code-strict ship hard-gates on ledger.approved before task complete"]},{name:"sdd",group:"optional",surface:"support",routing:{group:"sdd",method:"sdd"},optionSchema:{},description:"Spec-Driven Development: gate the spec pipeline (off/advisory/strict)",usage:{claude:"p. sdd [off|advisory|strict]",terminal:"prjct sdd [sub]"},params:"[off|advisory|strict]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["No arg \u2192 show mode + the active task spec station (pipeline checklist)","off|advisory|strict sets the intensity (opt-in, like lean)","strict: every task needs a reviewed spec; ship blocks unspecced work"]},{name:"notify",group:"setup",surface:"support",routing:{group:"notify",method:"notify"},optionSchema:{},description:"Desktop notifications (default on): ping on Claude-waiting + subagent-finished",usage:{claude:"p. notify [on|off]",terminal:"prjct notify [on|off]"},params:"[on|off]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Default ON \u2014 pings when Claude is waiting or a subagent finishes","No arg \u2192 show mode + what fires","off silences OS notifications (per-prompt work-state block stays)"]},{name:"agents",group:"setup",surface:"support",routing:{group:"agents",method:"agents"},optionSchema:{booleans:["fix"]},description:"Show the concrete compatibility matrix for AI coding agents (doctor) or harness surface map (surfaces)",usage:{claude:"p. agents [doctor|surfaces|doctor --fix]",terminal:"prjct agents [doctor|surfaces [--detail]|doctor --fix]"},params:"[doctor|status|list|surfaces] [--fix] [--detail]",implemented:!0,hasTemplate:!1,requiresProject:!1,isOptional:!0,features:["Derives support levels from the runtime registry","Reports AGENTS.md, MCP, skills, hooks, ACP, and project-rule support","surfaces: benchmark-tier harness map (hooks/MCP/skills wire status)","doctor --fix refreshes repo-local agent surfaces when run inside a project",'Use this to audit claims like "works with Codex/Gemini/OpenCode/Cursor/Grok"']},{name:"value",group:"legacy",surface:"legacy",routing:{group:"product",method:"value"},optionSchema:{},description:"Compatibility alias for `insights value`",usage:{claude:null,terminal:"prjct value [--md]"},params:"",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Scores project continuity from real SQLite data","Counts durable memory, preventive guardrails, shipped work, sync metrics, and agent coverage","Designed as the paid-tier proof screen for humans and agents"]},{name:"memory-doctor",group:"legacy",surface:"legacy",routing:{group:"product",method:"memoryDoctor"},optionSchema:{},description:"Compatibility alias for `insights quality`",usage:{claude:null,terminal:"prjct memory-doctor [--md]"},params:"",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Finds duplicate groups, stale inbox entries, low-signal memories, and missing types","Read-only by default; recommends exact cleanup actions","Protects recall quality across Claude, Codex, Gemini, OpenCode, and future agents"]},{name:"report",group:"legacy",surface:"legacy",routing:{group:"product",method:"report"},optionSchema:{numbers:["days"]},description:"Compatibility alias for `insights report`",usage:{claude:null,terminal:"prjct report [days] [--md]"},params:"[days]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Summarizes shipped features, completed tasks, active work, and carry-forward lessons","Uses real project state instead of a marketing changelog","Useful for founders, teams, and paid Cloud status emails"]},{name:"handoff",group:"legacy",surface:"legacy",routing:{group:"product",method:"handoff"},optionSchema:{},description:'Static continuation brief for another agent. For realtime ownership transfer use `prjct switch <agent> --reason "\u2026"` + `prjct accept`.',usage:{claude:null,terminal:"prjct handoff codex [--md]"},params:"[agent]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Gives the next agent the active task, required prjct checks, and high-value memories","Works across Codex, Claude, Gemini, Cursor, OpenCode, Qwen, Kimi, Grok, and unknown future agents","For stuck same-branch rescue with ownership transfer: prjct switch / accept (not this alias)"]},{name:"guardrails",group:"legacy",surface:"legacy",routing:{group:"product",method:"guardrails"},optionSchema:{},description:"Compatibility alias for `insights guardrails`",usage:{claude:null,terminal:"prjct guardrails [--md]"},params:"",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Checks changed files against preventive memory","Falls back to general project traps when no file-specific hit exists","Advisory only; no gate, no mutation"]},{name:"insights",group:"optional",surface:"ai-agile",routing:{group:"product",method:"insights"},optionSchema:{numbers:["days"]},description:"Harness intelligence: value, quality, reliability, token cost, reports, continuation, and guardrails",usage:{claude:"p. insights [value|quality|reliability|cost|report|continue|guardrails]",terminal:"prjct insights [value|quality|reliability|cost|report|continue|guardrails] [--md]"},params:"[value|quality|reliability|cost|report|continue|guardrails] [agent|days]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["v3 surface for project intelligence formerly spread across value/report/handoff/memory-doctor/guardrails","Default view summarizes whether the project is compounding","reliability/trust shows whether value, cost, and performance metrics are decision-ready","cost/spend/tokens shows subscription burn, token coverage, context reuse, and capture gaps","Subcommands remain read-only except where underlying compatibility commands already mutate nothing"]},{name:"performance",group:"optional",surface:"ai-agile",routing:{group:"product",method:"performance"},optionSchema:{numbers:["days"]},description:"Measure dev+LLM efficiency per work cycle: time, tokens, model/runtime, tools, friction",usage:{claude:"p. performance [7]",terminal:"prjct performance [days] [--md]"},params:"[days]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Uses real task/session rows and available token columns","Stores unknown when a runtime does not expose exact model/token data","Designed to guide the next work cycle, not to create scrum velocity reports"]},{name:"perf",group:"optional",surface:"ai-agile",routing:{group:"product",method:"perf"},optionSchema:{numbers:["days"]},description:"Report p50/p95 latency for commands and hooks from local telemetry",usage:{claude:"p. perf [7]",terminal:"prjct perf [days] [--md]"},params:"[days]",implemented:!0,hasTemplate:!1,requiresProject:!0,isOptional:!0,features:["Reads existing command_duration samples from SQLite","Groups hook samples under hook:<subcommand>","Reports p50, p95, average, min, max, and sample count"]},{name:"cloud",group:"setup",surface:"support",routing:{group:"cloud",method:"cloud"},optionSchema:{},description:"Cloud sync (paid): connect/disconnect projects, sync/pull, pause/resume, list, status",usage:{claude:"p. cloud [link|unlink|projects|sync|pull|pause|resume|status] [--all|--interactive|--yes]",terminal:"prjct cloud [sub] [--all|--interactive|--yes]"},params:"[link|unlink|projects|sync|pull|pause|resume|status] [--all|--interactive|--yes]",implemented:!0,hasTemplate:!1,requiresProject:!1,isOptional:!0,features:["Local-first: nothing leaves until `prjct connect` / `prjct cloud link`","One project (cwd), one-by-one (--interactive), or all (--all --yes)","Disconnect is soft \u2014 cloud history kept; local vault untouched","Auto-syncs on `prjct ship` and at session end once connected"]},{name:"connect",group:"setup",surface:"support",routing:{group:"cloud",method:"connect"},optionSchema:{},description:"Connect this project to Cloud Sync (alias of `prjct cloud link`)",usage:{claude:"p. connect [--all|--interactive|--yes]",terminal:"prjct connect [--all|--interactive|--yes]"},params:"[--all|--interactive|--yes]",implemented:!0,hasTemplate:!1,requiresProject:!1,isOptional:!0,features:["cwd: connect one repo after `prjct login`","--all --yes: bulk connect (confirm with human first)","--interactive: one-by-one Y/n (TTY)"]},{name:"disconnect",group:"setup",surface:"support",routing:{group:"cloud",method:"disconnect"},optionSchema:{},description:"Disconnect this project from Cloud Sync (alias of `prjct cloud unlink`)",usage:{claude:"p. disconnect [--all|--yes]",terminal:"prjct disconnect [--all|--yes]"},params:"[--all|--yes]",implemented:!0,hasTemplate:!1,requiresProject:!1,isOptional:!0,features:["Soft disconnect \u2014 leaves Cloud list; records kept; local vault untouched","Re-connect with `prjct connect`","--all --yes: bulk disconnect after human confirm"]},{name:"workflow",group:"optional",surface:"support",routing:{group:"workflow",method:"workflow"},optionSchema:{},description:"Configure workflow hooks via natural language",usage:{claude:'p. workflow ["config"]',terminal:'prjct workflow ["config"]'},params:'["natural language config"]',implemented:!0,hasTemplate:!0,requiresProject:!0,isOptional:!0,requiresLlm:!0,features:["Natural language configuration","Before/after hooks for task, done, ship, sync","Permanent, session, or one-time preferences"]},{name:"start",group:"setup",surface:"support",routing:{group:"setup",method:"start"},routingMode:"bin-only",description:"First-time setup (install commands to editors)",usage:{claude:null,terminal:"prjct start"},implemented:!0,hasTemplate:!1,requiresProject:!1},{name:"setup",group:"setup",surface:"support",routing:{group:"setup",method:"setup"},routingMode:"bin-only",description:"Reconfigure editor installations and user-owned defaults",usage:{claude:"p. setup",terminal:"prjct setup"},params:"[--force]",implemented:!0,hasTemplate:!0,requiresProject:!1},{name:"login",group:"setup",surface:"support",routing:{group:"setup",method:"login"},description:"Authenticate with prjct cloud (opens browser)",usage:{claude:null,terminal:"prjct login"},params:"",implemented:!0,hasTemplate:!1,requiresProject:!1,routingMode:"bin-only"},{name:"logout",group:"setup",surface:"support",routing:{group:"setup",method:"logout"},description:"Sign out from prjct cloud",usage:{claude:null,terminal:"prjct logout"},implemented:!0,hasTemplate:!1,requiresProject:!1,routingMode:"bin-only"},{name:"auth",group:"setup",surface:"support",routing:{group:"setup",method:"auth"},description:"Manage cloud authentication",usage:{claude:"p. auth [action]",terminal:"prjct auth [action]"},params:"[logout|status]",implemented:!0,hasTemplate:!1,requiresProject:!1,routingMode:"bin-only"},{name:"context",group:"setup",surface:"support",routing:{group:"context",method:"context"},routingMode:"bin-only",optionSchema:{},description:"Smart context filtering tools for AI agents",usage:{claude:null,terminal:"prjct context <tool> [args]"},params:"<tool> [args]",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["memory|learnings [topic] \u2014 recall project memory (BM25 + semantic + recall)","tiers \u2014 context cache tiers L0\u2013L3 contract + live L0 budget","project \u2014 verified per-project facts preview (stack + real commands)","artifacts \u2014 safe artifact repo (judgment, ships, handoffs, checkpoints)","skills \u2014 refreshed skill catalog index","--md prints the tool markdown rendering; --json forces the JSON envelope"]},{name:"search",group:"core",surface:"ai-agile",routing:{group:"context",method:"search"},optionSchema:{booleans:["global"]},description:"Search project memory (decisions, learnings, gotchas, ships\u2026) \u2014 BM25 + semantic + recall",usage:{claude:'p. search "<query>"',terminal:'prjct search "<query>" [--md]'},params:"<query>",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Blended retrieval: FTS5 BM25 + opt-in semantic + recency recall","Reranks by proven usefulness, expands one hop of the memory graph","`prjct search mem_1234` resolves a specific entry by id"]},{name:"update",group:"setup",surface:"support",routing:{group:"update",method:"update"},routingMode:"bin-only",description:"Update prjct system-wide: package + migrations + daemon restart",usage:{claude:null,terminal:"prjct update [--dry-run]"},params:"[--dry-run]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Phase 1: npm update (migrates homebrew \u2192 npm if needed)","Phase 2: All projects \u2014 migrate, sweep, reinstall commands","Phase 3: Daemon stop + restart with new code","--dry-run to preview without changes"]},{name:"uninstall",group:"setup",surface:"support",routing:{group:"uninstall",method:"uninstall"},routingMode:"bin-only",description:"Complete system removal of prjct",usage:{claude:null,terminal:"prjct uninstall"},params:"[--force|-f] [--backup|-b] [--dry-run|-n] [--keep-package]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Removes ~/.prjct-cli/ data","Cleans CLAUDE.md prjct section","Uninstalls Homebrew/npm packages","Backup option before deletion"]},{name:"team",group:"setup",surface:"support",routing:{group:"team",method:"team"},optionSchema:{booleans:["required","enforce"],strings:["minVersion"]},description:"Enroll this repo in prjct team mode \u2014 commits .prjct/team.json + .claude/CLAUDE.md so teammates pick up shared expectations",usage:{claude:"p. team",terminal:"prjct team [--required] [--min-version <semver>]"},params:"[--required] [--min-version <semver>]",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Writes .prjct/team.json with required/minVersion config","Adds prjct context block to .claude/CLAUDE.md (per-project)","Stages both files for the next commit (does NOT commit)","Teammates clone repo + install prjct \u2192 ready to go"]},{name:"embeddings",group:"setup",surface:"support",routing:{group:"embeddings",method:"embeddings"},optionSchema:{strings:["key","model","baseUrl","authHeader","authScheme","headers","query"]},description:"Configure the GLOBAL semantic-embeddings provider (BYOT) \u2014 one API key, stored securely, used by every project.",usage:{claude:"p. embeddings status",terminal:'prjct embeddings <set|status|test|clear> [--key <K>] [--model <M>] [--base-url <U>] [--auth-header <H>] [--auth-scheme <S|none>] [--headers "k=v,..."] [--query <qs>]'},params:"[set|status|test|clear]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["BYOT: bring your own embedding API key \u2014 ANY OpenAI-compatible provider","Zero-config: paste just --key, the base URL is auto-detected from its prefix","OpenAI, OpenRouter, Ollama, Together, Mistral, Voyage, Jina, LM Studio\u2026",'Non-Bearer providers too: --auth-header api-key --auth-scheme none --query "api-version=..." (Azure OpenAI)',"Key stored in the macOS Keychain (else a 0600 file), never in config","Global \u2014 applies to all projects; per-project config still overrides","Without a key, recall uses the always-on local subword embedder","Validate with: prjct embeddings test"]},{name:"llm",group:"setup",surface:"support",routing:{group:"llm",method:"llm"},optionSchema:{strings:["name","key","model","baseUrl","wire","provider","authHeader","authScheme"],booleans:["weak","all"]},description:"OPT-IN (default OFF): machine-local LLM brain profiles for a future owned agent loop. Does not change guest mode. enable|disable|set|use|status|test|clear.",usage:{claude:"p. llm status",terminal:"prjct llm <enable|disable|set|use|status|test|clear> [--name <n>] [--key <K>] [--model <M>] [--base-url <U>] [--wire openai-compatible|anthropic] [--weak] [--all]"},params:"[enable|disable|set|use|status|test|clear]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Default OFF \u2014 zero impact on guest harnesses until prjct llm enable (or PRJCT_OWNED_LLM=1)","Does not alter embeddings setup gate or existing verbs","Multi-profile brains: Anthropic / OpenAI / xAI / OpenRouter / Ollama / LM Studio","Partial set merges; clear <name> or clear --all (keys wiped, no orphans)","Honest probe + HTTP timeouts","Pairs with prjct agent (print mode) when enabled"]},{name:"agent",group:"setup",surface:"support",routing:{group:"agent",method:"run"},optionSchema:{numbers:["maxSteps"],booleans:["quiet","noWork"]},description:"OPT-IN owned print-mode agent (one-shot). Requires prjct llm enable + brain. Starts a work cycle by default (risks + file map injected). Tools: FS + prjct_search/guard/remember/work. Guest unchanged.",usage:{claude:null,terminal:'prjct agent "<intent>" [--max-steps N] [--no-work] [--quiet] [--md]'},params:'"<intent>"',implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Blocked unless prjct llm enable (or PRJCT_OWNED_LLM=1) and a brain profile is set","Binds to prjct work cycle (startTask) unless --no-work; attaches if one is already open","Print/one-shot only \u2014 no interactive TUI yet","Tools scoped to project root; secret-like paths denied","Does not replace Claude Code / Grok / Codex guest mode"]},{name:"log",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"log"},optionSchema:{strings:["task"]},params:"<note>",description:'Append-only implementation journal on the active work cycle \u2014 "what did the last agent try", the cheapest session-to-session continuity. Surfaced in prjct brief and prime.',usage:{claude:'p. log "tried X, blocked on Y"',terminal:'prjct log "<note>" [--task id]'}},{name:"brief",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"brief"},optionSchema:{},description:"COMPILED context artifact for a task: orchestration directive + journal + related memory + recently-landed conventions + graph position. Persisted, regenerable \u2014 retrieval as a build step.",usage:{claude:"p. brief",terminal:"prjct brief [task-id] [--md]"}},{name:"replan",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"replan"},optionSchema:{},params:"<what-changed>",description:"Cascading drift repair: captures the pivot as a decision memory FIRST, then serves a re-plan directive over the open frontier so downstream items get re-evaluated against reality.",usage:{claude:'p. replan "auth moved to JWT"',terminal:'prjct replan "<what changed>"'}},{name:"plan",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"plan"},optionSchema:{},params:'["title"] | show | write "<md>" | approve | clear',description:"Plan-mode ceremony (read-only until approve): SQLite-backed plan with Context/Approach/Files/Reuse/Verification. Host must not edit source while status is draft.",usage:{claude:'p. plan "Add auth"',terminal:'prjct plan ["title"] | show | write "..." | approve | clear [--md]'},features:["Grok Build plan-mode pattern at the harness layer (no TUI ownership)","draft \u2192 write \u2192 approve; approve persists a decision memory","Single SoT in kv_store work-plan:active"]},{name:"prime",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"prime"},optionSchema:{},description:"Session-open bundle in ONE pull: active cycle + its last journal entries + ready frontier + pull-pointers. The named start-of-session ceremony.",usage:{claude:"p. prime",terminal:"prjct prime [--md]"}},{name:"land",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"land"},optionSchema:{},description:'Session-close checklist ("land the plane"): open cycle, claimed-but-unfinished items, pending sync, hand-off reminder \u2014 everything that must not die with the context.',usage:{claude:"p. land",terminal:"prjct land [--md]"}},{name:"dream",group:"ceremonies",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"ceremonies",method:"dream"},optionSchema:{booleans:["force","dryRun","md"],numbers:["minHours","minSessions"]},description:"Memory auto-dream: consolidate vault (triage inbox + Rho retention) and rebuild the L0 memory index \u2014 Claude Code KAIROS pattern, deterministic (no model call).",usage:{claude:"p. dream --force",terminal:"prjct dream [--force] [--dry-run] [--min-hours=24] [--min-sessions=5] [--md]"},params:"[--force] [--dry-run]",features:["Gates: \u226524h since last dream AND \u22655 lands (session counter) \u2014 bypass with --force","Phases: orient \u2192 gather \u2192 consolidate (triageInbox + applyRetention) \u2192 prune (L0 index)","Land auto-runs when gates open; dry-run previews without writes"]},{name:"ready",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"ready"},optionSchema:{},description:'The ready frontier: open backlog items with zero unresolved blocking dependencies \u2014 "what can I work on NOW" as a structural query, ranked by how much each item unblocks.',usage:{claude:"p. ready",terminal:"prjct ready [--md]"}},{name:"next",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"next"},optionSchema:{},description:'Deterministic "what now": top unclaimed item of the ready frontier, served WITH its orchestration directive (model tier, effort, ceremony, fan-out, points).',usage:{claude:"p. next",terminal:"prjct next [--md]"}},{name:"claim",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"claim"},optionSchema:{strings:["as"]},params:"<id>",description:"Race-free claim of a backlog item for multi-agent fan-out: succeeds only if unclaimed (atomic check-and-set).",usage:{claude:"p. claim <id>",terminal:"prjct claim <id> [--as name]"}},{name:"depend",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"depend"},optionSchema:{strings:["on","type"]},params:"<id>",description:"Add a typed dependency edge between work items: blocks | parent | related | discovered-from. Blocking edges are cycle-checked.",usage:{claude:"p. depend <id> --on <id>",terminal:"prjct depend <id> --on <id> [--type blocks|parent|related|discovered-from]"}},{name:"phases",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"phases"},optionSchema:{},description:"Topological execution phases over the dependency graph: items in the same phase are parallelizable \u2014 a data-driven fan-out plan with per-item orchestration.",usage:{claude:"p. phases",terminal:"prjct phases [--md]"}},{name:"expand",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"expand"},optionSchema:{},params:"<id>",description:"Decomposition loop: read the persisted complexity record + expansion directive for an item, or persist the agent's decomposition as subtasks with parent edges.",usage:{claude:"p. expand <id>",terminal:'prjct expand <id> ["subtask 1" "subtask 2" ...]'}},{name:"switch",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"switch"},optionSchema:{booleans:["launch"],strings:["reason"]},params:"<agent>",description:"Yield the active work cycle to another agent runtime (codex/claude/grok/\u2026) with who started + why \u2014 realtime handoff for stuck multi-terminal work.",usage:{claude:'p. switch codex --reason "\u2026"',terminal:'prjct switch <agent> [--reason "\u2026"] [--launch]'}},{name:"accept",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"accept"},optionSchema:{},params:"[hand_id]",description:"Accept a pending multi-agent handoff: rebind ownership of the live cycle and print the resume brief (who/why/task id).",usage:{claude:"p. accept [hand_id]",terminal:"prjct accept [hand_id] [--md]"}},{name:"handoffs",group:"workGraph",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"workGraph",method:"handoffs"},optionSchema:{},description:"List pending and recent multi-agent handoffs for this project.",usage:{claude:"p. handoffs",terminal:"prjct handoffs [--md]"}},{name:"changelog",group:"changelog",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"changelog",method:"changelog"},optionSchema:{},description:"Release notes from the typed delivery record: what shipped (by version) + completed work cycles in the window. Zero LLM \u2014 pure data-plane render.",usage:{claude:"p. changelog 14",terminal:"prjct changelog [days]"}},{name:"workflows",group:"workflowsReference",surface:"ai-agile",requiresProject:!1,implemented:!0,hasTemplate:!1,routing:{group:"workflowsReference",method:"workflows"},optionSchema:{},description:"Print the quality methodology reference (subagent dispatch, model policy, review/judgment/security workflows) \u2014 the rig-agnostic pull of what Claude reads as workflows.md.",usage:{claude:"p. workflows",terminal:"prjct workflows --md"}},{name:"memory",group:"memoryExport",surface:"ai-agile",requiresProject:!0,implemented:!0,hasTemplate:!1,routing:{group:"memoryExport",method:"memory"},optionSchema:{booleans:["force","dryRun","md"],strings:["reason"]},description:"Memory surface: export|import (git-shareable), index (L0 TOC), close|forget (lifecycle), dream (auto-consolidation).",usage:{claude:"p. memory index",terminal:"prjct memory export|import|index|close <id>|forget <id>|dream [--force] [--dry-run]"},features:["export/import \u2014 git-shareable JSONL under .prjct/memory-export/","index \u2014 rebuild/show L0 compact memory TOC (SessionStart injects it)","close/forget \u2014 lifecycle aliases of top-level verbs","dream \u2014 auto-consolidation + L0 rebuild"]},{name:"guard",group:"core",surface:"ai-agile",routing:{group:"guard",method:"guard"},optionSchema:{numbers:["limit"],strings:["diff"],booleans:["strict"]},description:"Surface preventive memory (gotchas, anti-patterns, recurring-bugs) recorded against a file BEFORE you edit it \u2014 anticipation, provider-agnostic.",usage:{claude:"p. guard <file>",terminal:"prjct guard <file> | prjct guard --diff <range> [--strict]"},params:"[file]",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Pillar 3 (anticipation): see the trap before you step in it","Pull, not push \u2014 also exposed as the prjct_guard MCP tool for Claude + Codex","Strict: only gotchas / anti-patterns / recurring-bugs \u2014 never plain decisions, so no noise",'Quiet by design: "clear to edit" when nothing preventive matches',"Matches absolute or repo-relative paths by exact / suffix / basename"]},{name:"config",group:"setup",surface:"support",routing:{group:"config",method:"config"},optionSchema:{},description:"Read/write global prjct config \u2014 auto-update opt-in, suggestions toggle, etc.",usage:{claude:"p. config list",terminal:"prjct config <list|get|set|unset> [key] [value]"},params:"<list|get|set|unset> [key] [value]",implemented:!0,hasTemplate:!1,requiresProject:!1,features:["Stored at ~/.prjct-cli/config/global.json","Opt into silent auto-update: prjct config set auto-update on","Toggle proactive suggestions: prjct config set suggestions off","Booleans accept on/off/true/false; numbers parsed automatically"]},{name:"spec",group:"legacy",surface:"legacy",routing:{group:"spec",method:"draft"},routingMode:"cold-only",description:"Compatibility alias for `intent` \u2014 Goal/Acceptance/Scope/Risks before work starts.",usage:{claude:null,terminal:'prjct spec "<title>" [--goal "..."] [--tags k:v,...]'},params:'"<title>" [--goal] [--tags]',implemented:!0,hasTemplate:!1,requiresProject:!0,features:['Drafting: `prjct spec "<title>"` IS the create action \u2014 there is no `draft` subverb (aliases `draft`/`new`/`create` are tolerated and stripped)',"Persists in `specs` SQLite table + memory event stream","Sub-verbs: list, show, update, apply-delta, validate, set-status, record-review, link-task, ship, audit, inventory"]},{name:"audit-spec",group:"legacy",surface:"legacy",routing:{group:"spec",method:"audit"},routingMode:"cold-only",description:"Compatibility alias for `intent audit <id>`",usage:{claude:null,terminal:"prjct audit-spec <id>"},params:"<spec-id>",implemented:!0,hasTemplate:!1,requiresProject:!0,features:["Emits dispatch prompt \u2014 Claude runs three Agent calls in parallel","Each reviewer writes back via `prjct spec record-review`","All three pass \u2192 spec auto-promotes draft \u2192 reviewed"]},...[["daemon","Run the prjct daemon in the foreground",void 0,"start [--foreground|-f] | stop | restart | status | logs [--follow|-f] [--lines=N|-n N]"],["stop","Stop the running prjct daemon",void 0,"[--force|-f]"],["restart","Restart the prjct daemon"],["upgrade","Alias of `prjct update`",{group:"update",method:"update"}],["hook","Run a Claude Code hook event (internal; called by the hook scripts)"],["hooks","Inspect or reinstall the Claude Code hooks",void 0,"install | uninstall | status"],["claude","Claude Code integration management (install/uninstall)"],["crew","Run a crew (multi-subagent) workflow"],["harness","Harness scorecard, instruction observability/disposition, and Body/rig adoption (score \xB7 instructions \xB7 learn-from \xB7 list \xB7 use)"],["doctor","Diagnose the local prjct installation",void 0,"[--fix|--heal]"],["watch","Watch project files and react to changes",void 0,"[--verbose|-v] [--debounce=<ms>] [--interval=<sec>]"],["version","Print the installed prjct version + provider status"],["prefs","Inspect or set workflow preferences"],["retro","Summarize what shipped over a time window",void 0,"[window] \u2014 24h, 7d, \u2026"],["health","Codebase health snapshot"],["skill-adherence","Report how well sessions follow the prjct skill"],["review-risk","Risk-ranked review hints for the working tree"],["context-save","Save the current working context for later restore"],["context-restore","Restore a previously saved working context"]].map(([t,e,r,s])=>({name:t,group:"setup",description:e,routing:r,usage:{claude:null,terminal:`prjct ${t}`},...s?{params:s}:{},implemented:!0,hasTemplate:!1,requiresProject:!1,routingMode:"bin-only"}))],yt={"-h":"help","--help":"help","-v":"version","--version":"version"},kt=new Set([...ie.filter(t=>t.routingMode==="bin-only").map(t=>t.name),...Object.entries(yt).filter(([,t])=>ie.some(e=>e.name===t&&e.routingMode==="bin-only")).map(([t])=>t)]);var Ve=new Set(ie.filter(t=>t.routing).map(t=>t.name));Oe();pe();se();Oe();import{execSync as $t}from"node:child_process";import et from"node:fs/promises";import G from"node:path";import T from"chalk";pe();$e();import Ue from"node:path";var St=["CHANGELOG.md","HISTORY.md","NEWS.md","CHANGES.md"],Tt=`# Changelog
9
-
10
- All notable changes to this project will be documented in this file.
11
-
12
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
13
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
14
- `,oe=class{static{o(this,"ChangelogService")}projectPath;constructor(e){this.projectPath=e}async detect(){for(let s of St){let n=Ue.join(this.projectPath,s);if(await Ee(n)){let a=await $(n),i=this.detectFormat(a);return{filePath:n,fileName:s,format:i,created:!1}}}let e="CHANGELOG.md",r=Ue.join(this.projectPath,e);return await H(r,`${Tt}
15
- `),{filePath:r,fileName:e,format:"keepachangelog",created:!0}}async addEntry(e){let r=await this.detect(),s=await $(r.filePath);if(this.hasVersionEntry(s,e.version,r.format))return;let n=e.date||Ce(new Date),a=r.format==="keepachangelog"?this.insertKeepAChangelogEntry(s,e,n):this.insertMarkdownEntry(s,e,n);await H(r.filePath,a)}hasVersionEntry(e,r,s){let n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return(s==="keepachangelog"?new RegExp(`^## \\[${n}\\]`,"m"):new RegExp(`^## ${n}\\b`,"m")).test(e)}async addFeature(e,r){await this.addEntry({version:e,sections:{Added:[r]}})}detectFormat(e){return e.includes("Keep a Changelog")||e.includes("keepachangelog.com")||/^### (?:Added|Changed|Deprecated|Removed|Fixed|Security)\s*$/m.test(e)?"keepachangelog":"markdown"}insertKeepAChangelogEntry(e,r,s){let n=e.split(`
16
- `),a=n.findIndex(c=>/^##\s*\[Unreleased\]\s*$/i.test(c));if(a!==-1){let c=n.slice(a+1).findIndex(x=>/^##\s/.test(x)),p=c===-1?n.length:a+1+c,d=n.slice(a+1,p).join(`
17
- `).trim(),g=this.promoteUnreleasedBody(d,r,s);return`${[...n.slice(0,a),"## [Unreleased]","",g,"",...n.slice(p)].join(`
18
- `).replace(/\n{3,}/g,`
19
-
20
- `).trimEnd()}
21
- `}let i=this.formatKeepAChangelogEntry(r,s),l=e.search(/^## /m);if(l!==-1){let c=e.slice(0,l),p=e.slice(l);return`${c}## [Unreleased]
22
-
23
- ${i}
24
- ${p}`}return`${e.trimEnd()}
25
-
26
- ## [Unreleased]
27
-
28
- ${i}
29
- `}promoteUnreleasedBody(e,r,s){if(!e)return this.formatKeepAChangelogEntry(r,s);let n=`## [${r.version}] - ${s}`,i=(r.sections?.Added??(r.description?[r.description]:[])).filter(p=>!e.includes(p));if(i.length===0)return`${n}
30
-
31
- ${e}`;let l=i.map(p=>`- ${p}`).join(`
32
- `),c=/^###\s+Added\s*$/im.test(e)?e.replace(/^###\s+Added\s*$/im,p=>`${p}
33
- ${l}`):`### Added
34
- ${l}
35
-
36
- ${e}`;return`${n}
37
-
38
- ${c}`}insertMarkdownEntry(e,r,s){let n=this.formatMarkdownEntry(r,s),a=e.indexOf(`
39
- `);if(a!==-1){let i=e.slice(0,a+1),l=e.slice(a+1);return`${i}
40
- ${n}
41
- ${l}`}return`${n}
42
-
43
- ${e}`}formatKeepAChangelogEntry(e,r){let s=[`## [${e.version}] - ${r}`];return s.push(""),e.sections?this.renderSections(s,e.sections):e.description&&(s.push("### Added"),s.push(`- ${e.description}`),s.push("")),s.join(`
44
- `)}renderSections(e,r){for(let[s,n]of Object.entries(r)){e.push(`### ${s}`);for(let a of n)e.push(`- ${a}`);e.push("")}}formatMarkdownEntry(e,r){let s=[`## ${e.version} - ${r}`];return s.push(""),e.sections?this.renderSections(s,e.sections):e.description&&(s.push(`- ${e.description}`),s.push("")),s.join(`
45
- `)}};se();$e();import D from"node:path";var ce=class{static{o(this,"VersionService")}projectPath;constructor(e){this.projectPath=e}async detect(){let e=[()=>this.fromPackageJson(),()=>this.fromCargoToml(),()=>this.fromPyprojectToml(),()=>this.fromCsproj(),()=>this.fromVersionFile("VERSION"),()=>this.fromVersionFile("version.txt"),()=>this.fromGitTag()];for(let r of e){let s=await r();if(s)return s}return this.createFallbackVersion()}async bump(e="patch"){let r=await this.detect();if(r.file){let n=await this.readVersionFromGitHead(r.file,r.format);if(n&&this.isAheadOf(r.current,n))return r.current}let s=Ct(r.current,e);return await this.writeVersion({...r,next:s}),s}async readVersionFromGitHead(e,r){let s=D.relative(this.projectPath,e),n=await K(["show",`HEAD:${s}`],{cwd:this.projectPath});if(!n.ok){if(n.kind==="exit")return null;Y(n)}try{let a=n.stdout;if(r==="json")return JSON.parse(a).version??null;if(r==="plaintext"){let i=a.trim();return he(i)?i:null}return r==="toml"?ze(a)??Je(a):r==="xml"?Ke(a):null}catch{return null}}isAheadOf(e,r){let s=e.split(".").map(a=>Number.parseInt(a,10)||0),n=r.split(".").map(a=>Number.parseInt(a,10)||0);for(let a of[0,1,2]){let i=s[a]??0,l=n[a]??0;if(i>l)return!0;if(i<l)return!1}return!1}async fromPackageJson(){let e=D.join(this.projectPath,"package.json"),r=await de(e,null);return r?.version?{current:r.version,next:W(r.version),file:e,format:"json"}:null}async fromCargoToml(){let e=D.join(this.projectPath,"Cargo.toml"),r=await $(e,"");if(!r)return null;let s=ze(r);return s?{current:s,next:W(s),file:e,format:"toml"}:null}async fromPyprojectToml(){let e=D.join(this.projectPath,"pyproject.toml"),r=await $(e,"");if(!r)return null;let s=Je(r);return s?{current:s,next:W(s),file:e,format:"toml"}:null}async fromCsproj(){let e=await Re(this.projectPath,{extension:".csproj"});if(e.length===0)return null;let r=D.join(this.projectPath,e[0]),s=await $(r,"");if(!s)return null;let n=Ke(s);return n?{current:n,next:W(n),file:r,format:"xml"}:null}async fromVersionFile(e){let r=D.join(this.projectPath,e),s=await $(r,"");if(!s)return null;let n=s.trim();return he(n)?{current:n,next:W(n),file:r,format:"plaintext"}:null}async fromGitTag(){let e=await K(["tag","--sort=-v:refname"],{cwd:this.projectPath});if(!e.ok){if(e.kind==="exit")return null;Y(e)}let r=e.stdout.trim().split(`
46
- `);for(let s of r){let n=s.trim().replace(/^v/,"");if(he(n))return{current:n,next:W(n),file:null,format:"git-tag"}}return null}async createFallbackVersion(){let e=D.join(this.projectPath,"VERSION");return await H(e,`0.1.0
47
- `),{current:"0.1.0",next:"0.1.1",file:e,format:"plaintext"}}async writeVersion(e){if(!e.file){e.format==="git-tag"&&await S("git",["tag",`v${e.next}`],{cwd:this.projectPath});return}switch(e.format){case"json":await this.writeJsonVersion(e.file,e.next);break;case"toml":await this.writeTomlVersion(e.file,e.next);break;case"xml":await this.writeXmlVersion(e.file,e.next);break;case"plaintext":await H(e.file,`${e.next}
48
- `);break}}async writeJsonVersion(e,r){let s=await de(e,{});s&&(s.version=r,await Pe(e,s))}async writeTomlVersion(e,r){let s=await $(e,"");if(!s)return;let n=s.replace(/^(\s*version\s*=\s*")([^"]+)(")/m,`$1${r}$3`);await H(e,n)}async writeXmlVersion(e,r){let s=await $(e,"");if(!s)return;let n=s.replace(/(<Version>)([^<]+)(<\/Version>)/,`$1${r}$3`);await H(e,n)}};function he(t){return/^\d+\.\d+\.\d+/.test(t)}o(he,"isSemver");function W(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return t;let[,r,s,n,a]=e;if(a){let i=a.split("."),l=i.length-1;return/^\d+$/.test(i[l])?(i[l]=String(Number(i[l])+1),`${r}.${s}.${n}-${i.join(".")}`):`${r}.${s}.${n}-${a}.1`}return`${r}.${s}.${Number(n)+1}`}o(W,"bumpPatch");function xt(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);return e?`${e[1]}.${Number(e[2])+1}.0`:t}o(xt,"bumpMinor");function jt(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);return e?`${Number(e[1])+1}.0.0`:t}o(jt,"bumpMajor");function Ct(t,e){return e==="major"?jt(t):e==="minor"?xt(t):W(t)}o(Ct,"bumpVersion");function Ye(t){let e=(t??"").toLowerCase().trim();return e?/^[a-z]+(\([^)]*\))?!:/.test(e)||e.includes("breaking change")?"major":/^(fix|chore|docs|refactor|perf|style|test|build|ci|revert)(\([^)]*\))?:/.test(e)?"patch":"minor":"patch"}o(Ye,"inferBumpLevel");function ze(t){let e=t.match(/\[package\]([\s\S]*?)(?=\n\[|\n*$)/);return e?e[1].match(/^\s*version\s*=\s*"([^"]+)"/m)?.[1]??null:null}o(ze,"parseTomlVersion");function Je(t){let e=t.match(/\[project\]([\s\S]*?)(?=\n\[|\n*$)/);if(e){let s=e[1].match(/^\s*version\s*=\s*"([^"]+)"/m);if(s)return s[1]}let r=t.match(/\[tool\.poetry\]([\s\S]*?)(?=\n\[|\n*$)/);if(r){let s=r[1].match(/^\s*version\s*=\s*"([^"]+)"/m);if(s)return s[1]}return null}o(Je,"parsePyprojectVersion");function Ke(t){return t.match(/<Version>([^<]+)<\/Version>/)?.[1]?.trim()??null}o(Ke,"parseCsprojVersion");Ae();wt();se();Ae();function Xe(t,e,r){try{let s=L();return F.run(t,`INSERT INTO workflow_runs
49
- (id, project_id, command, work_cycle_id, status, iteration, max_iterations, started_at)
50
- VALUES (?, ?, ?, ?, 'running', 0, NULL, ?)`,s,t,e,r??null,Date.now()),s}catch{return null}}o(Xe,"startWorkflowRun");function we(t,e,r,s,n){if(e)try{F.run(t,`INSERT INTO gate_evaluation (id, run_id, rule_id, passed, reason, evaluated_at)
51
- VALUES (?, ?, ?, ?, ?, ?)`,L(),e,String(r),s?1:0,n??null,Date.now())}catch{}}o(we,"recordGateEvaluation");function ye(t,e,r,s,n,a){if(e)try{F.run(t,`INSERT INTO workflow_run_step (id, run_id, rule_id, seq, status, attempt, output, ended_at)
52
- VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,L(),e,String(r),s,n,a??null,Date.now())}catch{}}o(ye,"recordRunStep");function le(t,e,r){if(e)try{F.run(t,"UPDATE workflow_runs SET status = ?, ended_at = ? WHERE id = ?",r,Date.now(),e)}catch{}}o(le,"finishWorkflowRun");function Pt(t){let e=t.split(/\s+/).map(s=>s.trim()).filter(Boolean),r=[];for(let s of e){let n=s.match(/^tags:([a-zA-Z0-9_\-.]+)([=~])(.+)$/);if(n){r.push({kind:"tags",key:n[1],op:n[2],value:n[3]});continue}let a=s.match(/^branch([=~])(.+)$/);if(a){r.push({kind:"branch",op:a[1],value:a[2]});continue}let i=s.match(/^files:(.+)$/);i&&r.push({kind:"files",op:"~",value:i[1]})}return r}o(Pt,"parseWhen");var Qe=new Map;function Et(t){let e=Qe.get(t);if(e)return e;let r=o(a=>{if(a>=t.length)return"";let i=t[a];return i==="*"?t[a+1]==="*"?`.*${r(a+2)}`:`[^/]*${r(a+1)}`:`${/[.+^${}()|[\]\\]/.test(i)?`\\${i}`:i}${r(a+1)}`},"translate"),s=r(0),n=new RegExp(`^${s}$`);return Qe.set(t,n),n}o(Et,"globToRegex");function Rt(t,e){if(t.kind==="tags"){let r=e.tags[t.key??""]??"";return t.op==="="?r===t.value:r.toLowerCase().includes(t.value.toLowerCase())}if(t.kind==="branch")return t.op==="="?e.branch===t.value:e.branch.toLowerCase().includes(t.value.toLowerCase());if(t.kind==="files"){let r=Et(t.value);return e.filesChanged.some(s=>r.test(s))}return!0}o(Rt,"matchCondition");function Ze(t,e){if(!t||!t.trim())return!0;let r=Pt(t);return r.length===0?!0:r.every(s=>Rt(s,e))}o(Ze,"evaluateWhen");var tt="status:",st="script:",nt="mcp:",At="persona:context",rt="version:bump",qt="changelog:add",ve="git:commit",Ot="git:push",Ht="pr:ensure",at="verify:";async function Mt(t,e,r){let s=await w.getCurrentTask(t);if(!s)throw new Error(`Cannot transition to '${r}': no active work cycle`);await N.log(e,I,{taskId:s.id,from:s.type??null,to:r,source:"workflow"})}o(Mt,"runStatusTransition");async function _t(t,e){let{evaluateWorkflowRuleExecutable:r}=await import("./trust-boundary-EX65SUYR.mjs"),s=r(t.trustSource,t.description||t.action);if(!s.allow)throw new Error(s.denyMessage);await ue(t.action,{timeout:t.timeoutMs,cwd:e,env:{...process.env}})}o(_t,"runShellAction");async function Ft(t){let{test:e}=await De(t);return e?.command??null}o(Ft,"detectVerifyCommand");async function Lt(t,e){let{evaluateWorkflowRuleExecutable:r}=await import("./trust-boundary-EX65SUYR.mjs"),s=r(t.trustSource,t.description||t.action);if(!s.allow)throw new Error(s.denyMessage);let n=t.action.slice(at.length).trim();if(!n)throw new Error(`Empty command in verify action '${t.action}'`);let a=n==="auto"?await Ft(e).then(i=>{if(!i)throw new Error("verify:auto found no test script (package.json `scripts.test`). Specify an explicit check, e.g. `verify:bun test` or `verify:npm run typecheck`.");return i}):n;try{await ue(a,{timeout:t.timeoutMs,cwd:e,env:{...process.env}})}catch(i){throw new Error(`Verification failed: \`${a}\`
53
- ${R(i)}
54
- Stop-the-line: do not proceed. Fix the failure and re-run this check \u2014 unverified output must not advance.`)}}o(Lt,"runVerifyAction");async function It(t,e,r){let{evaluateWorkflowRuleExecutable:s}=await import("./trust-boundary-EX65SUYR.mjs"),n=s(t.trustSource,t.description||t.action);if(!n.allow)throw new Error(n.denyMessage);let a=t.action.slice(st.length).trim();if(!a)throw new Error(`Empty script path in action '${t.action}'`);if(G.isAbsolute(a)||a.includes("\0"))throw new Error(`Script path escapes workflows dir: ${a}`);let i=G.resolve(e,".prjct/workflows"),l=G.resolve(i,a),c=G.relative(i,l);if(c.startsWith("..")||G.isAbsolute(c))throw new Error(`Script path escapes workflows dir: ${a}`);let p=await et.realpath(l).catch(()=>{throw new Error(`Script not found: .prjct/workflows/${a}`)}),d=await et.realpath(i).catch(()=>i),g=G.relative(d,p);if(g.startsWith("..")||G.isAbsolute(g))throw new Error(`Script path escapes workflows dir: ${a}`);await S("bash",[p],{timeout:t.timeoutMs,cwd:e,env:{...process.env,PRJCT_BRANCH:r.branch,PRJCT_FILES_CHANGED:r.filesChanged.join(","),PRJCT_TAGS:Object.entries(r.tags).map(([y,x])=>`${y}=${x}`).join(",")}})}o(It,"runScriptAction");function Nt(t){let e=t.action.slice(nt.length).trim(),r=e.indexOf(":");if(r===-1)return`Call MCP tool ${JSON.stringify(e)} (server unspecified \u2014 re-author rule with format \`mcp:<server>:<tool>[:<args>]\`).`;let s=e.slice(0,r),n=e.slice(r+1),a=n.indexOf(":"),i=a===-1?n:n.slice(0,a),l=a===-1?"":n.slice(a+1),c=t.description?` (${t.description})`:"";return l?`Call MCP \`${s}.${i}\` with args ${l}${c}.`:`Call MCP \`${s}.${i}\`${c}.`}o(Nt,"buildMcpInstruction");async function Dt(t){try{let{default:e}=await import("./config-manager-2JJPCLKC.mjs"),s=(await e.readConfig(t))?.persona;if(!s)return"No persona declared for this project \u2014 `.prjct/prjct.config.json` has no `persona` field.";let n=[`You are **${s.role}** in this project.`];return s.focus&&n.push(`Focus: ${s.focus}.`),s.mcps&&s.mcps.length>0&&n.push(`MCPs available: ${s.mcps.join(", ")}.`),s.packs&&s.packs.length>0&&n.push(`Active packs: ${s.packs.join(", ")}.`),n.join(" ")}catch(e){return`Could not resolve persona: ${R(e)}`}}o(Dt,"buildPersonaInstruction");async function Wt(t,e){let r=new ce(t),s=Ye(typeof e.feature=="string"?e.feature:void 0),n=await r.bump(s);e.version=n}o(Wt,"runVersionBump");async function Gt(t,e){let r=typeof e.version=="string"?e.version:null,s=typeof e.feature=="string"?e.feature:null;if(!r)throw new Error("changelog:add requires a prior version:bump step (no version in runContext)");if(!s)throw new Error("changelog:add requires a feature name in runContext (set by ship before rules run)");await new oe(t).addFeature(r,s)}o(Gt,"runChangelogAdd");function it(t,e){return t.replace(/\$([A-Z_]+)/g,(r,s)=>{let n=s.toLowerCase(),a=e[n];return typeof a=="string"?a:""})}o(it,"expandTemplate");async function Bt(t,e,r){let n=t.slice(ve.length).replace(/^:/,"").trim()||(r.version?"feat: $FEATURE (v$VERSION)":"feat: $FEATURE"),a=`${it(n,r)}
55
-
56
- Generated with [p/](https://www.prjct.app/)`;await S("git",["add","."],{cwd:e}),await S("git",["commit","-m",a],{cwd:e})}o(Bt,"runGitCommit");function Vt(t,e){let r=t.trim(),s=e.trim(),n=s.includes("/")?s.slice(s.indexOf("/")+1):"";return!!r&&n===r?["push"]:["push","-u","origin","HEAD"]}o(Vt,"decideGitPushArgs");async function Ut(t){let e=await S("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t}).then(n=>n.stdout.trim()).catch(()=>""),r=await S("git",["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"],{cwd:t}).then(n=>n.stdout.trim()).catch(()=>""),s=Vt(e,r);try{await S("git",s,{cwd:t,timeout:3e4})}catch(n){let a=R(n);throw new Error(`git push failed: ${a}`)}}o(Ut,"runGitPush");async function zt(t,e,r){try{let s=await S("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t}).then(c=>c.stdout.trim());if(!s||s==="main"||s==="master")return;if(!await S("gh",["--version"],{cwd:t}).then(()=>!0).catch(()=>!1)){r.instructions.push("# prjct: pr:ensure skipped \u2014 `gh` CLI not found. Install it or open the PR manually.");return}let a=await S("gh",["pr","list","--head",s,"--json","number","--jq","length"],{cwd:t}).then(c=>Number(c.stdout.trim())).catch(()=>-1);if(a<0){r.instructions.push("# prjct: pr:ensure could not check for an existing PR (gh not authenticated?) \u2014 skipped.");return}if(a>0)return;let i=it(e.version?"feat: $FEATURE (v$VERSION)":"feat: $FEATURE",e),l=await S("gh",["pr","create","--fill",...i?["--title",i]:[]],{cwd:t,timeout:3e4}).then(c=>c.stdout.trim());r.instructions.push(`# prjct: opened PR \u2014 ${l}`)}catch(s){r.instructions.push(`# prjct: pr:ensure failed (non-blocking) \u2014 ${R(s)}`)}}o(zt,"runPrEnsure");async function ke(t,e,r,s,n,a){let i=t.action;if(i.startsWith(tt)){let l=i.slice(tt.length).trim();if(!l)throw new Error(`Empty status target in action '${i}'`);await Mt(e,r,l);return}if(i.startsWith(st)){await It(t,r,s);return}if(i.startsWith(nt)){n.instructions.push(Nt(t));return}if(i===At){n.instructions.push(await Dt(r));return}if(i===rt||i.startsWith(`${rt}:`)){await Wt(r,a);return}if(i===qt){await Gt(r,a);return}if(i===ve||i.startsWith(`${ve}:`)){await Bt(i,r,a);return}if(i===Ot){await Ut(r);return}if(i===Ht){await zt(r,a,n);return}if(i.startsWith(at)){await Lt(t,r);return}await _t(t,r)}o(ke,"runRuleAction");async function Jt(t,e){let[r,s,n]=await Promise.all([Kt(e),Yt(e),Xt(t)]);return{branch:r,filesChanged:s,tags:n}}o(Jt,"buildWhenContext");async function Kt(t){try{return await ae(t)||""}catch{return""}}o(Kt,"resolveBranch");async function Yt(t){let e={cwd:t,encoding:"utf-8"},r=o(async a=>{try{return $t(a,e).split(`
57
- `).map(i=>i.trim()).filter(Boolean)}catch{return[]}},"runDiff"),[s,n]=await Promise.all([r("git diff --cached --name-only"),r("git diff --name-only")]);return[...new Set([...s,...n])]}o(Yt,"resolveChangedFiles");async function Xt(t){try{let e=await w.getCurrentTask(t),r={};if(e?.type&&(r.type=e.type),!e)return r;let s=F.get(t,"SELECT data FROM events WHERE type = ? ORDER BY id DESC LIMIT 1",qe);if(s)try{let n=JSON.parse(s.data);if(n.taskId===e.id&&n.tags)return{...r,...n.tags}}catch{}return r}catch{return{}}}o(Xt,"resolveActiveTags");async function be(t,e,r,s={}){let n={success:!0,gatesFailed:[],hooksFailed:[],stepsRun:[],instructions:[],output:""};if(s.skipRules)return n;let a=s.runContext??{},l=Ne.getRulesForCommand(t,e).filter(u=>u.position===r),c=s.projectPath||process.cwd(),d=l.some(u=>u.whenExpr||u.type==="gate")?await Jt(t,c):{branch:"",filesChanged:[],tags:{}},g=l.filter(u=>Ze(u.whenExpr,d)),y=g.length>0?Xe(t,`${r}:${e}`):null,x=g.filter(u=>u.type==="gate");for(let u of x){let f=u.description||u.action;console.log(`
58
- ${T.dim(`[gate] ${r}-${e}: ${u.action}`)}`);try{let k=Date.now();await ke(u,t,c,d,n,a);let E=Date.now()-k,z=E>1e3?`${(E/1e3).toFixed(1)}s`:`${E}ms`;console.log(`${T.green("\u2713")} ${T.dim(`gate passed (${z})`)}`),we(t,y,u.id,!0)}catch(k){return console.log(`${T.red("\u2717")} gate failed: ${f}`),n.gatesFailed.push(f),n.success=!1,n.output+=`Gate failed: ${f}
59
- ${R(k)}
60
- `,we(t,y,u.id,!1,R(k)),le(t,y,"blocked"),n}}let B=g.filter(u=>u.type==="instruction");for(let u of B){let f=u.description||u.action;console.log(`
61
- ${T.dim(`[instruction] ${r}-${e}: ${f}`)}`),n.instructions.push(u.action)}let V=g.filter(u=>u.type==="hook"),U=V.filter(u=>u.parallel===!1),j=V.filter(u=>u.parallel!==!1),Z=o(async u=>{console.log(`
62
- ${T.dim(`[hook] ${r}-${e}: ${u.action}`)}`);try{let f=Date.now();await ke(u,t,c,d,n,a);let k=Date.now()-f,E=k>1e3?`${(k/1e3).toFixed(1)}s`:`${k}ms`;console.log(`${T.green("\u2713")} ${T.dim(`(${E})`)}`)}catch(f){console.log(`${T.yellow("\u26A0")} hook failed (non-blocking): ${u.action}`),n.hooksFailed.push(u.description||u.action),n.output+=`Hook failed: ${u.action}
63
- ${R(f)}
64
- `}},"runHook");for(let u of U)await Z(u);j.length>0&&await Promise.all(j.map(Z));let ee=g.filter(u=>u.type==="step");for(let[u,f]of ee.entries()){console.log(`
65
- ${T.dim(`[step] ${e}: ${f.action}`)}`);try{let k=Date.now();await ke(f,t,c,d,n,a);let E=Date.now()-k,z=E>1e3?`${(E/1e3).toFixed(1)}s`:`${E}ms`;console.log(`${T.green("\u2713")} ${T.dim(`step passed (${z})`)}`),n.stepsRun.push(f.description||f.action),ye(t,y,f.id,u,"ok")}catch(k){return console.log(`${T.red("\u2717")} step failed: ${f.action}`),n.gatesFailed.push(f.description||f.action),n.success=!1,n.output+=`Step failed: ${f.action}
66
- ${R(k)}
67
- `,ye(t,y,f.id,u,"failed",R(k)),le(t,y,"failed"),n}}return le(t,y,"passed"),n}o(be,"executeWorkflowRules");pe();se();var Qt=["cli","command","install","setup","doctor","mcp","codex","claude","statusline","statusbar","output","help"],Zt=new Set(["the","and","for","with","that","this","task","implement","implementa","fix","bug","add","agrega","crear","hacer","esto","debe"]);function Q(t){let e=t.toLowerCase(),r=er(e),s=Qt.some(d=>e.includes(d)),n=A(e,["security","seguridad","auth","permission","secret","migration","sqlite","database","arquitectura","architecture","must","critical","critico","cr\xEDtico"]),a=tr(r,e,n),i=rr(a,n),l=sr(r,a,s),c=nr(a),p=ir(t);return{level:a,kind:r,risk:i,expectedEvidence:l,scopeHints:p,gates:c,rationale:ar(a,r,i),createdAt:ne()}}o(Q,"buildTaskHarness");async function Se(t,e){let r=e.harness;if(!r||r.level==="H0")return{changedFiles:[],observedEvidence:[],warnings:[],diffSize:0};let s=await Promise.all([je(t),pr(t)]).then(([p,d])=>({changedFiles:p,diffSize:d,gitUnavailable:null})).catch(p=>{if(p instanceof re)return{changedFiles:[],diffSize:0,gitUnavailable:p};throw p}),{changedFiles:n,diffSize:a,gitUnavailable:i}=s,l=or(n),c=[];return i?(c.push(`git ${i.kind}: change evidence unavailable \u2014 completion checks skipped, not failed.`),{changedFiles:n,observedEvidence:l,warnings:c,diffSize:a}):(r.expectedEvidence.includes("regression-test")&&!l.includes("tests-changed")&&c.push(`${r.level} expects a regression test; no test file changed in the diff.`),r.expectedEvidence.includes("docs-if-public-behavior")&&ur(n)&&!l.includes("docs-changed")&&c.push("Public-facing files changed; no README/docs/changelog file changed."),a>400&&c.push(`Diff is ${a} changed lines; consider splitting or justify the scope.`),{changedFiles:n,observedEvidence:l,warnings:c,diffSize:a})}o(Se,"evaluateHarnessCompletion");function er(t){if(A(t,["security","seguridad","auth","authent","authoriz","permission","secret"]))return"security";if(A(t,["bug","bugs","fix","fixes","fixed","fixing","falla","fallo","error","broken","regression","no se"]))return"bug";let e=A(t,["implement","implementa","refactor","restructure","cleanup","crear","agrega","construir","build"]);return A(t,["research","investiga","investigate","analiza","analyze","analysis","an\xE1lisis","compare","compara","survey","explore","explora","revisa","revisar","review","reviewing","repasa","repasar"])&&!e?"research":A(t,["refactor","cleanup","restructure"])||/(?:^|[^a-z0-9_-])split(?:[^a-z0-9_-]|$)/.test(t)?"refactor":A(t,["doc","docs","document","readme","changelog","typo"])?"docs":A(t,["chore","format","lint","linting","linter"])?"chore":A(t,["add","agrega","crear","implement","implementa","feature","mejora"])?"feature":"unknown"}o(er,"detectKind");function tr(t,e,r){return t==="docs"||t==="chore"?"H0":t==="security"?"H3":t==="research"?"H1":r&&A(e,["migration","sqlite","database","architecture","arquitectura"])?"H3":t==="feature"||t==="refactor"?"H2":"H1"}o(tr,"detectLevel");function rr(t,e){return t==="H3"||e?"high":t==="H2"||t==="H1"?"medium":"low"}o(rr,"detectRisk");function sr(t,e,r){let s=new Set;return t==="bug"&&(s.add("regression-test"),s.add("focused-tests"),s.add("edge-cases")),(t==="feature"||t==="refactor")&&(s.add("focused-tests"),s.add("scope-check")),r&&s.add("docs-if-public-behavior"),(e==="H2"||e==="H3")&&s.add("spec-or-design"),e==="H3"&&s.add("config-preservation"),[...s]}o(sr,"expectedEvidenceFor");function nr(t){return t==="H0"?[]:t==="H1"?["verify-before-done"]:t==="H2"?["verify-before-done","scope-check"]:["spec-before-implementation","verify-before-done","scope-check","review-before-ship"]}o(nr,"gatesFor");function ar(t,e,r){return t==="H0"?`Low-risk ${e}; keep the task direct and low-friction.`:`${t} ${e}/${r}; define expected evidence up front and verify before closure.`}o(ar,"rationaleFor");function ir(t){let e=t.toLowerCase().normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").split(/[^a-z0-9_.-]+/u).filter(r=>r.length>=3&&!Zt.has(r));return[...new Set(e)].slice(0,8)}o(ir,"extractScopeHints");function A(t,e){return e.some(r=>{if(r.includes(" "))return t.includes(r);let s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=r.length>=5?`\\b${s}`:`\\b${s}\\b`;return new RegExp(n).test(t)})}o(A,"hasAny");function or(t){let e=new Set;return t.some(cr)&&e.add("tests-changed"),t.some(lr)&&e.add("docs-changed"),[...e]}o(or,"observedEvidenceFromFiles");function cr(t){return/(^|\/)(__tests__|tests?|specs?)\//.test(t)||/\.(test|spec)\.[cm]?[tj]sx?$/.test(t)}o(cr,"isTestFile");function lr(t){return/(^|\/)(README|CHANGELOG|docs\/)/i.test(t)}o(lr,"isDocsFile");function ur(t){return t.some(e=>e.startsWith("core/commands/")||e.startsWith("core/mcp/")||e.startsWith("templates/")||e==="README.md")}o(ur,"touchesPublicSurface");async function pr(t){let e=await K(["diff","--shortstat","HEAD"],{cwd:t});if(!e.ok){if(e.kind==="exit")return 0;Y(e)}let r=Number.parseInt(e.stdout.match(/(\d+) insertions?/)?.[1]??"0",10),s=Number.parseInt(e.stdout.match(/(\d+) deletions?/)?.[1]??"0",10);return r+s}o(pr,"readDiffSize");var dr=[/\btypo\b/i,/\bdocs?\b/i,/\breadme\b/i,/\bformat\b/i,/\bchangelog\b/i,/\brerun\b.*\btests?\b/i,/\bre-?run\b.*\btests?\b/i],mr=[/\badd\b/i,/\bimplement\b/i,/\bcreate\b/i,/\bbuild\b/i,/\bfeature\b/i,/\bbilling\b/i,/\bauth\b/i,/\bsecurity\b/i,/\bmigration\b/i,/\bretry\b/i,/\bfailure\b/i,/\brecovery\b/i,/\baudit\b/i,/\bworkflow\b/i,/\borchestrat/i];function gr(t){let e=t.trim(),r=dr.some(n=>n.test(e)),s=mr.some(n=>n.test(e));return r&&!s?{kind:"trivial",station:"direct",requiresSpec:!1,requiresTestsFirst:!1,reason:"trivial-keyword"}:s?{kind:"substantive",station:"spec_required",requiresSpec:!0,requiresTestsFirst:!0,reason:"substantive-keyword"}:{kind:"trivial",station:"direct",requiresSpec:!1,requiresTestsFirst:!1,reason:"conservative-default"}}o(gr,"classifyTaskPipeline");function ot(t,e){let r=gr(t);return r.kind==="substantive"&&e?{...r,station:"test_red",reason:"linked-spec"}:r}o(ot,"decideTaskPipeline");function ct(t){switch(t.station){case"direct":return"Proceed directly; no spec is required for this trivial task.";case"spec_required":return"Create or link a reviewed spec before implementation; write tests before implementation from the spec acceptance criteria.";case"test_red":return"Write failing tests before implementation, covering the linked spec acceptance criteria and edge cases.";case"implementation":return"Implement the minimum code needed to make the existing tests pass.";case"verify":return"Run verification and keep the task blocked on red tests."}}o(ct,"formatTaskPipelineNextAction");var fr=["active","resume","in_progress","working"],lt=120;function js(t){let e=t.type==="decision"||t.type==="gotcha"||t.type==="fact"||t.type==="spec"?"SoT":t.type==="anti-pattern"||t.type==="pattern"||t.type==="learning"?"SUGGEST":"ctx",r=t.when?t.when.slice(0,10):"",s=t.author?` by ${t.author}`:"",n=[r,s].filter(Boolean).join(""),a=`[${e}\xB7${t.type}] ${t.title}${n?` (${n.trim()})`:""} \`${t.id}\``,i=t.decisionTrap??t.antiPattern??t.nextImplication??t.why??t.outcome??t.keyData??t.detail;if(!i)return e==="SoT"?`${a} \u2014 BINDING; supersede via prjct remember if wrong`:a;let l=i.length>lt?`${i.slice(0,lt-1)}\u2026`:i;if(e==="SoT")return`${a} \u2014 tip\u2192user \xB7 SoT: ${l}`;if(e==="SUGGEST"){let c=t.files&&t.files.length>0?` in \`${t.files.slice(0,2).join("`, `")}\``:"";return`${a} \u2014 tip\u2192user \xB7 suggest${c}: ${l}`}return`${a} \u2014 ${l}`}o(js,"formatRelatedContextForAgent");function Cs(t){return`[${t.label}] ${t.title} \u2014 \`${t.file}\` \`${t.id}\``}o(Cs,"formatRiskForAgent");async function Ps(t,e,r,s={}){let n=r.trim().toLowerCase();if(Ve.has(n))return{ok:!1,blocked:`'${n}' is a prjct command, not a work intent. Did you mean \`prjct ${n}\`? To start a work cycle, describe the task (e.g. \`prjct work "fix the ${n} flow"\`).`};let a=await be(t,"task","before",{projectPath:e,skipRules:s.skipHooks});if(!a.success)return{ok:!1,blocked:a.gatesFailed.length>0?`Blocked: ${a.gatesFailed.join(", ")}`:`Hook failed: ${a.hooksFailed.join(", ")}`};let i=await me.readConfig(e).catch(()=>null);try{let{ensureCodingAnticipationDefaults:h}=await import("./pack-manager-QLFQKP24.mjs"),m=await h(e);m.healed&&m.reason==="activated-code"?console.log("\u2139 Anticipation ON: activated pack `code` (conflictMode advisory) \u2014 traps surface before edit"):m.healed&&m.reason==="conflictMode-healed"&&console.log("\u2139 Anticipation ON: conflictMode \u2192 advisory for pack code")}catch{}{let{effectiveSddMode:h}=await import("./sdd-PB6WKSLE.mjs"),{discussLockVerdict:m}=await import("./discuss-lock-55GER2LR.mjs"),C=Q(r),b=s.spec?await import("./spec-service-ENLAAMVL.mjs").then(({specService:v})=>v.get(e,s.spec)).then(v=>v?.status??null).catch(()=>null):null;if(s.spec&&b===null){let{specService:v}=await import("./spec-service-ENLAAMVL.mjs");if(await v.get(e,s.spec).then(_=>!_).catch(()=>!1))return{ok:!1,blocked:`Spec ${s.spec} not found.`}}let q=m({sddMode:h(i),harnessLevel:C.level,hasSpecId:!!s.spec,specStatus:b});if(q.blocked)return{ok:!1,blocked:q.message}}if(s.spec)try{let{effectiveSddMode:h}=await import("./sdd-PB6WKSLE.mjs"),{effectiveTddMode:m}=await import("./tdd-TAMBOPN3.mjs"),{effectiveNyquistWorkMode:C,nyquistWorkVerdict:b}=await import("./nyquist-lite-GE7OAFLC.mjs"),{specService:q}=await import("./spec-service-ENLAAMVL.mjs"),v=Q(r),_=(await q.get(e,s.spec))?.content?.acceptance_criteria??[],P=b({harnessLevel:v.level,criteria:_,mode:C(h(i),m(i))});if(P.blocked)return{ok:!1,blocked:P.message??"Nyquist-lite blocked work start."};P.message&&console.log(P.message)}catch{}{let h=i?.deliveryGeometry?.mode??"off";try{let{existsSync:m}=await import("node:fs"),C=await import("node:path"),{computeWorkingTreeChangeset:b,geometryOf:q,tierOf:v,geometryBlockMessage:M,intentGeometryVerdict:_,NORMAL_MAX_LOC:P}=await import("./delivery-geometry-WYOEMKMO.mjs"),O=Q(r),J=m(C.join(e,".git"))?await b(e):null,ft=i?.deliveryGeometry?.locThreshold??P,xe=!!(J&&J.loc>=ft);if(h==="strict"&&xe&&J&&!s.geometry){let ht=q(v(J));return{ok:!1,blocked:M(J,ht)}}let te=_({harnessLevel:O.level,harnessRisk:O.risk,mode:h,explicitGeometry:s.geometry??null,treeLarge:xe});if(te.blocked)return{ok:!1,blocked:te.message??"Delivery geometry required at intent."};te.message&&console.log(te.message)}catch(m){if(m instanceof re&&h==="strict")return{ok:!1,blocked:`Delivery geometry gate unevaluable: ${m.message}. Re-run when git is healthy, or pass \`--geometry\` explicitly.`}}}let l=/^[A-Z]+-\d+$/.test(r)?r:void 0,c=L(),p=s.spec,d=Q(r),g=await(async()=>{try{let h=await me.readConfig(e).catch(()=>null),[{effectiveSddMode:m},{effectiveTddMode:C}]=await Promise.all([import("./sdd-PB6WKSLE.mjs"),import("./tdd-TAMBOPN3.mjs")]),{effectiveWeakModelMode:b}=await import("./weak-model-mode-BMSPGEQY.mjs");return fe(d,m(h),C(h),b(h),`${r}::${c}`)}catch{return fe(d,"off","off","off",`${r}::${c}`)}})(),{resolveCallerIdentity:y}=await import("./agent-identity-DH6DX72X.mjs"),x=y(r),B=await(async()=>{let h=i?.multiAgent?.autoWorktree??"auto";try{let{getOccupancy:m,shouldIsolate:C,worktreeSlugFromIntent:b}=await import("./workspace-occupancy-JOBYNNXV.mjs"),q=await m(t,e,x),v=C(q,h,r);if(v.block)return{blocked:v.reason};if(v.isolate&&q.isMain){let{worktreeService:M}=await import("./worktree-service-AS7JVBK5.mjs"),_=b(r),P=await M.create(e,_);await M.setup(P.path,await M.getMainWorktree(e));let O=v.occupant;return{effectivePath:P.path,isolation:{reason:v.reason,worktreePath:P.path,branch:P.branch,slug:P.slug,occupantSummary:O?`${[O.ownerAgent,O.ownerIdentity].filter(Boolean).join("/")||"other"} \xB7 ${O.taskId.slice(0,8)} \xB7 "${O.description.slice(0,60)}"`:"foreign cycle"}}}}catch(m){if(m instanceof Error&&m.message.includes("already active"))return{blocked:m.message}}return{effectivePath:e,isolation:void 0}})();if("blocked"in B)return{ok:!1,blocked:B.blocked};let{effectivePath:V,isolation:U}=B,j=await X(V);if(j.gitError)return{ok:!1,blocked:`git ${j.gitError}: workspace identity unknown \u2014 refusing to start work on the main fallback. Re-run when git is healthy.`};let Z=j.isMain?Ge:j.workspaceId,ee={id:c,description:r,sessionId:L(),linearId:l,linkedSpecId:p,harness:d,ownerAgent:x.agent,ownerIdentity:x.identity,ownerSessionId:x.sessionId,yieldStatus:"active"};j.isMain?await w.startTask(t,ee):await w.startTaskInWorkspace(t,{...ee,branch:j.branch??U?.branch,workspaceId:j.workspaceId,worktreePath:j.worktreePath},j.workspaceId);try{let{ensureJudgmentLedger:h,intensityFromQuality:m}=await import("./judgment-orchestrator-AAON4ZJ4.mjs");g.quality!=="none"&&await h({projectId:t,projectPath:e,signals:{harnessLevel:d.level,harnessKind:d.kind},forceIntensity:m(g.quality)})}catch{}try{let{prjctDb:h}=await import("./database-ZCP76LMM.mjs");h.run(t,"UPDATE tasks SET expected_value = ? WHERE id = ?",String(g.expectedPoints),c);let{workGraph:m}=await import("./work-graph-AVAOKY63.mjs");m.recordComplexity(t,c,{score:g.expectedPoints,recommendedSubtasks:g.expectedPoints>=5?Math.min(g.expectedPoints,6):0,reasoning:`Triage: ${d.level} \xB7 ${g.model}/${g.effort} \xB7 fan-out ${g.fanout}`})}catch{}let u=ot(r,p),f=We(t,{taskId:c,workspaceId:Z,classification:u.kind,station:u.station,requiresSpec:u.requiresSpec,requiresTestsFirst:u.requiresTestsFirst,reason:u.reason,linkedSpecId:p??null});if(p)try{let{specService:h}=await import("./spec-service-ENLAAMVL.mjs");await h.linkTask(e,p,c)}catch{}let k=await Be.ensureAuthor();await N.log(e,"task_started",{task:r,taskId:c,harness:d,timestamp:ne()},k.name),await be(t,"task","after",{projectPath:e,skipRules:s.skipHooks});let E=U?.branch??await ae(V).catch(()=>""),z=await yr(e,t,r),Te=await wr(e,t,r),mt=hr(t,Te),gt=await(async()=>{try{let{buildCycleBudgetCard:h}=await import("./cycle-budget-card-O5WAGNGC.mjs"),{contextPressureVerdict:m}=await import("./context-pressure-OUN5PFMN.mjs"),C=m(i,{turnCount:0,tokensIn:0,tokensOut:0}),b=h({turns:0,turnLimit:i?.maxTurnsPerCycle??C.limit,tokensSpent:0,tokenBudget:i?.maxTokensPerCycle??null,pressureLevel:C.level});return console.log(b.line),b.line}catch{return null}})();return{ok:!0,taskId:c,description:r,branch:E,linearId:l,linkedSpecId:p,harness:d,orchestration:g,ownerAgent:x.agent,ownerIdentity:x.identity,isolation:U,pipeline:{classification:f.classification,station:f.station,nextAction:ct(u),requiresSpec:f.requiresSpec,requiresTestsFirst:f.requiresTestsFirst},instructions:a.instructions,relatedContext:z,likelyFiles:Te,risks:mt,cycleBudget:gt}}o(Ps,"startTask");function hr(t,e){let r=new Set,s=[];try{for(let n of e.slice(0,5)){let a=Ie.recallForFile(t,n.path,2,{preventiveOnly:!0});for(let i of a)if(!r.has(i.id)&&(r.add(i.id),s.push({id:i.id,label:He(i),title:_e(i),file:n.path}),s.length>=4))return s}}catch{}return s}o(hr,"recallRisksForFiles");async function wr(t,e,r){try{let{resolveWorkScope:s,toLikelyFileHits:n}=await import("./work-scope-YCS4GTXW.mjs"),a=await s(t,e,r,8);return a.files.length>0?n(a.files):ge(e,r)}catch{try{return ge(e,r)}catch{return[]}}}o(wr,"recallLikelyFiles");async function yr(t,e,r){try{let{enrichedRecall:s}=await import("./enriched-recall-6VOIUNLN.mjs"),{deriveTitle:n}=await import("./format-IIOFTSBF.mjs"),a=await s(t,e,{topic:r,types:["decision","gotcha","fact","spec","anti-pattern","pattern","learning","context"],limit:8});if(a.length===0)return[];let{recordSurfacedForActiveTask:i}=await import("./surface-attribution-EGIKCVMF.mjs");return await i(e,t,a.map(l=>l.id)),a.map(l=>{let c=Le(l.content),p=c.relatedFiles??l.tags?.related_files?.split(",").filter(Boolean)??l.tags?.files?.split(",").filter(Boolean);return{id:l.id,type:l.type,title:n(l),detail:c.contextSynthesis??Me(l.content,180),when:l.rememberedAt,author:c.whoAuthor??l.tags?.author,keyData:c.keyData??l.tags?.key_data,feature:c.featureDomain??l.tags?.feature,files:p,why:c.whyItMattered,pattern:c.pattern,antiPattern:c.antiPattern,decisionTrap:c.decisionTrap,outcome:c.outcome,nextImplication:c.nextImplication}})}catch{return[]}}o(yr,"recallRelatedContext");var ut=Fe();async function Es(t,e,r){let s=r.toLowerCase(),n=fr.includes(s),a=await X(e);if(a.gitError)return{ok:!1,reason:"unsupported",message:`git ${a.gitError}: workspace identity unknown \u2014 refusing to change task status on the main fallback. Re-run when git is healthy.`};if(!a.isMain){let p=await w.getCurrentTaskForWorkspace(t,a.workspaceId);if(!p)return{ok:!1,reason:"no-active-task"};if(s==="done"||s==="completed"){let d=await dt(t,p.id),g=await Se(e,p);await N.log(e,I,{taskId:p.id,from:d??null,to:r,workspaceId:a.workspaceId,harnessWarnings:g.warnings}),await w.completeTaskInWorkspace(t,a.workspaceId),await pt(t,p.id,g.diffSize);try{let{usefulnessService:y}=await import("./usefulness-TBD5EYAL.mjs");y.creditShippedTask(t,p.id)}catch{}try{let{applyRetentionIncremental:y}=await import("./retention-RET4P2RO.mjs");y(t)}catch{}return{ok:!0,taskId:p.id,status:r,verificationWarnings:g.warnings,contextPrompt:ut}}return{ok:!1,reason:"unsupported",message:`'${r}' isn't supported for a worktree task yet \u2014 only 'done'. (pause/resume per-worktree is a planned follow-up)`}}if(n&&!await w.getCurrentTask(t)){let d=await w.resumeTask(t);if(d)return await N.log(e,I,{taskId:d.id,from:"paused",to:r}),{ok:!0,taskId:d.id,status:r}}let i=await w.getCurrentTask(t);if(!i)return{ok:!1,reason:"no-active-task"};let l=await dt(t,i.id),c=s==="done"||s==="completed"?await Se(e,i):{warnings:[],diffSize:0};await N.log(e,I,{taskId:i.id,from:l??null,to:r,harnessWarnings:c.warnings});try{if(s==="done"||s==="completed"){await w.completeTask(t),await pt(t,i.id,c.diffSize);try{let{usefulnessService:p}=await import("./usefulness-TBD5EYAL.mjs");p.creditShippedTask(t,i.id)}catch{}try{let{applyRetentionIncremental:p}=await import("./retention-RET4P2RO.mjs");p(t)}catch{}}else s==="paused"||s==="pause"?await w.pauseTask(t):n&&(await w.getCurrentTask(t)||await w.resumeTask(t))}catch{}return{ok:!0,taskId:i.id,status:r,verificationWarnings:c.warnings,contextPrompt:s==="done"||s==="completed"?ut:void 0}}o(Es,"setTaskStatus");async function Rs(t,e){let r=await X(e);return r.gitError?null:r.isMain?w.getCurrentTask(t):w.getCurrentTaskForWorkspace(t,r.workspaceId)}o(Rs,"resolveActiveTask");async function pt(t,e,r){try{let{prjctDb:s}=await import("./database-ZCP76LMM.mjs"),{pointsFromDiffLines:n}=await import("./task-orchestration-7NGRIISS.mjs"),a=s.get(t,"SELECT expected_value FROM tasks WHERE id = ?",e),i=Number(a?.expected_value);if(!Number.isFinite(i)||i<=0)return;s.run(t,`UPDATE tasks SET data = json_set(COALESCE(data, '{}'),
68
- '$.expectedPoints', ?, '$.actualPoints', ?, '$.diffLines', ?)
69
- WHERE id = ?`,i,n(r),r,e)}catch{}}o(pt,"recordEstimationOutcome");async function $s(t,e,r){let s=await X(e);return s.gitError?null:s.isMain?w.completeTask(t,r):w.completeTaskInWorkspace(t,s.workspaceId,r)}o($s,"completeActiveTask");async function dt(t,e){try{let{default:r}=await import("./database-ZCP76LMM.mjs"),s=r.query(t,"SELECT data FROM events WHERE type = ? ORDER BY id DESC LIMIT 10",`memory.${I}`);for(let n of s)try{let a=JSON.parse(n.data);if(a.taskId===e&&a.to)return a.to}catch{}}catch{}return null}o(dt,"readLastStatus");export{be as a,js as b,Cs as c,Ps as d,hr as e,ut as f,Es as g,Rs as h,$s as i,dt as j};
@@ -1,16 +0,0 @@
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 c}from"./chunk-IJ523YO2.mjs";import{a as r}from"./chunk-E66B27AL.mjs";c();function g(){return"---"}r(g,"mdHeader");function a(){return`---
9
- prjct v${u()}`}r(a,"mdFooter");function f(...n){return m(g(),...n.filter(Boolean),a())}r(f,"mdOutput");function d(n,t){let i=`| ${n.join(" | ")} |`,e=`|${n.map(()=>"---").join("|")}|`,o=t.map(s=>`| ${s.join(" | ")} |`);return[i,e,...o].join(`
10
- `)}r(d,"mdTable");function l(n,t,i=3){return`### ${n}
11
- ${t}`}r(l,"mdSection");function $(n,t=!1){return n.map((i,e)=>t?`${e+1}. ${i}`:`- ${i}`).join(`
12
- `)}r($,"mdList");function h(n){let t=["Command","Action"],i=n.map(e=>[`\`${e.command}\``,e.label]);return`### Next
13
- ${d(t,i)}`}r(h,"mdNextSteps");function x(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 d(i,e)}r(x,"mdStats");function b(n,t){return t?`## ${n}
14
- > ${t}`:`## ${n}`}r(b,"mdDone");function j(n){return`> **WARNING:** ${n}`}r(j,"mdWarn");function m(...n){return n.filter(Boolean).join(`
15
-
16
- `)}r(m,"mdJoin");export{f as a,l as b,$ as c,h as d,x as e,b as f,j as g};
@@ -1,9 +0,0 @@
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{d as m,g as b}from"./chunk-TKXOMN4K.mjs";import{b as f,h as P}from"./chunk-A6K4H3YT.mjs";import{a as c}from"./chunk-E66B27AL.mjs";P();b();function C(t,e,n){let s=t.prepare("INSERT INTO analysis_finding (id, analysis_id, kind, title, detail, severity, sort_order) VALUES (?, ?, ?, ?, ?, ?, ?)"),o=[],i=c((a,u,p,L)=>{if(!u)return;let k=o.length,S=`${e}-f${k}`;s.run(S,e,a,u,p,L,k),o.push(S)},"addFinding");for(let a of n.patterns??[])i("pattern",a.name,a.description,null);for(let a of n.antiPatterns??[])i("anti_pattern",a.issue,a.suggestion,a.severity);for(let a of n.techDebt??[])i("tech_debt",a.description,`${a.area}: ${a.impact}`,a.priority);for(let a of n.riskAreas??[])i("risk_area",a.path,`${a.reason} \u2014 ${a.risk}`,a.severity);for(let a of n.refactorSuggestions??[])i("refactor",a.description,a.benefit,null);let l=new Set;for(let a of[...n.projectInsights??[],...n.architecture?.insights??[]]){let u=a.toLowerCase();l.has(u)||(l.add(u),i("insight",a,null,null))}let g=t.prepare("INSERT INTO analysis_convention (id, analysis_id, rule, sort_order) VALUES (?, ?, ?, ?)");(n.conventions??[]).forEach((a,u)=>{g.run(`${e}-c${u}`,e,a.rule,u)});let r=t.prepare("INSERT INTO analysis_stack_item (id, analysis_id, kind, name) VALUES (?, ?, ?, ?)");[...(n.stack?.languages??[]).map(a=>({kind:"language",name:a})),...(n.stack?.frameworks??[]).map(a=>({kind:"framework",name:a}))].forEach((a,u)=>{r.run(`${e}-s${u}`,e,a.kind,a.name)});let v=t.prepare("INSERT INTO analysis_command (id, analysis_id, name, command, purpose) VALUES (?, ?, ?, ?, ?)");Object.entries(n.commands??{}).filter(a=>!!a[1]).forEach(([a,u],p)=>{v.run(`${e}-cmd${p}`,e,a,u,null)});let j=t.prepare("INSERT INTO analysis_domain (id, analysis_id, name, paths) VALUES (?, ?, ?, ?)");(n.architecture?.domains??[]).forEach((a,u)=>{j.run(`${e}-d${u}`,e,a,null)})}c(C,"writeAnalysisChildren");var h=class{static{c(this,"LLMAnalysisStorage")}save(e,n){let s=m.getDb(e),o=f();s.transaction(()=>{s.prepare("UPDATE llm_analysis SET status = 'superseded', superseded_at = ? WHERE status = 'active'").run(o);let i=s.prepare("INSERT INTO llm_analysis (commit_hash, status, analysis, analyzed_at) VALUES (?, ?, ?, ?)").run(n.commitHash??null,"active",JSON.stringify(n),n.analyzedAt);C(s,String(i.lastInsertRowid),n)})()}getActiveRelational(e){let n=m.get(e,"SELECT id FROM llm_analysis WHERE status = 'active' LIMIT 1");if(!n)return null;let s=String(n.id),o=m.query(e,"SELECT kind, title, detail FROM analysis_finding WHERE analysis_id = ? ORDER BY kind, sort_order",s),i=m.query(e,"SELECT rule FROM analysis_convention WHERE analysis_id = ? ORDER BY sort_order",s).map(d=>d.rule),l=m.query(e,"SELECT kind, name FROM analysis_stack_item WHERE analysis_id = ?",s),g=m.query(e,"SELECT name FROM analysis_domain WHERE analysis_id = ?",s).map(d=>d.name),r=m.query(e,"SELECT name, command FROM analysis_command WHERE analysis_id = ?",s);return o.length===0&&i.length===0&&l.length===0?null:{findings:o,conventions:i,stack:l,domains:g,commands:r}}getActive(e){let n=m.get(e,"SELECT analysis FROM llm_analysis WHERE status = 'active' LIMIT 1");return n?JSON.parse(n.analysis):null}getActiveSummary(e){let n=this.getActive(e);return n?{commitHash:n.commitHash,architectureStyle:n.architecture.style,patternCount:n.patterns.length,antiPatternCount:n.antiPatterns.length,analyzedAt:n.analyzedAt}:null}isCurrent(e,n){return n?m.get(e,"SELECT commit_hash FROM llm_analysis WHERE status = 'active' LIMIT 1")?.commit_hash===n:!1}getAllFull(e){return m.query(e,"SELECT id, commit_hash, status, analyzed_at, superseded_at, analysis FROM llm_analysis ORDER BY id DESC").map(s=>({id:s.id,status:s.status,commitHash:s.commit_hash,analyzedAt:s.analyzed_at,supersededAt:s.superseded_at,analysis:JSON.parse(s.analysis)}))}getHistory(e,n=10){return m.query(e,"SELECT id, commit_hash, status, analyzed_at, analysis FROM llm_analysis ORDER BY id DESC LIMIT ?",n).map(o=>{let i=JSON.parse(o.analysis);return{id:o.id,commitHash:o.commit_hash,status:o.status,analyzedAt:o.analyzed_at,patternCount:i.patterns.length}})}},R=new h,q=R;P();var M=["zod","better-sqlite3","@modelcontextprotocol/sdk","@modelcontextprotocol/client","@modelcontextprotocol/server","chalk","chokidar","commander","express","fastify","hono","react","next","vue","vitest","jest","typescript","biome","lefthook","drizzle-orm","prisma","@prisma/client"];function y(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"item"}c(y,"stableStyleKey");function _(t){return t?!!(t.architecture?.style&&t.architecture.style!=="unknown"||(t.patterns?.length??0)>0||(t.conventions?.length??0)>0||(t.antiPatterns?.length??0)>0||(t.stack?.frameworks?.length??0)>0||(t.stack?.languages?.length??0)>0):!1}c(_,"isRichLlmAnalysis");function J(t){return!_(t)}c(J,"isThinLlmAnalysis");function $(t){let e=w(t),n=x(t.commands),s=_(t.llmAnalysis)?t.llmAnalysis:null,o=D(s?.conventions?.map(r=>({key:y(r.category?`${r.category}-${r.rule}`:r.rule),rule:r.rule,category:r.category}))??[],t.memoryConventions?.map(r=>({key:y(r.category?`${r.category}-${r.rule}`:r.rule),rule:r.rule,category:r.category}))??[]),i=N(s?.patterns?.map(r=>({key:y(r.name),name:r.name,description:r.description,locations:r.locations,category:r.category}))??[],t.memoryPatterns?.map(r=>({key:y(r.name),name:r.name,description:r.description}))??[]),l=H(s?.antiPatterns?.map(r=>({key:y(r.issue),issue:r.issue,suggestion:r.suggestion,severity:r.severity}))??[],t.memoryAntiPatterns?.map(r=>({key:y(r.issue),issue:r.issue,suggestion:r.suggestion}))??[]);if(s?.stack?.languages?.length)for(let r of s.stack.languages)e.languages.includes(r)||e.languages.push(r);if(s?.stack?.frameworks?.length)for(let r of s.stack.frameworks)e.frameworks.includes(r)||e.frameworks.push(r);s?.stack?.packageManager&&!e.packageManager&&(e.packageManager=s.stack.packageManager);let g={symbols:t.structural?.symbols??0,files:t.structural?.files??t.stats.fileCount??0,packages:t.structural?.packages??[]};return{payloadVersion:1,stack:e,commands:n,conventions:o,patterns:i,antiPatterns:l,structural:g,metrics:{...t.metrics??{}}}}c($,"buildProjectStylePayload");function U(t){let e=$(t),n=t.capturedAt??f();return{id:t.id??`style_${n.replace(/[^0-9]/g,"").slice(0,14)}_${Math.random().toString(36).slice(2,8)}`,capturedAt:n,commitHash:t.commitHash??null,source:t.source??"sync-mechanical",patternCount:e.patterns.length,antiPatternCount:e.antiPatterns.length,conventionCount:e.conventions.length,frameworkCount:e.stack.frameworks.length,symbolCount:e.structural.symbols,fileCount:e.structural.files,summary:T(e),payload:e}}c(U,"buildProjectStyleSnapshot");function T(t){let e=[t.stack.ecosystem!=="unknown"?t.stack.ecosystem:null,t.stack.languages.slice(0,2).join("+")||null,t.stack.frameworks.slice(0,3).join(", ")||null].filter(Boolean);return`${e.length>0?e.join(" \xB7 "):"stack unknown"}; ${t.patterns.length} patterns, ${t.antiPatterns.length} anti-patterns, ${t.conventions.length} conventions; ${t.structural.files} files`+(t.structural.symbols>0?`, ${t.structural.symbols} symbols`:"")}c(T,"buildStyleSummary");function w(t){let e=A([...t.stack.frameworks??[],...t.stats.frameworks??[]]),n=A([...t.stats.languages??[]]),s=O(t.packageDeps??{}),o=t.packageDeps??{};for(let l of s)["Hono","Express","Fastify","React","Next.js","Vue","NestJS"].includes(l)&&!e.includes(l)&&e.push(l);let i=t.stack.hasTesting===!0||!!(o.vitest||o.jest||o.mocha||o["bun-types"]||o["@types/bun"]||s.includes("Vitest")||s.includes("Jest"))||!!(t.commands?.test&&/test/i.test(t.commands.test));return{ecosystem:t.stats.ecosystem||"unknown",languages:n,frameworks:e,packageManager:t.packageManager??void 0,keyLibraries:s,hasTests:i,hasDocker:t.stack.hasDocker===!0}}c(w,"buildStack");function x(t){return t?{test:t.test,lint:t.lint,build:t.build,dev:t.dev,install:t.install,format:t.format}:{}}c(x,"buildCommands");function O(t){let e=new Set;for(let n of M)t[n]&&e.add(z(n));return[...e].slice(0,16)}c(O,"collectKeyLibraries");function z(t){return{hono:"Hono",express:"Express",fastify:"Fastify",react:"React",next:"Next.js",vue:"Vue",vitest:"Vitest",jest:"Jest",typescript:"TypeScript",zod:"Zod","better-sqlite3":"better-sqlite3","@modelcontextprotocol/sdk":"MCP SDK","@modelcontextprotocol/client":"MCP SDK","@modelcontextprotocol/server":"MCP SDK",biome:"Biome",lefthook:"Lefthook","drizzle-orm":"Drizzle",prisma:"Prisma","@prisma/client":"Prisma"}[t]??t}c(z,"displayLibName");function D(t,e){let n=new Map;for(let s of[...t,...e])n.has(s.key)||n.set(s.key,s);return[...n.values()].slice(0,40)}c(D,"mergeConventions");function N(t,e){let n=new Map;for(let s of[...t,...e])n.has(s.key)||n.set(s.key,s);return[...n.values()].slice(0,40)}c(N,"mergePatterns");function H(t,e){let n=new Map;for(let s of[...t,...e])n.has(s.key)||n.set(s.key,s);return[...n.values()].slice(0,40)}c(H,"mergeAntiPatterns");function A(t){let e=[],n=new Set;for(let s of t){let o=s.trim();if(!o)continue;let i=o.toLowerCase();n.has(i)||(n.add(i),e.push(o))}return e}c(A,"unique");function K(t,e={}){if(!t)return null;let n=e.maxConventions??5,s=e.maxPatterns??4,o=e.maxAnti??3,i=t.payload,l=["## How this repo works (project style)",""],g=[i.stack.ecosystem!=="unknown"?i.stack.ecosystem:null,i.stack.languages.join(", ")||null,i.stack.frameworks.join(", ")||null,i.stack.keyLibraries.slice(0,6).join(", ")||null].filter(Boolean);if(g.length>0&&l.push(`**Stack:** ${g.join(" \xB7 ")}`),i.conventions.length>0){l.push("","**Conventions (match):**");for(let r of i.conventions.slice(0,n))l.push(`- ${r.rule}`)}if(i.patterns.length>0){l.push("","**Patterns (match):**");for(let r of i.patterns.slice(0,s))l.push(`- **${r.name}** \u2014 ${E(r.description,120)}`)}if(i.antiPatterns.length>0){l.push("","**Anti-patterns (avoid):**");for(let r of i.antiPatterns.slice(0,o))l.push(`- ${r.issue}${r.suggestion?` \u2192 ${E(r.suggestion,80)}`:""}`)}return i.conventions.length===0&&i.patterns.length===0&&i.antiPatterns.length===0&&l.push("","_No durable house patterns yet \u2014 open a neighbor file and match local idiom. Prefer `prjct sync` + structured analysis-save-llm JSON to enrich._"),l.push("",`_${t.summary}_`),l.join(`
9
- `)}c(K,"formatProjectStyleDigest");function E(t,e){let n=t.replace(/\s+/g," ").trim();return n.length>e?`${n.slice(0,e-1)}\u2026`:n}c(E,"truncate");export{q as a,_ as b,J as c,U as d,K as e};
@@ -1,24 +0,0 @@
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 C,b as Z}from"./chunk-MXHX44WF.mjs";import{a as Q}from"./chunk-SQW2B7NW.mjs";import{a as W}from"./chunk-5WAONIPX.mjs";import{a as X,d as Y}from"./chunk-OLQAMCYV.mjs";import"./chunk-NJ74RHNC.mjs";import{a as J}from"./chunk-WUOVBBPC.mjs";import"./chunk-KDNUQPAK.mjs";import{a as K}from"./chunk-5TBQNW2G.mjs";import{a as z}from"./chunk-ADYTBOCZ.mjs";import{a as O}from"./chunk-XV2LJVYB.mjs";import{a as V}from"./chunk-3UB6SFRA.mjs";import{a as L}from"./chunk-YHOZTAZH.mjs";import{b as F}from"./chunk-LF3S3MYE.mjs";import"./chunk-XSJ7SPVR.mjs";import{b as q}from"./chunk-Y7MZA2G4.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-NLL5AV2G.mjs";import{a as U,g as B}from"./chunk-NCLONKOT.mjs";import"./chunk-22GFTUER.mjs";import"./chunk-YQ55MHKL.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-KOGZCFBC.mjs";import"./chunk-BKJHD5JI.mjs";import"./chunk-33BHU4OM.mjs";import"./chunk-ZYCNW75E.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-CPR4FPXG.mjs";import"./chunk-3HGQPUKG.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-ZMLA5SKR.mjs";import"./chunk-3CKNJ5RA.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-TF6PN7IB.mjs";import{d as T}from"./chunk-XYKVWO23.mjs";import"./chunk-7PBWIO4K.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{b as v}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import{b as x}from"./chunk-D7DQABWO.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GVNMXVVA.mjs";import{h as j,i as S}from"./chunk-JGZ3QGWX.mjs";import{c as w}from"./chunk-QXCEBAIA.mjs";import"./chunk-GAOQHD5S.mjs";import{b}from"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import{d as H,g as lt}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{k as N,o as ut}from"./chunk-UH4MD3F3.mjs";import{b as M,p as at}from"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as u}from"./chunk-E66B27AL.mjs";import{createHash as A}from"node:crypto";import y from"node:fs/promises";import f from"node:path";var dt=15;function tt(e){let r=[],i=[];e.loop?.stopped&&e.loop.message&&(r.push("loop-hard-stop"),i.push(e.loop.message)),e.pressure?.level==="critical"&&e.pressure.cue?(r.push("context-pressure-critical"),i.push(e.pressure.cue)):e.pressure?.level==="warn"&&e.pressure.cue&&(r.push("context-pressure-warn"),i.push(e.pressure.cue)),e.qualityInject?.trim()&&(r.push("quality-ledger"),i.push(e.qualityInject.trim()));let t=e.turns??0,n=e.stuckThreshold??dt;if(!e.loop?.stopped&&t>=n&&(r.push("stuck-cycle"),i.push(`\u26A0 ${t} turns on this cycle and it is still open. If you are not nearly done, STOP looping: split it, ship the slice that works, or check in with the user \u2014 then \`prjct status done\`. A re-plan beats another grinding turn.`)),i.length===0)return{level:"ok",markdown:null,cues:[]};let s=r.some(g=>["loop-hard-stop","context-pressure-critical","context-pressure-warn"].includes(g)),a=r.some(g=>["quality-ledger","stuck-cycle"].includes(g)),c=s?"hard":a?"warn":"ok",m=c==="hard"?"# prjct: alignment (MUST \u2014 hard gate)":"# prjct: alignment (mid-cycle)",d=i.join(`
9
-
10
- `),o=r.includes("quality-ledger")&&!d.includes("prjct ship")?`
11
-
12
- _${U}_`:"";return{level:c,cues:r,markdown:`${m}
13
-
14
- ${d}${o}`}}u(tt,"buildAlignmentCard");lt();at();ut();var P=1500,pt=P+2100,et=15,mt=10,R=8,nt=420,gt=2,ft=15e3;var ht=new Set(["address","apply","check","continue","create","current","description","feedback","handle","merge","monitor","please","review","should","title","watch","write"]),E=new WeakMap,$=new Map;async function rt(e,r,i={}){let t=r!==void 0?r:await b.readConfig(e);if(!t?.projectId)return null;let n=yt(t,e,i),s=["# prjct: project state"];try{let c=await V(t.projectId,e);if(c.current){let d=st(c.current.startedAt);s.push(`- Active work cycle: "${c.current.description}" (${d}) [${c.current.label}]`);let{turns:o,loopVerdict:g,currentTask:l}=(()=>{try{let p=c.mainTaskRaw;return{turns:p?.turnCount??0,currentTask:p,loopVerdict:W(t,p)}}catch{return{turns:0,currentTask:null,loopVerdict:null}}})();!g?.stopped&&o>0&&o%mt===0&&o<et&&s.push(` \u21B3 Turn ${o} on this cycle \u2014 still advancing the goal? If stuck, re-plan or split; do not loop.`);try{let p=t.maxTokensPerCycle??0;if(p>0&&l){let h=(l.tokensIn??0)+(l.tokensOut??0);h>=p?s.push(` \u26A0 Token budget: ${h.toLocaleString()} of ${p.toLocaleString()} spent on this cycle. STOP growing it \u2014 ship the working slice, split the remainder into a new cycle, or check in with the user.`):h>=p*.8&&s.push(` \u21B3 Token budget: ${h.toLocaleString()} of ${p.toLocaleString()} (${Math.round(h/p*100)}%). Plan the close: prefer finishing over expanding scope.`)}}catch{}try{let p=c.current.startedAt;if(p){let h=H.get(t.projectId,`SELECT COUNT(DISTINCT json_extract(data, '$.file')) AS c
15
- FROM events WHERE type = 'memory.post_edit' AND timestamp >= ?`,p)?.c??0,I=q(h);I&&s.push(` ${I}`)}}catch{}try{let p=K(t,l),h=B(t.projectId),I=tt({loop:g,pressure:p,qualityInject:h,turns:o,stuckThreshold:et});I.markdown&&(s.push(""),s.push(I.markdown))}catch{}l?.ownerAgent&&s.push(`- Owner: ${l.ownerAgent}${l.ownerIdentity?`/${l.ownerIdentity}`:""}${l.yieldStatus==="yielded"?" (yielded \u2014 awaiting accept)":""}`)}let m=c.all.filter(d=>!d.isCurrent);m.length>0&&s.push(`- ${m.length} task(s) active in other workspace(s)`),!c.current&&m.length>0&&s.push("- This workspace idle but siblings busy \u2014 `prjct work` auto-isolates to a worktree when needed")}catch{}let a=await n;for(let c of a)c&&s.push(c);return s.length===1?null:s.join(`
16
- `)}u(rt,"buildProjectState");function yt(e,r,i={}){return Promise.all([i.skipHandoff?Promise.resolve(null):(async()=>{try{let{formatPendingHandoffCue:t}=await import("./agent-switch-I4MTVE56.mjs"),n=t(e.projectId);return n?`- ${n.replace(/\n/g,`
17
- - `)}`:null}catch{return null}})(),(async()=>{try{let t=await L.getActiveTasks(e.projectId);return t.length>0?`- Pending: ${t.length} \xB7 Next: "${t[0].description}"`:null}catch{return null}})(),(async()=>{try{if(!await N(f.join(r,".git")))return null;let t=await vt(r);if(!t.branch)return null;let n=[];t.modified>0&&n.push(`${t.modified} modified`),t.staged>0&&n.push(`${t.staged} staged`),t.untracked>0&&n.push(`${t.untracked} untracked`);let s=n.length>0?` \u2014 working tree ${n.join(", ")}`:"",a=t.ahead>0?`${s?",":" \u2014"} ${t.ahead} unpushed`:"";return`- Branch: ${t.branch}${s}${a}`}catch{return null}})(),(async()=>{try{let t=await O.getRecent(e.projectId,1);if(t.length===0)return null;let n=t[0],s=st(n.shippedAt??"");return`- Last ship: ${n.version?`v${n.version}`:n.name} (${s})`}catch{return null}})(),(async()=>{try{let t=v.countByType(e.projectId,"inbox");return t>0?`- Inbox: ${t} items pending`:null}catch{return null}})()])}u(yt,"collectSecondarySignals");function It(e){return e.type==="voice"||e.type==="glossary"?!0:e.type==="example"&&!!e.tags.domain&&(e.tags.polarity==="good"||e.tags.polarity==="bad")}u(It,"isValidGuidanceEntry");function kt(e,r){try{let i=C(r),t=j(r).filter(o=>o.length>=5&&!ht.has(o)),n=t.length>0?v.searchFts(e,t,R*2):[],s=i?v.recall(e,{types:["voice","glossary","example"],limit:R*2}).filter(o=>o.tags.domain==="delivery"||o.tags.domain===i):[],a=new Map([...n,...s].map(o=>[o.id,o])),c=new Map([["voice",0],["glossary",1],["example",2]]),m=[...a.values()].filter(It).sort((o,g)=>(c.get(o.type)??3)-(c.get(g.type)??3)).slice(0,gt);if(m.length===0)return null;let d=["# prjct: selective guidance"];for(let o of m){let g=o.type==="example"?` ${o.tags.polarity}/${o.tags.domain}`:o.tags.domain?` ${o.tags.domain}`:"",l=nt-d.join(`
18
- `).length-g.length-8;if(l<24)break;let p=S(o.content.replace(/\s+/g," ").trim(),Math.min(150,l));d.push(`- ${o.type}${g}: ${p}`)}return d.length===1?null:{text:S(d.join(`
19
- `),nt),memoryIds:m.slice(0,d.length-1).map(o=>o.id)}}catch{return null}}u(kt,"buildSelectiveGuidance");function wt(e,r,i=P){if(!r)return e;let t=e?`${e}
20
-
21
- ${r}`:r;return t.length<=i?t:null}u(wt,"appendPromptSection");function it(e,r){try{let i=j(r);if(i.length===0)return null;let t=v.searchFts(e,i,R),n=t.find(s=>s.type==="decision"||s.type==="gotcha"||s.type==="fact")??t.find(s=>s.type==="anti-pattern"||s.type==="pattern")??t.find(s=>s.type==="gotcha"||s.type==="anti-pattern");return n?n.type==="decision"||n.type==="gotcha"||n.type==="fact"?{cue:`> Tip\u2192user (SoT): ${T(n)} \`${n.id}\` \u2014 say it briefly in chat; binding \u2014 do not contradict without superseding`,memoryId:n.id}:n.type==="anti-pattern"||n.type==="pattern"?{cue:`> Tip\u2192user (suggest): ${T(n)} \`${n.id}\` \u2014 propose the live change in chat, then apply when editing`,memoryId:n.id}:{cue:`> Tip\u2192user: ${T(n)} \`${n.id}\``,memoryId:n.id}:null}catch{return null}}u(it,"buildTopicalCueResult");function ie(e,r,i){return it(e,r)?.cue??null}u(ie,"buildTopicalCue");var k=new Map,D={skipDiskSnapshotOnce:!1};function se(){k.clear(),D.skipDiskSnapshotOnce=!0}u(se,"_resetGitSnapshotCacheForTests");async function vt(e){let r=await y.stat(f.join(e,".git","index")).then(a=>a.mtimeMs).catch(()=>0),i=k.get(e);if(i&&i.expiresAt>Date.now()&&i.indexMtimeMs===r)return i.snapshot;let t=St(e);if(!i&&!D.skipDiskSnapshotOnce){let a=await y.readFile(t,"utf-8").then(c=>JSON.parse(c)).catch(()=>null);if(a&&a.expiresAt>Date.now()&&a.indexMtimeMs===r)return k.set(e,a),a.snapshot}D.skipDiskSnapshotOnce=!1;let n=await Pt(e);k.size>32&&k.clear();let s={snapshot:n,expiresAt:Date.now()+ft,indexMtimeMs:r};return k.set(e,s),y.mkdir(f.dirname(t),{recursive:!0}).then(()=>y.writeFile(t,JSON.stringify(s))).catch(()=>{}),n}u(vt,"captureGit");function St(e){let r=A("sha1").update(f.resolve(e)).digest("hex").slice(0,16);return f.join(w.runDir(),`prompt-git-${r}.json`)}u(St,"gitSnapshotPath");function _(e,r){let i=A("sha1").update(f.resolve(r)).digest("hex").slice(0,12);return`${e.replace(/[^a-zA-Z0-9._-]/g,"_")}-${i}`}u(_,"promptHashKey");async function bt(e,r,i){let t=_(e,r),n=A("sha256").update(i).digest("hex");if($.get(t)===n)return null;$.size>64&&$.clear(),$.set(t,n);let s=f.join(w.runDir(),`prompt-state-${t}.hash`);return(await y.readFile(s,"utf-8").catch(()=>"")).trim()===n?null:(await y.mkdir(f.dirname(s),{recursive:!0}).then(()=>y.writeFile(s,n)).catch(()=>{}),i)}u(bt,"dedupePromptPayload");function Tt(e,r){return f.join(w.runDir(),`prompt-afteremit-${_(e,r)}.json`)}u(Tt,"promptAfterEmitStampPath");async function $t(e,r,i,t){let n=Tt(e,r),s=A("sha256").update(i).digest("hex");await y.mkdir(f.dirname(n),{recursive:!0}).then(()=>y.writeFile(n,JSON.stringify({hash:s,record:t}))).catch(()=>{})}u($t,"persistPromptAfterEmit");async function At(e,r){try{let i=_(e,r),t=w.runDir(),[n,s]=await Promise.all([y.readFile(f.join(t,`prompt-afteremit-${i}.json`),"utf-8"),y.readFile(f.join(t,`prompt-state-${i}.hash`),"utf-8")]),a=JSON.parse(n),c=a.record;return!c||a.hash!==s.trim()||c.projectId!==e||!Array.isArray(c.surfacedIds)?null:c}catch{return null}}u(At,"readPersistedPromptAfterEmit");async function Pt(e){let r={branch:"",modified:0,staged:0,untracked:0,ahead:0},i=u(async o=>{try{return(await M("git",o,{cwd:e,timeout:2e3})).stdout.trim()}catch{return""}},"safe"),[t,n,s]=await Promise.all([i(["branch","--show-current"]),i(["status","--porcelain"]),i(["rev-list","--count","@{u}..HEAD"])]);if(!t)return r;let{modified:a,staged:c,untracked:m}=n.split(`
22
- `).filter(Boolean).reduce((o,g)=>{let l=g.slice(0,2);return l.startsWith("??")?o.untracked++:(l[0]!==" "&&l[0]!=="?"&&o.staged++,l[1]!==" "&&o.modified++),o},{modified:0,staged:0,untracked:0}),d=Number.parseInt(s,10)||0;return{branch:t,modified:a,staged:c,untracked:m,ahead:d}}u(Pt,"captureGitUncached");function st(e){if(!e)return"unknown";let r=Date.parse(e);if(Number.isNaN(r))return"unknown";let i=Math.max(0,Math.floor((Date.now()-r)/864e5));return i<1?"today":i<2?"yesterday":i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}u(st,"formatRelative");function ot(e,r,i,t=P){let n=it(e,r),s=F(e,r),a=Z(r),c=kt(e,r),m=[n?.cue,a,c?.text,s].filter(l=>!!l).reduce((l,p)=>wt(l,p,t)??l,S(i,t)),d=!!(c?.text&&m.includes(c.text)),g=!!(a&&m.includes(a))?`delivery:${C(r)??"unknown"}`:d?c?.memoryIds[0]??null:null;return{prioritized:m,cueResult:n,guidance:c,guidanceIncluded:d,guidanceRuleId:g}}u(ot,"computePromptGuidance");function oe(e=process.cwd(),r){return J({event:"UserPromptSubmit",projectPath:e,build:u(async(i,t,n)=>{let s=(i.prompt??"").trim();if(!s)return null;let a=await b.readConfig(t);if(!a?.projectId)return null;let c=n==="kimi"?await Y(a.projectId,i.session_id,n).catch(()=>null):null,m=await rt(t,a,{skipHandoff:!!c}),d=c?await X(t,a,{digest:c==="digest"}).catch(()=>null):null;if(!m&&!d)return null;let o=[d,m].filter(Boolean).join(`
23
-
24
- `),g=d?pt:P,{prioritized:l,cueResult:p,guidance:h,guidanceIncluded:I,guidanceRuleId:ct}=ot(a.projectId,s,o,g),G={projectId:a.projectId,projectPath:t,bumpTurn:!!m?.includes("Active work cycle:"),surfacedIds:[...p?[p.memoryId]:[],...I?h?.memoryIds??[]:[]],guidanceRuleId:ct};return E.set(i,G),await $t(a.projectId,t,l,G),bt(a.projectId,t,l)},"build"),afterEmit:u(async(i,t)=>{let n=E.get(i)??await jt(i,t);E.delete(i),n&&await Promise.all([n.bumpTurn?x.bumpTurnCount(n.projectId).then(()=>{}):Promise.resolve(),n.surfacedIds.length>0?z(n.projectId,n.projectPath,n.surfacedIds):Promise.resolve(),n.guidanceRuleId?Promise.resolve(Q.recordGuidanceActivation(n.projectId,{ruleId:n.guidanceRuleId})).then(()=>{}):Promise.resolve()])},"afterEmit")},r)}u(oe,"runPromptHook");async function jt(e,r){let i=(e.prompt??"").trim();if(!i)return null;let t=await b.readConfig(r).catch(()=>null);if(!t?.projectId)return null;let n=await At(t.projectId,r);if(n)return n;let[s,a]=await Promise.all([x.getCurrentTask(t.projectId).catch(()=>null),rt(r,t)]),{cueResult:c,guidance:m,guidanceIncluded:d,guidanceRuleId:o}=ot(t.projectId,i,a??"");return{projectId:t.projectId,projectPath:r,bumpTurn:!!s,surfacedIds:[...c?[c.memoryId]:[],...d?m?.memoryIds??[]:[]],guidanceRuleId:o}}u(jt,"rebuildPromptAfterEmit");export{se as _resetGitSnapshotCacheForTests,Z as buildDeliveryGuidance,rt as buildProjectState,kt as buildSelectiveGuidance,ie as buildTopicalCue,C as classifyDeliveryIntent,oe as runPromptHook};