prjct-cli 3.93.0 → 3.95.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 (265) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +27 -21
  3. package/dist/bin/hook-chunks/{agent-switch-A6AYZRJ5.mjs → agent-switch-4ZJJWKMD.mjs} +1 -1
  4. package/dist/bin/hook-chunks/{analysis-WPRPBYHY.mjs → analysis-UGHAG2SK.mjs} +3 -3
  5. package/dist/bin/hook-chunks/{auth-config-WNUARXTJ.mjs → auth-config-JIITQ6GY.mjs} +1 -1
  6. package/dist/bin/hook-chunks/auto-flush-CXWTU3RF.mjs +8 -0
  7. package/dist/bin/hook-chunks/{auto-updater-EHRRMCYY.mjs → auto-updater-4TIXYSEX.mjs} +1 -1
  8. package/dist/bin/hook-chunks/capture-gate-PS6QUXLX.mjs +8 -0
  9. package/dist/bin/hook-chunks/chunk-22AXWLI6.mjs +26 -0
  10. package/dist/bin/hook-chunks/chunk-32RX4YGI.mjs +9 -0
  11. package/dist/bin/hook-chunks/{chunk-6EWGHM32.mjs → chunk-3WQBTXUC.mjs} +1 -1
  12. package/dist/bin/hook-chunks/{chunk-ZZ65CN5F.mjs → chunk-4HAKTI36.mjs} +1 -1
  13. package/dist/bin/hook-chunks/{chunk-V37VTXDW.mjs → chunk-4KVPAHFV.mjs} +1 -1
  14. package/dist/bin/hook-chunks/chunk-4KXXDQYI.mjs +11 -0
  15. package/dist/bin/hook-chunks/{chunk-4WHS7CO7.mjs → chunk-4NTVXJD7.mjs} +1 -1
  16. package/dist/bin/hook-chunks/{chunk-HIFIDMH5.mjs → chunk-5H3KJWQS.mjs} +2 -2
  17. package/dist/bin/hook-chunks/chunk-5XA5RL5I.mjs +8 -0
  18. package/dist/bin/hook-chunks/chunk-6GAFRIUQ.mjs +18 -0
  19. package/dist/bin/hook-chunks/{chunk-4OYUJTPR.mjs → chunk-76GDLA3Z.mjs} +3 -3
  20. package/dist/bin/hook-chunks/chunk-7YT2FGO7.mjs +8 -0
  21. package/dist/bin/hook-chunks/chunk-A6K4H3YT.mjs +9 -0
  22. package/dist/bin/hook-chunks/{chunk-MEQS4VPO.mjs → chunk-ABJNOG2I.mjs} +1 -1
  23. package/dist/bin/hook-chunks/{chunk-7SI6X3Z7.mjs → chunk-B36LC2JR.mjs} +1 -1
  24. package/dist/bin/hook-chunks/chunk-BCAHWZH7.mjs +8 -0
  25. package/dist/bin/hook-chunks/{chunk-EM6ZDJAK.mjs → chunk-BDOAQVIF.mjs} +1 -1
  26. package/dist/bin/hook-chunks/chunk-BOBFTVAY.mjs +11 -0
  27. package/dist/bin/hook-chunks/{chunk-7OZDWT6C.mjs → chunk-BU22R6JX.mjs} +1 -1
  28. package/dist/bin/hook-chunks/chunk-BX7VKYA7.mjs +8 -0
  29. package/dist/bin/hook-chunks/chunk-C4O243NG.mjs +9 -0
  30. package/dist/bin/hook-chunks/chunk-CYZ7ST2P.mjs +36 -0
  31. package/dist/bin/hook-chunks/chunk-DCSKTMDX.mjs +8 -0
  32. package/dist/bin/hook-chunks/{chunk-WDGDFXSB.mjs → chunk-DVDZA63F.mjs} +1 -1
  33. package/dist/bin/hook-chunks/{chunk-ZX2KFQV5.mjs → chunk-EWOK4VE7.mjs} +1 -1
  34. package/dist/bin/hook-chunks/{chunk-ODWWIFSN.mjs → chunk-FEFP6JOL.mjs} +1 -1
  35. package/dist/bin/hook-chunks/{chunk-7AN7VQHN.mjs → chunk-FW4MEPTB.mjs} +1 -1
  36. package/dist/bin/hook-chunks/chunk-FXFG6PV6.mjs +69 -0
  37. package/dist/bin/hook-chunks/chunk-G7QQZMAO.mjs +9 -0
  38. package/dist/bin/hook-chunks/{chunk-P5ZYAXSE.mjs → chunk-GCDLPKOH.mjs} +1 -1
  39. package/dist/bin/hook-chunks/{chunk-ACKEPXP4.mjs → chunk-GDECEHO5.mjs} +1 -1
  40. package/dist/bin/hook-chunks/chunk-GDESYWTD.mjs +14 -0
  41. package/dist/bin/hook-chunks/chunk-GLPKMG5A.mjs +18 -0
  42. package/dist/bin/hook-chunks/chunk-GPZP7NXL.mjs +11 -0
  43. package/dist/bin/hook-chunks/{chunk-PSSR7LSW.mjs → chunk-H4CA3XZ6.mjs} +1 -1
  44. package/dist/bin/hook-chunks/chunk-HEDZA6KC.mjs +8 -0
  45. package/dist/bin/hook-chunks/{chunk-3LG3ACQV.mjs → chunk-I26F7TLM.mjs} +1 -1
  46. package/dist/bin/hook-chunks/chunk-IGHY4FGS.mjs +8 -0
  47. package/dist/bin/hook-chunks/{chunk-DMXFGLZE.mjs → chunk-IWJG7CZX.mjs} +1 -1
  48. package/dist/bin/hook-chunks/{chunk-LLQUB6YR.mjs → chunk-J5UQVJUW.mjs} +2 -2
  49. package/dist/bin/hook-chunks/chunk-J5UVRZ44.mjs +15 -0
  50. package/dist/bin/hook-chunks/{chunk-QDQ7DTDV.mjs → chunk-JR542RI2.mjs} +1 -1
  51. package/dist/bin/hook-chunks/{chunk-P4J6TY2L.mjs → chunk-KHLYWNHT.mjs} +1 -1
  52. package/dist/bin/hook-chunks/{chunk-75UJIVMO.mjs → chunk-KOGZCFBC.mjs} +1 -1
  53. package/dist/bin/hook-chunks/{chunk-Q5I2UPD6.mjs → chunk-KSSRINDX.mjs} +1 -1
  54. package/dist/bin/hook-chunks/{chunk-ZTZTVBAZ.mjs → chunk-LNB2GLYI.mjs} +1 -1
  55. package/dist/bin/hook-chunks/chunk-M5E2YOZ4.mjs +8 -0
  56. package/dist/bin/hook-chunks/{chunk-PWMMLXZS.mjs → chunk-MHNWIB7B.mjs} +2 -2
  57. package/dist/bin/hook-chunks/{chunk-LFY5O66D.mjs → chunk-N3L77UNM.mjs} +1 -1
  58. package/dist/bin/hook-chunks/{chunk-TSCXXNUF.mjs → chunk-NLKPAJND.mjs} +1 -1
  59. package/dist/bin/hook-chunks/{chunk-3JUE6MNF.mjs → chunk-OC4CYF7V.mjs} +1 -1
  60. package/dist/bin/hook-chunks/chunk-OGIFB3OE.mjs +19 -0
  61. package/dist/bin/hook-chunks/chunk-OUAS3LZ3.mjs +8 -0
  62. package/dist/bin/hook-chunks/{chunk-6WXGOGAN.mjs → chunk-OUAVSD47.mjs} +1 -1
  63. package/dist/bin/hook-chunks/{chunk-X5RDLFPM.mjs → chunk-OWOPA2O7.mjs} +1 -1
  64. package/dist/bin/hook-chunks/chunk-PGWFGRX4.mjs +47 -0
  65. package/dist/bin/hook-chunks/chunk-PO3QDKTE.mjs +8 -0
  66. package/dist/bin/hook-chunks/{chunk-RXD7MHJ6.mjs → chunk-PP6DANGV.mjs} +1 -1
  67. package/dist/bin/hook-chunks/{chunk-HT3ZCLLJ.mjs → chunk-PTA7DMLM.mjs} +1 -1
  68. package/dist/bin/hook-chunks/{chunk-45I2C2UB.mjs → chunk-QBYHZX33.mjs} +1 -1
  69. package/dist/bin/hook-chunks/chunk-QL3NYJTW.mjs +16 -0
  70. package/dist/bin/hook-chunks/{chunk-AOPJ4Z6O.mjs → chunk-QP5USCDX.mjs} +1 -1
  71. package/dist/bin/hook-chunks/chunk-QWQFF2UG.mjs +10 -0
  72. package/dist/bin/hook-chunks/chunk-R4ILCXKE.mjs +8 -0
  73. package/dist/bin/hook-chunks/{chunk-D7TRY3CO.mjs → chunk-RHKF7EJW.mjs} +1 -1
  74. package/dist/bin/hook-chunks/{chunk-HZIORCPO.mjs → chunk-ROA2AJXY.mjs} +1 -1
  75. package/dist/bin/hook-chunks/{chunk-AUUWQH3S.mjs → chunk-RTEEXGEA.mjs} +1 -1
  76. package/dist/bin/hook-chunks/{chunk-QK2IMCDC.mjs → chunk-S5ISOGDB.mjs} +1 -1
  77. package/dist/bin/hook-chunks/{chunk-GIMUTVLP.mjs → chunk-S5N2ZZDL.mjs} +1 -1
  78. package/dist/bin/hook-chunks/{chunk-742LOGHA.mjs → chunk-S6L3FECF.mjs} +1 -1
  79. package/dist/bin/hook-chunks/{chunk-CREPUNOS.mjs → chunk-T6ELTQZM.mjs} +1 -1
  80. package/dist/bin/hook-chunks/{chunk-UK7D7EFV.mjs → chunk-TXSLON7M.mjs} +2 -2
  81. package/dist/bin/hook-chunks/chunk-U4OON3S7.mjs +31 -0
  82. package/dist/bin/hook-chunks/chunk-UH4MD3F3.mjs +9 -0
  83. package/dist/bin/hook-chunks/{chunk-HDHVBB6Q.mjs → chunk-UHVYBU7F.mjs} +1 -1
  84. package/dist/bin/hook-chunks/chunk-UYQC63MC.mjs +11 -0
  85. package/dist/bin/hook-chunks/{chunk-3WY2AYPE.mjs → chunk-V2FR2NPL.mjs} +4 -4
  86. package/dist/bin/hook-chunks/{chunk-L4376X2P.mjs → chunk-WGWE3CSC.mjs} +1 -1
  87. package/dist/bin/hook-chunks/{chunk-KXWBIQGJ.mjs → chunk-X5W2UYQK.mjs} +2 -2
  88. package/dist/bin/hook-chunks/{chunk-YUOTOCKK.mjs → chunk-XDBJSJOT.mjs} +1 -1
  89. package/dist/bin/hook-chunks/{chunk-2NMSEZTQ.mjs → chunk-XFQ7NNLN.mjs} +1 -1
  90. package/dist/bin/hook-chunks/{chunk-SOPRYWUY.mjs → chunk-XS45K7ZQ.mjs} +1 -1
  91. package/dist/bin/hook-chunks/{chunk-BISPGBNN.mjs → chunk-XXRAQZNC.mjs} +1 -1
  92. package/dist/bin/hook-chunks/{chunk-NLG2EW6M.mjs → chunk-YDBZO6I3.mjs} +1 -1
  93. package/dist/bin/hook-chunks/{chunk-6IKHMK2U.mjs → chunk-YQ55MHKL.mjs} +1 -1
  94. package/dist/bin/hook-chunks/chunk-Z4X7JIAP.mjs +11 -0
  95. package/dist/bin/hook-chunks/{chunk-2OU2MKNS.mjs → chunk-Z6KVLCMK.mjs} +1 -1
  96. package/dist/bin/hook-chunks/{chunk-OGOCHZ3S.mjs → chunk-ZFLIVOFX.mjs} +1 -1
  97. package/dist/bin/hook-chunks/{chunk-54LH63LM.mjs → chunk-ZMLA5SKR.mjs} +1 -0
  98. package/dist/bin/hook-chunks/chunk-ZOX6OV6X.mjs +12 -0
  99. package/dist/bin/hook-chunks/client-CRXA774S.mjs +10 -0
  100. package/dist/bin/hook-chunks/code-graph-cloud-GTSLO7CD.mjs +8 -0
  101. package/dist/bin/hook-chunks/{codex-skill-ZCAUF2RM.mjs → codex-skill-NUBNPSMF.mjs} +1 -1
  102. package/dist/bin/hook-chunks/{command-installer-LNK7WC5I.mjs → command-installer-UHSXC3UG.mjs} +1 -1
  103. package/dist/bin/hook-chunks/{config-manager-4VWDBPMG.mjs → config-manager-DX5OOPW5.mjs} +1 -1
  104. package/dist/bin/hook-chunks/{content-bound-stamp-72EQVZLP.mjs → content-bound-stamp-OG2KKN3L.mjs} +1 -1
  105. package/dist/bin/hook-chunks/{context7-service-4C6VNJUS.mjs → context7-service-GDJ3QICX.mjs} +1 -1
  106. package/dist/bin/hook-chunks/custom-workflow-storage-FD47DPA3.mjs +8 -0
  107. package/dist/bin/hook-chunks/cwd-changed-EP3UIRK6.mjs +8 -0
  108. package/dist/bin/hook-chunks/{database-SLDTQXWG.mjs → database-ZUC7OEZG.mjs} +1 -1
  109. package/dist/bin/hook-chunks/{delivery-geometry-VHCURJ7E.mjs → delivery-geometry-WYOEMKMO.mjs} +1 -1
  110. package/dist/bin/hook-chunks/{detect-changes-M2OYIOE5.mjs → detect-changes-OJUBWWTU.mjs} +1 -1
  111. package/dist/bin/hook-chunks/{detection-MEYHME4X.mjs → detection-QRVSNMKL.mjs} +1 -1
  112. package/dist/bin/hook-chunks/developer-evolution-WNSTHDAA.mjs +12 -0
  113. package/dist/bin/hook-chunks/distill-GOGPFQFK.mjs +8 -0
  114. package/dist/bin/hook-chunks/{editors-config-3N6VREZR.mjs → editors-config-2CACBNS4.mjs} +1 -1
  115. package/dist/bin/hook-chunks/enriched-recall-QF22RIK7.mjs +8 -0
  116. package/dist/bin/hook-chunks/exec-2P5VOBHM.mjs +8 -0
  117. package/dist/bin/hook-chunks/format-J3X3R225.mjs +8 -0
  118. package/dist/bin/hook-chunks/{git-helpers-6JLP2OJZ.mjs → git-helpers-HELM6DXJ.mjs} +1 -1
  119. package/dist/bin/hook-chunks/{judgment-ledger-storage-UKROWRVA.mjs → judgment-ledger-storage-FE4HXTHM.mjs} +1 -1
  120. package/dist/bin/hook-chunks/{judgment-orchestrator-UFGNBTEK.mjs → judgment-orchestrator-YDJTKNV2.mjs} +1 -1
  121. package/dist/bin/hook-chunks/judgment-receipt-7A2DXVJA.mjs +8 -0
  122. package/dist/bin/hook-chunks/land-cue-SZWJH6XP.mjs +9 -0
  123. package/dist/bin/hook-chunks/land-synthesis-JLYUBKHR.mjs +8 -0
  124. package/dist/bin/hook-chunks/legacy-crew-sweep-JXYO62UE.mjs +24 -0
  125. package/dist/bin/hook-chunks/memory-index-CIYDXN2G.mjs +8 -0
  126. package/dist/bin/hook-chunks/notification-UA7RTVHG.mjs +8 -0
  127. package/dist/bin/hook-chunks/{pack-integrity-62XJ5A75.mjs → pack-integrity-GZC5NGFN.mjs} +1 -1
  128. package/dist/bin/hook-chunks/{pack-manager-K3PQ7MCS.mjs → pack-manager-AF5F7PRT.mjs} +1 -1
  129. package/dist/bin/hook-chunks/{package-legitimacy-HXC4L73B.mjs → package-legitimacy-MIR3VZSF.mjs} +1 -1
  130. package/dist/bin/hook-chunks/{path-manager-F2HE2GGK.mjs → path-manager-375HH6TB.mjs} +1 -1
  131. package/dist/bin/hook-chunks/{planning-WMLFXZMA.mjs → planning-M3RAOZVB.mjs} +2 -2
  132. package/dist/bin/hook-chunks/post-edit-QRDYPZLZ.mjs +8 -0
  133. package/dist/bin/hook-chunks/{pr-convention-7UGI7TFA.mjs → pr-convention-5NPXQJ2R.mjs} +1 -1
  134. package/dist/bin/hook-chunks/pre-bash-TWWFVNQ7.mjs +11 -0
  135. package/dist/bin/hook-chunks/pre-commit-PTFF7JIN.mjs +8 -0
  136. package/dist/bin/hook-chunks/pre-edit-PMMWDR2B.mjs +11 -0
  137. package/dist/bin/hook-chunks/pre-package-325ALZKD.mjs +8 -0
  138. package/dist/bin/hook-chunks/pre-search-GOHVFAFH.mjs +9 -0
  139. package/dist/bin/hook-chunks/pre-secrets-MYNM5KI4.mjs +8 -0
  140. package/dist/bin/hook-chunks/{precision-judgment-WPTCNTGV.mjs → precision-judgment-TT3DRNAX.mjs} +1 -1
  141. package/dist/bin/hook-chunks/{prjct-md-Q6C5YNI3.mjs → prjct-md-RCB6FWD6.mjs} +1 -1
  142. package/dist/bin/hook-chunks/{project-agent-surfaces-3BBZIQNI.mjs → project-agent-surfaces-V4P5RTUR.mjs} +1 -1
  143. package/dist/bin/hook-chunks/{project-file-inventory-ZAPKPKY6.mjs → project-file-inventory-OKIP4LBO.mjs} +1 -1
  144. package/dist/bin/hook-chunks/project-memory-JK2MXRJB.mjs +8 -0
  145. package/dist/bin/hook-chunks/project-style-evolution-RPGATIYJ.mjs +8 -0
  146. package/dist/bin/hook-chunks/prompt-DOENKHLQ.mjs +24 -0
  147. package/dist/bin/hook-chunks/{velocity-storage-UPW6TLK6.mjs → publish-helper-SX7HEV2L.mjs} +1 -1
  148. package/dist/bin/hook-chunks/purge-XKHUAB4H.mjs +8 -0
  149. package/dist/bin/hook-chunks/retention-C3NQT65W.mjs +8 -0
  150. package/dist/bin/hook-chunks/sdd-6PF7MBAY.mjs +10 -0
  151. package/dist/bin/hook-chunks/session-continuity-UEXQDGZE.mjs +11 -0
  152. package/dist/bin/hook-chunks/session-start-B4P7L33E.mjs +8 -0
  153. package/dist/bin/hook-chunks/setup-ZOHG6MGF.mjs +141 -0
  154. package/dist/bin/hook-chunks/{shipping-HV5IAM2J.mjs → shipping-QVGTOO6U.mjs} +5 -5
  155. package/dist/bin/hook-chunks/{skill-index-OOVAXHYJ.mjs → skill-index-FGDQVYHM.mjs} +1 -1
  156. package/dist/bin/hook-chunks/{spec-context-inference-UBHJLOIJ.mjs → spec-context-inference-6Z52BT37.mjs} +1 -1
  157. package/dist/bin/hook-chunks/{spec-service-TA4Q5S3X.mjs → spec-service-UAQ5AEXQ.mjs} +2 -2
  158. package/dist/bin/hook-chunks/spec-task-breakdown-LAXGVLMY.mjs +8 -0
  159. package/dist/bin/hook-chunks/state-storage-XU35ZYNA.mjs +8 -0
  160. package/dist/bin/hook-chunks/stop-CFB2H3XC.mjs +16 -0
  161. package/dist/bin/hook-chunks/subagent-start-KFAZZUHS.mjs +8 -0
  162. package/dist/bin/hook-chunks/subagent-stop-OUG4PR7S.mjs +8 -0
  163. package/dist/bin/hook-chunks/{surface-attribution-HYCBHBTC.mjs → surface-attribution-A6GCGRFM.mjs} +1 -1
  164. package/dist/bin/hook-chunks/symbol-graph-DMPBNBX7.mjs +8 -0
  165. package/dist/bin/hook-chunks/{sync-analyzer-FKC57RTV.mjs → sync-analyzer-6U5GHYV3.mjs} +1 -1
  166. package/dist/bin/hook-chunks/{sync-client-DJWOG2ZQ.mjs → sync-client-PIRHMHXL.mjs} +1 -1
  167. package/dist/bin/hook-chunks/{sync-cursor-storage-2VKG757H.mjs → sync-cursor-storage-VVLA3L2U.mjs} +1 -1
  168. package/dist/bin/hook-chunks/{task-orchestration-MLOCR7GA.mjs → task-orchestration-HFZYWYLR.mjs} +1 -1
  169. package/dist/bin/hook-chunks/{task-overview-6ZQKJGSH.mjs → task-overview-PCUZWL5Q.mjs} +1 -1
  170. package/dist/bin/hook-chunks/task-service-PXCDU55T.mjs +8 -0
  171. package/dist/bin/hook-chunks/tdd-QZL4OSM7.mjs +10 -0
  172. package/dist/bin/hook-chunks/{template-loader-SO6OHPJI.mjs → template-loader-SKXILJLJ.mjs} +1 -1
  173. package/dist/bin/hook-chunks/{transcript-jsonl-6X4DDD6R.mjs → transcript-jsonl-7W2NOJPZ.mjs} +1 -1
  174. package/dist/bin/hook-chunks/{trust-boundary-ERMDF2C5.mjs → trust-boundary-EX65SUYR.mjs} +1 -1
  175. package/dist/bin/hook-chunks/{usefulness-253CZLNY.mjs → usefulness-SZLG6LVC.mjs} +1 -1
  176. package/dist/bin/hook-chunks/{vault-retire-notice-GRT3QRLZ.mjs → vault-retire-notice-HOXPURNQ.mjs} +1 -1
  177. package/dist/bin/hook-chunks/velocity-storage-5J6BAMCW.mjs +8 -0
  178. package/dist/bin/hook-chunks/weak-model-mode-ZRNKFTFF.mjs +8 -0
  179. package/dist/bin/hook-chunks/work-graph-PGYHFLEL.mjs +49 -0
  180. package/dist/bin/hook-chunks/work-scope-FIB6LBKE.mjs +8 -0
  181. package/dist/bin/hook-chunks/{workspace-occupancy-UVIRHY5Z.mjs → workspace-occupancy-3D4OKQRB.mjs} +1 -1
  182. package/dist/bin/hook-chunks/{worktree-service-XGRN5TTE.mjs → worktree-service-AS7JVBK5.mjs} +1 -1
  183. package/dist/bin/hook-fast-darwin-arm64 +0 -0
  184. package/dist/bin/hook-fast-darwin-x64 +0 -0
  185. package/dist/bin/hook-fast-linux-x64 +0 -0
  186. package/dist/bin/prjct-core.mjs +737 -736
  187. package/dist/bin/prjct-hooks.mjs +2 -2
  188. package/dist/bin/prjct.mjs +1 -1
  189. package/dist/daemon/entry.mjs +651 -647
  190. package/dist/mcp/server.mjs +310 -312
  191. package/package.json +1 -1
  192. package/dist/bin/hook-chunks/auto-flush-5D4PKOMM.mjs +0 -8
  193. package/dist/bin/hook-chunks/capture-gate-EOOSAGAP.mjs +0 -8
  194. package/dist/bin/hook-chunks/chunk-4DDCWMI6.mjs +0 -8
  195. package/dist/bin/hook-chunks/chunk-4KY2EHXS.mjs +0 -9
  196. package/dist/bin/hook-chunks/chunk-A5RNWWTH.mjs +0 -9
  197. package/dist/bin/hook-chunks/chunk-A7SGMNOK.mjs +0 -11
  198. package/dist/bin/hook-chunks/chunk-AKIN5WSQ.mjs +0 -9
  199. package/dist/bin/hook-chunks/chunk-BNWB77U5.mjs +0 -9
  200. package/dist/bin/hook-chunks/chunk-CQHPIYNM.mjs +0 -8
  201. package/dist/bin/hook-chunks/chunk-CTWZQ7YI.mjs +0 -8
  202. package/dist/bin/hook-chunks/chunk-DLHSCKBJ.mjs +0 -15
  203. package/dist/bin/hook-chunks/chunk-DV7KV2O4.mjs +0 -38
  204. package/dist/bin/hook-chunks/chunk-EHP4DYVQ.mjs +0 -71
  205. package/dist/bin/hook-chunks/chunk-FGQZ62ZP.mjs +0 -47
  206. package/dist/bin/hook-chunks/chunk-HJ4HEI45.mjs +0 -8
  207. package/dist/bin/hook-chunks/chunk-J6JZ4PQA.mjs +0 -18
  208. package/dist/bin/hook-chunks/chunk-JRKGG2E3.mjs +0 -8
  209. package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +0 -13
  210. package/dist/bin/hook-chunks/chunk-LT5WSSQO.mjs +0 -8
  211. package/dist/bin/hook-chunks/chunk-MHRMV4WI.mjs +0 -31
  212. package/dist/bin/hook-chunks/chunk-N5WOHG36.mjs +0 -8
  213. package/dist/bin/hook-chunks/chunk-NJAMZSHM.mjs +0 -26
  214. package/dist/bin/hook-chunks/chunk-NWY5M34K.mjs +0 -12
  215. package/dist/bin/hook-chunks/chunk-OB5GRS7T.mjs +0 -18
  216. package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +0 -9
  217. package/dist/bin/hook-chunks/chunk-SVZHJZ5T.mjs +0 -9
  218. package/dist/bin/hook-chunks/chunk-UB53HQMG.mjs +0 -14
  219. package/dist/bin/hook-chunks/chunk-UBMIPWJR.mjs +0 -19
  220. package/dist/bin/hook-chunks/chunk-VPPHD762.mjs +0 -11
  221. package/dist/bin/hook-chunks/chunk-VV7VNUTF.mjs +0 -16
  222. package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +0 -8
  223. package/dist/bin/hook-chunks/client-SKFMAUI5.mjs +0 -10
  224. package/dist/bin/hook-chunks/code-graph-cloud-65GCWNII.mjs +0 -8
  225. package/dist/bin/hook-chunks/custom-workflow-storage-M77INP6Z.mjs +0 -8
  226. package/dist/bin/hook-chunks/cwd-changed-FYNPPO73.mjs +0 -8
  227. package/dist/bin/hook-chunks/developer-evolution-R5BXQH6G.mjs +0 -12
  228. package/dist/bin/hook-chunks/distill-W7QGQUDX.mjs +0 -8
  229. package/dist/bin/hook-chunks/enriched-recall-W7KYRYVR.mjs +0 -8
  230. package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +0 -8
  231. package/dist/bin/hook-chunks/format-BOWFDUBP.mjs +0 -8
  232. package/dist/bin/hook-chunks/judgment-receipt-WGTFKID7.mjs +0 -8
  233. package/dist/bin/hook-chunks/land-cue-WLGSULSO.mjs +0 -9
  234. package/dist/bin/hook-chunks/land-synthesis-V7UH5QV6.mjs +0 -8
  235. package/dist/bin/hook-chunks/legacy-crew-sweep-MFE4BDNR.mjs +0 -24
  236. package/dist/bin/hook-chunks/memory-index-B53F5HAX.mjs +0 -10
  237. package/dist/bin/hook-chunks/notification-HJLS4L7Y.mjs +0 -8
  238. package/dist/bin/hook-chunks/post-edit-TT3XOG55.mjs +0 -8
  239. package/dist/bin/hook-chunks/pre-bash-2KKF4V6G.mjs +0 -11
  240. package/dist/bin/hook-chunks/pre-commit-UU4SKKWV.mjs +0 -8
  241. package/dist/bin/hook-chunks/pre-edit-RTBLZPWH.mjs +0 -11
  242. package/dist/bin/hook-chunks/pre-package-LQTINBT4.mjs +0 -8
  243. package/dist/bin/hook-chunks/pre-search-UJU3XZ2K.mjs +0 -9
  244. package/dist/bin/hook-chunks/pre-secrets-IE5NX5X5.mjs +0 -8
  245. package/dist/bin/hook-chunks/project-memory-YHQBRX3D.mjs +0 -8
  246. package/dist/bin/hook-chunks/project-style-evolution-HS6HYI7W.mjs +0 -8
  247. package/dist/bin/hook-chunks/prompt-AYY7BZFG.mjs +0 -22
  248. package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +0 -8
  249. package/dist/bin/hook-chunks/purge-AXMYTZVM.mjs +0 -8
  250. package/dist/bin/hook-chunks/retention-22OSCAGV.mjs +0 -8
  251. package/dist/bin/hook-chunks/sdd-W3OUQPHD.mjs +0 -10
  252. package/dist/bin/hook-chunks/session-continuity-LO2KNHXU.mjs +0 -11
  253. package/dist/bin/hook-chunks/session-start-5UZSL6OY.mjs +0 -8
  254. package/dist/bin/hook-chunks/setup-BSWLQJPE.mjs +0 -142
  255. package/dist/bin/hook-chunks/spec-task-breakdown-QJWGCON2.mjs +0 -8
  256. package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +0 -8
  257. package/dist/bin/hook-chunks/stop-QVDK6LUV.mjs +0 -17
  258. package/dist/bin/hook-chunks/subagent-start-UYBSD7VK.mjs +0 -8
  259. package/dist/bin/hook-chunks/subagent-stop-FHLL7X66.mjs +0 -8
  260. package/dist/bin/hook-chunks/symbol-graph-LZM4RZXZ.mjs +0 -8
  261. package/dist/bin/hook-chunks/task-service-RMCQEHV6.mjs +0 -8
  262. package/dist/bin/hook-chunks/tdd-LV63NXZ3.mjs +0 -10
  263. package/dist/bin/hook-chunks/weak-model-mode-VDYJ25PX.mjs +0 -8
  264. package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +0 -49
  265. 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{c as d}from"./chunk-NLG2EW6M.mjs";import{G as u,R as h,d as m}from"./chunk-6IKHMK2U.mjs";import{g,h as f}from"./chunk-75UJIVMO.mjs";import{b as p,e as C}from"./chunk-AKIN5WSQ.mjs";import{a as s}from"./chunk-E66B27AL.mjs";C();var w='Ship: you MAY suggest when ready, but run `prjct ship` ONLY after the user confirms in text this turn (e.g. "ship", "s\xED publ\xEDcalo"). Never ship on silence, Stop, or green tests alone.';function $(t){return t==="skip"?"none":t==="standard"?"standard":"full"}s($,"qualityFromIntensity");function E(t){return t==="none"?"skip":t==="standard"?"standard":"full"}s(E,"intensityFromQuality");async function R(t,e={}){let{files:n,loc:r}=await(async()=>{try{let o=await f(t);if(o&&(o.files>0||o.loc>0))return{files:o.files,loc:o.loc};let l=await g(t);return{files:l?.files??0,loc:l?.loc??0}}catch{return{files:0,loc:0}}})(),{intensity:i}=m({files:n,loc:r},e);return{intensity:i,files:n,loc:r}}s(R,"resolveWorkIntensity");async function N(t){let e=await R(t.projectPath,t.signals??{}),n=t.forceIntensity??e.intensity,r=$(n),i=d.get(t.projectId);if(r==="none"){let a=u(i,n);return{opened:!1,intensity:n,quality:r,ledger:i,next:a}}if(i&&(i.verdict==="in_progress"||i.verdict==="approved")){let a=u(i,i.intensity);return{opened:!1,intensity:i.intensity,quality:r,ledger:i,next:a}}let o=t.target?.trim()||await L(t.projectPath)||`work-${p().slice(0,10)}`,l=await import("./delivery-geometry-VHCURJ7E.mjs").then(({tierOf:a})=>a({files:e.files,loc:e.loc})).catch(()=>{}),x=await(async()=>{try{let{computeCommittedChangeset:a}=await import("./delivery-geometry-VHCURJ7E.mjs"),c=await a(t.projectPath);if(c?.base){let{execFileAsync:I}=await import("./exec-I7XE7NMD.mjs"),{stdout:v}=await I("git",["diff","--name-only",`${c.base}..HEAD`],{cwd:t.projectPath});return v.split(`
8
+ import{c as d}from"./chunk-YDBZO6I3.mjs";import{G as u,R as h,d as m}from"./chunk-YQ55MHKL.mjs";import{g,h as f}from"./chunk-KOGZCFBC.mjs";import{b as p,h as C}from"./chunk-A6K4H3YT.mjs";import{a as s}from"./chunk-E66B27AL.mjs";C();var w='Ship: you MAY suggest when ready, but run `prjct ship` ONLY after the user confirms in text this turn (e.g. "ship", "s\xED publ\xEDcalo"). Never ship on silence, Stop, or green tests alone.';function $(t){return t==="skip"?"none":t==="standard"?"standard":"full"}s($,"qualityFromIntensity");function E(t){return t==="none"?"skip":t==="standard"?"standard":"full"}s(E,"intensityFromQuality");async function R(t,e={}){let{files:n,loc:r}=await(async()=>{try{let o=await f(t);if(o&&(o.files>0||o.loc>0))return{files:o.files,loc:o.loc};let l=await g(t);return{files:l?.files??0,loc:l?.loc??0}}catch{return{files:0,loc:0}}})(),{intensity:i}=m({files:n,loc:r},e);return{intensity:i,files:n,loc:r}}s(R,"resolveWorkIntensity");async function N(t){let e=await R(t.projectPath,t.signals??{}),n=t.forceIntensity??e.intensity,r=$(n),i=d.get(t.projectId);if(r==="none"){let a=u(i,n);return{opened:!1,intensity:n,quality:r,ledger:i,next:a}}if(i&&(i.verdict==="in_progress"||i.verdict==="approved")){let a=u(i,i.intensity);return{opened:!1,intensity:i.intensity,quality:r,ledger:i,next:a}}let o=t.target?.trim()||await L(t.projectPath)||`work-${p().slice(0,10)}`,l=await import("./delivery-geometry-WYOEMKMO.mjs").then(({tierOf:a})=>a({files:e.files,loc:e.loc})).catch(()=>{}),x=await(async()=>{try{let{computeCommittedChangeset:a}=await import("./delivery-geometry-WYOEMKMO.mjs"),c=await a(t.projectPath);if(c?.base){let{execFileAsync:I}=await import("./exec-2P5VOBHM.mjs"),{stdout:v}=await I("git",["diff","--name-only",`${c.base}..HEAD`],{cwd:t.projectPath});return v.split(`
9
9
  `).map(k=>k.trim()).filter(Boolean)}return c?.dirs?.length?[...c.dirs]:void 0}catch{return}})(),y=h({target:o,intensity:n,deliveryTier:l,now:p(),scopePaths:x});d.set(t.projectId,y);let j=u(y,n);return{opened:!0,intensity:n,quality:r,ledger:y,next:j}}s(N,"ensureJudgmentLedger");function P(t,e){if(t.intensity==="skip")return null;if(e?.verdict==="approved")return["# prjct: quality ready","",`- Judgment ledger \`${e.id.slice(0,8)}\` \u2192 **APPROVED** (intensity=${e.intensity}).`,"- You MAY suggest: work is ready to ship when they want.",`- ${w}`].join(`
10
10
  `);if(t.kind==="skip_ship")return null;let n=["# prjct: quality orchestrator (automatic)","",`- **kind**: \`${t.kind}\` \xB7 intensity **${t.intensity}** \xB7 round ${t.fixRound}/${t.maxFixRounds}`,`- **directive**: ${t.directive}`,"","### Steps (run these \u2014 human does not type judgment)",...t.steps.map((r,i)=>`${i+1}. ${r}`),"",`_${w}_`];return t.judgeCharters&&n.push("","### Charters",`RED: ${t.judgeCharters.red}`,"",`BLUE: ${t.judgeCharters.blue}`),t.rankedFixIds.length&&n.push("",`### Blast rank: ${t.rankedFixIds.join(" \u2192 ")}`),n.join(`
11
- `)}s(P,"formatQualityInject");function Q(t){let e=d.get(t),n=e?.intensity??"skip";if(!e&&n==="skip")return null;let r=u(e,n==="skip"&&e?e.intensity:n);return e?P(r,e):null}s(Q,"qualityInjectForProject");async function L(t){try{let{getGitBranch:e}=await import("./git-helpers-6JLP2OJZ.mjs");return await e(t)??null}catch{return null}}s(L,"defaultBranchTarget");function q(t){return t!=="skip"}s(q,"shipRequiresQuality");export{w as a,$ as b,E as c,R as d,N as e,P as f,Q as g,q as h};
11
+ `)}s(P,"formatQualityInject");function Q(t){let e=d.get(t),n=e?.intensity??"skip";if(!e&&n==="skip")return null;let r=u(e,n==="skip"&&e?e.intensity:n);return e?P(r,e):null}s(Q,"qualityInjectForProject");async function L(t){try{let{getGitBranch:e}=await import("./git-helpers-HELM6DXJ.mjs");return await e(t)??null}catch{return null}}s(L,"defaultBranchTarget");function q(t){return t!=="skip"}s(q,"shipRequiresQuality");export{w as a,$ as b,E as c,R as d,N as e,P as f,Q as g,q as h};
@@ -0,0 +1,15 @@
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 j}from"./chunk-NLKPAJND.mjs";import{n as w}from"./chunk-A6K4H3YT.mjs";import{c as C}from"./chunk-JQE2F2RK.mjs";import{k as r,o as u}from"./chunk-UH4MD3F3.mjs";import{c as A}from"./chunk-FW4MEPTB.mjs";import{b as l,c,d as h,e as d}from"./chunk-SYHDEUVU.mjs";import{c as R,e as G}from"./chunk-GCDLPKOH.mjs";import{a as s}from"./chunk-E66B27AL.mjs";u();import a from"node:path";var b=`${h}
9
+ - project facts (stack/commands): see \`PRJCT.md\``,P=`${l}
10
+ ${b}
11
+ ${c}
12
+ `;async function T(e){return d(e,"AGENTS.md",P)}s(T,"writeProjectAgentsMd");var D="@PRJCT.md",I=`${l}
13
+ ${D}
14
+ ${c}
15
+ `;async function y(e){return d(e,"CLAUDE.md",I)}s(y,"writeProjectClaudeMd");import g from"node:fs/promises";import p from"node:path";u();w();C();import m from"node:path";var F=[{id:"agents-md",displayName:"AGENTS.md-compatible agents",kind:"standard",status:"stable",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Universal project instruction surface shared by current and future coding agents."},{id:"mcp",displayName:"Model Context Protocol clients",kind:"standard",status:"stable",contextFiles:[],supports:{agentsMd:!1,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Universal tool surface for prjct memory, workflow, files, and code intelligence."},{id:"acp",displayName:"Agent Client Protocol clients",kind:"standard",status:"emerging",contextFiles:[],supports:{agentsMd:!1,mcp:!1,skills:!1,hooks:!1,acp:!0,projectRules:!1},notes:"Editor/agent transport for clients such as Zed and other ACP-compatible tools."},{id:"claude",displayName:"Claude Code",kind:"cli",status:"stable",detectsBy:{homeDirs:[".claude"],commands:["claude"]},contextFiles:["CLAUDE.md","AGENTS.md"],mcpTargets:[{format:"claude-json",pathHint:"~/.claude/mcp.json",writable:!0}],supports:{agentsMd:!1,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!0},notes:"Benchmark-tier CLI (2026-07): Claude Code + Opus frontier. CLAUDE.md, skills, hooks, MCP JSON."},{id:"codex",displayName:"OpenAI Codex",kind:"cli",status:"stable",detectsBy:{homeDirs:[".codex"],commands:["codex"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"codex-toml",pathHint:"~/.codex/config.toml",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!1},notes:"Benchmark-tier CLI (2026-07): Codex + GPT-5.x (TB leader). AGENTS.md, config.toml MCP (native), hooks opt-in (planned installer)."},{id:"gemini",displayName:"Gemini CLI",kind:"cli",status:"stable",detectsBy:{homeDirs:[".gemini"],commands:["gemini"]},contextFiles:["GEMINI.md","AGENTS.md"],mcpTargets:[{format:"claude-json",pathHint:"~/.gemini/settings.json mcpServers",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!0},notes:"Benchmark-tier CLI (2026-07): Gemini CLI + Pro/Flash. GEMINI.md; prjct install writes MCP+hooks to ~/.gemini/settings.json."},{id:"antigravity",displayName:"Google Antigravity",kind:"ide",status:"emerging",detectsBy:{homeDirs:[m.join(".gemini","antigravity")]},contextFiles:["ANTIGRAVITY.md","AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!1,acp:!1,projectRules:!0},notes:"Uses Antigravity skills under the Gemini config tree."},{id:"opencode",displayName:"OpenCode",kind:"cli",status:"stable",detectsBy:{homeDirs:[".config/opencode"],projectDirs:[".opencode"],commands:["opencode"]},contextFiles:["AGENTS.md","opencode.json","opencode.jsonc"],mcpTargets:[{format:"opencode-json",pathHint:"~/.config/opencode/opencode.json mcp.prjct",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!1,acp:!1,projectRules:!0},notes:"Benchmark-tier open-source CLI (2026-07): most-starred multi-provider agent. AGENTS.md + prjct install writes mcp.prjct; Claude skill/CLAUDE.md compat."},{id:"pi",displayName:"Pi",kind:"cli",status:"stable",detectsBy:{homeDirs:[".pi",m.join(".pi","agent")],projectDirs:[".pi"],commands:["pi"]},contextFiles:["AGENTS.md","CLAUDE.md","SYSTEM.md","APPEND_SYSTEM.md"],supports:{agentsMd:!0,mcp:!1,skills:!0,hooks:!1,acp:!1,projectRules:!1},notes:"Benchmark-tier minimal harness (2026-07): AGENTS.md + prjct skill at ~/.pi/agent/skills/prjct. MCP only via optional extensions \u2014 do not require it."},{id:"qwen-code",displayName:"Qwen Code",kind:"model-runtime",status:"emerging",detectsBy:{homeDirs:[".qwen"],projectDirs:[".qwen"],commands:["qwen"]},contextFiles:["AGENTS.md","GEMINI.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"Qwen-family coding runtime; treat model/provider choice as separate from runtime setup."},{id:"kimi-cli",displayName:"Kimi Code CLI",kind:"model-runtime",status:"emerging",detectsBy:{homeDirs:[".kimi-code",".kimi"],projectDirs:[".kimi"],commands:["kimi"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"claude-json",pathHint:"~/.kimi-code/mcp.json",writable:!0},{format:"claude-json",pathHint:"~/.kimi/mcp.json (legacy Kimi CLI fallback)",writable:!1}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!1},notes:"Kimi Code CLI (~/.kimi-code; legacy ~/.kimi is fallback-only): native MCP + hooks ([[hooks]] in config.toml) + compact skill at ~/.agents/skills/prjct via prjct install. See harness-surfaces."},{id:"grok",displayName:"xAI Grok Build",kind:"cli",status:"stable",detectsBy:{homeDirs:[".grok"],commands:["grok"]},contextFiles:["AGENTS.md","CLAUDE.md"],mcpTargets:[{format:"codex-toml",pathHint:"~/.grok/config.toml",writable:!0},{format:"claude-json",pathHint:"~/.claude/mcp.json (Grok Claude-compat fallback)",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!1},notes:"Benchmark-tier CLI (2026-07): Grok Build. Native MCP + skill via prjct install (~/.grok/config.toml + ~/.grok/skills/prjct). Hooks still Claude-compat. See harness-surfaces."},{id:"goose",displayName:"Goose",kind:"cli",status:"stable",detectsBy:{homeDirs:[".config/goose"],projectDirs:[".goose"],commands:["goose"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"generic",pathHint:"Goose extensions",writable:!1}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Open-source coding agent with extension/MCP-style tool configuration."},{id:"aider",displayName:"Aider",kind:"cli",status:"stable",detectsBy:{projectFiles:[".aider.conf.yml",".aider.conf.yaml"],commands:["aider"]},contextFiles:["AGENTS.md","CONVENTIONS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"CLI pair-programming agent; AGENTS.md provides durable repo instructions."},{id:"cursor",displayName:"Cursor",kind:"ide",status:"stable",detectsBy:{projectDirs:[".cursor"],projectFiles:[".cursorrules"]},contextFiles:["AGENTS.md",".cursor/rules/prjct.mdc"],projectRuleTargets:[{relativePath:".cursor/rules/prjct.mdc",templateKey:"global/CURSOR.mdc",detectPath:".cursor"}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!0,acp:!1,projectRules:!0},notes:"Benchmark-tier AI IDE (2026-07): agent mode + CLI. Rules under .cursor/rules; prjct install writes ~/.cursor/hooks.json."},{id:"cline",displayName:"Cline",kind:"ide",status:"stable",detectsBy:{projectDirs:[".cline",".clinerules"],projectFiles:[".clinerules"]},contextFiles:["AGENTS.md",".clinerules/"],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!0,projectRules:!0},notes:"Benchmark-tier open agent (2026-07): VS Code + multi-model. AGENTS.md, rules, skills, hooks, MCP, ACP."},{id:"roo-code",displayName:"Roo Code",kind:"ide",status:"stable",detectsBy:{projectDirs:[".roo"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"VS Code agent with MCP and project rule surfaces."},{id:"continue",displayName:"Continue",kind:"ide",status:"stable",detectsBy:{projectDirs:[".continue"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"continue-yaml",pathHint:".continue/mcpServers/",writable:!1}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"IDE assistant with dedicated MCP server config directory."},{id:"kiro",displayName:"Kiro",kind:"ide",status:"stable",detectsBy:{homeDirs:[".kiro"],projectDirs:[".kiro"]},contextFiles:["AGENTS.md",".kiro/steering/"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!0,acp:!1,projectRules:!0},notes:"Agentic IDE with steering docs and MCP."},{id:"copilot",displayName:"GitHub Copilot coding agent",kind:"hosted",status:"hosted",detectsBy:{projectFiles:[m.join(".github","copilot-instructions.md")]},contextFiles:["AGENTS.md",".github/copilot-instructions.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"GitHub Copilot coding agent / Copilot CLI (2026-07 benchmark field). Repo AGENTS.md + .github instructions + MCP."},{id:"devin",displayName:"Devin",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; repo-level AGENTS.md is the safest portable surface."},{id:"jules",displayName:"Google Jules",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; AGENTS.md carries repo-level prjct instructions."},{id:"zed",displayName:"Zed Agent Panel",kind:"ide",status:"stable",detectsBy:{projectDirs:[".zed"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!0,projectRules:!0},notes:"Editor agent surface with ACP support; AGENTS.md remains the repo contract."},{id:"warp",displayName:"Warp",kind:"ide",status:"stable",detectsBy:{homeDirs:[".warp"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Terminal agent surface; AGENTS.md plus MCP covers portable prjct usage."},{id:"amp",displayName:"Amp",kind:"cli",status:"stable",detectsBy:{homeDirs:[".config/amp"],commands:["amp"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Coding agent runtime; AGENTS.md and MCP are the portable contract."},{id:"factory",displayName:"Factory",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted/agentic development platform; repo instructions are the stable surface."},{id:"augment",displayName:"Augment",kind:"ide",status:"stable",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"IDE agent; universal project instructions avoid model-specific coupling."},{id:"kilo-code",displayName:"Kilo Code",kind:"ide",status:"stable",detectsBy:{projectDirs:[".kilocode"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"Agent runtime in the Cline/Roo family; AGENTS.md and MCP keep it compatible."},{id:"phoenix",displayName:"Phoenix",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; AGENTS.md is the repo-level bridge."},{id:"ona",displayName:"Ona",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; AGENTS.md is the repo-level bridge."},{id:"semgrep",displayName:"Semgrep assistant",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Security/review agent surface; AGENTS.md carries project workflow guidance."}];function N(){return F.flatMap(e=>e.projectRuleTargets??[])}s(N,"listProjectRuleTargets");u();G();async function v(e){let t=A(e);return t||g.readFile(p.join(R,"templates",e),"utf-8")}s(v,"loadTemplate");async function B(e,t,n){let o=p.join(e,t);await g.mkdir(p.dirname(o),{recursive:!0}),await g.writeFile(o,await v(n),"utf-8")}s(B,"writeRule");async function E(e,t={}){let n=new Set(t.agents??[]),o=[];for(let i of N())(n.has(i.relativePath.split("/")[0].replace(/^\./,""))||i.detectPath&&await r(p.join(e,i.detectPath)))&&(await B(e,i.relativePath,i.templateKey),o.push(i.relativePath));return{written:o}}s(E,"writeProjectIdeRules");async function L(e){let[t,n,o]=await Promise.all([r(a.join(e,"PRJCT.md")),r(a.join(e,"AGENTS.md")),r(a.join(e,"CLAUDE.md"))]);return t||n||o}s(L,"hasAdoptedSurfaces");async function ge(e,t={}){if(!(t.explicit||t.refreshIfAdopted&&await L(e)))return{prjctMd:{action:"unchanged",path:a.join(e,"PRJCT.md")},agentsMd:{action:"unchanged",path:a.join(e,"AGENTS.md")},ideRules:[]};let o=new Set(t.agents??[]),i=await r(a.join(e,"CLAUDE.md")),f=o.has("claude")||i,[M,S,k,x]=await Promise.all([j(e),T(e),f?y(e):void 0,E(e,t)]);return{prjctMd:M,agentsMd:S,...k?{claudeMd:k}:{},ideRules:x.written}}s(ge,"writeProjectAgentSurfaces");export{ge as a};
@@ -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};
@@ -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-C4O243NG.mjs";import{a as f}from"./chunk-V2FR2NPL.mjs";import{a as C}from"./chunk-QP5USCDX.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-C3NQT65W.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,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};
@@ -5,5 +5,5 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as f}from"./chunk-6EWGHM32.mjs";import{c as m}from"./chunk-AOPJ4Z6O.mjs";import{d as r,g}from"./chunk-HDHVBB6Q.mjs";import{a as i}from"./chunk-E66B27AL.mjs";g();var _=["hook","gate","step","instruction"];function d(o){let t=o.trust_source==="imported"?"imported":"local",e=_.includes(o.type)?o.type:"step";return{id:o.id,type:e,command:o.command,position:o.position,action:o.action,description:o.description,enabled:o.enabled===1,timeoutMs:o.timeout_ms,createdAt:o.created_at,sortOrder:o.sort_order,whenExpr:o.when_expr??null,parallel:o.parallel===null?!0:o.parallel===1,trustSource:t}}i(d,"rowToRule");var p=class{static{i(this,"WorkflowRuleStorage")}addRule(t,e){let n=r.get(t,"SELECT MAX(sort_order) as m FROM workflow_rules WHERE command = ?",e.command),u=e.sortOrder||(n?.m??-1)+1;r.run(t,`INSERT INTO workflow_rules (type, command, position, action, description, enabled, timeout_ms, created_at, sort_order, when_expr, parallel, trust_source)
8
+ import{a as f}from"./chunk-3WQBTXUC.mjs";import{b as m}from"./chunk-QP5USCDX.mjs";import{d as r,g}from"./chunk-UHVYBU7F.mjs";import{a as i}from"./chunk-E66B27AL.mjs";g();var _=["hook","gate","step","instruction"];function d(o){let t=o.trust_source==="imported"?"imported":"local",e=_.includes(o.type)?o.type:"step";return{id:o.id,type:e,command:o.command,position:o.position,action:o.action,description:o.description,enabled:o.enabled===1,timeoutMs:o.timeout_ms,createdAt:o.created_at,sortOrder:o.sort_order,whenExpr:o.when_expr??null,parallel:o.parallel===null?!0:o.parallel===1,trustSource:t}}i(d,"rowToRule");var p=class{static{i(this,"WorkflowRuleStorage")}addRule(t,e){let n=r.get(t,"SELECT MAX(sort_order) as m FROM workflow_rules WHERE command = ?",e.command),u=e.sortOrder||(n?.m??-1)+1;r.run(t,`INSERT INTO workflow_rules (type, command, position, action, description, enabled, timeout_ms, created_at, sort_order, when_expr, parallel, trust_source)
9
9
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,e.type,e.command,e.position,e.action,e.description??null,e.enabled?1:0,e.timeoutMs,e.createdAt,u,e.whenExpr??null,e.parallel===!1?0:1,e.trustSource??"local");let l=r.get(t,"SELECT last_insert_rowid() as id")?.id??0;return l>0&&m({projectId:t,entityType:"workflow_rules",entityId:String(l),eventType:"upsert",data:{id:l,type:e.type,command:e.command,position:e.position,action:e.action,description:e.description??null,enabled:e.enabled?1:0,timeout_ms:e.timeoutMs,sort_order:u,when_expr:e.whenExpr??null,parallel:e.parallel===!1?0:1,trust_source:e.trustSource??"local",created_at:e.createdAt}}),l}removeRule(t,e){return r.get(t,"SELECT id FROM workflow_rules WHERE id = ?",e)?(r.run(t,"DELETE FROM workflow_rules WHERE id = ?",e),m({projectId:t,entityType:"workflow_rules",entityId:String(e),eventType:"delete",data:{id:e}}),!0):!1}updateRule(t,e,n){if(!r.get(t,"SELECT id FROM workflow_rules WHERE id = ?",e))return!1;let w={type:{column:"type"},command:{column:"command"},position:{column:"position"},action:{column:"action"},description:{column:"description"},enabled:{column:"enabled",transform:i(s=>s?1:0,"transform")},timeoutMs:{column:"timeout_ms"},createdAt:{column:"created_at"},sortOrder:{column:"sort_order"},whenExpr:{column:"when_expr"},parallel:{column:"parallel",transform:i(s=>s===!1?0:1,"transform")},trustSource:{column:"trust_source"}},l=[],c=[];for(let[s,E]of Object.entries(n)){let a=w[s];if(!a)continue;l.push(`${a.column} = ?`);let R=E;c.push(a.transform?a.transform(R):R)}return l.length===0||(c.push(e),r.run(t,`UPDATE workflow_rules SET ${l.join(", ")} WHERE id = ?`,...c)),!0}getRuleById(t,e){let n=r.get(t,"SELECT * FROM workflow_rules WHERE id = ?",e);return n?d(n):null}getRulesForCommand(t,e){let n=f.getWorkflow(t,e);return!n||!n.enabled?[]:r.query(t,"SELECT * FROM workflow_rules WHERE command = ? AND enabled = 1 ORDER BY sort_order ASC",e).map(d)}getAllRules(t){return r.query(t,"SELECT * FROM workflow_rules ORDER BY command ASC, sort_order ASC").map(d)}resetRules(t){let e=r.get(t,"SELECT COUNT(*) as c FROM workflow_rules");return r.run(t,"DELETE FROM workflow_rules"),e?.c??0}},S=new p;export{S as a};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as f}from"./chunk-DYHYDHCW.mjs";import{d as x,f as D,j as g,n as S}from"./chunk-SVZHJZ5T.mjs";import{a as l,o as P}from"./chunk-CTWZQ7YI.mjs";import{d as k}from"./chunk-PKDYFXMI.mjs";import{a}from"./chunk-E66B27AL.mjs";import y from"node:path";P();S();S();import j from"node:fs/promises";import F from"node:path";var d=class{static{a(this,"StackDetector")}projectPath;constructor(t){this.projectPath=t}async detect(){let t={hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]},e=await this.readPackageJson();if(e){let s={...e.dependencies,...e.devDependencies};this.detectFrontend(s,t),this.detectBackend(s,t),this.detectDatabase(s,t),this.detectTesting(s,e,t),this.collectFrameworks(s,t)}return t.hasDocker=await this.detectDocker(),t}detectFrontend(t,e){(t.react||t.vue||t.svelte||t["@angular/core"])&&(e.hasFrontend=!0,e.frontendType="web"),(t["react-native"]||t.expo)&&(e.hasFrontend=!0,e.frontendType=e.frontendType==="web"?"both":"mobile")}detectBackend(t,e){["express","fastify","hono","koa","@nestjs/core","nest","@hapi/hapi","restify","polka"].some(o=>t[o])&&(e.hasBackend=!0)}detectDatabase(t,e){["prisma","@prisma/client","mongoose","pg","mysql2","sequelize","typeorm","drizzle-orm","knex","better-sqlite3","mongodb","redis","ioredis"].some(o=>t[o])&&(e.hasDatabase=!0)}detectTesting(t,e,s){["jest","vitest","mocha","@testing-library/react","@testing-library/vue","cypress","playwright","@playwright/test","ava","tap","bun-types"].some(c=>t[c]||e.devDependencies?.[c])&&(s.hasTesting=!0)}async detectDocker(){let t=["Dockerfile","docker-compose.yml","docker-compose.yaml",".dockerignore"];for(let e of t)if(await this.fileExistsInProject(e))return!0;return!1}collectFrameworks(t,e){t.react&&e.frameworks.push("React"),t.next&&e.frameworks.push("Next.js"),t.vue&&e.frameworks.push("Vue"),t.nuxt&&e.frameworks.push("Nuxt"),t.svelte&&e.frameworks.push("Svelte"),t["@angular/core"]&&e.frameworks.push("Angular"),t["react-native"]&&e.frameworks.push("React Native"),t.expo&&e.frameworks.push("Expo"),t.express&&e.frameworks.push("Express"),t.fastify&&e.frameworks.push("Fastify"),t.hono&&e.frameworks.push("Hono"),t.koa&&e.frameworks.push("Koa"),(t["@nestjs/core"]||t.nest)&&e.frameworks.push("NestJS"),t.astro&&e.frameworks.push("Astro"),t.remix&&e.frameworks.push("Remix"),t.gatsby&&e.frameworks.push("Gatsby")}async readPackageJson(){try{let t=F.join(this.projectPath,"package.json"),e=await j.readFile(t,"utf-8");return JSON.parse(e)}catch{return null}}async fileExistsInProject(t){return g(F.join(this.projectPath,t))}};async function I(r){let t={branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0},e={cwd:r},s=a(i=>i.catch(()=>null),"safe"),[o,c,w,h,b,v]=await Promise.all([s(l("git branch --show-current",e)),s(l("git rev-list --count HEAD",e)),s(l("git shortlog -sn --all",e)),s(l("git status --porcelain",e)),s(l('git log --oneline -20 --pretty=format:"%h|%s|%ad" --date=short',e)),s(l('git log --oneline --since="1 week ago"',e))]);if(o&&(t.branch=o.stdout.trim()||"main"),c&&(t.commits=parseInt(c.stdout.trim(),10)||0),w&&(t.contributors=w.stdout.split(`
8
+ import{a as f}from"./chunk-DYHYDHCW.mjs";import{d as x,f as D,k as g,o as S}from"./chunk-UH4MD3F3.mjs";import{a as l,p as P}from"./chunk-QWQFF2UG.mjs";import{d as k}from"./chunk-PKDYFXMI.mjs";import{a}from"./chunk-E66B27AL.mjs";import y from"node:path";P();S();S();import j from"node:fs/promises";import F from"node:path";var d=class{static{a(this,"StackDetector")}projectPath;constructor(t){this.projectPath=t}async detect(){let t={hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]},e=await this.readPackageJson();if(e){let s={...e.dependencies,...e.devDependencies};this.detectFrontend(s,t),this.detectBackend(s,t),this.detectDatabase(s,t),this.detectTesting(s,e,t),this.collectFrameworks(s,t)}return t.hasDocker=await this.detectDocker(),t}detectFrontend(t,e){(t.react||t.vue||t.svelte||t["@angular/core"])&&(e.hasFrontend=!0,e.frontendType="web"),(t["react-native"]||t.expo)&&(e.hasFrontend=!0,e.frontendType=e.frontendType==="web"?"both":"mobile")}detectBackend(t,e){["express","fastify","hono","koa","@nestjs/core","nest","@hapi/hapi","restify","polka"].some(o=>t[o])&&(e.hasBackend=!0)}detectDatabase(t,e){["prisma","@prisma/client","mongoose","pg","mysql2","sequelize","typeorm","drizzle-orm","knex","better-sqlite3","mongodb","redis","ioredis"].some(o=>t[o])&&(e.hasDatabase=!0)}detectTesting(t,e,s){["jest","vitest","mocha","@testing-library/react","@testing-library/vue","cypress","playwright","@playwright/test","ava","tap","bun-types"].some(c=>t[c]||e.devDependencies?.[c])&&(s.hasTesting=!0)}async detectDocker(){let t=["Dockerfile","docker-compose.yml","docker-compose.yaml",".dockerignore"];for(let e of t)if(await this.fileExistsInProject(e))return!0;return!1}collectFrameworks(t,e){t.react&&e.frameworks.push("React"),t.next&&e.frameworks.push("Next.js"),t.vue&&e.frameworks.push("Vue"),t.nuxt&&e.frameworks.push("Nuxt"),t.svelte&&e.frameworks.push("Svelte"),t["@angular/core"]&&e.frameworks.push("Angular"),t["react-native"]&&e.frameworks.push("React Native"),t.expo&&e.frameworks.push("Expo"),t.express&&e.frameworks.push("Express"),t.fastify&&e.frameworks.push("Fastify"),t.hono&&e.frameworks.push("Hono"),t.koa&&e.frameworks.push("Koa"),(t["@nestjs/core"]||t.nest)&&e.frameworks.push("NestJS"),t.astro&&e.frameworks.push("Astro"),t.remix&&e.frameworks.push("Remix"),t.gatsby&&e.frameworks.push("Gatsby")}async readPackageJson(){try{let t=F.join(this.projectPath,"package.json"),e=await j.readFile(t,"utf-8");return JSON.parse(e)}catch{return null}}async fileExistsInProject(t){return g(F.join(this.projectPath,t))}};async function I(r){let t={branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0},e={cwd:r},s=a(i=>i.catch(()=>null),"safe"),[o,c,w,h,b,v]=await Promise.all([s(l("git branch --show-current",e)),s(l("git rev-list --count HEAD",e)),s(l("git shortlog -sn --all",e)),s(l("git status --porcelain",e)),s(l('git log --oneline -20 --pretty=format:"%h|%s|%ad" --date=short',e)),s(l('git log --oneline --since="1 week ago"',e))]);if(o&&(t.branch=o.stdout.trim()||"main"),c&&(t.commits=parseInt(c.stdout.trim(),10)||0),w&&(t.contributors=w.stdout.split(`
9
9
  `).filter(i=>i.trim()).length),h){let i=h.stdout.trim().split(`
10
10
  `).filter(Boolean);t.hasChanges=i.length>0;for(let p of i){let m=p.substring(0,2),u=p.substring(3);m.startsWith("A")||m.startsWith("M ")?t.stagedFiles.push(u):m.includes("M")?t.modifiedFiles.push(u):m.startsWith("??")&&t.untrackedFiles.push(u)}}return b&&(t.recentCommits=b.stdout.split(`
11
11
  `).filter(Boolean).map(i=>{let[p,m,u]=i.split("|");return{hash:p,message:m,date:u}})),v&&(t.weeklyCommits=v.stdout.split(`
@@ -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 r}from"./chunk-E66B27AL.mjs";import{createHash as e}from"node:crypto";function s(n){return e("sha256").update(n).digest("hex")}r(s,"sha256");function c(n){return s(n).slice(0,16)}r(c,"sha256Short");function f(n){let t=n&&typeof n=="object"&&!Array.isArray(n)?JSON.stringify(i(n)):JSON.stringify(n);return s(t)}r(f,"hashPayload");function i(n){let t={};for(let o of Object.keys(n).sort())t[o]=n[o];return t}r(i,"sortKeys");export{s as a,c as b,f as c};
@@ -5,9 +5,9 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-JRKGG2E3.mjs";import{n as E,r as _,s as T,t as S}from"./chunk-AKIN5WSQ.mjs";import{m as I,n as P}from"./chunk-SVZHJZ5T.mjs";import{a as A}from"./chunk-PKDYFXMI.mjs";import{a as y,e as $,f as O}from"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import i from"chalk";_();import m from"chalk";var j=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],x=80,v={name:"prjct",icon:"\u26A1",signature:"\u26A1 prjct",spinner:{frames:j,speed:x},cli:{header:c(()=>`${m.cyan.bold("\u26A1")} ${m.cyan("prjct")}`,"header"),footer:c(()=>m.dim("\u26A1 prjct"),"footer"),spin:c((e,t)=>`${m.cyan("\u26A1")} ${m.cyan("prjct")} ${m.cyan(j[e%10])} ${m.dim(t||"")}`,"spin")},template:{header:"\u26A1 prjct",footer:"\u26A1 prjct"},commitFooter:"Generated with [p/](https://www.prjct.app/)",urls:{website:"https://prjct.app",docs:"https://prjct.app/docs"},getCommitFooter:c((e="claude")=>E(e).commitFooter,"getCommitFooter"),getSignature:c((e="claude")=>E(e).signature,"getSignature")},l=v;var w={NO_PROJECT:{message:"No prjct project found in this directory",hint:"Run 'prjct init' to set up a new project",file:".prjct/prjct.config.json"},NO_PROJECT_ID:{message:"Project ID not found",hint:"Run 'prjct init' or check .prjct/prjct.config.json",file:".prjct/prjct.config.json"},CONFIG_NOT_FOUND:{message:"Configuration file not found",hint:"Run 'prjct init' to create project configuration",file:".prjct/prjct.config.json"},CONFIG_INVALID:{message:"Invalid configuration file",hint:"Check JSON syntax or delete .prjct/ and run init again",file:".prjct/prjct.config.json"},GIT_NOT_FOUND:{message:"Git repository not detected",hint:"Run 'git init' first, then 'prjct init'"},GIT_NO_COMMITS:{message:"No commits in repository",hint:"Make an initial commit before using prjct"},GIT_DIRTY:{message:"Working directory has uncommitted changes",hint:"Commit or stash changes, or use '--force' to override"},GIT_ON_MAIN:{message:"Cannot ship from main/master branch",hint:"Create a feature branch first: git checkout -b feature/your-feature"},GIT_OPERATION_FAILED:{message:"Git operation failed",hint:"Check git status and resolve any conflicts"},GH_NOT_AUTHENTICATED:{message:"GitHub CLI not authenticated",hint:"Run 'gh auth login' to authenticate",docs:"https://cli.github.com/manual/gh_auth_login"},LINEAR_NOT_CONFIGURED:{message:"Linear integration not configured",hint:"Configure the Linear MCP server in your AI client"},LINEAR_API_ERROR:{message:"Linear API error",hint:"Check your API key or network connection"},NO_ACTIVE_TASK:{message:"No active work cycle",hint:`Start work with 'p. work "intent"'`},TASK_ALREADY_ACTIVE:{message:"A work cycle is already in progress",hint:"Use 'p. work' to inspect it or ship when complete"},SYNC_FAILED:{message:"Project sync failed",hint:"Check file permissions and try again"},NOTHING_TO_SHIP:{message:"Nothing to ship",hint:"Make some changes first, then run ship"},PR_CREATE_FAILED:{message:"Failed to create pull request",hint:"Check GitHub auth and remote configuration"},NO_AI_PROVIDER:{message:"No AI provider detected",hint:"Install Claude Code or Gemini CLI, then run 'prjct start'",docs:"https://prjct.app/docs"},PROVIDER_NOT_CONFIGURED:{message:"AI provider not configured for prjct",hint:"Run 'prjct start' to configure your provider"},UNKNOWN_COMMAND:{message:"Unknown command",hint:"Run 'prjct --help' to see available commands"},MISSING_PARAM:{message:"Missing required parameter",hint:"Check command usage below"},UNKNOWN:{message:"An unexpected error occurred",hint:"Check the error details and try again"}};function R(e,t){return{...w[e],...t}}c(R,"getError");var b=l.spinner.speed,L={silent:{maxLines:0,maxCharsPerLine:0,showMetrics:!1},minimal:{maxLines:1,maxCharsPerLine:65,showMetrics:!1},compact:{maxLines:4,maxCharsPerLine:80,showMetrics:!0},verbose:{maxLines:1/0,maxCharsPerLine:1/0,showMetrics:!0}},s={currentTier:"compact",interval:null,frame:0,quietMode:!1};function k(){return L[s.currentTier]}c(k,"getTierConfig");var h={success:i.green("\u2713"),fail:i.red("\u2717"),warn:i.yellow("\u26A0"),info:i.blue("\u2139"),debug:i.dim("\u{1F527}"),bullet:i.dim("\u2022"),arrow:i.dim("\u2192"),check:i.green("\u2713"),cross:i.red("\u2717"),spinner:i.cyan("\u25D0")};var g=c((e,t)=>{if(!process.stdout.isTTY&&!process.stderr.isTTY)return e||"";let r=t??(k().maxCharsPerLine||u.FALLBACK_TRUNCATE);return e&&e.length>r?`${e.slice(0,r-1)}\u2026`:e||""},"truncate");var G=c(()=>process.stdout.isTTY?process.stdout.write(`\r${" ".repeat(u.CLEAR_WIDTH)}\r`):!0,"clear"),D={start(){return s.quietMode||console.log(l.cli.header()),this},end(){return s.quietMode||console.log(l.cli.footer()),this},spin(e){return s.quietMode?this:(this.stop(),process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,g(e,u.SPINNER_MSG))}`)},b),this):(process.stdout.write(`${l.cli.spin(0,g(e,u.SPINNER_MSG))}
8
+ import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-PO3QDKTE.mjs";import{q as E,u as _,v as T,w as S}from"./chunk-A6K4H3YT.mjs";import{n as I,o as P}from"./chunk-UH4MD3F3.mjs";import{a as A}from"./chunk-PKDYFXMI.mjs";import{a as y,e as $,f as O}from"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import i from"chalk";_();import m from"chalk";var j=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],x=80,v={name:"prjct",icon:"\u26A1",signature:"\u26A1 prjct",spinner:{frames:j,speed:x},cli:{header:c(()=>`${m.cyan.bold("\u26A1")} ${m.cyan("prjct")}`,"header"),footer:c(()=>m.dim("\u26A1 prjct"),"footer"),spin:c((e,t)=>`${m.cyan("\u26A1")} ${m.cyan("prjct")} ${m.cyan(j[e%10])} ${m.dim(t||"")}`,"spin")},template:{header:"\u26A1 prjct",footer:"\u26A1 prjct"},commitFooter:"Generated with [p/](https://www.prjct.app/)",urls:{website:"https://prjct.app",docs:"https://prjct.app/docs"},getCommitFooter:c((e="claude")=>E(e).commitFooter,"getCommitFooter"),getSignature:c((e="claude")=>E(e).signature,"getSignature")},l=v;var w={NO_PROJECT:{message:"No prjct project found in this directory",hint:"Run 'prjct init' to set up a new project",file:".prjct/prjct.config.json"},NO_PROJECT_ID:{message:"Project ID not found",hint:"Run 'prjct init' or check .prjct/prjct.config.json",file:".prjct/prjct.config.json"},CONFIG_NOT_FOUND:{message:"Configuration file not found",hint:"Run 'prjct init' to create project configuration",file:".prjct/prjct.config.json"},CONFIG_INVALID:{message:"Invalid configuration file",hint:"Check JSON syntax or delete .prjct/ and run init again",file:".prjct/prjct.config.json"},GIT_NOT_FOUND:{message:"Git repository not detected",hint:"Run 'git init' first, then 'prjct init'"},GIT_NO_COMMITS:{message:"No commits in repository",hint:"Make an initial commit before using prjct"},GIT_DIRTY:{message:"Working directory has uncommitted changes",hint:"Commit or stash changes, or use '--force' to override"},GIT_ON_MAIN:{message:"Cannot ship from main/master branch",hint:"Create a feature branch first: git checkout -b feature/your-feature"},GIT_OPERATION_FAILED:{message:"Git operation failed",hint:"Check git status and resolve any conflicts"},GH_NOT_AUTHENTICATED:{message:"GitHub CLI not authenticated",hint:"Run 'gh auth login' to authenticate",docs:"https://cli.github.com/manual/gh_auth_login"},LINEAR_NOT_CONFIGURED:{message:"Linear integration not configured",hint:"Configure the Linear MCP server in your AI client"},LINEAR_API_ERROR:{message:"Linear API error",hint:"Check your API key or network connection"},NO_ACTIVE_TASK:{message:"No active work cycle",hint:`Start work with 'p. work "intent"'`},TASK_ALREADY_ACTIVE:{message:"A work cycle is already in progress",hint:"Use 'p. work' to inspect it or ship when complete"},SYNC_FAILED:{message:"Project sync failed",hint:"Check file permissions and try again"},NOTHING_TO_SHIP:{message:"Nothing to ship",hint:"Make some changes first, then run ship"},PR_CREATE_FAILED:{message:"Failed to create pull request",hint:"Check GitHub auth and remote configuration"},NO_AI_PROVIDER:{message:"No AI provider detected",hint:"Install Claude Code or Gemini CLI, then run 'prjct start'",docs:"https://prjct.app/docs"},PROVIDER_NOT_CONFIGURED:{message:"AI provider not configured for prjct",hint:"Run 'prjct start' to configure your provider"},UNKNOWN_COMMAND:{message:"Unknown command",hint:"Run 'prjct --help' to see available commands"},MISSING_PARAM:{message:"Missing required parameter",hint:"Check command usage below"},UNKNOWN:{message:"An unexpected error occurred",hint:"Check the error details and try again"}};function R(e,t){return{...w[e],...t}}c(R,"getError");var b=l.spinner.speed,L={silent:{maxLines:0,maxCharsPerLine:0,showMetrics:!1},minimal:{maxLines:1,maxCharsPerLine:65,showMetrics:!1},compact:{maxLines:4,maxCharsPerLine:80,showMetrics:!0},verbose:{maxLines:1/0,maxCharsPerLine:1/0,showMetrics:!0}},s={currentTier:"compact",interval:null,frame:0,quietMode:!1};function k(){return L[s.currentTier]}c(k,"getTierConfig");var h={success:i.green("\u2713"),fail:i.red("\u2717"),warn:i.yellow("\u26A0"),info:i.blue("\u2139"),debug:i.dim("\u{1F527}"),bullet:i.dim("\u2022"),arrow:i.dim("\u2192"),check:i.green("\u2713"),cross:i.red("\u2717"),spinner:i.cyan("\u25D0")};var g=c((e,t)=>{if(!process.stdout.isTTY&&!process.stderr.isTTY)return e||"";let r=t??(k().maxCharsPerLine||u.FALLBACK_TRUNCATE);return e&&e.length>r?`${e.slice(0,r-1)}\u2026`:e||""},"truncate");var G=c(()=>process.stdout.isTTY?process.stdout.write(`\r${" ".repeat(u.CLEAR_WIDTH)}\r`):!0,"clear"),D={start(){return s.quietMode||console.log(l.cli.header()),this},end(){return s.quietMode||console.log(l.cli.footer()),this},spin(e){return s.quietMode?this:(this.stop(),process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,g(e,u.SPINNER_MSG))}`)},b),this):(process.stdout.write(`${l.cli.spin(0,g(e,u.SPINNER_MSG))}
9
9
  `),this))},done(e,t){if(this.stop(),!s.quietMode){let r=[];t?.agents!==void 0&&r.push(`${t.agents}a`),t?.reduction!==void 0&&r.push(`${t.reduction}%`),t?.tokens!==void 0&&r.push(`${Math.round(t.tokens)}K`);let o=r.length>0?i.dim(` [${r.join(" | ")}]`):"";console.log(`${h.success} ${g(e,u.DONE_MSG)}${o}`)}return this},fail(e){return this.stop(),console.error(`${h.fail} ${g(e,u.FAIL_MSG)}`),this},failWithHint(e){this.stop();let t=typeof e=="string"?R(e):e;return console.error(),console.error(`${h.fail} ${t.message}`),t.file&&console.error(i.dim(` File: ${t.file}`)),t.hint&&console.error(i.yellow(` \u{1F4A1} ${t.hint}`)),t.docs&&console.error(i.dim(` Docs: ${t.docs}`)),console.error(),this},warn(e){return this.stop(),s.quietMode||console.log(`${h.warn} ${g(e,u.WARN_MSG)}`),this},info(e){return this.stop(),s.quietMode||console.log(`${h.info} ${e}`),this},debug(e){this.stop();let t=process.env.DEBUG==="1"||process.env.DEBUG==="true";return!s.quietMode&&t&&console.log(`${h.debug} ${i.dim(e)}`),this},success(e,t){return this.done(e,t)},list(e,t={}){if(this.stop(),s.quietMode)return this;let r=t.bullet||h.bullet,o=" ".repeat(t.indent||0);for(let n of e)console.log(`${o}${r} ${n}`);return this},table(e,t={}){if(this.stop(),s.quietMode||e.length===0)return this;let r=Object.keys(e[0]),o={};for(let n of r){o[n]=n.length;for(let a of e){let p=String(a[n]??"");p.length>o[n]&&(o[n]=p.length)}}if(t.header!==!1){let n=r.map(a=>a.padEnd(o[a])).join(" ");console.log(i.dim(n)),console.log(i.dim("\u2500".repeat(n.length)))}for(let n of e){let a=r.map(p=>String(n[p]??"").padEnd(o[p])).join(" ");console.log(a)}return this},box(e,t){if(this.stop(),s.quietMode)return this;let r=t.split(`
10
10
  `),o=Math.max(e.length,...r.map(a=>a.length)),n="\u2500".repeat(o+2);console.log(i.dim(`\u250C${n}\u2510`)),console.log(`${i.dim("\u2502")} ${i.bold(e.padEnd(o))} ${i.dim("\u2502")}`),console.log(i.dim(`\u251C${n}\u2524`));for(let a of r)console.log(`${i.dim("\u2502")} ${a.padEnd(o)} ${i.dim("\u2502")}`);return console.log(i.dim(`\u2514${n}\u2518`)),this},section(e){return this.stop(),s.quietMode?this:(console.log(`
11
11
  ${i.bold(e)}`),console.log(i.dim("\u2500".repeat(e.length))),this)},stop(){return s.interval&&(clearInterval(s.interval),s.interval=null,G()),this},step(e,t,r){if(s.quietMode)return this;this.stop();let o=i.dim(`[${e}/${t}]`);return process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,`${o} ${g(r,u.STEP_MSG)}`)}`)},b),this):(process.stdout.write(`${l.cli.spin(0,`${o} ${g(r,u.STEP_MSG)}`)}
12
12
  `),this)},progress(e,t,r){if(s.quietMode)return this;this.stop();let o=Math.round(e/t*100),n=Math.round(o/10),a=10-n,p=i.cyan("\u2588".repeat(n))+i.dim("\u2591".repeat(a)),d=r?` ${g(r,u.PROGRESS_TEXT)}`:"";return process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,`[${p}] ${o}%${d}`)}`)},b),this):(process.stdout.write(`${l.cli.spin(0,`[${p}] ${o}%${d}`)}
13
- `),this)}},M=D;S();O();P();var C=class{static{c(this,"ProjectService")}currentAuthor=null;async ensureInit(t){if(await f.isConfigured(t))return{success:!0};try{let{worktreeService:a}=await import("./worktree-service-XGRN5TTE.mjs");if(await a.detect(t)){let d=await a.getMainWorktree(t);if(d&&d!==t&&await f.isConfigured(d))return await a.setup(t,d),{success:!0}}}catch{}M.spin("initializing project...");let{PlanningCommands:r}=await import("./planning-WMLFXZMA.mjs"),n=await new r().init(null,t);return n.success?{success:!0}:n}async getProjectId(t){let r=await f.getProjectId(t);if(!r)throw A.notInitialized();return r}async getGlobalPath(t){let r=await this.getProjectId(t);return await T.ensureProjectStructure(r),T.getGlobalProjectPath(r)}async ensureAuthor(){if(this.currentAuthor)return this.currentAuthor;let t=await N();return this.currentAuthor={name:t.name??void 0,email:t.email??void 0,github:t.github??void 0},this.currentAuthor}getCurrentAuthor(){return this.currentAuthor}clearAuthorCache(){this.currentAuthor=null}async isEmptyDirectory(t){try{return(await I(t)).filter(n=>!n.startsWith(".")&&n!=="node_modules"&&n!=="package.json"&&n!=="package-lock.json"&&n!=="README.md").length===0}catch(r){return y(r)||console.error(`Directory check error: ${$(r)}`),!0}}async hasExistingCode(t){try{let r=["src","lib","app","components","pages","api","main.go","main.rs","main.py"];return(await I(t)).some(n=>r.includes(n))}catch(r){return y(r)||console.error(`Code check error: ${$(r)}`),!1}}async isConfigured(t){return await f.isConfigured(t)}async needsMigration(t){return await f.needsMigration(t)}},F=new C,ct=F;export{M as a,F as b,ct as c};
13
+ `),this)}},M=D;S();O();P();var C=class{static{c(this,"ProjectService")}currentAuthor=null;async ensureInit(t){if(await f.isConfigured(t))return{success:!0};try{let{worktreeService:a}=await import("./worktree-service-AS7JVBK5.mjs");if(await a.detect(t)){let d=await a.getMainWorktree(t);if(d&&d!==t&&await f.isConfigured(d))return await a.setup(t,d),{success:!0}}}catch{}M.spin("initializing project...");let{PlanningCommands:r}=await import("./planning-M3RAOZVB.mjs"),n=await new r().init(null,t);return n.success?{success:!0}:n}async getProjectId(t){let r=await f.getProjectId(t);if(!r)throw A.notInitialized();return r}async getGlobalPath(t){let r=await this.getProjectId(t);return await T.ensureProjectStructure(r),T.getGlobalProjectPath(r)}async ensureAuthor(){if(this.currentAuthor)return this.currentAuthor;let t=await N();return this.currentAuthor={name:t.name??void 0,email:t.email??void 0,github:t.github??void 0},this.currentAuthor}getCurrentAuthor(){return this.currentAuthor}clearAuthorCache(){this.currentAuthor=null}async isEmptyDirectory(t){try{return(await I(t)).filter(n=>!n.startsWith(".")&&n!=="node_modules"&&n!=="package.json"&&n!=="package-lock.json"&&n!=="README.md").length===0}catch(r){return y(r)||console.error(`Directory check error: ${$(r)}`),!0}}async hasExistingCode(t){try{let r=["src","lib","app","components","pages","api","main.go","main.rs","main.py"];return(await I(t)).some(n=>r.includes(n))}catch(r){return y(r)||console.error(`Code check error: ${$(r)}`),!1}}async isConfigured(t){return await f.isConfigured(t)}async needsMigration(t){return await f.needsMigration(t)}},F=new C,ct=F;export{M as a,F as b,ct as c};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{c as t}from"./chunk-ZZ65CN5F.mjs";import{a as e}from"./chunk-E66B27AL.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-RMCQEHV6.mjs"),c=await s(r,o);c?.id&&t.recordSurfaced(r,i,c.id);for(let n of i)t.recordFetch(r,n)}catch{}}e(f,"recordSurfacedForActiveTask");export{f as a};
8
+ import{c as t}from"./chunk-4HAKTI36.mjs";import{a as e}from"./chunk-E66B27AL.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-PXCDU55T.mjs"),c=await s(r,o);c?.id&&t.recordSurfaced(r,i,c.id);for(let n of i)t.recordFetch(r,n)}catch{}}e(f,"recordSurfacedForActiveTask");export{f as a};
@@ -5,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-PO3QDKTE.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-RPGATIYJ.mjs"),r=e(n);if(!r)return null;let i=r.payload.stack,o=[i.ecosystem&&i.ecosystem!=="unknown"?i.ecosystem:null,i.languages.slice(0,O).join(", ")||null,i.frameworks.slice(0,x).join(", ")||null].filter(s=>!!s);return o.length>0?o.join(" \xB7 "):null}catch{return null}}a(L,"buildStackLine");async function b(t){let[n,e]=await Promise.all([L(t),C(t)]),r=G(e.commands);if(!n&&r.length===0)return null;let i=[];n&&i.push(`- stack: ${n}`);for(let o of r){let s=o.mutating?"mutating":"read-only";i.push(`- ${o.kind}: \`${K(o.command,I)}\` (${s})`)}return i.push("- deeper: `prjct context --md` \xB7 `prjct_analysis` MCP \xB7 `prjct_relevant_files` MCP"),i.join(`
9
9
  `)}a(b,"buildProjectFactsSection");async function $(t){let n=await b(t),e=[p];return n&&e.push("","## This project",n),e.join(`
10
10
  `)}a($,"buildPrjctMdBody");async function J(t){let n=await $(t),e=`${f}
11
11
  ${n}
@@ -5,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 p}from"./chunk-3FBCOCPD.mjs";import{c as h}from"./chunk-YUOTOCKK.mjs";import{a as d}from"./chunk-E66B27AL.mjs";var k={memories:"memories",tasks:"tasks",subtasks:"subtasks",ideas:"ideas",queue_tasks:"queue_tasks",custom_workflows:"custom_workflows",workflow_rules:"workflow_rules",archives:"archives",shipped_items:"shipped_items",shipped_features:"shipped_features",metrics_daily:"metrics_daily",work_cost_snapshots:"work_cost_snapshots",velocity_sprints:"velocity_sprints",analysis:"analysis",specs:"specs",memory:"memories",memory_entry:"memories",task:"tasks",paused_task:"tasks",subtask:"subtasks",idea:"ideas",queue:"queue_tasks",queue_task:"queue_tasks",shipped:"shipped_items",feature:"roadmap_features",workflow:"custom_workflows",workflow_rule:"workflow_rules",metric:"metrics_daily",work_cost_snapshot:"work_cost_snapshots",velocity:"velocity_sprints",spec:"specs",project:"projects",session:"sessions",agent:"agents"};function y(c){if(c)return k[c]}d(y,"toCloudTable");var w={memories:"memories",tasks:"tasks",subtasks:"tasks",queue_tasks:"tasks",ideas:"ideas",shipped_items:"shipped",shipped_features:"shipped",custom_workflows:"workflows",workflow_rules:"workflows",metrics_daily:"metrics",work_cost_snapshots:"metrics",velocity_sprints:"metrics",archives:"archives",analysis:"analysis",specs:"specs"},f={memories:!0,tasks:!0,ideas:!0,shipped:!0,workflows:!0,metrics:!0,archives:!0,user_prompts:!1,agent_sessions:!1,analysis:!0,specs:!0};function T(c,e){let t=w[c];return t?{...f,...e??{}}[t]!==!1:!0}d(T,"isTableIncluded");var v=Object.keys(f);function _(c){return c.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}d(_,"camelToSnake");function E(c){let e={};for(let[t,s]of Object.entries(c))e[_(t)]=s;return e}d(E,"snakeCaseKeys");function R(c,e){let[t,s]=e.type.split("."),r=y(e.entityType)??y(t);if(!r)return null;let i=e.eventType==="delete"||s==="deleted"||s==="archived"||s==="removed"?"delete":"upsert",n=e.data||{},a=E(n),u=e.entityId||(typeof a.id=="string"?a.id:"")||(typeof n.id=="string"?n.id:"")||(typeof a.task_id=="string"?a.task_id:"")||(typeof n.taskId=="string"?n.taskId:"")||(typeof a.entity_id=="string"?a.entity_id:"")||"";u&&a.id==null&&(a.id=u);let l={event_type:i,entity_type:r,entity_id:u,data:{...a,project_id:c},project_id:c};return e.originDeviceId!==void 0&&(l.origin_device_id=e.originDeviceId),e.contentHash!==void 0&&(l.content_hash=e.contentHash),e.revisionCount!==void 0&&(l.revision_count=e.revisionCount),e.timestamp&&(l.ts=e.timestamp),l}d(R,"mapCliEventToWebFormat");function g(c,e){return e.map(t=>R(c,t)).filter(t=>t!==null)}d(g,"mapCliEventsToWebFormat");var m=class{static{d(this,"SyncClient")}retryConfig={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4};async pushEvents(e,t){let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)throw this.createError("AUTH_REQUIRED","No API key configured");let i=g(e,t),n=await this.fetchWithRetry(`${s}/sync/batch`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify({projectId:e,events:i})});if(!n.ok)throw await this.parseErrorResponse(n);return await n.json()}async pullEvents(e,t,s){let{apiUrl:r,apiKey:o,deviceId:i}=await this.getAuthHeaders();if(!o)throw this.createError("AUTH_REQUIRED","No API key configured");let n={projectId:e};typeof t=="number"&&t>0&&(n.sinceEventId=t);let a=await this.fetchWithRetry(`${r}/sync/pull`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(o,i)},body:JSON.stringify(n)});if(!a.ok)throw await this.parseErrorResponse(a);return await a.json()}async getStatus(e){let{apiUrl:t,apiKey:s,deviceId:r}=await this.getAuthHeaders();if(!s)throw this.createError("AUTH_REQUIRED","No API key configured");let o=await this.fetchWithRetry(`${t}/sync/status/${e}`,{method:"GET",headers:{...this.authHeaders(s,r)}});if(!o.ok)throw await this.parseErrorResponse(o);return await o.json()}async linkProject(e,t,s){let{apiUrl:r,apiKey:o,deviceId:i}=await this.getAuthHeaders();if(!o)throw this.createError("AUTH_REQUIRED","No API key configured");let n=await this.fetchWithRetry(`${r}/sync/link`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(o,i)},body:JSON.stringify({projectId:e,...t?{name:t}:{},...s?{meta:s}:{}})});if(!n.ok)throw await this.parseErrorResponse(n);return await n.json()}async setCloudLifecycle(e,t){try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();return r?(await this.fetchWithRetry(`${s}/sync/projects/${e}/${t}`,{method:"POST",headers:{...this.authHeaders(r,o)}})).ok:!1}catch{return!1}}async uploadCodeGraph(e,t){try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)return{ok:!1,reason:"unauthenticated"};let i=await this.fetchWithRetry(`${s}/sync/projects/${e}/code-graph`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify(t)});if(!i.ok)return{ok:!1,reason:await(async()=>{let u=`${i.status} ${i.statusText}`;try{let l=await i.json();return typeof l.detail=="string"?l.detail:l.detail!=null?JSON.stringify(l.detail).slice(0,300):u}catch{return u}})()};let n=await i.json();return{ok:n.ok!==!1,nodes:n.nodes,links:n.links}}catch(s){return{ok:!1,reason:s instanceof Error?s.message:String(s)}}}async publishBenchmark(e,t){let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)throw this.createError("AUTH_REQUIRED","No API key configured");let i=await this.fetchWithRetry(`${s}/benchmarks/evals`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify({projectId:e,...t})});if(!i.ok)throw await this.parseErrorResponse(i);return await i.json()}async testConnection(){let e=new AbortController,t=setTimeout(()=>e.abort(),p("API_REQUEST"));try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)return clearTimeout(t),!1;let i=await fetch(`${s}/auth/verify`,{method:"GET",headers:{...this.authHeaders(r,o)},signal:e.signal});return clearTimeout(t),i.status===401||i.status===403?(await h.clearAuth(),!1):i.ok}catch{return clearTimeout(t),!1}}async hasAuth(){return await h.hasAuth()}async getAuthHeaders(){let[e,t,s]=await Promise.all([h.getApiUrl(),h.getApiKey(),h.getDeviceId()]);return{apiUrl:e,apiKey:t,deviceId:s}}authHeaders(e,t){return{"X-Api-Key":e,"X-Device-Id":t}}async fetchWithRetry(e,t,s=0){let r=new AbortController,o=setTimeout(()=>r.abort(),p("API_REQUEST")),i=(t.method??"GET").toUpperCase(),n=i==="GET"||i==="HEAD";try{let a=await fetch(e,{...t,signal:r.signal});if(clearTimeout(o),n&&a.status>=500&&s<this.retryConfig.maxRetries){let u=Math.min(this.retryConfig.baseDelayMs*2**s,this.retryConfig.maxDelayMs);return await this.sleep(u),this.fetchWithRetry(e,t,s+1)}return a}catch(a){if(clearTimeout(o),a instanceof Error&&a.name==="AbortError")throw this.createError("NETWORK_ERROR",`Request timed out. Try increasing PRJCT_TIMEOUT_API_REQUEST (current: ${p("API_REQUEST")}ms)`);if(n&&s<this.retryConfig.maxRetries){let u=Math.min(this.retryConfig.baseDelayMs*2**s,this.retryConfig.maxDelayMs);return await this.sleep(u),this.fetchWithRetry(e,t,s+1)}throw this.createError("NETWORK_ERROR",a instanceof Error?a.message:"Network request failed")}}async parseErrorResponse(e){try{let t=await e.json(),s=t.detail||t.message||t.error||`HTTP ${e.status}`;return e.status===401||e.status===403?(await h.clearAuth(),this.createError("AUTH_REQUIRED",s,e.status)):e.status===402?this.createError("PAYMENT_REQUIRED",s,e.status):this.createError("API_ERROR",s,e.status)}catch{return e.status===401||e.status===403?(await h.clearAuth(),this.createError("AUTH_REQUIRED",`HTTP ${e.status}`,e.status)):this.createError("API_ERROR",`HTTP ${e.status}`,e.status)}}createError(e,t,s){return{code:e,message:t,status:s}}sleep(e){return new Promise(t=>setTimeout(t,e))}},b=new m,j=b;export{y as a,T as b,b as c,j as d};
8
+ import{a as p}from"./chunk-3FBCOCPD.mjs";import{c as d}from"./chunk-XDBJSJOT.mjs";import{a as l}from"./chunk-E66B27AL.mjs";var k={memories:"memories",tasks:"tasks",subtasks:"subtasks",ideas:"ideas",queue_tasks:"queue_tasks",custom_workflows:"custom_workflows",workflow_rules:"workflow_rules",archives:"archives",shipped_items:"shipped_items",shipped_features:"shipped_features",metrics_daily:"metrics_daily",work_cost_snapshots:"work_cost_snapshots",velocity_sprints:"velocity_sprints",analysis:"analysis",specs:"specs",memory:"memories",memory_entry:"memories",task:"tasks",paused_task:"tasks",subtask:"subtasks",idea:"ideas",queue:"queue_tasks",queue_task:"queue_tasks",shipped:"shipped_items",feature:"roadmap_features",workflow:"custom_workflows",workflow_rule:"workflow_rules",metric:"metrics_daily",work_cost_snapshot:"work_cost_snapshots",velocity:"velocity_sprints",spec:"specs",project:"projects",session:"sessions",agent:"agents"};function y(c){if(c)return k[c]}l(y,"toCloudTable");var w={memories:"memories",tasks:"tasks",subtasks:"tasks",queue_tasks:"tasks",ideas:"ideas",shipped_items:"shipped",shipped_features:"shipped",custom_workflows:"workflows",workflow_rules:"workflows",metrics_daily:"metrics",work_cost_snapshots:"metrics",velocity_sprints:"metrics",archives:"archives",analysis:"analysis",specs:"specs"},f={memories:!0,tasks:!0,ideas:!0,shipped:!0,workflows:!0,metrics:!0,archives:!0,user_prompts:!1,agent_sessions:!1,analysis:!0,specs:!0};function T(c,e){let t=w[c];return t?{...f,...e??{}}[t]!==!1:!0}l(T,"isTableIncluded");var v=Object.keys(f);function _(c){return c.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}l(_,"camelToSnake");function R(c){let e={};for(let[t,s]of Object.entries(c))e[_(t)]=s;return e}l(R,"snakeCaseKeys");function E(c,e){let[t,s]=e.type.split("."),r=y(e.entityType)??y(t);if(!r)return null;let i=e.eventType==="delete"||s==="deleted"||s==="archived"||s==="removed"?"delete":"upsert",n=e.data||{},a=R(n),h=e.entityId||(typeof a.id=="string"?a.id:"")||(typeof n.id=="string"?n.id:"")||(typeof a.task_id=="string"?a.task_id:"")||(typeof n.taskId=="string"?n.taskId:"")||(typeof a.entity_id=="string"?a.entity_id:"")||"";h&&a.id==null&&(a.id=h);let u={event_type:i,entity_type:r,entity_id:h,data:{...a,project_id:c},project_id:c};return e.originDeviceId!==void 0&&(u.origin_device_id=e.originDeviceId),e.contentHash!==void 0&&(u.content_hash=e.contentHash),e.revisionCount!==void 0&&(u.revision_count=e.revisionCount),e.timestamp&&(u.ts=e.timestamp),u}l(E,"mapCliEventToWebFormat");function g(c,e){return e.map(t=>E(c,t)).filter(t=>t!==null)}l(g,"mapCliEventsToWebFormat");var m=class{static{l(this,"SyncClient")}retryConfig={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4};async pushEvents(e,t){let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)throw this.createError("AUTH_REQUIRED","No API key configured");let i=g(e,t),n=await this.fetchWithRetry(`${s}/sync/batch`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify({projectId:e,events:i})});if(!n.ok)throw await this.parseErrorResponse(n);return await n.json()}async pullEvents(e,t,s){let{apiUrl:r,apiKey:o,deviceId:i}=await this.getAuthHeaders();if(!o)throw this.createError("AUTH_REQUIRED","No API key configured");let n={projectId:e};typeof t=="number"&&t>0&&(n.sinceEventId=t);let a=await this.fetchWithRetry(`${r}/sync/pull`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(o,i)},body:JSON.stringify(n)});if(!a.ok)throw await this.parseErrorResponse(a);return await a.json()}async getStatus(e){let{apiUrl:t,apiKey:s,deviceId:r}=await this.getAuthHeaders();if(!s)throw this.createError("AUTH_REQUIRED","No API key configured");let o=await this.fetchWithRetry(`${t}/sync/status/${e}`,{method:"GET",headers:{...this.authHeaders(s,r)}});if(!o.ok)throw await this.parseErrorResponse(o);return await o.json()}async linkProject(e,t,s){let{apiUrl:r,apiKey:o,deviceId:i}=await this.getAuthHeaders();if(!o)throw this.createError("AUTH_REQUIRED","No API key configured");let n=await this.fetchWithRetry(`${r}/sync/link`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(o,i)},body:JSON.stringify({projectId:e,...t?{name:t}:{},...s?{meta:s}:{}})});if(!n.ok)throw await this.parseErrorResponse(n);return await n.json()}async setCloudLifecycle(e,t){try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();return r?(await this.fetchWithRetry(`${s}/sync/projects/${e}/${t}`,{method:"POST",headers:{...this.authHeaders(r,o)}})).ok:!1}catch{return!1}}async uploadCodeGraph(e,t){try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)return{ok:!1,reason:"unauthenticated"};let i=await this.fetchWithRetry(`${s}/sync/projects/${e}/code-graph`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify(t)});if(!i.ok)return{ok:!1,reason:await(async()=>{let h=`${i.status} ${i.statusText}`;try{let u=await i.json();return typeof u.detail=="string"?u.detail:u.detail!=null?JSON.stringify(u.detail).slice(0,300):h}catch{return h}})()};let n=await i.json();return{ok:n.ok!==!1,nodes:n.nodes,links:n.links}}catch(s){return{ok:!1,reason:s instanceof Error?s.message:String(s)}}}async publishBenchmark(e,t){let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)throw this.createError("AUTH_REQUIRED","No API key configured");let i=await this.fetchWithRetry(`${s}/benchmarks/evals`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify({projectId:e,...t})});if(!i.ok)throw await this.parseErrorResponse(i);return await i.json()}async testConnection(){let e=new AbortController,t=setTimeout(()=>e.abort(),p("API_REQUEST"));try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)return clearTimeout(t),!1;let i=await fetch(`${s}/auth/verify`,{method:"GET",headers:{...this.authHeaders(r,o)},signal:e.signal});return clearTimeout(t),i.status===401||i.status===403?(await d.clearAuth(),!1):i.ok}catch{return clearTimeout(t),!1}}async hasAuth(){return await d.hasAuth()}async getAuthHeaders(){let[e,t,s]=await Promise.all([d.getApiUrl(),d.getApiKey(),d.getDeviceId()]);return{apiUrl:e,apiKey:t,deviceId:s}}authHeaders(e,t){return{"X-Api-Key":e,"X-Device-Id":t}}async fetchWithRetry(e,t,s=0){let r=new AbortController,o=setTimeout(()=>r.abort(),p("API_REQUEST")),i=(t.method??"GET").toUpperCase(),n=i==="GET"||i==="HEAD";try{let a=await fetch(e,{...t,signal:r.signal});return clearTimeout(o),n&&a.status>=500&&s<this.retryConfig.maxRetries?this.scheduleRetry(e,t,s):a}catch(a){if(clearTimeout(o),a instanceof Error&&a.name==="AbortError")throw this.createError("NETWORK_ERROR",`Request timed out. Try increasing PRJCT_TIMEOUT_API_REQUEST (current: ${p("API_REQUEST")}ms)`);if(n&&s<this.retryConfig.maxRetries)return this.scheduleRetry(e,t,s);throw this.createError("NETWORK_ERROR",a instanceof Error?a.message:"Network request failed")}}async scheduleRetry(e,t,s){let r=Math.min(this.retryConfig.baseDelayMs*2**s,this.retryConfig.maxDelayMs);return await this.sleep(r),this.fetchWithRetry(e,t,s+1)}async parseErrorResponse(e){try{let t=await e.json(),s=t.detail||t.message||t.error||`HTTP ${e.status}`;return e.status===401||e.status===403?(await d.clearAuth(),this.createError("AUTH_REQUIRED",s,e.status)):e.status===402?this.createError("PAYMENT_REQUIRED",s,e.status):this.createError("API_ERROR",s,e.status)}catch{return e.status===401||e.status===403?(await d.clearAuth(),this.createError("AUTH_REQUIRED",`HTTP ${e.status}`,e.status)):this.createError("API_ERROR",`HTTP ${e.status}`,e.status)}}createError(e,t,s){return{code:e,message:t,status:s}}sleep(e){return new Promise(t=>setTimeout(t,e))}},b=new m,D=b;export{y as a,T as b,b as c,D as d};
@@ -0,0 +1,19 @@
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 j,b as f,d as x,e as I}from"./chunk-BU22R6JX.mjs";import{a as D}from"./chunk-JR542RI2.mjs";import{b as v}from"./chunk-IGHY4FGS.mjs";import{g as C,h as M,i as w,j as E,o as R}from"./chunk-22AXWLI6.mjs";import{a as b}from"./chunk-V2FR2NPL.mjs";import{a as S,b as K,d as m,g as U}from"./chunk-UHVYBU7F.mjs";import{a as c}from"./chunk-E66B27AL.mjs";K();import g from"node:fs/promises";import d from"node:path";U();var q=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default)$/i;function L(t){let e=M(t);if(!C(t))return{ready:!1,builtAt:e?.builtAt??null,symbols:0,edges:0,files:0,languages:[],kinds:[],routes:[],hotspots:[],entryCandidates:[],packages:[],note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let o=w(t),n=new Map,r=new Map,a=new Map,u=[],p=[];for(let i of o){n.set(i.kind,(n.get(i.kind)??0)+1),r.set(i.file,(r.get(i.file)??0)+1);let l=i.file.includes(".")?i.file.slice(i.file.lastIndexOf(".")):"(none)";a.set(l,(a.get(l)??0)+1),i.kind==="route"&&u.push({name:i.name,file:i.file,line:i.startLine}),i.exported&&q.test(i.name)&&(i.kind==="function"||i.kind==="class")&&!/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(i.file)&&p.push({name:i.name,file:i.file,kind:i.kind})}let y=[...r.keys()],h=[],Y=R(t),J=y.length>400?y.slice(0,400):y;for(let i of J){let l=Y.get(i)??0;l>0&&h.push({file:i,fanIn:l,symbolCount:r.get(i)??0})}h.sort((i,l)=>l.fanIn-i.fanIn);let k=new Set,A=v(t);if(A)for(let i of Object.keys(A.forward).slice(0,2e3)){let l=i.includes("/")?i.slice(0,i.indexOf("/")):i;l&&!l.startsWith(".")&&k.add(l)}for(let i of y.slice(0,2e3)){let l=i.includes("/")?i.slice(0,i.indexOf("/")):".";l&&l!=="."&&k.add(l)}if(p.length<8)for(let i of o){if(p.length>=12)break;i.exported&&i.kind==="class"&&!p.some(l=>l.file===i.file)&&p.push({name:i.name,file:i.file,kind:i.kind})}return{ready:!0,builtAt:e?.builtAt??null,symbols:e?.symbolCount??o.length,edges:e?.edgeCount??0,files:e?.fileCount??r.size,languages:[...a.entries()].map(([i,l])=>({ext:i,count:l})).sort((i,l)=>l.count-i.count).slice(0,12),kinds:[...n.entries()].map(([i,l])=>({kind:i,count:l})).sort((i,l)=>l.count-i.count),routes:u.slice(0,30),hotspots:h.slice(0,15),entryCandidates:p.slice(0,15),packages:[...k].sort().slice(0,40),note:"Structural only (symbol + import graphs). Narrative architecture lives in prjct analysis / memory decisions."}}c(L,"buildArchitectureSnapshot");function O(t,e){let s=[];if(!t)return{hasChanges:!0,items:[{field:"Project style",type:"added",after:e.summary}],summary:{added:1,removed:0,changed:0},beforeCommit:null,afterCommit:e.commitHash};let o=t.payload,n=e.payload;return o.stack.ecosystem!==n.stack.ecosystem&&s.push({field:"Ecosystem",type:"changed",before:o.stack.ecosystem,after:n.stack.ecosystem}),(o.stack.packageManager??"")!==(n.stack.packageManager??"")&&s.push({field:"Package manager",type:"changed",before:o.stack.packageManager??"(none)",after:n.stack.packageManager??"(none)"}),P("Languages",o.stack.languages,n.stack.languages,s),P("Frameworks",o.stack.frameworks,n.stack.frameworks,s),P("Key libraries",o.stack.keyLibraries,n.stack.keyLibraries,s),o.stack.hasTests!==n.stack.hasTests&&s.push({field:"Has tests",type:"changed",before:String(o.stack.hasTests),after:String(n.stack.hasTests)}),_("Pattern",o.patterns.map(r=>[r.key,r.name]),n.patterns.map(r=>[r.key,r.name]),s),_("Anti-pattern",o.antiPatterns.map(r=>[r.key,r.issue]),n.antiPatterns.map(r=>[r.key,r.issue]),s),_("Convention",o.conventions.map(r=>[r.key,r.rule]),n.conventions.map(r=>[r.key,r.rule]),s),o.structural.symbols!==n.structural.symbols&&(o.structural.symbols>0||n.structural.symbols>0)&&s.push({field:"Symbols",type:"changed",before:String(o.structural.symbols),after:String(n.structural.symbols)}),o.structural.files!==n.structural.files&&s.push({field:"Files",type:"changed",before:String(o.structural.files),after:String(n.structural.files)}),D(s,t.commitHash,e.commitHash)}c(O,"generateProjectStyleDiff");function F(t){if(!t.hasChanges)return`## Project evolution
9
+
10
+ No style changes since last sync.`;let e=["## Project evolution (this sync)"];(t.beforeCommit||t.afterCommit)&&e.push(`> \`${T(t.beforeCommit)}\` \u2192 \`${T(t.afterCommit)}\``),e.push(""),e.push(`+${t.summary.added} \xB7 \u2212${t.summary.removed} \xB7 ~${t.summary.changed}`),e.push("");for(let s of t.items.slice(0,20)){let o=s.type==="added"?"+":s.type==="removed"?"\u2212":"~";s.type==="changed"?e.push(`- ${o} **${s.field}**: ${s.before} \u2192 ${s.after}`):s.type==="added"?e.push(`- ${o} **${s.field}**: ${s.after}`):e.push(`- ${o} **${s.field}**: ${s.before}`)}return e.join(`
11
+ `)}c(F,"formatProjectStyleDiffMd");function T(t){return t?t.length>7?t.slice(0,7):t:"(none)"}c(T,"short");function P(t,e,s,o){let n=new Set(e.map(a=>a.toLowerCase())),r=new Set(s.map(a=>a.toLowerCase()));for(let a of s)n.has(a.toLowerCase())||o.push({field:t,type:"added",after:a});for(let a of e)r.has(a.toLowerCase())||o.push({field:t,type:"removed",before:a})}c(P,"diffStringArray");function _(t,e,s,o){let n=new Map(e),r=new Map(s);for(let[a,u]of r)n.has(a)?n.get(a)!==u&&o.push({field:t,type:"changed",before:n.get(a),after:u}):o.push({field:t,type:"added",after:u});for(let[a,u]of n)r.has(a)||o.push({field:t,type:"removed",before:u})}c(_,"diffKeyed");var H=50;function W(t){let e=(()=>{try{return JSON.parse(t.payload_json)}catch{return z()}})();return{id:t.id,capturedAt:t.captured_at,commitHash:t.commit_hash,source:t.source||"sync-mechanical",patternCount:t.pattern_count,antiPatternCount:t.anti_pattern_count,conventionCount:t.convention_count,frameworkCount:t.framework_count,symbolCount:t.symbol_count,fileCount:t.file_count,summary:t.summary,payload:e}}c(W,"rowToSnapshot");function z(){return{payloadVersion:1,stack:{ecosystem:"unknown",languages:[],frameworks:[],keyLibraries:[],hasTests:!1,hasDocker:!1},commands:{},conventions:[],patterns:[],antiPatterns:[],structural:{symbols:0,files:0,packages:[]},metrics:{}}}c(z,"emptyPayload");function N(t){try{let e=m.get(t,"SELECT * FROM project_style_snapshots WHERE is_active = 1 ORDER BY captured_at DESC LIMIT 1");return e?W(e):null}catch{return null}}c(N,"getActiveProjectStyle");function G(t,e=12){try{return m.query(t,"SELECT * FROM project_style_snapshots ORDER BY captured_at DESC LIMIT ?",e).map(W)}catch{return[]}}c(G,"getProjectEvolution");function jt(t,e=6){let s=G(t,e);if(s.length===0)return null;let o=["## Project evolution"];if(s.length>=2){let n=s[0],r=s[s.length-1],a=n.patternCount-r.patternCount,u=n.conventionCount-r.conventionCount,p=n.fileCount-r.fileCount;o.push(`Over ${s.length} snapshots: patterns ${$(a)}, conventions ${$(u)}, files ${$(p)}.`)}for(let n of s)o.push(`- ${n.capturedAt.slice(0,10)} \u2014 ${n.summary}`);return o.join(`
12
+ `)}c(jt,"renderProjectEvolution");function $(t){return t>=0?`+${t}`:`${t}`}c($,"fmtDelta");function V(t,e){m.transaction(t,s=>{s.prepare("UPDATE project_style_snapshots SET is_active = 0 WHERE is_active = 1").run(),s.prepare(`INSERT INTO project_style_snapshots (
13
+ id, captured_at, commit_hash, source,
14
+ pattern_count, anti_pattern_count, convention_count, framework_count,
15
+ symbol_count, file_count, summary, payload_json, is_active
16
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)`).run(e.id,e.capturedAt,e.commitHash,e.source,e.patternCount,e.antiPatternCount,e.conventionCount,e.frameworkCount,e.symbolCount,e.fileCount,e.summary,JSON.stringify(e.payload));let o=s.prepare("SELECT id FROM project_style_snapshots ORDER BY captured_at DESC").all();if(o.length>H){let n=o.slice(H),r=s.prepare("DELETE FROM project_style_snapshots WHERE id = ?");for(let a of n)r.run(a.id)}})}c(V,"persistProjectStyleSnapshot");async function Pt(t){let e=N(t.projectId),s=X(t.projectId),o=await et(t.projectPath),n=Z(t.projectId),r=tt(t.projectId),a=x({stats:t.stats,stack:t.stack,commands:t.commands,packageDeps:o.deps,packageManager:o.packageManager,llmAnalysis:s,memoryPatterns:r.patterns,memoryAntiPatterns:r.antiPatterns,memoryConventions:r.conventions,structural:n,commitHash:t.commitHash??null,source:t.source??"sync-mechanical"});a.payload.metrics.styleCoverage=Q(a),a.payload.metrics.hasRichAnalysis=f(s)?1:0;let u=O(e,a),p=e===null;(p||u.hasChanges)&&V(t.projectId,a);let y=N(t.projectId)??a;return t.bridgeMemory!==!1&&await st(t.projectPath,t.projectId,y).catch(()=>{}),await rt(t.projectId,y).catch(()=>{}),{snapshot:y,delta:u,isFirst:p}}c(Pt,"recomputeProjectStyle");function Q(t){let e=(t.payload.stack.ecosystem!=="unknown"?25:0)+(t.payload.stack.frameworks.length>0||t.payload.stack.keyLibraries.length>0?20:0)+(t.payload.stack.hasTests?10:0)+Math.min(25,t.conventionCount*5)+Math.min(15,t.patternCount*3)+Math.min(5,t.antiPatternCount);return Math.min(100,e)}c(Q,"computeStyleCoverage");function X(t){try{let e=j.getActive(t);if(f(e))return e;try{let s=j.getAllFull(t);for(let o of s)if(f(o.analysis))return o.analysis}catch{}return e}catch{return null}}c(X,"pickBestAnalysis");function Z(t){try{let e=L(t);return e.ready?{symbols:e.symbols,files:e.files,packages:e.packages.slice(0,20)}:{symbols:0,files:0,packages:[]}}catch{return{symbols:0,files:0,packages:[]}}}c(Z,"loadStructural");function tt(t){let e=[],s=[],o=[];try{let n=b.recall(t,{types:["pattern","anti-pattern","decision"],limit:40});for(let r of n){let a=r.tags?.topic??"";!a.startsWith("style:")&&r.type!=="pattern"&&r.type!=="anti-pattern"||(r.type==="pattern"||a.startsWith("style:pattern:")?e.push({name:r.tags?.name||a.replace(/^style:pattern:/,"")||"pattern",description:r.content.slice(0,400)}):r.type==="anti-pattern"||a.startsWith("style:anti:")?s.push({issue:r.tags?.name||a.replace(/^style:anti:/,"")||"anti-pattern",suggestion:r.content.slice(0,400)}):a.startsWith("style:convention:")&&o.push({rule:r.content.slice(0,400),category:r.tags?.category}))}}catch{}return{patterns:e,antiPatterns:s,conventions:o}}c(tt,"loadMemoryStyle");async function et(t){try{let e=await g.readFile(d.join(t,"package.json"),"utf-8"),s=JSON.parse(e),o={...s.dependencies??{},...s.devDependencies??{}},n=s.packageManager?s.packageManager.split("@")[0]??null:await(async()=>{let r=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];for(let[a,u]of r)try{return await g.access(d.join(t,a)),u}catch{}return null})();return{deps:o,packageManager:n}}catch{return{deps:{},packageManager:null}}}c(et,"readPackageMeta");function nt(t){let e=t.payload,s=[...e.conventions.slice(0,25).map(n=>({type:"decision",content:n.rule,tags:{topic:`style:convention:${n.key}`,category:n.category??"convention",source:"project-style"}})),...e.patterns.slice(0,25).map(n=>({type:"pattern",content:`${n.name}: ${n.description}`,tags:{topic:`style:pattern:${n.key}`,name:n.name,source:"project-style",...n.category?{category:n.category}:{}}})),...e.antiPatterns.slice(0,25).map(n=>({type:"anti-pattern",content:`${n.issue}. Suggestion: ${n.suggestion}`,tags:{topic:`style:anti:${n.key}`,name:n.issue,source:"project-style",...n.severity?{severity:n.severity}:{}}}))],o=new Set;return s.filter(n=>{let r=`${n.type}\0${S(n.content)}`;return o.has(r)?!1:(o.add(r),!0)})}c(nt,"desiredStyleBridgeEntries");function B(t,e,s){return`${t}\0${e}\0${s}`}c(B,"styleBridgeIdentity");async function st(t,e,s){let o=nt(s);if(o.length===0)return 0;let n=(()=>{try{let a=[...new Set(o.map(y=>y.tags.topic))],u=a.map(()=>"?").join(","),p=m.query(e,`SELECT type, topic_key, content_hash
17
+ FROM memory_entries
18
+ WHERE project_id = ? AND deleted_at IS NULL
19
+ AND topic_key IN (${u})`,e,...a);return new Set(p.map(y=>B(y.type,y.topic_key,y.content_hash)))}catch{return null}})(),r=[];for(let a of o){let u=a.tags.topic,p=B(a.type,u,S(a.content));n?.has(p)||(await b.remember(t,{...a,projectId:e,provenance:"extracted"}),r.push(a))}return r.length}c(st,"bridgeStyleToMemory");async function rt(t,e){let{default:s}=await import("./path-manager-375HH6TB.mjs"),o=s.getGlobalProjectPath(t),n=d.join(o,"analysis");await g.mkdir(n,{recursive:!0});let r=e.payload.stack,a={ecosystem:r.ecosystem,frameworks:r.frameworks,hasTests:r.hasTests,technologies:[...r.languages,...r.frameworks,...r.keyLibraries].filter((u,p,y)=>y.indexOf(u)===p),packageManager:r.packageManager??null,updatedAt:e.capturedAt,styleSummary:e.summary};await g.writeFile(d.join(n,"repo-analysis.json"),JSON.stringify(a,null,2),"utf-8")}c(rt,"writeRepoAnalysisArtifact");function _t(t){let e=t.delta.hasChanges||t.isFirst?F(t.delta):null,s=I(t.snapshot,{maxConventions:4,maxPatterns:3,maxAnti:2});return{evolutionMd:e,digestMd:s,delta:t.delta}}c(_t,"formatProjectStyleForSync");export{N as a,G as b,jt as c,V as d,Pt as e,st as f,_t as g};
@@ -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{b as n,f as p}from"./chunk-HDSS6UB3.mjs";p();import{z as e}from"zod";var c=e.enum(["low","medium","high","critical"]),t=e.enum(["feature","bug","improvement","chore"]),u=e.enum(["active","backlog","previously_active"]),l=e.enum(["H0","H1","H2","H3"]),m=e.enum(["bug","feature","refactor","docs","chore","security","research","unknown"]),d=e.enum(["low","medium","high"]),g=e.enum(["regression-test","focused-tests","docs-if-public-behavior","config-preservation","spec-or-design","edge-cases","scope-check"]),k=e.enum(["verify-before-done","scope-check","review-before-ship","spec-before-implementation"]),y=e.enum(["pending","in_progress","completed","blocked","paused","failed","skipped"]),o=e.object({title:e.string(),description:e.string(),filesChanged:e.array(e.object({path:e.string(),action:e.enum(["created","modified","deleted"])})),whatWasDone:e.array(e.string()).min(1),outputForNextAgent:e.string().min(1),notes:e.string().optional()}),I=e.object({output:e.string().min(1,"Subtask output is required"),summary:o}),S=e.object({id:e.string(),description:e.string(),domain:e.string(),agent:e.string(),status:y,dependsOn:e.array(e.string()),startedAt:e.string().optional(),completedAt:e.string().optional(),output:e.string().optional(),summary:o.optional(),skipReason:e.string().optional(),blockReason:e.string().optional(),estimatedPoints:e.number().optional(),estimatedMinutes:e.number().optional()}),f=e.object({completed:e.number(),total:e.number(),percentage:e.number()}),s=e.object({level:l,kind:m,risk:d,expectedEvidence:e.array(g),scopeHints:e.array(e.string()),gates:e.array(k),rationale:e.string(),createdAt:e.string()}),r=e.object({featureId:e.string().optional(),subtasks:e.array(S).optional(),currentSubtaskIndex:e.number().optional(),subtaskProgress:f.optional(),linearId:e.string().optional(),linearUuid:e.string().optional(),estimatedPoints:e.number().optional(),estimatedMinutes:e.number().optional(),modelMetadata:n.optional(),tokensIn:e.number().optional(),tokensOut:e.number().optional(),harness:s.optional()}),i=r.extend({id:e.string(),description:e.string(),type:t.optional(),startedAt:e.string(),sessionId:e.string(),linkedSpecId:e.string().optional(),parentDescription:e.string().optional(),branch:e.string().optional(),prUrl:e.string().optional(),turnCount:e.number().optional(),turnLimitAcknowledgedAt:e.string().optional(),ownerAgent:e.string().optional(),ownerIdentity:e.string().optional(),ownerSessionId:e.string().optional(),yieldStatus:e.enum(["active","yielded"]).optional(),pendingHandoffId:e.string().optional()}),a=r.extend({id:e.string(),description:e.string(),status:e.literal("paused"),startedAt:e.string(),pausedAt:e.string(),pauseReason:e.string().optional(),type:t.optional(),sessionId:e.string().optional()}),h=e.object({stackConfirmed:e.array(e.string()).optional(),patternsDiscovered:e.array(e.string()).optional(),agentAccuracy:e.array(e.object({agent:e.string(),rating:e.enum(["helpful","neutral","inaccurate"]),note:e.string().optional()})).optional(),issuesEncountered:e.array(e.string()).optional()}),b=e.object({taskId:e.string(),title:e.string(),classification:t,startedAt:e.string(),completedAt:e.string(),subtaskCount:e.number(),subtaskSummaries:e.array(o),outcome:e.string(),branchName:e.string(),linearId:e.string().optional(),linearUuid:e.string().optional(),prUrl:e.string().optional(),feedback:h.optional(),harness:s.optional(),tokensIn:e.number().optional(),tokensOut:e.number().optional()}),x=i.extend({workspaceId:e.string(),worktreePath:e.string().optional(),agentSessionId:e.string().optional(),jiraId:e.string().optional(),jiraUuid:e.string().optional(),dispatchedFrom:e.string().optional()}),j=e.object({currentTask:i.nullable(),previousTask:a.nullable().optional(),pausedTasks:e.array(a).optional(),taskHistory:e.array(b).optional(),activeTasks:e.array(x).optional(),lastUpdated:e.string()}),T=e.object({id:e.string(),description:e.string(),body:e.string().optional(),priority:c,type:t,featureId:e.string().optional(),originFeature:e.string().optional(),completed:e.boolean(),completedAt:e.string().optional(),createdAt:e.string(),section:u,agent:e.string().optional(),groupName:e.string().optional(),groupId:e.string().optional()}),A=e.object({tasks:e.array(T),lastUpdated:e.string()});export{I as a,j as b,A as c};
@@ -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{c as l}from"./chunk-L4COZ7ZH.mjs";import{c as u}from"./chunk-SOPRYWUY.mjs";import{a as s,c}from"./chunk-V37VTXDW.mjs";import{b as i}from"./chunk-JRKGG2E3.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function g(n){let e=n.tool_input??n.toolInput;return e&&typeof e.command=="string"?e.command:typeof n.command=="string"?n.command:e&&typeof e.command_line=="string"?e.command_line:""}o(g,"extractCommand");function k(n){return n?n.sdd?.mode==="strict"||n.tdd?.mode==="strict"||n.deliveryGeometry?.mode==="strict":!1}o(k,"isStrictPackageMode");async function m(n,e){let a=s(g(e));if(!a)return null;let t=await c(n),r=u(a.packages,t);if(r.allow)return null;let d=await i.readConfig(n).catch(()=>null);return{strict:k(d),message:r.decision?.message??r.denyMessage}}o(m,"evaluatePrePackageInput");function w(n=process.cwd(),e){return l({event:"PreToolUse",projectPath:n,decide:o(async a=>{try{let t=await m(n,a);return t?.strict?{deny:t.message}:null}catch{return null}},"decide"),build:o(async a=>{try{let t=await m(n,a);return!t||t.strict?null:`# prjct: package legitimacy (advisory)
8
+ import{a as l}from"./chunk-GPZP7NXL.mjs";import{c as u}from"./chunk-XS45K7ZQ.mjs";import{a as s,c}from"./chunk-4KVPAHFV.mjs";import{b as i}from"./chunk-PO3QDKTE.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function g(n){let e=n.tool_input??n.toolInput;return e&&typeof e.command=="string"?e.command:typeof n.command=="string"?n.command:e&&typeof e.command_line=="string"?e.command_line:""}o(g,"extractCommand");function k(n){return n?n.sdd?.mode==="strict"||n.tdd?.mode==="strict"||n.deliveryGeometry?.mode==="strict":!1}o(k,"isStrictPackageMode");async function m(n,e){let a=s(g(e));if(!a)return null;let t=await c(n),r=u(a.packages,t);if(r.allow)return null;let d=await i.readConfig(n).catch(()=>null);return{strict:k(d),message:r.decision?.message??r.denyMessage}}o(m,"evaluatePrePackageInput");function w(n=process.cwd(),e){return l({event:"PreToolUse",projectPath:n,decide:o(async a=>{try{let t=await m(n,a);return t?.strict?{deny:t.message}:null}catch{return null}},"decide"),build:o(async a=>{try{let t=await m(n,a);return!t||t.strict?null:`# prjct: package legitimacy (advisory)
9
9
  ${t.message}`}catch{return null}},"build")},e)}o(w,"runPrePackageHook");export{m as a,w as b};
@@ -5,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 e,o as s}from"./chunk-CTWZQ7YI.mjs";import{a as i}from"./chunk-E66B27AL.mjs";s();function p(t){let n=t?.notify?.mode;if(n==="on"||n==="off")return n;let o=process.env.PRJCT_NOTIFY_MODE?.toLowerCase();return o==="on"||o==="off"?o:"on"}i(p,"effectiveNotifyMode");function f(t){return t.replace(/["\\]/g,"").replace(/[\r\n]+/g," ").trim().slice(0,180)}i(f,"sanitize");async function a(t,n){try{let o=f(t)||"prjct",r=f(n);process.platform==="darwin"?await e("osascript",["-e",`display notification "${r}" with title "${o}"`]):process.platform==="linux"&&await e("notify-send",[o,r])}catch{}}i(a,"notifyDesktop");export{p as a,a as b};
8
+ import{b as e,p as s}from"./chunk-QWQFF2UG.mjs";import{a as i}from"./chunk-E66B27AL.mjs";s();function p(t){let n=t?.notify?.mode;if(n==="on"||n==="off")return n;let o=process.env.PRJCT_NOTIFY_MODE?.toLowerCase();return o==="on"||o==="off"?o:"on"}i(p,"effectiveNotifyMode");function f(t){return t.replace(/["\\]/g,"").replace(/[\r\n]+/g," ").trim().slice(0,180)}i(f,"sanitize");async function a(t,n){try{let o=f(t)||"prjct",r=f(n);process.platform==="darwin"?await e("osascript",["-e",`display notification "${r}" with title "${o}"`]):process.platform==="linux"&&await e("notify-send",[o,r])}catch{}}i(a,"notifyDesktop");export{p as a,a as b};
@@ -0,0 +1,47 @@
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 q}from"./chunk-QP5USCDX.mjs";import{e as p,g as P}from"./chunk-UHVYBU7F.mjs";import{d as H,e as g,f as B,h as Q}from"./chunk-A6K4H3YT.mjs";import{a as c}from"./chunk-E66B27AL.mjs";P();P();function l(t,s,...e){try{return Number(p.get(t,s,...e)?.value??0)}catch{return 0}}c(l,"count");function E(t,s,...e){try{return p.query(t,s,...e)}catch{return[]}}c(E,"query");Q();var j="memory.task_tokens",_=1e7;function pt(t,s,e,r,n){if(!s||e+r<=0)return;let i=5e7;if(e>i||r>i)return;let a=e>_||r>_,u=Math.min(Math.round(e),_),d=Math.min(Math.round(r),_);a&&(n={...n,isEstimated:!0});try{p.appendEvent(t,j,{taskId:s,tokensIn:u,tokensOut:d,...n?.description?{description:n.description}:{},...n?.agent?{agent:n.agent}:{},...n?.model?{model:n.model}:{},...n?.runtime?{runtime:n.runtime}:{},...n?.isEstimated!==void 0?{isEstimated:n.isEstimated}:{},...n?.source?{source:n.source}:{}},s)}catch{}if(u>=0&&u<=_&&d>=0&&d<=_)try{p.run(t,"UPDATE tasks SET tokens_in = ?, tokens_out = ? WHERE id = ?",u,d,s)}catch{}try{let C=n?.source??"cli",S=`${s}:${C}`,h=Date.now();p.run(t,`INSERT INTO token_usage
9
+ (id, work_cycle_id, event_key, source, is_estimated, input_tokens, output_tokens, model_id, description, measured_at, created_at)
10
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
11
+ ON CONFLICT(event_key) DO UPDATE SET
12
+ input_tokens = excluded.input_tokens,
13
+ output_tokens = excluded.output_tokens,
14
+ is_estimated = excluded.is_estimated,
15
+ model_id = excluded.model_id,
16
+ description = COALESCE(excluded.description, token_usage.description),
17
+ measured_at = excluded.measured_at`,S,s,S,C,n?.isEstimated?1:0,u,d,n?.model??null,n?.description??null,h,h)}catch{}}c(pt,"recordTaskTokenUsage");function I(t,s){let e=Date.parse(s),r=E(t,`SELECT work_cycle_id, input_tokens, output_tokens, is_estimated, description
18
+ FROM token_usage
19
+ WHERE measured_at >= ?
20
+ ORDER BY measured_at DESC`,Number.isFinite(e)?e:0),n=new Map;for(let i of r){let a=i.work_cycle_id;if(!a||n.has(a))continue;let u=g(i.input_tokens)??0,d=g(i.output_tokens)??0;u+d<=0||n.set(a,{id:a,description:i.description??a,status:i.is_estimated?"estimated":"measured",tokensIn:u,tokensOut:d,tokensTotal:u+d,minutes:null})}return n}c(I,"measuredCyclesFromTokenUsage");function tt(t,s){let e=H(s),r=new Date().toISOString(),n=E(t,`SELECT id, description, status, started_at, completed_at, shipped_at, tokens_in, tokens_out
21
+ FROM tasks
22
+ WHERE COALESCE(completed_at, shipped_at, started_at) >= ?
23
+ ORDER BY COALESCE(completed_at, shipped_at, started_at) DESC`,e),i=new Map;for(let o of n.map(nt))o&&i.set(o.id,o);for(let[o,m]of I(t,e)){let b=i.get(o);i.set(o,{...m,description:b?.description??m.description,minutes:b?.minutes??m.minutes})}let a=[...i.values()].sort((o,m)=>m.tokensTotal-o.tokensTotal),u=T(t,"memory.task_started",e),d=T(t,"memory.status.changed",e),R=T(t,"memory.feature_shipped",e),C=T(t,"sync",e),S=l(t,"SELECT COUNT(*) AS value FROM events WHERE type >= ? AND type < ? AND timestamp >= ?","memory.","memory/",e),h=T(t,"memory.post_edit",e),Y=l(t,"SELECT COUNT(*) AS value FROM agent_sessions WHERE started_at >= ?",e),$=(()=>{try{return l(t,"SELECT COUNT(*) AS value FROM cli_sessions WHERE created_at >= ?",e)}catch{return 0}})(),A=Y+$,w=l(t,"SELECT COUNT(DISTINCT memory_id) AS value FROM memory_surface_log WHERE created_at >= ?",e),z=l(t,`SELECT COUNT(DISTINCT s.memory_id) AS value
24
+ FROM memory_surface_log s
25
+ INNER JOIN memory_usefulness u ON u.memory_id = s.memory_id
26
+ WHERE s.created_at >= ?
27
+ AND u.score > 0`,e),J=(()=>{try{return l(t,`SELECT COUNT(DISTINCT t.id) AS value
28
+ FROM tasks t
29
+ INNER JOIN agent_sessions a ON a.task_id = t.id
30
+ WHERE (t.completed_at IS NOT NULL OR t.shipped_at IS NOT NULL)
31
+ AND COALESCE(t.completed_at, t.shipped_at, t.started_at) >= ?`,e)}catch{return 0}})(),V=l(t,"SELECT COUNT(*) AS value FROM context_zone_events WHERE timestamp >= ?",e),G=l(t,"SELECT COUNT(*) AS value FROM context_compactions WHERE timestamp >= ?",e),D=K(t,"command_duration",e),x=K(t,"startup_time",e),N=st(t,e),W=a.reduce((o,m)=>o+m.tokensIn,0),L=a.reduce((o,m)=>o+m.tokensOut,0),f=Math.max(n.length,u,R),y=n.filter(o=>o.completed_at||o.shipped_at),v=new Set(I(t,e).keys()),X=(()=>{try{return new Set(p.query(t,`SELECT DISTINCT task_id AS task_id FROM agent_sessions
32
+ WHERE task_id IS NOT NULL AND started_at >= ?`,e).map(o=>o.task_id).filter(Boolean))}catch{return new Set}})(),O=y.filter(o=>{let m=Number(o.tokens_in??0),b=Number(o.tokens_out??0);return m+b>0||v.has(o.id)}).length,U=y.filter(o=>Number(o.tokens_in??0)+Number(o.tokens_out??0)>0||v.has(o.id)||X.has(o.id)).length,M=U>0?U:y.length>0?y.length:n.length>0?n.length:f,F=Math.max(O,a.length),k=[];f===0?k.push("No work cycles were found in tasks or historical events for this window."):n.length===0&&k.push("Work history was rescued from events, but normalized task rows are missing."),M>0&&O===0&&F===0&&k.push("Work cycles exist, but none have exact token totals. Capture exact or estimated usage at task close."),A===0&&k.push("No agent sessions were recorded. Session-level model/runtime/cost cannot be attributed yet."),w===0&&k.push("No surfaced context was logged in this window, so reuse and re-exploration waste cannot be proven.");let Z=(()=>{try{return p.query(t,`SELECT COALESCE(model_id, 'unknown') AS model,
33
+ SUM(input_tokens) AS t_in, SUM(output_tokens) AS t_out
34
+ FROM token_usage
35
+ WHERE model_id IS NOT NULL AND measured_at >= ?
36
+ GROUP BY COALESCE(model_id, 'unknown')
37
+ ORDER BY t_in + t_out DESC`,Date.parse(e)).map(o=>({model:o.model,tokensIn:o.t_in,tokensOut:o.t_out}))}catch{return[]}})();return{id:`work-cost-${s}d`,windowDays:s,generatedAt:r,workCycles:n.length>0?n.length:f,knownTokenCycles:F,tokensIn:W,tokensOut:L,tokensTotal:W+L,tokenCoveragePercent:M===0?0:Math.min(100,Math.round(Math.max(O,a.filter(o=>v.has(o.id)||o.tokensTotal>0).length)/M*100)),measuredSessions:Math.max(A,J),surfacedContext:w,usefulContext:z,contextZoneEvents:V,compactions:G,commandSamples:D.samples,commandMs:Math.round(D.total??0),avgStartupMs:x.average===null?null:Math.round(x.average),mostExpensive:a.slice(0,8),byModel:Z,historicalRescue:{inferredWorkCycles:f,taskTableCycles:n.length,eventWorkStarts:u,eventStatusChanges:d,eventShips:R,syncRuns:C,memoryEvents:S,postEditEvents:h,declaredTokenMentions:N.length,declaredTokensTotal:N.reduce((o,m)=>o+m.tokens,0),topDeclaredTokenMentions:N.slice(0,5)},gaps:k}}c(tt,"buildWorkCostSnapshot");async function kt(t,s=[7,30,90]){let e=s.map(r=>tt(t,r));for(let r of e)await q({projectId:t,entityType:"work_cost_snapshots",entityId:r.id,eventType:"upsert",data:et(r)});return e}c(kt,"publishWorkCostSnapshots");function et(t){return{...t,mostExpensive:t.mostExpensive.map(s=>({...s,description:"[redacted]"})),historicalRescue:{...t.historicalRescue,topDeclaredTokenMentions:t.historicalRescue.topDeclaredTokenMentions.map(s=>({tokens:s.tokens,sourceType:s.sourceType,occurredAt:s.occurredAt,summary:"[redacted]"}))}}}c(et,"redactSnapshotForCloud");function nt(t){let s=g(t.tokens_in)??0,e=g(t.tokens_out)??0,r=s+e;return r<=0?null:{id:t.id,description:t.description,status:t.status,tokensIn:s,tokensOut:e,tokensTotal:r,minutes:B(t.started_at,t.completed_at??t.shipped_at)}}c(nt,"toCostTask");function st(t,s){let e=E(t,`SELECT type, data, timestamp
38
+ FROM events
39
+ WHERE timestamp >= ?
40
+ AND type >= ?
41
+ AND type < ?
42
+ AND json_valid(data)
43
+ AND json_extract(data, '$.content') LIKE '%token%'
44
+ ORDER BY timestamp DESC
45
+ LIMIT 200`,s,"memory.remember.","memory.remember/"),r=[];for(let n of e){let i=(()=>{try{let u=JSON.parse(n.data);return typeof u.content=="string"?u.content:""}catch{return""}})();if(!i)continue;let a=ot(i);for(let u of a)r.push({tokens:u,sourceType:n.type,occurredAt:n.timestamp,summary:rt(i)})}return r.sort((n,i)=>i.tokens-n.tokens)}c(st,"declaredTokenMentions");function ot(t){let s=[],e=/\b(\d+(?:\.\d+)?)\s*([kKmM])?\s*(?:tokens?|tok)\b/g;for(let r of t.matchAll(e)){let n=Number.parseFloat(r[1]??"0"),i=r[2]?.toLowerCase();if(!Number.isFinite(n)||n<=0)continue;let a=i==="m"?1e6:i==="k"?1e3:1;s.push(Math.round(n*a))}return s}c(ot,"extractTokenCounts");function rt(t){let s=t.replace(/\s+/g," ").trim();return s.length<=140?s:`${s.slice(0,137)}...`}c(rt,"summarize");function T(t,s,e){return l(t,"SELECT COUNT(*) AS value FROM events WHERE type = ? AND timestamp >= ?",s,e)}c(T,"eventCount");function K(t,s,e){return E(t,`SELECT COUNT(*) AS samples, COALESCE(SUM(value), 0) AS total, AVG(value) AS average
46
+ FROM perf_samples
47
+ WHERE metric = ? AND timestamp >= ?`,s,e)[0]??{samples:0,total:0,average:null}}c(K,"aggregatePerf");export{pt as a,kt as b};
@@ -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 v}from"./chunk-ABJNOG2I.mjs";import{b as u,h as S,v as s,w as $}from"./chunk-A6K4H3YT.mjs";import{g as C,o as j}from"./chunk-UH4MD3F3.mjs";import{a as y,b as P,p as G}from"./chunk-QWQFF2UG.mjs";import{b,e as E}from"./chunk-GCDLPKOH.mjs";import{d as w}from"./chunk-PKDYFXMI.mjs";import{a as f,f as M}from"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import h from"node:fs/promises";import W from"node:path";import*as d from"jsonc-parser";G();import k from"node:crypto";var D="6f9b2c1a-3d4e-5f60-8a7b-1c2d3e4f5a6b";function F(r,t=D){let n=Buffer.from(t.replace(/-/g,""),"hex"),i=k.createHash("sha1").update(n).update(r,"utf8").digest().subarray(0,16);i[6]=i[6]&15|80,i[8]=i[8]&63|128;let e=i.toString("hex");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}c(F,"uuidv5");async function N(r){let t=await P("git",["remote","get-url","origin"],{cwd:r}).then(({stdout:i})=>i.trim()||null).catch(()=>null);if(!t)return null;let{provider:n,repoSlug:o}=v(t);return!n||!o?null:`${n}:${o}`.toLowerCase()}c(N,"repoKey");async function x(r){let t=await N(r);return t?F(t):null}c(x,"deriveProjectId");M();S();j();E();G();async function m(r){try{let{stdout:t}=await y(r,{timeout:5e3});return{success:!0,output:t.trim()}}catch{return{success:!1,output:""}}}c(m,"execCommand");async function R(){let r=await m("gh api user --jq .login");if(r.success&&r.output)return r.output;let t=await m("git config --global github.user");return t.success&&t.output?t.output:null}c(R,"detectGitHubUsername");async function T(){let r=await m("git config user.name");return r.success&&r.output?r.output:null}c(T,"detectGitName");async function U(){let r=await m("git config user.email");return r.success&&r.output?r.output:null}c(U,"detectGitEmail");async function A(){let[r,t,n]=await Promise.all([R(),T(),U()]);return{github:r,email:n,name:t||r||"Unknown"}}c(A,"detect");$();function I(r){let t=[],n=d.parse(r,t,{allowTrailingComma:!0,disallowComments:!1});if(t.length>0){let o=t[0];throw new SyntaxError(`JSON parse error at offset ${o.offset}: ${d.printParseErrorCode(o.error)}`)}return n}c(I,"parseJsonc");var l=new Map,p=class{static{c(this,"ConfigManager")}async readConfig(t){let n=s.getLocalConfigPath(t),o=await h.stat(n).catch(()=>null);if(!o)return l.delete(n),null;let i=o.mtimeMs,e=l.get(n);if(e&&e.mtimeMs===i)return e.config;try{let a=await h.readFile(n,"utf-8"),g=I(a);return l.size>32&&l.clear(),l.set(n,{mtimeMs:i,config:g}),g}catch(a){return f(a)?(l.delete(n),null):(console.warn(`Warning: Could not read config at ${t}: ${w(a)}`),null)}}async writeConfig(t,n){let o=s.getLocalConfigPath(t);await C(o,n),l.delete(o)}async readGlobalConfig(t){try{let n=s.getGlobalProjectConfigPath(t),o=await h.readFile(n,"utf-8");return I(o)}catch(n){return f(n)||console.warn(`Warning: Could not read global config for ${t}: ${w(n)}`),null}}async writeGlobalConfig(t,n){let o=s.getGlobalProjectConfigPath(t);await C(o,n)}async ensureGlobalConfig(t){let n=await this.readGlobalConfig(t),o=n??(()=>{let i=u();return{projectId:t,authors:[],version:b,lastSync:i}})();return n||await this.writeGlobalConfig(t,o),o}async createConfig(t,n){let o=await x(t)??s.generateProjectId(t),i=s.getGlobalProjectPath(o),e=s.getDisplayPath(i),a=u(),g={projectId:o,dataPath:e,showMetrics:!0};await this.writeConfig(t,g);let L={projectId:o,authors:[{name:n.name||"Unknown",email:n.email||"",github:n.github||"",firstContribution:a,lastActivity:a}],version:b,created:a,lastSync:a};return await this.writeGlobalConfig(o,L),g}async updateLastSync(t){let n=await this.getProjectId(t),o=await this.readGlobalConfig(n);o&&(o.lastSync=u(),await this.writeGlobalConfig(n,o))}validateConfig(t){return!(!t||!t.projectId||!t.dataPath)}async needsMigration(t){if(!await s.hasLegacyStructure(t))return!1;if(!await s.hasConfig(t))return!0;let i=await this.readConfig(t);if(!i||!i.projectId)return!0;let e=s.getGlobalProjectPath(i.projectId);try{return(await h.readdir(W.join(e,"core"))).length===0}catch(a){return f(a),!0}}async getProjectId(t){let n=await this.readConfig(t);if(n?.projectId)return n.projectId;try{let{worktreeService:o}=await import("./worktree-service-AS7JVBK5.mjs");if(await o.detect(t)){let e=await o.getMainWorktree(t);if(e!==t){let a=await this.readConfig(e);if(a?.projectId)return a.projectId}}}catch{}return""}async findAuthor(t,n){let o=await this.readGlobalConfig(t);return!o||!o.authors?null:o.authors.find(i=>i.github===n)||null}async addAuthor(t,n){let o=await this.ensureGlobalConfig(t);if(o.authors.some(a=>a.github===n.github))return;let e=u();o.authors.push({name:n.name||"Unknown",email:n.email||"",github:n.github||"",firstContribution:e,lastActivity:e}),o.lastSync=e,await this.writeGlobalConfig(t,o)}async updateAuthorActivity(t,n){let o=await this.readGlobalConfig(t);if(!o||!o.authors)return;let i=o.authors.find(e=>e.github===n);i&&(i.lastActivity=u(),o.lastSync=i.lastActivity,await this.writeGlobalConfig(t,o))}async getCurrentAuthor(t){let n=await A(),o=await this.getProjectId(t);return await this.addAuthor(o,{name:n.name??void 0,email:n.email??void 0,github:n.github??void 0}),n.github||n.name||"Unknown"}async isConfigured(t){let n=await this.readConfig(t);return this.validateConfig(n)}async getShowMetrics(t){return(await this.readConfig(t))?.showMetrics??!0}async setShowMetrics(t,n){let o=await this.readConfig(t);o&&(o.showMetrics=n,await this.writeConfig(t,o))}async getConfigWithDefaults(t){let n=await this.readConfig(t);if(n)return n;let o=s.generateProjectId(t);return{projectId:o,dataPath:s.getDisplayPath(s.getGlobalProjectPath(o))}}},H=new p,et=H;export{A as a,et as b};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as p}from"./chunk-3WY2AYPE.mjs";import{d as g,g as M}from"./chunk-HDHVBB6Q.mjs";import{a as o}from"./chunk-E66B27AL.mjs";M();var h=300,x=3;function v(t){let e=t?.judgment?.conflictMode;if(e==="off"||e==="advisory"||e==="strict")return e;let n=t?.persona?.packs??[];return n.includes("code-strict")?"strict":n.includes("code")?"advisory":"off"}o(v,"effectiveConflictMode");function N(t){let e={action:"none",memoryIds:[],reason:"",recovery:"",message:""};if(t.mode==="off")return e;let n=new Set(t.overriddenIds??[]),r=t.candidates.filter(c=>c.id&&!n.has(c.id));if(r.length===0)return e;let i=r.filter(c=>c.confidence==="high"),l=r.filter(c=>c.confidence==="low"),s=i[0]??l[0];if(!s)return e;let f=r.map(c=>c.id),u=t.fileLabel?` on \`${t.fileLabel}\``:"",a=`Edit may contradict [${s.type}] ${m(s.content,80)} (\`${s.id}\`)${u}`,d='To supersede: `prjct remember decision "\u2026why supersede\u2026" --tags supersedes:'+s.id+'`. To lift deny for this memory: `prjct remember feedback "override conflict '+s.id+': <why>" --tags conflict:override,memory:'+s.id+"`.";return i.length===0?{action:"warn",memoryIds:f,reason:`Low-confidence preventive signal${u}: ${m(s.content,80)}`,recovery:d,message:y(a,d,f,!1)}:t.mode==="strict"?{action:"deny",memoryIds:i.map(c=>c.id),reason:a,recovery:d,message:_(a,d,i.map(c=>c.id))}:{action:"warn",memoryIds:f,reason:a,recovery:d,message:y(a,d,f,!0)}}o(N,"decisionConflictVerdict");function y(t,e,n,r){return[r?"# prjct: CONFLICT \u2014 decision/gotcha may block this path":"# prjct: heads-up \u2014 weak preventive signal","",t,"",`Memory: ${n.map(l=>`\`${l}\``).join(", ")}`,"",e,"",r?"> Not a soft nudge. Revise the edit or supersede the decision with rationale before proceeding.":"> Apply if it still holds; proceed if not."].join(`
8
+ import{a as p}from"./chunk-V2FR2NPL.mjs";import{d as g,g as M}from"./chunk-UHVYBU7F.mjs";import{a as o}from"./chunk-E66B27AL.mjs";M();var h=300,x=3;function v(t){let e=t?.judgment?.conflictMode;if(e==="off"||e==="advisory"||e==="strict")return e;let n=t?.persona?.packs??[];return n.includes("code-strict")?"strict":n.includes("code")?"advisory":"off"}o(v,"effectiveConflictMode");function N(t){let e={action:"none",memoryIds:[],reason:"",recovery:"",message:""};if(t.mode==="off")return e;let n=new Set(t.overriddenIds??[]),r=t.candidates.filter(c=>c.id&&!n.has(c.id));if(r.length===0)return e;let i=r.filter(c=>c.confidence==="high"),l=r.filter(c=>c.confidence==="low"),s=i[0]??l[0];if(!s)return e;let f=r.map(c=>c.id),u=t.fileLabel?` on \`${t.fileLabel}\``:"",a=`Edit may contradict [${s.type}] ${m(s.content,80)} (\`${s.id}\`)${u}`,d='To supersede: `prjct remember decision "\u2026why supersede\u2026" --tags supersedes:'+s.id+'`. To lift deny for this memory: `prjct remember feedback "override conflict '+s.id+': <why>" --tags conflict:override,memory:'+s.id+"`.";return i.length===0?{action:"warn",memoryIds:f,reason:`Low-confidence preventive signal${u}: ${m(s.content,80)}`,recovery:d,message:y(a,d,f,!1)}:t.mode==="strict"?{action:"deny",memoryIds:i.map(c=>c.id),reason:a,recovery:d,message:_(a,d,i.map(c=>c.id))}:{action:"warn",memoryIds:f,reason:a,recovery:d,message:y(a,d,f,!0)}}o(N,"decisionConflictVerdict");function y(t,e,n,r){return[r?"# prjct: CONFLICT \u2014 decision/gotcha may block this path":"# prjct: heads-up \u2014 weak preventive signal","",t,"",`Memory: ${n.map(l=>`\`${l}\``).join(", ")}`,"",e,"",r?"> Not a soft nudge. Revise the edit or supersede the decision with rationale before proceeding.":"> Apply if it still holds; proceed if not."].join(`
9
9
  `)}o(y,"formatWarnMessage");function _(t,e,n){return[`\u26D4 prjct conflict deny: ${t}`,`Memories: ${n.join(", ")}`,e,"Host will block Edit|Write until override or supersede. Fail-open only on hook errors, not on intentional deny."].join(" ")}o(_,"formatDenyMessage");function E(t){let e=new Set;try{let n=Date.now()-6048e5,r=g.query(t,`SELECT t.value AS value
10
10
  FROM memory_entry_tags t
11
11
  JOIN memory_entries me ON me.id = t.entry_id
@@ -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 x,b as h}from"./chunk-KXWBIQGJ.mjs";import{a as M,h as I}from"./chunk-DXQMKW2B.mjs";import{e as b}from"./chunk-UK7D7EFV.mjs";import{a as S}from"./chunk-3WY2AYPE.mjs";import{a as l,b as D}from"./chunk-HDHVBB6Q.mjs";import{b as R}from"./chunk-GCKILEXJ.mjs";import{a as c}from"./chunk-E66B27AL.mjs";D();var F=.92,v=.18;function d(e){let r=new Map,n=[];for(let s of e){r.set(l(s.content),s.id);let o=x(s.content);n.push(Float64Array.from(o))}return{entries:e,fingerprints:r,vectors:n}}c(d,"buildReferenceIndex");function g(e,r,n){if(!r||r.entries.length===0)return{excess:1,maxSim:0,nearestId:null,exactDup:!1,nearDup:!1};let s=l(e),o=r.fingerprints.get(s);if(o&&o!==n)return{excess:0,maxSim:1,nearestId:o,exactDup:!0,nearDup:!0};let f=x(e),a=r.entries.reduce((t,m,_)=>{if(n&&m.id===n)return t;let E=h(f,r.vectors[_]);return E>t.maxSim?{maxSim:E,nearestId:m.id}:t},{maxSim:0,nearestId:null}),i=Math.max(0,Math.min(1,a.maxSim)),u=a.nearestId,p=i>=F;return{excess:p?0:Math.max(0,Math.min(1,1-i)),maxSim:i,nearestId:u,exactDup:!1,nearDup:p}}c(g,"excessAgainstIndex");function L(e,r,n){return g(e,d(r),n)}c(L,"computeExcess");var $=new Set(["decision","gotcha","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","context"]),k=150,N={declared:3,extracted:2,ambiguous:1,inferred:0};function T(e){return e.tags?.context_schema==="living-v2"||e.tags?.synthesis==="model-authored"||e.tags?.synthesis==="deterministic"||e.tags?.source==="land-auto"||e.tags?.capture==="land-v2"}c(T,"isLivingV2");function w(e){return!(!R(e)||e.content.trim().length<40||!$.has(e.type)||e.type==="context"&&!T(e)||e.type==="inbox"||e.type==="todo"||e.type==="idea")}c(w,"isReferenceEligible");function A(e){let r=N[e.provenance]??1,n=e.type==="decision"||e.type==="gotcha"?100:e.type==="learning"||e.type==="fact"?50:e.type==="context"?30:20,s=Date.parse(e.rememberedAt),o=Number.isFinite(s)?s/1e13:0;return n*10+r*3+o}c(A,"referenceRank");function C(e){let r=e.filter(w);return r.sort((n,s)=>A(s)-A(n)),r.slice(0,k)}c(C,"buildReferenceModel");var P=new Set(["decision","gotcha","red-herring","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","shipped"]),j=.28;function Q(e,r,n,s){let o=n.trim();if(o.length===0)return{accept:!1,reason:"empty content"};let f=M(o,r);if(f.junk)return{accept:!1,reason:`junk capture: ${f.reason}`};let a=I(o,r,{force:s?.force==="true"||s?.["precision:force"]==="true"});if(a.action==="refuse")return{accept:!1,reason:`precision: ${a.reason}`};if(a.action==="demote")return{accept:!1,reason:`precision demote\u2192${a.demoteTo??"context"}: ${a.reason}`};let i=b(s?.source);if(P.has(r)&&!i)return{accept:!0,reason:"judgment type \u2014 always accept novel content"};let u=(()=>{try{return S.allEntriesForIndex(e)}catch{return null}})();if(!u)return{accept:!0,reason:"gate skipped (read failure)"};if(u.length===0)return{accept:!0,reason:"empty vault \u2014 seed accepted"};let p=C(u);if(p.length===0)return{accept:!0,reason:"empty reference \u2014 accept"};let y=d(p),t=g(o,y),m=i?j:v;return t.exactDup||t.nearDup||t.excess<m?{accept:!1,reason:t.exactDup?`redundant exact match of ${t.nearestId}`:i?`auto-source low excess ${t.excess.toFixed(2)} (floor ${m}) vs R nearest ${t.nearestId}`:`low excess ${t.excess.toFixed(2)} vs reference (nearest ${t.nearestId}, sim ${t.maxSim.toFixed(2)})`,excess:t.excess,nearestId:t.nearestId}:{accept:!0,reason:i?`auto-source excess ${t.excess.toFixed(2)} above floor`:`excess ${t.excess.toFixed(2)} above capture floor`,excess:t.excess,nearestId:t.nearestId}}c(Q,"captureGate");export{k as a,w as b,C as c,F as d,v as e,d as f,g,L as h,Q as i};
8
+ import{a as x,b as h}from"./chunk-X5W2UYQK.mjs";import{a as M,h as I}from"./chunk-DXQMKW2B.mjs";import{e as b}from"./chunk-TXSLON7M.mjs";import{a as S}from"./chunk-V2FR2NPL.mjs";import{a as l,b as D}from"./chunk-UHVYBU7F.mjs";import{b as R}from"./chunk-GCKILEXJ.mjs";import{a as c}from"./chunk-E66B27AL.mjs";D();var F=.92,v=.18;function d(e){let r=new Map,n=[];for(let s of e){r.set(l(s.content),s.id);let o=x(s.content);n.push(Float64Array.from(o))}return{entries:e,fingerprints:r,vectors:n}}c(d,"buildReferenceIndex");function g(e,r,n){if(!r||r.entries.length===0)return{excess:1,maxSim:0,nearestId:null,exactDup:!1,nearDup:!1};let s=l(e),o=r.fingerprints.get(s);if(o&&o!==n)return{excess:0,maxSim:1,nearestId:o,exactDup:!0,nearDup:!0};let f=x(e),a=r.entries.reduce((t,m,_)=>{if(n&&m.id===n)return t;let E=h(f,r.vectors[_]);return E>t.maxSim?{maxSim:E,nearestId:m.id}:t},{maxSim:0,nearestId:null}),i=Math.max(0,Math.min(1,a.maxSim)),u=a.nearestId,p=i>=F;return{excess:p?0:Math.max(0,Math.min(1,1-i)),maxSim:i,nearestId:u,exactDup:!1,nearDup:p}}c(g,"excessAgainstIndex");function L(e,r,n){return g(e,d(r),n)}c(L,"computeExcess");var $=new Set(["decision","gotcha","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","context"]),k=150,N={declared:3,extracted:2,ambiguous:1,inferred:0};function T(e){return e.tags?.context_schema==="living-v2"||e.tags?.synthesis==="model-authored"||e.tags?.synthesis==="deterministic"||e.tags?.source==="land-auto"||e.tags?.capture==="land-v2"}c(T,"isLivingV2");function w(e){return!(!R(e)||e.content.trim().length<40||!$.has(e.type)||e.type==="context"&&!T(e)||e.type==="inbox"||e.type==="todo"||e.type==="idea")}c(w,"isReferenceEligible");function A(e){let r=N[e.provenance]??1,n=e.type==="decision"||e.type==="gotcha"?100:e.type==="learning"||e.type==="fact"?50:e.type==="context"?30:20,s=Date.parse(e.rememberedAt),o=Number.isFinite(s)?s/1e13:0;return n*10+r*3+o}c(A,"referenceRank");function C(e){let r=e.filter(w);return r.sort((n,s)=>A(s)-A(n)),r.slice(0,k)}c(C,"buildReferenceModel");var P=new Set(["decision","gotcha","red-herring","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","shipped"]),j=.28;function Q(e,r,n,s){let o=n.trim();if(o.length===0)return{accept:!1,reason:"empty content"};let f=M(o,r);if(f.junk)return{accept:!1,reason:`junk capture: ${f.reason}`};let a=I(o,r,{force:s?.force==="true"||s?.["precision:force"]==="true"});if(a.action==="refuse")return{accept:!1,reason:`precision: ${a.reason}`};if(a.action==="demote")return{accept:!1,reason:`precision demote\u2192${a.demoteTo??"context"}: ${a.reason}`};let i=b(s?.source);if(P.has(r)&&!i)return{accept:!0,reason:"judgment type \u2014 always accept novel content"};let u=(()=>{try{return S.allEntriesForIndex(e)}catch{return null}})();if(!u)return{accept:!0,reason:"gate skipped (read failure)"};if(u.length===0)return{accept:!0,reason:"empty vault \u2014 seed accepted"};let p=C(u);if(p.length===0)return{accept:!0,reason:"empty reference \u2014 accept"};let y=d(p),t=g(o,y),m=i?j:v;return t.exactDup||t.nearDup||t.excess<m?{accept:!1,reason:t.exactDup?`redundant exact match of ${t.nearestId}`:i?`auto-source low excess ${t.excess.toFixed(2)} (floor ${m}) vs R nearest ${t.nearestId}`:`low excess ${t.excess.toFixed(2)} vs reference (nearest ${t.nearestId}, sim ${t.maxSim.toFixed(2)})`,excess:t.excess,nearestId:t.nearestId}:{accept:!0,reason:i?`auto-source excess ${t.excess.toFixed(2)} above floor`:`excess ${t.excess.toFixed(2)} above capture floor`,excess:t.excess,nearestId:t.nearestId}}c(Q,"captureGate");export{k as a,w as b,C as c,F as d,v as e,d as f,g,L as h,Q as i};