prjct-cli 3.97.0 → 3.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/bin/core-chunks/{agent-HCP5FF77.mjs → agent-3N2MSSGT.mjs} +1 -1
  3. package/dist/bin/core-chunks/{agent-switch-AVSX6SLY.mjs → agent-switch-4SE6GF7R.mjs} +1 -1
  4. package/dist/bin/core-chunks/{agents-OAQXBGH3.mjs → agents-ZPNNCOH7.mjs} +1 -1
  5. package/dist/bin/core-chunks/{analysis-3A7ODSSI.mjs → analysis-OARMM4AH.mjs} +2 -2
  6. package/dist/bin/core-chunks/{auto-flush-EWSVMKQN.mjs → auto-flush-XA3V7BJ6.mjs} +1 -1
  7. package/dist/bin/core-chunks/{bin-commands-LLHG2NSY.mjs → bin-commands-FYID6EYI.mjs} +5 -5
  8. package/dist/bin/core-chunks/{capture-7LQ52T6L.mjs → capture-3JJPWIF3.mjs} +1 -1
  9. package/dist/bin/core-chunks/{capture-gate-M4HM7WAI.mjs → capture-gate-G5LGVDME.mjs} +1 -1
  10. package/dist/bin/core-chunks/{ceremonies-4OZ3FKRE.mjs → ceremonies-B565WDCA.mjs} +4 -4
  11. package/dist/bin/core-chunks/{changelog-CUNVCEL5.mjs → changelog-LPJ4GKB6.mjs} +1 -1
  12. package/dist/bin/core-chunks/{chunk-DN46DLU3.mjs → chunk-2FRLIQKX.mjs} +1 -1
  13. package/dist/bin/core-chunks/{chunk-X4FR5S7E.mjs → chunk-2VRS5CUH.mjs} +1 -1
  14. package/dist/bin/core-chunks/{chunk-ZK7BMUMR.mjs → chunk-2VXPFULA.mjs} +1 -1
  15. package/dist/bin/core-chunks/chunk-3OWKIRK6.mjs +7 -0
  16. package/dist/bin/core-chunks/{chunk-V5VCXMKO.mjs → chunk-5DZ2LTII.mjs} +1 -1
  17. package/dist/bin/core-chunks/{chunk-5ONMON5L.mjs → chunk-5OWPZWEU.mjs} +1 -1
  18. package/dist/bin/core-chunks/{chunk-KWC2PCPC.mjs → chunk-5TGZSK4C.mjs} +1 -1
  19. package/dist/bin/core-chunks/chunk-5ZBACKED.mjs +14 -0
  20. package/dist/bin/core-chunks/{chunk-X35YYOFE.mjs → chunk-6KNMT46X.mjs} +2 -2
  21. package/dist/bin/core-chunks/{chunk-5MN22JFI.mjs → chunk-6POAOY5C.mjs} +1 -1
  22. package/dist/bin/core-chunks/{chunk-7CI4AMVO.mjs → chunk-6U3CYLY5.mjs} +1 -1
  23. package/dist/bin/core-chunks/{chunk-J7T5IEFJ.mjs → chunk-6U3MV7KZ.mjs} +1 -1
  24. package/dist/bin/core-chunks/{chunk-2ZPM4Z6W.mjs → chunk-7BU6SJBC.mjs} +4 -4
  25. package/dist/bin/core-chunks/{chunk-ZKJZDOPT.mjs → chunk-ACIOJQSI.mjs} +1 -1
  26. package/dist/bin/core-chunks/{chunk-UE3XKXWM.mjs → chunk-ALTQ3KL4.mjs} +1 -1
  27. package/dist/bin/core-chunks/{chunk-IVGWOY3U.mjs → chunk-ANBDOI53.mjs} +1 -1
  28. package/dist/bin/core-chunks/{chunk-LZC6NGB6.mjs → chunk-B2HY22OD.mjs} +2 -2
  29. package/dist/bin/core-chunks/{chunk-6AFXUX2M.mjs → chunk-BUD3R6LF.mjs} +2 -2
  30. package/dist/bin/core-chunks/{chunk-MDONTD7O.mjs → chunk-CA2VFWFP.mjs} +1 -1
  31. package/dist/bin/core-chunks/{chunk-56FW4P6U.mjs → chunk-CB3CNJTL.mjs} +1 -1
  32. package/dist/bin/core-chunks/{chunk-6FFOWWH2.mjs → chunk-CVKMV22J.mjs} +1 -1
  33. package/dist/bin/core-chunks/{chunk-5UUITMRX.mjs → chunk-CXKDKMYE.mjs} +1 -1
  34. package/dist/bin/core-chunks/{chunk-XSZG3CBO.mjs → chunk-DTMZBK4E.mjs} +1 -1
  35. package/dist/bin/core-chunks/chunk-DW4QMD6J.mjs +10 -0
  36. package/dist/bin/core-chunks/{chunk-CDLZLTRY.mjs → chunk-DZDEBDAB.mjs} +1 -1
  37. package/dist/bin/core-chunks/{chunk-WGDE3L33.mjs → chunk-FOUBHU4X.mjs} +1 -1
  38. package/dist/bin/core-chunks/{chunk-CNWEQUB7.mjs → chunk-HA7Y76GF.mjs} +1 -1
  39. package/dist/bin/core-chunks/{chunk-MTDCRYLP.mjs → chunk-HVXWQ2XZ.mjs} +1 -1
  40. package/dist/bin/core-chunks/{chunk-OYXQRBVM.mjs → chunk-IJNKHQIS.mjs} +1 -1
  41. package/dist/bin/core-chunks/{chunk-KIRU4QFX.mjs → chunk-J6Y7IVFQ.mjs} +1 -1
  42. package/dist/bin/core-chunks/{chunk-3FXNIJCS.mjs → chunk-JGGQSMZC.mjs} +1 -1
  43. package/dist/bin/core-chunks/{chunk-6P4GMVUZ.mjs → chunk-KI4OY3UQ.mjs} +1 -1
  44. package/dist/bin/core-chunks/{chunk-BTCCUMKI.mjs → chunk-L3DJN3XD.mjs} +1 -1
  45. package/dist/bin/core-chunks/{chunk-CEOTHJIY.mjs → chunk-LFOQ7FCR.mjs} +1 -1
  46. package/dist/bin/core-chunks/{chunk-XU3BQPBU.mjs → chunk-LGX2GM45.mjs} +1 -1
  47. package/dist/bin/core-chunks/chunk-LTKUTRRL.mjs +7 -0
  48. package/dist/bin/core-chunks/{chunk-BQKDJ3U6.mjs → chunk-LZILSE5H.mjs} +1 -1
  49. package/dist/bin/core-chunks/chunk-MPU3VM6Z.mjs +7 -0
  50. package/dist/bin/core-chunks/{chunk-INM5COWM.mjs → chunk-MXJF3FA7.mjs} +1 -1
  51. package/dist/bin/core-chunks/{chunk-VDXTMAMO.mjs → chunk-NNILF7R3.mjs} +1 -1
  52. package/dist/bin/core-chunks/{chunk-WZXUFSVT.mjs → chunk-O5VCBMEK.mjs} +1 -1
  53. package/dist/bin/core-chunks/{chunk-XYDLXF5A.mjs → chunk-OE27RFLJ.mjs} +1 -1
  54. package/dist/bin/core-chunks/{chunk-HEXSVBUP.mjs → chunk-OGM34Z6W.mjs} +1 -1
  55. package/dist/bin/core-chunks/{chunk-KKIJAEYU.mjs → chunk-OXKGN3HG.mjs} +1 -1
  56. package/dist/bin/core-chunks/{chunk-QLMZW4K7.mjs → chunk-PQTR6XVW.mjs} +1 -1
  57. package/dist/bin/core-chunks/{chunk-53ZPEZLU.mjs → chunk-Q7GJIU6D.mjs} +1 -1
  58. package/dist/bin/core-chunks/{chunk-IFLBZKKK.mjs → chunk-QWRPJARA.mjs} +1 -1
  59. package/dist/bin/core-chunks/{chunk-TGNZI4KF.mjs → chunk-STFUT7R7.mjs} +2 -2
  60. package/dist/bin/core-chunks/{chunk-IMQCXC3R.mjs → chunk-SUXIKMTS.mjs} +1 -1
  61. package/dist/bin/core-chunks/{chunk-WP5IU4W4.mjs → chunk-TOORPP6K.mjs} +1 -1
  62. package/dist/bin/core-chunks/{chunk-7QMBIMEX.mjs → chunk-UAYTDSYG.mjs} +3 -3
  63. package/dist/bin/core-chunks/{chunk-PPERWRFS.mjs → chunk-UNIBFM6J.mjs} +1 -1
  64. package/dist/bin/core-chunks/{chunk-5YSPND5J.mjs → chunk-UX2ORID4.mjs} +1 -1
  65. package/dist/bin/core-chunks/{chunk-3JD6KRNJ.mjs → chunk-VJCTTFKP.mjs} +1 -1
  66. package/dist/bin/core-chunks/chunk-W23JLJJZ.mjs +109 -0
  67. package/dist/bin/core-chunks/{chunk-DCVPNFS4.mjs → chunk-WCTVZQBG.mjs} +1 -1
  68. package/dist/bin/core-chunks/{chunk-GOIBJ7PV.mjs → chunk-WZ6W5ZQ5.mjs} +1 -1
  69. package/dist/bin/core-chunks/{chunk-XPRLQIVQ.mjs → chunk-X433BB6F.mjs} +1 -1
  70. package/dist/bin/core-chunks/{chunk-ZHTYSYZC.mjs → chunk-XBR63NJA.mjs} +1 -1
  71. package/dist/bin/core-chunks/{chunk-ZS7XJUPE.mjs → chunk-XJTEPHLC.mjs} +1 -1
  72. package/dist/bin/core-chunks/{chunk-K25HGTC3.mjs → chunk-XLAGA5B7.mjs} +1 -1
  73. package/dist/bin/core-chunks/{chunk-3USVY66O.mjs → chunk-XSZOHNL4.mjs} +1 -1
  74. package/dist/bin/core-chunks/{chunk-TTN2CFZC.mjs → chunk-XWLTEAGN.mjs} +1 -1
  75. package/dist/bin/core-chunks/{chunk-V3Y3G2DE.mjs → chunk-YOWW4LHK.mjs} +1 -1
  76. package/dist/bin/core-chunks/{chunk-P53YMOKR.mjs → chunk-YPLFWN62.mjs} +1 -1
  77. package/dist/bin/core-chunks/{chunk-ZQHSJ6FF.mjs → chunk-ZAUJWUUN.mjs} +3 -3
  78. package/dist/bin/core-chunks/{chunk-WSVMQYYU.mjs → chunk-ZQ2XH76U.mjs} +2 -2
  79. package/dist/bin/core-chunks/{chunk-RXXXA7Z6.mjs → chunk-ZSANMA7K.mjs} +1 -1
  80. package/dist/bin/core-chunks/{chunk-AJTBFIH2.mjs → chunk-ZZR3LXCK.mjs} +1 -1
  81. package/dist/bin/core-chunks/{cleanup-installs-WHXUGAHM.mjs → cleanup-installs-LD43GI4K.mjs} +1 -1
  82. package/dist/bin/core-chunks/{cloud-FFUJZLDV.mjs → cloud-RXHFZ7MX.mjs} +1 -1
  83. package/dist/bin/core-chunks/{code-SU7GCPH6.mjs → code-IYK65A62.mjs} +1 -1
  84. package/dist/bin/core-chunks/{codex-hooks-GOLMCL2Q.mjs → codex-hooks-N5UHKK5B.mjs} +1 -1
  85. package/dist/bin/core-chunks/{codex-mcp-K4X2UIQF.mjs → codex-mcp-G7WNAT6T.mjs} +1 -1
  86. package/dist/bin/core-chunks/{codex-skill-3HNVU4T4.mjs → codex-skill-IZNP76BJ.mjs} +1 -1
  87. package/dist/bin/core-chunks/{command-installer-XIQK2G6W.mjs → command-installer-4ENM4GZR.mjs} +1 -1
  88. package/dist/bin/core-chunks/{config-W3RHV3GK.mjs → config-UVF7YOR6.mjs} +1 -1
  89. package/dist/bin/core-chunks/{config-manager-QVFHXIKI.mjs → config-manager-QY73WM5U.mjs} +1 -1
  90. package/dist/bin/core-chunks/{context-4KGTUAC4.mjs → context-4GB6ICXK.mjs} +1 -1
  91. package/dist/bin/core-chunks/{context-DDHC7VIC.mjs → context-MPHOQPXF.mjs} +2 -2
  92. package/dist/bin/core-chunks/{context-checkpoint-4CEUPEVG.mjs → context-checkpoint-NBI5HKPV.mjs} +1 -1
  93. package/dist/bin/core-chunks/{context-tiers-4S6H22NP.mjs → context-tiers-NOKJ75QP.mjs} +1 -1
  94. package/dist/bin/core-chunks/{context7-service-AZWDYK5Z.mjs → context7-service-2MYRUNKY.mjs} +1 -1
  95. package/dist/bin/core-chunks/{core-PR5WEQCS.mjs → core-WMEHDCOK.mjs} +1 -1
  96. package/dist/bin/core-chunks/{crew-JQCG6NS3.mjs → crew-EYVSIX4L.mjs} +1 -1
  97. package/dist/bin/core-chunks/{cwd-changed-ODKZVSPB.mjs → cwd-changed-EUJZOBIC.mjs} +1 -1
  98. package/dist/bin/core-chunks/{daemon-2NQTBFVR.mjs → daemon-QARP3RVX.mjs} +1 -1
  99. package/dist/bin/core-chunks/{developer-profile-MRPBWL2K.mjs → developer-profile-2VSFJGCU.mjs} +1 -1
  100. package/dist/bin/core-chunks/{distill-MLDZG5RA.mjs → distill-ZF7WHGCZ.mjs} +1 -1
  101. package/dist/bin/core-chunks/doctor-heal-XFSVPSEY.mjs +7 -0
  102. package/dist/bin/core-chunks/{doctor-service-WXLB2FEE.mjs → doctor-service-6ZJBWIXR.mjs} +1 -1
  103. package/dist/bin/core-chunks/{dynasty-outcomes-H2O546OL.mjs → dynasty-outcomes-KDWIEA4Y.mjs} +1 -1
  104. package/dist/bin/core-chunks/{embeddings-7A5Z5I67.mjs → embeddings-354ZYFKX.mjs} +1 -1
  105. package/dist/bin/core-chunks/{enriched-recall-YXK7EIKH.mjs → enriched-recall-MKBOXB7M.mjs} +1 -1
  106. package/dist/bin/core-chunks/{eval-4YFUBFLV.mjs → eval-O4YD6YOV.mjs} +2 -2
  107. package/dist/bin/core-chunks/{format-5V6GF6JJ.mjs → format-SYVL4CV5.mjs} +1 -1
  108. package/dist/bin/core-chunks/{gemini-settings-ZTU3VQU3.mjs → gemini-settings-RGD7JLSP.mjs} +1 -1
  109. package/dist/bin/core-chunks/{grok-mcp-F3SRFMCW.mjs → grok-mcp-IE2RRRRW.mjs} +1 -1
  110. package/dist/bin/core-chunks/{grok-plugin-4CE2WUYI.mjs → grok-plugin-SSANHBS7.mjs} +1 -1
  111. package/dist/bin/core-chunks/{grok-skill-GLSBOOKW.mjs → grok-skill-7ZP7R7KO.mjs} +1 -1
  112. package/dist/bin/core-chunks/{guard-FJBJ6IAE.mjs → guard-RT7U3LJX.mjs} +1 -1
  113. package/dist/bin/core-chunks/{guards-LFUFKVVH.mjs → guards-AXH6V2IJ.mjs} +1 -1
  114. package/dist/bin/core-chunks/{harness-FN3HASSA.mjs → harness-V7J7WIT2.mjs} +2 -2
  115. package/dist/bin/core-chunks/{health-W2VWME7Z.mjs → health-TNB5OC37.mjs} +1 -1
  116. package/dist/bin/core-chunks/{help-I37I3V2R.mjs → help-P7EYELVK.mjs} +1 -1
  117. package/dist/bin/core-chunks/{hooks-service-C2P5DRCH.mjs → hooks-service-REI56DDC.mjs} +1 -1
  118. package/dist/bin/core-chunks/{install-XP4S6HWQ.mjs → install-FZQJJWT5.mjs} +2 -2
  119. package/dist/bin/core-chunks/{judgment-GJE332LF.mjs → judgment-G5KH6QFC.mjs} +2 -2
  120. package/dist/bin/core-chunks/{judgment-receipt-WT4EMCAV.mjs → judgment-receipt-GO6QEZQC.mjs} +1 -1
  121. package/dist/bin/core-chunks/{kimi-hooks-2UEUIKXV.mjs → kimi-hooks-TR6J3OVG.mjs} +1 -1
  122. package/dist/bin/core-chunks/{kimi-mcp-DJCXZ2JY.mjs → kimi-mcp-ETG7O6O5.mjs} +1 -1
  123. package/dist/bin/core-chunks/{land-cue-5USQ64MS.mjs → land-cue-3BUD3KJJ.mjs} +1 -1
  124. package/dist/bin/core-chunks/{land-rho-ISNVEPVC.mjs → land-rho-MCTQDPRH.mjs} +1 -1
  125. package/dist/bin/core-chunks/{land-synthesis-CHARJMUP.mjs → land-synthesis-MU4EZEYL.mjs} +1 -1
  126. package/dist/bin/core-chunks/{lean-L53CKZNH.mjs → lean-26BWCUOR.mjs} +1 -1
  127. package/dist/bin/core-chunks/{legacy-crew-sweep-2TLKJTHI.mjs → legacy-crew-sweep-G5UJT2PM.mjs} +2 -2
  128. package/dist/bin/core-chunks/{llm-XMH7WTHV.mjs → llm-KMVXVBHG.mjs} +1 -1
  129. package/dist/bin/core-chunks/{mcp-FLVIZBV2.mjs → mcp-BD5TOTCK.mjs} +1 -1
  130. package/dist/bin/core-chunks/{memory-dream-EJWI4FJO.mjs → memory-dream-6GFV2GXN.mjs} +1 -1
  131. package/dist/bin/core-chunks/{memory-export-27HTNNFI.mjs → memory-export-WJ4H7CFV.mjs} +1 -1
  132. package/dist/bin/core-chunks/{memory-index-BRZDZ2BY.mjs → memory-index-7NIU34EI.mjs} +1 -1
  133. package/dist/bin/core-chunks/{notification-KJ4FQJAW.mjs → notification-G654IX3O.mjs} +1 -1
  134. package/dist/bin/core-chunks/{notify-76B7AICZ.mjs → notify-EWYUBKGO.mjs} +1 -1
  135. package/dist/bin/core-chunks/{opencode-mcp-5YSIYDI3.mjs → opencode-mcp-L7NC77JF.mjs} +1 -1
  136. package/dist/bin/core-chunks/{pack-integrity-GXN67LJB.mjs → pack-integrity-X277OVRB.mjs} +1 -1
  137. package/dist/bin/core-chunks/{pack-manager-46SPIPPD.mjs → pack-manager-VN7F6R47.mjs} +1 -1
  138. package/dist/bin/core-chunks/package-R4FUTGOE.mjs +7 -0
  139. package/dist/bin/core-chunks/{pi-skill-SDHTUK3V.mjs → pi-skill-IZQEUILZ.mjs} +1 -1
  140. package/dist/bin/core-chunks/{planning-S3MYVWH6.mjs → planning-NOWLKZDS.mjs} +2 -2
  141. package/dist/bin/core-chunks/{post-edit-5YSNEMK7.mjs → post-edit-GTBY32JU.mjs} +1 -1
  142. package/dist/bin/core-chunks/{pre-bash-GLDILCRF.mjs → pre-bash-32ZOGNSP.mjs} +1 -1
  143. package/dist/bin/core-chunks/{pre-commit-U6HPPNIC.mjs → pre-commit-7TU2A7H4.mjs} +1 -1
  144. package/dist/bin/core-chunks/{pre-edit-PEYQA6P6.mjs → pre-edit-ASEWA5TS.mjs} +1 -1
  145. package/dist/bin/core-chunks/{pre-package-76JR5GLO.mjs → pre-package-ZTZACEBB.mjs} +1 -1
  146. package/dist/bin/core-chunks/{pre-search-5EHNUOP3.mjs → pre-search-MKDRFJSE.mjs} +1 -1
  147. package/dist/bin/core-chunks/{preferences-BTSYWYUM.mjs → preferences-KO5U2ELK.mjs} +1 -1
  148. package/dist/bin/core-chunks/{primitives-IXAYLX7U.mjs → primitives-GNUMBYOK.mjs} +1 -1
  149. package/dist/bin/core-chunks/{prjct-md-SUDFWDCS.mjs → prjct-md-BSFV7OQQ.mjs} +1 -1
  150. package/dist/bin/core-chunks/{product-KKGJ6MMF.mjs → product-GUHSUNIH.mjs} +1 -1
  151. package/dist/bin/core-chunks/{project-agent-surfaces-I2CUZUIN.mjs → project-agent-surfaces-BXCJJXB7.mjs} +1 -1
  152. package/dist/bin/core-chunks/{project-memory-GYLYIJQD.mjs → project-memory-L5MDZYST.mjs} +1 -1
  153. package/dist/bin/core-chunks/{project-style-evolution-5W25UPPN.mjs → project-style-evolution-HIMSJQQB.mjs} +1 -1
  154. package/dist/bin/core-chunks/prompt-47YP5JIR.mjs +25 -0
  155. package/dist/bin/core-chunks/{purge-5EPJV25P.mjs → purge-6SJKHKIY.mjs} +1 -1
  156. package/dist/bin/core-chunks/{registry-LK6IQ5UX.mjs → registry-YM2EYUXY.mjs} +1 -1
  157. package/dist/bin/core-chunks/{retention-S22T3SPT.mjs → retention-QSXWKE4H.mjs} +1 -1
  158. package/dist/bin/core-chunks/{retro-CLKOHAN6.mjs → retro-B2EBN4TA.mjs} +1 -1
  159. package/dist/bin/core-chunks/{review-risk-LLLBKUXT.mjs → review-risk-LBPY5M3K.mjs} +1 -1
  160. package/dist/bin/core-chunks/{safe-artifacts-RW5WQUUJ.mjs → safe-artifacts-PE2TMEZQ.mjs} +1 -1
  161. package/dist/bin/core-chunks/{sdd-HE7O6N5S.mjs → sdd-3WNZJ6FU.mjs} +1 -1
  162. package/dist/bin/core-chunks/{seed-JX7W53E5.mjs → seed-MMDJE2UO.mjs} +2 -2
  163. package/dist/bin/core-chunks/{self-heal-DFUEKNF3.mjs → self-heal-R5FBXEVQ.mjs} +1 -1
  164. package/dist/bin/core-chunks/{session-continuity-BFSW4OL6.mjs → session-continuity-OQDB5UYI.mjs} +1 -1
  165. package/dist/bin/core-chunks/{session-start-HVYUKJL2.mjs → session-start-FM6UL7MT.mjs} +1 -1
  166. package/dist/bin/core-chunks/{setup-GHS24ER5.mjs → setup-BL36ZWPW.mjs} +2 -2
  167. package/dist/bin/core-chunks/{setup-J4JFYT63.mjs → setup-V75BWRHU.mjs} +2 -2
  168. package/dist/bin/core-chunks/{shipping-I4D4AVTE.mjs → shipping-NZVM57JJ.mjs} +4 -4
  169. package/dist/bin/core-chunks/{signals-digest-V44KYN6Z.mjs → signals-digest-P5BG6MZF.mjs} +1 -1
  170. package/dist/bin/core-chunks/{skill-adherence-MHY4BZL4.mjs → skill-adherence-JE3N3Y67.mjs} +1 -1
  171. package/dist/bin/core-chunks/{spec-2XXPLHUZ.mjs → spec-VC3VTUI3.mjs} +3 -3
  172. package/dist/bin/core-chunks/{spec-context-inference-THFMXC7S.mjs → spec-context-inference-KOINWBC7.mjs} +1 -1
  173. package/dist/bin/core-chunks/{spec-service-I23KJKKP.mjs → spec-service-UZ53XL6X.mjs} +1 -1
  174. package/dist/bin/core-chunks/{spec-task-breakdown-HTG6ME6G.mjs → spec-task-breakdown-3Y7YXCIQ.mjs} +1 -1
  175. package/dist/bin/core-chunks/{stop-2H57XCGZ.mjs → stop-6SH36ULT.mjs} +3 -3
  176. package/dist/bin/core-chunks/{subagent-start-5LPASXOS.mjs → subagent-start-TVGBV2V2.mjs} +1 -1
  177. package/dist/bin/core-chunks/{subagent-stop-ANLSG3KN.mjs → subagent-stop-APWY6KMX.mjs} +1 -1
  178. package/dist/bin/core-chunks/{surface-attribution-WL7S53XX.mjs → surface-attribution-CQVM2SWY.mjs} +1 -1
  179. package/dist/bin/core-chunks/{task-service-FK7FC3PE.mjs → task-service-KFYL5NT4.mjs} +1 -1
  180. package/dist/bin/core-chunks/{tdd-NQDHU62B.mjs → tdd-P2PP4RR4.mjs} +1 -1
  181. package/dist/bin/core-chunks/{team-XZ4Q6UBV.mjs → team-WKAAOEFE.mjs} +1 -1
  182. package/dist/bin/core-chunks/{template-loader-33OVJ4G5.mjs → template-loader-H4FE37HV.mjs} +1 -1
  183. package/dist/bin/core-chunks/{uninstall-6NFON7FO.mjs → uninstall-W6EAUS7N.mjs} +1 -1
  184. package/dist/bin/core-chunks/{update-4IE6SA6M.mjs → update-PSHEJJI5.mjs} +2 -2
  185. package/dist/bin/core-chunks/{update-checker-FK7MWNWN.mjs → update-checker-LZCUPWQB.mjs} +1 -1
  186. package/dist/bin/core-chunks/{version-252QLBN2.mjs → version-B5DBRVGQ.mjs} +1 -1
  187. package/dist/bin/core-chunks/{watch-service-7ZERG7RC.mjs → watch-service-7V3O52TW.mjs} +1 -1
  188. package/dist/bin/core-chunks/weak-frontier-demo-ZCDTMYRO.mjs +7 -0
  189. package/dist/bin/core-chunks/{weak-model-mode-DH66XMD2.mjs → weak-model-mode-LOAPFJPQ.mjs} +1 -1
  190. package/dist/bin/core-chunks/{work-graph-JGJWE3AV.mjs → work-graph-ZNV7S6EU.mjs} +1 -1
  191. package/dist/bin/core-chunks/{work-scope-3LXOEIUX.mjs → work-scope-XXPUH6TU.mjs} +1 -1
  192. package/dist/bin/core-chunks/{workflow-FGJVLRQ3.mjs → workflow-XM77QYRF.mjs} +2 -2
  193. package/dist/bin/core-chunks/{workflows-reference-UWKRZ6BJ.mjs → workflows-reference-T7RH7IGJ.mjs} +1 -1
  194. package/dist/bin/core-chunks/{world-model-impact-RH5WH2B3.mjs → world-model-impact-FAGGNUGN.mjs} +1 -1
  195. package/dist/bin/hook-chunks/{agent-switch-7GOGG4KG.mjs → agent-switch-TAJWH2ZD.mjs} +1 -1
  196. package/dist/bin/hook-chunks/{analysis-UI2JRLJO.mjs → analysis-34WDLUXK.mjs} +2 -2
  197. package/dist/bin/hook-chunks/{auto-flush-JKIXTI2I.mjs → auto-flush-7TIEBPPQ.mjs} +1 -1
  198. package/dist/bin/hook-chunks/{capture-gate-DIPHPNIC.mjs → capture-gate-JFVGG7RB.mjs} +1 -1
  199. package/dist/bin/hook-chunks/{chunk-XXVHUYL7.mjs → chunk-22CBVTZ3.mjs} +1 -1
  200. package/dist/bin/hook-chunks/{chunk-ZH2MF7H7.mjs → chunk-3JOZN7YJ.mjs} +1 -1
  201. package/dist/bin/hook-chunks/{chunk-Y7RDBMNC.mjs → chunk-4X3KUIXK.mjs} +1 -1
  202. package/dist/bin/hook-chunks/{chunk-6RS7PNAN.mjs → chunk-5ALQBNIZ.mjs} +1 -1
  203. package/dist/bin/hook-chunks/{chunk-IL36ER4U.mjs → chunk-5VPZI2ZF.mjs} +1 -1
  204. package/dist/bin/hook-chunks/{chunk-FBEDUKMG.mjs → chunk-6EHYPQ5U.mjs} +1 -1
  205. package/dist/bin/hook-chunks/chunk-7H5UVM6X.mjs +9 -0
  206. package/dist/bin/hook-chunks/{chunk-IDPBMN3Q.mjs → chunk-A3R47SP6.mjs} +1 -1
  207. package/dist/bin/hook-chunks/{chunk-UI25YRTY.mjs → chunk-CGAKJDKT.mjs} +1 -1
  208. package/dist/bin/hook-chunks/{chunk-6LU777GI.mjs → chunk-CJY4Y5SO.mjs} +1 -1
  209. package/dist/bin/hook-chunks/{chunk-WIA6ORIY.mjs → chunk-FSFURDAE.mjs} +1 -1
  210. package/dist/bin/hook-chunks/{chunk-6WDRJ7J7.mjs → chunk-FTBBQHI4.mjs} +1 -1
  211. package/dist/bin/hook-chunks/{chunk-25OGCQTR.mjs → chunk-G4VJKPG7.mjs} +3 -3
  212. package/dist/bin/hook-chunks/{chunk-PFORBQBF.mjs → chunk-GAJOSSB4.mjs} +2 -2
  213. package/dist/bin/hook-chunks/{chunk-KOLXYWOA.mjs → chunk-H3GIYI4Q.mjs} +2 -2
  214. package/dist/bin/hook-chunks/{chunk-B7MHIUFA.mjs → chunk-HRU2KNEB.mjs} +1 -1
  215. package/dist/bin/hook-chunks/{chunk-JF6DFOQK.mjs → chunk-LCGWETJ6.mjs} +1 -1
  216. package/dist/bin/hook-chunks/{chunk-PQJ64L6U.mjs → chunk-MG2DNP4Z.mjs} +1 -1
  217. package/dist/bin/hook-chunks/chunk-NGB6JNSB.mjs +18 -0
  218. package/dist/bin/hook-chunks/{chunk-AEDB75AK.mjs → chunk-OALZUWC6.mjs} +1 -1
  219. package/dist/bin/hook-chunks/{chunk-IFIENAZU.mjs → chunk-PZMBZ6GE.mjs} +1 -1
  220. package/dist/bin/hook-chunks/{chunk-F3PNT2DQ.mjs → chunk-QIB6Y6AH.mjs} +2 -2
  221. package/dist/bin/hook-chunks/{chunk-ZXON2U5F.mjs → chunk-QMNZPNVY.mjs} +1 -1
  222. package/dist/bin/hook-chunks/{chunk-B2ZA5ZAO.mjs → chunk-R4YDE3GU.mjs} +1 -1
  223. package/dist/bin/hook-chunks/{chunk-UBWUQ64A.mjs → chunk-RFKRKUHB.mjs} +1 -1
  224. package/dist/bin/hook-chunks/{chunk-NMB6YSAH.mjs → chunk-RGOTJCZU.mjs} +1 -1
  225. package/dist/bin/hook-chunks/{chunk-ANSRNEEI.mjs → chunk-T2KVL6PZ.mjs} +1 -1
  226. package/dist/bin/hook-chunks/{chunk-HNZ24HIK.mjs → chunk-T7DRHVK3.mjs} +2 -2
  227. package/dist/bin/hook-chunks/{chunk-IHEOOJJT.mjs → chunk-TWFLW6OJ.mjs} +1 -1
  228. package/dist/bin/hook-chunks/{chunk-ONGVBXBD.mjs → chunk-UJIOGFNP.mjs} +1 -1
  229. package/dist/bin/hook-chunks/{chunk-NSTXHVTH.mjs → chunk-UK24P7PV.mjs} +2 -2
  230. package/dist/bin/hook-chunks/{chunk-63P5VOR6.mjs → chunk-ULNGKZB6.mjs} +4 -4
  231. package/dist/bin/hook-chunks/{chunk-UMJ5D5I6.mjs → chunk-UWHVPO6X.mjs} +2 -2
  232. package/dist/bin/hook-chunks/{chunk-A6LRNS6R.mjs → chunk-XC2BSGWF.mjs} +1 -1
  233. package/dist/bin/hook-chunks/{chunk-7PA4KPSR.mjs → chunk-ZPAY2NSF.mjs} +2 -2
  234. package/dist/bin/hook-chunks/{codex-skill-UZZCACMB.mjs → codex-skill-BFRU5FTP.mjs} +1 -1
  235. package/dist/bin/hook-chunks/{command-installer-FJ73C2ZW.mjs → command-installer-3XOZGKOQ.mjs} +1 -1
  236. package/dist/bin/hook-chunks/{config-manager-XDKOTIJM.mjs → config-manager-UPB7NEXF.mjs} +1 -1
  237. package/dist/bin/hook-chunks/{context7-service-NH4BMGSJ.mjs → context7-service-7VFXEQVN.mjs} +1 -1
  238. package/dist/bin/hook-chunks/{cwd-changed-STP3LH6Y.mjs → cwd-changed-USNJYUH7.mjs} +1 -1
  239. package/dist/bin/hook-chunks/{distill-63BHUJAC.mjs → distill-47YVL7IH.mjs} +1 -1
  240. package/dist/bin/hook-chunks/{enriched-recall-6F6LBYAB.mjs → enriched-recall-CVYI52NO.mjs} +1 -1
  241. package/dist/bin/hook-chunks/{format-VJ2YQ4XQ.mjs → format-DPIN45EG.mjs} +1 -1
  242. package/dist/bin/hook-chunks/{judgment-receipt-LSJCAYBT.mjs → judgment-receipt-G2DKQR7U.mjs} +1 -1
  243. package/dist/bin/hook-chunks/{land-cue-DEO2AZW4.mjs → land-cue-3JD2TXFP.mjs} +1 -1
  244. package/dist/bin/hook-chunks/{land-synthesis-GTMFIGDM.mjs → land-synthesis-5C4KGCTB.mjs} +1 -1
  245. package/dist/bin/hook-chunks/{legacy-crew-sweep-QPKU7ITU.mjs → legacy-crew-sweep-XQNXNZES.mjs} +2 -2
  246. package/dist/bin/hook-chunks/{memory-index-KCMXQGKX.mjs → memory-index-LL6SQJ2N.mjs} +1 -1
  247. package/dist/bin/hook-chunks/{notification-DX6ZHOUC.mjs → notification-ACQBRJG3.mjs} +1 -1
  248. package/dist/bin/hook-chunks/{pack-integrity-UMLIB5RQ.mjs → pack-integrity-DCXVRRJZ.mjs} +1 -1
  249. package/dist/bin/hook-chunks/{pack-manager-YXRK2TJ4.mjs → pack-manager-KYWKNYUY.mjs} +1 -1
  250. package/dist/bin/hook-chunks/{planning-JR7O5MYW.mjs → planning-KOU3XKWS.mjs} +2 -2
  251. package/dist/bin/hook-chunks/{post-edit-IPTVSRVG.mjs → post-edit-CK2MYQEN.mjs} +1 -1
  252. package/dist/bin/hook-chunks/{pre-bash-5WWTH36N.mjs → pre-bash-W5A5CTR3.mjs} +1 -1
  253. package/dist/bin/hook-chunks/{pre-commit-KZ5TNTPW.mjs → pre-commit-5Q24RM4S.mjs} +1 -1
  254. package/dist/bin/hook-chunks/{pre-edit-XHPYBXRU.mjs → pre-edit-YIJ4BCYL.mjs} +1 -1
  255. package/dist/bin/hook-chunks/{pre-package-U3HDW3SX.mjs → pre-package-O4RMVA4T.mjs} +1 -1
  256. package/dist/bin/hook-chunks/{pre-search-R5CRK66E.mjs → pre-search-WYOWC3D6.mjs} +1 -1
  257. package/dist/bin/hook-chunks/{prjct-md-IBQTJBK7.mjs → prjct-md-2UVHFYTJ.mjs} +1 -1
  258. package/dist/bin/hook-chunks/{project-agent-surfaces-TPZO73ZV.mjs → project-agent-surfaces-BKFYUMRV.mjs} +1 -1
  259. package/dist/bin/hook-chunks/{project-memory-YQLZX5RG.mjs → project-memory-OC5GTJPY.mjs} +1 -1
  260. package/dist/bin/hook-chunks/{project-style-evolution-NOFCIIZZ.mjs → project-style-evolution-2IFJCACQ.mjs} +1 -1
  261. package/dist/bin/hook-chunks/prompt-JIWMP563.mjs +26 -0
  262. package/dist/bin/hook-chunks/{purge-5W3K2MZL.mjs → purge-FQK3Z4QS.mjs} +1 -1
  263. package/dist/bin/hook-chunks/{retention-GWJ4AX7I.mjs → retention-2FETBJFG.mjs} +1 -1
  264. package/dist/bin/hook-chunks/{sdd-GWBRD4KI.mjs → sdd-V43TSJ2P.mjs} +1 -1
  265. package/dist/bin/hook-chunks/{session-continuity-VH645RGR.mjs → session-continuity-RO2ACICF.mjs} +1 -1
  266. package/dist/bin/hook-chunks/{session-start-4TYTI27B.mjs → session-start-FKKFMKQ5.mjs} +1 -1
  267. package/dist/bin/hook-chunks/{setup-VF4UHUBX.mjs → setup-YV2DKG5L.mjs} +2 -2
  268. package/dist/bin/hook-chunks/{shipping-2ULWBGRX.mjs → shipping-SCNFEXBY.mjs} +4 -4
  269. package/dist/bin/hook-chunks/{spec-context-inference-HVENYOIO.mjs → spec-context-inference-BD3ANTXA.mjs} +1 -1
  270. package/dist/bin/hook-chunks/{spec-service-4XGQQPGP.mjs → spec-service-OWYOAGXS.mjs} +2 -2
  271. package/dist/bin/hook-chunks/{spec-task-breakdown-JXF556UH.mjs → spec-task-breakdown-HOTLUFDM.mjs} +1 -1
  272. package/dist/bin/hook-chunks/{stop-NJDYIIXR.mjs → stop-MIXT7WXA.mjs} +3 -3
  273. package/dist/bin/hook-chunks/{subagent-start-2YMGD4SY.mjs → subagent-start-NO3TN65K.mjs} +1 -1
  274. package/dist/bin/hook-chunks/{subagent-stop-4TZJ2NSJ.mjs → subagent-stop-CKWIXX7W.mjs} +1 -1
  275. package/dist/bin/hook-chunks/{surface-attribution-UNK4J5W2.mjs → surface-attribution-BYESPLXM.mjs} +1 -1
  276. package/dist/bin/hook-chunks/{task-service-SPUES5DO.mjs → task-service-5ONSBKKP.mjs} +1 -1
  277. package/dist/bin/hook-chunks/{tdd-MYF7I5FS.mjs → tdd-SESB4IG3.mjs} +1 -1
  278. package/dist/bin/hook-chunks/{template-loader-4SYVR2UB.mjs → template-loader-KO67FVHO.mjs} +1 -1
  279. package/dist/bin/hook-chunks/{weak-model-mode-TYJJT6JJ.mjs → weak-model-mode-HPXBKXJT.mjs} +1 -1
  280. package/dist/bin/hook-chunks/{work-scope-A6XPENFE.mjs → work-scope-RNPGACPA.mjs} +1 -1
  281. package/dist/bin/prjct-core.mjs +3 -3
  282. package/dist/bin/prjct-hooks.mjs +1 -1
  283. package/dist/daemon/entry.mjs +591 -583
  284. package/dist/mcp/server.mjs +318 -312
  285. package/package.json +2 -1
  286. package/dist/bin/core-chunks/chunk-GDLAQV3Q.mjs +0 -14
  287. package/dist/bin/core-chunks/chunk-R7LLMJDP.mjs +0 -7
  288. package/dist/bin/core-chunks/chunk-UT425KVX.mjs +0 -10
  289. package/dist/bin/core-chunks/chunk-VILH3VYH.mjs +0 -103
  290. package/dist/bin/core-chunks/chunk-Y5SEUYET.mjs +0 -7
  291. package/dist/bin/core-chunks/doctor-heal-ZUZ2RHGY.mjs +0 -7
  292. package/dist/bin/core-chunks/package-DCGCOAGQ.mjs +0 -7
  293. package/dist/bin/core-chunks/prompt-SW5XDRMX.mjs +0 -23
  294. package/dist/bin/core-chunks/weak-frontier-demo-5C4FR3OA.mjs +0 -7
  295. package/dist/bin/hook-chunks/chunk-IWUF2LGO.mjs +0 -18
  296. package/dist/bin/hook-chunks/chunk-ZYCNW75E.mjs +0 -9
  297. package/dist/bin/hook-chunks/prompt-DJWONMTZ.mjs +0 -24
@@ -0,0 +1,10 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{g as P,p as w}from"./chunk-HYIT7MF5.mjs";import{e as l,g as x}from"./chunk-225DWS4D.mjs";import{a as o,b as S}from"./chunk-3TRXQAU4.mjs";x();w();import p from"node:fs";import v from"node:fs/promises";import C from"node:os";import t from"node:path";var g="mcp-remote@0.1.38";var j="prjct: agentic harness with project memory, workflow gates, intent briefs, and performance context. Use prjct_task_start as the MCP entrypoint for a work cycle; prjct retrieves focused context, persists evidence stations, and keeps humans in the loop for risky gates. Agents resume from prjct_task_status/workflow output, create or link reviewed intent/spec briefs when required, and persist synthesized learning instead of raw transcript fragments.";function b(){let e=_();if(e)return e;if(process.env.PRJCT_MCP_ALLOW_LOCAL==="1"){let r=O();if(r)return{command:r,args:["mcp-server"],description:j}}return{command:"npx",args:["-y","prjct-cli@latest","mcp-server"],description:j}}o(b,"getPrjctMcpConfig");function M(e){let r=e.replace(/\\/g,"/");return!!(r.includes("/.worktrees/")||r.includes("/prjct-cli/bin/prjct")&&!r.includes("/node_modules/prjct-cli/"))}o(M,"isNonProductionPrjctPath");function _(){let e=[];try{e.push(t.dirname(S.resolve("prjct-cli/package.json")))}catch{}let r=C.homedir();for(let n of[process.env.NVM_BIN?t.resolve(process.env.NVM_BIN,".."):"",t.join(r,".nvm","versions","node",process.version,"lib"),"/opt/homebrew/lib","/usr/local/lib"].filter(Boolean))e.push(t.join(n,"node_modules","prjct-cli"));for(let n of e){if(M(n))continue;let s=t.join(n,"bin","prjct.cjs"),i=p.existsSync(t.join(n,"dist","bin","prjct.mjs"))||p.existsSync(t.join(n,"dist","bin","prjct-core.mjs"));if(!p.existsSync(s)||!i)continue;let a=[process.execPath,t.join(t.dirname(process.execPath),"node"),t.join(n,"..","..","bin","node")].find(m=>m&&p.existsSync(m)),f=t.resolve(n,"..","..","..","bin","node"),d=p.existsSync(f)?f:a??process.execPath;return{command:d,args:[s,"mcp-server"],env:{PATH:`${t.dirname(d)}${t.delimiter}/usr/bin${t.delimiter}/bin`},description:j}}return null}o(_,"resolvePublishedPrjctMcpConfig");function O(){let e=process.argv[1],r=[e?t.resolve(t.dirname(e),"prjct"):"",e?t.resolve(t.dirname(e),"..","bin","prjct"):"",t.resolve(process.cwd(),"bin","prjct")].filter(Boolean);for(let n of r){if(!p.existsSync(n))continue;let s=(()=>{try{return p.realpathSync(n)}catch{return n}})();if(!M(s))return s}return null}o(O,"resolveLocalPrjctBin");function $(){let e=k.prjct;return{...e,env:{...e.env??{},PRJCT_MCP_TOOLS:"lean"}}}o($,"getPrjctLeanMcpConfig");var k={context7:{command:"npx",args:["-y","@upstash/context7-mcp@latest"],description:"Library documentation lookup"},prjct:b(),linear:{command:"npx",args:["-y",g,"https://mcp.linear.app/mcp"],description:"Linear MCP server (OAuth)"},jira:{command:"npx",args:["-y",g,"https://mcp.atlassian.com/v1/mcp"],description:"Atlassian MCP server for Jira (OAuth)"}};function u(){return process.env.PRJCT_TEST_MODE==="1"?t.join(C.tmpdir(),"prjct-context7-test","mcp.json"):t.join(C.homedir(),".claude","mcp.json")}o(u,"getClaudeMcpConfigPath");async function h(e=u()){try{let r=await v.readFile(e,"utf-8");return JSON.parse(r)}catch(r){let n=l(r).toLowerCase();if(n.includes("no such file")||n.includes("enoent"))return{};throw new Error(`Failed to read MCP config at ${e}: ${l(r)}`)}}o(h,"readMcpConfig");async function y(e,r=u()){await P(r,e)}o(y,"writeMcpConfig");async function A(e,r,n=u()){let s=await h(n),i={...s.mcpServers||{}},c=i[e];i[e]=r,s.mcpServers=i;let a=JSON.stringify(c)!==JSON.stringify(r);return await y(s,n),{path:n,changed:a}}o(A,"upsertMcpServer");async function V(e,r=u()){return!!(await h(r)).mcpServers?.[e]}o(V,"hasMcpServer");async function D(e,r=u(),n){let s=await h(r),i=s.mcpServers,c=i?.[e];return!i||!c?{path:r,changed:!1}:n&&JSON.stringify(c)!==JSON.stringify(n)?{path:r,changed:!1}:(delete i[e],Object.keys(i).length===0&&delete s.mcpServers,await y(s,r),{path:r,changed:!0})}o(D,"removeMcpServer");function F(e,r,n,s,i){let c=e.indexOf(n),a=e.indexOf(s);if(c!==-1&&a!==-1&&a>c){let f=e.slice(0,c),d=e.slice(a+s.length),m=d.startsWith(`
8
+ `)?d.slice(1):d;return{next:f+r+m}}return new RegExp(`^\\s*\\[mcp_servers\\.${i}\\]`,"m").test(e)?{next:e,skipped:"user-managed"}:e.trim().length>0?{next:`${e.trimEnd()}
9
+
10
+ ${r}`}:{next:r}}o(F,"upsertMarkedBlock");async function q(e,r,n){return n===r?{path:e,changed:!1}:(await v.mkdir(t.dirname(e),{recursive:!0}),await v.writeFile(e,n,"utf-8"),{path:e,changed:!0})}o(q,"writeConfigIfChanged");export{$ as a,k as b,u as c,A as d,V as e,D as f,F as g,q as h};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as g}from"./chunk-UT425KVX.mjs";import{b as p,c as O}from"./chunk-DOJPSIMG.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";O();import a from"node:fs/promises";import l from"node:path";import*as o from"jsonc-parser";function h(){return process.env.PRJCT_TEST_MODE==="1"?l.join(p(".prjct-tests"),"opencode","opencode.json"):p(".config","opencode","opencode.json")}i(h,"getOpenCodeConfigPath");function E(){return process.env.PRJCT_TEST_MODE==="1"?l.join(p(".prjct-tests"),"opencode","opencode.jsonc"):p(".config","opencode","opencode.jsonc")}i(E,"getOpenCodeJsoncConfigPath");function P(n=g.prjct){let t={type:"local",command:[n.command,...n.args??[]],enabled:!0};return n.env&&Object.keys(n.env).length>0&&(t.environment={...n.env}),t}i(P,"toOpenCodeLocalMcp");async function S(n=h()){try{return await a.access(n),n}catch{}if(n===h()){let r=E();try{return await a.access(r),r}catch{}}return n}i(S,"resolveWritePath");function y(n){if(!n.trim())return{};let r=[],t=o.parse(n,r,{allowTrailingComma:!0,disallowComments:!1});if(r.length>0){let e=r[0];throw new SyntaxError(`OpenCode config parse error at offset ${e.offset}: ${o.printParseErrorCode(e.error)}`)}return t===null||typeof t!="object"||Array.isArray(t)?{}:t}i(y,"parseOpenCodeConfig");async function J(n,r=g.prjct){let t=n??await S();await a.mkdir(l.dirname(t),{recursive:!0});let e=await a.readFile(t,"utf-8").catch(f=>{if(f.code==="ENOENT")return"";throw f}),c=P(r);if(!e.trim()){let f={$schema:"https://opencode.ai/config.json",mcp:{prjct:c}};return await a.writeFile(t,`${JSON.stringify(f,null,2)}
7
+ import{b as g}from"./chunk-DW4QMD6J.mjs";import{b as p,c as O}from"./chunk-DOJPSIMG.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";O();import a from"node:fs/promises";import l from"node:path";import*as o from"jsonc-parser";function h(){return process.env.PRJCT_TEST_MODE==="1"?l.join(p(".prjct-tests"),"opencode","opencode.json"):p(".config","opencode","opencode.json")}i(h,"getOpenCodeConfigPath");function E(){return process.env.PRJCT_TEST_MODE==="1"?l.join(p(".prjct-tests"),"opencode","opencode.jsonc"):p(".config","opencode","opencode.jsonc")}i(E,"getOpenCodeJsoncConfigPath");function P(n=g.prjct){let t={type:"local",command:[n.command,...n.args??[]],enabled:!0};return n.env&&Object.keys(n.env).length>0&&(t.environment={...n.env}),t}i(P,"toOpenCodeLocalMcp");async function S(n=h()){try{return await a.access(n),n}catch{}if(n===h()){let r=E();try{return await a.access(r),r}catch{}}return n}i(S,"resolveWritePath");function y(n){if(!n.trim())return{};let r=[],t=o.parse(n,r,{allowTrailingComma:!0,disallowComments:!1});if(r.length>0){let e=r[0];throw new SyntaxError(`OpenCode config parse error at offset ${e.offset}: ${o.printParseErrorCode(e.error)}`)}return t===null||typeof t!="object"||Array.isArray(t)?{}:t}i(y,"parseOpenCodeConfig");async function J(n,r=g.prjct){let t=n??await S();await a.mkdir(l.dirname(t),{recursive:!0});let e=await a.readFile(t,"utf-8").catch(f=>{if(f.code==="ENOENT")return"";throw f}),c=P(r);if(!e.trim()){let f={$schema:"https://opencode.ai/config.json",mcp:{prjct:c}};return await a.writeFile(t,`${JSON.stringify(f,null,2)}
8
8
  `,"utf-8"),{path:t,changed:!0}}let s=y(e),C=(s.mcp??{}).prjct;if(!(JSON.stringify(C)!==JSON.stringify(c)))return{path:t,changed:!1};let d={tabSize:2,insertSpaces:!0},j=!s.mcp||typeof s.mcp!="object"?o.applyEdits(e,o.modify(e,["mcp"],{},{formattingOptions:d})):e,m=o.applyEdits(j,o.modify(j,["mcp","prjct"],c,{formattingOptions:d})),u=s.$schema?m:o.applyEdits(m,o.modify(m,["$schema"],"https://opencode.ai/config.json",{formattingOptions:d,isArrayInsertion:!1}));return await a.writeFile(t,u.endsWith(`
9
9
  `)?u:`${u}
10
10
  `,"utf-8"),{path:t,changed:!0}}i(J,"ensureOpenCodeMcpServer");function T(n){if(!n)return!1;try{let e=y(n).mcp?.prjct;if(!e)return!1;let c=e.command;return Array.isArray(c)?c.some(s=>typeof s=="string"&&(s.includes("prjct")||s.includes("mcp-server"))):typeof c=="string"?c.includes("prjct")||c.includes("mcp-server"):JSON.stringify(e).includes("mcp-server")||JSON.stringify(e).includes("prjct")}catch{return n.includes('"prjct"')&&(n.includes("mcp-server")||n.includes("type"))}}i(T,"hasOpenCodePrjctMcp");export{h as a,E as b,P as c,J as d,T as e};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as k}from"./chunk-V3Y3G2DE.mjs";import{a as I}from"./chunk-IFLBZKKK.mjs";import{b as H}from"./chunk-3USVY66O.mjs";import{d as g,f as $}from"./chunk-YLYAYRSJ.mjs";import{e as x}from"./chunk-JPMUJY42.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";function E(e){let i=[{id:"claude-hooks",label:"Reinstall Claude hooks",needed:e.hooksExpected>0&&e.hooksInstalled<e.hooksExpected,reason:e.hooksInstalled<e.hooksExpected?`${e.hooksInstalled}/${e.hooksExpected} hooks missing`:"hooks complete"},{id:"multi-runtime-wire",label:"Wire detected multi-runtime adapters",needed:e.detectedCount>0&&(e.liveCount<e.detectedCount||e.organicPct<100),reason:e.detectedCount===0?"no runtimes detected":`organic ${e.liveCount}/${e.detectedCount} (${e.organicPct}%)`},{id:"agent-surfaces",label:"Refresh project AGENTS.md / adapters",needed:e.hasProject,reason:e.hasProject?"explicit surface refresh (clean-repo opt-in)":"no project \u2014 skip surfaces"},{id:"portable-skills",label:"Rewrite portable multi-host skills (clear project stamp)",needed:e.skillPoisoned===!0,reason:e.skillPoisoned===!0?"global skill has project identity (multi-project poison)":"skills portable"},{id:"organic-board",label:"Re-probe organic board",needed:!0,reason:"always re-probe after heal"}],s=i.filter(c=>c.needed).length,r=`Doctor heal plan: ${s}/${i.length} actions needed`;return{actions:i,neededCount:s,line:r}}l(E,"planDoctorHeal");async function B(e=process.cwd()){let i=[],s=[],r=[],{hooksInstalled:c,hooksExpected:y}=await $().then(t=>({hooksInstalled:t.installed,hooksExpected:t.expected})).catch(t=>(r.push(`hook status: ${t.message}`),{hooksInstalled:0,hooksExpected:0})),d=[await k(e).catch(()=>null)],S=await H.getProjectId(e).catch(()=>null),j=await(async()=>{try{let t=await import("node:fs/promises"),o=await import("node:path"),a=await import("node:os"),{skillBodyHasProjectStamp:n}=await import("./skill-generator-LKS5BNMY.mjs"),h=o.join(a.homedir(),".claude","skills","prjct","SKILL.md"),v=await t.readFile(h,"utf-8").catch(()=>null);return v?n(v):!1}catch{return!1}})(),u=d[0],w=E({hooksInstalled:c,hooksExpected:y,liveCount:u?.liveCount??0,detectedCount:u?.detectedCount??0,organicPct:u?.organicPct??0,hasProject:!!S,skillPoisoned:j}),p={value:null};async function f(){if(!p.value){let t=await x(e);p.value=t.filter(o=>o.detected).map(o=>o.runtime.id)}return p.value}l(f,"detectedIds");for(let t of w.actions){if(!t.needed&&t.id!=="organic-board"){s.push(t.id);continue}try{if(t.id==="claude-hooks")await g(),i.push(t.id);else if(t.id==="portable-skills"){let{skillGenerator:o}=await import("./skill-generator-LKS5BNMY.mjs");await o.generateAndInstall(),i.push(t.id)}else if(t.id==="multi-runtime-wire"){let o=await f();if(o.includes("codex")){let{ensureCodexMcpServer:a}=await import("./codex-mcp-K4X2UIQF.mjs"),{installCodexHooks:n}=await import("./codex-hooks-GOLMCL2Q.mjs");await a(),await n()}if(o.includes("gemini")){let{installGeminiSettings:a}=await import("./gemini-settings-ZTU3VQU3.mjs");await a()}if(o.includes("cursor")){let{installCursorHooks:a}=await import("./cursor-hooks-DGDJVAI6.mjs");await a()}if(o.includes("kimi-cli")){let{ensureKimiMcpServer:a}=await import("./kimi-mcp-DJCXZ2JY.mjs"),{installKimiHooks:n}=await import("./kimi-hooks-2UEUIKXV.mjs");await a(),await n()}if(o.includes("grok")){let{ensureGrokMcpServer:a}=await import("./grok-mcp-F3SRFMCW.mjs"),{installGrokSkill:n}=await import("./grok-skill-GLSBOOKW.mjs"),{installGrokPlugin:h}=await import("./grok-plugin-4CE2WUYI.mjs");await a(),await n(),await h()}if(o.includes("opencode")){let{ensureOpenCodeMcpServer:a}=await import("./opencode-mcp-5YSIYDI3.mjs");await a()}if(o.includes("pi")){let{installPiSkill:a}=await import("./pi-skill-SDHTUK3V.mjs");await a()}await g(),i.push(t.id)}else if(t.id==="agent-surfaces"){let o=await f();await I(e,{explicit:!0,agents:o}),i.push(t.id)}else t.id==="organic-board"&&(d.push(await k(e)),i.push(t.id))}catch(o){r.push(`${t.id}: ${o.message}`)}}let m=d.at(-1),b=m?.liveCount??0,C=m?.detectedCount??0,P=m?.organicPct??0,A=`Doctor heal: applied ${i.length} \xB7 skipped ${s.length} \xB7 errors ${r.length} \xB7 organic ${b}/${C} (${P}%)`;return{planned:w.neededCount,applied:i,skipped:s,errors:r,organicPct:P,liveCount:b,detectedCount:C,line:A}}l(B,"applyDoctorHeal");export{E as a,B as b};
7
+ import{a as k}from"./chunk-YOWW4LHK.mjs";import{a as I}from"./chunk-QWRPJARA.mjs";import{b as H}from"./chunk-XSZOHNL4.mjs";import{d as g,f as $}from"./chunk-YLYAYRSJ.mjs";import{e as x}from"./chunk-JPMUJY42.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";function E(e){let i=[{id:"claude-hooks",label:"Reinstall Claude hooks",needed:e.hooksExpected>0&&e.hooksInstalled<e.hooksExpected,reason:e.hooksInstalled<e.hooksExpected?`${e.hooksInstalled}/${e.hooksExpected} hooks missing`:"hooks complete"},{id:"multi-runtime-wire",label:"Wire detected multi-runtime adapters",needed:e.detectedCount>0&&(e.liveCount<e.detectedCount||e.organicPct<100),reason:e.detectedCount===0?"no runtimes detected":`organic ${e.liveCount}/${e.detectedCount} (${e.organicPct}%)`},{id:"agent-surfaces",label:"Refresh project AGENTS.md / adapters",needed:e.hasProject,reason:e.hasProject?"explicit surface refresh (clean-repo opt-in)":"no project \u2014 skip surfaces"},{id:"portable-skills",label:"Rewrite portable multi-host skills (clear project stamp)",needed:e.skillPoisoned===!0,reason:e.skillPoisoned===!0?"global skill has project identity (multi-project poison)":"skills portable"},{id:"organic-board",label:"Re-probe organic board",needed:!0,reason:"always re-probe after heal"}],s=i.filter(c=>c.needed).length,r=`Doctor heal plan: ${s}/${i.length} actions needed`;return{actions:i,neededCount:s,line:r}}l(E,"planDoctorHeal");async function B(e=process.cwd()){let i=[],s=[],r=[],{hooksInstalled:c,hooksExpected:y}=await $().then(t=>({hooksInstalled:t.installed,hooksExpected:t.expected})).catch(t=>(r.push(`hook status: ${t.message}`),{hooksInstalled:0,hooksExpected:0})),d=[await k(e).catch(()=>null)],S=await H.getProjectId(e).catch(()=>null),j=await(async()=>{try{let t=await import("node:fs/promises"),o=await import("node:path"),a=await import("node:os"),{skillBodyHasProjectStamp:n}=await import("./skill-generator-LKS5BNMY.mjs"),h=o.join(a.homedir(),".claude","skills","prjct","SKILL.md"),v=await t.readFile(h,"utf-8").catch(()=>null);return v?n(v):!1}catch{return!1}})(),u=d[0],w=E({hooksInstalled:c,hooksExpected:y,liveCount:u?.liveCount??0,detectedCount:u?.detectedCount??0,organicPct:u?.organicPct??0,hasProject:!!S,skillPoisoned:j}),p={value:null};async function f(){if(!p.value){let t=await x(e);p.value=t.filter(o=>o.detected).map(o=>o.runtime.id)}return p.value}l(f,"detectedIds");for(let t of w.actions){if(!t.needed&&t.id!=="organic-board"){s.push(t.id);continue}try{if(t.id==="claude-hooks")await g(),i.push(t.id);else if(t.id==="portable-skills"){let{skillGenerator:o}=await import("./skill-generator-LKS5BNMY.mjs");await o.generateAndInstall(),i.push(t.id)}else if(t.id==="multi-runtime-wire"){let o=await f();if(o.includes("codex")){let{ensureCodexMcpServer:a}=await import("./codex-mcp-G7WNAT6T.mjs"),{installCodexHooks:n}=await import("./codex-hooks-N5UHKK5B.mjs");await a(),await n()}if(o.includes("gemini")){let{installGeminiSettings:a}=await import("./gemini-settings-RGD7JLSP.mjs");await a()}if(o.includes("cursor")){let{installCursorHooks:a}=await import("./cursor-hooks-DGDJVAI6.mjs");await a()}if(o.includes("kimi-cli")){let{ensureKimiMcpServer:a}=await import("./kimi-mcp-ETG7O6O5.mjs"),{installKimiHooks:n}=await import("./kimi-hooks-TR6J3OVG.mjs");await a(),await n()}if(o.includes("grok")){let{ensureGrokMcpServer:a}=await import("./grok-mcp-IE2RRRRW.mjs"),{installGrokSkill:n}=await import("./grok-skill-7ZP7R7KO.mjs"),{installGrokPlugin:h}=await import("./grok-plugin-SSANHBS7.mjs");await a(),await n(),await h()}if(o.includes("opencode")){let{ensureOpenCodeMcpServer:a}=await import("./opencode-mcp-L7NC77JF.mjs");await a()}if(o.includes("pi")){let{installPiSkill:a}=await import("./pi-skill-IZQEUILZ.mjs");await a()}await g(),i.push(t.id)}else if(t.id==="agent-surfaces"){let o=await f();await I(e,{explicit:!0,agents:o}),i.push(t.id)}else t.id==="organic-board"&&(d.push(await k(e)),i.push(t.id))}catch(o){r.push(`${t.id}: ${o.message}`)}}let m=d.at(-1),b=m?.liveCount??0,C=m?.detectedCount??0,P=m?.organicPct??0,A=`Doctor heal: applied ${i.length} \xB7 skipped ${s.length} \xB7 errors ${r.length} \xB7 organic ${b}/${C} (${P}%)`;return{planned:w.neededCount,applied:i,skipped:s,errors:r,organicPct:P,liveCount:b,detectedCount:C,line:A}}l(B,"applyDoctorHeal");export{E as a,B as b};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{f as x}from"./chunk-2NI4EEK2.mjs";import{b as M}from"./chunk-X4FR5S7E.mjs";import{f as E}from"./chunk-6AFXUX2M.mjs";import{b as f}from"./chunk-LZC6NGB6.mjs";import{a as q}from"./chunk-Q6C27OL7.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";var k=85,I=2;async function j(t,e,n={}){let o=n.threshold??k,d=n.maxIterations??I,i=await import("./retention-S22T3SPT.mjs").then(({evaluateRetentionShared:s})=>s(e,Date.now()).byId).catch(()=>null),h=c(async(s,a,y,g)=>{if(s>=d||a.score>=o)return{...a,irrelevantRemoved:y,repairEntriesCreated:g};let r=f.allEntriesForIndex(e),m=r.filter(l=>{if(!C(l))return!1;let b=i?.get(l.id);return!(b&&b.verdict==="active"&&b.score>=70)}),u=L(r)?0:1;u>0&&await f.remember(t,{type:"context",content:D(r,a),tags:{context_schema:"living-v2",synthesis:"model-authored",feature:"context-quality-cleanup",key_data:`quality_score=${a.score}; threshold=${o}; irrelevant=${m.length}`,model:"prjct sync context-quality analyzer",token_usage:"0 deterministic sync tokens",source:"sync-context-quality"},provenance:"inferred",projectId:e});let p=[];for(let l of m)f.forget(e,l.id)&&(p.push(l.id),await q({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 w={...R(e,o),iterations:s+1,irrelevantRemoved:y+p.length,repairEntriesCreated:g+u};return m.length===0&&u===0?w:h(s+1,w,y+p.length,g+u)},"repairIteration");return h(0,R(e,o),0,0)}c(j,"repairContextQuality");function R(t,e=k){let n=f.allEntriesForIndex(t),o=n.filter(r=>r.type==="context"),d=o.filter(v),i=o.filter(r=>!v(r)),h=n.filter(C),s=[],a=[];n.length>0&&d.length===0&&(a.push(35),s.push("missing living-v2 context synthesis")),h.length>0&&(a.push(Math.min(40,h.length*8)),s.push(`${h.length} irrelevant generated entries in active context`)),i.length>0&&(a.push(Math.min(20,i.length*5)),s.push(`${i.length} legacy context entries need cleanup`));let y=d[0];if(y){let r=x(y.content),u=[r.contextSynthesis,r.keyData,r.model,r.tokenUsage,r.nextImplication].filter(p=>!p).length;u>0&&(a.push(u*4),s.push("latest living context is missing structured UI/LLM fields"))}let g=Math.max(0,Math.min(100,100-a.reduce((r,m)=>r+m,0)));return{score:g,threshold:e,passed:g>=e,iterations:0,livingContextCount:d.length,legacyContextCount:i.length,irrelevantRemoved:0,repairEntriesCreated:0,issues:s}}c(R,"evaluateContextQuality");function C(t){return M(t)?!0:t.tags?.source==="sync-context-quality"||t.type!=="context"||v(t)?!1:$(t)}c(C,"isIrrelevantGeneratedContext");function v(t){if(t.tags?.context_schema==="living-v2")return!0;let e=x(t.content);return!!(e.contextSynthesis&&e.keyData)}c(v,"isLivingV2Context");function L(t){return t.some(e=>e.type==="context"&&v(e))}c(L,"hasUsableLivingContext");function $(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}c($,"isLowValueLegacyContext");function D(t,e){let n=t.filter(i=>!C(i)).filter(i=>["decision","gotcha","learning","context","shipped"].includes(i.type)).slice(0,8),o=n.length>0?n.map(i=>`${i.type}:${E(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: ${o}`,"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 ")}c(D,"buildRepairContext");export{j as a,C as b};
7
+ import{f as x}from"./chunk-2NI4EEK2.mjs";import{b as M}from"./chunk-2VRS5CUH.mjs";import{g as E}from"./chunk-BUD3R6LF.mjs";import{b as f}from"./chunk-B2HY22OD.mjs";import{a as q}from"./chunk-Q6C27OL7.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";var k=85,I=2;async function j(t,e,n={}){let o=n.threshold??k,d=n.maxIterations??I,i=await import("./retention-QSXWKE4H.mjs").then(({evaluateRetentionShared:s})=>s(e,Date.now()).byId).catch(()=>null),h=c(async(s,a,y,g)=>{if(s>=d||a.score>=o)return{...a,irrelevantRemoved:y,repairEntriesCreated:g};let r=f.allEntriesForIndex(e),m=r.filter(l=>{if(!C(l))return!1;let b=i?.get(l.id);return!(b&&b.verdict==="active"&&b.score>=70)}),u=L(r)?0:1;u>0&&await f.remember(t,{type:"context",content:D(r,a),tags:{context_schema:"living-v2",synthesis:"model-authored",feature:"context-quality-cleanup",key_data:`quality_score=${a.score}; threshold=${o}; irrelevant=${m.length}`,model:"prjct sync context-quality analyzer",token_usage:"0 deterministic sync tokens",source:"sync-context-quality"},provenance:"inferred",projectId:e});let p=[];for(let l of m)f.forget(e,l.id)&&(p.push(l.id),await q({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 w={...R(e,o),iterations:s+1,irrelevantRemoved:y+p.length,repairEntriesCreated:g+u};return m.length===0&&u===0?w:h(s+1,w,y+p.length,g+u)},"repairIteration");return h(0,R(e,o),0,0)}c(j,"repairContextQuality");function R(t,e=k){let n=f.allEntriesForIndex(t),o=n.filter(r=>r.type==="context"),d=o.filter(v),i=o.filter(r=>!v(r)),h=n.filter(C),s=[],a=[];n.length>0&&d.length===0&&(a.push(35),s.push("missing living-v2 context synthesis")),h.length>0&&(a.push(Math.min(40,h.length*8)),s.push(`${h.length} irrelevant generated entries in active context`)),i.length>0&&(a.push(Math.min(20,i.length*5)),s.push(`${i.length} legacy context entries need cleanup`));let y=d[0];if(y){let r=x(y.content),u=[r.contextSynthesis,r.keyData,r.model,r.tokenUsage,r.nextImplication].filter(p=>!p).length;u>0&&(a.push(u*4),s.push("latest living context is missing structured UI/LLM fields"))}let g=Math.max(0,Math.min(100,100-a.reduce((r,m)=>r+m,0)));return{score:g,threshold:e,passed:g>=e,iterations:0,livingContextCount:d.length,legacyContextCount:i.length,irrelevantRemoved:0,repairEntriesCreated:0,issues:s}}c(R,"evaluateContextQuality");function C(t){return M(t)?!0:t.tags?.source==="sync-context-quality"||t.type!=="context"||v(t)?!1:$(t)}c(C,"isIrrelevantGeneratedContext");function v(t){if(t.tags?.context_schema==="living-v2")return!0;let e=x(t.content);return!!(e.contextSynthesis&&e.keyData)}c(v,"isLivingV2Context");function L(t){return t.some(e=>e.type==="context"&&v(e))}c(L,"hasUsableLivingContext");function $(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}c($,"isLowValueLegacyContext");function D(t,e){let n=t.filter(i=>!C(i)).filter(i=>["decision","gotcha","learning","context","shipped"].includes(i.type)).slice(0,8),o=n.length>0?n.map(i=>`${i.type}:${E(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: ${o}`,"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 ")}c(D,"buildRepairContext");export{j as a,C as b};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{b as a}from"./chunk-GDLAQV3Q.mjs";import{a as c,f as i,g as p}from"./chunk-UT425KVX.mjs";import{b as o,c as k}from"./chunk-DOJPSIMG.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";k();import m from"node:fs/promises";import j from"node:path";var f="# prjct:mcp:start - managed by prjct, do not edit between markers",M="# prjct:mcp:end";function u(){return process.env.PRJCT_TEST_MODE==="1"?j.join(o(".prjct-tests"),"grok","config.toml"):o(".grok","config.toml")}e(u,"getGrokConfigTomlPath");async function h(t=u(),r=c.prjct){let n=await m.readFile(t,"utf-8").catch(()=>""),l=a(r),s=i(n,l,f,M,"prjct"),g=s.next,d=s.skipped;return{...await p(t,n,g),skipped:d}}e(h,"ensureGrokMcpServer");async function v(t=u()){try{let r=await m.readFile(t,"utf-8");return/^\s*\[mcp_servers\.prjct\]/m.test(r)||r.includes(f)}catch{return!1}}e(v,"grokHasPrjctMcpServer");export{u as a,h as b,v as c};
7
+ import{b as a}from"./chunk-5ZBACKED.mjs";import{b as c,g as i,h as p}from"./chunk-DW4QMD6J.mjs";import{b as o,c as k}from"./chunk-DOJPSIMG.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";k();import m from"node:fs/promises";import j from"node:path";var f="# prjct:mcp:start - managed by prjct, do not edit between markers",M="# prjct:mcp:end";function u(){return process.env.PRJCT_TEST_MODE==="1"?j.join(o(".prjct-tests"),"grok","config.toml"):o(".grok","config.toml")}e(u,"getGrokConfigTomlPath");async function h(t=u(),r=c.prjct){let n=await m.readFile(t,"utf-8").catch(()=>""),l=a(r),s=i(n,l,f,M,"prjct"),g=s.next,d=s.skipped;return{...await p(t,n,g),skipped:d}}e(h,"ensureGrokMcpServer");async function v(t=u()){try{let r=await m.readFile(t,"utf-8");return/^\s*\[mcp_servers\.prjct\]/m.test(r)||r.includes(f)}catch{return!1}}e(v,"grokHasPrjctMcpServer");export{u as a,h as b,v as c};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{D as F,E as M,x as j}from"./chunk-HU5ERAAV.mjs";import{b as k,f as G}from"./chunk-XYDLXF5A.mjs";import{a as b,b as S}from"./chunk-2EEMQV7N.mjs";import{f as L,g as N}from"./chunk-TTN2CFZC.mjs";import{a as E,b as a,c as _}from"./chunk-DOJPSIMG.mjs";import{i as A,l as I,p as O}from"./chunk-HYIT7MF5.mjs";import{e as l,g as R}from"./chunk-225DWS4D.mjs";import{a as c,e as C}from"./chunk-3TRXQAU4.mjs";R();O();M();import s from"node:fs/promises";import o from"node:path";G();R();O();S();import P from"node:fs/promises";import D from"node:path";var y='<!-- prjct:start - DO NOT REMOVE THIS MARKER -->\n# p/ \u2014 Project knowledge layer\n\nprjct stores project memory (decisions, learnings, gotchas, patterns, ships, analyses) per project in SQLite and serves it to you through tools. **Query it \u2014 don\'t re-read source from scratch.**\n\nprjct remembers and shows the path; it does not own execution. Treat prjct output as durable signals (task state, memories, specs, workflows, risks, recent learnings). Claude, GPT, and other agents decide the concrete HOW with their own native tools and judgment, then persist meaningful outcomes back to prjct.\n\nYou are in a prjct project when `.prjct/` is in cwd OR `~/.prjct-cli/projects/` has an entry for the current path.\n\n## Lookup FIRST, source LAST\n\nBefore reading source code or running broad searches for ANY question about the project (architecture, conventions, decisions, recent ships, bugs, patterns, tech debt, past analyses), QUERY prjct first \u2014 bounded, ranked answers from SQLite, no markdown trees to wade through:\n\n- `prjct context memory <topic>` / `prjct search "<q>"` \u2014 captured decisions, gotchas, learnings, facts\n- `prjct context --md` \u2014 current state: active cycle, ships, recent learnings\n- architecture / conventions / patterns / anti-patterns / tech-debt / insights \u2192 MCP `prjct_analysis` (add `mode:archive` for history)\n- developer preferences \u2192 MCP `prjct_developer`; machine signals \u2192 MCP `prjct_signals`\n- specs \u2192 MCP `prjct_spec_list` / `prjct_spec_get`; per-file traps before editing \u2192 `prjct guard <file>`\n\nOnly fall through to source/repo reading when prjct does not contain the answer.\n\n**Skill \u2260 project identity.** The prjct skill is a portable multi-LLM contract (L0). Live name/stack/branch come from SessionStart + `prjct context --md` for **this cwd**. If skill text and the tree disagree, trust the cwd and the tree.\n\n## Capture analyses BACK to prjct\n\nWhen you complete substantive work \u2014 analysis, decision, learning, gotcha \u2014 persist it: `prjct remember <decision|learning|gotcha|fact> "..."` or `prjct capture "<text>" --tags k:v`. **Author every entry in ENGLISH**, whatever language the user speaks. **Default to capturing \u2014 under-capture is the failure mode that makes prjct useless.** The full verb map and task workflow live in the `prjct` skill.\n\n## Where things live\n\n- Source of truth: SQLite at `~/.prjct-cli/projects/<id>/` (don\'t read directly \u2014 use `prjct` CLI / MCP tools)\n- Project config: `.prjct/prjct.config.json` in repo root\n\n**Auto-managed by prjct-cli** | https://prjct.app\n<!-- prjct:end - DO NOT REMOVE THIS MARKER -->\n';async function v(d){let t=(M(),C(F)),e=d??await t.getActiveProvider(),i=e.name;if(d){if(!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"}}else if(!(await t.detectProvider(i)).installed&&!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"};try{await P.mkdir(e.configDir,{recursive:!0});let n=D.join(e.configDir,e.contextFile),m=await(async()=>{if(i==="claude")return y;let u=k(`global/${e.contextFile}`);if(u)return u;let{PACKAGE_ROOT:g}=(N(),C(L)),T=D.join(g,"templates","global",e.contextFile);return P.readFile(T,"utf-8").catch(()=>i==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await A(n),p="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",x=(()=>{if(!r.content.includes(p)||!r.content.includes(f))return r.content;let u=r.content.substring(0,r.content.indexOf(p)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(u+g).replace(/\n{3,}/g,`
7
+ import{D as F,E as M,x as j}from"./chunk-HU5ERAAV.mjs";import{b as k,f as G}from"./chunk-OE27RFLJ.mjs";import{a as b,b as S}from"./chunk-2EEMQV7N.mjs";import{f as L,g as N}from"./chunk-XWLTEAGN.mjs";import{a as E,b as a,c as _}from"./chunk-DOJPSIMG.mjs";import{i as A,l as I,p as O}from"./chunk-HYIT7MF5.mjs";import{e as l,g as R}from"./chunk-225DWS4D.mjs";import{a as c,e as C}from"./chunk-3TRXQAU4.mjs";R();O();M();import s from"node:fs/promises";import o from"node:path";G();R();O();S();import P from"node:fs/promises";import D from"node:path";var y='<!-- prjct:start - DO NOT REMOVE THIS MARKER -->\n# p/ \u2014 Project knowledge layer\n\nprjct stores project memory (decisions, learnings, gotchas, patterns, ships, analyses) per project in SQLite and serves it to you through tools. **Query it \u2014 don\'t re-read source from scratch.**\n\nprjct remembers and shows the path; it does not own execution. Treat prjct output as durable signals (task state, memories, specs, workflows, risks, recent learnings). Claude, GPT, and other agents decide the concrete HOW with their own native tools and judgment, then persist meaningful outcomes back to prjct.\n\nYou are in a prjct project when `.prjct/` is in cwd OR `~/.prjct-cli/projects/` has an entry for the current path.\n\n## Lookup FIRST, source LAST\n\nBefore reading source code or running broad searches for ANY question about the project (architecture, conventions, decisions, recent ships, bugs, patterns, tech debt, past analyses), QUERY prjct first \u2014 bounded, ranked answers from SQLite, no markdown trees to wade through:\n\n- `prjct context memory <topic>` / `prjct search "<q>"` \u2014 captured decisions, gotchas, learnings, facts\n- `prjct context --md` \u2014 current state: active cycle, ships, recent learnings\n- architecture / conventions / patterns / anti-patterns / tech-debt / insights \u2192 MCP `prjct_analysis` (add `mode:archive` for history)\n- developer preferences \u2192 MCP `prjct_developer`; machine signals \u2192 MCP `prjct_signals`\n- specs \u2192 MCP `prjct_spec_list` / `prjct_spec_get`; per-file traps before editing \u2192 `prjct guard <file>`\n\nOnly fall through to source/repo reading when prjct does not contain the answer.\n\n**Skill \u2260 project identity.** The prjct skill is a portable multi-LLM contract (L0). Live name/stack/branch come from SessionStart + `prjct context --md` for **this cwd**. If skill text and the tree disagree, trust the cwd and the tree.\n\n## Capture analyses BACK to prjct\n\nWhen you complete substantive work \u2014 analysis, decision, learning, gotcha \u2014 persist it: `prjct remember <decision|learning|gotcha|fact> "..."` or `prjct capture "<text>" --tags k:v`. **Author every entry in ENGLISH**, whatever language the user speaks. **Default to capturing \u2014 under-capture is the failure mode that makes prjct useless.** The full verb map and task workflow live in the `prjct` skill.\n\n## Where things live\n\n- Source of truth: SQLite at `~/.prjct-cli/projects/<id>/` (don\'t read directly \u2014 use `prjct` CLI / MCP tools)\n- Project config: `.prjct/prjct.config.json` in repo root\n\n**Auto-managed by prjct-cli** | https://prjct.app\n<!-- prjct:end - DO NOT REMOVE THIS MARKER -->\n';async function v(d){let t=(M(),C(F)),e=d??await t.getActiveProvider(),i=e.name;if(d){if(!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"}}else if(!(await t.detectProvider(i)).installed&&!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"};try{await P.mkdir(e.configDir,{recursive:!0});let n=D.join(e.configDir,e.contextFile),m=await(async()=>{if(i==="claude")return y;let u=k(`global/${e.contextFile}`);if(u)return u;let{PACKAGE_ROOT:g}=(N(),C(L)),T=D.join(g,"templates","global",e.contextFile);return P.readFile(T,"utf-8").catch(()=>i==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await A(n),p="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",x=(()=>{if(!r.content.includes(p)||!r.content.includes(f))return r.content;let u=r.content.substring(0,r.content.indexOf(p)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(u+g).replace(/\n{3,}/g,`
8
8
 
9
9
  `).trim()}
10
10
  `})(),h=b(r.exists?x:"",m,"<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");return r.exists&&r.content===h.content?{success:!0,action:"unchanged",path:n}:(await P.writeFile(n,h.content,"utf-8"),{success:!0,action:h.action,path:n})}catch(n){return{success:!1,error:l(n),action:"failed"}}}c(v,"installGlobalConfig");_();async function ot(d){return v(d)}c(ot,"installGlobalConfig");var w=class{static{c(this,"CommandInstaller")}commandsPath="";configPath="";_initialized=!1;async ensureInit(t){if(this._initialized)return;let e=t??await j();this.configPath=e.configDir??"",this.commandsPath=this.configPath?o.join(this.configPath,"commands"):"",this._initialized=!0}async detectActiveProvider(t){return await this.ensureInit(t),I(this.configPath)}async installCommands(){let t=await this.detectActiveProvider(),e=await j();return t?(await this.cleanupRouter(),{success:!0,installed:[],path:this.commandsPath}):{success:!1,error:`${e.displayName} not detected. Please install it first.`}}async uninstallCommands(){try{let t=[];await this.ensureInit();for(let e of["p.md","p.toml"]){let i=o.join(this.commandsPath,e);try{await s.unlink(i),t.push(e)}catch(n){if(n.code!=="ENOENT")return{success:!1,error:l(n)}}}return{success:!0,uninstalled:t}}catch(t){return{success:!1,error:l(t)}}}async checkInstallation(){return await this.detectActiveProvider()?{installed:!0,providerDetected:!0,commands:[],path:this.commandsPath}:{installed:!1,providerDetected:!1}}async getInstallPath(){return await this.ensureInit(),this.commandsPath}async syncCommands(t){if(!await this.detectActiveProvider(t))return{success:!1,error:"AI agent not detected",added:0,updated:0,removed:0};try{return{success:!0,added:0,updated:0,removed:await this.cleanupRouter()?1:0}}catch(i){return{success:!1,error:l(i),added:0,updated:0,removed:0}}}async cleanupRouter(){return await this.ensureInit(),(await Promise.all(["p.md","p.toml"].map(async e=>{try{return await s.unlink(o.join(this.commandsPath,e)),!0}catch{return!1}}))).some(Boolean)}async cleanupLegacyCommands(){await this.ensureInit();let t=o.join(this.commandsPath,"p");try{if((await s.stat(t).catch(()=>null))?.isDirectory())return await s.rm(t,{recursive:!0,force:!0}),!0}catch{}return!1}async installGlobalConfig(t){return v(t)}async cleanupAllLegacy(){let t=E(),e=[],i=[o.join(t,".claude","commands","p.md"),o.join(t,".claude","commands","p.toml"),o.join(t,".gemini","commands","p.md"),o.join(t,".gemini","commands","p.toml")];for(let r of i)try{await s.unlink(r),e.push(r)}catch{}let n=[o.join(t,".claude","commands","p"),o.join(t,".gemini","commands","p")];for(let r of n)try{(await s.stat(r).catch(()=>null))?.isDirectory()&&(await s.rm(r,{recursive:!0,force:!0}),e.push(r))}catch{}let m=[o.join(t,".prjct-cli","config","homebrew-migrated")];for(let r of m)try{await s.unlink(r),e.push(r)}catch{}return{cleaned:e}}};function it(){return{claude:{commands:a(".claude","commands"),config:a(".claude"),router:a(".claude","commands","p.md")},gemini:{commands:a(".gemini","commands"),config:a(".gemini"),router:a(".gemini","commands","p.toml")}}}c(it,"getProviderPaths");var H=new w,st=H;export{ot as a,w as b,it as c,st as d};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{i as c}from"./chunk-7QMBIMEX.mjs";import{d as s}from"./chunk-FOWTB762.mjs";import{a as m}from"./chunk-7CI4AMVO.mjs";import{a as u}from"./chunk-UYMZ3NAF.mjs";import{h as i}from"./chunk-ID2C2S33.mjs";import{a as f}from"./chunk-RACISWUV.mjs";import{b as l}from"./chunk-3USVY66O.mjs";import{a as o}from"./chunk-3TRXQAU4.mjs";async function k(t,r={}){let e=await l.getProjectId(t);return e?{ok:!0,value:e}:(r.md?console.log("> No project ID found. Run `prjct init` first."):i.failWithHint("NO_PROJECT_ID"),{ok:!1,result:{success:!1,error:"No project ID found"}})}o(k,"requireProjectId");async function C(t,r={}){let e=await m.ensureInit(t);return e.success?k(t,r):{ok:!1,result:e}}o(C,"requireProject");async function T(t,r={},e=process.cwd()){let n=await c(t,e);return n?{ok:!0,value:n}:{ok:!1,result:s('No active work cycle \u2014 start one with `prjct work "<intent>"`',r)}}o(T,"requireActiveTask");function O(t,r,e={}){if(r&&u.getWorkflow(t,r)?.enabled)return{ok:!0,value:{name:r}};let p=u.getAllWorkflows(t).map(a=>a.name).join(", ");return{ok:!1,result:s(`Workflow '${r??""}' not found. Available: ${p}`,e)}}o(O,"requireWorkflow");function P(t,r={}){let e=f(t,{force:r.force});return e.allow?{ok:!0}:(i.fail(e.denyMessage),{ok:!1,result:{success:!1,error:e.kind==="secrets"?"Secret-like content detected":e.kind==="prompt_injection"?"Prompt-injection-like content detected":e.reason}})}o(P,"requireTrustedMemoryContent");export{k as a,C as b,T as c,O as d,P as e};
7
+ import{i as c}from"./chunk-UAYTDSYG.mjs";import{d as s}from"./chunk-FOWTB762.mjs";import{a as m}from"./chunk-6U3CYLY5.mjs";import{a as u}from"./chunk-UYMZ3NAF.mjs";import{h as i}from"./chunk-ID2C2S33.mjs";import{a as f}from"./chunk-RACISWUV.mjs";import{b as l}from"./chunk-XSZOHNL4.mjs";import{a as o}from"./chunk-3TRXQAU4.mjs";async function k(t,r={}){let e=await l.getProjectId(t);return e?{ok:!0,value:e}:(r.md?console.log("> No project ID found. Run `prjct init` first."):i.failWithHint("NO_PROJECT_ID"),{ok:!1,result:{success:!1,error:"No project ID found"}})}o(k,"requireProjectId");async function C(t,r={}){let e=await m.ensureInit(t);return e.success?k(t,r):{ok:!1,result:e}}o(C,"requireProject");async function T(t,r={},e=process.cwd()){let n=await c(t,e);return n?{ok:!0,value:n}:{ok:!1,result:s('No active work cycle \u2014 start one with `prjct work "<intent>"`',r)}}o(T,"requireActiveTask");function O(t,r,e={}){if(r&&u.getWorkflow(t,r)?.enabled)return{ok:!0,value:{name:r}};let p=u.getAllWorkflows(t).map(a=>a.name).join(", ");return{ok:!1,result:s(`Workflow '${r??""}' not found. Available: ${p}`,e)}}o(O,"requireWorkflow");function P(t,r={}){let e=f(t,{force:r.force});return e.allow?{ok:!0}:(i.fail(e.denyMessage),{ok:!1,result:{success:!1,error:e.kind==="secrets"?"Secret-like content detected":e.kind==="prompt_injection"?"Prompt-injection-like content detected":e.reason}})}o(P,"requireTrustedMemoryContent");export{k as a,C as b,T as c,O as d,P as e};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as E,c as w}from"./chunk-YLYAYRSJ.mjs";import{a as j}from"./chunk-UT425KVX.mjs";import{b as G,c as P}from"./chunk-DOJPSIMG.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";P();import v from"node:fs/promises";import y from"node:path";var k="_prjctManaged";function b(){return process.env.PRJCT_TEST_MODE==="1"?y.join(G(".prjct-tests"),"gemini","settings.json"):G(".gemini","settings.json")}i(b,"getGeminiSettingsPath");function M(){let n=[];for(let e of w)e.event==="SessionStart"?n.push({geminiEvent:"SessionStart",matcher:e.matcher||void 0,subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="UserPromptSubmit"?n.push({geminiEvent:"BeforeAgent",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PreToolUse"&&e.matcher==="Bash"?n.push({geminiEvent:"BeforeTool",matcher:"run_shell_command",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PreToolUse"&&e.matcher==="Edit|Write"?n.push({geminiEvent:"BeforeTool",matcher:"write_file|replace",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PostToolUse"&&e.matcher==="Edit|Write"?n.push({geminiEvent:"AfterTool",matcher:"write_file|replace",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="Stop"?n.push({geminiEvent:"AfterAgent",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="Notification"&&n.push({geminiEvent:"Notification",subcommand:e.subcommand,name:`prjct-${e.subcommand}`});return n}i(M,"geminiHookMaps");function R(n){return E(n,"PRJCT_HOOK_HOST=gemini")}i(R,"hookCommand");function f(n){return n[k]===!0||(n.name?.startsWith("prjct-")??!1)}i(f,"isPrjctHandler");function h(n){if(n[k]===!0)return!1;let e=n.command?.trim()??"";return/(^|\/|\s)prjct\s+hook\s+\S+/.test(e)||/PRJCT_HOOK_HOST=gemini/.test(e)}i(h,"isLegacyPrjctHandler");async function S(n){try{let e=await v.readFile(n,"utf-8"),o=JSON.parse(e);return o&&typeof o=="object"?o:{}}catch(e){if(e.code==="ENOENT")return{};throw e}}i(S,"readSettings");async function H(n,e){await v.mkdir(y.dirname(n),{recursive:!0}),await v.writeFile(n,`${JSON.stringify(e,null,2)}
7
+ import{a as E,c as w}from"./chunk-YLYAYRSJ.mjs";import{b as j}from"./chunk-DW4QMD6J.mjs";import{b as G,c as P}from"./chunk-DOJPSIMG.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";P();import v from"node:fs/promises";import y from"node:path";var k="_prjctManaged";function b(){return process.env.PRJCT_TEST_MODE==="1"?y.join(G(".prjct-tests"),"gemini","settings.json"):G(".gemini","settings.json")}i(b,"getGeminiSettingsPath");function M(){let n=[];for(let e of w)e.event==="SessionStart"?n.push({geminiEvent:"SessionStart",matcher:e.matcher||void 0,subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="UserPromptSubmit"?n.push({geminiEvent:"BeforeAgent",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PreToolUse"&&e.matcher==="Bash"?n.push({geminiEvent:"BeforeTool",matcher:"run_shell_command",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PreToolUse"&&e.matcher==="Edit|Write"?n.push({geminiEvent:"BeforeTool",matcher:"write_file|replace",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PostToolUse"&&e.matcher==="Edit|Write"?n.push({geminiEvent:"AfterTool",matcher:"write_file|replace",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="Stop"?n.push({geminiEvent:"AfterAgent",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="Notification"&&n.push({geminiEvent:"Notification",subcommand:e.subcommand,name:`prjct-${e.subcommand}`});return n}i(M,"geminiHookMaps");function R(n){return E(n,"PRJCT_HOOK_HOST=gemini")}i(R,"hookCommand");function f(n){return n[k]===!0||(n.name?.startsWith("prjct-")??!1)}i(f,"isPrjctHandler");function h(n){if(n[k]===!0)return!1;let e=n.command?.trim()??"";return/(^|\/|\s)prjct\s+hook\s+\S+/.test(e)||/PRJCT_HOOK_HOST=gemini/.test(e)}i(h,"isLegacyPrjctHandler");async function S(n){try{let e=await v.readFile(n,"utf-8"),o=JSON.parse(e);return o&&typeof o=="object"?o:{}}catch(e){if(e.code==="ENOENT")return{};throw e}}i(S,"readSettings");async function H(n,e){await v.mkdir(y.dirname(n),{recursive:!0}),await v.writeFile(n,`${JSON.stringify(e,null,2)}
8
8
  `,"utf-8")}i(H,"writeSettings");function O(n){return{type:"command",command:R(n.subcommand),name:n.name,timeout:3e4,description:`prjct ${n.subcommand} (managed)`,[k]:!0}}i(O,"handlerFor");function _(n){let e=new Set(M().map(r=>r.name)),o=[];for(let r of Object.keys(n)){let s=[];for(let m of n[r]??[])m.hooks=m.hooks.filter(t=>!f(t)&&!h(t)||t.name&&e.has(t.name)?!0:t.name&&!e.has(t.name)||!t.name&&h(t)?(o.push(t),!1):!0),m.hooks.length>0&&s.push(m);s.length>0?n[r]=s:delete n[r]}return o.length}i(_,"pruneOrphans");async function T(n=b()){let e=await S(n),o={...e.mcpServers??{}},r=o.prjct,s=j.prjct,m=JSON.stringify(r)!==JSON.stringify(s);return o.prjct=s,e.mcpServers=o,(m||r===void 0)&&await H(n,e),{path:n,changed:m||r===void 0}}i(T,"ensureGeminiMcpServer");async function x(n=b()){let e=await S(n),o=e.hooks??{},r=[],s=[];for(let t of M()){let p=o[t.geminiEvent]??[],g=t.matcher??"",l=p.find(a=>(a.matcher??"")===g),c=l??{matcher:t.matcher,hooks:[]};l||p.push(c),c.hooks=c.hooks.filter(a=>!h(a)||f(a)),c.hooks=c.hooks.filter(a=>!(h(a)&&!f(a)));let d=O(t),u=c.hooks.find(a=>f(a)&&(a.name===t.name||a.command.includes(t.subcommand)));u?u.command===d.command&&u.timeout===d.timeout?s.push(t):(u.command=d.command,u.timeout=d.timeout,u.name=d.name,u.description=d.description,u[k]=!0,r.push(t)):(c.hooks.push(d),r.push(t)),c.matcher||delete c.matcher,o[t.geminiEvent]=p}let m=_(o);return e.hooks=o,await H(n,e),{path:n,hooksWritten:r.length,alreadyPresent:s.length,hooksPruned:m}}i(x,"installGeminiHooks");async function U(n=b()){let e=await T(n),o=await x(n);return{settingsPath:n,mcpChanged:e.changed,hooksWritten:o.hooksWritten,alreadyPresent:o.alreadyPresent,hooksPruned:o.hooksPruned}}i(U,"installGeminiSettings");async function B(n=b()){let e=await S(n),o=[];if(e.hooks){for(let[s,m]of Object.entries(e.hooks)){let t=[];for(let p of m){let g=p.hooks.filter(l=>f(l)||h(l)?(o.push(l),!1):!0);g.length>0&&t.push({...p,hooks:g})}t.length>0?e.hooks[s]=t:delete e.hooks[s]}Object.keys(e.hooks).length===0&&delete e.hooks}let r=!!e.mcpServers?.prjct;return r&&e.mcpServers&&(delete e.mcpServers.prjct,Object.keys(e.mcpServers).length===0&&delete e.mcpServers),await H(n,e),{settingsPath:n,hooksRemoved:o.length,mcpRemoved:r}}i(B,"uninstallGeminiSettings");export{b as a,M as b,T as c,x as d,U as e,B as f};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as P}from"./chunk-UHXV7MDW.mjs";import{a as y,c as _,d as v}from"./chunk-TILUQF6L.mjs";import{a as h}from"./chunk-Y5SEUYET.mjs";import{a as b}from"./chunk-MG3YN3AI.mjs";import{b as d}from"./chunk-LZC6NGB6.mjs";import{a as f,b as $,f as u,i as L}from"./chunk-DMO3ZFUG.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";$();import m from"node:fs/promises";import g from"node:path";L();function w(t,e){let n=[];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,s=e.payload;return o.stack.ecosystem!==s.stack.ecosystem&&n.push({field:"Ecosystem",type:"changed",before:o.stack.ecosystem,after:s.stack.ecosystem}),(o.stack.packageManager??"")!==(s.stack.packageManager??"")&&n.push({field:"Package manager",type:"changed",before:o.stack.packageManager??"(none)",after:s.stack.packageManager??"(none)"}),S("Languages",o.stack.languages,s.stack.languages,n),S("Frameworks",o.stack.frameworks,s.stack.frameworks,n),S("Key libraries",o.stack.keyLibraries,s.stack.keyLibraries,n),o.stack.hasTests!==s.stack.hasTests&&n.push({field:"Has tests",type:"changed",before:String(o.stack.hasTests),after:String(s.stack.hasTests)}),k("Pattern",o.patterns.map(r=>[r.key,r.name]),s.patterns.map(r=>[r.key,r.name]),n),k("Anti-pattern",o.antiPatterns.map(r=>[r.key,r.issue]),s.antiPatterns.map(r=>[r.key,r.issue]),n),k("Convention",o.conventions.map(r=>[r.key,r.rule]),s.conventions.map(r=>[r.key,r.rule]),n),o.structural.symbols!==s.structural.symbols&&(o.structural.symbols>0||s.structural.symbols>0)&&n.push({field:"Symbols",type:"changed",before:String(o.structural.symbols),after:String(s.structural.symbols)}),o.structural.files!==s.structural.files&&n.push({field:"Files",type:"changed",before:String(o.structural.files),after:String(s.structural.files)}),b(n,t.commitHash,e.commitHash)}c(w,"generateProjectStyleDiff");function M(t){if(!t.hasChanges)return`## Project evolution
7
+ import{a as P}from"./chunk-UHXV7MDW.mjs";import{a as y,c as _,d as v}from"./chunk-TILUQF6L.mjs";import{a as h}from"./chunk-MPU3VM6Z.mjs";import{a as b}from"./chunk-MG3YN3AI.mjs";import{b as d}from"./chunk-B2HY22OD.mjs";import{a as f,b as $,f as u,i as L}from"./chunk-DMO3ZFUG.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";$();import m from"node:fs/promises";import g from"node:path";L();function w(t,e){let n=[];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,s=e.payload;return o.stack.ecosystem!==s.stack.ecosystem&&n.push({field:"Ecosystem",type:"changed",before:o.stack.ecosystem,after:s.stack.ecosystem}),(o.stack.packageManager??"")!==(s.stack.packageManager??"")&&n.push({field:"Package manager",type:"changed",before:o.stack.packageManager??"(none)",after:s.stack.packageManager??"(none)"}),S("Languages",o.stack.languages,s.stack.languages,n),S("Frameworks",o.stack.frameworks,s.stack.frameworks,n),S("Key libraries",o.stack.keyLibraries,s.stack.keyLibraries,n),o.stack.hasTests!==s.stack.hasTests&&n.push({field:"Has tests",type:"changed",before:String(o.stack.hasTests),after:String(s.stack.hasTests)}),k("Pattern",o.patterns.map(r=>[r.key,r.name]),s.patterns.map(r=>[r.key,r.name]),n),k("Anti-pattern",o.antiPatterns.map(r=>[r.key,r.issue]),s.antiPatterns.map(r=>[r.key,r.issue]),n),k("Convention",o.conventions.map(r=>[r.key,r.rule]),s.conventions.map(r=>[r.key,r.rule]),n),o.structural.symbols!==s.structural.symbols&&(o.structural.symbols>0||s.structural.symbols>0)&&n.push({field:"Symbols",type:"changed",before:String(o.structural.symbols),after:String(s.structural.symbols)}),o.structural.files!==s.structural.files&&n.push({field:"Files",type:"changed",before:String(o.structural.files),after:String(s.structural.files)}),b(n,t.commitHash,e.commitHash)}c(w,"generateProjectStyleDiff");function M(t){if(!t.hasChanges)return`## Project evolution
8
8
 
9
9
  No style changes since last sync.`;let e=["## Project evolution (this sync)"];(t.beforeCommit||t.afterCommit)&&e.push(`> \`${C(t.beforeCommit)}\` \u2192 \`${C(t.afterCommit)}\``),e.push(""),e.push(`+${t.summary.added} \xB7 \u2212${t.summary.removed} \xB7 ~${t.summary.changed}`),e.push("");for(let n of t.items.slice(0,20)){let o=n.type==="added"?"+":n.type==="removed"?"\u2212":"~";n.type==="changed"?e.push(`- ${o} **${n.field}**: ${n.before} \u2192 ${n.after}`):n.type==="added"?e.push(`- ${o} **${n.field}**: ${n.after}`):e.push(`- ${o} **${n.field}**: ${n.before}`)}return e.join(`
10
10
  `)}c(M,"formatProjectStyleDiffMd");function C(t){return t?t.length>7?t.slice(0,7):t:"(none)"}c(C,"short");function S(t,e,n,o){let s=new Set(e.map(a=>a.toLowerCase())),r=new Set(n.map(a=>a.toLowerCase()));for(let a of n)s.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(S,"diffStringArray");function k(t,e,n,o){let s=new Map(e),r=new Map(n);for(let[a,i]of r)s.has(a)?s.get(a)!==i&&o.push({field:t,type:"changed",before:s.get(a),after:i}):o.push({field:t,type:"added",after:i});for(let[a,i]of s)r.has(a)||o.push({field:t,type:"removed",before:i})}c(k,"diffKeyed");var A=50;function R(t){let e=(()=>{try{return JSON.parse(t.payload_json)}catch{return I()}})();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(R,"rowToSnapshot");function I(){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(I,"emptyPayload");function D(t){try{let e=u.get(t,"SELECT * FROM project_style_snapshots WHERE is_active = 1 ORDER BY captured_at DESC LIMIT 1");return e?R(e):null}catch{return null}}c(D,"getActiveProjectStyle");function T(t,e=12){try{return u.query(t,"SELECT * FROM project_style_snapshots ORDER BY captured_at DESC LIMIT ?",e).map(R)}catch{return[]}}c(T,"getProjectEvolution");function st(t,e=6){let n=T(t,e);if(n.length===0)return null;let o=["## Project evolution"];if(n.length>=2){let s=n[0],r=n[n.length-1],a=s.patternCount-r.patternCount,i=s.conventionCount-r.conventionCount,p=s.fileCount-r.fileCount;o.push(`Over ${n.length} snapshots: patterns ${j(a)}, conventions ${j(i)}, files ${j(p)}.`)}for(let s of n)o.push(`- ${s.capturedAt.slice(0,10)} \u2014 ${s.summary}`);return o.join(`
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{f as p}from"./chunk-6AFXUX2M.mjs";import{e as f}from"./chunk-X35YYOFE.mjs";import{b as g}from"./chunk-LZC6NGB6.mjs";import{g as m,i as _}from"./chunk-DMO3ZFUG.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";_();var S=8,y=140;function h(d,r){if(r.length===0)return 0;let n=[];try{m.transaction(d,s=>{let i=s.prepare("DELETE FROM memory_embeddings WHERE memory_id = ?"),c=s.prepare("DELETE FROM memory_entries WHERE id = ?"),t=s.prepare("DELETE FROM events WHERE id = ? AND type LIKE 'memory.remember.%'");for(let e of r){try{i.run(e)}catch{}c.run(e).changes&&n.push(e);let a=e.match(/^mem_(\d+)$/);if(a)try{t.run(Number(a[1]))}catch{}}})}catch{return n.length}return n.length}l(h,"hardDeleteEntries");function w(d,r,n){let s=new Map;for(let e of r)s.set(e.type,(s.get(e.type)??0)+1);let i=[...s.entries()].sort((e,o)=>o[1]-e[1]).map(([e,o])=>`${e}\xD7${o}`).join(", "),c=r.map(e=>p(e).replace(/\s+/g," ").trim()).filter(e=>e.length>20).slice(0,S).map(e=>`- ${e.length>y?`${e.slice(0,y-1)}\u2026`:e}`),t=[`Distill of discarded auto-history (${d}).`,`Context synthesis: ${r.length} low-value rows collapsed \u2014 raw history deleted; only this digest remains for the project model.`,`Key data: source=retention-distill; discarded=${r.length}; types=${i}; at=${n}`,"What happened: purged auto-generated / redundant captures that added no excess vs the reference model.","Why it mattered: prevent vault bloat; agents must not re-read detector noise.",`Outcome: ${r.length} raw entries hard-deleted after distillation.`,"Next implication: prefer high-excess judgment; re-run detectors only when code/model changes."];return c.length>0&&t.push(`Sample cues (not full bodies):
7
+ import{g as p}from"./chunk-BUD3R6LF.mjs";import{e as f}from"./chunk-6KNMT46X.mjs";import{b as g}from"./chunk-B2HY22OD.mjs";import{g as m,i as _}from"./chunk-DMO3ZFUG.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";_();var S=8,y=140;function h(d,r){if(r.length===0)return 0;let n=[];try{m.transaction(d,s=>{let i=s.prepare("DELETE FROM memory_embeddings WHERE memory_id = ?"),c=s.prepare("DELETE FROM memory_entries WHERE id = ?"),t=s.prepare("DELETE FROM events WHERE id = ? AND type LIKE 'memory.remember.%'");for(let e of r){try{i.run(e)}catch{}c.run(e).changes&&n.push(e);let a=e.match(/^mem_(\d+)$/);if(a)try{t.run(Number(a[1]))}catch{}}})}catch{return n.length}return n.length}l(h,"hardDeleteEntries");function w(d,r,n){let s=new Map;for(let e of r)s.set(e.type,(s.get(e.type)??0)+1);let i=[...s.entries()].sort((e,o)=>o[1]-e[1]).map(([e,o])=>`${e}\xD7${o}`).join(", "),c=r.map(e=>p(e).replace(/\s+/g," ").trim()).filter(e=>e.length>20).slice(0,S).map(e=>`- ${e.length>y?`${e.slice(0,y-1)}\u2026`:e}`),t=[`Distill of discarded auto-history (${d}).`,`Context synthesis: ${r.length} low-value rows collapsed \u2014 raw history deleted; only this digest remains for the project model.`,`Key data: source=retention-distill; discarded=${r.length}; types=${i}; at=${n}`,"What happened: purged auto-generated / redundant captures that added no excess vs the reference model.","Why it mattered: prevent vault bloat; agents must not re-read detector noise.",`Outcome: ${r.length} raw entries hard-deleted after distillation.`,"Next implication: prefer high-excess judgment; re-run detectors only when code/model changes."];return c.length>0&&t.push(`Sample cues (not full bodies):
8
8
  ${c.join(`
9
9
  `)}`),t.join(" ")}l(w,"buildDistillContent");async function A(d,r,n,s,i){if(s.length<=i)return{discarded:0,digested:!1};let t=[...s].sort((u,b)=>b.rememberedAt.localeCompare(u.rememberedAt)).slice(i);if(t.length===0)return{discarded:0,digested:!1};let e=new Date().toISOString(),o=`auto-distill:${n}`,a=w(n,t,e),E=await g.remember(d,{type:"learning",content:a,tags:{source:"retention-distill",topic:o,capture:"distill-discard-v1",context_schema:"living-v2",synthesis:"deterministic",discarded_count:String(t.length),auto_source:n},provenance:"inferred",projectId:r}).then(()=>!0).catch(()=>!1),D=t.map(u=>u.id);return{discarded:h(r,D),digested:E,digestTopic:o}}l(A,"distillAndDiscardAutoSource");async function v(d,r,n){let s=g.allEntriesForIndex(r),i=new Map;for(let t of s){let e=t.tags?.source;if(!f(e)||e==="retention-distill"||t.tags?.source==="retention-distill")continue;let o=i.get(e)??[];o.push(t),i.set(e,o)}let c=[];for(let[t,e]of i){if(e.length<=n)continue;let o=await A(d,r,t,e,n);c.push(o)}return{discarded:c.reduce((t,e)=>t+e.discarded,0),digests:c.filter(t=>t.digested).length}}l(v,"distillAndDiscardAllAutoSources");function x(d,r,n=1e3){let s=Date.now()-r*864e5;try{let i=m.query(d,`SELECT id, type, content FROM memory_entries
10
10
  WHERE deleted_at IS NOT NULL AND deleted_at < ?
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as p}from"./chunk-PIA26GWG.mjs";import{a as o,b as L}from"./chunk-RP7F67ZT.mjs";import{a as c}from"./chunk-INJ5WT2D.mjs";import{b as e,f as S}from"./chunk-XYDLXF5A.mjs";import{d as a,g as P}from"./chunk-TTN2CFZC.mjs";import{b as s,c as h}from"./chunk-DOJPSIMG.mjs";import{l as m,p as k}from"./chunk-HYIT7MF5.mjs";import{e as l,g as d}from"./chunk-225DWS4D.mjs";import{a as n}from"./chunk-3TRXQAU4.mjs";S();d();k();import I from"node:fs/promises";import u from"node:path";L();P();h();var E="prjct-pi-skill";function f(){return process.env.PRJCT_TEST_MODE==="1"?u.join(s(".prjct-tests"),"pi","agent","skills","prjct","SKILL.md"):s(".pi","agent","skills","prjct","SKILL.md")}n(f,"getPiSkillPath");function A(){return f()}n(A,"getPiSkillInstallPath");function w(t){return`<!-- ${E}: ${JSON.stringify({v:a,h:t})} -->`}n(w,"getPiSkillMetadata");function K(t){return c(t).slice(0,12)}n(K,"hashContent");async function x(){return e("pi/SKILL.md")??e("codex/SKILL.md")}n(x,"loadPiSkillTemplate");function C(t){let r=t.trimEnd(),i=K(r),g=w(i);return{content:`${r}
7
+ import{a as p}from"./chunk-PIA26GWG.mjs";import{a as o,b as L}from"./chunk-RP7F67ZT.mjs";import{a as c}from"./chunk-INJ5WT2D.mjs";import{b as e,f as S}from"./chunk-OE27RFLJ.mjs";import{d as a,g as P}from"./chunk-XWLTEAGN.mjs";import{b as s,c as h}from"./chunk-DOJPSIMG.mjs";import{l as m,p as k}from"./chunk-HYIT7MF5.mjs";import{e as l,g as d}from"./chunk-225DWS4D.mjs";import{a as n}from"./chunk-3TRXQAU4.mjs";S();d();k();import I from"node:fs/promises";import u from"node:path";L();P();h();var E="prjct-pi-skill";function f(){return process.env.PRJCT_TEST_MODE==="1"?u.join(s(".prjct-tests"),"pi","agent","skills","prjct","SKILL.md"):s(".pi","agent","skills","prjct","SKILL.md")}n(f,"getPiSkillPath");function A(){return f()}n(A,"getPiSkillInstallPath");function w(t){return`<!-- ${E}: ${JSON.stringify({v:a,h:t})} -->`}n(w,"getPiSkillMetadata");function K(t){return c(t).slice(0,12)}n(K,"hashContent");async function x(){return e("pi/SKILL.md")??e("codex/SKILL.md")}n(x,"loadPiSkillTemplate");function C(t){let r=t.trimEnd(),i=K(r),g=w(i);return{content:`${r}
8
8
 
9
9
  ${g}
10
10
  `,templateHash:i}}n(C,"buildPiSkillContent");async function H(){try{let t=f();await I.mkdir(u.dirname(t),{recursive:!0});let r=await m(t),i=await x();return i?await p({skillMdPath:t,skillExists:r,templateContent:i,build:C,logLabel:"Pi"}):(o.warn("Pi SKILL.md template not found"),{success:!1,action:null})}catch(t){return o.warn(`Pi skill warning: ${l(t)}`),{success:!1,action:null}}}n(H,"installPiSkill");export{A as a,C as b,H as c};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{c as t}from"./chunk-F2FKQUYE.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-FK7FC3PE.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};
7
+ import{c as t}from"./chunk-F2FKQUYE.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-KFYL5NT4.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};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as p,b as o,d as c,f as s}from"./chunk-DW4QMD6J.mjs";import{b as i,c as g}from"./chunk-DOJPSIMG.mjs";import{a as n}from"./chunk-3TRXQAU4.mjs";g();import{existsSync as m}from"node:fs";import a from"node:path";function u(){return process.env.PRJCT_TEST_MODE==="1"?[i(".prjct-tests","kimi-code"),i(".prjct-tests","kimi")]:[i(".kimi-code"),i(".kimi")]}n(u,"kimiHomeDirs");function v(){return u().map(t=>a.join(t,"mcp.json"))}n(v,"getKimiMcpConfigPaths");function h(){let[t,e]=u(),r=m(e)&&!m(t)?e:t;return a.join(r,"mcp.json")}n(h,"getKimiMcpConfigPath");async function M(t=h()){let e=await c("context7",o.context7,t),r=await c("prjct",p(),t);return{path:t,changed:e.changed||r.changed}}n(M,"ensureKimiMcpServer");async function S(){let t=await Promise.all(v().map(async e=>{let r=await s("prjct",e),d=await s("context7",e,o.context7);return{path:e,removed:(r.changed?1:0)+(d.changed?1:0)}}));return{paths:t.filter(e=>e.removed>0).map(e=>e.path),serversRemoved:t.reduce((e,r)=>e+r.removed,0)}}n(S,"uninstallKimiMcpServer");export{v as a,h as b,M as c,S as d};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as b,b as m}from"./chunk-6OYLZ4NM.mjs";import{a as u,b as g}from"./chunk-YEALP3WX.mjs";import{b as f}from"./chunk-LZC6NGB6.mjs";import{a as d}from"./chunk-3TRXQAU4.mjs";function M(o,i,s=8){let r=i.map(e=>e.trim()).filter(Boolean),h=!!g(o),l=!!m(o),c=new Map;if(r.length>0&&h)try{for(let e of u(r,g(o),2)){if(r.some(n=>n.endsWith(e.path)||e.path.endsWith(n)))continue;let t=c.get(e.path)??{score:0,via:new Set};t.score+=e.score,t.via.add("imports"),c.set(e.path,t)}}catch{}if(r.length>0&&l)try{for(let e of b(r,m(o))){if(r.some(n=>n.endsWith(e.path)||e.path.endsWith(n)))continue;let t=c.get(e.path)??{score:0,via:new Set};t.score+=e.score,t.via.add("cochange"),c.set(e.path,t)}}catch{}let p=[...c.entries()].map(([e,t])=>({path:e,score:t.score,via:t.via.size>1?"both":[...t.via][0]??"imports"})).sort((e,t)=>t.score-e.score).slice(0,s),a=[];for(let e of r.slice(0,5))try{let t=f.recallForFile(o,e,2,{preventiveOnly:!0});for(let n of t)a.push({id:n.id,type:n.type,title:n.content.replace(/\s+/g," ").trim().slice(0,100),file:e})}catch{}let $=p.length>0?`related=${p.slice(0,3).map(e=>e.path.split("/").pop()).join(",")}`:h||l?"related=none-strong":"indexes=cold",v=a.length>0?`traps=${a.length}`:"traps=0",y=r.length===0?"World model: no seed files":`World model impact: seeds=${r.length} \xB7 ${$} \xB7 ${v}`;return{seeds:r,neighbors:p,traps:a.slice(0,s),line:y,hasIndexes:{imports:h,cochange:l}}}d(M,"breakImpact");function S(o){if(o.seeds.length===0)return"";let i=["# prjct: world-model impact",o.line,""];if(o.neighbors.length>0){i.push("Related (imports/co-change):");for(let s of o.neighbors.slice(0,6))i.push(`- \`${s.path}\` (${s.via}, score=${s.score.toFixed(2)})`);i.push("")}if(o.traps.length>0){i.push("Judgment on seed files:");for(let s of o.traps.slice(0,5))i.push(`- **[${s.type}]** ${s.title} \`${s.id}\``)}return i.join(`
7
+ import{a as b,b as m}from"./chunk-6OYLZ4NM.mjs";import{a as u,b as g}from"./chunk-YEALP3WX.mjs";import{b as f}from"./chunk-B2HY22OD.mjs";import{a as d}from"./chunk-3TRXQAU4.mjs";function M(o,i,s=8){let r=i.map(e=>e.trim()).filter(Boolean),h=!!g(o),l=!!m(o),c=new Map;if(r.length>0&&h)try{for(let e of u(r,g(o),2)){if(r.some(n=>n.endsWith(e.path)||e.path.endsWith(n)))continue;let t=c.get(e.path)??{score:0,via:new Set};t.score+=e.score,t.via.add("imports"),c.set(e.path,t)}}catch{}if(r.length>0&&l)try{for(let e of b(r,m(o))){if(r.some(n=>n.endsWith(e.path)||e.path.endsWith(n)))continue;let t=c.get(e.path)??{score:0,via:new Set};t.score+=e.score,t.via.add("cochange"),c.set(e.path,t)}}catch{}let p=[...c.entries()].map(([e,t])=>({path:e,score:t.score,via:t.via.size>1?"both":[...t.via][0]??"imports"})).sort((e,t)=>t.score-e.score).slice(0,s),a=[];for(let e of r.slice(0,5))try{let t=f.recallForFile(o,e,2,{preventiveOnly:!0});for(let n of t)a.push({id:n.id,type:n.type,title:n.content.replace(/\s+/g," ").trim().slice(0,100),file:e})}catch{}let $=p.length>0?`related=${p.slice(0,3).map(e=>e.path.split("/").pop()).join(",")}`:h||l?"related=none-strong":"indexes=cold",v=a.length>0?`traps=${a.length}`:"traps=0",y=r.length===0?"World model: no seed files":`World model impact: seeds=${r.length} \xB7 ${$} \xB7 ${v}`;return{seeds:r,neighbors:p,traps:a.slice(0,s),line:y,hasIndexes:{imports:h,cochange:l}}}d(M,"breakImpact");function S(o){if(o.seeds.length===0)return"";let i=["# prjct: world-model impact",o.line,""];if(o.neighbors.length>0){i.push("Related (imports/co-change):");for(let s of o.neighbors.slice(0,6))i.push(`- \`${s.path}\` (${s.via}, score=${s.score.toFixed(2)})`);i.push("")}if(o.traps.length>0){i.push("Judgment on seed files:");for(let s of o.traps.slice(0,5))i.push(`- **[${s.type}]** ${s.title} \`${s.id}\``)}return i.join(`
8
8
  `).trim()}d(S,"formatImpactMd");export{M as a,S as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'module';
2
+ import { fileURLToPath as __fileURLToPath } from 'url';
3
+ import { dirname as __pathDirname } from 'path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{f as l,i as R}from"./chunk-DMO3ZFUG.mjs";import{e as h,l as L}from"./chunk-HU5ERAAV.mjs";import{a as d}from"./chunk-3TRXQAU4.mjs";L();R();function T(o,n,t){let a=o.prepare("INSERT INTO analysis_finding (id, analysis_id, kind, title, detail, severity, sort_order) VALUES (?, ?, ?, ?, ?, ?, ?)"),e=[],i=d((s,r,y,S)=>{if(!r)return;let _=e.length,p=`${n}-f${_}`;a.run(p,n,s,r,y,S,_),e.push(p)},"addFinding");for(let s of t.patterns??[])i("pattern",s.name,s.description,null);for(let s of t.antiPatterns??[])i("anti_pattern",s.issue,s.suggestion,s.severity);for(let s of t.techDebt??[])i("tech_debt",s.description,`${s.area}: ${s.impact}`,s.priority);for(let s of t.riskAreas??[])i("risk_area",s.path,`${s.reason} \u2014 ${s.risk}`,s.severity);for(let s of t.refactorSuggestions??[])i("refactor",s.description,s.benefit,null);let m=new Set;for(let s of[...t.projectInsights??[],...t.architecture?.insights??[]]){let r=s.toLowerCase();m.has(r)||(m.add(r),i("insight",s,null,null))}let c=o.prepare("INSERT INTO analysis_convention (id, analysis_id, rule, sort_order) VALUES (?, ?, ?, ?)");(t.conventions??[]).forEach((s,r)=>{c.run(`${n}-c${r}`,n,s.rule,r)});let g=o.prepare("INSERT INTO analysis_stack_item (id, analysis_id, kind, name) VALUES (?, ?, ?, ?)");[...(t.stack?.languages??[]).map(s=>({kind:"language",name:s})),...(t.stack?.frameworks??[]).map(s=>({kind:"framework",name:s}))].forEach((s,r)=>{g.run(`${n}-s${r}`,n,s.kind,s.name)});let f=o.prepare("INSERT INTO analysis_command (id, analysis_id, name, command, purpose) VALUES (?, ?, ?, ?, ?)");Object.entries(t.commands??{}).filter(s=>!!s[1]).forEach(([s,r],y)=>{f.run(`${n}-cmd${y}`,n,s,r,null)});let A=o.prepare("INSERT INTO analysis_domain (id, analysis_id, name, paths) VALUES (?, ?, ?, ?)");(t.architecture?.domains??[]).forEach((s,r)=>{A.run(`${n}-d${r}`,n,s,null)})}d(T,"writeAnalysisChildren");var E=class{static{d(this,"LLMAnalysisStorage")}save(n,t){let a=l.getDb(n),e=h();a.transaction(()=>{a.prepare("UPDATE llm_analysis SET status = 'superseded', superseded_at = ? WHERE status = 'active'").run(e);let i=a.prepare("INSERT INTO llm_analysis (commit_hash, status, analysis, analyzed_at) VALUES (?, ?, ?, ?)").run(t.commitHash??null,"active",JSON.stringify(t),t.analyzedAt);T(a,String(i.lastInsertRowid),t)})()}getActiveRelational(n){let t=l.get(n,"SELECT id FROM llm_analysis WHERE status = 'active' LIMIT 1");if(!t)return null;let a=String(t.id),e=l.query(n,"SELECT kind, title, detail FROM analysis_finding WHERE analysis_id = ? ORDER BY kind, sort_order",a),i=l.query(n,"SELECT rule FROM analysis_convention WHERE analysis_id = ? ORDER BY sort_order",a).map(u=>u.rule),m=l.query(n,"SELECT kind, name FROM analysis_stack_item WHERE analysis_id = ?",a),c=l.query(n,"SELECT name FROM analysis_domain WHERE analysis_id = ?",a).map(u=>u.name),g=l.query(n,"SELECT name, command FROM analysis_command WHERE analysis_id = ?",a);return e.length===0&&i.length===0&&m.length===0?null:{findings:e,conventions:i,stack:m,domains:c,commands:g}}getActive(n){let t=l.get(n,"SELECT analysis FROM llm_analysis WHERE status = 'active' LIMIT 1");return t?JSON.parse(t.analysis):null}getActiveSummary(n){let t=this.getActive(n);return t?{commitHash:t.commitHash,architectureStyle:t.architecture.style,patternCount:t.patterns.length,antiPatternCount:t.antiPatterns.length,analyzedAt:t.analyzedAt}:null}isCurrent(n,t){return t?l.get(n,"SELECT commit_hash FROM llm_analysis WHERE status = 'active' LIMIT 1")?.commit_hash===t:!1}getAllFull(n){return l.query(n,"SELECT id, commit_hash, status, analyzed_at, superseded_at, analysis FROM llm_analysis ORDER BY id DESC").map(a=>({id:a.id,status:a.status,commitHash:a.commit_hash,analyzedAt:a.analyzed_at,supersededAt:a.superseded_at,analysis:JSON.parse(a.analysis)}))}getArchiveSummaries(n,t){let a=l.get(n,"SELECT COUNT(*) AS c FROM llm_analysis WHERE status = 'superseded'")?.c??0,e=l.query(n,"SELECT id, commit_hash, analyzed_at, superseded_at, analysis FROM llm_analysis WHERE status = 'superseded' ORDER BY id DESC LIMIT ?",t);return{total:a,entries:e.map(i=>({id:i.id,commitHash:i.commit_hash,analyzedAt:i.analyzed_at,supersededAt:i.superseded_at,analysis:JSON.parse(i.analysis)}))}}getHistory(n,t=10){return l.query(n,"SELECT id, commit_hash, status, analyzed_at, analysis FROM llm_analysis ORDER BY id DESC LIMIT ?",t).map(e=>{let i=JSON.parse(e.analysis);return{id:e.id,commitHash:e.commit_hash,status:e.status,analyzedAt:e.analyzed_at,patternCount:i.patterns.length}})}},O=new E,C=O;export{C as a};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as P,b as v}from"./chunk-76YMLNLF.mjs";import{b as y}from"./chunk-3USVY66O.mjs";import{F as f,G as S,e as g,l as M}from"./chunk-HU5ERAAV.mjs";import{e as h,g as k}from"./chunk-225DWS4D.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";var b=class{static{l(this,"PrjctCommands")}_workflow;workflowG(){return this._workflow??=import("./workflow-FGJVLRQ3.mjs").then(e=>new e.WorkflowCommands).catch(e=>{throw this._workflow=void 0,e})}_planning;planningG(){return this._planning??=import("./planning-S3MYVWH6.mjs").then(e=>new e.PlanningCommands).catch(e=>{throw this._planning=void 0,e})}_shipping;shippingG(){return this._shipping??=import("./shipping-I4D4AVTE.mjs").then(e=>new e.ShippingCommands).catch(e=>{throw this._shipping=void 0,e})}_analysis;analysisG(){return this._analysis??=import("./analysis-3A7ODSSI.mjs").then(e=>new e.AnalysisCommands).catch(e=>{throw this._analysis=void 0,e})}_setupCmds;setupCmdsG(){return this._setupCmds??=import("./setup-GHS24ER5.mjs").then(e=>new e.SetupCommands).catch(e=>{throw this._setupCmds=void 0,e})}_updateCmds;updateCmdsG(){return this._updateCmds??=import("./update-4IE6SA6M.mjs").then(e=>new e.UpdateCommands).catch(e=>{throw this._updateCmds=void 0,e})}_contextCmds;contextCmdsG(){return this._contextCmds??=import("./context-DDHC7VIC.mjs").then(e=>new e.ContextCommands).catch(e=>{throw this._contextCmds=void 0,e})}_primitivesCmds;primitivesCmdsG(){return this._primitivesCmds??=import("./primitives-IXAYLX7U.mjs").then(e=>new e.PrimitiveCommands).catch(e=>{throw this._primitivesCmds=void 0,e})}_seedCmds;seedCmdsG(){return this._seedCmds??=import("./seed-JX7W53E5.mjs").then(e=>new e.SeedCommands).catch(e=>{throw this._seedCmds=void 0,e})}_installCmds;installCmdsG(){return this._installCmds??=import("./install-XP4S6HWQ.mjs").then(e=>new e.InstallCommands).catch(e=>{throw this._installCmds=void 0,e})}_captureCmds;captureCmdsG(){return this._captureCmds??=import("./capture-7LQ52T6L.mjs").then(e=>new e.CaptureCommands).catch(e=>{throw this._captureCmds=void 0,e})}_mcpCmds;mcpCmdsG(){return this._mcpCmds??=import("./mcp-FLVIZBV2.mjs").then(e=>new e.McpCommands).catch(e=>{throw this._mcpCmds=void 0,e})}_teamCmds;teamCmdsG(){return this._teamCmds??=import("./team-XZ4Q6UBV.mjs").then(e=>new e.TeamCommands).catch(e=>{throw this._teamCmds=void 0,e})}_configCmds;configCmdsG(){return this._configCmds??=import("./config-W3RHV3GK.mjs").then(e=>new e.ConfigCommands).catch(e=>{throw this._configCmds=void 0,e})}_embeddingsCmds;embeddingsCmdsG(){return this._embeddingsCmds??=import("./embeddings-7A5Z5I67.mjs").then(e=>new e.EmbeddingsCommands).catch(e=>{throw this._embeddingsCmds=void 0,e})}_guardCmds;guardCmdsG(){return this._guardCmds??=import("./guard-FJBJ6IAE.mjs").then(e=>new e.GuardCommands).catch(e=>{throw this._guardCmds=void 0,e})}_specCmds;specCmdsG(){return this._specCmds??=import("./spec-2XXPLHUZ.mjs").then(e=>new e.SpecCommands).catch(e=>{throw this._specCmds=void 0,e})}agent;agentInfo;currentAuthor;prjctDir;constructor(){this.agent=null,this.agentInfo=null,this.currentAuthor=null,this.prjctDir=".prjct"}async task(e=null,t=process.cwd(),n={}){return(await this.workflowG()).now(e,t,n)}async workflowPrefs(e=null,t=process.cwd(),n={}){return(await this.workflowG()).workflow(e,t,n)}async init(e=null,t=process.cwd()){return(await this.planningG()).init(e,t)}async ship(e,t=process.cwd(),n={}){return(await this.shippingG()).ship(e,t,{...n})}async analyze(e={},t=process.cwd()){return(await this.analysisG()).analyze(e,t)}async sync(e=process.cwd(),t={}){return(await this.analysisG()).sync(e,t)}async saveLlmAnalysis(e,t=process.cwd(),n={}){return(await this.analysisG()).saveLlmAnalysis(e,t,n)}async context(e=null,t=process.cwd(),n={}){return(await this.contextCmdsG()).context(e,t,n)}async search(e=null,t=process.cwd(),n={}){return(await this.contextCmdsG()).search(e,t,n)}async status(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).status(e,t,n)}async tag(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).tag(e,t,n)}async remember(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).remember(e,t,n)}async forget(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).forget(e,t,n)}async close(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).close(e,t,n)}async seed(e=null,t=process.cwd(),n={}){return(await this.seedCmdsG()).seed(e,t,n)}async install(e=null,t=process.cwd(),n={}){return(await this.installCmdsG()).install(null,t,n)}async capture(e=null,t=process.cwd(),n={}){return(await this.captureCmdsG()).capture(e,t,n)}async mcp(e=null,t=process.cwd(),n={}){return(await this.mcpCmdsG()).mcp(e,t,n)}async team(e=null,t=process.cwd(),n={}){return(await this.teamCmdsG()).team(e,t,n)}async config(e=null,t=process.cwd(),n={}){return(await this.configCmdsG()).config(e,t,n)}async embeddings(e=null,t=process.cwd(),n={}){return(await this.embeddingsCmdsG()).embeddings(e,t,n)}async guard(e=null,t=process.cwd(),n={}){return(await this.guardCmdsG()).guard(e,t,n)}async auth(e=null,t={}){return(await this.setupCmdsG()).auth(e,t)}async login(e={}){return(await this.setupCmdsG()).login(e)}async logout(){return(await this.setupCmdsG()).logout()}async start(){return(await this.setupCmdsG()).start()}async setup(e={}){return(await this.setupCmdsG()).setup(e)}async update(e={},t=process.cwd()){return(await this.updateCmdsG()).update(e,t)}async installStatusLine(){return(await this.setupCmdsG()).installStatusLine()}async initializeAgent(){return(await this.workflowG()).initializeAgent()}async ensureProjectInit(e){return(await this.workflowG()).ensureProjectInit(e)}async ensureAuthor(){return(await this.workflowG()).ensureAuthor()}async getGlobalProjectPath(e){return(await this.workflowG()).getGlobalProjectPath(e)}async logToMemory(e,t,n){return(await this.workflowG()).logToMemory(e,t,n)}async spec(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).draft(e,t,n)}async specList(e=process.cwd(),t={}){return(await this.specCmdsG()).list(null,e,t)}async specShow(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).show(e,t,n)}async specUpdate(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).update(e,t,n)}async specApplyDelta(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).applyDelta(e,t,n)}async specSetStatus(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).setStatus(e,t,n)}async specRecordReview(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).recordReview(e,t,n)}async specLinkTask(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).linkTask(e,t,n)}async specShip(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).ship(e,t,n)}async specAudit(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).audit(e,t,n)}async specValidate(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).validate(e,t,n)}async specBreakdown(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).breakdown(e,t,n)}async specInventory(e=process.cwd(),t={}){return(await this.specCmdsG()).inventory(null,e,t)}};S();k();M();var w=class{static{l(this,"CommandRegistry")}handlers=new Map;handlerFns=new Map;optionFns=new Map;lazyResetters=[];metadata=new Map;categories=new Map;noProjectCommands=new Set(["init","setup","start","migrateAll"]);register(e,t){this.handlers.set(e.name,e),this.setMeta(e.name,t)}registerFn(e,t,n){this.handlerFns.set(e,t),this.setMeta(e,n)}setMeta(e,t){let n=t?.requiresProject??!this.noProjectCommands.has(e);this.metadata.set(e,{name:e,group:t?.group??"unknown",surface:t?.surface,description:t?.description??"",requiresProject:n,usage:t?.usage??{claude:null,terminal:null},implemented:t?.implemented??!0,hasTemplate:t?.hasTemplate??!1,params:t?.params,blockingRules:t?.blockingRules,features:t?.features,isOptional:t?.isOptional,deprecated:t?.deprecated,replacedBy:t?.replacedBy,routingMode:t?.routingMode,optionSchema:t?.optionSchema})}registerCategory(e,t){this.categories.set(e,t)}registerLazyMethod(e,t,n,s){let i=[];this.lazyResetters.push(()=>{i.length=0});let o=l(async()=>{let d=i.at(-1);if(d)return d;let u=await t(),c=u[n];if(typeof c!="function")throw new Error(`${n} is not a function`);let p={instance:u,method:c};return i.push(p),p},"resolve"),m=l(async(d,u)=>{let{instance:c,method:p}=await o();return d!=null?p.call(c,d,u.projectPath):p.call(c,u.projectPath)},"wrapper");this.handlerFns.set(e,m),this.optionFns.set(e,async(d,u,c)=>{let{instance:p,method:G}=await o();return G.call(p,d,u,c)}),this.setMeta(e,s)}resetLazyResolutions(){for(let e of this.lazyResetters)e()}has(e){return this.handlers.has(e)||this.handlerFns.has(e)}list(){return[...this.handlers.keys(),...this.handlerFns.keys()]}listByGroup(e){return Array.from(this.metadata.entries()).filter(([,t])=>t.group===e).map(([t])=>t)}getGroups(){let e=new Set;for(let t of this.metadata.values())e.add(t.group);return Array.from(e)}getMeta(e){return this.metadata.get(e)}getAll(){return Array.from(this.metadata.values())}getByName(e){return this.metadata.get(e)}getByCategory(e){return this.getAll().filter(t=>t.group===e)}getAllImplemented(){return this.getAll().filter(e=>e.implemented)}getAllWithTemplates(){return this.getAll().filter(e=>e.hasTemplate)}getClaudeCommands(){return this.getAll().filter(e=>e.usage.claude!==null)}getTerminalCommands(){return this.getAll().filter(e=>e.usage.terminal!==null)}getAllCategories(){return new Map(this.categories)}getCategory(e){return this.categories.get(e)}getRequiresInit(){return this.getAll().filter(e=>e.requiresProject)}getWithBlockingRules(){return this.getAll().filter(e=>e.blockingRules!==void 0)}getOptionalCommands(){return this.getAll().filter(e=>e.isOptional)}getDeprecatedCommands(){return this.getAll().filter(e=>e.deprecated)}getStats(){let e=this.getAll(),t={};for(let n of this.categories.keys())t[n]=e.filter(s=>s.group===n).length;return{total:e.length,implemented:e.filter(n=>n.implemented).length,withTemplates:e.filter(n=>n.hasTemplate).length,claudeOnly:e.filter(n=>n.usage.claude&&!n.usage.terminal).length,terminalOnly:e.filter(n=>!n.usage.claude&&n.usage.terminal).length,both:e.filter(n=>n.usage.claude&&n.usage.terminal).length,requiresInit:e.filter(n=>n.requiresProject).length,byCategory:t}}validate(){let e=[],t=this.getAll(),n=t.map(m=>m.name),s=n.filter((m,d)=>n.indexOf(m)!==d);s.length>0&&e.push(`Duplicate command names: ${s.join(", ")}`);let i=t.filter(m=>m.hasTemplate&&!m.implemented);i.length>0&&e.push(`Commands with templates but not implemented: ${i.map(m=>m.name).join(", ")}`);let o=Array.from(this.categories.keys());if(o.length>0){let m=t.filter(d=>!o.includes(d.group));m.length>0&&e.push(`Invalid categories: ${m.map(d=>`${d.name}:${d.group}`).join(", ")}`)}return{valid:e.length===0,issues:e}}async buildContext(e){let t=await y.getProjectId(e);if(!t)throw new Error("No prjct project found. Run p. init first.");return{projectId:t,projectPath:e,globalPath:f.getGlobalProjectPath(t),timestamp:g()}}async execute(e,t,n=process.cwd()){let s=this.metadata.get(e),i=await(async()=>{if(s?.requiresProject===!1)return{projectId:"",projectPath:n,globalPath:"",timestamp:g()};try{return await this.buildContext(n)}catch(d){return{success:!1,error:h(d)}}})();if("success"in i)return i;let o=this.handlers.get(e);if(o)return o.execute(t,i);let m=this.handlerFns.get(e);return m?m(t,i):{success:!1,error:`Command not found: ${e}`}}async executeWithOptions(e,t,n,s){let i=this.optionFns.get(e);if(!i)return{success:!1,error:`Command not found: ${e}`};if(this.metadata.get(e)?.requiresProject!==!1)try{await this.buildContext(n)}catch(m){return{success:!1,error:h(m)}}return i(t,n,s)}async executeWithoutProject(e,t,n=process.cwd()){let s=this.handlers.get(e);if(s){let o={projectId:"",projectPath:n,globalPath:"",timestamp:g()};return s.execute(t,o)}let i=this.handlerFns.get(e);if(i){let o={projectId:"",projectPath:n,globalPath:"",timestamp:g()};return i(t,o)}return{success:!1,error:`Command not found: ${e}`}}clear(){this.handlers.clear(),this.handlerFns.clear(),this.metadata.clear(),this.categories.clear()}},C=new w;var R=[];function B(){for(let r of R)r()}l(B,"resetGroupLoaders");function a(r){let e={};return R.push(()=>{delete e.promise}),()=>(e.promise||(e.promise=r().catch(t=>{throw delete e.promise,t})),e.promise)}l(a,"lazy");var A={workflow:a(async()=>new(await import("./workflow-FGJVLRQ3.mjs")).WorkflowCommands),planning:a(async()=>new(await import("./planning-S3MYVWH6.mjs")).PlanningCommands),shipping:a(async()=>new(await import("./shipping-I4D4AVTE.mjs")).ShippingCommands),analysis:a(async()=>new(await import("./analysis-3A7ODSSI.mjs")).AnalysisCommands),setup:a(async()=>new(await import("./setup-GHS24ER5.mjs")).SetupCommands),context:a(async()=>new(await import("./context-DDHC7VIC.mjs")).ContextCommands),primitives:a(async()=>new(await import("./primitives-IXAYLX7U.mjs")).PrimitiveCommands),seed:a(async()=>new(await import("./seed-JX7W53E5.mjs")).SeedCommands),install:a(async()=>new(await import("./install-XP4S6HWQ.mjs")).InstallCommands),capture:a(async()=>new(await import("./capture-7LQ52T6L.mjs")).CaptureCommands),mcp:a(async()=>new(await import("./mcp-FLVIZBV2.mjs")).McpCommands),team:a(async()=>new(await import("./team-XZ4Q6UBV.mjs")).TeamCommands),config:a(async()=>new(await import("./config-W3RHV3GK.mjs")).ConfigCommands),uninstall:a(async()=>new(await import("./uninstall-6NFON7FO.mjs")).UninstallCommands),update:a(async()=>new(await import("./update-4IE6SA6M.mjs")).UpdateCommands),spec:a(async()=>new(await import("./spec-2XXPLHUZ.mjs")).SpecCommands),embeddings:a(async()=>new(await import("./embeddings-7A5Z5I67.mjs")).EmbeddingsCommands),llm:a(async()=>new(await import("./llm-XMH7WTHV.mjs")).LlmCommands),agent:a(async()=>new(await import("./agent-HCP5FF77.mjs")).AgentCommands),guard:a(async()=>new(await import("./guard-FJBJ6IAE.mjs")).GuardCommands),memoryExport:a(async()=>new(await import("./memory-export-27HTNNFI.mjs")).MemoryExportCommands),workflowsReference:a(async()=>new(await import("./workflows-reference-UWKRZ6BJ.mjs")).WorkflowsReferenceCommands),changelog:a(async()=>new(await import("./changelog-CUNVCEL5.mjs")).ChangelogCommands),workGraph:a(async()=>new(await import("./work-graph-JGJWE3AV.mjs")).WorkGraphCommands),ceremonies:a(async()=>new(await import("./ceremonies-4OZ3FKRE.mjs")).CeremonyCommands),lean:a(async()=>new(await import("./lean-L53CKZNH.mjs")).LeanCommands),cloud:a(async()=>new(await import("./cloud-FFUJZLDV.mjs")).CloudCommands),tdd:a(async()=>new(await import("./tdd-NQDHU62B.mjs")).TddCommands),sdd:a(async()=>new(await import("./sdd-HE7O6N5S.mjs")).SddCommands),notify:a(async()=>new(await import("./notify-76B7AICZ.mjs")).NotifyCommands),agents:a(async()=>new(await import("./agents-OAQXBGH3.mjs")).AgentsCommands),product:a(async()=>new(await import("./product-KKGJ6MMF.mjs")).ProductCommands),eval:a(async()=>new(await import("./eval-4YFUBFLV.mjs")).EvalCommands),judgment:a(async()=>new(await import("./judgment-GJE332LF.mjs")).JudgmentCommands),code:a(async()=>new(await import("./code-SU7GCPH6.mjs")).CodeCommands)};function _(){for(let[r,e]of Object.entries(P))C.registerCategory(r,e)}l(_,"registerCategories");function j(){if(!C.has("work")){_();for(let r of v)r.routing&&C.registerLazyMethod(r.name,A[r.routing.group],r.routing.method,r)}}l(j,"registerAllCommands");j();function x(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}l(x,"kebab");function V(r,e){let t=l(s=>r[s]!==void 0?r[s]:r[x(s)],"pick"),n={md:r.md===!0};for(let s of e.booleans??[])n[s]=t(s)===!0;for(let s of e.strings??[]){let i=t(s);n[s]=i!=null&&i!==!1&&i!==""?String(i):void 0}for(let s of e.numbers??[]){let i=t(s),o=i!=null&&i!==!1&&i!==""?Number(i):Number.NaN;n[s]=Number.isNaN(o)?void 0:o}return n}l(V,"mapOptions");var O=new Set(["list","show","update","apply-delta","set-status","record-review","link-task","ship","audit","validate","breakdown","inventory"]),I=new Set(["draft","new","create"]);async function K(r,e,t,n){let s=t.md===!0,i=e[0],o=e.slice(1).join(" ")||null,m=e.join(" ")||null,d={md:s,goal:t.goal?String(t.goal):void 0,tags:t.tags?String(t.tags):void 0};if(i&&I.has(i))return r.spec(o,n,d);if(!i||!O.has(i))return r.spec(m,n,d);switch(i){case"list":return r.specList(n,{md:s,status:t.status?String(t.status):void 0});case"show":return r.specShow(o,n,{md:s});case"update":return r.specUpdate(o,n,{md:s,json:t.json?String(t.json):void 0});case"apply-delta":return r.specApplyDelta(o,n,{md:t.md,file:t.file?String(t.file):void 0});case"set-status":return r.specSetStatus(o,n,{md:s,status:t.status?String(t.status):void 0});case"record-review":return r.specRecordReview(o,n,{md:s,reviewer:t.reviewer?String(t.reviewer):void 0,verdict:t.verdict?String(t.verdict):void 0,notes:t.notes?String(t.notes):void 0});case"link-task":return r.specLinkTask(o,n,{md:s,taskId:t["task-id"]?String(t["task-id"]):void 0});case"ship":return r.specShip(o,n,{md:s,pr:t.pr?String(t.pr):void 0});case"audit":return r.specAudit(o,n,{md:s,lenses:t.lenses?String(t.lenses):void 0,strict:t.strict===!0});case"validate":return r.specValidate(o,n,{md:s,strict:t.strict===!0});case"breakdown":return r.specBreakdown(o,n,{md:s,force:t.force===!0});case"inventory":return r.specInventory(n,{md:s,json:t.json===!0});default:return{success:!1,error:`unknown spec subverb: ${i}`}}}l(K,"routeSpec");export{b as a,C as b,B as c,V as d,K as e};
7
+ import{a as P,b as v}from"./chunk-76YMLNLF.mjs";import{b as y}from"./chunk-XSZOHNL4.mjs";import{F as f,G as S,e as g,l as M}from"./chunk-HU5ERAAV.mjs";import{e as h,g as k}from"./chunk-225DWS4D.mjs";import{a as l}from"./chunk-3TRXQAU4.mjs";var b=class{static{l(this,"PrjctCommands")}_workflow;workflowG(){return this._workflow??=import("./workflow-XM77QYRF.mjs").then(e=>new e.WorkflowCommands).catch(e=>{throw this._workflow=void 0,e})}_planning;planningG(){return this._planning??=import("./planning-NOWLKZDS.mjs").then(e=>new e.PlanningCommands).catch(e=>{throw this._planning=void 0,e})}_shipping;shippingG(){return this._shipping??=import("./shipping-NZVM57JJ.mjs").then(e=>new e.ShippingCommands).catch(e=>{throw this._shipping=void 0,e})}_analysis;analysisG(){return this._analysis??=import("./analysis-OARMM4AH.mjs").then(e=>new e.AnalysisCommands).catch(e=>{throw this._analysis=void 0,e})}_setupCmds;setupCmdsG(){return this._setupCmds??=import("./setup-BL36ZWPW.mjs").then(e=>new e.SetupCommands).catch(e=>{throw this._setupCmds=void 0,e})}_updateCmds;updateCmdsG(){return this._updateCmds??=import("./update-PSHEJJI5.mjs").then(e=>new e.UpdateCommands).catch(e=>{throw this._updateCmds=void 0,e})}_contextCmds;contextCmdsG(){return this._contextCmds??=import("./context-MPHOQPXF.mjs").then(e=>new e.ContextCommands).catch(e=>{throw this._contextCmds=void 0,e})}_primitivesCmds;primitivesCmdsG(){return this._primitivesCmds??=import("./primitives-GNUMBYOK.mjs").then(e=>new e.PrimitiveCommands).catch(e=>{throw this._primitivesCmds=void 0,e})}_seedCmds;seedCmdsG(){return this._seedCmds??=import("./seed-MMDJE2UO.mjs").then(e=>new e.SeedCommands).catch(e=>{throw this._seedCmds=void 0,e})}_installCmds;installCmdsG(){return this._installCmds??=import("./install-FZQJJWT5.mjs").then(e=>new e.InstallCommands).catch(e=>{throw this._installCmds=void 0,e})}_captureCmds;captureCmdsG(){return this._captureCmds??=import("./capture-3JJPWIF3.mjs").then(e=>new e.CaptureCommands).catch(e=>{throw this._captureCmds=void 0,e})}_mcpCmds;mcpCmdsG(){return this._mcpCmds??=import("./mcp-BD5TOTCK.mjs").then(e=>new e.McpCommands).catch(e=>{throw this._mcpCmds=void 0,e})}_teamCmds;teamCmdsG(){return this._teamCmds??=import("./team-WKAAOEFE.mjs").then(e=>new e.TeamCommands).catch(e=>{throw this._teamCmds=void 0,e})}_configCmds;configCmdsG(){return this._configCmds??=import("./config-UVF7YOR6.mjs").then(e=>new e.ConfigCommands).catch(e=>{throw this._configCmds=void 0,e})}_embeddingsCmds;embeddingsCmdsG(){return this._embeddingsCmds??=import("./embeddings-354ZYFKX.mjs").then(e=>new e.EmbeddingsCommands).catch(e=>{throw this._embeddingsCmds=void 0,e})}_guardCmds;guardCmdsG(){return this._guardCmds??=import("./guard-RT7U3LJX.mjs").then(e=>new e.GuardCommands).catch(e=>{throw this._guardCmds=void 0,e})}_specCmds;specCmdsG(){return this._specCmds??=import("./spec-VC3VTUI3.mjs").then(e=>new e.SpecCommands).catch(e=>{throw this._specCmds=void 0,e})}agent;agentInfo;currentAuthor;prjctDir;constructor(){this.agent=null,this.agentInfo=null,this.currentAuthor=null,this.prjctDir=".prjct"}async task(e=null,t=process.cwd(),n={}){return(await this.workflowG()).now(e,t,n)}async workflowPrefs(e=null,t=process.cwd(),n={}){return(await this.workflowG()).workflow(e,t,n)}async init(e=null,t=process.cwd()){return(await this.planningG()).init(e,t)}async ship(e,t=process.cwd(),n={}){return(await this.shippingG()).ship(e,t,{...n})}async analyze(e={},t=process.cwd()){return(await this.analysisG()).analyze(e,t)}async sync(e=process.cwd(),t={}){return(await this.analysisG()).sync(e,t)}async saveLlmAnalysis(e,t=process.cwd(),n={}){return(await this.analysisG()).saveLlmAnalysis(e,t,n)}async context(e=null,t=process.cwd(),n={}){return(await this.contextCmdsG()).context(e,t,n)}async search(e=null,t=process.cwd(),n={}){return(await this.contextCmdsG()).search(e,t,n)}async status(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).status(e,t,n)}async tag(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).tag(e,t,n)}async remember(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).remember(e,t,n)}async forget(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).forget(e,t,n)}async close(e=null,t=process.cwd(),n={}){return(await this.primitivesCmdsG()).close(e,t,n)}async seed(e=null,t=process.cwd(),n={}){return(await this.seedCmdsG()).seed(e,t,n)}async install(e=null,t=process.cwd(),n={}){return(await this.installCmdsG()).install(null,t,n)}async capture(e=null,t=process.cwd(),n={}){return(await this.captureCmdsG()).capture(e,t,n)}async mcp(e=null,t=process.cwd(),n={}){return(await this.mcpCmdsG()).mcp(e,t,n)}async team(e=null,t=process.cwd(),n={}){return(await this.teamCmdsG()).team(e,t,n)}async config(e=null,t=process.cwd(),n={}){return(await this.configCmdsG()).config(e,t,n)}async embeddings(e=null,t=process.cwd(),n={}){return(await this.embeddingsCmdsG()).embeddings(e,t,n)}async guard(e=null,t=process.cwd(),n={}){return(await this.guardCmdsG()).guard(e,t,n)}async auth(e=null,t={}){return(await this.setupCmdsG()).auth(e,t)}async login(e={}){return(await this.setupCmdsG()).login(e)}async logout(){return(await this.setupCmdsG()).logout()}async start(){return(await this.setupCmdsG()).start()}async setup(e={}){return(await this.setupCmdsG()).setup(e)}async update(e={},t=process.cwd()){return(await this.updateCmdsG()).update(e,t)}async installStatusLine(){return(await this.setupCmdsG()).installStatusLine()}async initializeAgent(){return(await this.workflowG()).initializeAgent()}async ensureProjectInit(e){return(await this.workflowG()).ensureProjectInit(e)}async ensureAuthor(){return(await this.workflowG()).ensureAuthor()}async getGlobalProjectPath(e){return(await this.workflowG()).getGlobalProjectPath(e)}async logToMemory(e,t,n){return(await this.workflowG()).logToMemory(e,t,n)}async spec(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).draft(e,t,n)}async specList(e=process.cwd(),t={}){return(await this.specCmdsG()).list(null,e,t)}async specShow(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).show(e,t,n)}async specUpdate(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).update(e,t,n)}async specApplyDelta(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).applyDelta(e,t,n)}async specSetStatus(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).setStatus(e,t,n)}async specRecordReview(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).recordReview(e,t,n)}async specLinkTask(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).linkTask(e,t,n)}async specShip(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).ship(e,t,n)}async specAudit(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).audit(e,t,n)}async specValidate(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).validate(e,t,n)}async specBreakdown(e=null,t=process.cwd(),n={}){return(await this.specCmdsG()).breakdown(e,t,n)}async specInventory(e=process.cwd(),t={}){return(await this.specCmdsG()).inventory(null,e,t)}};S();k();M();var w=class{static{l(this,"CommandRegistry")}handlers=new Map;handlerFns=new Map;optionFns=new Map;lazyResetters=[];metadata=new Map;categories=new Map;noProjectCommands=new Set(["init","setup","start","migrateAll"]);register(e,t){this.handlers.set(e.name,e),this.setMeta(e.name,t)}registerFn(e,t,n){this.handlerFns.set(e,t),this.setMeta(e,n)}setMeta(e,t){let n=t?.requiresProject??!this.noProjectCommands.has(e);this.metadata.set(e,{name:e,group:t?.group??"unknown",surface:t?.surface,description:t?.description??"",requiresProject:n,usage:t?.usage??{claude:null,terminal:null},implemented:t?.implemented??!0,hasTemplate:t?.hasTemplate??!1,params:t?.params,blockingRules:t?.blockingRules,features:t?.features,isOptional:t?.isOptional,deprecated:t?.deprecated,replacedBy:t?.replacedBy,routingMode:t?.routingMode,optionSchema:t?.optionSchema})}registerCategory(e,t){this.categories.set(e,t)}registerLazyMethod(e,t,n,s){let i=[];this.lazyResetters.push(()=>{i.length=0});let o=l(async()=>{let d=i.at(-1);if(d)return d;let u=await t(),c=u[n];if(typeof c!="function")throw new Error(`${n} is not a function`);let p={instance:u,method:c};return i.push(p),p},"resolve"),m=l(async(d,u)=>{let{instance:c,method:p}=await o();return d!=null?p.call(c,d,u.projectPath):p.call(c,u.projectPath)},"wrapper");this.handlerFns.set(e,m),this.optionFns.set(e,async(d,u,c)=>{let{instance:p,method:G}=await o();return G.call(p,d,u,c)}),this.setMeta(e,s)}resetLazyResolutions(){for(let e of this.lazyResetters)e()}has(e){return this.handlers.has(e)||this.handlerFns.has(e)}list(){return[...this.handlers.keys(),...this.handlerFns.keys()]}listByGroup(e){return Array.from(this.metadata.entries()).filter(([,t])=>t.group===e).map(([t])=>t)}getGroups(){let e=new Set;for(let t of this.metadata.values())e.add(t.group);return Array.from(e)}getMeta(e){return this.metadata.get(e)}getAll(){return Array.from(this.metadata.values())}getByName(e){return this.metadata.get(e)}getByCategory(e){return this.getAll().filter(t=>t.group===e)}getAllImplemented(){return this.getAll().filter(e=>e.implemented)}getAllWithTemplates(){return this.getAll().filter(e=>e.hasTemplate)}getClaudeCommands(){return this.getAll().filter(e=>e.usage.claude!==null)}getTerminalCommands(){return this.getAll().filter(e=>e.usage.terminal!==null)}getAllCategories(){return new Map(this.categories)}getCategory(e){return this.categories.get(e)}getRequiresInit(){return this.getAll().filter(e=>e.requiresProject)}getWithBlockingRules(){return this.getAll().filter(e=>e.blockingRules!==void 0)}getOptionalCommands(){return this.getAll().filter(e=>e.isOptional)}getDeprecatedCommands(){return this.getAll().filter(e=>e.deprecated)}getStats(){let e=this.getAll(),t={};for(let n of this.categories.keys())t[n]=e.filter(s=>s.group===n).length;return{total:e.length,implemented:e.filter(n=>n.implemented).length,withTemplates:e.filter(n=>n.hasTemplate).length,claudeOnly:e.filter(n=>n.usage.claude&&!n.usage.terminal).length,terminalOnly:e.filter(n=>!n.usage.claude&&n.usage.terminal).length,both:e.filter(n=>n.usage.claude&&n.usage.terminal).length,requiresInit:e.filter(n=>n.requiresProject).length,byCategory:t}}validate(){let e=[],t=this.getAll(),n=t.map(m=>m.name),s=n.filter((m,d)=>n.indexOf(m)!==d);s.length>0&&e.push(`Duplicate command names: ${s.join(", ")}`);let i=t.filter(m=>m.hasTemplate&&!m.implemented);i.length>0&&e.push(`Commands with templates but not implemented: ${i.map(m=>m.name).join(", ")}`);let o=Array.from(this.categories.keys());if(o.length>0){let m=t.filter(d=>!o.includes(d.group));m.length>0&&e.push(`Invalid categories: ${m.map(d=>`${d.name}:${d.group}`).join(", ")}`)}return{valid:e.length===0,issues:e}}async buildContext(e){let t=await y.getProjectId(e);if(!t)throw new Error("No prjct project found. Run p. init first.");return{projectId:t,projectPath:e,globalPath:f.getGlobalProjectPath(t),timestamp:g()}}async execute(e,t,n=process.cwd()){let s=this.metadata.get(e),i=await(async()=>{if(s?.requiresProject===!1)return{projectId:"",projectPath:n,globalPath:"",timestamp:g()};try{return await this.buildContext(n)}catch(d){return{success:!1,error:h(d)}}})();if("success"in i)return i;let o=this.handlers.get(e);if(o)return o.execute(t,i);let m=this.handlerFns.get(e);return m?m(t,i):{success:!1,error:`Command not found: ${e}`}}async executeWithOptions(e,t,n,s){let i=this.optionFns.get(e);if(!i)return{success:!1,error:`Command not found: ${e}`};if(this.metadata.get(e)?.requiresProject!==!1)try{await this.buildContext(n)}catch(m){return{success:!1,error:h(m)}}return i(t,n,s)}async executeWithoutProject(e,t,n=process.cwd()){let s=this.handlers.get(e);if(s){let o={projectId:"",projectPath:n,globalPath:"",timestamp:g()};return s.execute(t,o)}let i=this.handlerFns.get(e);if(i){let o={projectId:"",projectPath:n,globalPath:"",timestamp:g()};return i(t,o)}return{success:!1,error:`Command not found: ${e}`}}clear(){this.handlers.clear(),this.handlerFns.clear(),this.metadata.clear(),this.categories.clear()}},C=new w;var R=[];function B(){for(let r of R)r()}l(B,"resetGroupLoaders");function a(r){let e={};return R.push(()=>{delete e.promise}),()=>(e.promise||(e.promise=r().catch(t=>{throw delete e.promise,t})),e.promise)}l(a,"lazy");var A={workflow:a(async()=>new(await import("./workflow-XM77QYRF.mjs")).WorkflowCommands),planning:a(async()=>new(await import("./planning-NOWLKZDS.mjs")).PlanningCommands),shipping:a(async()=>new(await import("./shipping-NZVM57JJ.mjs")).ShippingCommands),analysis:a(async()=>new(await import("./analysis-OARMM4AH.mjs")).AnalysisCommands),setup:a(async()=>new(await import("./setup-BL36ZWPW.mjs")).SetupCommands),context:a(async()=>new(await import("./context-MPHOQPXF.mjs")).ContextCommands),primitives:a(async()=>new(await import("./primitives-GNUMBYOK.mjs")).PrimitiveCommands),seed:a(async()=>new(await import("./seed-MMDJE2UO.mjs")).SeedCommands),install:a(async()=>new(await import("./install-FZQJJWT5.mjs")).InstallCommands),capture:a(async()=>new(await import("./capture-3JJPWIF3.mjs")).CaptureCommands),mcp:a(async()=>new(await import("./mcp-BD5TOTCK.mjs")).McpCommands),team:a(async()=>new(await import("./team-WKAAOEFE.mjs")).TeamCommands),config:a(async()=>new(await import("./config-UVF7YOR6.mjs")).ConfigCommands),uninstall:a(async()=>new(await import("./uninstall-W6EAUS7N.mjs")).UninstallCommands),update:a(async()=>new(await import("./update-PSHEJJI5.mjs")).UpdateCommands),spec:a(async()=>new(await import("./spec-VC3VTUI3.mjs")).SpecCommands),embeddings:a(async()=>new(await import("./embeddings-354ZYFKX.mjs")).EmbeddingsCommands),llm:a(async()=>new(await import("./llm-KMVXVBHG.mjs")).LlmCommands),agent:a(async()=>new(await import("./agent-3N2MSSGT.mjs")).AgentCommands),guard:a(async()=>new(await import("./guard-RT7U3LJX.mjs")).GuardCommands),memoryExport:a(async()=>new(await import("./memory-export-WJ4H7CFV.mjs")).MemoryExportCommands),workflowsReference:a(async()=>new(await import("./workflows-reference-T7RH7IGJ.mjs")).WorkflowsReferenceCommands),changelog:a(async()=>new(await import("./changelog-LPJ4GKB6.mjs")).ChangelogCommands),workGraph:a(async()=>new(await import("./work-graph-ZNV7S6EU.mjs")).WorkGraphCommands),ceremonies:a(async()=>new(await import("./ceremonies-B565WDCA.mjs")).CeremonyCommands),lean:a(async()=>new(await import("./lean-26BWCUOR.mjs")).LeanCommands),cloud:a(async()=>new(await import("./cloud-RXHFZ7MX.mjs")).CloudCommands),tdd:a(async()=>new(await import("./tdd-P2PP4RR4.mjs")).TddCommands),sdd:a(async()=>new(await import("./sdd-3WNZJ6FU.mjs")).SddCommands),notify:a(async()=>new(await import("./notify-EWYUBKGO.mjs")).NotifyCommands),agents:a(async()=>new(await import("./agents-ZPNNCOH7.mjs")).AgentsCommands),product:a(async()=>new(await import("./product-GUHSUNIH.mjs")).ProductCommands),eval:a(async()=>new(await import("./eval-O4YD6YOV.mjs")).EvalCommands),judgment:a(async()=>new(await import("./judgment-G5KH6QFC.mjs")).JudgmentCommands),code:a(async()=>new(await import("./code-IYK65A62.mjs")).CodeCommands)};function _(){for(let[r,e]of Object.entries(P))C.registerCategory(r,e)}l(_,"registerCategories");function j(){if(!C.has("work")){_();for(let r of v)r.routing&&C.registerLazyMethod(r.name,A[r.routing.group],r.routing.method,r)}}l(j,"registerAllCommands");j();function x(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}l(x,"kebab");function V(r,e){let t=l(s=>r[s]!==void 0?r[s]:r[x(s)],"pick"),n={md:r.md===!0};for(let s of e.booleans??[])n[s]=t(s)===!0;for(let s of e.strings??[]){let i=t(s);n[s]=i!=null&&i!==!1&&i!==""?String(i):void 0}for(let s of e.numbers??[]){let i=t(s),o=i!=null&&i!==!1&&i!==""?Number(i):Number.NaN;n[s]=Number.isNaN(o)?void 0:o}return n}l(V,"mapOptions");var O=new Set(["list","show","update","apply-delta","set-status","record-review","link-task","ship","audit","validate","breakdown","inventory"]),I=new Set(["draft","new","create"]);async function K(r,e,t,n){let s=t.md===!0,i=e[0],o=e.slice(1).join(" ")||null,m=e.join(" ")||null,d={md:s,goal:t.goal?String(t.goal):void 0,tags:t.tags?String(t.tags):void 0};if(i&&I.has(i))return r.spec(o,n,d);if(!i||!O.has(i))return r.spec(m,n,d);switch(i){case"list":return r.specList(n,{md:s,status:t.status?String(t.status):void 0});case"show":return r.specShow(o,n,{md:s});case"update":return r.specUpdate(o,n,{md:s,json:t.json?String(t.json):void 0});case"apply-delta":return r.specApplyDelta(o,n,{md:t.md,file:t.file?String(t.file):void 0});case"set-status":return r.specSetStatus(o,n,{md:s,status:t.status?String(t.status):void 0});case"record-review":return r.specRecordReview(o,n,{md:s,reviewer:t.reviewer?String(t.reviewer):void 0,verdict:t.verdict?String(t.verdict):void 0,notes:t.notes?String(t.notes):void 0});case"link-task":return r.specLinkTask(o,n,{md:s,taskId:t["task-id"]?String(t["task-id"]):void 0});case"ship":return r.specShip(o,n,{md:s,pr:t.pr?String(t.pr):void 0});case"audit":return r.specAudit(o,n,{md:s,lenses:t.lenses?String(t.lenses):void 0,strict:t.strict===!0});case"validate":return r.specValidate(o,n,{md:s,strict:t.strict===!0});case"breakdown":return r.specBreakdown(o,n,{md:s,force:t.force===!0});case"inventory":return r.specInventory(n,{md:s,json:t.json===!0});default:return{success:!1,error:`unknown spec subverb: ${i}`}}}l(K,"routeSpec");export{b as a,C as b,B as c,V as d,K as e};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as r,e as o}from"./chunk-56FW4P6U.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";var s=8;function g(n,t,e=s){return o(r(n,t,e).files)}i(g,"rankLikelyFiles");function u(n){let t=n.signals.length>0?` (${n.signals.join("+")})`:"";return`\`${n.path}\` \u2014 ${n.reason}${t}`}i(u,"formatLikelyFileForAgent");function c(n,t){let e=r(n,t,s);return e.files.length===0?null:e.agentBlock||null}i(c,"buildIndexedFileCue");export{g as a,u as b,c};
7
+ import{a as r,e as o}from"./chunk-CB3CNJTL.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";var s=8;function g(n,t,e=s){return o(r(n,t,e).files)}i(g,"rankLikelyFiles");function u(n){let t=n.signals.length>0?` (${n.signals.join("+")})`:"";return`\`${n.path}\` \u2014 ${n.reason}${t}`}i(u,"formatLikelyFileForAgent");function c(n,t){let e=r(n,t,s);return e.files.length===0?null:e.agentBlock||null}i(c,"buildIndexedFileCue");export{g as a,u as b,c};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{b as m,c as d}from"./chunk-KWC2PCPC.mjs";import{a as l,b}from"./chunk-RP7F67ZT.mjs";import{d as g,g as y}from"./chunk-TTN2CFZC.mjs";import{b as a,c as w}from"./chunk-DOJPSIMG.mjs";import{e as u,g as k}from"./chunk-225DWS4D.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";import s from"node:fs/promises";import n from"node:path";w();k();b();y();var c="prjct";function f(){return process.env.PRJCT_TEST_MODE==="1"?n.join(a(".prjct-tests"),"grok","plugins",c):a(".grok","plugins",c)}e(f,"getGrokPluginRoot");function v(){return`${JSON.stringify({name:c,version:g,description:"prjct agentic harness: SQLite work cycles, memory, guards. Grok is Brain; prjct is Body. Run prjct verbs / MCP prjct_*.",author:{name:"prjct.app"}},null,2)}
7
+ import{b as m,c as d}from"./chunk-5TGZSK4C.mjs";import{a as l,b}from"./chunk-RP7F67ZT.mjs";import{d as g,g as y}from"./chunk-XWLTEAGN.mjs";import{b as a,c as w}from"./chunk-DOJPSIMG.mjs";import{e as u,g as k}from"./chunk-225DWS4D.mjs";import{a as e}from"./chunk-3TRXQAU4.mjs";import s from"node:fs/promises";import n from"node:path";w();k();b();y();var c="prjct";function f(){return process.env.PRJCT_TEST_MODE==="1"?n.join(a(".prjct-tests"),"grok","plugins",c):a(".grok","plugins",c)}e(f,"getGrokPluginRoot");function v(){return`${JSON.stringify({name:c,version:g,description:"prjct agentic harness: SQLite work cycles, memory, guards. Grok is Brain; prjct is Body. Run prjct verbs / MCP prjct_*.",author:{name:"prjct.app"}},null,2)}
8
8
  `}e(v,"buildPluginJson");function P(){return`---
9
9
  description: Enter or manage prjct plan mode (read-only until approve). Use when the approach is ambiguous and you need a written plan before editing code.
10
10
  ---
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{b,c as $}from"./chunk-FATYLG3L.mjs";import{b as y,e as E}from"./chunk-623SNKDH.mjs";import{e as c,g as A}from"./chunk-TTN2CFZC.mjs";import{a as n,c as P,d as x}from"./chunk-3TRXQAU4.mjs";var z={};x(z,{default:()=>k,getTemplateContent:()=>w,listTemplates:()=>j,resetBundle:()=>B});import m from"node:fs";import v from"node:fs/promises";import d from"node:path";function g(){if(s.loaded)return s.templates;s.loaded=!0;let t=d.join(c,"dist","templates.json");try{let e=m.readFileSync(t,"utf-8");return s.templates=JSON.parse(e),s.templates}catch{return null}}function L(t){let e=i.indexOf(t);e>-1&&i.splice(e,1),i.push(t)}function W(){for(;a.size>=R&&i.length>0;){let t=i.shift();t&&a.delete(t)}}function S(t){let e=/^---\n([\s\S]+?)\n---\n([\s\S]*)$/,r=t.match(e);if(!r)return{frontmatter:{},content:t.trim()};let[,o,l]=r,p={};return o.split(`
7
+ import{b,c as $}from"./chunk-FATYLG3L.mjs";import{b as y,e as E}from"./chunk-623SNKDH.mjs";import{e as c,g as A}from"./chunk-XWLTEAGN.mjs";import{a as n,c as P,d as x}from"./chunk-3TRXQAU4.mjs";var z={};x(z,{default:()=>k,getTemplateContent:()=>w,listTemplates:()=>j,resetBundle:()=>B});import m from"node:fs";import v from"node:fs/promises";import d from"node:path";function g(){if(s.loaded)return s.templates;s.loaded=!0;let t=d.join(c,"dist","templates.json");try{let e=m.readFileSync(t,"utf-8");return s.templates=JSON.parse(e),s.templates}catch{return null}}function L(t){let e=i.indexOf(t);e>-1&&i.splice(e,1),i.push(t)}function W(){for(;a.size>=R&&i.length>0;){let t=i.shift();t&&a.delete(t)}}function S(t){let e=/^---\n([\s\S]+?)\n---\n([\s\S]*)$/,r=t.match(e);if(!r)return{frontmatter:{},content:t.trim()};let[,o,l]=r,p={};return o.split(`
8
8
  `).forEach(F=>{let[f,...h]=F.split(":");if(f&&h.length>0){let u=h.join(":").trim();u.startsWith("[")&&u.endsWith("]")?p[f.trim()]=u.slice(1,-1).split(",").map(O=>O.trim()):p[f.trim()]=u.replace(/^["']|["']$/g,"")}}),{frontmatter:p,content:l.trim()}}async function T(t){if(a.has(t))return L(t),a.get(t);let o=g()?.[`commands/${t}.md`]??await v.readFile(d.join(c,"templates","commands",`${t}.md`),"utf-8").catch(()=>{throw y.notFound(t)}),l=S(o);return W(),a.set(t,l),i.push(t),l}async function _(t){return(await T(t)).frontmatter["allowed-tools"]||[]}function C(){a.clear(),i.length=0}function B(){s.templates=null,s.loaded=!1,C()}function w(t){let e=g();if(e?.[t])return e[t];let r=b(t);if(r)return r;let o=d.join(c,"templates",t);try{return m.readFileSync(o,"utf-8")}catch{return null}}function j(t){let e=g();if(e)return Object.keys(e).filter(o=>o.startsWith(t));let r=d.join(c,"templates",t);try{return m.readdirSync(r).map(l=>`${t}${l}`)}catch{return[]}}var R,a,i,s,M,k,G=P(()=>{E();$();A();R=50,a=new Map,i=[],s={templates:null,loaded:!1};n(g,"loadBundle");n(L,"updateLruOrder");n(W,"evictLru");n(S,"parseFrontmatter");n(T,"load");n(_,"getAllowedTools");n(C,"clearCache");n(B,"resetBundle");n(w,"getTemplateContent");n(j,"listTemplates");M={load:T,parseFrontmatter:S,getAllowedTools:_,clearCache:C,getTemplateContent:w,listTemplates:j},k=M});export{B as a,w as b,j as c,k as d,z as e,G as f};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as P,c as I,e as M}from"./chunk-6RT2P22O.mjs";import{e as T,f as O}from"./chunk-XYDLXF5A.mjs";import{c as x,g as L}from"./chunk-TTN2CFZC.mjs";import{a as t,b as v,e as S}from"./chunk-3TRXQAU4.mjs";M();import{execFileSync as F}from"node:child_process";import{realpathSync as w}from"node:fs";import h from"node:path";import H from"node:readline";L();M();import{execFileSync as y}from"node:child_process";import C from"node:os";import g from"node:path";var _=C.homedir(),p={npm:{name:"npm",installArgs:["install","-g","prjct-cli@latest","--prefer-online"],getInstallRoot:t(()=>{try{return y("npm",["root","-g"],{encoding:"utf-8",stdio:"pipe"}).trim()}catch{return null}},"getInstallRoot")},pnpm:{name:"pnpm",installArgs:["add","-g","prjct-cli@latest"],getInstallRoot:t(()=>{try{return y("pnpm",["root","-g"],{encoding:"utf-8",stdio:"pipe"}).trim()}catch{return null}},"getInstallRoot")},bun:{name:"bun",installArgs:["add","-g","prjct-cli@latest"],getInstallRoot:t(()=>g.join(_,".bun","install","global","node_modules"),"getInstallRoot")},yarn:{name:"yarn",installArgs:["global","add","prjct-cli@latest"],getInstallRoot:t(()=>{try{let e=y("yarn",["global","dir"],{encoding:"utf-8",stdio:"pipe"}).trim();return g.join(e,"node_modules")}catch{return null}},"getInstallRoot")}};function tn(){return C.tmpdir()}t(tn,"registryInstallCwd");function on(e,r){let o=r??"prjct-cli@latest";return e.installArgs.map(n=>n==="prjct-cli@latest"||n.startsWith("prjct-cli@")?o:n)}t(on,"registryInstallArgs");function N(){try{return!!y("brew",["list","prjct-cli"],{encoding:"utf-8",stdio:["pipe","pipe","ignore"]})}catch{return!1}}t(N,"isHomebrewInstall");function $(e){return I(e)||process.platform==="win32"&&I(`${e}.cmd`)}t($,"isOnPath");function R(){let e=[process.argv[1],process.execPath].filter(Boolean);for(let r of e){let n=(()=>{try{return v("node:fs").realpathSync(r)}catch{return r}})().replace(/\\/g,"/").toLowerCase();if(n.includes("/.bun/install/global")||n.includes("/.bun/bin/"))return"bun";if(n.includes("/library/pnpm/")||n.includes("/.pnpm/")||n.includes("/.local/share/pnpm/")||n.includes("/pnpm/")&&(n.includes("/global")||n.includes("/prjct")))return"pnpm";if(n.includes("/.yarn/")||n.includes("/yarn/global")||n.includes("/yarn/berry"))return"yarn";if(n.includes("/node_modules/prjct-cli")||n.includes("/npm/node_modules/")||n.endsWith("/npm/prjct.cmd")||n.endsWith("/npm/prjct"))return"npm"}return null}t(R,"detectInstallerFromRunningBinary");function sn(){let e=R();if(e&&$(e))return p[e];for(let r of["bun","pnpm","npm","yarn"])if($(r))return p[r];throw new Error("No supported package manager found in PATH (tried npm, pnpm, bun, yarn). Install one and re-run, or upgrade manually: bun add -g prjct-cli@latest")}t(sn,"selectPackageManager");function A(){let e=[];for(let r of[p.bun,p.pnpm,p.npm,p.yarn]){let o=r.getInstallRoot();if(!o)continue;let n=g.join(o,"prjct-cli","package.json");try{let a=JSON.parse(v("node:fs").readFileSync(n,"utf-8"));a?.name==="prjct-cli"&&typeof a.version=="string"&&e.push({pm:r,version:a.version})}catch{}}return e}t(A,"getAllInstalledLocations");function an(){try{let{existsSync:e,realpathSync:r,readFileSync:o}=v("node:fs"),n=(()=>{try{return r(g.resolve(__dirname,"..","..",".."))}catch{return""}})(),a=[p.bun.getInstallRoot(),p.pnpm.getInstallRoot(),p.npm.getInstallRoot(),p.yarn.getInstallRoot()].filter(s=>!!s);for(let s of a){let l=g.join(s,"prjct-cli"),d=g.join(l,"package.json");if(!e(d))continue;let c=(()=>{try{return r(l)}catch{return l}})();if(n&&c===n)continue;try{if(JSON.parse(o(g.join(c,"package.json"),"utf-8"))?.name!=="prjct-cli")continue}catch{continue}x(c);let{resetBundle:i}=(O(),S(T));i();return}}catch{}}t(an,"redirectToInstalledPackage");var q={npm:["npm","uninstall","-g","prjct-cli"],pnpm:["pnpm","remove","-g","prjct-cli"],bun:["bun","remove","-g","prjct-cli"],yarn:["yarn","global","remove","prjct-cli"]};function B(){let e=P("prjct")??P("prjct.cmd");if(!e)return null;try{return w(e)}catch{return e}}t(B,"pathWinnerReal");function E(){try{return w(h.resolve(__dirname,"..","..",".."))}catch{return""}}t(E,"sourceRoot");function k(e){let r=h.normalize(e).replace(/\\/g,"/");return process.platform==="win32"?r.toLowerCase():r}t(k,"normalizePathForCompare");function z(e,r){if(!e||!r)return!1;try{let o=k(w(e)),n=k(w(r));return n===o||n.startsWith(`${o}/`)}catch{let o=k(e),n=k(r);return n===o||n.startsWith(`${o}/`)||n.includes(o)}}t(z,"locationOwnsWinner");function J(e){try{return w(e)}catch{return e}}t(J,"defaultResolvePath");function G(e){if(!e||process.platform==="win32")return!1;let r=e.replace(/\\/g,"/");return!!(r.includes("/Cellar/prjct-cli")||r.includes("/Cellar/prjct/")||/(?:^|\/)(?:opt\/)?homebrew\/bin\/prjct(?:$|\/)/.test(r)||r.includes("/.linuxbrew/bin/prjct")||r.includes("/linuxbrew/.linuxbrew/bin/prjct")||r.endsWith("/homebrew/bin/prjct")||r.endsWith("/opt/homebrew/bin/prjct"))}t(G,"isBrewWinnerPath");function Y(e){let{winnerReal:r,winnerPm:o,locations:n,brewInstalled:a,sourceRoot:s,ownsWinner:l=z,resolvePath:d=J}=e,c=[];if(!r&&!o)return{winner:null,removable:[],skipped:[{pm:"(all)",reason:"cannot resolve the PATH-winning binary \u2014 refusing to remove"}]};let i=G(r),f=!i&&r?n.find(u=>{let m=u.installRoot;return l(m,r)||l(m?h.join(m,"prjct-cli"):null,r)})?.name:void 0,b=i?"brew":f??o,j=[];for(let u of n){let m=u.installRoot,W=l(m,r)||l(m?h.join(m,"prjct-cli"):null,r);if(u.name===b||W||!r&&u.name===o){c.push({pm:u.name,reason:"PATH winner (or owns winning binary) \u2014 kept"});continue}if(m&&s&&d(h.join(m,"prjct-cli"))===s){c.push({pm:u.name,reason:"resolves to the dev source tree (link) \u2014 kept"});continue}j.push({pm:u.name,version:u.version})}return a&&!i&&b!=="brew"?j.push({pm:"brew",version:"(homebrew)"}):a&&(i||b==="brew")&&c.push({pm:"brew",reason:"PATH winner \u2014 kept"}),b===null?{winner:null,removable:[],skipped:[...c,{pm:"(all)",reason:"no definitive winner \u2014 refusing to remove any copy"}]}:{winner:b,removable:j,skipped:c}}t(Y,"planCleanupFrom");function K(){return Y({winnerReal:B(),winnerPm:R(),locations:A().map(e=>({name:e.pm.name,installRoot:e.pm.getInstallRoot(),version:e.version})),brewInstalled:N(),sourceRoot:E()})}t(K,"planCleanup");function U(e){let r=e==="brew"?["brew","uninstall","prjct-cli"]:q[e];try{return F(r[0],r.slice(1),{stdio:"pipe"}),{ok:!0}}catch(o){return{ok:!1,error:`${e}: ${o.message.split(`
7
+ import{a as P,c as I,e as M}from"./chunk-6RT2P22O.mjs";import{e as T,f as O}from"./chunk-OE27RFLJ.mjs";import{c as x,g as L}from"./chunk-XWLTEAGN.mjs";import{a as t,b as v,e as S}from"./chunk-3TRXQAU4.mjs";M();import{execFileSync as F}from"node:child_process";import{realpathSync as w}from"node:fs";import h from"node:path";import H from"node:readline";L();M();import{execFileSync as y}from"node:child_process";import C from"node:os";import g from"node:path";var _=C.homedir(),p={npm:{name:"npm",installArgs:["install","-g","prjct-cli@latest","--prefer-online"],getInstallRoot:t(()=>{try{return y("npm",["root","-g"],{encoding:"utf-8",stdio:"pipe"}).trim()}catch{return null}},"getInstallRoot")},pnpm:{name:"pnpm",installArgs:["add","-g","prjct-cli@latest"],getInstallRoot:t(()=>{try{return y("pnpm",["root","-g"],{encoding:"utf-8",stdio:"pipe"}).trim()}catch{return null}},"getInstallRoot")},bun:{name:"bun",installArgs:["add","-g","prjct-cli@latest"],getInstallRoot:t(()=>g.join(_,".bun","install","global","node_modules"),"getInstallRoot")},yarn:{name:"yarn",installArgs:["global","add","prjct-cli@latest"],getInstallRoot:t(()=>{try{let e=y("yarn",["global","dir"],{encoding:"utf-8",stdio:"pipe"}).trim();return g.join(e,"node_modules")}catch{return null}},"getInstallRoot")}};function tn(){return C.tmpdir()}t(tn,"registryInstallCwd");function on(e,r){let o=r??"prjct-cli@latest";return e.installArgs.map(n=>n==="prjct-cli@latest"||n.startsWith("prjct-cli@")?o:n)}t(on,"registryInstallArgs");function N(){try{return!!y("brew",["list","prjct-cli"],{encoding:"utf-8",stdio:["pipe","pipe","ignore"]})}catch{return!1}}t(N,"isHomebrewInstall");function $(e){return I(e)||process.platform==="win32"&&I(`${e}.cmd`)}t($,"isOnPath");function R(){let e=[process.argv[1],process.execPath].filter(Boolean);for(let r of e){let n=(()=>{try{return v("node:fs").realpathSync(r)}catch{return r}})().replace(/\\/g,"/").toLowerCase();if(n.includes("/.bun/install/global")||n.includes("/.bun/bin/"))return"bun";if(n.includes("/library/pnpm/")||n.includes("/.pnpm/")||n.includes("/.local/share/pnpm/")||n.includes("/pnpm/")&&(n.includes("/global")||n.includes("/prjct")))return"pnpm";if(n.includes("/.yarn/")||n.includes("/yarn/global")||n.includes("/yarn/berry"))return"yarn";if(n.includes("/node_modules/prjct-cli")||n.includes("/npm/node_modules/")||n.endsWith("/npm/prjct.cmd")||n.endsWith("/npm/prjct"))return"npm"}return null}t(R,"detectInstallerFromRunningBinary");function sn(){let e=R();if(e&&$(e))return p[e];for(let r of["bun","pnpm","npm","yarn"])if($(r))return p[r];throw new Error("No supported package manager found in PATH (tried npm, pnpm, bun, yarn). Install one and re-run, or upgrade manually: bun add -g prjct-cli@latest")}t(sn,"selectPackageManager");function A(){let e=[];for(let r of[p.bun,p.pnpm,p.npm,p.yarn]){let o=r.getInstallRoot();if(!o)continue;let n=g.join(o,"prjct-cli","package.json");try{let a=JSON.parse(v("node:fs").readFileSync(n,"utf-8"));a?.name==="prjct-cli"&&typeof a.version=="string"&&e.push({pm:r,version:a.version})}catch{}}return e}t(A,"getAllInstalledLocations");function an(){try{let{existsSync:e,realpathSync:r,readFileSync:o}=v("node:fs"),n=(()=>{try{return r(g.resolve(__dirname,"..","..",".."))}catch{return""}})(),a=[p.bun.getInstallRoot(),p.pnpm.getInstallRoot(),p.npm.getInstallRoot(),p.yarn.getInstallRoot()].filter(s=>!!s);for(let s of a){let l=g.join(s,"prjct-cli"),d=g.join(l,"package.json");if(!e(d))continue;let c=(()=>{try{return r(l)}catch{return l}})();if(n&&c===n)continue;try{if(JSON.parse(o(g.join(c,"package.json"),"utf-8"))?.name!=="prjct-cli")continue}catch{continue}x(c);let{resetBundle:i}=(O(),S(T));i();return}}catch{}}t(an,"redirectToInstalledPackage");var q={npm:["npm","uninstall","-g","prjct-cli"],pnpm:["pnpm","remove","-g","prjct-cli"],bun:["bun","remove","-g","prjct-cli"],yarn:["yarn","global","remove","prjct-cli"]};function B(){let e=P("prjct")??P("prjct.cmd");if(!e)return null;try{return w(e)}catch{return e}}t(B,"pathWinnerReal");function E(){try{return w(h.resolve(__dirname,"..","..",".."))}catch{return""}}t(E,"sourceRoot");function k(e){let r=h.normalize(e).replace(/\\/g,"/");return process.platform==="win32"?r.toLowerCase():r}t(k,"normalizePathForCompare");function z(e,r){if(!e||!r)return!1;try{let o=k(w(e)),n=k(w(r));return n===o||n.startsWith(`${o}/`)}catch{let o=k(e),n=k(r);return n===o||n.startsWith(`${o}/`)||n.includes(o)}}t(z,"locationOwnsWinner");function J(e){try{return w(e)}catch{return e}}t(J,"defaultResolvePath");function G(e){if(!e||process.platform==="win32")return!1;let r=e.replace(/\\/g,"/");return!!(r.includes("/Cellar/prjct-cli")||r.includes("/Cellar/prjct/")||/(?:^|\/)(?:opt\/)?homebrew\/bin\/prjct(?:$|\/)/.test(r)||r.includes("/.linuxbrew/bin/prjct")||r.includes("/linuxbrew/.linuxbrew/bin/prjct")||r.endsWith("/homebrew/bin/prjct")||r.endsWith("/opt/homebrew/bin/prjct"))}t(G,"isBrewWinnerPath");function Y(e){let{winnerReal:r,winnerPm:o,locations:n,brewInstalled:a,sourceRoot:s,ownsWinner:l=z,resolvePath:d=J}=e,c=[];if(!r&&!o)return{winner:null,removable:[],skipped:[{pm:"(all)",reason:"cannot resolve the PATH-winning binary \u2014 refusing to remove"}]};let i=G(r),f=!i&&r?n.find(u=>{let m=u.installRoot;return l(m,r)||l(m?h.join(m,"prjct-cli"):null,r)})?.name:void 0,b=i?"brew":f??o,j=[];for(let u of n){let m=u.installRoot,W=l(m,r)||l(m?h.join(m,"prjct-cli"):null,r);if(u.name===b||W||!r&&u.name===o){c.push({pm:u.name,reason:"PATH winner (or owns winning binary) \u2014 kept"});continue}if(m&&s&&d(h.join(m,"prjct-cli"))===s){c.push({pm:u.name,reason:"resolves to the dev source tree (link) \u2014 kept"});continue}j.push({pm:u.name,version:u.version})}return a&&!i&&b!=="brew"?j.push({pm:"brew",version:"(homebrew)"}):a&&(i||b==="brew")&&c.push({pm:"brew",reason:"PATH winner \u2014 kept"}),b===null?{winner:null,removable:[],skipped:[...c,{pm:"(all)",reason:"no definitive winner \u2014 refusing to remove any copy"}]}:{winner:b,removable:j,skipped:c}}t(Y,"planCleanupFrom");function K(){return Y({winnerReal:B(),winnerPm:R(),locations:A().map(e=>({name:e.pm.name,installRoot:e.pm.getInstallRoot(),version:e.version})),brewInstalled:N(),sourceRoot:E()})}t(K,"planCleanup");function U(e){let r=e==="brew"?["brew","uninstall","prjct-cli"]:q[e];try{return F(r[0],r.slice(1),{stdio:"pipe"}),{ok:!0}}catch(o){return{ok:!1,error:`${e}: ${o.message.split(`
8
8
  `)[0]}`}}}t(U,"removeOne");async function V(e){let r=H.createInterface({input:process.stdin,output:process.stdout});try{let o=await new Promise(n=>r.question(`${e} [y/N] `,n));return/^y(es)?$/i.test(o.trim())}finally{r.close()}}t(V,"confirm");async function bn(e,r,o){let n=[],a=[];if(e==="off")return n.push("Install consolidation skipped (--no-cleanup)"),{details:n,errors:a};let s=K();if(s.removable.length===0)return n.push(s.skipped.some(i=>i.pm==="(all)")?`Consolidation skipped \u2014 ${s.skipped[0].reason}`:"Single install \u2014 nothing to consolidate"),{details:n,errors:a};let l=s.removable.map(i=>`${i.pm} (${i.version})`).join(", ");if(n.push(`Winner: ${s.winner??"unknown"} \u2014 redundant copies: ${l}`),r){for(let i of s.removable)n.push(`Would remove ${i.pm} copy`);return{details:n,errors:a}}let d=process.stdin.isTTY===!0&&process.stdout.isTTY===!0;if(!(e==="force"||o||d&&await V(`Remove ${s.removable.length} redundant prjct install(s) [${l}], keeping ${s.winner}?`)))return d?n.push("Consolidation declined \u2014 left all installs in place"):n.push(`Multiple installs detected [${l}]. Run \`prjct upgrade --yes\` to consolidate (kept ${s.winner}).`),{details:n,errors:a};for(let i of s.removable){let f=U(i.pm);f.ok?n.push(`Removed redundant ${i.pm} install`):a.push(f.error??`failed to remove ${i.pm}`)}for(let i of s.skipped)n.push(`Kept ${i.pm}: ${i.reason}`);return{details:n,errors:a}}t(bn,"consolidateInstalls");export{tn as a,on as b,N as c,$ as d,sn as e,A as f,an as g,k as h,z as i,G as j,Y as k,K as l,bn as m};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{i as x,l as h}from"./chunk-WSVMQYYU.mjs";import{e as b}from"./chunk-X35YYOFE.mjs";import{b as S}from"./chunk-LZC6NGB6.mjs";import{a as M,h as I}from"./chunk-UNNY2IWZ.mjs";import{a as l,b as F}from"./chunk-DMO3ZFUG.mjs";import{d as R,j as D}from"./chunk-KPR5TWSN.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";F();var $=.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>=$;return{excess:p?0:Math.max(0,Math.min(1,1-i)),maxSim:i,nearestId:u,exactDup:!1,nearDup:p}}c(g,"excessAgainstIndex");function O(e,r,n){return g(e,d(r),n)}c(O,"computeExcess");D();var k=new Set(["decision","gotcha","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","context"]),N=150,T={declared:3,extracted:2,ambiguous:1,inferred:0};function w(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(w,"isLivingV2");function P(e){return!(!R(e)||e.content.trim().length<40||!k.has(e.type)||e.type==="context"&&!w(e)||e.type==="inbox"||e.type==="todo"||e.type==="idea")}c(P,"isReferenceEligible");function A(e){let r=T[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(P);return r.sort((n,s)=>A(s)-A(n)),r.slice(0,N)}c(C,"buildReferenceModel");var j=new Set(["decision","gotcha","red-herring","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","shipped"]),U=.28;function Z(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(j.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?U: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(Z,"captureGate");export{N as a,P as b,C as c,$ as d,v as e,d as f,g,O as h,Z as i};
7
+ import{i as x,l as h}from"./chunk-ZQ2XH76U.mjs";import{e as b}from"./chunk-6KNMT46X.mjs";import{b as S}from"./chunk-B2HY22OD.mjs";import{a as M,h as I}from"./chunk-UNNY2IWZ.mjs";import{a as l,b as F}from"./chunk-DMO3ZFUG.mjs";import{d as R,j as D}from"./chunk-KPR5TWSN.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";F();var $=.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>=$;return{excess:p?0:Math.max(0,Math.min(1,1-i)),maxSim:i,nearestId:u,exactDup:!1,nearDup:p}}c(g,"excessAgainstIndex");function O(e,r,n){return g(e,d(r),n)}c(O,"computeExcess");D();var k=new Set(["decision","gotcha","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","context"]),N=150,T={declared:3,extracted:2,ambiguous:1,inferred:0};function w(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(w,"isLivingV2");function P(e){return!(!R(e)||e.content.trim().length<40||!k.has(e.type)||e.type==="context"&&!w(e)||e.type==="inbox"||e.type==="todo"||e.type==="idea")}c(P,"isReferenceEligible");function A(e){let r=T[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(P);return r.sort((n,s)=>A(s)-A(n)),r.slice(0,N)}c(C,"buildReferenceModel");var j=new Set(["decision","gotcha","red-herring","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","shipped"]),U=.28;function Z(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(j.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?U: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(Z,"captureGate");export{N as a,P as b,C as c,$ as d,v as e,d as f,g,O as h,Z as i};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as y}from"./chunk-F7OOBAJO.mjs";import{c}from"./chunk-4PPIE6GA.mjs";import{F as a,G as j}from"./chunk-HU5ERAAV.mjs";import{f as g,g as u,n as h,p as P}from"./chunk-HYIT7MF5.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";j();P();import x from"node:path";function d(){return x.join(a.getStatePath(),"cloud-linked.json")}s(d,"registryPath");async function l(){let i=await g(d(),[]);return Array.isArray(i)?i.filter(t=>t?.projectId&&t?.projectPath):[]}s(l,"listLinkedProjects");async function _(i,t){let n=(await l()).filter(r=>r.projectId!==i);n.push({projectId:i,projectPath:t}),await h(a.getStatePath()),await u(d(),n)}s(_,"addLinkedProject");async function I(i){let t=await l();await h(a.getStatePath()),await u(d(),t.filter(e=>e.projectId!==i))}s(I,"removeLinkedProject");function v(){return typeof globalThis.WebSocket=="function"}s(v,"hasGlobalWebSocket");function R(i,t,e,n){let r=i.replace(/\/$/,"").replace(/^http/,"ws"),o=new URLSearchParams({key:e,device:n,project:t});return`${r}/ws?${o.toString()}`}s(R,"buildRealtimeUrl");function M(i,t,e){let n=Math.min(e,t*2**i);return Math.round(Math.random()*n)}s(M,"backoffDelay");var p=class{static{s(this,"RealtimeClient")}opts;ws=null;_state="idle";attempt=0;stopped=!1;reconnectTimer=null;constructor(t){this.opts={...t,wsFactory:t.wsFactory??(e=>new globalThis.WebSocket(e)),baseDelayMs:t.baseDelayMs??1e3,maxDelayMs:t.maxDelayMs??3e4}}get state(){return this._state}start(){this.stopped||this._state==="connecting"||this._state==="open"||this.connect()}stop(){this.stopped=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSocket(),this._state="closed"}connect(){this._state=this.attempt===0?"connecting":"reconnecting";let t=R(this.opts.apiUrl,this.opts.projectId,this.opts.apiKey,this.opts.deviceId),e=(()=>{try{return this.opts.wsFactory(t)}catch{return null}})();if(!e){this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{this._state="open",this.attempt=0},e.onmessage=n=>{this.handleMessage(n?.data)},e.onerror=()=>{},e.onclose=()=>{this.stopped||this.scheduleReconnect()}}async handleMessage(t){let e=(()=>{try{return typeof t=="string"?JSON.parse(t):t}catch{return null}})();if(!e||typeof e!="object")return;let n=e;if(n.type==="event"&&n.event&&typeof n.event=="object")try{await this.opts.apply(this.opts.projectId,n.event)}catch{}}scheduleReconnect(){if(this.stopped)return;this.closeSocket(),this._state="reconnecting";let t=M(this.attempt,this.opts.baseDelayMs,this.opts.maxDelayMs);this.attempt+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.stopped||this.connect()},t),this.reconnectTimer?.unref?.()}closeSocket(){if(!this.ws)return;let t=this.ws;t.onopen=null,t.onmessage=null,t.onclose=null,t.onerror=null;try{t.close()}catch{}this.ws=null}};var m=class{static{s(this,"RealtimeManager")}clients=new Map;available(){return process.env.PRJCT_IN_DAEMON==="1"&&v()}async startAll(){if(!this.available())return;let t=await l();for(let e of t)try{await this.start(e.projectId,e.projectPath)}catch{}}async start(t,e){if(!this.available()||this.clients.has(t))return;let{default:n}=await import("./config-manager-QVFHXIKI.mjs"),r=await n.readConfig(e).catch(()=>null);if(!r?.cloud?.enabled||r.cloud.paused)return;let o=await c.read();if(!o.apiKey)return;let[w,b]=await Promise.all([c.getApiUrl(),c.getDeviceId()]),f=new p({projectId:t,apiUrl:w,apiKey:o.apiKey,deviceId:b,apply:s((k,S)=>y.applyRealtimeEvent(k,S),"apply")});this.clients.set(t,f),f.start()}stop(t){let e=this.clients.get(t);e&&(e.stop(),this.clients.delete(t))}stopAll(){for(let t of this.clients.values())t.stop();this.clients.clear()}status(t){return this.clients.get(t)?.state??"disabled"}},T=new m,N=T;export{l as a,_ as b,I as c,T as d,N as e};
7
+ import{a as y}from"./chunk-F7OOBAJO.mjs";import{c}from"./chunk-4PPIE6GA.mjs";import{F as a,G as j}from"./chunk-HU5ERAAV.mjs";import{f as g,g as u,n as h,p as P}from"./chunk-HYIT7MF5.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";j();P();import x from"node:path";function d(){return x.join(a.getStatePath(),"cloud-linked.json")}s(d,"registryPath");async function l(){let i=await g(d(),[]);return Array.isArray(i)?i.filter(t=>t?.projectId&&t?.projectPath):[]}s(l,"listLinkedProjects");async function _(i,t){let n=(await l()).filter(r=>r.projectId!==i);n.push({projectId:i,projectPath:t}),await h(a.getStatePath()),await u(d(),n)}s(_,"addLinkedProject");async function I(i){let t=await l();await h(a.getStatePath()),await u(d(),t.filter(e=>e.projectId!==i))}s(I,"removeLinkedProject");function v(){return typeof globalThis.WebSocket=="function"}s(v,"hasGlobalWebSocket");function R(i,t,e,n){let r=i.replace(/\/$/,"").replace(/^http/,"ws"),o=new URLSearchParams({key:e,device:n,project:t});return`${r}/ws?${o.toString()}`}s(R,"buildRealtimeUrl");function M(i,t,e){let n=Math.min(e,t*2**i);return Math.round(Math.random()*n)}s(M,"backoffDelay");var p=class{static{s(this,"RealtimeClient")}opts;ws=null;_state="idle";attempt=0;stopped=!1;reconnectTimer=null;constructor(t){this.opts={...t,wsFactory:t.wsFactory??(e=>new globalThis.WebSocket(e)),baseDelayMs:t.baseDelayMs??1e3,maxDelayMs:t.maxDelayMs??3e4}}get state(){return this._state}start(){this.stopped||this._state==="connecting"||this._state==="open"||this.connect()}stop(){this.stopped=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.closeSocket(),this._state="closed"}connect(){this._state=this.attempt===0?"connecting":"reconnecting";let t=R(this.opts.apiUrl,this.opts.projectId,this.opts.apiKey,this.opts.deviceId),e=(()=>{try{return this.opts.wsFactory(t)}catch{return null}})();if(!e){this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{this._state="open",this.attempt=0},e.onmessage=n=>{this.handleMessage(n?.data)},e.onerror=()=>{},e.onclose=()=>{this.stopped||this.scheduleReconnect()}}async handleMessage(t){let e=(()=>{try{return typeof t=="string"?JSON.parse(t):t}catch{return null}})();if(!e||typeof e!="object")return;let n=e;if(n.type==="event"&&n.event&&typeof n.event=="object")try{await this.opts.apply(this.opts.projectId,n.event)}catch{}}scheduleReconnect(){if(this.stopped)return;this.closeSocket(),this._state="reconnecting";let t=M(this.attempt,this.opts.baseDelayMs,this.opts.maxDelayMs);this.attempt+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.stopped||this.connect()},t),this.reconnectTimer?.unref?.()}closeSocket(){if(!this.ws)return;let t=this.ws;t.onopen=null,t.onmessage=null,t.onclose=null,t.onerror=null;try{t.close()}catch{}this.ws=null}};var m=class{static{s(this,"RealtimeManager")}clients=new Map;available(){return process.env.PRJCT_IN_DAEMON==="1"&&v()}async startAll(){if(!this.available())return;let t=await l();for(let e of t)try{await this.start(e.projectId,e.projectPath)}catch{}}async start(t,e){if(!this.available()||this.clients.has(t))return;let{default:n}=await import("./config-manager-QY73WM5U.mjs"),r=await n.readConfig(e).catch(()=>null);if(!r?.cloud?.enabled||r.cloud.paused)return;let o=await c.read();if(!o.apiKey)return;let[w,b]=await Promise.all([c.getApiUrl(),c.getDeviceId()]),f=new p({projectId:t,apiUrl:w,apiKey:o.apiKey,deviceId:b,apply:s((k,S)=>y.applyRealtimeEvent(k,S),"apply")});this.clients.set(t,f),f.start()}stop(t){let e=this.clients.get(t);e&&(e.stop(),this.clients.delete(t))}stopAll(){for(let t of this.clients.values())t.stop();this.clients.clear()}status(t){return this.clients.get(t)?.state??"disabled"}},T=new m,N=T;export{l as a,_ as b,I as c,T as d,N as e};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{a as l}from"./chunk-MCY7OXED.mjs";import{c as u}from"./chunk-RACISWUV.mjs";import{a as s,c}from"./chunk-NINFE7GS.mjs";import{b as i}from"./chunk-3USVY66O.mjs";import{a as o}from"./chunk-3TRXQAU4.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)
7
+ import{a as l}from"./chunk-MCY7OXED.mjs";import{c as u}from"./chunk-RACISWUV.mjs";import{a as s,c}from"./chunk-NINFE7GS.mjs";import{b as i}from"./chunk-XSZOHNL4.mjs";import{a as o}from"./chunk-3TRXQAU4.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
8
  ${t.message}`}catch{return null}},"build")},e)}o(w,"runPrePackageHook");export{m as a,w as b};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{c as P}from"./chunk-ZKJZDOPT.mjs";import{d as w}from"./chunk-JPMUJY42.mjs";import{b as M,f as N}from"./chunk-XYDLXF5A.mjs";import{c,d as u,e as g,f as d,g as p}from"./chunk-2EEMQV7N.mjs";import{e as A,g as I}from"./chunk-TTN2CFZC.mjs";import{l as o,p as T}from"./chunk-HYIT7MF5.mjs";import{a as r}from"./chunk-3TRXQAU4.mjs";T();import a from"node:path";p();var O=`${g}
7
+ import{c as P}from"./chunk-ACIOJQSI.mjs";import{d as w}from"./chunk-JPMUJY42.mjs";import{b as M,f as N}from"./chunk-OE27RFLJ.mjs";import{c,d as u,e as g,f as d,g as p}from"./chunk-2EEMQV7N.mjs";import{e as A,g as I}from"./chunk-XWLTEAGN.mjs";import{l as o,p as T}from"./chunk-HYIT7MF5.mjs";import{a as r}from"./chunk-3TRXQAU4.mjs";T();import a from"node:path";p();var O=`${g}
8
8
  - project facts (stack/commands): see \`PRJCT.md\``,y=`${c}
9
9
  ${O}
10
10
  ${u}