prjct-cli 3.93.0 → 3.94.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 (254) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/bin/hook-chunks/{agent-switch-A6AYZRJ5.mjs → agent-switch-2U2LOBGR.mjs} +1 -1
  3. package/dist/bin/hook-chunks/{analysis-WPRPBYHY.mjs → analysis-N4NYGIG3.mjs} +3 -3
  4. package/dist/bin/hook-chunks/{auth-config-WNUARXTJ.mjs → auth-config-SP4PBALR.mjs} +1 -1
  5. package/dist/bin/hook-chunks/auto-flush-BN6L6QHO.mjs +8 -0
  6. package/dist/bin/hook-chunks/{auto-updater-EHRRMCYY.mjs → auto-updater-4TIXYSEX.mjs} +1 -1
  7. package/dist/bin/hook-chunks/capture-gate-FRF2G3IG.mjs +8 -0
  8. package/dist/bin/hook-chunks/{chunk-3WY2AYPE.mjs → chunk-27XFSCOE.mjs} +4 -4
  9. package/dist/bin/hook-chunks/chunk-2HB2JHQE.mjs +69 -0
  10. package/dist/bin/hook-chunks/{chunk-LFY5O66D.mjs → chunk-3VWBNLBC.mjs} +1 -1
  11. package/dist/bin/hook-chunks/{chunk-V37VTXDW.mjs → chunk-4KVPAHFV.mjs} +1 -1
  12. package/dist/bin/hook-chunks/{chunk-PWMMLXZS.mjs → chunk-4O4D6DV7.mjs} +2 -2
  13. package/dist/bin/hook-chunks/chunk-4SKJWNKE.mjs +11 -0
  14. package/dist/bin/hook-chunks/{chunk-3LG3ACQV.mjs → chunk-5EQLQ7GF.mjs} +1 -1
  15. package/dist/bin/hook-chunks/{chunk-HZIORCPO.mjs → chunk-66GE3IHX.mjs} +1 -1
  16. package/dist/bin/hook-chunks/{chunk-MEQS4VPO.mjs → chunk-6RLCUGGG.mjs} +1 -1
  17. package/dist/bin/hook-chunks/{chunk-BISPGBNN.mjs → chunk-6UH244CC.mjs} +1 -1
  18. package/dist/bin/hook-chunks/chunk-7GNWHWOO.mjs +26 -0
  19. package/dist/bin/hook-chunks/chunk-7JEKBJAP.mjs +9 -0
  20. package/dist/bin/hook-chunks/{chunk-LLQUB6YR.mjs → chunk-7O6OMD4X.mjs} +2 -2
  21. package/dist/bin/hook-chunks/chunk-7YT2FGO7.mjs +8 -0
  22. package/dist/bin/hook-chunks/{chunk-6WXGOGAN.mjs → chunk-AVRNHROK.mjs} +1 -1
  23. package/dist/bin/hook-chunks/chunk-AZHE4VOM.mjs +8 -0
  24. package/dist/bin/hook-chunks/{chunk-7OZDWT6C.mjs → chunk-AZYQFRPJ.mjs} +1 -1
  25. package/dist/bin/hook-chunks/chunk-BCAHWZH7.mjs +8 -0
  26. package/dist/bin/hook-chunks/{chunk-Q5I2UPD6.mjs → chunk-C3W2HLJT.mjs} +1 -1
  27. package/dist/bin/hook-chunks/{chunk-ZX2KFQV5.mjs → chunk-D6IONKRA.mjs} +1 -1
  28. package/dist/bin/hook-chunks/chunk-DRGI5UHQ.mjs +10 -0
  29. package/dist/bin/hook-chunks/{chunk-7SI6X3Z7.mjs → chunk-EHEQOF6Z.mjs} +1 -1
  30. package/dist/bin/hook-chunks/{chunk-P5ZYAXSE.mjs → chunk-EMTCZG5I.mjs} +1 -1
  31. package/dist/bin/hook-chunks/{chunk-7AN7VQHN.mjs → chunk-EQ5KNMLG.mjs} +1 -1
  32. package/dist/bin/hook-chunks/{chunk-742LOGHA.mjs → chunk-F4T7IAA7.mjs} +1 -1
  33. package/dist/bin/hook-chunks/{chunk-ODWWIFSN.mjs → chunk-FEFP6JOL.mjs} +1 -1
  34. package/dist/bin/hook-chunks/{chunk-2OU2MKNS.mjs → chunk-FX6VHIKB.mjs} +1 -1
  35. package/dist/bin/hook-chunks/{chunk-P4J6TY2L.mjs → chunk-GFY4GY3Z.mjs} +1 -1
  36. package/dist/bin/hook-chunks/{chunk-PSSR7LSW.mjs → chunk-H4CA3XZ6.mjs} +1 -1
  37. package/dist/bin/hook-chunks/chunk-HHIGNKDO.mjs +8 -0
  38. package/dist/bin/hook-chunks/chunk-HNEKXKOI.mjs +16 -0
  39. package/dist/bin/hook-chunks/{chunk-45I2C2UB.mjs → chunk-HRWXMF7P.mjs} +1 -1
  40. package/dist/bin/hook-chunks/{chunk-TSCXXNUF.mjs → chunk-IHECXD2M.mjs} +1 -1
  41. package/dist/bin/hook-chunks/chunk-IKIB42F7.mjs +31 -0
  42. package/dist/bin/hook-chunks/chunk-INXNK57E.mjs +8 -0
  43. package/dist/bin/hook-chunks/{chunk-WDGDFXSB.mjs → chunk-J6TAD3OZ.mjs} +1 -1
  44. package/dist/bin/hook-chunks/chunk-JAMSIKDE.mjs +9 -0
  45. package/dist/bin/hook-chunks/{chunk-CREPUNOS.mjs → chunk-JCYXFHQZ.mjs} +1 -1
  46. package/dist/bin/hook-chunks/chunk-JMCMTX6U.mjs +8 -0
  47. package/dist/bin/hook-chunks/{chunk-D7TRY3CO.mjs → chunk-JPSJWCFD.mjs} +1 -1
  48. package/dist/bin/hook-chunks/{chunk-QDQ7DTDV.mjs → chunk-JR542RI2.mjs} +1 -1
  49. package/dist/bin/hook-chunks/chunk-JUZ5LNDI.mjs +14 -0
  50. package/dist/bin/hook-chunks/{chunk-HDHVBB6Q.mjs → chunk-KG7Z6OMK.mjs} +1 -1
  51. package/dist/bin/hook-chunks/{chunk-OGOCHZ3S.mjs → chunk-KOCROTRM.mjs} +1 -1
  52. package/dist/bin/hook-chunks/{chunk-75UJIVMO.mjs → chunk-KOGZCFBC.mjs} +1 -1
  53. package/dist/bin/hook-chunks/{chunk-ZTZTVBAZ.mjs → chunk-LNB2GLYI.mjs} +1 -1
  54. package/dist/bin/hook-chunks/chunk-M5E2YOZ4.mjs +8 -0
  55. package/dist/bin/hook-chunks/{chunk-HT3ZCLLJ.mjs → chunk-MHQTGU45.mjs} +1 -1
  56. package/dist/bin/hook-chunks/{chunk-KXWBIQGJ.mjs → chunk-MI3JEFON.mjs} +2 -2
  57. package/dist/bin/hook-chunks/chunk-NBKEOLDH.mjs +18 -0
  58. package/dist/bin/hook-chunks/{chunk-EM6ZDJAK.mjs → chunk-NCOOKPXX.mjs} +1 -1
  59. package/dist/bin/hook-chunks/chunk-NHIWYDQD.mjs +8 -0
  60. package/dist/bin/hook-chunks/chunk-NUJASVHN.mjs +18 -0
  61. package/dist/bin/hook-chunks/chunk-NWIQNII6.mjs +11 -0
  62. package/dist/bin/hook-chunks/{chunk-UK7D7EFV.mjs → chunk-NWZEBCTC.mjs} +2 -2
  63. package/dist/bin/hook-chunks/{chunk-6EWGHM32.mjs → chunk-OENWCYLF.mjs} +1 -1
  64. package/dist/bin/hook-chunks/{chunk-3JUE6MNF.mjs → chunk-OIU4Y5WL.mjs} +1 -1
  65. package/dist/bin/hook-chunks/chunk-OUAS3LZ3.mjs +8 -0
  66. package/dist/bin/hook-chunks/{chunk-X5RDLFPM.mjs → chunk-OWOPA2O7.mjs} +1 -1
  67. package/dist/bin/hook-chunks/{chunk-NLG2EW6M.mjs → chunk-OZJ6UKKP.mjs} +1 -1
  68. package/dist/bin/hook-chunks/chunk-PUHX3ECX.mjs +11 -0
  69. package/dist/bin/hook-chunks/chunk-Q3EYM4GJ.mjs +19 -0
  70. package/dist/bin/hook-chunks/{chunk-4OYUJTPR.mjs → chunk-Q3Z53QTH.mjs} +3 -3
  71. package/dist/bin/hook-chunks/{chunk-ZZ65CN5F.mjs → chunk-QPRNRLG6.mjs} +1 -1
  72. package/dist/bin/hook-chunks/chunk-QWQFF2UG.mjs +10 -0
  73. package/dist/bin/hook-chunks/{chunk-DMXFGLZE.mjs → chunk-QYEASMFV.mjs} +1 -1
  74. package/dist/bin/hook-chunks/chunk-R4ILCXKE.mjs +8 -0
  75. package/dist/bin/hook-chunks/{chunk-4WHS7CO7.mjs → chunk-S7HQQILD.mjs} +1 -1
  76. package/dist/bin/hook-chunks/chunk-SDUS2AT7.mjs +8 -0
  77. package/dist/bin/hook-chunks/chunk-T2FCU3ZS.mjs +12 -0
  78. package/dist/bin/hook-chunks/{chunk-A5RNWWTH.mjs → chunk-TFCLMTJ5.mjs} +1 -1
  79. package/dist/bin/hook-chunks/{chunk-AUUWQH3S.mjs → chunk-TG5CQJD5.mjs} +1 -1
  80. package/dist/bin/hook-chunks/{chunk-GIMUTVLP.mjs → chunk-TKWAFYF7.mjs} +1 -1
  81. package/dist/bin/hook-chunks/{chunk-YUOTOCKK.mjs → chunk-TYEAIX3X.mjs} +1 -1
  82. package/dist/bin/hook-chunks/{chunk-AOPJ4Z6O.mjs → chunk-UA4Z5TGG.mjs} +1 -1
  83. package/dist/bin/hook-chunks/chunk-UH4MD3F3.mjs +9 -0
  84. package/dist/bin/hook-chunks/chunk-V2BSS7HW.mjs +36 -0
  85. package/dist/bin/hook-chunks/{chunk-DLHSCKBJ.mjs → chunk-VWOIUTAX.mjs} +1 -1
  86. package/dist/bin/hook-chunks/{chunk-ACKEPXP4.mjs → chunk-X2AGNDGD.mjs} +1 -1
  87. package/dist/bin/hook-chunks/{chunk-L4376X2P.mjs → chunk-XE4MJNBQ.mjs} +1 -1
  88. package/dist/bin/hook-chunks/{chunk-2NMSEZTQ.mjs → chunk-XFQ7NNLN.mjs} +1 -1
  89. package/dist/bin/hook-chunks/{chunk-SOPRYWUY.mjs → chunk-XS45K7ZQ.mjs} +1 -1
  90. package/dist/bin/hook-chunks/chunk-Y3J7UUMR.mjs +47 -0
  91. package/dist/bin/hook-chunks/{chunk-HIFIDMH5.mjs → chunk-Y4DUB7UN.mjs} +2 -2
  92. package/dist/bin/hook-chunks/{chunk-6IKHMK2U.mjs → chunk-YQ55MHKL.mjs} +1 -1
  93. package/dist/bin/hook-chunks/{chunk-QK2IMCDC.mjs → chunk-YUKGWWL7.mjs} +1 -1
  94. package/dist/bin/hook-chunks/chunk-ZJXH76Q5.mjs +11 -0
  95. package/dist/bin/hook-chunks/{chunk-RXD7MHJ6.mjs → chunk-ZMKTR2IO.mjs} +1 -1
  96. package/dist/bin/hook-chunks/{chunk-54LH63LM.mjs → chunk-ZMLA5SKR.mjs} +1 -0
  97. package/dist/bin/hook-chunks/client-ERZ5CM3D.mjs +10 -0
  98. package/dist/bin/hook-chunks/code-graph-cloud-4GRWQSUK.mjs +8 -0
  99. package/dist/bin/hook-chunks/{codex-skill-ZCAUF2RM.mjs → codex-skill-6DYQMPDJ.mjs} +1 -1
  100. package/dist/bin/hook-chunks/{command-installer-LNK7WC5I.mjs → command-installer-MF4KUM3X.mjs} +1 -1
  101. package/dist/bin/hook-chunks/{config-manager-4VWDBPMG.mjs → config-manager-2VZPHUDG.mjs} +1 -1
  102. package/dist/bin/hook-chunks/{content-bound-stamp-72EQVZLP.mjs → content-bound-stamp-OG2KKN3L.mjs} +1 -1
  103. package/dist/bin/hook-chunks/{context7-service-4C6VNJUS.mjs → context7-service-V7CIDF3Q.mjs} +1 -1
  104. package/dist/bin/hook-chunks/custom-workflow-storage-UOBQXY42.mjs +8 -0
  105. package/dist/bin/hook-chunks/cwd-changed-J6O46KS7.mjs +8 -0
  106. package/dist/bin/hook-chunks/{database-SLDTQXWG.mjs → database-XYKQF3KR.mjs} +1 -1
  107. package/dist/bin/hook-chunks/{delivery-geometry-VHCURJ7E.mjs → delivery-geometry-WYOEMKMO.mjs} +1 -1
  108. package/dist/bin/hook-chunks/{detect-changes-M2OYIOE5.mjs → detect-changes-DFRJOOB3.mjs} +1 -1
  109. package/dist/bin/hook-chunks/{detection-MEYHME4X.mjs → detection-QRVSNMKL.mjs} +1 -1
  110. package/dist/bin/hook-chunks/developer-evolution-SLC34HUU.mjs +12 -0
  111. package/dist/bin/hook-chunks/distill-U2LJGUG3.mjs +8 -0
  112. package/dist/bin/hook-chunks/{editors-config-3N6VREZR.mjs → editors-config-6XFYIOE6.mjs} +1 -1
  113. package/dist/bin/hook-chunks/enriched-recall-X6RDNNIE.mjs +8 -0
  114. package/dist/bin/hook-chunks/exec-2P5VOBHM.mjs +8 -0
  115. package/dist/bin/hook-chunks/format-ALUX4QSI.mjs +8 -0
  116. package/dist/bin/hook-chunks/{git-helpers-6JLP2OJZ.mjs → git-helpers-HELM6DXJ.mjs} +1 -1
  117. package/dist/bin/hook-chunks/{judgment-ledger-storage-UKROWRVA.mjs → judgment-ledger-storage-SCGU3URM.mjs} +1 -1
  118. package/dist/bin/hook-chunks/{judgment-orchestrator-UFGNBTEK.mjs → judgment-orchestrator-BYPG65RS.mjs} +1 -1
  119. package/dist/bin/hook-chunks/judgment-receipt-GWSSCLAB.mjs +8 -0
  120. package/dist/bin/hook-chunks/land-cue-MMISX2BI.mjs +9 -0
  121. package/dist/bin/hook-chunks/land-synthesis-WG5JAS7B.mjs +8 -0
  122. package/dist/bin/hook-chunks/legacy-crew-sweep-2WSO5KEB.mjs +24 -0
  123. package/dist/bin/hook-chunks/memory-index-QK5QJOFJ.mjs +8 -0
  124. package/dist/bin/hook-chunks/notification-MPVWVV52.mjs +8 -0
  125. package/dist/bin/hook-chunks/{pack-integrity-62XJ5A75.mjs → pack-integrity-XRYOROK5.mjs} +1 -1
  126. package/dist/bin/hook-chunks/{pack-manager-K3PQ7MCS.mjs → pack-manager-WWGQNJDQ.mjs} +1 -1
  127. package/dist/bin/hook-chunks/{package-legitimacy-HXC4L73B.mjs → package-legitimacy-MIR3VZSF.mjs} +1 -1
  128. package/dist/bin/hook-chunks/{path-manager-F2HE2GGK.mjs → path-manager-ZR5RAKTK.mjs} +1 -1
  129. package/dist/bin/hook-chunks/{planning-WMLFXZMA.mjs → planning-S55KBPN2.mjs} +2 -2
  130. package/dist/bin/hook-chunks/post-edit-QMHSZHDN.mjs +8 -0
  131. package/dist/bin/hook-chunks/{pr-convention-7UGI7TFA.mjs → pr-convention-5NPXQJ2R.mjs} +1 -1
  132. package/dist/bin/hook-chunks/pre-bash-RAM6L3G4.mjs +11 -0
  133. package/dist/bin/hook-chunks/pre-commit-736ZLMDL.mjs +8 -0
  134. package/dist/bin/hook-chunks/pre-edit-GZ4QJ2MU.mjs +11 -0
  135. package/dist/bin/hook-chunks/pre-package-LCIAWWGK.mjs +8 -0
  136. package/dist/bin/hook-chunks/pre-search-J5EOFMYN.mjs +9 -0
  137. package/dist/bin/hook-chunks/pre-secrets-TSUMTXHH.mjs +8 -0
  138. package/dist/bin/hook-chunks/{precision-judgment-WPTCNTGV.mjs → precision-judgment-TT3DRNAX.mjs} +1 -1
  139. package/dist/bin/hook-chunks/{prjct-md-Q6C5YNI3.mjs → prjct-md-T2DG236Y.mjs} +1 -1
  140. package/dist/bin/hook-chunks/{project-agent-surfaces-3BBZIQNI.mjs → project-agent-surfaces-VRY22I66.mjs} +1 -1
  141. package/dist/bin/hook-chunks/{project-file-inventory-ZAPKPKY6.mjs → project-file-inventory-5DEN5VLF.mjs} +1 -1
  142. package/dist/bin/hook-chunks/project-memory-KKEMTEMP.mjs +8 -0
  143. package/dist/bin/hook-chunks/project-style-evolution-7MAUSED2.mjs +8 -0
  144. package/dist/bin/hook-chunks/{prompt-AYY7BZFG.mjs → prompt-DVF6V2X2.mjs} +7 -7
  145. package/dist/bin/hook-chunks/{velocity-storage-UPW6TLK6.mjs → publish-helper-G54XQV5K.mjs} +1 -1
  146. package/dist/bin/hook-chunks/purge-MC5LFSAO.mjs +8 -0
  147. package/dist/bin/hook-chunks/retention-LWETHQX3.mjs +8 -0
  148. package/dist/bin/hook-chunks/sdd-5UCVX43H.mjs +10 -0
  149. package/dist/bin/hook-chunks/session-continuity-RKNAJJHR.mjs +11 -0
  150. package/dist/bin/hook-chunks/session-start-MFMFKUPK.mjs +8 -0
  151. package/dist/bin/hook-chunks/setup-WQRJ6TQL.mjs +141 -0
  152. package/dist/bin/hook-chunks/{shipping-HV5IAM2J.mjs → shipping-5D5LTJ3P.mjs} +5 -5
  153. package/dist/bin/hook-chunks/{skill-index-OOVAXHYJ.mjs → skill-index-RAVJMC4P.mjs} +1 -1
  154. package/dist/bin/hook-chunks/{spec-context-inference-UBHJLOIJ.mjs → spec-context-inference-7DDSTRTV.mjs} +1 -1
  155. package/dist/bin/hook-chunks/{spec-service-TA4Q5S3X.mjs → spec-service-LAO5Z2M5.mjs} +2 -2
  156. package/dist/bin/hook-chunks/spec-task-breakdown-K3GMQKGH.mjs +8 -0
  157. package/dist/bin/hook-chunks/state-storage-EIFGUO7X.mjs +8 -0
  158. package/dist/bin/hook-chunks/stop-RYLI4FGF.mjs +16 -0
  159. package/dist/bin/hook-chunks/subagent-start-CCUPSANT.mjs +8 -0
  160. package/dist/bin/hook-chunks/subagent-stop-RBD2OILE.mjs +8 -0
  161. package/dist/bin/hook-chunks/{surface-attribution-HYCBHBTC.mjs → surface-attribution-K37N2NK7.mjs} +1 -1
  162. package/dist/bin/hook-chunks/symbol-graph-BKQIMFRG.mjs +8 -0
  163. package/dist/bin/hook-chunks/{sync-analyzer-FKC57RTV.mjs → sync-analyzer-6U5GHYV3.mjs} +1 -1
  164. package/dist/bin/hook-chunks/{sync-client-DJWOG2ZQ.mjs → sync-client-EGBMWF3J.mjs} +1 -1
  165. package/dist/bin/hook-chunks/{sync-cursor-storage-2VKG757H.mjs → sync-cursor-storage-E3LMZISA.mjs} +1 -1
  166. package/dist/bin/hook-chunks/{task-orchestration-MLOCR7GA.mjs → task-orchestration-2ZYE5M6J.mjs} +1 -1
  167. package/dist/bin/hook-chunks/{task-overview-6ZQKJGSH.mjs → task-overview-ITY5OSHX.mjs} +1 -1
  168. package/dist/bin/hook-chunks/task-service-XREJLWEF.mjs +8 -0
  169. package/dist/bin/hook-chunks/tdd-7S55S5C3.mjs +10 -0
  170. package/dist/bin/hook-chunks/{template-loader-SO6OHPJI.mjs → template-loader-SCM4C2A3.mjs} +1 -1
  171. package/dist/bin/hook-chunks/{trust-boundary-ERMDF2C5.mjs → trust-boundary-EX65SUYR.mjs} +1 -1
  172. package/dist/bin/hook-chunks/{usefulness-253CZLNY.mjs → usefulness-SCH5ARGV.mjs} +1 -1
  173. package/dist/bin/hook-chunks/{vault-retire-notice-GRT3QRLZ.mjs → vault-retire-notice-HT756AND.mjs} +1 -1
  174. package/dist/bin/hook-chunks/velocity-storage-47CF3XWZ.mjs +8 -0
  175. package/dist/bin/hook-chunks/weak-model-mode-FLCEQ2BV.mjs +8 -0
  176. package/dist/bin/hook-chunks/work-graph-JQHVVXIZ.mjs +49 -0
  177. package/dist/bin/hook-chunks/work-scope-CDLSZ4U5.mjs +8 -0
  178. package/dist/bin/hook-chunks/{workspace-occupancy-UVIRHY5Z.mjs → workspace-occupancy-UUW4UGGB.mjs} +1 -1
  179. package/dist/bin/hook-chunks/{worktree-service-XGRN5TTE.mjs → worktree-service-AS7JVBK5.mjs} +1 -1
  180. package/dist/bin/prjct-core.mjs +720 -732
  181. package/dist/bin/prjct-hooks.mjs +2 -2
  182. package/dist/daemon/entry.mjs +638 -647
  183. package/dist/mcp/server.mjs +310 -312
  184. package/package.json +1 -1
  185. package/dist/bin/hook-chunks/auto-flush-5D4PKOMM.mjs +0 -8
  186. package/dist/bin/hook-chunks/capture-gate-EOOSAGAP.mjs +0 -8
  187. package/dist/bin/hook-chunks/chunk-4DDCWMI6.mjs +0 -8
  188. package/dist/bin/hook-chunks/chunk-4KY2EHXS.mjs +0 -9
  189. package/dist/bin/hook-chunks/chunk-A7SGMNOK.mjs +0 -11
  190. package/dist/bin/hook-chunks/chunk-AKIN5WSQ.mjs +0 -9
  191. package/dist/bin/hook-chunks/chunk-BNWB77U5.mjs +0 -9
  192. package/dist/bin/hook-chunks/chunk-CQHPIYNM.mjs +0 -8
  193. package/dist/bin/hook-chunks/chunk-CTWZQ7YI.mjs +0 -8
  194. package/dist/bin/hook-chunks/chunk-DV7KV2O4.mjs +0 -38
  195. package/dist/bin/hook-chunks/chunk-EHP4DYVQ.mjs +0 -71
  196. package/dist/bin/hook-chunks/chunk-FGQZ62ZP.mjs +0 -47
  197. package/dist/bin/hook-chunks/chunk-HJ4HEI45.mjs +0 -8
  198. package/dist/bin/hook-chunks/chunk-J6JZ4PQA.mjs +0 -18
  199. package/dist/bin/hook-chunks/chunk-JRKGG2E3.mjs +0 -8
  200. package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +0 -13
  201. package/dist/bin/hook-chunks/chunk-LT5WSSQO.mjs +0 -8
  202. package/dist/bin/hook-chunks/chunk-MHRMV4WI.mjs +0 -31
  203. package/dist/bin/hook-chunks/chunk-N5WOHG36.mjs +0 -8
  204. package/dist/bin/hook-chunks/chunk-NJAMZSHM.mjs +0 -26
  205. package/dist/bin/hook-chunks/chunk-NWY5M34K.mjs +0 -12
  206. package/dist/bin/hook-chunks/chunk-OB5GRS7T.mjs +0 -18
  207. package/dist/bin/hook-chunks/chunk-SVZHJZ5T.mjs +0 -9
  208. package/dist/bin/hook-chunks/chunk-UB53HQMG.mjs +0 -14
  209. package/dist/bin/hook-chunks/chunk-UBMIPWJR.mjs +0 -19
  210. package/dist/bin/hook-chunks/chunk-VPPHD762.mjs +0 -11
  211. package/dist/bin/hook-chunks/chunk-VV7VNUTF.mjs +0 -16
  212. package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +0 -8
  213. package/dist/bin/hook-chunks/client-SKFMAUI5.mjs +0 -10
  214. package/dist/bin/hook-chunks/code-graph-cloud-65GCWNII.mjs +0 -8
  215. package/dist/bin/hook-chunks/custom-workflow-storage-M77INP6Z.mjs +0 -8
  216. package/dist/bin/hook-chunks/cwd-changed-FYNPPO73.mjs +0 -8
  217. package/dist/bin/hook-chunks/developer-evolution-R5BXQH6G.mjs +0 -12
  218. package/dist/bin/hook-chunks/distill-W7QGQUDX.mjs +0 -8
  219. package/dist/bin/hook-chunks/enriched-recall-W7KYRYVR.mjs +0 -8
  220. package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +0 -8
  221. package/dist/bin/hook-chunks/format-BOWFDUBP.mjs +0 -8
  222. package/dist/bin/hook-chunks/judgment-receipt-WGTFKID7.mjs +0 -8
  223. package/dist/bin/hook-chunks/land-cue-WLGSULSO.mjs +0 -9
  224. package/dist/bin/hook-chunks/land-synthesis-V7UH5QV6.mjs +0 -8
  225. package/dist/bin/hook-chunks/legacy-crew-sweep-MFE4BDNR.mjs +0 -24
  226. package/dist/bin/hook-chunks/memory-index-B53F5HAX.mjs +0 -10
  227. package/dist/bin/hook-chunks/notification-HJLS4L7Y.mjs +0 -8
  228. package/dist/bin/hook-chunks/post-edit-TT3XOG55.mjs +0 -8
  229. package/dist/bin/hook-chunks/pre-bash-2KKF4V6G.mjs +0 -11
  230. package/dist/bin/hook-chunks/pre-commit-UU4SKKWV.mjs +0 -8
  231. package/dist/bin/hook-chunks/pre-edit-RTBLZPWH.mjs +0 -11
  232. package/dist/bin/hook-chunks/pre-package-LQTINBT4.mjs +0 -8
  233. package/dist/bin/hook-chunks/pre-search-UJU3XZ2K.mjs +0 -9
  234. package/dist/bin/hook-chunks/pre-secrets-IE5NX5X5.mjs +0 -8
  235. package/dist/bin/hook-chunks/project-memory-YHQBRX3D.mjs +0 -8
  236. package/dist/bin/hook-chunks/project-style-evolution-HS6HYI7W.mjs +0 -8
  237. package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +0 -8
  238. package/dist/bin/hook-chunks/purge-AXMYTZVM.mjs +0 -8
  239. package/dist/bin/hook-chunks/retention-22OSCAGV.mjs +0 -8
  240. package/dist/bin/hook-chunks/sdd-W3OUQPHD.mjs +0 -10
  241. package/dist/bin/hook-chunks/session-continuity-LO2KNHXU.mjs +0 -11
  242. package/dist/bin/hook-chunks/session-start-5UZSL6OY.mjs +0 -8
  243. package/dist/bin/hook-chunks/setup-BSWLQJPE.mjs +0 -142
  244. package/dist/bin/hook-chunks/spec-task-breakdown-QJWGCON2.mjs +0 -8
  245. package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +0 -8
  246. package/dist/bin/hook-chunks/stop-QVDK6LUV.mjs +0 -17
  247. package/dist/bin/hook-chunks/subagent-start-UYBSD7VK.mjs +0 -8
  248. package/dist/bin/hook-chunks/subagent-stop-FHLL7X66.mjs +0 -8
  249. package/dist/bin/hook-chunks/symbol-graph-LZM4RZXZ.mjs +0 -8
  250. package/dist/bin/hook-chunks/task-service-RMCQEHV6.mjs +0 -8
  251. package/dist/bin/hook-chunks/tdd-LV63NXZ3.mjs +0 -10
  252. package/dist/bin/hook-chunks/weak-model-mode-VDYJ25PX.mjs +0 -8
  253. package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +0 -49
  254. package/dist/bin/hook-chunks/work-scope-OKFSTW6D.mjs +0 -8
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{d as b}from"./chunk-SYHDEUVU.mjs";import{a as j}from"./chunk-GCKILEXJ.mjs";import{c as p,e as A}from"./chunk-P5ZYAXSE.mjs";import{b as w}from"./chunk-PKDYFXMI.mjs";import{a as e}from"./chunk-E66B27AL.mjs";import g from"node:fs";import H from"node:fs/promises";import m from"node:path";var I=j.join("/"),R="Generated with [p/](https://www.prjct.app/)",P="<!-- prjct:start - DO NOT REMOVE THIS MARKER -->",L="<!-- prjct:end - DO NOT REMOVE THIS MARKER -->",n={rag:"prjct is a RAG-backed project memory harness; do not preload project history.",entrypoint:'Tasks \u2192 `prjct work "\u2026"`. Known cmds (`sync`/`search`/`remember`/\u2026) \u2192 `prjct <cmd>` \u2014 never work-wrap.',pull:"Pull only what surfaces: `prjct search` / `context memory` / `guard` / MCP \u2014 not something to load wholesale.",remember:'Save synthesized memory in English: `prjct remember <decision|learning|gotcha|context> "<text>"`.',kb:`KB (\`${I}\`): \`remember <facet>\` / \`context memory <facet>\` \u2014 on demand, never injected here.`,ship:"Ship only after user OKs: `prjct ship --md`.",loop:"Loop: land; H2+ intent; tip\u2192user SoT; close.",identity:"L0 portable; id=cwd."};function S(){return`${["---","name: prjct","description: prjct work cycles + memory; run prjct verbs, do not preload context.","---","","# prjct","","Run `prjct <cmd> --md` and follow it.","",`- ${n.rag}`,`- ${n.entrypoint}`,`- ${n.pull}`,`- ${n.remember}`,`- ${n.kb}`,`- ${n.ship}`,`- ${n.loop}`,`- ${n.identity}`,"",`Commit footer: \`${R}\``].join(`
8
+ import{d as b}from"./chunk-SYHDEUVU.mjs";import{a as j}from"./chunk-GCKILEXJ.mjs";import{c as p,e as A}from"./chunk-EMTCZG5I.mjs";import{b as w}from"./chunk-PKDYFXMI.mjs";import{a as e}from"./chunk-E66B27AL.mjs";import g from"node:fs";import H from"node:fs/promises";import m from"node:path";var I=j.join("/"),R="Generated with [p/](https://www.prjct.app/)",P="<!-- prjct:start - DO NOT REMOVE THIS MARKER -->",L="<!-- prjct:end - DO NOT REMOVE THIS MARKER -->",n={rag:"prjct is a RAG-backed project memory harness; do not preload project history.",entrypoint:'Tasks \u2192 `prjct work "\u2026"`. Known cmds (`sync`/`search`/`remember`/\u2026) \u2192 `prjct <cmd>` \u2014 never work-wrap.',pull:"Pull only what surfaces: `prjct search` / `context memory` / `guard` / MCP \u2014 not something to load wholesale.",remember:'Save synthesized memory in English: `prjct remember <decision|learning|gotcha|context> "<text>"`.',kb:`KB (\`${I}\`): \`remember <facet>\` / \`context memory <facet>\` \u2014 on demand, never injected here.`,ship:"Ship only after user OKs: `prjct ship --md`.",loop:"Loop: land; H2+ intent; tip\u2192user SoT; close.",identity:"L0 portable; id=cwd."};function S(){return`${["---","name: prjct","description: prjct work cycles + memory; run prjct verbs, do not preload context.","---","","# prjct","","Run `prjct <cmd> --md` and follow it.","",`- ${n.rag}`,`- ${n.entrypoint}`,`- ${n.pull}`,`- ${n.remember}`,`- ${n.kb}`,`- ${n.ship}`,`- ${n.loop}`,`- ${n.identity}`,"",`Commit footer: \`${R}\``].join(`
9
9
  `)}
10
10
  `}e(S,"buildCompactSkill");var M=S,_=S;function O(t){return`${["<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","# p/ \u2014 Context layer for AI agents","","Skills auto-activate for: work, intent, ship, sync, guard, remember, search, insights, performance","Other commands: run `prjct <command> --md` and follow CLI output","","Flow: known verbs run as `prjct <cmd> --md` (sync, search, remember, ship, guard, land, prime\u2026).",'`prjct work` is only for task/work cycles \u2014 never wrap a bare verb as work "sync".',"Substantive implementation follows the persisted work-cycle station from `prjct work --md`:","reviewed intent, evidence, tests when required, then code.","Sync analysis: prefer schema v1 JSON via `prjct analysis-save-llm` (markdown = thin notes only).","","Data:","- Persist everything (memories, context, intents) in ENGLISH, whatever language the user speaks",`- ${n.rag}`,`- ${n.entrypoint}`,`- ${n.pull}`,`- Sovereign knowledge base \u2014 ${n.kb}`,`- ${n.remember}`,`- ${n.loop}`,"- On close, save synthesized context; raw quotes, counters, detector rows, and transcript chunks are inputs, not final memory","- prjct remembers and shows the path; the agent decides how to execute with its own native tools","- Treat prjct output as signals, not a prescriptive harness",`- Commit footer: \`${R}\``,"- Path resolution: `.prjct/prjct.config.json` \u2192 `~/.prjct-cli/projects/{projectId}`","- Storage: `prjct` CLI (SQLite internally)","- Worktree hygiene: if working in a git worktree, remove it AFTER its PR merges \u2014 `git worktree remove` from the main worktree; never with uncommitted/unpushed work, never `--force`","",`Crew (opt-in via \`prjct crew install\`): Leader (blue) \xB7 Implementer (purple) \xB7 Reviewer (pink). Subagent dispatch is Claude-Code-only; in ${t}, identify the role you are playing explicitly.`,"","**Auto-managed by prjct-cli** | https://prjct.app","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->"].join(`
11
11
  `)}
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as k,b as a}from"./chunk-PWMMLXZS.mjs";import{a as E}from"./chunk-QK2IMCDC.mjs";import{j as l,n as A}from"./chunk-SVZHJZ5T.mjs";import{c as d}from"./chunk-PKDYFXMI.mjs";import{e as c,f as v}from"./chunk-BUDZL4DW.mjs";import{a as n}from"./chunk-E66B27AL.mjs";v();function C(r,e,t){if(t.md){console.log(`> ${e}`);return}k[r](e)}n(C,"notify");var B=n((r,e={})=>C("warn",r,e),"notifyWarn");var D=n((r,e={})=>C("fail",r,e),"notifyFail");function J(r,e={}){return B(r,e),{success:!1,error:r}}n(J,"failWith");function Z(r,e={}){return D(r,e),{success:!1,error:r}}n(Z,"failHard");function ee(r,e){let t=c(r);return e&&D(t,e),{success:!1,error:t}}n(ee,"failFromError");A();import x from"node:path";var f={value:null},$={type:"claude",name:"Claude (Code + Desktop)",isSupported:!0,capabilities:{mcp:!0,filesystem:"mcp",markdown:!0,emojis:!0,colors:!0,interactive:!0,agents:!0},config:{configFile:"CLAUDE.md",commandPrefix:"p.",responseStyle:"rich",dataDir:".prjct",commandsDir:"~/.claude/commands/p"},environment:{hasMCP:!0,sandboxed:!1,persistent:!0,agentSystem:!0}},j={type:"terminal",name:"Terminal/CLI",isSupported:!0,capabilities:{mcp:!1,filesystem:"native",markdown:!1,emojis:!0,colors:!0,interactive:!0,agents:!1},config:{configFile:null,commandPrefix:"prjct",responseStyle:"cli",dataDir:".prjct",commandsDir:null},environment:{hasMCP:!1,sandboxed:!1,persistent:!0,agentSystem:!1}};async function L(){if(process.env.CLAUDE_AGENT||process.env.ANTHROPIC_CLAUDE||global.mcp||process.env.MCP_AVAILABLE)return!0;let r=process.cwd();if(await l(x.join(r,"CLAUDE.md")))return!0;let e=process.env.HOME||process.env.USERPROFILE||"";if(await l(x.join(e,".claude")))return!0;let t=process.cwd();return!!(t.includes("/.claude/")||t.includes("/claude-workspace/"))}n(L,"isClaudeEnvironment");function V(){return{...$}}n(V,"getClaudeAgent");function U(){return{...j}}n(U,"getTerminalAgent");function G(){return!!(process.env.CODEX_SANDBOX||process.env.PRJCT_SANDBOX==="1")}n(G,"isSandboxed");async function T(){if(f.value)return f.value;let r=await L()?V():U();return r.environment={...r.environment,sandboxed:G()},f.value=r,r}n(T,"detect");v();A();import p from"node:fs/promises";var y=class{static{n(this,"RuntimeClaude")}name;type;constructor(){this.name="Claude Code",this.type="claude"}formatResponse(e,t="info"){let i={success:"\u2705",error:"\u274C",warning:"\u26A0\uFE0F",info:"\u2139\uFE0F",celebrate:"\u{1F389}",ship:"\u{1F680}",focus:"\u{1F3AF}",idea:"\u{1F4A1}",progress:"\u{1F4CA}",task:"\u{1F4DD}"};return`${i[t]||i.info} ${e}`}async readFile(e){try{if(global.mcp?.filesystem)return await global.mcp.filesystem.read(e)}catch(t){console.warn(`MCP readFile failed, falling back to fs: ${c(t)}`)}return await p.readFile(e,"utf8")}async writeFile(e,t){try{if(global.mcp?.filesystem)return await global.mcp.filesystem.write(e,t)}catch(i){console.warn(`MCP writeFile failed, falling back to fs: ${c(i)}`)}await p.writeFile(e,t,"utf8")}async listDirectory(e){try{if(global.mcp?.filesystem)return await global.mcp.filesystem.list(e)}catch(t){console.warn(`MCP listDirectory failed, falling back to fs: ${c(t)}`)}return await p.readdir(e)}async fileExists(e){return l(e)}async createDirectory(e){await p.mkdir(e,{recursive:!0})}getTimestamp(){return new Date().toISOString()}formatTaskList(e){return!e||e.length===0?"\u{1F4CB} No tasks queued":`\u{1F4CB} Queue:
8
+ import{a as k,b as a}from"./chunk-4O4D6DV7.mjs";import{a as E}from"./chunk-YUKGWWL7.mjs";import{k as l,o as A}from"./chunk-UH4MD3F3.mjs";import{c as d}from"./chunk-PKDYFXMI.mjs";import{e as c,f as v}from"./chunk-BUDZL4DW.mjs";import{a as n}from"./chunk-E66B27AL.mjs";v();function C(r,e,t){if(t.md){console.log(`> ${e}`);return}k[r](e)}n(C,"notify");var B=n((r,e={})=>C("warn",r,e),"notifyWarn");var D=n((r,e={})=>C("fail",r,e),"notifyFail");function J(r,e={}){return B(r,e),{success:!1,error:r}}n(J,"failWith");function Z(r,e={}){return D(r,e),{success:!1,error:r}}n(Z,"failHard");function ee(r,e){let t=c(r);return e&&D(t,e),{success:!1,error:t}}n(ee,"failFromError");A();import x from"node:path";var f={value:null},$={type:"claude",name:"Claude (Code + Desktop)",isSupported:!0,capabilities:{mcp:!0,filesystem:"mcp",markdown:!0,emojis:!0,colors:!0,interactive:!0,agents:!0},config:{configFile:"CLAUDE.md",commandPrefix:"p.",responseStyle:"rich",dataDir:".prjct",commandsDir:"~/.claude/commands/p"},environment:{hasMCP:!0,sandboxed:!1,persistent:!0,agentSystem:!0}},j={type:"terminal",name:"Terminal/CLI",isSupported:!0,capabilities:{mcp:!1,filesystem:"native",markdown:!1,emojis:!0,colors:!0,interactive:!0,agents:!1},config:{configFile:null,commandPrefix:"prjct",responseStyle:"cli",dataDir:".prjct",commandsDir:null},environment:{hasMCP:!1,sandboxed:!1,persistent:!0,agentSystem:!1}};async function L(){if(process.env.CLAUDE_AGENT||process.env.ANTHROPIC_CLAUDE||global.mcp||process.env.MCP_AVAILABLE)return!0;let r=process.cwd();if(await l(x.join(r,"CLAUDE.md")))return!0;let e=process.env.HOME||process.env.USERPROFILE||"";if(await l(x.join(e,".claude")))return!0;let t=process.cwd();return!!(t.includes("/.claude/")||t.includes("/claude-workspace/"))}n(L,"isClaudeEnvironment");function V(){return{...$}}n(V,"getClaudeAgent");function U(){return{...j}}n(U,"getTerminalAgent");function G(){return!!(process.env.CODEX_SANDBOX||process.env.PRJCT_SANDBOX==="1")}n(G,"isSandboxed");async function T(){if(f.value)return f.value;let r=await L()?V():U();return r.environment={...r.environment,sandboxed:G()},f.value=r,r}n(T,"detect");v();A();import p from"node:fs/promises";var y=class{static{n(this,"RuntimeClaude")}name;type;constructor(){this.name="Claude Code",this.type="claude"}formatResponse(e,t="info"){let i={success:"\u2705",error:"\u274C",warning:"\u26A0\uFE0F",info:"\u2139\uFE0F",celebrate:"\u{1F389}",ship:"\u{1F680}",focus:"\u{1F3AF}",idea:"\u{1F4A1}",progress:"\u{1F4CA}",task:"\u{1F4DD}"};return`${i[t]||i.info} ${e}`}async readFile(e){try{if(global.mcp?.filesystem)return await global.mcp.filesystem.read(e)}catch(t){console.warn(`MCP readFile failed, falling back to fs: ${c(t)}`)}return await p.readFile(e,"utf8")}async writeFile(e,t){try{if(global.mcp?.filesystem)return await global.mcp.filesystem.write(e,t)}catch(i){console.warn(`MCP writeFile failed, falling back to fs: ${c(i)}`)}await p.writeFile(e,t,"utf8")}async listDirectory(e){try{if(global.mcp?.filesystem)return await global.mcp.filesystem.list(e)}catch(t){console.warn(`MCP listDirectory failed, falling back to fs: ${c(t)}`)}return await p.readdir(e)}async fileExists(e){return l(e)}async createDirectory(e){await p.mkdir(e,{recursive:!0})}getTimestamp(){return new Date().toISOString()}formatTaskList(e){return!e||e.length===0?"\u{1F4CB} No tasks queued":`\u{1F4CB} Queue:
9
9
  ${e.map((t,i)=>`${i+1}. ${t}`).join(`
10
10
  `)}`}formatRecap(e){return`\u{1F4CA} Recap
11
11
 
@@ -5,5 +5,5 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{e as r,o as c}from"./chunk-CTWZQ7YI.mjs";import{a as e}from"./chunk-E66B27AL.mjs";c();var s=5e3;async function g(t){let n=await r(["branch","--show-current"],{cwd:t,timeoutMs:s});if(n.ok)return n.stdout.trim()||void 0}e(g,"getGitBranch");async function m(t,n=20){let o=e(i=>i.trim().split(`
8
+ import{e as r,p as c}from"./chunk-QWQFF2UG.mjs";import{a as e}from"./chunk-E66B27AL.mjs";c();var s=5e3;async function g(t){let n=await r(["branch","--show-current"],{cwd:t,timeoutMs:s});if(n.ok)return n.stdout.trim()||void 0}e(g,"getGitBranch");async function m(t,n=20){let o=e(i=>i.trim().split(`
9
9
  `).filter(f=>f.length>0).slice(0,n),"parse"),u=await r(["diff","--name-only","HEAD"],{cwd:t,timeoutMs:s});if(u.ok){let i=o(u.stdout);if(i.length>0)return i}let d=await r(["diff","--name-only"],{cwd:t,timeoutMs:s});return d.ok?o(d.stdout):[]}e(m,"getModifiedFiles");export{g as a,m as b};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{d as p,g as b}from"./chunk-HDHVBB6Q.mjs";import{d as f,n as S}from"./chunk-SVZHJZ5T.mjs";import{a as o}from"./chunk-E66B27AL.mjs";b();S();import a from"node:path";var g="file-inventory",m=/^(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|composer\.lock|Cargo\.lock|poetry\.lock|CHANGELOG(\.md)?|LICENSE(\.md)?|\.DS_Store)$/i,x=/(^|\/)(node_modules|dist|build|\.git|coverage|\.next|target|vendor)(\/|$)/i,y=new Set([".png",".jpg",".jpeg",".gif",".webp",".ico",".woff",".woff2",".ttf",".eot",".mp4",".mp3",".zip",".gz",".tar",".wasm",".exe",".dll",".so",".dylib",".bin",".pdf",".ico"]),v={".ts":"TypeScript",".tsx":"TypeScript",".js":"JavaScript",".jsx":"JavaScript",".mjs":"JavaScript",".cjs":"JavaScript",".vue":"Vue",".svelte":"Svelte",".py":"Python",".go":"Go",".rs":"Rust",".java":"Java",".kt":"Kotlin",".kts":"Kotlin",".swift":"Swift",".rb":"Ruby",".php":"PHP",".cs":"C#",".fs":"F#",".cpp":"C++",".cc":"C++",".c":"C",".h":"C/C++",".hpp":"C++",".m":"Objective-C",".mm":"Objective-C++",".scala":"Scala",".clj":"Clojure",".ex":"Elixir",".exs":"Elixir",".erl":"Erlang",".hs":"Haskell",".lua":"Lua",".r":"R",".dart":"Dart",".sql":"SQL",".graphql":"GraphQL",".gql":"GraphQL",".proto":"Protobuf",".md":"Markdown",".mdx":"MDX",".json":"JSON",".yml":"YAML",".yaml":"YAML",".toml":"TOML",".css":"CSS",".scss":"SCSS",".sass":"Sass",".less":"Less",".html":"HTML",".htm":"HTML",".sh":"Shell",".bash":"Shell",".zsh":"Shell",".ps1":"PowerShell",".swiftui":"Swift"};async function h(e,n={}){let t=(await f(e,{skipDotfiles:!0,maxFiles:n.maxFiles??5e4})).filter(l=>{if(x.test(l))return!1;let u=a.basename(l);if(m.test(u))return!1;let c=a.extname(u).toLowerCase();return!!(c&&c!=="."&&!y.has(c))}),r=t.reduce((l,u)=>{let c=a.extname(a.basename(u)).toLowerCase();return l[c]=(l[c]??0)+1,l},Object.create(null)),i=j(r);return{extensions:r,languages:i,fileCount:t.length,builtAt:new Date().toISOString(),projectHint:a.basename(e)}}o(h,"buildFileInventory");function j(e){let n=new Set,s=Object.entries(e).sort((t,r)=>r[1]-t[1]);for(let[t]of s){let r=v[t];r&&n.add(r)}return[...n]}o(j,"languagesFromExtensions");function C(e,n){p.setDoc(e,g,n)}o(C,"saveFileInventory");function d(e){try{return p.getDoc(e,g)}catch{return null}}o(d,"loadFileInventory");async function L(e,n){let s=await h(n);return C(e,s),s}o(L,"refreshFileInventory");function E(e){let n=d(e);return n?.extensions?new Set(Object.keys(n.extensions).map(s=>s.toLowerCase())):new Set}o(E,"inventoryExtensions");function k(e,n,s={}){let t=n.replace(/^\.\//,"").replace(/\\/g,"/").trim();if(!t||x.test(t))return!1;let r=t.split("/").pop()??t;if(m.test(r))return!1;let i=a.extname(r).toLowerCase();return i?!y.has(i):t.includes("/")}o(k,"pathMatchesInventory");function O(e,n){let s=n.replace(/^\.\//,"").replace(/\\/g,"/").trim(),t=s.split("/").pop()??s,r=a.extname(t).toLowerCase();if(!r)return .7;let i=E(e);return i.size===0||i.has(r)?1:.45}o(O,"inventoryPathWeight");function P(e){if(!e||Object.keys(e.extensions).length===0)return"File inventory: empty \u2014 run `prjct sync` to discover languages/extensions.";let n=Object.entries(e.extensions).sort((t,r)=>r[1]-t[1]).slice(0,12).map(([t,r])=>`${t}\xD7${r}`).join(" "),s=e.languages.length>0?e.languages.join(", "):"unknown";return`File inventory: ${e.fileCount} files \xB7 langs: ${s} \xB7 ${n}`}o(P,"formatInventorySummary");export{g as a,h as b,j as c,C as d,d as e,L as f,E as g,k as h,O as i,P as j};
8
+ import{d as p,g as b}from"./chunk-KG7Z6OMK.mjs";import{d as f,o as S}from"./chunk-UH4MD3F3.mjs";import{a as o}from"./chunk-E66B27AL.mjs";b();S();import a from"node:path";var g="file-inventory",m=/^(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|composer\.lock|Cargo\.lock|poetry\.lock|CHANGELOG(\.md)?|LICENSE(\.md)?|\.DS_Store)$/i,x=/(^|\/)(node_modules|dist|build|\.git|coverage|\.next|target|vendor)(\/|$)/i,y=new Set([".png",".jpg",".jpeg",".gif",".webp",".ico",".woff",".woff2",".ttf",".eot",".mp4",".mp3",".zip",".gz",".tar",".wasm",".exe",".dll",".so",".dylib",".bin",".pdf",".ico"]),v={".ts":"TypeScript",".tsx":"TypeScript",".js":"JavaScript",".jsx":"JavaScript",".mjs":"JavaScript",".cjs":"JavaScript",".vue":"Vue",".svelte":"Svelte",".py":"Python",".go":"Go",".rs":"Rust",".java":"Java",".kt":"Kotlin",".kts":"Kotlin",".swift":"Swift",".rb":"Ruby",".php":"PHP",".cs":"C#",".fs":"F#",".cpp":"C++",".cc":"C++",".c":"C",".h":"C/C++",".hpp":"C++",".m":"Objective-C",".mm":"Objective-C++",".scala":"Scala",".clj":"Clojure",".ex":"Elixir",".exs":"Elixir",".erl":"Erlang",".hs":"Haskell",".lua":"Lua",".r":"R",".dart":"Dart",".sql":"SQL",".graphql":"GraphQL",".gql":"GraphQL",".proto":"Protobuf",".md":"Markdown",".mdx":"MDX",".json":"JSON",".yml":"YAML",".yaml":"YAML",".toml":"TOML",".css":"CSS",".scss":"SCSS",".sass":"Sass",".less":"Less",".html":"HTML",".htm":"HTML",".sh":"Shell",".bash":"Shell",".zsh":"Shell",".ps1":"PowerShell",".swiftui":"Swift"};async function h(e,n={}){let t=(await f(e,{skipDotfiles:!0,maxFiles:n.maxFiles??5e4})).filter(l=>{if(x.test(l))return!1;let u=a.basename(l);if(m.test(u))return!1;let c=a.extname(u).toLowerCase();return!!(c&&c!=="."&&!y.has(c))}),r=t.reduce((l,u)=>{let c=a.extname(a.basename(u)).toLowerCase();return l[c]=(l[c]??0)+1,l},Object.create(null)),i=j(r);return{extensions:r,languages:i,fileCount:t.length,builtAt:new Date().toISOString(),projectHint:a.basename(e)}}o(h,"buildFileInventory");function j(e){let n=new Set,s=Object.entries(e).sort((t,r)=>r[1]-t[1]);for(let[t]of s){let r=v[t];r&&n.add(r)}return[...n]}o(j,"languagesFromExtensions");function C(e,n){p.setDoc(e,g,n)}o(C,"saveFileInventory");function d(e){try{return p.getDoc(e,g)}catch{return null}}o(d,"loadFileInventory");async function L(e,n){let s=await h(n);return C(e,s),s}o(L,"refreshFileInventory");function E(e){let n=d(e);return n?.extensions?new Set(Object.keys(n.extensions).map(s=>s.toLowerCase())):new Set}o(E,"inventoryExtensions");function k(e,n,s={}){let t=n.replace(/^\.\//,"").replace(/\\/g,"/").trim();if(!t||x.test(t))return!1;let r=t.split("/").pop()??t;if(m.test(r))return!1;let i=a.extname(r).toLowerCase();return i?!y.has(i):t.includes("/")}o(k,"pathMatchesInventory");function O(e,n){let s=n.replace(/^\.\//,"").replace(/\\/g,"/").trim(),t=s.split("/").pop()??s,r=a.extname(t).toLowerCase();if(!r)return .7;let i=E(e);return i.size===0||i.has(r)?1:.45}o(O,"inventoryPathWeight");function P(e){if(!e||Object.keys(e.extensions).length===0)return"File inventory: empty \u2014 run `prjct sync` to discover languages/extensions.";let n=Object.entries(e.extensions).sort((t,r)=>r[1]-t[1]).slice(0,12).map(([t,r])=>`${t}\xD7${r}`).join(" "),s=e.languages.length>0?e.languages.join(", "):"unknown";return`File inventory: ${e.fileCount} files \xB7 langs: ${s} \xB7 ${n}`}o(P,"formatInventorySummary");export{g as a,h as b,j as c,C as d,d as e,L as f,E as g,k as h,O as i,P as j};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as x}from"./chunk-SJ75V4WG.mjs";import{d as M}from"./chunk-BNWB77U5.mjs";import{a as f}from"./chunk-3WY2AYPE.mjs";import{b as C}from"./chunk-AOPJ4Z6O.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var q=new Set(["pattern-detector-auto","pattern-detector-recurring","skill-miss-detector","friction-detector"]);function E(t){if(t.type==="improvement-signal")return!0;let e=t.tags?.source;return e!==void 0&&q.has(e)}o(E,"isSignalEntry");var R=85,S=2;async function K(t,e,n={}){let a=n.threshold??R,d=n.maxIterations??S,i=await import("./retention-22OSCAGV.mjs").then(({evaluateRetention:s})=>s(e,Date.now()).byId).catch(()=>null),h=o(async(s,c,g,m)=>{if(s>=d||c.score>=a)return{...c,irrelevantRemoved:g,repairEntriesCreated:m};let r=f.allEntriesForIndex(e),p=r.filter(l=>{if(!w(l))return!1;let b=i?.get(l.id);return!(b&&b.verdict==="active"&&b.score>=70)}),u=I(r)?0:1;u>0&&await f.remember(t,{type:"context",content:_(r,c),tags:{context_schema:"living-v2",synthesis:"model-authored",feature:"context-quality-cleanup",key_data:`quality_score=${c.score}; threshold=${a}; irrelevant=${p.length}`,model:"prjct sync context-quality analyzer",token_usage:"0 deterministic sync tokens",source:"sync-context-quality"},provenance:"inferred",projectId:e});let y=[];for(let l of p)f.forget(e,l.id)&&(y.push(l.id),await C({projectId:e,entityType:"memories",entityId:l.id,eventType:"delete",data:{id:l.id,type:l.type,content:l.content,tags:l.tags,reason:"context-quality-cleanup"}}));let $={...k(e,a),iterations:s+1,irrelevantRemoved:g+y.length,repairEntriesCreated:m+u};return p.length===0&&u===0?$:h(s+1,$,g+y.length,m+u)},"repairIteration");return h(0,k(e,a),0,0)}o(K,"repairContextQuality");function k(t,e=R){let n=f.allEntriesForIndex(t),a=n.filter(r=>r.type==="context"),d=a.filter(v),i=a.filter(r=>!v(r)),h=n.filter(w),s=[],c=[];n.length>0&&d.length===0&&(c.push(35),s.push("missing living-v2 context synthesis")),h.length>0&&(c.push(Math.min(40,h.length*8)),s.push(`${h.length} irrelevant generated entries in active context`)),i.length>0&&(c.push(Math.min(20,i.length*5)),s.push(`${i.length} legacy context entries need cleanup`));let g=d[0];if(g){let r=x(g.content),u=[r.contextSynthesis,r.keyData,r.model,r.tokenUsage,r.nextImplication].filter(y=>!y).length;u>0&&(c.push(u*4),s.push("latest living context is missing structured UI/LLM fields"))}let m=Math.max(0,Math.min(100,100-c.reduce((r,p)=>r+p,0)));return{score:m,threshold:e,passed:m>=e,iterations:0,livingContextCount:d.length,legacyContextCount:i.length,irrelevantRemoved:0,repairEntriesCreated:0,issues:s}}o(k,"evaluateContextQuality");function w(t){return E(t)?!0:t.tags?.source==="sync-context-quality"||t.type!=="context"||v(t)?!1:L(t)}o(w,"isIrrelevantGeneratedContext");function v(t){if(t.tags?.context_schema==="living-v2")return!0;let e=x(t.content);return!!(e.contextSynthesis&&e.keyData)}o(v,"isLivingV2Context");function I(t){return t.some(e=>e.type==="context"&&v(e))}o(I,"hasUsableLivingContext");function L(t){let e=t.content.trim();if(e.length<260||/User pushback:|raw quote|transcript|hot file|skill-miss/i.test(e))return!0;let n=x(e);return[n.whatHappened,n.whyItMattered,n.pattern,n.antiPattern,n.outcome,n.nextImplication].filter(Boolean).length<3}o(L,"isLowValueLegacyContext");function _(t,e){let n=t.filter(i=>!w(i)).filter(i=>["decision","gotcha","learning","context","shipped"].includes(i.type)).slice(0,8),a=n.length>0?n.map(i=>`${i.type}:${M(i)}`).join("; "):"No high-quality prior context survived cleanup.";return["Context synthesis: Sync repaired historical low-quality project context by removing generated telemetry and preserving the useful project knowledge as a living-v2 synthesis. Future agents should trust this synthesized layer over old raw detector rows or legacy context snippets.",`Key data: ${[`quality_score=${e.score}`,`threshold=${e.threshold}`,`legacy_context=${e.legacyContextCount}`,`issues=${e.issues.join("|")||"none"}`].join("; ")}`,"What happened: prjct sync detected that active context quality was below the required threshold and generated a replacement synthesis before deleting irrelevant generated entries.","Why it mattered: Existing users had accumulated low-signal context over time; leaving it active makes the second brain noisy for both the UI and LLM retrieval.","Who/author: prjct sync","Model: prjct sync context-quality analyzer","Token usage: 0 deterministic sync tokens","Sentiment: cleanup required because raw generated context had become product debt","Related files: generated from existing project memory during sync","Feature/domain: context-quality-cleanup","Pattern: Keep structured key data for UI representation and synthesized context for humans/LLMs.","Anti-pattern: Surfacing raw detector rows, hot-file counters, or short legacy snippets as durable project knowledge.","Decision/trap: Generated garbage is hard-deleted from active recall/vault/search; user-authored decisions, gotchas, learnings, and facts are preserved.",`Outcome: Repair synthesis created from surviving highlights: ${a}`,"Next implication: If quality remains below threshold, run full sync/analysis and inspect remaining user-authored entries manually instead of deleting them blindly."].join(" \xB7 ")}o(_,"buildRepairContext");export{K as a,w as b};
8
+ import{b as x}from"./chunk-SJ75V4WG.mjs";import{d as M}from"./chunk-7JEKBJAP.mjs";import{a as f}from"./chunk-27XFSCOE.mjs";import{a as C}from"./chunk-UA4Z5TGG.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var q=new Set(["pattern-detector-auto","pattern-detector-recurring","skill-miss-detector","friction-detector"]);function E(t){if(t.type==="improvement-signal")return!0;let e=t.tags?.source;return e!==void 0&&q.has(e)}o(E,"isSignalEntry");var R=85,S=2;async function K(t,e,n={}){let a=n.threshold??R,d=n.maxIterations??S,i=await import("./retention-LWETHQX3.mjs").then(({evaluateRetention:s})=>s(e,Date.now()).byId).catch(()=>null),h=o(async(s,c,g,m)=>{if(s>=d||c.score>=a)return{...c,irrelevantRemoved:g,repairEntriesCreated:m};let r=f.allEntriesForIndex(e),p=r.filter(l=>{if(!w(l))return!1;let b=i?.get(l.id);return!(b&&b.verdict==="active"&&b.score>=70)}),u=I(r)?0:1;u>0&&await f.remember(t,{type:"context",content:_(r,c),tags:{context_schema:"living-v2",synthesis:"model-authored",feature:"context-quality-cleanup",key_data:`quality_score=${c.score}; threshold=${a}; irrelevant=${p.length}`,model:"prjct sync context-quality analyzer",token_usage:"0 deterministic sync tokens",source:"sync-context-quality"},provenance:"inferred",projectId:e});let y=[];for(let l of p)f.forget(e,l.id)&&(y.push(l.id),await C({projectId:e,entityType:"memories",entityId:l.id,eventType:"delete",data:{id:l.id,type:l.type,content:l.content,tags:l.tags,reason:"context-quality-cleanup"}}));let $={...k(e,a),iterations:s+1,irrelevantRemoved:g+y.length,repairEntriesCreated:m+u};return p.length===0&&u===0?$:h(s+1,$,g+y.length,m+u)},"repairIteration");return h(0,k(e,a),0,0)}o(K,"repairContextQuality");function k(t,e=R){let n=f.allEntriesForIndex(t),a=n.filter(r=>r.type==="context"),d=a.filter(v),i=a.filter(r=>!v(r)),h=n.filter(w),s=[],c=[];n.length>0&&d.length===0&&(c.push(35),s.push("missing living-v2 context synthesis")),h.length>0&&(c.push(Math.min(40,h.length*8)),s.push(`${h.length} irrelevant generated entries in active context`)),i.length>0&&(c.push(Math.min(20,i.length*5)),s.push(`${i.length} legacy context entries need cleanup`));let g=d[0];if(g){let r=x(g.content),u=[r.contextSynthesis,r.keyData,r.model,r.tokenUsage,r.nextImplication].filter(y=>!y).length;u>0&&(c.push(u*4),s.push("latest living context is missing structured UI/LLM fields"))}let m=Math.max(0,Math.min(100,100-c.reduce((r,p)=>r+p,0)));return{score:m,threshold:e,passed:m>=e,iterations:0,livingContextCount:d.length,legacyContextCount:i.length,irrelevantRemoved:0,repairEntriesCreated:0,issues:s}}o(k,"evaluateContextQuality");function w(t){return E(t)?!0:t.tags?.source==="sync-context-quality"||t.type!=="context"||v(t)?!1:L(t)}o(w,"isIrrelevantGeneratedContext");function v(t){if(t.tags?.context_schema==="living-v2")return!0;let e=x(t.content);return!!(e.contextSynthesis&&e.keyData)}o(v,"isLivingV2Context");function I(t){return t.some(e=>e.type==="context"&&v(e))}o(I,"hasUsableLivingContext");function L(t){let e=t.content.trim();if(e.length<260||/User pushback:|raw quote|transcript|hot file|skill-miss/i.test(e))return!0;let n=x(e);return[n.whatHappened,n.whyItMattered,n.pattern,n.antiPattern,n.outcome,n.nextImplication].filter(Boolean).length<3}o(L,"isLowValueLegacyContext");function _(t,e){let n=t.filter(i=>!w(i)).filter(i=>["decision","gotcha","learning","context","shipped"].includes(i.type)).slice(0,8),a=n.length>0?n.map(i=>`${i.type}:${M(i)}`).join("; "):"No high-quality prior context survived cleanup.";return["Context synthesis: Sync repaired historical low-quality project context by removing generated telemetry and preserving the useful project knowledge as a living-v2 synthesis. Future agents should trust this synthesized layer over old raw detector rows or legacy context snippets.",`Key data: ${[`quality_score=${e.score}`,`threshold=${e.threshold}`,`legacy_context=${e.legacyContextCount}`,`issues=${e.issues.join("|")||"none"}`].join("; ")}`,"What happened: prjct sync detected that active context quality was below the required threshold and generated a replacement synthesis before deleting irrelevant generated entries.","Why it mattered: Existing users had accumulated low-signal context over time; leaving it active makes the second brain noisy for both the UI and LLM retrieval.","Who/author: prjct sync","Model: prjct sync context-quality analyzer","Token usage: 0 deterministic sync tokens","Sentiment: cleanup required because raw generated context had become product debt","Related files: generated from existing project memory during sync","Feature/domain: context-quality-cleanup","Pattern: Keep structured key data for UI representation and synthesized context for humans/LLMs.","Anti-pattern: Surfacing raw detector rows, hot-file counters, or short legacy snippets as durable project knowledge.","Decision/trap: Generated garbage is hard-deleted from active recall/vault/search; user-authored decisions, gotchas, learnings, and facts are preserved.",`Outcome: Repair synthesis created from surviving highlights: ${a}`,"Next implication: If quality remains below threshold, run full sync/analysis and inspect remaining user-authored entries manually instead of deleting them blindly."].join(" \xB7 ")}o(_,"buildRepairContext");export{K as a,w as b};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{f as d,h as p,j as i,m as u,n as F}from"./chunk-SVZHJZ5T.mjs";import{a as c}from"./chunk-E66B27AL.mjs";F();import t from"node:path";async function E(e,s){let o=s?.packageManager?.trim().toLowerCase();return o?.startsWith("pnpm@")?"pnpm":o?.startsWith("yarn@")?"yarn":o?.startsWith("bun@")?"bun":o?.startsWith("npm@")?"npm":await i(t.join(e,"pnpm-lock.yaml"))?"pnpm":await i(t.join(e,"yarn.lock"))?"yarn":await i(t.join(e,"bun.lockb"))||await i(t.join(e,"bun.lock"))?"bun":(await i(t.join(e,"package-lock.json")),"npm")}c(E,"detectPackageManager");function w(e,s){return e==="yarn"?`yarn ${s}`:e==="pnpm"?`pnpm run ${s}`:e==="bun"?`bun run ${s}`:`npm run ${s}`}c(w,"pmRun");function H(e){return e==="yarn"?"yarn test":e==="pnpm"?"pnpm test":e==="bun"?"bun test":"npm test"}c(H,"pmTest");var x=["package.json","Cargo.toml","pyproject.toml","VERSION","version.txt"],b=".csproj",v=["CHANGELOG.md","HISTORY.md","NEWS.md","CHANGES.md"];async function g(e,s){for(let l of x)if(await i(t.join(e,l)))return l;let m=(s??await u(e)).find(l=>l.endsWith(b));if(m)return m}c(g,"detectVersionFile");async function r(e){for(let s of v)if(await i(t.join(e,s)))return s}c(r,"detectChangelogFile");async function M(e){let s=t.join(e,"package.json"),o=await d(s,null);if(o){let n=await E(e,o),a=o.scripts||{},f={stack:"js",packageManager:n};return a.lint&&(f.lint={tool:n,command:w(n,"lint")}),a.typecheck&&(f.typecheck={tool:n,command:w(n,"typecheck")}),a.test&&(f.test={tool:n,command:H(n)}),f.versionFile=await g(e),f.changelogFile=await r(e),f}if(await i(t.join(e,"pytest.ini"))){let n=await g(e),a=await r(e);return{stack:"python",test:{tool:"pytest",command:"pytest"},versionFile:n,changelogFile:a}}let m=await p(t.join(e,"pyproject.toml"),"");if(m.includes("[tool.pytest")||m.includes("pytest")){let n=await g(e),a=await r(e);return{stack:"python",test:{tool:"pytest",command:"pytest"},versionFile:n,changelogFile:a}}if(await i(t.join(e,"Cargo.toml"))){let n=await r(e);return{stack:"rust",test:{tool:"cargo",command:"cargo test"},versionFile:"Cargo.toml",changelogFile:n}}if(await i(t.join(e,"go.mod"))){let n=await g(e),a=await r(e);return{stack:"go",test:{tool:"go",command:"go test ./..."},versionFile:n,changelogFile:a}}let l=await u(e);if(l.some(n=>n.endsWith(".sln")||n.endsWith(".csproj")||n.endsWith(".fsproj"))){let n=await g(e,l),a=await r(e);return{stack:"dotnet",test:{tool:"dotnet",command:"dotnet test"},versionFile:n,changelogFile:a}}if(await i(t.join(e,"pom.xml"))){let n=await r(e);return{stack:"java",test:{tool:"maven",command:"mvn test"},versionFile:"pom.xml",changelogFile:n}}if(await i(t.join(e,"gradlew"))&&(await i(t.join(e,"build.gradle"))||await i(t.join(e,"build.gradle.kts")))){let n=await r(e);return{stack:"java",test:{tool:"gradle",command:"./gradlew test"},changelogFile:n}}let k=await g(e),y=await r(e);return{stack:"unknown",versionFile:k,changelogFile:y}}c(M,"detectProjectCommands");export{M as a};
8
+ import{f as d,h as p,k as i,n as u,o as F}from"./chunk-UH4MD3F3.mjs";import{a as c}from"./chunk-E66B27AL.mjs";F();import t from"node:path";async function E(e,s){let o=s?.packageManager?.trim().toLowerCase();return o?.startsWith("pnpm@")?"pnpm":o?.startsWith("yarn@")?"yarn":o?.startsWith("bun@")?"bun":o?.startsWith("npm@")?"npm":await i(t.join(e,"pnpm-lock.yaml"))?"pnpm":await i(t.join(e,"yarn.lock"))?"yarn":await i(t.join(e,"bun.lockb"))||await i(t.join(e,"bun.lock"))?"bun":(await i(t.join(e,"package-lock.json")),"npm")}c(E,"detectPackageManager");function w(e,s){return e==="yarn"?`yarn ${s}`:e==="pnpm"?`pnpm run ${s}`:e==="bun"?`bun run ${s}`:`npm run ${s}`}c(w,"pmRun");function H(e){return e==="yarn"?"yarn test":e==="pnpm"?"pnpm test":e==="bun"?"bun test":"npm test"}c(H,"pmTest");var x=["package.json","Cargo.toml","pyproject.toml","VERSION","version.txt"],b=".csproj",v=["CHANGELOG.md","HISTORY.md","NEWS.md","CHANGES.md"];async function g(e,s){for(let l of x)if(await i(t.join(e,l)))return l;let m=(s??await u(e)).find(l=>l.endsWith(b));if(m)return m}c(g,"detectVersionFile");async function r(e){for(let s of v)if(await i(t.join(e,s)))return s}c(r,"detectChangelogFile");async function M(e){let s=t.join(e,"package.json"),o=await d(s,null);if(o){let n=await E(e,o),a=o.scripts||{},f={stack:"js",packageManager:n};return a.lint&&(f.lint={tool:n,command:w(n,"lint")}),a.typecheck&&(f.typecheck={tool:n,command:w(n,"typecheck")}),a.test&&(f.test={tool:n,command:H(n)}),f.versionFile=await g(e),f.changelogFile=await r(e),f}if(await i(t.join(e,"pytest.ini"))){let n=await g(e),a=await r(e);return{stack:"python",test:{tool:"pytest",command:"pytest"},versionFile:n,changelogFile:a}}let m=await p(t.join(e,"pyproject.toml"),"");if(m.includes("[tool.pytest")||m.includes("pytest")){let n=await g(e),a=await r(e);return{stack:"python",test:{tool:"pytest",command:"pytest"},versionFile:n,changelogFile:a}}if(await i(t.join(e,"Cargo.toml"))){let n=await r(e);return{stack:"rust",test:{tool:"cargo",command:"cargo test"},versionFile:"Cargo.toml",changelogFile:n}}if(await i(t.join(e,"go.mod"))){let n=await g(e),a=await r(e);return{stack:"go",test:{tool:"go",command:"go test ./..."},versionFile:n,changelogFile:a}}let l=await u(e);if(l.some(n=>n.endsWith(".sln")||n.endsWith(".csproj")||n.endsWith(".fsproj"))){let n=await g(e,l),a=await r(e);return{stack:"dotnet",test:{tool:"dotnet",command:"dotnet test"},versionFile:n,changelogFile:a}}if(await i(t.join(e,"pom.xml"))){let n=await r(e);return{stack:"java",test:{tool:"maven",command:"mvn test"},versionFile:"pom.xml",changelogFile:n}}if(await i(t.join(e,"gradlew"))&&(await i(t.join(e,"build.gradle"))||await i(t.join(e,"build.gradle.kts")))){let n=await r(e);return{stack:"java",test:{tool:"gradle",command:"./gradlew test"},changelogFile:n}}let k=await g(e),y=await r(e);return{stack:"unknown",versionFile:k,changelogFile:y}}c(M,"detectProjectCommands");export{M as a};
@@ -0,0 +1,8 @@
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{e as u,g as C}from"./chunk-KG7Z6OMK.mjs";import{a as E,b as _,c as A,d as w,e as v,o as b}from"./chunk-UH4MD3F3.mjs";import{a as c}from"./chunk-E66B27AL.mjs";A();C();b();import I from"node:fs/promises";import d from"node:path";function O(t){let r=new RegExp(_.source,"g");return[...t.matchAll(r)].map(e=>e[1]).filter(e=>e.startsWith(".")||e.startsWith("@/"))}c(O,"extractImportSources");async function R(t,r,e){let n=t.startsWith("@/")?d.join(e,"src",t.slice(2)):d.resolve(d.dirname(d.join(e,r)),t);for(let o of E){let i=n+o;try{if((await I.stat(i)).isFile())return d.relative(e,i)}catch{}}return null}c(R,"resolveImport");async function x(t){let r=await w(t),e={},n={},o=await v(r,50,async i=>{let s=await G(t,i);return s&&s.imports.length>0?s:null});for(let{filePath:i,imports:s}of o){e[i]=s;for(let f of s)n[f]||(n[f]=[]),n[f].push(i)}return{forward:e,reverse:n,fileCount:r.length,edgeCount:o.reduce((i,s)=>i+s.imports.length,0),builtAt:new Date().toISOString()}}c(x,"buildGraph");function B(t,r,e=2){let n=new Set(t),o=new Map,i=[];for(let s of t){let f=r.forward[s]||[],a=r.reverse[s]||[];for(let p of[...f,...a])n.has(p)||i.push({file:p,depth:1})}for(let{file:s,depth:f}of i){if(f>e)continue;let a=1/(f+1),p=o.get(s);if(p){a>p.score&&o.set(s,{score:a,depth:f});continue}if(o.set(s,{score:a,depth:f}),f<e){let g=r.forward[s]||[],y=r.reverse[s]||[];for(let h of[...g,...y])!n.has(h)&&!o.has(h)&&i.push({file:h,depth:f+1})}}return Array.from(o.entries()).map(([s,{score:f,depth:a}])=>({path:s,score:f,depth:a})).sort((s,f)=>f.score-s.score)}c(B,"scoreFromSeeds");var l="import-graph",m=new Map;function D(t){return Object.values(t).reduce((r,e)=>r+e.length,0)}c(D,"countEdges");function T(t,r){let e=t.forward[r]||[];delete t.forward[r];for(let n of e){let o=(t.reverse[n]||[]).filter(i=>i!==r);o.length===0?delete t.reverse[n]:t.reverse[n]=o}}c(T,"removeOutgoingEdges");function P(t,r){let e=t.reverse[r]||[];delete t.reverse[r];let n=[];for(let o of e){let i=(t.forward[o]||[]).filter(s=>s!==r);i.length===0?delete t.forward[o]:t.forward[o]=i,n.push(o)}return n}c(P,"removeIncomingEdges");function M(t,r,e){if(e.length===0)return;let n=Array.from(new Set(e));t.forward[r]=n;for(let o of n)t.reverse[o]||(t.reverse[o]=[]),t.reverse[o].includes(r)||t.reverse[o].push(r)}c(M,"addEdges");async function G(t,r){try{let e=await I.readFile(d.join(t,r),"utf-8"),n=O(e),o=[];for(let i of n){let s=await R(i,r,t);s&&s!==r&&o.push(s)}return{filePath:r,imports:o}}catch{return null}}c(G,"importsForFile");function S(t){return{schemaVersion:2,fileCount:t.fileCount,edgeCount:t.edgeCount,builtAt:t.builtAt}}c(S,"graphMetadata");function F(t,r){try{u.transaction(t,e=>{e.prepare("DELETE FROM import_graph_edges").run();let n=e.prepare("INSERT INTO import_graph_edges (from_path, to_path, sort_order) VALUES (?, ?, ?)");for(let[o,i]of Object.entries(r.forward))for(let[s,f]of i.entries())n.run(o,f,s)})}catch{}}c(F,"replacePerFileEdges");function L(t,r,e,n){try{u.transaction(t,o=>{let i=o.prepare("DELETE FROM import_graph_edges WHERE from_path = ?"),s=o.prepare("INSERT INTO import_graph_edges (from_path, to_path, sort_order) VALUES (?, ?, ?)");for(let f of new Set([...e,...n]))i.run(f);for(let f of e){let a=r.forward[f]||[];for(let[p,g]of a.entries())s.run(f,g,p)}})}catch{}}c(L,"updatePerFileEdges");function N(t,r,e){try{let n=u.query(t,"SELECT from_path, to_path FROM import_graph_edges ORDER BY from_path, sort_order, to_path");if(n.length===0){if(e?.edgeCount===0){let a={forward:{},reverse:{},fileCount:e.fileCount,edgeCount:0,builtAt:e.builtAt};return m.set(t,{graph:a,updatedAt:r}),a}return null}let o={},i={};for(let a of n)o[a.from_path]||(o[a.from_path]=[]),o[a.from_path].push(a.to_path),i[a.to_path]||(i[a.to_path]=[]),i[a.to_path].push(a.from_path);let s=new Set;for(let[a,p]of Object.entries(o)){s.add(a);for(let g of p)s.add(g)}let f={forward:o,reverse:i,fileCount:e?.fileCount??s.size,edgeCount:n.length,builtAt:e?.builtAt??r};return m.set(t,{graph:f,updatedAt:r}),f}catch{return null}}c(N,"loadGraphFromPerFileEdges");function V(t,r){u.setDoc(t,l,S(r)),F(t,r),m.delete(t)}c(V,"saveGraph");function W(t,r,e,n){u.setDoc(t,l,S(r)),L(t,r,e,n),m.delete(t)}c(W,"saveGraphUpdate");function k(t){let r=u.get(t,"SELECT updated_at FROM kv_store WHERE key = ?",l);if(!r)return m.delete(t),null;let e=m.get(t);if(e&&e.updatedAt===r.updated_at)return e.graph;let n=u.getDoc(t,l),o=N(t,r.updated_at,n);if(o)return o;if(!n?.forward||!n?.reverse)return null;let i={forward:n.forward,reverse:n.reverse,fileCount:n.fileCount,edgeCount:n.edgeCount,builtAt:n.builtAt};return m.set(t,{graph:i,updatedAt:r.updated_at}),i}c(k,"loadGraph");async function q(t,r){let e=await x(t);return V(r,e),e}c(q,"indexImports");async function K(t,r,e,n=[]){let o=k(r);if(!o)return q(t,r);let i=new Set([...e,...n]);for(let a of i)T(o,a);let s=new Set;for(let a of n)for(let p of P(o,a))s.add(p);let f=await v(e,50,a=>G(t,a));for(let a of f)M(o,a.filePath,a.imports);return o.edgeCount=D(o.forward),o.builtAt=new Date().toISOString(),W(r,o,[...e,...s],n),o}c(K,"updateImportGraph");export{B as a,k as b,q as c,K as d};
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as f}from"./chunk-SDUS2AT7.mjs";import{a as i}from"./chunk-ZMLA5SKR.mjs";import{a as y}from"./chunk-27XFSCOE.mjs";import{d as g,g as x}from"./chunk-KG7Z6OMK.mjs";import{a}from"./chunk-E66B27AL.mjs";import{execFileSync as S}from"node:child_process";x();var j="land-auto",$="session-close";async function N(t){let o=L(t);if(!o)return{wrote:!1,content:null,reason:"nothing-to-land"};try{return await y.remember(t.projectPath,{type:"context",content:o,tags:{source:j,topic:$,capture:"land-v2",context_schema:"living-v2",synthesis:"deterministic"},provenance:"extracted",projectId:t.projectId}),{wrote:!0,content:o}}catch(r){return{wrote:!1,content:o,reason:`remember-failed: ${r.message}`}}}a(N,"synthesizeLandHandoff");function L(t){let o=t.cycleDescription?.trim()||null,r=f(t.projectId,t.cycleId),u=k(t.projectPath),c=b(t.projectId);if(!o&&r.length===0&&u.length===0&&c.length===0)return null;let e=[];o?e.push(`Session close: Work cycle "${i(o,120)}" still open or just closed.`):e.push("Session close: no open work cycle \u2014 landed repo + capture signals only."),e.push("Context synthesis: Passive land hand-off from durable signals (cycle, journal, commits, auto-captures). Not a model essay."),e.push(`Key data: source=${j}; topic=${$}; capture=land-v2`);let l=[];if(o&&l.push(`cycle="${i(o,100)}"`),r.length>0&&l.push(`journal: ${r.map(s=>i(s,70)).join(" \xB7 ")}`),l.length>0&&e.push(`What happened: ${l.join("; ")}`),r.length>0&&e.push(`Why it mattered: Journal trail shows progression \u2014 ${r.slice(0,2).map(s=>i(s,80)).join(" \xB7 ")}`),c.length>0){let s=c.filter(n=>n.type==="learning"||n.type==="decision"||n.type==="fact").slice(0,4),p=c.filter(n=>n.type==="gotcha"||n.type==="anti-pattern").slice(0,3);s.length>0&&e.push(`Learned this session: ${s.map(n=>`[${n.type}] ${i(n.content,100)}`).join(" \xB7 ")}`),p.length>0&&e.push(`Decision/trap: ${p.map(n=>`[${n.type}] ${i(n.content,100)}`).join(" \xB7 ")}`);let I=new Set([...s,...p]),d=c.filter(n=>!I.has(n)).slice(0,3);d.length>0&&s.length===0&&p.length===0&&e.push(`Decision/trap: ${d.map(n=>`[${n.type}] ${i(n.content,100)}`).join(" \xB7 ")}`)}u.length>0&&e.push(`Outcome: Recent commits: ${u.join("; ")}`),t.author&&e.push(`Who/author: ${t.author}`),t.model&&e.push(`Model: ${t.model}`);let m=t.tokensIn,h=t.tokensOut;if(m!=null||h!=null){let s=(m??0)+(h??0);e.push(`Token usage: in=${m??0} out=${h??0} total=${s} (compound judgment \u2014 not a fresh-window thrash loop)`)}e.push("Feature/domain: session-close"),e.push("Pattern: land auto-synthesis without agent remember"),e.push("Anti-pattern: relying on the model to remember to remember at session end"),e.push("Competitive: next window must `prjct prime` \u2014 act as this developer with SQLite judgment, not re-research from zero (GSD tax).");let w=o!=null?"Finish or pause the open cycle (`prjct status done` / `prjct pause`); next agent should `prjct work --md` or `prjct prime`.":"Next agent: `prjct prime` then pick from `prjct next --md`.";return e.push(`Next implication: ${w}`),e.join(" \xB7 ")}a(L,"buildLandHandoffContent");function k(t){try{return S("git",["log","-5","--oneline","--no-decorate"],{cwd:t,encoding:"utf-8",timeout:3e3,stdio:["ignore","pipe","ignore"]}).split(`
9
+ `).map(r=>r.trim()).filter(Boolean)}catch{return[]}}a(k,"recentCommits");function b(t){try{return g.query(t,`SELECT me.type, me.content
10
+ FROM memory_entries me
11
+ JOIN memory_entry_tags t ON t.entry_id = me.id
12
+ WHERE me.deleted_at IS NULL
13
+ AND t.key = 'source'
14
+ AND t.value IN ('transcript-auto', 'land-auto')
15
+ ORDER BY me.created_at DESC
16
+ LIMIT 8`).map(r=>({type:r.type,content:r.content}))}catch{return[]}}a(b,"recentAutoCaptures");export{N as a,L as b};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{e as d,g as r}from"./chunk-HDHVBB6Q.mjs";import{a as o}from"./chunk-E66B27AL.mjs";r();function t(e,s=500){let n=e?.replace(/\s+/g," ").trim();return n?n.length<=s?n:`${n.slice(0,s-3)}...`:null}o(t,"cleanText");function i(e){let s=[];return e.agent&&s.push(`agent=${e.agent}`),(e.tokensIn??0)+(e.tokensOut??0)>0&&(s.push(`tokens_in=${Math.round(e.tokensIn??0)}`),s.push(`tokens_out=${Math.round(e.tokensOut??0)}`)),e.filesTouched&&e.filesTouched.length>0&&s.push(`files_touched=${e.filesTouched.length}`),s.length===0?null:s.join(" ")}o(i,"summary");function a(e){if(!e.sessionId)return;let s=new Date().toISOString();try{d.run(e.projectId,`INSERT INTO agent_sessions
8
+ import{e as d,g as r}from"./chunk-KG7Z6OMK.mjs";import{a as o}from"./chunk-E66B27AL.mjs";r();function t(e,s=500){let n=e?.replace(/\s+/g," ").trim();return n?n.length<=s?n:`${n.slice(0,s-3)}...`:null}o(t,"cleanText");function i(e){let s=[];return e.agent&&s.push(`agent=${e.agent}`),(e.tokensIn??0)+(e.tokensOut??0)>0&&(s.push(`tokens_in=${Math.round(e.tokensIn??0)}`),s.push(`tokens_out=${Math.round(e.tokensOut??0)}`)),e.filesTouched&&e.filesTouched.length>0&&s.push(`files_touched=${e.filesTouched.length}`),s.length===0?null:s.join(" ")}o(i,"summary");function a(e){if(!e.sessionId)return;let s=new Date().toISOString();try{d.run(e.projectId,`INSERT INTO agent_sessions
9
9
  (id, project_id, directory, task_id, goal, started_at, created_at)
10
10
  VALUES (?, ?, ?, ?, ?, ?, ?)
11
11
  ON CONFLICT(id) DO UPDATE SET
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as y,b as N}from"./chunk-KEJ5RMAI.mjs";import{b as u}from"./chunk-JRKGG2E3.mjs";import{f as d,h as l,j as m,n as j}from"./chunk-SVZHJZ5T.mjs";import{b as f,c as g,d as p,e as k}from"./chunk-SYHDEUVU.mjs";import{a}from"./chunk-E66B27AL.mjs";j();import c from"node:path";var P=[{scriptName:"typecheck",kind:"typecheck"},{scriptName:"lint",kind:"lint"},{scriptName:"test",kind:"test"},{scriptName:"build",kind:"build"},{scriptName:"dev",kind:"dev"},{scriptName:"format",kind:"format"}],A=[{file:"bun.lock",manager:"bun"},{file:"bun.lockb",manager:"bun"},{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];async function R(t){for(let{file:n,manager:e}of A)if(await m(c.join(t,n)))return e;return null}a(R,"detectPackageManager");async function w(t){let n=c.join(t,"package.json");if(!await m(n))return[];let r=(await d(n,null))?.scripts??{};return P.filter(({scriptName:i})=>!!r[i]).map(({scriptName:i,kind:o})=>{let s=r[i];return{scriptName:i,command:s,kind:o,mutating:S(s)}})}a(w,"detectNodeCommands");async function M(t){return await m(c.join(t,"Cargo.toml"))?[{scriptName:"test",command:"cargo test",kind:"test",mutating:!1},{scriptName:"build",command:"cargo build",kind:"build",mutating:!1},{scriptName:"lint",command:"cargo clippy",kind:"lint",mutating:!1},{scriptName:"format",command:"cargo fmt",kind:"format",mutating:!0}]:[]}a(M,"detectCargoCommands");async function _(t){return await m(c.join(t,"go.mod"))?[{scriptName:"test",command:"go test ./...",kind:"test",mutating:!1},{scriptName:"build",command:"go build ./...",kind:"build",mutating:!1},{scriptName:"format",command:"gofmt -l .",kind:"format",mutating:!1}]:[]}a(_,"detectGoCommands");var h=[{marker:/\[tool\.pytest\b/,scriptName:"test",command:"pytest",kind:"test",mutating:!1},{marker:/\[tool\.ruff\b/,scriptName:"lint",command:"ruff check .",kind:"lint",mutating:!1},{marker:/\[tool\.black\b/,scriptName:"format",command:"black .",kind:"format",mutating:!0},{marker:/\[tool\.mypy\b/,scriptName:"typecheck",command:"mypy .",kind:"typecheck",mutating:!1}];async function V(t){let n=c.join(t,"pyproject.toml");if(!await m(n))return[];let e=await l(n,"");return h.filter(({marker:r})=>r.test(e)).map(({marker:r,...i})=>i)}a(V,"detectPythonCommands");async function C(t){let[n,e,r,i,o]=await Promise.all([w(t),M(t),_(t),V(t),R(t)]);return{packageManager:o,commands:[...n,...e,...r,...i]}}a(C,"detectVerifiedCommands");var T=/^(?:--fix|--write|--update|-w|--fix-type)$/,E=new Set(["migrate","push","publish","deploy","release","commit"]);function S(t){for(let n of y(t)){let e=N(n);if(e.some(r=>T.test(r))||e.some(r=>E.has(r.toLowerCase())))return!0}return!1}a(S,"classifyCommandMutation");var x=6,O=3,I=80;function G(t){let n=new Set;return t.filter(e=>n.has(e.kind)?!1:(n.add(e.kind),!0))}a(G,"dedupeByKind");function K(t,n){let e=t.replace(/\s+/g," ").trim();return e.length>n?`${e.slice(0,n-1)}\u2026`:e}a(K,"truncate");async function L(t){try{let n=await u.getProjectId(t),{getActiveProjectStyle:e}=await import("./project-style-evolution-HS6HYI7W.mjs"),r=e(n);if(!r)return null;let i=r.payload.stack,o=[i.ecosystem&&i.ecosystem!=="unknown"?i.ecosystem:null,i.languages.slice(0,O).join(", ")||null,i.frameworks.slice(0,x).join(", ")||null].filter(s=>!!s);return o.length>0?o.join(" \xB7 "):null}catch{return null}}a(L,"buildStackLine");async function b(t){let[n,e]=await Promise.all([L(t),C(t)]),r=G(e.commands);if(!n&&r.length===0)return null;let i=[];n&&i.push(`- stack: ${n}`);for(let o of r){let s=o.mutating?"mutating":"read-only";i.push(`- ${o.kind}: \`${K(o.command,I)}\` (${s})`)}return i.push("- deeper: `prjct context --md` \xB7 `prjct_analysis` MCP \xB7 `prjct_relevant_files` MCP"),i.join(`
8
+ import{a as y,b as N}from"./chunk-KEJ5RMAI.mjs";import{b as u}from"./chunk-AZHE4VOM.mjs";import{f as d,h as l,k as m,o as j}from"./chunk-UH4MD3F3.mjs";import{b as f,c as g,d as p,e as k}from"./chunk-SYHDEUVU.mjs";import{a}from"./chunk-E66B27AL.mjs";j();import c from"node:path";var P=[{scriptName:"typecheck",kind:"typecheck"},{scriptName:"lint",kind:"lint"},{scriptName:"test",kind:"test"},{scriptName:"build",kind:"build"},{scriptName:"dev",kind:"dev"},{scriptName:"format",kind:"format"}],A=[{file:"bun.lock",manager:"bun"},{file:"bun.lockb",manager:"bun"},{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];async function R(t){for(let{file:n,manager:e}of A)if(await m(c.join(t,n)))return e;return null}a(R,"detectPackageManager");async function w(t){let n=c.join(t,"package.json");if(!await m(n))return[];let r=(await d(n,null))?.scripts??{};return P.filter(({scriptName:i})=>!!r[i]).map(({scriptName:i,kind:o})=>{let s=r[i];return{scriptName:i,command:s,kind:o,mutating:S(s)}})}a(w,"detectNodeCommands");async function M(t){return await m(c.join(t,"Cargo.toml"))?[{scriptName:"test",command:"cargo test",kind:"test",mutating:!1},{scriptName:"build",command:"cargo build",kind:"build",mutating:!1},{scriptName:"lint",command:"cargo clippy",kind:"lint",mutating:!1},{scriptName:"format",command:"cargo fmt",kind:"format",mutating:!0}]:[]}a(M,"detectCargoCommands");async function _(t){return await m(c.join(t,"go.mod"))?[{scriptName:"test",command:"go test ./...",kind:"test",mutating:!1},{scriptName:"build",command:"go build ./...",kind:"build",mutating:!1},{scriptName:"format",command:"gofmt -l .",kind:"format",mutating:!1}]:[]}a(_,"detectGoCommands");var h=[{marker:/\[tool\.pytest\b/,scriptName:"test",command:"pytest",kind:"test",mutating:!1},{marker:/\[tool\.ruff\b/,scriptName:"lint",command:"ruff check .",kind:"lint",mutating:!1},{marker:/\[tool\.black\b/,scriptName:"format",command:"black .",kind:"format",mutating:!0},{marker:/\[tool\.mypy\b/,scriptName:"typecheck",command:"mypy .",kind:"typecheck",mutating:!1}];async function V(t){let n=c.join(t,"pyproject.toml");if(!await m(n))return[];let e=await l(n,"");return h.filter(({marker:r})=>r.test(e)).map(({marker:r,...i})=>i)}a(V,"detectPythonCommands");async function C(t){let[n,e,r,i,o]=await Promise.all([w(t),M(t),_(t),V(t),R(t)]);return{packageManager:o,commands:[...n,...e,...r,...i]}}a(C,"detectVerifiedCommands");var T=/^(?:--fix|--write|--update|-w|--fix-type)$/,E=new Set(["migrate","push","publish","deploy","release","commit"]);function S(t){for(let n of y(t)){let e=N(n);if(e.some(r=>T.test(r))||e.some(r=>E.has(r.toLowerCase())))return!0}return!1}a(S,"classifyCommandMutation");var x=6,O=3,I=80;function G(t){let n=new Set;return t.filter(e=>n.has(e.kind)?!1:(n.add(e.kind),!0))}a(G,"dedupeByKind");function K(t,n){let e=t.replace(/\s+/g," ").trim();return e.length>n?`${e.slice(0,n-1)}\u2026`:e}a(K,"truncate");async function L(t){try{let n=await u.getProjectId(t),{getActiveProjectStyle:e}=await import("./project-style-evolution-7MAUSED2.mjs"),r=e(n);if(!r)return null;let i=r.payload.stack,o=[i.ecosystem&&i.ecosystem!=="unknown"?i.ecosystem:null,i.languages.slice(0,O).join(", ")||null,i.frameworks.slice(0,x).join(", ")||null].filter(s=>!!s);return o.length>0?o.join(" \xB7 "):null}catch{return null}}a(L,"buildStackLine");async function b(t){let[n,e]=await Promise.all([L(t),C(t)]),r=G(e.commands);if(!n&&r.length===0)return null;let i=[];n&&i.push(`- stack: ${n}`);for(let o of r){let s=o.mutating?"mutating":"read-only";i.push(`- ${o.kind}: \`${K(o.command,I)}\` (${s})`)}return i.push("- deeper: `prjct context --md` \xB7 `prjct_analysis` MCP \xB7 `prjct_relevant_files` MCP"),i.join(`
9
9
  `)}a(b,"buildProjectFactsSection");async function $(t){let n=await b(t),e=[p];return n&&e.push("","## This project",n),e.join(`
10
10
  `)}a($,"buildPrjctMdBody");async function J(t){let n=await $(t),e=`${f}
11
11
  ${n}
@@ -0,0 +1,31 @@
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 R}from"./chunk-SDUS2AT7.mjs";import{a}from"./chunk-ZMLA5SKR.mjs";import{a as h}from"./chunk-27XFSCOE.mjs";import{d as l,g as E}from"./chunk-KG7Z6OMK.mjs";import{a as c}from"./chunk-E66B27AL.mjs";E();var _="land-receipt",k="judgment-receipt",g="receipt-v1";function D(e){let s=e.trapsSurfaced??[],t=e.decisions??[],n=(e.journal??[]).filter(r=>r.trim()),o=(e.openRisksNext??[]).filter(r=>r.trim()),u=e.cycleDescription?.trim()||null,y=e.tokensIn!=null||e.tokensOut!=null||!!e.model;if(!u&&s.length===0&&t.length===0&&n.length===0&&o.length===0&&!y)return null;let i=["# Judgment Receipt",""],m=[];if(u&&m.push(`cycle: "${a(u,100)}"`),n.length>0&&m.push(`journal: ${n.slice(0,4).map(r=>a(r,70)).join(" \xB7 ")}`),m.length>0&&i.push("## Applied judgment",...m.map(r=>`- ${r}`),""),s.length>0&&i.push("## Traps re-surfaced",...s.slice(0,8).map(r=>`- **[${r.type}]** ${a(r.title,100)} \`${r.id}\``),""),t.length>0&&i.push("## Decisions contested or honored",...t.slice(0,8).map(r=>`- **${r.status}** [${r.type}] ${a(r.title,100)} \`${r.id}\``),""),o.length>0||u){let r=o.length>0?o.slice(0,5).map(d=>`- ${a(d,120)}`):["- Finish or pause open cycle; next agent: `prjct prime` / `prjct work --md`."];i.push("## Open risks / next",...r,"")}if(y){let r=[];if(e.tokensIn!=null||e.tokensOut!=null){let d=e.tokensIn??0,f=e.tokensOut??0;r.push(`tokens in=${d} out=${f} total=${d+f}`)}e.model&&r.push(`model=${e.model}`),e.author&&r.push(`author=${e.author}`),i.push("## Session economics",`- ${r.join(" \xB7 ")}`,"")}return i.push("_Closed-loop judgment continuity \u2014 not bulk memory. Proof of traps prevented and decisions applied._"),i.join(`
9
+ `).trim()}c(D,"buildJudgmentReceipt");function I(e){if(!e)return null;let s=(e.match(/## Traps re-surfaced/g)||[]).length,t=p(e,"Traps re-surfaced"),n=p(e,"Decisions contested or honored"),o=[];return t>0&&o.push(`${t} trap(s) re-surfaced`),n>0&&o.push(`${n} decision(s) tracked`),o.length===0&&o.push("session judgment landed"),`Judgment receipt: ${o.join(", ")}`}c(I,"summarizeJudgmentReceipt");function p(e,s){let t=new RegExp(`## ${s}\\n([\\s\\S]*?)(?=\\n## |\\n_|$)`),n=e.match(t);return n?(n[1].match(/^- /gm)||[]).length:0}c(p,"countSectionBullets");async function S(e,s,t){let n=D(t);if(!n)return{wrote:!1,content:null,summary:null,reason:"nothing-to-receipt"};try{return await h.remember(e,{type:"context",content:n,tags:{source:_,topic:k,capture:g,synthesis:"deterministic"},provenance:"extracted",projectId:s}),{wrote:!0,content:n,summary:I(n)}}catch(o){return{wrote:!1,content:n,summary:I(n),reason:`remember-failed: ${o.message}`}}}c(S,"persistJudgmentReceipt");async function b(e){let s=R(e.projectId,e.cycleId),t=O(e.projectId),n=j(e.projectId);return S(e.projectPath,e.projectId,{cycleDescription:e.cycleDescription,cycleId:e.cycleId,journal:s,trapsSurfaced:t,decisions:n,tokensIn:e.tokensIn,tokensOut:e.tokensOut,model:e.model,author:e.author,openRisksNext:e.cycleDescription?["Open cycle still needs finish or pause before context dies."]:[]})}c(b,"synthesizeJudgmentReceipt");function C(e){try{let s=Date.now()-864e5,n=l.query(e,`SELECT me.id, me.content
10
+ FROM memory_entries me
11
+ JOIN memory_entry_tags t ON t.entry_id = me.id
12
+ WHERE me.deleted_at IS NULL
13
+ AND me.created_at >= ?
14
+ AND t.key = 'capture' AND t.value = ?
15
+ ORDER BY me.created_at DESC
16
+ LIMIT 1`,s,g)[0];return n?{id:n.id,content:n.content,trapCount:p(n.content,"Traps re-surfaced")}:null}catch{return null}}c(C,"latestJudgmentReceipt24h");function T(e,s){try{let t=s??0;return l.get(e,`SELECT COUNT(*) AS c
17
+ FROM memory_entries me
18
+ JOIN memory_entry_tags t ON t.entry_id = me.id
19
+ WHERE me.deleted_at IS NULL
20
+ AND me.created_at >= ?
21
+ AND t.key = 'capture' AND t.value = ?`,t,g)?.c??0}catch{return 0}}c(T,"countReceiptsWritten");function O(e){try{return l.query(e,`SELECT id, type, content FROM memory_entries
22
+ WHERE deleted_at IS NULL
23
+ AND type IN ('gotcha', 'anti-pattern')
24
+ ORDER BY created_at DESC
25
+ LIMIT 5`).map(t=>({id:t.id,type:t.type,title:t.content.replace(/\s+/g," ").trim().slice(0,120)}))}catch{return[]}}c(O,"recentSurfacedTraps");function j(e){try{return l.query(e,`SELECT me.id, me.type, me.content, t.value AS action
26
+ FROM memory_entries me
27
+ JOIN memory_entry_tags t ON t.entry_id = me.id AND t.key = 'conflict_action'
28
+ WHERE me.deleted_at IS NULL
29
+ AND me.created_at >= ?
30
+ ORDER BY me.created_at DESC
31
+ LIMIT 8`,Date.now()-864e5).map(t=>({id:t.id,type:t.type,title:t.content.replace(/\s+/g," ").trim().slice(0,120),status:t.action==="deny"||t.action==="warn"?"contested":"honored"}))}catch{return[]}}c(j,"recentConflictDecisions");export{_ as a,k as b,g as c,D as d,I as e,S as f,b as g,C as h,T as i};
@@ -0,0 +1,8 @@
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 h}from"./chunk-TG5CQJD5.mjs";import{c as p}from"./chunk-M5E2YOZ4.mjs";import{d as c,g}from"./chunk-KG7Z6OMK.mjs";import{b as a,h as m,j as d,k as f}from"./chunk-JAMSIKDE.mjs";import{a as r}from"./chunk-E66B27AL.mjs";f();m();g();function v(i){let[e,t]=i.split(".");return e?{entityType:e.endsWith("s")?e:`${e}s`,eventType:t==="deleted"||t==="archived"||t==="removed"?"delete":"upsert"}:{}}r(v,"deriveEntityShape");function T(i){if(!i||typeof i!="object")return;let e=i;for(let t of["taskId","task_id","id","feature_id","featureId","specId","spec_id"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}r(T,"entityIdOf");var u={value:null};async function w(){if(u.value)return u.value;try{let{default:i}=await import("./auth-config-SP4PBALR.mjs"),e=i;if(typeof e.getDeviceId=="function"){let t=await e.getDeviceId();return u.value=t,t}return"unknown-device"}catch{return"unknown-device"}}r(w,"_resolveDeviceId");var y=class{static{r(this,"StorageManager")}filename;cache;constructor(e,t){this.filename=e,this.cache=new d({ttl:5e3,maxSize:50})}getStoreKey(){return this.filename.replace(".json","")}async read(e){if(!(process.env.PRJCT_IN_DAEMON==="1")){let n=this.cache.get(e);if(n!==null)return n}try{let n=c.getDoc(e,this.getStoreKey());if(n!==null)return this.cache.set(e,n),n}catch{}return this.getDefault()}async write(e,t){c.setDoc(e,this.getStoreKey(),t),this.cache.set(e,t)}async update(e,t){let n=this.getStoreKey(),s=c.updateDoc(e,n,t,()=>this.getDefault());return this.cache.set(e,s),s}async publishEvent(e,t,n){let s=v(t),o={type:t,path:[this.filename.replace(".json","")],data:n,timestamp:a(),projectId:e,entityType:s.entityType,entityId:T(n),eventType:s.eventType,contentHash:p(n),deviceId:await w(),revisionCount:1};await h.publish(o)}async publishEntityEvent(e,t,n,s){let o=`${t}.${n}`,l={...s,timestamp:a()};await this.publishEvent(e,o,l)}async exists(e){try{return c.hasDoc(e,this.getStoreKey())}catch{return!1}}clearCache(e){e?this.cache.delete(e):this.cache.clear()}getCacheStats(){return this.cache.stats()}};export{y as a};
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as S}from"./chunk-HJ4HEI45.mjs";import{a as m,b as c,c as g}from"./chunk-3LG3ACQV.mjs";import{d as p,g as D}from"./chunk-HDHVBB6Q.mjs";import{b as d,c as l,e as b}from"./chunk-AKIN5WSQ.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import{z as e}from"zod";var F=e.enum(["feature","fix","improvement","refactor"]),E=e.enum(["pass","warning","fail","skipped"]),_=e.enum(["added","changed","fixed","removed"]),v=e.object({hours:e.number(),minutes:e.number(),totalMinutes:e.number()}),O=e.object({filesChanged:e.number().nullable().optional(),linesAdded:e.number().nullable().optional(),linesRemoved:e.number().nullable().optional(),commits:e.number().nullable().optional()}),A=e.object({description:e.string(),type:_.optional()}),C=e.object({lintStatus:E.nullable().optional(),lintDetails:e.string().optional(),testStatus:E.nullable().optional(),testDetails:e.string().optional()}),T=e.object({hash:e.string().optional(),message:e.string().optional(),branch:e.string().optional()}),I=e.object({id:e.string(),name:e.string(),version:e.string().nullable().optional(),type:F,agent:e.string().optional(),description:e.string().optional(),changes:e.array(A).optional(),codeSnippets:e.array(e.string()).optional(),commit:T.optional(),codeMetrics:O.optional(),qualityMetrics:C.optional(),quantitativeImpact:e.string().optional(),duration:v.optional(),tasksCompleted:e.number().nullable().optional(),shippedAt:e.string(),featureId:e.string().optional()}),y=e.object({shipped:e.array(I),lastUpdated:e.string()});b();D();var f="shipped:backfilled:v1";function r(a){let s={...(()=>{if(!a.data)return{};try{return JSON.parse(a.data)}catch{return{}}})(),id:a.id,name:a.name,shippedAt:a.shipped_at,version:a.version};return a.description!=null&&(s.description=a.description),a.type!=null&&(s.type=a.type),a.duration!=null&&(s.duration=a.duration),s}o(r,"rowToFeature");var u=class extends S{static{o(this,"ShippedStorage")}constructor(){super("shipped.json",y)}getDefault(){return{shipped:[],lastUpdated:""}}getEventType(t){return`shipped.${t}d`}async getAll(t){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC").map(r)}async republishShips(t){if(p.getDoc(t,f))return 0;let s=await this.getAll(t);for(let i of s)await this.publishEvent(t,"shipped_item.created",{id:i.id,shipId:i.id,name:i.name,version:i.version,shippedAt:i.shippedAt});return p.setDoc(t,f,{at:d(),count:s.length}),s.length}async getRecent(t,s=5){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC LIMIT ?",s).map(r)}async addShipped(t,s,i){let n={...s,id:m(),shippedAt:i||d()};if(p.run(t,`INSERT OR IGNORE INTO shipped_features
8
+ import{a as S}from"./chunk-INXNK57E.mjs";import{a as m,b as c,c as g}from"./chunk-5EQLQ7GF.mjs";import{d as p,g as D}from"./chunk-KG7Z6OMK.mjs";import{b as d,c as l,h as b}from"./chunk-JAMSIKDE.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import{z as e}from"zod";var F=e.enum(["feature","fix","improvement","refactor"]),E=e.enum(["pass","warning","fail","skipped"]),_=e.enum(["added","changed","fixed","removed"]),v=e.object({hours:e.number(),minutes:e.number(),totalMinutes:e.number()}),O=e.object({filesChanged:e.number().nullable().optional(),linesAdded:e.number().nullable().optional(),linesRemoved:e.number().nullable().optional(),commits:e.number().nullable().optional()}),A=e.object({description:e.string(),type:_.optional()}),C=e.object({lintStatus:E.nullable().optional(),lintDetails:e.string().optional(),testStatus:E.nullable().optional(),testDetails:e.string().optional()}),T=e.object({hash:e.string().optional(),message:e.string().optional(),branch:e.string().optional()}),I=e.object({id:e.string(),name:e.string(),version:e.string().nullable().optional(),type:F,agent:e.string().optional(),description:e.string().optional(),changes:e.array(A).optional(),codeSnippets:e.array(e.string()).optional(),commit:T.optional(),codeMetrics:O.optional(),qualityMetrics:C.optional(),quantitativeImpact:e.string().optional(),duration:v.optional(),tasksCompleted:e.number().nullable().optional(),shippedAt:e.string(),featureId:e.string().optional()}),y=e.object({shipped:e.array(I),lastUpdated:e.string()});b();D();var f="shipped:backfilled:v1";function r(a){let s={...(()=>{if(!a.data)return{};try{return JSON.parse(a.data)}catch{return{}}})(),id:a.id,name:a.name,shippedAt:a.shipped_at,version:a.version};return a.description!=null&&(s.description=a.description),a.type!=null&&(s.type=a.type),a.duration!=null&&(s.duration=a.duration),s}o(r,"rowToFeature");var u=class extends S{static{o(this,"ShippedStorage")}constructor(){super("shipped.json",y)}getDefault(){return{shipped:[],lastUpdated:""}}getEventType(t){return`shipped.${t}d`}async getAll(t){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC").map(r)}async republishShips(t){if(p.getDoc(t,f))return 0;let s=await this.getAll(t);for(let i of s)await this.publishEvent(t,"shipped_item.created",{id:i.id,shipId:i.id,name:i.name,version:i.version,shippedAt:i.shippedAt});return p.setDoc(t,f,{at:d(),count:s.length}),s.length}async getRecent(t,s=5){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC LIMIT ?",s).map(r)}async addShipped(t,s,i){let n={...s,id:m(),shippedAt:i||d()};if(p.run(t,`INSERT OR IGNORE INTO shipped_features
9
9
  (id, name, shipped_at, version, description, type, duration, data)
10
10
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,n.id,n.name,n.shippedAt,n.version??"",n.description??null,n.type??null,n.duration??null,JSON.stringify(n)).changes===0){let h=p.get(t,"SELECT * FROM shipped_features WHERE name = ? AND version = ? AND shipped_at = ?",n.name,n.version??"",n.shippedAt);return h?r(h):n}return await this.publishEvent(t,"shipped_item.created",{id:n.id,shipId:n.id,name:n.name,version:n.version,shippedAt:n.shippedAt}),n}async getByVersion(t,s){let i=p.get(t,"SELECT * FROM shipped_features WHERE version = ? ORDER BY shipped_at DESC LIMIT 1",s);return i?r(i):void 0}async getCount(t){return p.get(t,"SELECT COUNT(*) AS c FROM shipped_features")?.c??0}async getByDateRange(t,s,i){return p.query(t,"SELECT * FROM shipped_features WHERE shipped_at >= ? AND shipped_at <= ? ORDER BY shipped_at DESC",s.toISOString(),i.toISOString()).map(r)}async getStats(t,s="month"){let i=new Date,n=s==="week"?new Date(i.getTime()-10080*60*1e3):s==="month"?new Date(i.getFullYear(),i.getMonth(),1):new Date(i.getFullYear(),0,1);return{count:(await this.getByDateRange(t,n,i)).length,period:s}}async archiveOldShipped(t){let s=l(c.SHIPPED_RETENTION_DAYS).toISOString(),i=p.query(t,"SELECT * FROM shipped_features WHERE shipped_at < ? ORDER BY shipped_at DESC",s).map(r);return i.length===0?0:(g.archiveMany(t,i.map(n=>({entityType:"shipped",entityId:n.id,entityData:n,summary:`${n.name} v${n.version}`,reason:"age"}))),p.run(t,"DELETE FROM shipped_features WHERE shipped_at < ?",s),await this.publishEvent(t,"shipped.archived",{count:i.length,oldestShippedAt:i[i.length-1]?.shippedAt}),i.length)}},Y=new u;export{Y as a};
@@ -0,0 +1,9 @@
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{c as y,d as D,e as Q,f as vt}from"./chunk-HDSS6UB3.mjs";import{a as Y,b as m,c as q,d as wt}from"./chunk-JQE2F2RK.mjs";import{a as K,b as Dt}from"./chunk-WUHGODSQ.mjs";import{g as W,k as u,l as N,m as P,o as S}from"./chunk-UH4MD3F3.mjs";import{a as z,b as A,p as J}from"./chunk-QWQFF2UG.mjs";import{a as i,c as h,d as yt,e as F}from"./chunk-E66B27AL.mjs";function $t(e){let t=e.getFullYear(),n=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0");return`${t}-${n}-${r}`}function X(e){return{year:e.getFullYear().toString(),month:(e.getMonth()+1).toString().padStart(2,"0"),day:e.getDate().toString().padStart(2,"0")}}function _t(){return new Date().toISOString()}function xt(e){let t=new Date;return t.setDate(t.getDate()-e),t}function Bt(e){return xt(e).toISOString()}function Lt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}function Ut(e,t){if(!e||!t)return null;let n=Date.parse(e),r=Date.parse(t);return!Number.isFinite(n)||!Number.isFinite(r)||r<n?null:Math.round((r-n)/6e4)}function Vt(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60),s=Math.floor(r/24);return s>0?`${s}d ${r%24}h`:r>0?`${r}h ${n%60}m`:n>0?`${n}m`:`${t}s`}var zt,Z=h(()=>{"use strict";i($t,"formatDate");i(X,"getYearMonthDay");i(_t,"getTimestamp");i(xt,"getDaysAgo");i(Bt,"sinceIso");i(Lt,"nullableNumber");i(Ut,"durationMinutes");i(Vt,"formatDuration");zt=new Intl.RelativeTimeFormat("en",{numeric:"always"})});import St from"node:fs";import w from"node:fs/promises";import l from"node:path";async function R(e){let t={isMonorepo:!1,type:null,rootPath:e,packages:[]},n=[{file:"pnpm-workspace.yaml",type:"pnpm"},{file:"lerna.json",type:"lerna"},{file:"nx.json",type:"nx"},{file:"rush.json",type:"rush"},{file:"turbo.json",type:"turborepo"}];for(let r of n)if(await u(l.join(e,r.file))){t.isMonorepo=!0,t.type=r.type;break}if(!t.isMonorepo){let r=l.join(e,"package.json");if(await u(r))try{JSON.parse(await w.readFile(r,"utf-8")).workspaces&&(t.isMonorepo=!0,t.type="npm")}catch{}}return t.isMonorepo&&(t.packages=await T(e,t.type)),t}async function T(e,t){let n=[];try{let r=await(async()=>{if(t==="pnpm"){let g=(await w.readFile(l.join(e,"pnpm-workspace.yaml"),"utf-8")).match(/packages:\s*\n((?:\s*-\s*.+\n?)+)/);return g?g[1].split(`
9
+ `).map(c=>c.replace(/^\s*-\s*['"]?|['"]?\s*$/g,"")).filter(Boolean):[]}if(t==="npm"||t==="lerna"){let a=l.join(e,"package.json"),g=JSON.parse(await w.readFile(a,"utf-8")),c=Array.isArray(g.workspaces)?g.workspaces:g.workspaces?.packages??[];if(t==="lerna"){let d=l.join(e,"lerna.json");if(await u(d)){let p=JSON.parse(await w.readFile(d,"utf-8"));if(p.packages)return p.packages}}return c}if(t==="nx")return["apps/*","libs/*","packages/*"];if(t==="turborepo"){let a=JSON.parse(await w.readFile(l.join(e,"package.json"),"utf-8"));return Array.isArray(a.workspaces)?a.workspaces:[]}return[]})(),s=r.length>0?r:["packages/*","apps/*","libs/*"];for(let a of s){if(a.startsWith("!"))continue;let g=Ct(a,{cwd:e});for(let c of g){let d=l.join(e,c),p=l.join(d,"package.json");if(await u(p))try{let f=JSON.parse(await w.readFile(p,"utf-8")),j=l.join(d,"PRJCT.md");n.push({name:f.name||l.basename(c),path:d,relativePath:c,hasPrjctMd:await u(j)})}catch{}}}}catch{}return n}async function tt(e,t){if(!t.isMonorepo)return null;let n=l.resolve(e);for(let r of t.packages){let s=l.resolve(r.path);if(n.startsWith(s))return r}return null}async function E(e){let t=l.resolve(e),n=l.parse(t).root;return t===n?null:(await R(t)).isMonorepo?t:E(l.dirname(t))}var Ct,et=h(()=>{"use strict";S();Ct=St.globSync;i(R,"detectMonorepo");i(T,"discoverMonorepoPackages");i(tt,"findContainingPackage");i(E,"findMonorepoRoot")});function rt(e,t){let n=typeof e=="string"?new Date(e).getTime():e;return Date.now()-n>t}var nt,it=h(()=>{"use strict";i(rt,"isExpired");nt=class{static{i(this,"TTLCache")}cache=new Map;ttl;maxSize;constructor(t={}){this.ttl=t.ttl??5e3,this.maxSize=t.maxSize??50}isValid(t){let n=this.cache.get(t);return n?Date.now()-n.timestamp<this.ttl:!1}get(t){let n=this.cache.get(t);return n?this.isValid(t)?n.data:(this.cache.delete(t),null):null}set(t,n){this.cache.set(t,{data:n,timestamp:Date.now()}),this.evictOldEntries()}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}has(t){return this.cache.has(t)}get size(){return this.cache.size}evictOldEntries(){if(this.cache.size<=this.maxSize)return;let n=Array.from(this.cache.entries()).sort((r,s)=>r[1].timestamp-s[1].timestamp).slice(0,this.cache.size-this.maxSize);for(let[r]of n)this.cache.delete(r)}stats(){return{size:this.cache.size,maxSize:this.maxSize,ttl:this.ttl}}prune(){let t=[...this.cache.keys()].filter(n=>!this.isValid(n));for(let n of t)this.cache.delete(n);return t.length}}});import kt from"node:fs/promises";import Mt from"node:path";async function st(){try{let e=await kt.readFile(ot(),"utf-8"),t=JSON.parse(e);return!t.timestamp||!t.detection||!t.detection.claude||!t.detection.gemini||!t.detection.codex||rt(t.timestamp,It)?null:t.detection}catch{return null}}async function at(e){let t={timestamp:new Date().toISOString(),detection:e};await W(ot(),t)}var ot,It,ct=h(()=>{"use strict";ut();it();S();ot=i(()=>Mt.join(lt.getCachePath(),"providers.json"),"cacheFile"),It=600*1e3;i(st,"readProviderCache");i(at,"writeProviderCache")});import{execFileSync as G}from"node:child_process";function x(e){for(let t of e.split(/\r?\n/)){let n=t.trim();if(n)return n}return null}function gt(e){if(!e||e.includes("\0"))return null;try{if(process.platform==="win32"){let t=G("where.exe",[e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],windowsHide:!0});return x(t)}try{let t=G("which",[e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return x(t)}catch{let t=G("/bin/sh",["-c",`command -v ${JSON.stringify(e)}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return x(t)}}catch{return null}}async function H(e){if(!e||e.includes("\0"))return null;try{if(process.platform==="win32"){let{stdout:t}=await A("where.exe",[e],{encoding:"utf-8",windowsHide:!0});return x(String(t))}try{let{stdout:t}=await A("which",[e]);return x(String(t))}catch{return gt(e)}}catch{return null}}function le(e){return gt(e)!==null}var mt=h(()=>{"use strict";J();i(x,"firstNonEmptyLine");i(gt,"whichSync");i(H,"whichAsync");i(le,"commandOnPath")});var k={};yt(k,{ClaudeProvider:()=>C,CursorProvider:()=>pt,GeminiProvider:()=>_,Providers:()=>v,detectAllProviders:()=>U,detectAntigravity:()=>Tt,detectCodex:()=>ht,detectKimi:()=>Et,detectProvider:()=>$,getActiveProvider:()=>Nt,getProviderBranding:()=>Rt,selectProvider:()=>Gt,validateCliVersion:()=>ft});import O from"node:path";async function L(e){let t=await H(e);return t||(process.platform==="win32"?H(`${e}.cmd`):null)}async function At(e){try{let{stdout:t}=await z(`${e} --version`,{timeout:2e3}),n=t.match(/\d+\.\d+\.\d+/);return n?n[0]:t.trim()}catch{return null}}async function $(e){let t=v[e];if(!t.cliCommand)return{installed:!1};let n=await L(t.cliCommand);if(!n)return{installed:!1};let r=await At(t.cliCommand),s=ft(e,r||void 0);return{installed:!0,version:r||void 0,path:n,versionWarning:s||void 0}}function ft(e,t){let n=v[e];return!n.minCliVersion||!t?null:Q(t,n.minCliVersion)<0?`\u26A0\uFE0F ${n.displayName} v${t} is below minimum v${n.minCliVersion}. Some features may not work correctly.`:null}async function U(e=!1){if(!e){let g=await st();if(g)return g}let[t,n,r]=await Promise.all([$("claude"),$("gemini"),ht()]),s={installed:r.installed},a={claude:t,gemini:n,codex:s};return await at(a).catch(()=>{}),a}async function Nt(e){if(e&&v[e])return v[e];let t=await U(),n=[t.claude.installed?"claude":null,t.gemini.installed?"gemini":null,t.codex.installed?"codex":null].filter(Boolean);return n.length===1?v[n[0]]:t.claude.installed?C:t.gemini.installed?_:t.codex.installed?B:C}function Rt(e){return{commitFooter:"Generated with [p/](https://www.prjct.app/)",signature:{claude:"\u26A1 prjct + Claude",gemini:"\u26A1 prjct + Gemini",cursor:"\u26A1 prjct + Cursor",antigravity:"\u26A1 prjct + Antigravity",codex:"\u26A1 prjct + Codex"}[e]||"\u26A1 prjct"}}async function Tt(){let e=dt.configDir;if(!e)return{installed:!1,skillInstalled:!1};let t=O.join(e,"skills","prjct","SKILL.md"),[n,r]=await Promise.all([u(e),u(t)]);return{installed:n,skillInstalled:r,configPath:n?e:void 0}}async function ht(){let e=B.configDir;if(!e)return{installed:!1,skillInstalled:!1};let t=await L("codex"),n=O.join(e,"skills","prjct","SKILL.md"),r=await u(n),s=!!t||await u(O.join(e,"auth.json"));return{installed:s,skillInstalled:r,configPath:s?e:void 0}}async function Et(){let e=m(".kimi"),[t,n]=await Promise.all([L("kimi"),u(e)]),r=!!t||n;return{installed:r,configPath:r?e:void 0}}async function Gt(){let e=await U();return{provider:e.claude.installed?"claude":e.gemini.installed?"gemini":e.codex.installed?"codex":"claude",detection:e}}var C,_,dt,pt,B,v,M=h(()=>{"use strict";wt();vt();J();S();ct();mt();q();C={name:"claude",displayName:"Claude Code",cliCommand:"claude",get configDir(){return m(".claude")},contextFile:"CLAUDE.md",get skillsDir(){return m(".claude","skills")},commandsDir:".claude/commands",commandFormat:"md",settingsFile:"settings.json",projectSettingsFile:"settings.local.json",ignoreFile:".claudeignore",websiteUrl:"https://www.anthropic.com/claude",docsUrl:"https://docs.anthropic.com/claude-code",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:"1.0.0"},_={name:"gemini",displayName:"Gemini CLI",cliCommand:"gemini",get configDir(){return m(".gemini")},contextFile:"GEMINI.md",get skillsDir(){return m(".gemini","skills")},commandsDir:".gemini/commands",commandFormat:"toml",settingsFile:"settings.json",projectSettingsFile:"settings.json",ignoreFile:".geminiignore",websiteUrl:"https://geminicli.com",docsUrl:"https://geminicli.com/docs",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:"1.0.0"},dt={name:"antigravity",displayName:"Google Antigravity",cliCommand:null,get configDir(){return m(".gemini","antigravity")},contextFile:"ANTIGRAVITY.md",get skillsDir(){return m(".gemini","antigravity","global_skills")},commandsDir:".agent/skills",commandFormat:"md",settingsFile:"mcp_config.json",projectSettingsFile:null,ignoreFile:".agentignore",websiteUrl:"https://gemini.google.com/app/antigravity",docsUrl:"https://gemini.google.com/app/antigravity",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:null},pt={name:"cursor",displayName:"Cursor IDE",cliCommand:null,configDir:null,contextFile:"prjct.mdc",skillsDir:null,commandsDir:".cursor/commands",rulesDir:".cursor/rules",commandFormat:"md",settingsFile:null,projectSettingsFile:null,ignoreFile:".cursorignore",isProjectLevel:!0,websiteUrl:"https://cursor.com",docsUrl:"https://cursor.com/docs",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:null},B={name:"codex",displayName:"OpenAI Codex",cliCommand:"codex",get configDir(){return m(".codex")},contextFile:"AGENTS.md",get skillsDir(){return m(".codex","skills")},commandsDir:".agents/skills",commandFormat:"md",settingsFile:null,projectSettingsFile:null,ignoreFile:".codexignore",websiteUrl:"https://openai.com/codex",docsUrl:"https://github.com/openai/codex",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:null},v={claude:C,gemini:_,cursor:pt,antigravity:dt,codex:B};i(L,"whichCommand");i(At,"getCliVersion");i($,"detectProvider");i(ft,"validateCliVersion");i(U,"detectAllProviders");i(Nt,"getActiveProvider");i(Rt,"getProviderBranding");i(Tt,"detectAntigravity");i(ht,"detectCodex");i(Et,"detectKimi");i(Gt,"selectProvider")});import Ht from"node:crypto";import I from"node:fs/promises";import o from"node:path";var V,Ot,lt,ut=h(()=>{Z();S();Dt();et();q();V=class{static{i(this,"PathManager")}globalBaseDir;globalConfigDir;constructor(){this.globalBaseDir=K(),this.globalConfigDir=o.join(this.globalBaseDir,"config")}get globalProjectsDir(){let t=process.env.PRJCT_PROJECTS_DIR;return t?o.resolve(t):o.join(this.globalBaseDir,"projects")}setGlobalBaseDir(t){this.globalBaseDir=o.resolve(t),this.globalConfigDir=o.join(this.globalBaseDir,"config")}generateProjectId(t){return Ht.randomUUID()}getGlobalBasePath(){return this.globalBaseDir}getGlobalProjectPath(t){return o.join(this.globalProjectsDir,t)}getLocalConfigPath(t){return o.join(t,".prjct","prjct.config.json")}getGlobalProjectConfigPath(t){return o.join(this.getGlobalProjectPath(t),"project.json")}getLegacyPrjctPath(t){return o.join(t,".prjct")}async hasLegacyStructure(t){return await N(this.getLegacyPrjctPath(t))}async hasConfig(t){return await u(this.getLocalConfigPath(t))}async ensureGlobalStructure(){await P(this.globalBaseDir),await P(this.globalProjectsDir),await P(this.globalConfigDir)}async ensureProjectStructure(t){await this.ensureGlobalStructure();let n=this.getGlobalProjectPath(t),r=["analysis","memory"];for(let s of r)await P(o.join(n,s));return await P(o.join(n,"sessions")),n}getSessionPath(t,n=new Date){let{year:r,month:s,day:a}=X(n);return o.join(this.getGlobalProjectPath(t),"sessions",r,s,a)}getCurrentSessionPath(t){return this.getSessionPath(t,new Date)}async ensureSessionPath(t,n=new Date){let r=this.getSessionPath(t,n);return await P(r),r}async listSessions(t,n=null,r=null){let s=o.join(this.getGlobalProjectPath(t),"sessions"),a=[];try{let g=await I.readdir(s,{withFileTypes:!0});for(let c of g){if(!c.isDirectory()||n&&c.name!==n.toString())continue;let d=o.join(s,c.name),p=await I.readdir(d,{withFileTypes:!0});for(let f of p){if(!f.isDirectory()||r&&f.name!==r.toString().padStart(2,"0"))continue;let j=o.join(d,f.name),Pt=await I.readdir(j,{withFileTypes:!0});for(let b of Pt)b.isDirectory()&&a.push({year:c.name,month:f.name,day:b.name,path:o.join(j,b.name),date:new Date(`${c.name}-${f.name}-${b.name}`)})}}return a.sort((c,d)=>d.date.getTime()-c.date.getTime()),a}catch{return[]}}async getSessionsInRange(t,n,r=new Date){return(await this.listSessions(t)).filter(a=>a.date>=n&&a.date<=r)}getFilePath(t,n,r){return o.join(this.getGlobalProjectPath(t),n,r)}async listProjects(){try{return await this.ensureGlobalStructure(),(await I.readdir(this.globalProjectsDir,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name)}catch{return[]}}async projectExists(t){return await N(this.getGlobalProjectPath(t))}getDisplayPath(t){let n=Y();return t.startsWith(n)?t.replace(n,"~"):t}getAuthConfigPath(){return o.join(this.globalConfigDir,"auth.json")}getSyncPendingPath(t){return o.join(this.getGlobalProjectPath(t),"sync","pending.json")}getLastSyncPath(t){return o.join(this.getGlobalProjectPath(t),"sync","last-sync.json")}getRunningStatusPath(){return o.join(this.globalBaseDir,".running")}getCachePath(){return o.join(this.globalBaseDir,"cache")}getStatePath(){return o.join(this.globalBaseDir,"state")}getStatusLinePath(){return o.join(this.globalBaseDir,"statusline")}async getAgentDir(){return(await(M(),F(k)).getActiveProvider()).configDir}async getAgentSettingsPath(){let t=await(M(),F(k)).getActiveProvider();return(M(),F(k)).getGlobalSettingsPath(t.name)}getClaudeDir(){return m(".claude")}getClaudeSettingsPath(){return o.join(this.getClaudeDir(),"settings.json")}getStoragePath(t,n){return o.join(this.getGlobalProjectPath(t),"storage",n)}getContextPath(t){return o.join(this.getGlobalProjectPath(t),"context")}async detectMonorepo(t){return R(t)}async discoverMonorepoPackages(t,n){return T(t,n)}async findContainingPackage(t,n){return tt(t,n)}async findMonorepoRoot(t){return E(t)}},Ot=new V,lt=Ot});export{$t as a,_t as b,xt as c,Bt as d,Lt as e,Ut as f,Vt as g,Z as h,rt as i,nt as j,it as k,H as l,le as m,mt as n,v as o,Nt as p,Rt as q,ht as r,Et as s,k as t,M as u,lt as v,ut as w};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as g}from"./chunk-QDQ7DTDV.mjs";import{d,g as C}from"./chunk-HDHVBB6Q.mjs";import{b as f,e as E}from"./chunk-AKIN5WSQ.mjs";import{e as _,o as q}from"./chunk-CTWZQ7YI.mjs";import{a as s}from"./chunk-E66B27AL.mjs";E();C();function m(e){return{projectId:e.project_id,taskId:e.task_id,workspaceId:e.workspace_id,classification:e.classification,station:e.station,requiresSpec:e.requires_spec===1,requiresTestsFirst:e.requires_tests_first===1,reason:e.reason,linkedSpecId:e.linked_spec_id,createdAt:e.created_at,updatedAt:e.updated_at}}s(m,"toState");function y(e,t){let i=f(),r=d.query(e,`INSERT INTO task_pipeline_state (
8
+ import{b as g}from"./chunk-M5E2YOZ4.mjs";import{d,g as C}from"./chunk-KG7Z6OMK.mjs";import{b as f,h as E}from"./chunk-JAMSIKDE.mjs";import{e as _,p as q}from"./chunk-QWQFF2UG.mjs";import{a as s}from"./chunk-E66B27AL.mjs";E();C();function m(e){return{projectId:e.project_id,taskId:e.task_id,workspaceId:e.workspace_id,classification:e.classification,station:e.station,requiresSpec:e.requires_spec===1,requiresTestsFirst:e.requires_tests_first===1,reason:e.reason,linkedSpecId:e.linked_spec_id,createdAt:e.created_at,updatedAt:e.updated_at}}s(m,"toState");function y(e,t){let i=f(),r=d.query(e,`INSERT INTO task_pipeline_state (
9
9
  project_id, task_id, workspace_id, classification, station,
10
10
  requires_spec, requires_tests_first, reason, linked_spec_id,
11
11
  created_at, updated_at
@@ -0,0 +1,8 @@
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{c as y}from"./chunk-R4ILCXKE.mjs";import{e as g,g as T}from"./chunk-KG7Z6OMK.mjs";import{d as b,e as I,o as A}from"./chunk-UH4MD3F3.mjs";import{a as l}from"./chunk-E66B27AL.mjs";import v from"node:fs/promises";import w from"node:path";T();A();var D=new Set(["the","a","an","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","of","in","to","for","with","on","at","from","by","as","or","and","but","if","not","no","so","up","out","this","that","it","its","all","any","import","export","default","const","let","var","function","class","interface","type","return","new","true","false","null","undefined","void","async","await","static","public","private","protected","readonly","string","number","boolean","object","array"]);function p(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[-_./]/g," ").toLowerCase().split(/\s+/).filter(n=>n.length>1)}l(p,"splitIdentifier");function B(t,n){let e=[],o=n.replace(/\.[^.]+$/,"").split(/[/\\]/).filter(Boolean);for(let i of o)e.push(...p(i));let r=[/export\s+(?:async\s+)?function\s+(\w+)/g,/export\s+class\s+(\w+)/g,/export\s+interface\s+(\w+)/g,/export\s+type\s+(\w+)/g,/export\s+(?:const|let|var)\s+(\w+)/g,/export\s+default\s+(?:class|function)\s+(\w+)/g];for(let i of r)for(let s of t.matchAll(i))s[1]&&e.push(...p(s[1]));let a=[/(?:async\s+)?function\s+(\w+)/g,/class\s+(\w+)/g,/interface\s+(\w+)/g,/type\s+(\w+)\s*=/g];for(let i of a)for(let s of t.matchAll(i))s[1]&&e.push(...p(s[1]));let d=/(?:from|import)\s+['"]([^'"]+)['"]/g;for(let i of t.matchAll(d)){let s=i[1];if(s.startsWith(".")||s.startsWith("@/"))e.push(...p(s));else{let f=s.startsWith("@")?s.split("/").slice(0,2).join("/"):s.split("/")[0];e.push(...p(f))}}let c=/\/\/\s*(.+)/g;for(let i of t.matchAll(c)){let s=i[1].toLowerCase().split(/\s+/).filter(f=>f.length>2);e.push(...s)}let u=/\/\*\*?([\s\S]*?)\*\//g;for(let i of t.matchAll(u)){let s=i[1].replace(/@\w+/g,"").replace(/\*/g,"").toLowerCase().split(/\s+/).filter(f=>f.length>2&&/^[a-z]+$/.test(f));e.push(...s)}return e.filter(i=>i.length>1&&!D.has(i)&&/^[a-z][a-z0-9]*$/.test(i))}l(B,"tokenizeFile");function R(t){return t.split(/\s+/).flatMap(n=>p(n)).filter(n=>n.length>1&&!D.has(n)&&/^[a-z][a-z0-9]*$/.test(n))}l(R,"tokenizeQuery");function x(){return Object.create(null)}l(x,"emptyInvertedIndex");async function C(t){let n=await b(t),e={},o=x(),r=await I(n,50,async c=>{try{let u=await v.readFile(w.join(t,c),"utf-8"),i=B(u,c);return i.length>0?{filePath:c,tokens:i}:null}catch{return null}});for(let{filePath:c,tokens:u}of r){e[c]={tokens:u,length:u.length};for(let[i,s]of M(u))o[i]||(o[i]=[]),o[i].push({path:c,tf:s})}let a=r.reduce((c,u)=>c+u.tokens.length,0),d=Object.keys(e).length;return{documents:e,invertedIndex:o,avgDocLength:d>0?a/d:0,totalDocs:d,builtAt:new Date().toISOString()}}l(C,"buildIndex");function N(t,n){return Math.log((n-t+.5)/(t+.5)+1)}l(N,"idf");function F(t,n){let e=R(t);if(e.length===0)return[];let o=new Map;for(let r of e){let a=n.invertedIndex[r];if(!a)continue;let d=N(a.length,n.totalDocs);for(let{path:c,tf:u}of a){let i=n.documents[c];if(!i)continue;let s=u*(1.2+1),f=u+1.2*(1-.75+.75*(i.length/n.avgDocLength)),L=d*(s/f);o.set(c,(o.get(c)||0)+L)}}return y(o)}l(F,"score");var h="bm25-index";function M(t){let n=new Map;for(let e of t)n.set(e,(n.get(e)||0)+1);return n}l(M,"termFrequencies");function P(t,n){let e=t.documents[n];if(!e)return;delete t.documents[n];let o=new Set(e.tokens),r=o.size>0?o:new Set(Object.keys(t.invertedIndex));for(let a of r){let d=t.invertedIndex[a];if(!d)continue;let c=d.filter(u=>u.path!==n);c.length===0?delete t.invertedIndex[a]:t.invertedIndex[a]=c}}l(P,"removeDocument");function z(t,n,e){if(e.length!==0){t.documents[n]={tokens:e,length:e.length};for(let[o,r]of M(e))t.invertedIndex[o]||(t.invertedIndex[o]=[]),t.invertedIndex[o].push({path:n,tf:r})}}l(z,"addDocument");function q(t){let n=Object.values(t.documents).map(o=>o.length),e=n.reduce((o,r)=>o+r,0);t.totalDocs=n.length,t.avgDocLength=n.length>0?e/n.length:0,t.builtAt=new Date().toISOString()}l(q,"recalculateStats");var m=new Map;function _(t){return{schemaVersion:2,avgDocLength:t.avgDocLength,totalDocs:t.totalDocs,builtAt:t.builtAt,docLengths:Object.fromEntries(Object.entries(t.documents).map(([n,e])=>[n,e.length]))}}l(_,"indexMetadata");function k(t,n,e,o,r){if(o.length!==0){t.run(e,JSON.stringify(o),o.length,r);for(let[a,d]of M(o))n.run(a,e,d)}}l(k,"writeDocumentRows");function W(t,n){try{g.transaction(t,e=>{e.prepare("DELETE FROM bm25_terms").run(),e.prepare("DELETE FROM bm25_documents").run();let o=new Date().toISOString(),r=e.prepare("INSERT INTO bm25_documents (path, tokens, length, updated_at) VALUES (?, ?, ?, ?)"),a=e.prepare("INSERT INTO bm25_terms (token, path, tf) VALUES (?, ?, ?)");for(let[d,c]of Object.entries(n.documents))k(r,a,d,c.tokens,o)})}catch{}}l(W,"replacePerFileTables");function $(t,n,e,o){try{g.transaction(t,r=>{let a=r.prepare("DELETE FROM bm25_terms WHERE path = ?"),d=r.prepare("DELETE FROM bm25_documents WHERE path = ?"),c=r.prepare("INSERT INTO bm25_documents (path, tokens, length, updated_at) VALUES (?, ?, ?, ?)"),u=r.prepare("INSERT INTO bm25_terms (token, path, tf) VALUES (?, ?, ?)"),i=new Date().toISOString();for(let s of new Set([...e,...o]))a.run(s),d.run(s);for(let s of e){let f=n.documents[s];f&&k(c,u,s,f.tokens,i)}})}catch{}}l($,"updatePerFileTables");function H(t,n){g.setDoc(t,h,_(n)),W(t,n),m.delete(t)}l(H,"saveIndex");function U(t,n,e,o){g.setDoc(t,h,_(n)),$(t,n,e,o),m.delete(t)}l(U,"saveIndexUpdate");function V(t,n,e){try{let o=g.query(t,"SELECT path, length FROM bm25_documents ORDER BY path");if(o.length===0){if(e?.totalDocs===0){let s={documents:{},invertedIndex:x(),avgDocLength:0,totalDocs:0,builtAt:e.builtAt};return m.set(t,{index:s,updatedAt:n}),s}return null}let r={},a=x();for(let s of o)r[s.path]={tokens:[],length:s.length};let d=o.reduce((s,f)=>s+f.length,0),c=g.query(t,"SELECT token, path, tf FROM bm25_terms ORDER BY token, path");for(let s of c)a[s.token]||(a[s.token]=[]),a[s.token].push({path:s.path,tf:s.tf});let u=o.length,i={documents:r,invertedIndex:a,avgDocLength:u>0?d/u:0,totalDocs:u,builtAt:e?.builtAt??n};return m.set(t,{index:i,updatedAt:n}),i}catch{return null}}l(V,"loadIndexFromPerFileTables");function tt(t){try{return g.get(t,"SELECT key AS k FROM kv_store WHERE key = ? LIMIT 1",h)!=null}catch{return!1}}l(tt,"hasIndex");function O(t){let n=g.get(t,"SELECT updated_at FROM kv_store WHERE key = ?",h);if(!n)return m.delete(t),null;let e=m.get(t);if(e&&e.updatedAt===n.updated_at)return e.index;let o=g.getDoc(t,h),r=V(t,n.updated_at,o);if(r)return r;if(!o?.invertedIndex)return null;let a={};for(let[c,u]of Object.entries(o.docLengths))a[c]={tokens:[],length:u};let d={documents:a,invertedIndex:Object.assign(x(),o.invertedIndex),avgDocLength:o.avgDocLength,totalDocs:o.totalDocs,builtAt:o.builtAt};return m.set(t,{index:d,updatedAt:n.updated_at}),d}l(O,"loadIndex");async function Y(t,n){let e=await C(t);return H(n,e),e}l(Y,"indexProject");async function nt(t,n,e,o=[]){let r=O(n);if(!r)return Y(t,n);let a=new Set([...e,...o]);for(let c of a)P(r,c);let d=await I(e,50,async c=>{try{let u=await v.readFile(w.join(t,c),"utf-8"),i=B(u,c);return{filePath:c,tokens:i}}catch{return null}});for(let{filePath:c,tokens:u}of d)z(r,c,u);return q(r),U(n,r,e,o),r}l(nt,"updateProjectIndex");function et(t,n,e=15){let o=O(t);return o?F(n,o).slice(0,e):[]}l(et,"queryFiles");export{tt as a,O as b,Y as c,nt as d,et as e};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as l,c as f,d as u}from"./chunk-TPESWBA7.mjs";import{a as c}from"./chunk-LLQUB6YR.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var m={none:0,frame:1,reviewed:2},y={none:0,after:1,first:2},p=o((e,n)=>m[e]>=m[n]?e:n,"maxSpec"),g=o((e,n)=>y[e]>=y[n]?e:n,"maxTest");function x(e){return e!=="docs"&&e!=="chore"}o(x,"isCodeKind");function E(e,n,t){let r=x(n);if(n==="research")return{model:"balanced",effort:"medium",spec:"none",tests:"none",fanout:"parallel",quality:"none",expectedPoints:2,directive:"",cast:[]};switch(e){case"H0":return{model:"fast",effort:"low",spec:"none",tests:"none",fanout:"direct",quality:"none",expectedPoints:1,directive:"",cast:[]};case"H1":return{model:"balanced",effort:"medium",spec:"none",tests:r?"after":"none",fanout:"direct",quality:r?"standard":"none",expectedPoints:2,directive:"",cast:[]};case"H2":return{model:"frontier",effort:"medium",spec:r?"frame":"none",tests:r?"first":"none",fanout:"parallel",quality:r?"standard":"none",expectedPoints:5,directive:"",cast:[]};default:return{model:"frontier",effort:t==="high"?"high":"medium",spec:r?"reviewed":"none",tests:r?"first":"none",fanout:"crew",quality:n==="security"||t==="high"||r?"full":"none",expectedPoints:8,directive:"",cast:[]}}}o(E,"baseline");function H(e,n,t,r){if(!x(n))return e;let s=t==="strict"?p(e.spec,"reviewed"):p(e.spec,t==="advisory"?"frame":"none"),a=r==="strict"?g(e.tests,"first"):g(e.tests,r==="assist"?"after":"none");return{...e,spec:s,tests:a}}o(H,"applyModeFloors");var h={none:"no spec",frame:'frame a lightweight spec (`prjct spec "<title>"`)',reviewed:'reviewed spec + audit panel (`prjct spec "<title>"` \u2192 `prjct spec audit <id>`)'},T={none:"no test ceremony",after:"leave a regression test behind",first:"tests BEFORE implementation"},w={direct:"do it yourself \u2014 no subagents",parallel:"DEFAULT multi-agent geometry: explore (fast) \u2192 implement (frontier) \u2192 review (balanced dual-blind); set EACH subagent model explicitly (they inherit yours otherwise: mem_3432). Stay single-thread only for a truly atomic one-file fix",crew:"DEFAULT crew geometry (`prjct crew`): leader + implementer + review lenses. Set EACH subagent model (Explore\u2192fast, implementer\u2192frontier, reviewers\u2192balanced) \u2014 they inherit your expensive model unless you fix it"},v={none:"no judgment tax (trivial)",standard:"quality auto: ledger opened; follow injected `prjct judgment next` card (one review + batch challenge)",full:"quality auto: ledger opened; follow injected next card (RED+BLUE dual-blind + batch refuters)"},S={fast:"fast/cheap model (e.g. haiku)",balanced:"balanced model (e.g. sonnet)",frontier:"frontier model (e.g. opus)"},O="Before implementing, forecast the diff size: if it will exceed ~400 changed lines, decide the delivery strategy NOW (split into stacked PRs / ship a first slice) instead of producing one unreviewable diff.";function P(e,n,t){let r=t.effort==="high"?", HIGH effort":t.effort==="low"?", low effort":"";if(e==="H0")return`Orchestrate (${e} ${n}): trivial \u2014 do it directly on a ${S[t.model]}${r}. ${h[t.spec]}, ${T[t.tests]}, ${w[t.fanout]}. ${v[t.quality]}. Don\u2019t burn frontier tokens on this. ${c}`;let s=e==="H2"||e==="H3"?` ${O}`:"",a=t.fanout==="parallel"||t.fanout==="crew"?" Multi-agent is the DEFAULT geometry for this harness class \u2014 do not collapse to a single-thread monologue unless the change is truly atomic.":"",i=t.cast.length>0?` ${l(t.cast)}. ${f(t.cast)}`:"";return`Orchestrate (${e} ${n}/${t.model}${r}): ${h[t.spec]}; ${T[t.tests]}; ${w[t.fanout]}; ${v[t.quality]}.${s}${a}${i} ${c}`}o(P,"renderDirective");function q(e){return e<50?1:e<150?2:e<400?5:8}o(q,"pointsFromDiffLines");function A(e){return e>=8?`\u26A0 Delegation trigger: ${e} files edited this cycle. This is no longer one change \u2014 split the remainder into its own cycle/PR and run a FRESH-context review of what's already written before \`prjct status done\`.`:e>=4?`\u21B3 Delegation trigger: ${e} files edited this cycle. Keep ONE writer thread; before closing, review the full diff with fresh eyes (subagent or re-read) \u2014 multi-file changes hide cross-file breaks.`:null}o(A,"renderDelegationTrigger");function D(e,n="off",t="off",r="off",s){let a=E(e.level,e.kind,e.risk),i=H(a,e.kind,n,t),b=r==="on"&&i.quality==="none"?"standard":r==="on"&&i.quality==="standard"?"full":i.quality,$=(s??`${e.level}:${e.kind}:${e.risk}`).trim(),C=u(i.fanout,$),d={...i,quality:b,cast:C};return{...d,directive:P(e.level,e.kind,d)}}o(D,"orchestrationFor");export{q as a,A as b,D as c};
8
+ import{b as l,c as f,d as u}from"./chunk-TPESWBA7.mjs";import{a as c}from"./chunk-7O6OMD4X.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var m={none:0,frame:1,reviewed:2},y={none:0,after:1,first:2},p=o((e,n)=>m[e]>=m[n]?e:n,"maxSpec"),g=o((e,n)=>y[e]>=y[n]?e:n,"maxTest");function x(e){return e!=="docs"&&e!=="chore"}o(x,"isCodeKind");function E(e,n,t){let r=x(n);if(n==="research")return{model:"balanced",effort:"medium",spec:"none",tests:"none",fanout:"parallel",quality:"none",expectedPoints:2,directive:"",cast:[]};switch(e){case"H0":return{model:"fast",effort:"low",spec:"none",tests:"none",fanout:"direct",quality:"none",expectedPoints:1,directive:"",cast:[]};case"H1":return{model:"balanced",effort:"medium",spec:"none",tests:r?"after":"none",fanout:"direct",quality:r?"standard":"none",expectedPoints:2,directive:"",cast:[]};case"H2":return{model:"frontier",effort:"medium",spec:r?"frame":"none",tests:r?"first":"none",fanout:"parallel",quality:r?"standard":"none",expectedPoints:5,directive:"",cast:[]};default:return{model:"frontier",effort:t==="high"?"high":"medium",spec:r?"reviewed":"none",tests:r?"first":"none",fanout:"crew",quality:n==="security"||t==="high"||r?"full":"none",expectedPoints:8,directive:"",cast:[]}}}o(E,"baseline");function H(e,n,t,r){if(!x(n))return e;let s=t==="strict"?p(e.spec,"reviewed"):p(e.spec,t==="advisory"?"frame":"none"),a=r==="strict"?g(e.tests,"first"):g(e.tests,r==="assist"?"after":"none");return{...e,spec:s,tests:a}}o(H,"applyModeFloors");var h={none:"no spec",frame:'frame a lightweight spec (`prjct spec "<title>"`)',reviewed:'reviewed spec + audit panel (`prjct spec "<title>"` \u2192 `prjct spec audit <id>`)'},T={none:"no test ceremony",after:"leave a regression test behind",first:"tests BEFORE implementation"},w={direct:"do it yourself \u2014 no subagents",parallel:"DEFAULT multi-agent geometry: explore (fast) \u2192 implement (frontier) \u2192 review (balanced dual-blind); set EACH subagent model explicitly (they inherit yours otherwise: mem_3432). Stay single-thread only for a truly atomic one-file fix",crew:"DEFAULT crew geometry (`prjct crew`): leader + implementer + review lenses. Set EACH subagent model (Explore\u2192fast, implementer\u2192frontier, reviewers\u2192balanced) \u2014 they inherit your expensive model unless you fix it"},v={none:"no judgment tax (trivial)",standard:"quality auto: ledger opened; follow injected `prjct judgment next` card (one review + batch challenge)",full:"quality auto: ledger opened; follow injected next card (RED+BLUE dual-blind + batch refuters)"},S={fast:"fast/cheap model (e.g. haiku)",balanced:"balanced model (e.g. sonnet)",frontier:"frontier model (e.g. opus)"},O="Before implementing, forecast the diff size: if it will exceed ~400 changed lines, decide the delivery strategy NOW (split into stacked PRs / ship a first slice) instead of producing one unreviewable diff.";function P(e,n,t){let r=t.effort==="high"?", HIGH effort":t.effort==="low"?", low effort":"";if(e==="H0")return`Orchestrate (${e} ${n}): trivial \u2014 do it directly on a ${S[t.model]}${r}. ${h[t.spec]}, ${T[t.tests]}, ${w[t.fanout]}. ${v[t.quality]}. Don\u2019t burn frontier tokens on this. ${c}`;let s=e==="H2"||e==="H3"?` ${O}`:"",a=t.fanout==="parallel"||t.fanout==="crew"?" Multi-agent is the DEFAULT geometry for this harness class \u2014 do not collapse to a single-thread monologue unless the change is truly atomic.":"",i=t.cast.length>0?` ${l(t.cast)}. ${f(t.cast)}`:"";return`Orchestrate (${e} ${n}/${t.model}${r}): ${h[t.spec]}; ${T[t.tests]}; ${w[t.fanout]}; ${v[t.quality]}.${s}${a}${i} ${c}`}o(P,"renderDirective");function q(e){return e<50?1:e<150?2:e<400?5:8}o(q,"pointsFromDiffLines");function A(e){return e>=8?`\u26A0 Delegation trigger: ${e} files edited this cycle. This is no longer one change \u2014 split the remainder into its own cycle/PR and run a FRESH-context review of what's already written before \`prjct status done\`.`:e>=4?`\u21B3 Delegation trigger: ${e} files edited this cycle. Keep ONE writer thread; before closing, review the full diff with fresh eyes (subagent or re-read) \u2014 multi-file changes hide cross-file breaks.`:null}o(A,"renderDelegationTrigger");function D(e,n="off",t="off",r="off",s){let a=E(e.level,e.kind,e.risk),i=H(a,e.kind,n,t),b=r==="on"&&i.quality==="none"?"standard":r==="on"&&i.quality==="standard"?"full":i.quality,$=(s??`${e.level}:${e.kind}:${e.risk}`).trim(),C=u(i.fanout,$),d={...i,quality:b,cast:C};return{...d,directive:P(e.level,e.kind,d)}}o(D,"orchestrationFor");export{q as a,A as b,D as c};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as r}from"./chunk-E66B27AL.mjs";import{createHash as e}from"node:crypto";function n(t){return e("sha256").update(t).digest("hex")}r(n,"sha256");function s(t){return n(t).slice(0,16)}r(s,"sha256Short");export{n as a,s as b};
8
+ import{a as r}from"./chunk-E66B27AL.mjs";function o(e,t,d){let a=e.filter(n=>n.type==="added").length,m=e.filter(n=>n.type==="removed").length,l=e.filter(n=>n.type==="changed").length;return{hasChanges:e.length>0,items:e,summary:{added:a,removed:m,changed:l},beforeCommit:t,afterCommit:d}}r(o,"summarizeDiffItems");export{o as a};
@@ -0,0 +1,14 @@
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{e as D,g as O,h as v,i as G,j as q}from"./chunk-FX6VHIKB.mjs";import{a as W,b as C}from"./chunk-HHIGNKDO.mjs";import{g as z,k as T}from"./chunk-7GNWHWOO.mjs";import{a as B,e as H}from"./chunk-JMCMTX6U.mjs";import{c as A}from"./chunk-R4ILCXKE.mjs";import{a as I}from"./chunk-27XFSCOE.mjs";import{e as w,g as se}from"./chunk-KG7Z6OMK.mjs";import{a as L,p as oe}from"./chunk-QWQFF2UG.mjs";import{a as c}from"./chunk-E66B27AL.mjs";se();oe();async function ce(e,t=100){try{let{stdout:r}=await L(`git log --name-only --pretty=format:'---COMMIT---' -${t}`,{cwd:e,maxBuffer:10485760}),n=r.split(`
9
+ `).reduce((o,i)=>{let m=i.trim();return m==="---COMMIT---"?(o.currentFiles&&o.currentFiles.size>0&&o.currentFiles.size<=30&&o.commits.push(o.currentFiles),o.currentFiles=new Set):m&&o.currentFiles&&ae(m)&&o.currentFiles.add(m),o},{commits:[],currentFiles:null});return n.currentFiles&&n.currentFiles.size>0&&n.currentFiles.size<=30&&n.commits.push(n.currentFiles),n.commits}catch{return[]}}c(ce,"parseGitLog");function ae(e){return/\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|java|cs|rb|php|vue|svelte)$/i.test(e)&&!e.includes("node_modules/")}c(ae,"isSourceFile");async function le(e,t=100){let r=await ce(e,t),n=new Map,o=new Map;for(let m of r){let p=Array.from(m);for(let g of p)n.set(g,(n.get(g)||0)+1);for(let[g,f]of p.entries())for(let h of p.slice(g+1)){let d=me(f,h);o.set(d,(o.get(d)||0)+1)}}let i={};for(let[m,p]of o){let[g,f]=m.split("\0"),h=n.get(g)||0,d=n.get(f)||0;if(h<2||d<2)continue;let s=h+d-p,a=s>0?p/s:0;a<.1||(i[g]||(i[g]={}),i[f]||(i[f]={}),i[g][f]=a,i[f][g]=a)}return{matrix:i,commitsAnalyzed:r.length,filesAnalyzed:n.size,builtAt:new Date().toISOString()}}c(le,"buildMatrix");function me(e,t){return e<t?`${e}\0${t}`:`${t}\0${e}`}c(me,"pairKey");function _(e,t){let r=new Set(e),n=new Map;for(let o of e){let i=t.matrix[o];if(i)for(let[m,p]of Object.entries(i)){if(r.has(m))continue;let g=n.get(m)||0;p>g&&n.set(m,p)}}return A(n)}c(_,"scoreFromSeeds");var N="cochange-index",R=new Map;function ge(e,t){w.setDoc(e,N,t),R.delete(e)}c(ge,"saveMatrix");function F(e){let t=w.get(e,"SELECT updated_at FROM kv_store WHERE key = ?",N);if(!t)return R.delete(e),null;let r=R.get(e);if(r&&r.updatedAt===t.updated_at)return r.matrix;let n=w.getDoc(e,N);return n&&R.set(e,{matrix:n,updatedAt:t.updated_at}),n}c(F,"loadMatrix");async function pe(e,t){try{let{stdout:r}=await L(`git rev-list --max-count=${t} HEAD`,{cwd:e,maxBuffer:1048576}),n=r.split(`
10
+ `).map(o=>o.trim()).filter(Boolean);return n.length>0?n.join(`
11
+ `):null}catch{return null}}c(pe,"recentHistoryFingerprint");async function Se(e,t,r=100){let n=await pe(e,r),o=n?F(t):null;if(o?.historyFingerprint===n)return o;let i=await le(e,r);return n&&(i.historyFingerprint=n),ge(t,i),i}c(Se,"indexCoChanges");function E(e){if(e.length===0)return[];let t=e[0]?.score||1;return e.map(r=>({path:r.path,score:r.score/t}))}c(E,"normalize");var M=[{name:"bm25",kind:"query",defaultWeight:.45,hasIndex:c(e=>B(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(H(e,t,r)),"scoreFromQuery")},{name:"symbols",kind:"query",defaultWeight:.2,hasIndex:c(e=>z(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(T(e,t,r)),"scoreFromQuery")},{name:"imports",kind:"seed",defaultWeight:.2,hasIndex:c(e=>C(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t,r)=>{let n=C(e);return n?E(W(t,n,r.importDepth)):[]},"scoreFromSeeds")},{name:"cochange",kind:"seed",defaultWeight:.15,hasIndex:c(e=>F(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t)=>{let r=F(e);return r?E(_(t,r)):[]},"scoreFromSeeds")}];var ue={bm25Weight:.45,importWeight:.2,cochangeWeight:.15,symbolsWeight:.2,topN:15,importDepth:2},Q=10;function U(e,t,r={}){let n={...ue,...r},o={bm25:n.bm25Weight,symbols:n.symbolsWeight,imports:n.importWeight,cochange:n.cochangeWeight},i=M.filter(s=>s.kind==="query"),m=M.filter(s=>s.kind==="seed"),p=new Map,g=new Map;for(let s of i){let a=s.scoreFromQuery(e,t,n.topN*3);if(a.length!==0){p.set(s.name,new Map(a.map(u=>[u.path,u.score])));for(let u of a.slice(0,Q))g.set(u.path,Math.max(g.get(u.path)??0,u.score))}}if(p.size===0)return[];let f=[...g.entries()].sort((s,a)=>a[1]-s[1]).slice(0,Q).map(([s])=>s);for(let s of m){let a=s.scoreFromSeeds(e,f,{importDepth:n.importDepth});a.length!==0&&p.set(s.name,new Map(a.map(u=>[u.path,u.score])))}let h=new Set;for(let s of p.values())for(let a of s.keys())h.add(a);let d=[];for(let s of h){let a=[...p].reduce((u,[l,y])=>{let b=y.get(s)??0,k=o[l]??M.find(S=>S.name===l)?.defaultWeight??0;return u+b*k},0);d.push({path:s,finalScore:a,signals:{bm25:p.get("bm25")?.get(s)??0,imports:p.get("imports")?.get(s)??0,cochange:p.get("cochange")?.get(s)??0,symbols:p.get("symbols")?.get(s)??0}})}return d.sort((s,a)=>a.finalScore-s.finalScore),d.slice(0,n.topN)}c(U,"rankFiles");function K(e){let t={};for(let r of M)t[r.name]=r.hasIndex(e);return{bm25:t.bm25??!1,imports:t.imports??!1,cochange:t.cochange??!1,symbols:t.symbols??!1}}c(K,"hasIndexes");function X(e,t,r=8){let n=t.map(s=>s.trim()).filter(Boolean),o=!!C(e),i=!!F(e),m=new Map;if(n.length>0&&o)try{for(let s of W(n,C(e),2)){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("imports"),m.set(s.path,a)}}catch{}if(n.length>0&&i)try{for(let s of _(n,F(e))){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("cochange"),m.set(s.path,a)}}catch{}let p=[...m.entries()].map(([s,a])=>({path:s,score:a.score,via:a.via.size>1?"both":[...a.via][0]??"imports"})).sort((s,a)=>a.score-s.score).slice(0,r),g=[];for(let s of n.slice(0,5))try{let a=I.recallForFile(e,s,2,{preventiveOnly:!0});for(let u of a)g.push({id:u.id,type:u.type,title:u.content.replace(/\s+/g," ").trim().slice(0,100),file:s})}catch{}let f=p.length>0?`related=${p.slice(0,3).map(s=>s.path.split("/").pop()).join(",")}`:o||i?"related=none-strong":"indexes=cold",h=g.length>0?`traps=${g.length}`:"traps=0",d=n.length===0?"World model: no seed files":`World model impact: seeds=${n.length} \xB7 ${f} \xB7 ${h}`;return{seeds:n,neighbors:p,traps:g.slice(0,r),line:d,hasIndexes:{imports:o,cochange:i}}}c(X,"breakImpact");var J=8,Y=/(?:^|[\s`"'(])((?:@?[\w.-]+\/)+[\w.-]+\.[\w.-]+)(?:$|[\s`"'),;:])/g;function Oe(e,t,r=J){let n=t.trim();if(!n)return re();let o=Z(e,n);return V(e,n,o,r)}c(Oe,"resolveWorkScopeSync");async function Ge(e,t,r,n=J){let o=r.trim();if(!o)return re();let i=new Set(Z(t,o));try{let{enrichedRecall:m}=await import("./enriched-recall-X6RDNNIE.mjs"),p=await m(e,t,{topic:o,types:["context","decision","gotcha","anti-pattern","learning"],limit:12});for(let g of ee(p,t))i.add(g)}catch{}return V(t,o,i,n)}c(Ge,"resolveWorkScope");function V(e,t,r,n){let o=K(e),i=new Map,m=D(e),p=O(e),g=c((l,y,b,k)=>{if(!v(e,l))return;let S=y*G(e,l),x=i.get(l);if(!x){i.set(l,{path:l,score:S,signals:[b],reason:k});return}x.score+=S,x.signals.includes(b)||x.signals.push(b),S>=.4&&(x.reason=k)},"bump");for(let l of r)g(l,fe(l,p),"memory","linked from project judgment memory (decision/gotcha/context)");let f=(()=>{if(!(o.bm25||o.symbols))return[];try{return U(e,t,{topN:Math.max(n*2,12)})}catch{return[]}})();for(let l of f){let y=l.signals.symbols??0,b=[l.signals.bm25>0?"bm25":null,y>0?"symbols":null,l.signals.imports>0?"imports":null,l.signals.cochange>0?"cochange":null].filter(x=>x!==null),k=Math.max(l.signals.bm25,y,l.signals.imports,l.signals.cochange),S=y>=k&&y>0?"matches function/class/route symbols in code graph":l.signals.bm25>=l.signals.imports&&l.signals.bm25>=l.signals.cochange?"matches task terms in code index (BM25)":l.signals.imports>=l.signals.cochange?"import-graph neighbor of matched files":"historically co-changes with matched files";g(l.path,l.finalScore,b[0]??"bm25",S);for(let x of b.slice(1)){let $=i.get(l.path);$&&!$.signals.includes(x)&&$.signals.push(x)}}let h=f.length,d=[...i.keys()].slice(0,5);d.length===0&&r.size>0&&d.push(...[...r].slice(0,5));let s=(()=>{if(d.length===0)return null;try{return X(e,d,n)}catch{return null}})();if(s)for(let l of s.neighbors)g(l.path,.35*Math.min(1,l.score+.1),l.via==="both"?"imports":l.via,l.via==="cochange"?"historically co-changes with seed files":"import-graph neighbor of seed files");let a=s?.neighbors.length??0,u=[...i.values()].sort((l,y)=>y.score-l.score).slice(0,n);return{files:u,indexesReady:o.bm25||o.imports||o.cochange||o.symbols,sources:{memorySeeds:r.size,indexHits:h,graphNeighbors:a},agentBlock:de(u,{indexesReady:o.bm25||o.imports||o.cochange||o.symbols,memorySeeds:r.size,inventoryLine:q(m)})}}c(V,"mergeScope");function Z(e,t){let r=new Set;try{let n=t.split(/\s+/).filter(m=>m.length>2).slice(0,12),o=n.length>0?(()=>{try{return I.searchFts(e,n,15)}catch{return[]}})():[],i=o.length>0?o:I.recall(e,{types:["gotcha","decision","anti-pattern","context"],limit:20});for(let m of ee(i,e))r.add(m)}catch{}return r}c(Z,"memoryFileSeedsSync");function ee(e,t){let r=new Set,n=c(o=>{let i=te(o);i&&(t?v(t,i)&&r.add(i):ne(i)&&r.add(i))},"accept");for(let o of e){let i=o.tags?.file?.trim();i&&n(i);let m=o.tags?.files?.trim();if(m)for(let g of m.split(",")){let f=g.trim();f&&n(f)}let p=o.content??"";Y.lastIndex=0;for(let g of p.matchAll(Y))n(g[1])}return[...r]}c(ee,"extractFilePathsFromEntries");function te(e){return e.replace(/^\.\//,"").replace(/\\/g,"/")}c(te,"normalizePath");function ne(e){let t=te(e).trim();return!t||t.length<3?!1:t.includes("/")&&t.includes(".")}c(ne,"looksLikeRepoPath");function fe(e,t){let r=(e.split("/").pop()??e).toLowerCase(),n=r.includes(".")?`.${r.split(".").pop()}`:"";return r==="package.json"||r==="cargo.toml"||r==="go.mod"?.4:t.size>0&&n&&t.has(n)?e.includes("/")?.9:.75:e.includes("/")&&r.includes(".")?.7:.5}c(fe,"memorySeedWeight");function re(){return{files:[],indexesReady:!1,sources:{memorySeeds:0,indexHits:0,graphNeighbors:0},agentBlock:""}}c(re,"emptyResult");function de(e,t){if(e.length===0)return t?.indexesReady===!1?["**Work scope (prjct):** indexes cold \u2014 run `prjct sync` once, then re-resolve scope.",t.inventoryLine?`_${t.inventoryLine}_`:"","Until then: prefer `prjct search` / `prjct context memory <topic>` over raw Grep/Glob walks."].filter(Boolean).join(`
12
+ `):["**Work scope (prjct):** no high-confidence file hits for this query.",t?.inventoryLine?`_${t.inventoryLine}_`:"","MUST still try `prjct context memory <topic>` + `prjct search` before a broad Grep/Glob walk."].filter(Boolean).join(`
13
+ `);let r=["**Work scope \u2014 prjct (MUST read before Grep/Glob):**","> Do NOT walk the tree. Open these first. Expand only via `prjct guard <file>` (graph neighbors + traps) or MCP `prjct_relevant_files` / `prjct_impact_analysis`.",...e.map(n=>{let o=n.signals.length>0?` (${n.signals.join("+")})`:"";return`- \`${n.path}\` \u2014 ${n.reason}${o}`})];return t?.memorySeeds&&t.memorySeeds>0&&r.push(`_Seeded from ${t.memorySeeds} memory path hit(s) + code index + graph._`),t?.inventoryLine&&r.push(`_${t.inventoryLine}_`),r.join(`
14
+ `)}c(de,"formatWorkScopeBlock");function qe(e){return e.map(({path:t,signals:r,reason:n})=>({path:t,signals:r,reason:n}))}c(qe,"toLikelyFileHits");function je(e,t){return t?v(t,e):ne(e)}c(je,"isUsefulScopePath");export{F as a,Se as b,Oe as c,Ge as d,ee as e,de as f,qe as g,je as h};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as U,c as W}from"./chunk-CE4RCNC7.mjs";import{s as h,t as Y}from"./chunk-AKIN5WSQ.mjs";import{d as D,f as B}from"./chunk-BUDZL4DW.mjs";import{a as r,b as g,c as l,d as M}from"./chunk-E66B27AL.mjs";import P from"node:crypto";function R(e){let t=e.toLowerCase().replace(/\s+/g," ").trim();return P.createHash("sha256").update(t).digest("hex")}var k=l(()=>{"use strict";r(R,"memoryFingerprint")});var C,f=l(()=>{"use strict";C=`
8
+ import{a as U,c as W}from"./chunk-CE4RCNC7.mjs";import{v as h,w as Y}from"./chunk-JAMSIKDE.mjs";import{d as D,f as B}from"./chunk-BUDZL4DW.mjs";import{a as r,b as g,c as l,d as M}from"./chunk-E66B27AL.mjs";import P from"node:crypto";function R(e){let t=e.toLowerCase().replace(/\s+/g," ").trim();return P.createHash("sha256").update(t).digest("hex")}var k=l(()=>{"use strict";r(R,"memoryFingerprint")});var C,f=l(()=>{"use strict";C=`
9
9
  -- =======================================================================
10
10
  -- Document storage (backward-compatible with JSON file pattern)
11
11
  -- =======================================================================
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as D}from"./chunk-DYHYDHCW.mjs";import{a as x}from"./chunk-3LG3ACQV.mjs";import{c as N}from"./chunk-AOPJ4Z6O.mjs";import{e as u,g as M}from"./chunk-HDHVBB6Q.mjs";import{b as m,e as C}from"./chunk-AKIN5WSQ.mjs";import{a as d}from"./chunk-E66B27AL.mjs";import{z as r}from"zod";var R=["draft","reviewed","in_progress","shipped","archived"];var k=r.object({verdict:r.enum(["pass","fail"]),notes:r.string(),ts:r.string(),candidateHash:r.string().optional()}),P=r.object({risk:r.string().min(1),mitigation:r.string().min(1)}),b=r.object({name:r.string().min(1),given:r.array(r.string()).default([]),when:r.array(r.string()).default([]),then:r.array(r.string()).default([])}),q=r.object({slug:r.string().min(1),name:r.string().min(1),statement:r.string().min(1),scenarios:r.array(b).default([])}),$=r.object({added:r.array(q).default([]),modified:r.array(q).default([]),removed:r.array(r.string().min(1)).default([])}),H=r.object({id:r.string().min(1),ts:r.string(),ops:$}),h=r.object({goal:r.string().min(1),eli10:r.string().default(""),stakes:r.string().default(""),acceptance_criteria:r.array(r.string().min(1)).default([]),scope:r.array(r.string()).default([]),out_of_scope:r.array(r.string()).default([]),risks:r.array(P).default([]),test_plan:r.array(r.string()).default([]),reviews:r.record(r.string(),k).optional(),selected_reviewers:r.array(r.string()).default([]),linked_tasks:r.array(r.string()).default([]),notes:r.string().default(""),tasks_created_at:r.string().nullable().default(null),audit_candidate_hash:r.string().nullable().default(null),scenarios:r.record(r.string(),r.array(b)).default({}),delta_log:r.array(H).default([])});import{createHash as W}from"node:crypto";C();function F(l){return l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}d(F,"slugifyRequirement");function z(l){return`delta-${W("sha256").update(l.trim()).digest("hex").slice(0,12)}`}d(z,"deltaIdFor");function v(l){return[...l].sort((t,e)=>t.ts===e.ts?t.id<e.id?-1:t.id>e.id?1:0:t.ts<e.ts?-1:1)}d(v,"sortDeltaLog");function L(l,t){let e=new Map;for(let n of[...l,...t])e.has(n.id)||e.set(n.id,n);return v([...e.values()])}d(L,"mergeDeltaLogs");function A(l){let t=new Set;for(let e of l)for(let n of[...e.ops.added,...e.ops.modified])t.add(n.statement);return t}d(A,"allDeltaStatements");function U(l){let t={order:[],statements:new Map,scenarios:new Map},e=d(n=>{t.statements.has(n.slug)||t.order.push(n.slug),t.statements.set(n.slug,n.statement),n.scenarios.length>0?t.scenarios.set(n.slug,n.scenarios):t.scenarios.delete(n.slug)},"upsert");for(let n of v(l)){for(let s of n.ops.added)e(s);for(let s of n.ops.modified)e(s);for(let s of n.ops.removed){t.statements.delete(s),t.scenarios.delete(s);let i=t.order.indexOf(s);i>=0&&t.order.splice(i,1)}}return t}d(U,"foldEntries");function O(l){let t=U(l),e={};for(let n of t.order){let s=t.scenarios.get(n);s&&(e[n]=s)}return{acceptance_criteria:t.order.map(n=>t.statements.get(n)??""),scenarios:e}}d(O,"materializeDeltas");function J(l){let t=[],e=[],n=[],s={section:null,req:null,scenario:null},i=d(()=>{s.scenario&&s.req&&s.req.scenarios.push({name:s.scenario.name,given:s.scenario.given,when:s.scenario.when,then:s.scenario.then}),s.scenario=null},"flushScenario"),c=d(()=>{i();let a=s.req;if(s.req=null,!a)return;let o=F(a.name);if(!o)throw new Error(`DELTA_PARSE: requirement name yields an empty slug: "${a.name}"`);if(s.section==="removed"){n.push(o);return}let g=a.statementLines.join(`
8
+ import{a as D}from"./chunk-DYHYDHCW.mjs";import{a as x}from"./chunk-5EQLQ7GF.mjs";import{b as N}from"./chunk-UA4Z5TGG.mjs";import{e as u,g as M}from"./chunk-KG7Z6OMK.mjs";import{b as m,h as C}from"./chunk-JAMSIKDE.mjs";import{a as d}from"./chunk-E66B27AL.mjs";import{z as r}from"zod";var R=["draft","reviewed","in_progress","shipped","archived"];var k=r.object({verdict:r.enum(["pass","fail"]),notes:r.string(),ts:r.string(),candidateHash:r.string().optional()}),P=r.object({risk:r.string().min(1),mitigation:r.string().min(1)}),b=r.object({name:r.string().min(1),given:r.array(r.string()).default([]),when:r.array(r.string()).default([]),then:r.array(r.string()).default([])}),q=r.object({slug:r.string().min(1),name:r.string().min(1),statement:r.string().min(1),scenarios:r.array(b).default([])}),$=r.object({added:r.array(q).default([]),modified:r.array(q).default([]),removed:r.array(r.string().min(1)).default([])}),H=r.object({id:r.string().min(1),ts:r.string(),ops:$}),h=r.object({goal:r.string().min(1),eli10:r.string().default(""),stakes:r.string().default(""),acceptance_criteria:r.array(r.string().min(1)).default([]),scope:r.array(r.string()).default([]),out_of_scope:r.array(r.string()).default([]),risks:r.array(P).default([]),test_plan:r.array(r.string()).default([]),reviews:r.record(r.string(),k).optional(),selected_reviewers:r.array(r.string()).default([]),linked_tasks:r.array(r.string()).default([]),notes:r.string().default(""),tasks_created_at:r.string().nullable().default(null),audit_candidate_hash:r.string().nullable().default(null),scenarios:r.record(r.string(),r.array(b)).default({}),delta_log:r.array(H).default([])});import{createHash as W}from"node:crypto";C();function F(l){return l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}d(F,"slugifyRequirement");function z(l){return`delta-${W("sha256").update(l.trim()).digest("hex").slice(0,12)}`}d(z,"deltaIdFor");function v(l){return[...l].sort((t,e)=>t.ts===e.ts?t.id<e.id?-1:t.id>e.id?1:0:t.ts<e.ts?-1:1)}d(v,"sortDeltaLog");function L(l,t){let e=new Map;for(let n of[...l,...t])e.has(n.id)||e.set(n.id,n);return v([...e.values()])}d(L,"mergeDeltaLogs");function A(l){let t=new Set;for(let e of l)for(let n of[...e.ops.added,...e.ops.modified])t.add(n.statement);return t}d(A,"allDeltaStatements");function U(l){let t={order:[],statements:new Map,scenarios:new Map},e=d(n=>{t.statements.has(n.slug)||t.order.push(n.slug),t.statements.set(n.slug,n.statement),n.scenarios.length>0?t.scenarios.set(n.slug,n.scenarios):t.scenarios.delete(n.slug)},"upsert");for(let n of v(l)){for(let s of n.ops.added)e(s);for(let s of n.ops.modified)e(s);for(let s of n.ops.removed){t.statements.delete(s),t.scenarios.delete(s);let i=t.order.indexOf(s);i>=0&&t.order.splice(i,1)}}return t}d(U,"foldEntries");function O(l){let t=U(l),e={};for(let n of t.order){let s=t.scenarios.get(n);s&&(e[n]=s)}return{acceptance_criteria:t.order.map(n=>t.statements.get(n)??""),scenarios:e}}d(O,"materializeDeltas");function J(l){let t=[],e=[],n=[],s={section:null,req:null,scenario:null},i=d(()=>{s.scenario&&s.req&&s.req.scenarios.push({name:s.scenario.name,given:s.scenario.given,when:s.scenario.when,then:s.scenario.then}),s.scenario=null},"flushScenario"),c=d(()=>{i();let a=s.req;if(s.req=null,!a)return;let o=F(a.name);if(!o)throw new Error(`DELTA_PARSE: requirement name yields an empty slug: "${a.name}"`);if(s.section==="removed"){n.push(o);return}let g=a.statementLines.join(`
9
9
  `).trim();if(!g)throw new Error(`DELTA_PARSE: requirement "${a.name}" has no SHALL statement`);(s.section==="modified"?e:t).push({slug:o,name:a.name,statement:g,scenarios:a.scenarios})},"flushReq");for(let a of l.split(`
10
10
  `)){let o=a.trim(),g=o.match(/^##\s+(ADDED|MODIFIED|REMOVED)\s+Requirements\s*$/i);if(g){c(),s.section=g[1].toLowerCase();continue}if(/^#{1,2}\s/.test(o)){c(),s.section=null;continue}let f=o.match(/^###\s+Requirement:\s*(.+)$/i);if(f){if(c(),!s.section)throw new Error('DELTA_PARSE: "### Requirement:" outside an ADDED/MODIFIED/REMOVED Requirements section');s.req={name:f[1].trim(),statementLines:[],scenarios:[]};continue}let S=o.match(/^####\s+Scenario:\s*(.+)$/i);if(S){if(i(),!s.req)throw new Error('DELTA_PARSE: "#### Scenario:" outside a "### Requirement:" block');s.scenario={name:S[1].trim(),given:[],when:[],then:[],last:null};continue}if(s.scenario&&o.startsWith("-")){let p=o.replace(/^-\s+/,"").match(/^(?:\*\*)?(GIVEN|WHEN|THEN|AND)\b\s*:?\s*(?:\*\*)?\s*(.*)$/i);if(p){let _=p[1].toUpperCase(),y=_==="AND"?s.scenario.last??"when":_.toLowerCase();s.scenario[y].push(p[2].trim()),s.scenario.last=y}continue}s.req&&!s.scenario&&o!==""&&s.req.statementLines.push(o)}if(c(),t.length+e.length+n.length===0)throw new Error("DELTA_EMPTY: no ADDED/MODIFIED/REMOVED Requirements sections found");return{added:t,modified:e,removed:n}}d(J,"parseDelta");function X(l,t,e={}){let n=J(t),s=e.id??z(t);if(l.delta_log.some(p=>p.id===s))return l;let i=U(l.delta_log).statements,c=new Set(n.added.map(p=>p.slug));for(let p of n.modified)if(!i.has(p.slug)&&!c.has(p.slug))throw new Error(`DELTA_UNKNOWN_REQUIREMENT: MODIFIED target "${p.name}" (slug: ${p.slug}) does not exist`);for(let p of n.removed)if(!i.has(p)&&!c.has(p))throw new Error(`DELTA_UNKNOWN_REQUIREMENT: REMOVED target slug "${p}" does not exist`);let a={id:s,ts:e.ts??m(),ops:n},o=v([...l.delta_log,a]),g=A(o),f=l.acceptance_criteria.filter(p=>!g.has(p)),S=O(o);return h.parse({...l,acceptance_criteria:[...f,...S.acceptance_criteria],scenarios:S.scenarios,delta_log:o})}d(X,"applyDelta");C();M();var E=class extends Error{constructor(e,n){super(`spec relational projection failed for ${e} (content write rolled back): ${n instanceof Error?n.message:String(n)}`);this.specId=e;this.name="SpecProjectionError"}specId;static{d(this,"SpecProjectionError")}};function w(l,t,e){try{u.run(l,"DELETE FROM spec_review WHERE spec_id = ?",t),u.run(l,"DELETE FROM spec_selected_reviewer WHERE spec_id = ?",t);for(let[n,s]of Object.entries(e.reviews??{}))u.run(l,"INSERT INTO spec_review (id, spec_id, lens, verdict, notes, created_at) VALUES (?, ?, ?, ?, ?, ?)",`${t}-rev-${n}`,t,n,s.verdict,s.notes??null,Date.now());for(let n of e.selected_reviewers)u.run(l,"INSERT OR IGNORE INTO spec_selected_reviewer (spec_id, lens) VALUES (?, ?)",t,n)}catch(n){throw new E(t,n)}}d(w,"projectSpecRelational");var T=class{static{d(this,"SpecStorage")}nextUpdatedAt(t,e){let n=m(),i=u.get(t,"SELECT updated_at FROM specs WHERE id = ?",e)?.updated_at;return!i||n>i?n:new Date(new Date(i).getTime()+1).toISOString()}create(t,e){let n=x(),s=m(),i=h.parse(e.content);try{u.transaction(t,()=>{u.run(t,`INSERT INTO specs (id, title, status, content, tags, created_at, updated_at)
11
11
  VALUES (?, ?, 'draft', ?, ?, ?, ?)`,n,e.title,JSON.stringify(i),e.tags?JSON.stringify(e.tags):null,s,s),w(t,n,i)})}catch(a){if(a instanceof E)D.warn(a.message);else throw a}let c={id:n,title:e.title,status:"draft",content:i,tags:e.tags??{},createdAt:s,updatedAt:s,shippedAt:null,shippedPr:null,shippedSha:null,archivedAt:null};return this.publishSync(t,c),c}get(t,e){let n=u.get(t,"SELECT * FROM specs WHERE id = ?",e);return n?this.rowToSpec(n):null}list(t,e={}){let n=[];e.status&&n.push(e.status);let i=`SELECT * FROM specs WHERE 1=1${e.status?" AND status = ?":e.includeArchived?"":" AND status != 'archived'"} ORDER BY created_at DESC`;return u.query(t,i,...n).map(a=>this.rowToSpec(a))}search(t,e){let n=`%${e}%`;return u.query(t,"SELECT * FROM specs WHERE title LIKE ? OR content LIKE ? ORDER BY created_at DESC",n,n).map(i=>this.rowToSpec(i))}updateContent(t,e,n){let s=h.parse(n),i=this.nextUpdatedAt(t,e);try{u.transaction(t,()=>{u.run(t,"UPDATE specs SET content = ?, updated_at = ? WHERE id = ?",JSON.stringify(s),i,e),w(t,e,s)})}catch(a){if(a instanceof E)D.warn(a.message);else throw a}let c=this.get(t,e);return c&&this.publishSync(t,c),c}casUpdate(t,e,n,s){let i=h.parse(n),c=this.nextUpdatedAt(t,e),a=(()=>{try{return u.transaction(t,()=>{let g=u.run(t,"UPDATE specs SET content = ?, updated_at = ? WHERE id = ? AND updated_at = ?",JSON.stringify(i),c,e,s).changes===1;return g&&w(t,e,i),g})}catch(o){if(o instanceof E)return D.warn(o.message),!1;throw o}})();if(a){let o=this.get(t,e);o&&this.publishSync(t,o)}return a}setStatus(t,e,n){if(!R.includes(n))throw new Error(`invalid spec status: ${n}`);let s=this.nextUpdatedAt(t,e),i=[],c=[n,s];n==="shipped"&&(i.push("shipped_at = ?"),c.push(s)),n==="archived"&&(i.push("archived_at = ?"),c.push(s));let a=["status = ?","updated_at = ?",...i].join(", ");c.push(e),u.run(t,`UPDATE specs SET ${a} WHERE id = ?`,...c);let o=this.get(t,e);return o&&this.publishSync(t,o),o}setShippedPr(t,e,n){u.run(t,"UPDATE specs SET shipped_pr = ?, updated_at = ? WHERE id = ?",n,this.nextUpdatedAt(t,e),e);let s=this.get(t,e);return s&&this.publishSync(t,s),s}setShippedSha(t,e,n){u.run(t,"UPDATE specs SET shipped_sha = ?, updated_at = ? WHERE id = ?",n,this.nextUpdatedAt(t,e),e);let s=this.get(t,e);return s&&this.publishSync(t,s),s}linkTask(t,e,n){let s=this.get(t,e);if(!s)return null;if(s.content.linked_tasks.includes(n))return s;let i={...s.content,linked_tasks:[...s.content.linked_tasks,n]};return this.updateContent(t,e,i)}delete(t,e){let n=this.get(t,e);return n?(u.run(t,"DELETE FROM specs WHERE id = ?",e),this.publishSync(t,n,"delete"),!0):!1}applyRemote(t,e){if(!e.id)return;let n=typeof e.content=="string"?e.content:JSON.stringify(e.content??{}),s=R.includes(e.status)?e.status:"draft",i=e.tags==null?null:typeof e.tags=="string"?e.tags:JSON.stringify(e.tags),c=m();if(u.run(t,`INSERT INTO specs (id, title, status, content, tags, created_at, updated_at)
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{n as y,o as h}from"./chunk-CTWZQ7YI.mjs";import{a as o}from"./chunk-E66B27AL.mjs";h();var b=2,v=20,p=10,u=400;function k(e){return e.files<=b&&e.loc<=v?"trivial":e.files<=p&&e.loc<=u?"normal":"large"}o(k,"tierOf");function x(e){return e==="trivial"?"direct":e==="normal"?"single":"split"}o(x,"geometryOf");async function l(e,r){return y(e,r)}o(l,"safeGit");function d(e){let r=e.match(/(\d+) files? changed/),t=e.match(/(\d+) insertions?/),s=e.match(/(\d+) deletions?/),i=r?Number.parseInt(r[1],10):0,n=(t?Number.parseInt(t[1],10):0)+(s?Number.parseInt(s[1],10):0);return{files:i,loc:n}}o(d,"parseShortstat");async function G(e){let r=await l(e,["rev-parse","--abbrev-ref","origin/HEAD"]),t=r&&r!=="origin/HEAD"?r:await(async()=>{for(let c of["main","master"])if(await l(e,["rev-parse","--verify","--quiet",c])!==null)return c;return""})();if(!t)return null;let s=await l(e,["merge-base",t,"HEAD"]);if(!s)return null;let i=await l(e,["rev-parse","HEAD"]);if(!i||i===s)return null;let n=await l(e,["diff","--shortstat",`${s}..HEAD`]);if(n===null)return null;let{files:a,loc:m}=d(n),f=await l(e,["diff","--name-only",`${s}..HEAD`])??"",g=[...new Set(f.split(`
8
+ import{n as y,p as h}from"./chunk-QWQFF2UG.mjs";import{a as o}from"./chunk-E66B27AL.mjs";h();var b=2,v=20,p=10,u=400;function k(e){return e.files<=b&&e.loc<=v?"trivial":e.files<=p&&e.loc<=u?"normal":"large"}o(k,"tierOf");function x(e){return e==="trivial"?"direct":e==="normal"?"single":"split"}o(x,"geometryOf");async function l(e,r){return y(e,r)}o(l,"safeGit");function d(e){let r=e.match(/(\d+) files? changed/),t=e.match(/(\d+) insertions?/),s=e.match(/(\d+) deletions?/),i=r?Number.parseInt(r[1],10):0,n=(t?Number.parseInt(t[1],10):0)+(s?Number.parseInt(s[1],10):0);return{files:i,loc:n}}o(d,"parseShortstat");async function G(e){let r=await l(e,["rev-parse","--abbrev-ref","origin/HEAD"]),t=r&&r!=="origin/HEAD"?r:await(async()=>{for(let c of["main","master"])if(await l(e,["rev-parse","--verify","--quiet",c])!==null)return c;return""})();if(!t)return null;let s=await l(e,["merge-base",t,"HEAD"]);if(!s)return null;let i=await l(e,["rev-parse","HEAD"]);if(!i||i===s)return null;let n=await l(e,["diff","--shortstat",`${s}..HEAD`]);if(n===null)return null;let{files:a,loc:m}=d(n),f=await l(e,["diff","--name-only",`${s}..HEAD`])??"",g=[...new Set(f.split(`
9
9
  `).filter(Boolean).map(c=>c.includes("/")?c.slice(0,c.indexOf("/")):"."))].sort();return{base:s.slice(0,7),files:a,loc:m,dirs:g,source:"committed"}}o(G,"computeCommittedChangeset");async function w(e){let r=await l(e,["diff","--shortstat","HEAD"]),t=await l(e,["diff","--shortstat","--cached"]);if(r===null&&t===null)return null;let s=d(r??""),i=d(t??""),n=Math.max(s.files,i.files),a=s.loc+i.loc;if(n===0&&a===0)return null;let m=await l(e,["diff","--name-only","HEAD"])??await l(e,["diff","--name-only","--cached"])??"",f=[...new Set(m.split(`
10
10
  `).filter(Boolean).map(g=>g.includes("/")?g.slice(0,g.indexOf("/")):"."))].sort();return{base:"HEAD",files:n,loc:a,dirs:f,source:"working-tree"}}o(w,"computeWorkingTreeChangeset");function L(e,r){let t=e.dirs.length>1?` Natural split lines: ${e.dirs.slice(0,6).join(", ")}.`:"";return`Delivery geometry gate: ${e.loc} LOC / ${e.files} files (${e.source}) \u2192 suggested \`${r}\`.${t} Decide explicitly: \`prjct work "<intent>" --geometry split|single|direct\` or split the tree before continuing. (Relax: \`prjct config\` deliveryGeometry off.)`}o(L,"geometryBlockMessage");function $(e){let r=e.harnessLevel,t=e.harnessRisk==="high",s=r==="H3"||r==="H2"&&t,i=!!e.treeLarge||s,n=r==="H3"||t||e.treeLarge?"split":"single";if(e.explicitGeometry)return{blocked:!1,message:null,reason:"has-geometry",geometry:e.explicitGeometry};if(!i)return{blocked:!1,message:null,reason:"not-large",geometry:"direct"};let a=`Delivery geometry (intent): ${r}`+(t?" high-risk":"")+(e.treeLarge?" + large working tree":"")+` \u2192 plan as \`${n}\` before coding. Pass \`prjct work "<intent>" --geometry split|single|direct\` (or stamp geometry on the linked intent/spec). Dynasty: geometry is first-class plan, not only a ship-time afterthought.`;return e.mode==="strict"?{blocked:!0,message:a,reason:e.treeLarge?"tree-strict":"h2-intent-strict",geometry:n}:{blocked:!1,message:`\u26A0\uFE0F ${a}`,reason:"h2-intent-advisory",geometry:n}}o($,"intentGeometryVerdict");function A(e){if(e.mode==="off"||!e.changeset)return{blocked:!1,message:null,tier:"trivial",geometry:"direct",reason:"none"};let r=e.locThreshold??u,t=k(e.changeset),s=x(t);if(e.changeset.loc<r&&t!=="large")return{blocked:!1,message:null,tier:t,geometry:s,reason:"ok-small"};if(e.explicitGeometry)return{blocked:!1,message:null,tier:t,geometry:e.explicitGeometry,reason:"override"};let i=e.changeset.dirs&&e.changeset.dirs.length>1?` Natural split lines: ${e.changeset.dirs.slice(0,6).join(", ")}.`:"",n=`Delivery geometry (ship): ${e.changeset.loc} LOC / ${e.changeset.files} files (${e.changeset.source}) \u2192 suggested \`${s}\`.${i} Decide with \`prjct ship --geometry split|single|direct\` before publishing. (SUPERIOR to silent large PRs \u2014 gentle-ai forecast with teeth.)`;return e.mode==="strict"?{blocked:!0,message:n,tier:t,geometry:s,reason:"strict-block"}:{blocked:!1,message:`\u26A0\uFE0F ${n}`,tier:t,geometry:s,reason:"advisory"}}o(A,"shipGeometryVerdict");export{b as a,v as b,p as c,u as d,k as e,x as f,G as g,w as h,L as i,$ as j,A as k};