prjct-cli 3.96.0 → 3.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/bin/prjct.cjs +14 -0
- package/dist/bin/core-chunks/agent-3N2MSSGT.mjs +31 -0
- package/dist/bin/core-chunks/agent-codenames-7N4DU62I.mjs +7 -0
- package/dist/bin/core-chunks/agent-identity-4KFRR5OU.mjs +7 -0
- package/dist/bin/core-chunks/agent-runtime-registry-3RMVBEV2.mjs +7 -0
- package/dist/bin/core-chunks/agent-switch-4SE6GF7R.mjs +7 -0
- package/dist/bin/core-chunks/agents-ZPNNCOH7.mjs +10 -0
- package/dist/bin/core-chunks/ai-provider-RVXK7D7R.mjs +7 -0
- package/dist/bin/core-chunks/analysis-OARMM4AH.mjs +41 -0
- package/dist/bin/core-chunks/auth-config-KWLVKHCY.mjs +7 -0
- package/dist/bin/core-chunks/auto-flush-XA3V7BJ6.mjs +7 -0
- package/dist/bin/core-chunks/auto-updater-PKYQRBGQ.mjs +8 -0
- package/dist/bin/core-chunks/bin-commands-FYID6EYI.mjs +21 -0
- package/dist/bin/core-chunks/capture-3JJPWIF3.mjs +7 -0
- package/dist/bin/core-chunks/capture-gate-G5LGVDME.mjs +7 -0
- package/dist/bin/core-chunks/ceremonies-B565WDCA.mjs +19 -0
- package/dist/bin/core-chunks/changelog-LPJ4GKB6.mjs +10 -0
- package/dist/bin/core-chunks/chunk-225DWS4D.mjs +7 -0
- package/dist/bin/core-chunks/chunk-24EN5Y62.mjs +48 -0
- package/dist/bin/core-chunks/chunk-2EEMQV7N.mjs +9 -0
- package/dist/bin/core-chunks/chunk-2FRLIQKX.mjs +10 -0
- package/dist/bin/core-chunks/chunk-2I5PUQWY.mjs +7 -0
- package/dist/bin/core-chunks/chunk-2JJM3YMW.mjs +44 -0
- package/dist/bin/core-chunks/chunk-2NI4EEK2.mjs +8 -0
- package/dist/bin/core-chunks/chunk-2TJRTFIS.mjs +9 -0
- package/dist/bin/core-chunks/chunk-2VRS5CUH.mjs +9 -0
- package/dist/bin/core-chunks/chunk-2VXPFULA.mjs +7 -0
- package/dist/bin/core-chunks/chunk-3OWKIRK6.mjs +7 -0
- package/dist/bin/core-chunks/chunk-3TRXQAU4.mjs +7 -0
- package/dist/bin/core-chunks/chunk-45LKWJ5D.mjs +7 -0
- package/dist/bin/core-chunks/chunk-4IE7LRH3.mjs +7 -0
- package/dist/bin/core-chunks/chunk-4MR5XSLO.mjs +8 -0
- package/dist/bin/core-chunks/chunk-4PPIE6GA.mjs +102 -0
- package/dist/bin/core-chunks/chunk-4PRD4EU2.mjs +7 -0
- package/dist/bin/core-chunks/chunk-4T7NGLNQ.mjs +16 -0
- package/dist/bin/core-chunks/chunk-5DZ2LTII.mjs +52 -0
- package/dist/bin/core-chunks/chunk-5EF5EOCL.mjs +7 -0
- package/dist/bin/core-chunks/chunk-5OWPZWEU.mjs +13 -0
- package/dist/bin/core-chunks/chunk-5TGZSK4C.mjs +10 -0
- package/dist/bin/core-chunks/chunk-5YLI5V3Q.mjs +8 -0
- package/dist/bin/core-chunks/chunk-5ZBACKED.mjs +14 -0
- package/dist/bin/core-chunks/chunk-623SNKDH.mjs +7 -0
- package/dist/bin/core-chunks/chunk-6FUCOGOW.mjs +7 -0
- package/dist/bin/core-chunks/chunk-6KNMT46X.mjs +18 -0
- package/dist/bin/core-chunks/chunk-6OYLZ4NM.mjs +10 -0
- package/dist/bin/core-chunks/chunk-6POAOY5C.mjs +19 -0
- package/dist/bin/core-chunks/chunk-6RT2P22O.mjs +7 -0
- package/dist/bin/core-chunks/chunk-6U3CYLY5.mjs +7 -0
- package/dist/bin/core-chunks/chunk-6U3MV7KZ.mjs +15 -0
- package/dist/bin/core-chunks/chunk-6XTLPAPZ.mjs +15 -0
- package/dist/bin/core-chunks/chunk-76YMLNLF.mjs +7 -0
- package/dist/bin/core-chunks/chunk-7BU6SJBC.mjs +17 -0
- package/dist/bin/core-chunks/chunk-7QTE6X4J.mjs +7 -0
- package/dist/bin/core-chunks/chunk-7ZHWJSW5.mjs +8 -0
- package/dist/bin/core-chunks/chunk-ACIOJQSI.mjs +14 -0
- package/dist/bin/core-chunks/chunk-AJXELVNH.mjs +7 -0
- package/dist/bin/core-chunks/chunk-ALTQ3KL4.mjs +7 -0
- package/dist/bin/core-chunks/chunk-ANBDOI53.mjs +8 -0
- package/dist/bin/core-chunks/chunk-ANVCA6LF.mjs +7 -0
- package/dist/bin/core-chunks/chunk-AS3LWTQ4.mjs +16 -0
- package/dist/bin/core-chunks/chunk-B2HY22OD.mjs +50 -0
- package/dist/bin/core-chunks/chunk-B7AQHL7B.mjs +7 -0
- package/dist/bin/core-chunks/chunk-BSR3XUBD.mjs +24 -0
- package/dist/bin/core-chunks/chunk-BTSHD3XJ.mjs +9 -0
- package/dist/bin/core-chunks/chunk-BUD3R6LF.mjs +9 -0
- package/dist/bin/core-chunks/chunk-C35JQUWD.mjs +8 -0
- package/dist/bin/core-chunks/chunk-C7YBUD4K.mjs +10 -0
- package/dist/bin/core-chunks/chunk-CA2VFWFP.mjs +21 -0
- package/dist/bin/core-chunks/chunk-CB3CNJTL.mjs +10 -0
- package/dist/bin/core-chunks/chunk-CFD6CW7T.mjs +46 -0
- package/dist/bin/core-chunks/chunk-CKYBGRCF.mjs +8 -0
- package/dist/bin/core-chunks/chunk-CUIB6CTG.mjs +20 -0
- package/dist/bin/core-chunks/chunk-CVKMV22J.mjs +17 -0
- package/dist/bin/core-chunks/chunk-CWLGRKA7.mjs +6 -0
- package/dist/bin/core-chunks/chunk-CXKDKMYE.mjs +9 -0
- package/dist/bin/core-chunks/chunk-CXNVDJNN.mjs +7 -0
- package/dist/bin/core-chunks/chunk-D62TAZG6.mjs +9 -0
- package/dist/bin/core-chunks/chunk-DEYAQEF5.mjs +7 -0
- package/dist/bin/core-chunks/chunk-DIEPWXJJ.mjs +7 -0
- package/dist/bin/core-chunks/chunk-DMO3ZFUG.mjs +1259 -0
- package/dist/bin/core-chunks/chunk-DOJPSIMG.mjs +7 -0
- package/dist/bin/core-chunks/chunk-DTMZBK4E.mjs +7 -0
- package/dist/bin/core-chunks/chunk-DW4QMD6J.mjs +10 -0
- package/dist/bin/core-chunks/chunk-DZDEBDAB.mjs +10 -0
- package/dist/bin/core-chunks/chunk-DZVOFEM5.mjs +7 -0
- package/dist/bin/core-chunks/chunk-E5QQDYBR.mjs +7 -0
- package/dist/bin/core-chunks/chunk-E73HSXCX.mjs +7 -0
- package/dist/bin/core-chunks/chunk-EFSPBB4S.mjs +8 -0
- package/dist/bin/core-chunks/chunk-EHVU2SMR.mjs +34 -0
- package/dist/bin/core-chunks/chunk-ESB4ALH2.mjs +7 -0
- package/dist/bin/core-chunks/chunk-EZRNQXCC.mjs +7 -0
- package/dist/bin/core-chunks/chunk-F2FKQUYE.mjs +19 -0
- package/dist/bin/core-chunks/chunk-F7OOBAJO.mjs +30 -0
- package/dist/bin/core-chunks/chunk-FATYLG3L.mjs +14 -0
- package/dist/bin/core-chunks/chunk-FOUBHU4X.mjs +7 -0
- package/dist/bin/core-chunks/chunk-FOWTB762.mjs +7 -0
- package/dist/bin/core-chunks/chunk-GGGDYL4P.mjs +7 -0
- package/dist/bin/core-chunks/chunk-GHSRH4GL.mjs +8 -0
- package/dist/bin/core-chunks/chunk-GSNQKBHZ.mjs +11 -0
- package/dist/bin/core-chunks/chunk-GTG67Z45.mjs +11 -0
- package/dist/bin/core-chunks/chunk-H2KNJUPN.mjs +23 -0
- package/dist/bin/core-chunks/chunk-HA7Y76GF.mjs +7 -0
- package/dist/bin/core-chunks/chunk-HCPQZRR3.mjs +7 -0
- package/dist/bin/core-chunks/chunk-HPCSSJXH.mjs +7 -0
- package/dist/bin/core-chunks/chunk-HU5ERAAV.mjs +8 -0
- package/dist/bin/core-chunks/chunk-HVXWQ2XZ.mjs +7 -0
- package/dist/bin/core-chunks/chunk-HYIT7MF5.mjs +8 -0
- package/dist/bin/core-chunks/chunk-HYMJVHAX.mjs +13 -0
- package/dist/bin/core-chunks/chunk-ID2C2S33.mjs +18 -0
- package/dist/bin/core-chunks/chunk-ID5KE74L.mjs +7 -0
- package/dist/bin/core-chunks/chunk-IJNKHQIS.mjs +10 -0
- package/dist/bin/core-chunks/chunk-INJ5WT2D.mjs +7 -0
- package/dist/bin/core-chunks/chunk-IOFCSTGM.mjs +7 -0
- package/dist/bin/core-chunks/chunk-J6Y7IVFQ.mjs +7 -0
- package/dist/bin/core-chunks/chunk-JCWA7NLM.mjs +7 -0
- package/dist/bin/core-chunks/chunk-JGGQSMZC.mjs +8 -0
- package/dist/bin/core-chunks/chunk-JPMUJY42.mjs +7 -0
- package/dist/bin/core-chunks/chunk-JT4RNQ67.mjs +15 -0
- package/dist/bin/core-chunks/chunk-KI4OY3UQ.mjs +18 -0
- package/dist/bin/core-chunks/chunk-KPR5TWSN.mjs +7 -0
- package/dist/bin/core-chunks/chunk-KUQLXY2P.mjs +11 -0
- package/dist/bin/core-chunks/chunk-L3DJN3XD.mjs +12 -0
- package/dist/bin/core-chunks/chunk-L4TUXFCL.mjs +7 -0
- package/dist/bin/core-chunks/chunk-L5LFLI4R.mjs +7 -0
- package/dist/bin/core-chunks/chunk-LFOQ7FCR.mjs +10 -0
- package/dist/bin/core-chunks/chunk-LGX2GM45.mjs +7 -0
- package/dist/bin/core-chunks/chunk-LTKUTRRL.mjs +7 -0
- package/dist/bin/core-chunks/chunk-LZILSE5H.mjs +8 -0
- package/dist/bin/core-chunks/chunk-MCY7OXED.mjs +10 -0
- package/dist/bin/core-chunks/chunk-MG3YN3AI.mjs +7 -0
- package/dist/bin/core-chunks/chunk-MPU3VM6Z.mjs +7 -0
- package/dist/bin/core-chunks/chunk-MR5XXHRK.mjs +8 -0
- package/dist/bin/core-chunks/chunk-MXJF3FA7.mjs +7 -0
- package/dist/bin/core-chunks/chunk-MXJKULJY.mjs +9 -0
- package/dist/bin/core-chunks/chunk-NINFE7GS.mjs +9 -0
- package/dist/bin/core-chunks/chunk-NNILF7R3.mjs +7 -0
- package/dist/bin/core-chunks/chunk-NNOX3UU4.mjs +7 -0
- package/dist/bin/core-chunks/chunk-NOHSLOLL.mjs +7 -0
- package/dist/bin/core-chunks/chunk-NXUIMC22.mjs +13 -0
- package/dist/bin/core-chunks/chunk-NZKUCQZK.mjs +8 -0
- package/dist/bin/core-chunks/chunk-O5N6XYPU.mjs +8 -0
- package/dist/bin/core-chunks/chunk-O5VCBMEK.mjs +25 -0
- package/dist/bin/core-chunks/chunk-OE27RFLJ.mjs +8 -0
- package/dist/bin/core-chunks/chunk-OGM34Z6W.mjs +8 -0
- package/dist/bin/core-chunks/chunk-OIE3AKKO.mjs +7 -0
- package/dist/bin/core-chunks/chunk-OXKGN3HG.mjs +7 -0
- package/dist/bin/core-chunks/chunk-P2KU4FFA.mjs +11 -0
- package/dist/bin/core-chunks/chunk-PIA26GWG.mjs +7 -0
- package/dist/bin/core-chunks/chunk-PPSVWUXC.mjs +15 -0
- package/dist/bin/core-chunks/chunk-PQTR6XVW.mjs +7 -0
- package/dist/bin/core-chunks/chunk-PWL3KS7Y.mjs +7 -0
- package/dist/bin/core-chunks/chunk-Q3LUL6LL.mjs +7 -0
- package/dist/bin/core-chunks/chunk-Q6C27OL7.mjs +7 -0
- package/dist/bin/core-chunks/chunk-Q7GJIU6D.mjs +8 -0
- package/dist/bin/core-chunks/chunk-QAIEAOJF.mjs +7 -0
- package/dist/bin/core-chunks/chunk-QWRPJARA.mjs +14 -0
- package/dist/bin/core-chunks/chunk-QZ7T2EYR.mjs +25 -0
- package/dist/bin/core-chunks/chunk-RACISWUV.mjs +10 -0
- package/dist/bin/core-chunks/chunk-RCIWCKL7.mjs +9 -0
- package/dist/bin/core-chunks/chunk-ROOCBUKH.mjs +8 -0
- package/dist/bin/core-chunks/chunk-RP7F67ZT.mjs +7 -0
- package/dist/bin/core-chunks/chunk-RXZJB43D.mjs +7 -0
- package/dist/bin/core-chunks/chunk-S6FBPXQL.mjs +9 -0
- package/dist/bin/core-chunks/chunk-SLYLGDX7.mjs +8 -0
- package/dist/bin/core-chunks/chunk-SO3ZPNWT.mjs +7 -0
- package/dist/bin/core-chunks/chunk-SRJEX6XF.mjs +12 -0
- package/dist/bin/core-chunks/chunk-SROBBOJB.mjs +11 -0
- package/dist/bin/core-chunks/chunk-STFUT7R7.mjs +28 -0
- package/dist/bin/core-chunks/chunk-SUXIKMTS.mjs +30 -0
- package/dist/bin/core-chunks/chunk-TDTPDVUM.mjs +8 -0
- package/dist/bin/core-chunks/chunk-TIBYHZFA.mjs +8 -0
- package/dist/bin/core-chunks/chunk-TILUQF6L.mjs +8 -0
- package/dist/bin/core-chunks/chunk-TOORPP6K.mjs +7 -0
- package/dist/bin/core-chunks/chunk-U24YKPYX.mjs +7 -0
- package/dist/bin/core-chunks/chunk-U55OPVYR.mjs +9 -0
- package/dist/bin/core-chunks/chunk-UAYTDSYG.mjs +64 -0
- package/dist/bin/core-chunks/chunk-UHXV7MDW.mjs +12 -0
- package/dist/bin/core-chunks/chunk-UNIBFM6J.mjs +13 -0
- package/dist/bin/core-chunks/chunk-UNNY2IWZ.mjs +9 -0
- package/dist/bin/core-chunks/chunk-UX2ORID4.mjs +9 -0
- package/dist/bin/core-chunks/chunk-UYMZ3NAF.mjs +8 -0
- package/dist/bin/core-chunks/chunk-V6L5PLD7.mjs +18 -0
- package/dist/bin/core-chunks/chunk-V7R3L54M.mjs +7 -0
- package/dist/bin/core-chunks/chunk-V7VA4EQX.mjs +7 -0
- package/dist/bin/core-chunks/chunk-VCSESVZ4.mjs +9 -0
- package/dist/bin/core-chunks/chunk-VCYVYFWE.mjs +9 -0
- package/dist/bin/core-chunks/chunk-VJCTTFKP.mjs +8 -0
- package/dist/bin/core-chunks/chunk-VRFYDYQY.mjs +7 -0
- package/dist/bin/core-chunks/chunk-VWFVSNQT.mjs +7 -0
- package/dist/bin/core-chunks/chunk-W23JLJJZ.mjs +109 -0
- package/dist/bin/core-chunks/chunk-WCTVZQBG.mjs +8 -0
- package/dist/bin/core-chunks/chunk-WTDUJB4I.mjs +8 -0
- package/dist/bin/core-chunks/chunk-WZ6W5ZQ5.mjs +7 -0
- package/dist/bin/core-chunks/chunk-X433BB6F.mjs +7 -0
- package/dist/bin/core-chunks/chunk-XBR63NJA.mjs +7 -0
- package/dist/bin/core-chunks/chunk-XC6YAP36.mjs +7 -0
- package/dist/bin/core-chunks/chunk-XJTEPHLC.mjs +7 -0
- package/dist/bin/core-chunks/chunk-XLAGA5B7.mjs +10 -0
- package/dist/bin/core-chunks/chunk-XLFEWZRA.mjs +7 -0
- package/dist/bin/core-chunks/chunk-XSZOHNL4.mjs +7 -0
- package/dist/bin/core-chunks/chunk-XWLTEAGN.mjs +7 -0
- package/dist/bin/core-chunks/chunk-Y7XOKG4O.mjs +7 -0
- package/dist/bin/core-chunks/chunk-YEALP3WX.mjs +7 -0
- package/dist/bin/core-chunks/chunk-YJOC2JJK.mjs +12 -0
- package/dist/bin/core-chunks/chunk-YLYAYRSJ.mjs +8 -0
- package/dist/bin/core-chunks/chunk-YOGI4WE6.mjs +8 -0
- package/dist/bin/core-chunks/chunk-YOWW4LHK.mjs +8 -0
- package/dist/bin/core-chunks/chunk-YPLFWN62.mjs +7 -0
- package/dist/bin/core-chunks/chunk-YQ6HM3YO.mjs +10 -0
- package/dist/bin/core-chunks/chunk-YZEO5DZA.mjs +7 -0
- package/dist/bin/core-chunks/chunk-ZAUJWUUN.mjs +20 -0
- package/dist/bin/core-chunks/chunk-ZBBNCCGV.mjs +12 -0
- package/dist/bin/core-chunks/chunk-ZQ2XH76U.mjs +12 -0
- package/dist/bin/core-chunks/chunk-ZSANMA7K.mjs +7 -0
- package/dist/bin/core-chunks/chunk-ZXTJLMVZ.mjs +7 -0
- package/dist/bin/core-chunks/chunk-ZZR3LXCK.mjs +9 -0
- package/dist/bin/core-chunks/cleanup-installs-LD43GI4K.mjs +7 -0
- package/dist/bin/core-chunks/client-D43KKUYH.mjs +8 -0
- package/dist/bin/core-chunks/closest-command-YYNABM7V.mjs +7 -0
- package/dist/bin/core-chunks/cloud-RXHFZ7MX.mjs +14 -0
- package/dist/bin/core-chunks/code-IYK65A62.mjs +12 -0
- package/dist/bin/core-chunks/code-graph-cloud-G3WQBICY.mjs +7 -0
- package/dist/bin/core-chunks/codex-hooks-N5UHKK5B.mjs +7 -0
- package/dist/bin/core-chunks/codex-mcp-G7WNAT6T.mjs +7 -0
- package/dist/bin/core-chunks/codex-skill-IZNP76BJ.mjs +7 -0
- package/dist/bin/core-chunks/command-installer-4ENM4GZR.mjs +7 -0
- package/dist/bin/core-chunks/config-UVF7YOR6.mjs +8 -0
- package/dist/bin/core-chunks/config-manager-QY73WM5U.mjs +7 -0
- package/dist/bin/core-chunks/content-bound-stamp-2PJNI4JC.mjs +7 -0
- package/dist/bin/core-chunks/context-4GB6ICXK.mjs +38 -0
- package/dist/bin/core-chunks/context-MPHOQPXF.mjs +10 -0
- package/dist/bin/core-chunks/context-checkpoint-NBI5HKPV.mjs +27 -0
- package/dist/bin/core-chunks/context-pressure-5URQVNBC.mjs +7 -0
- package/dist/bin/core-chunks/context-tiers-NOKJ75QP.mjs +7 -0
- package/dist/bin/core-chunks/context7-service-2MYRUNKY.mjs +7 -0
- package/dist/bin/core-chunks/core-WMEHDCOK.mjs +70 -0
- package/dist/bin/core-chunks/crew-EYVSIX4L.mjs +24 -0
- package/dist/bin/core-chunks/cursor-hooks-DGDJVAI6.mjs +7 -0
- package/dist/bin/core-chunks/custom-workflow-storage-EBEIG54R.mjs +7 -0
- package/dist/bin/core-chunks/cwd-changed-EUJZOBIC.mjs +7 -0
- package/dist/bin/core-chunks/cycle-budget-card-H37XRAIX.mjs +7 -0
- package/dist/bin/core-chunks/daemon-QARP3RVX.mjs +13 -0
- package/dist/bin/core-chunks/database-UU2ZXSD4.mjs +7 -0
- package/dist/bin/core-chunks/delivery-geometry-GSJ6LXUC.mjs +7 -0
- package/dist/bin/core-chunks/detect-changes-2YIEX7AY.mjs +7 -0
- package/dist/bin/core-chunks/detection-KKDZYWVD.mjs +7 -0
- package/dist/bin/core-chunks/developer-evolution-AVAXGDKQ.mjs +11 -0
- package/dist/bin/core-chunks/developer-profile-2VSFJGCU.mjs +7 -0
- package/dist/bin/core-chunks/discuss-lock-CWXKBBYJ.mjs +7 -0
- package/dist/bin/core-chunks/distill-ZF7WHGCZ.mjs +7 -0
- package/dist/bin/core-chunks/doctor-heal-XFSVPSEY.mjs +7 -0
- package/dist/bin/core-chunks/doctor-service-6ZJBWIXR.mjs +8 -0
- package/dist/bin/core-chunks/drift-refresh-XPJAO2B3.mjs +7 -0
- package/dist/bin/core-chunks/dynasty-outcomes-KDWIEA4Y.mjs +11 -0
- package/dist/bin/core-chunks/editors-config-ELAQA6RV.mjs +7 -0
- package/dist/bin/core-chunks/embeddings-354ZYFKX.mjs +7 -0
- package/dist/bin/core-chunks/enriched-recall-MKBOXB7M.mjs +7 -0
- package/dist/bin/core-chunks/eval-O4YD6YOV.mjs +76 -0
- package/dist/bin/core-chunks/exec-34V6SJYO.mjs +7 -0
- package/dist/bin/core-chunks/file-helper-LLQKU6YF.mjs +7 -0
- package/dist/bin/core-chunks/format-SYVL4CV5.mjs +7 -0
- package/dist/bin/core-chunks/gemini-settings-RGD7JLSP.mjs +7 -0
- package/dist/bin/core-chunks/git-context-ZSWE3KWM.mjs +8 -0
- package/dist/bin/core-chunks/git-helpers-UC53D4FT.mjs +7 -0
- package/dist/bin/core-chunks/grok-mcp-IE2RRRRW.mjs +7 -0
- package/dist/bin/core-chunks/grok-plugin-SSANHBS7.mjs +7 -0
- package/dist/bin/core-chunks/grok-skill-7ZP7R7KO.mjs +7 -0
- package/dist/bin/core-chunks/guard-RT7U3LJX.mjs +13 -0
- package/dist/bin/core-chunks/guards-AXH6V2IJ.mjs +7 -0
- package/dist/bin/core-chunks/handoff-storage-NGUA4Y2L.mjs +7 -0
- package/dist/bin/core-chunks/harness-V7J7WIT2.mjs +43 -0
- package/dist/bin/core-chunks/health-TNB5OC37.mjs +11 -0
- package/dist/bin/core-chunks/help-P7EYELVK.mjs +14 -0
- package/dist/bin/core-chunks/hooks-service-REI56DDC.mjs +91 -0
- package/dist/bin/core-chunks/infer-memory-file-ATP7PSAQ.mjs +7 -0
- package/dist/bin/core-chunks/install-FZQJJWT5.mjs +9 -0
- package/dist/bin/core-chunks/judgment-G5KH6QFC.mjs +21 -0
- package/dist/bin/core-chunks/judgment-ledger-storage-ZTYXPMM4.mjs +7 -0
- package/dist/bin/core-chunks/judgment-orchestrator-E3SO3NVE.mjs +7 -0
- package/dist/bin/core-chunks/judgment-receipt-GO6QEZQC.mjs +7 -0
- package/dist/bin/core-chunks/kimi-hooks-TR6J3OVG.mjs +7 -0
- package/dist/bin/core-chunks/kimi-mcp-ETG7O6O5.mjs +7 -0
- package/dist/bin/core-chunks/land-cue-3BUD3KJJ.mjs +8 -0
- package/dist/bin/core-chunks/land-rho-MCTQDPRH.mjs +8 -0
- package/dist/bin/core-chunks/land-synthesis-MU4EZEYL.mjs +7 -0
- package/dist/bin/core-chunks/lean-26BWCUOR.mjs +34 -0
- package/dist/bin/core-chunks/legacy-crew-sweep-G5UJT2PM.mjs +23 -0
- package/dist/bin/core-chunks/living-context-contract-HZIVBMXX.mjs +7 -0
- package/dist/bin/core-chunks/llm-KMVXVBHG.mjs +18 -0
- package/dist/bin/core-chunks/mcp-BD5TOTCK.mjs +17 -0
- package/dist/bin/core-chunks/memory-dream-6GFV2GXN.mjs +14 -0
- package/dist/bin/core-chunks/memory-export-WJ4H7CFV.mjs +13 -0
- package/dist/bin/core-chunks/memory-index-7NIU34EI.mjs +7 -0
- package/dist/bin/core-chunks/notification-G654IX3O.mjs +7 -0
- package/dist/bin/core-chunks/notify-EWYUBKGO.mjs +9 -0
- package/dist/bin/core-chunks/nyquist-lite-A23B7G4B.mjs +9 -0
- package/dist/bin/core-chunks/one-breath-install-LVNIVN6S.mjs +7 -0
- package/dist/bin/core-chunks/opencode-mcp-L7NC77JF.mjs +7 -0
- package/dist/bin/core-chunks/output-D27IOQXR.mjs +7 -0
- package/dist/bin/core-chunks/pack-integrity-X277OVRB.mjs +9 -0
- package/dist/bin/core-chunks/pack-manager-VN7F6R47.mjs +7 -0
- package/dist/bin/core-chunks/package-R4FUTGOE.mjs +7 -0
- package/dist/bin/core-chunks/package-legitimacy-VHHGI4P7.mjs +7 -0
- package/dist/bin/core-chunks/path-manager-E5DCU5LP.mjs +7 -0
- package/dist/bin/core-chunks/performance-tracker-BFBNR3LY.mjs +7 -0
- package/dist/bin/core-chunks/pi-skill-IZQEUILZ.mjs +7 -0
- package/dist/bin/core-chunks/planning-NOWLKZDS.mjs +8 -0
- package/dist/bin/core-chunks/post-edit-GTBY32JU.mjs +7 -0
- package/dist/bin/core-chunks/pr-convention-37YHTUKM.mjs +7 -0
- package/dist/bin/core-chunks/pre-bash-32ZOGNSP.mjs +10 -0
- package/dist/bin/core-chunks/pre-commit-7TU2A7H4.mjs +7 -0
- package/dist/bin/core-chunks/pre-edit-ASEWA5TS.mjs +8 -0
- package/dist/bin/core-chunks/pre-package-ZTZACEBB.mjs +7 -0
- package/dist/bin/core-chunks/pre-search-MKDRFJSE.mjs +8 -0
- package/dist/bin/core-chunks/pre-secrets-RJELPDFY.mjs +7 -0
- package/dist/bin/core-chunks/precision-classifier-AV75OEVA.mjs +7 -0
- package/dist/bin/core-chunks/precision-judgment-MCX4MIIG.mjs +7 -0
- package/dist/bin/core-chunks/preferences-KO5U2ELK.mjs +31 -0
- package/dist/bin/core-chunks/primitives-GNUMBYOK.mjs +13 -0
- package/dist/bin/core-chunks/prjct-md-BSFV7OQQ.mjs +7 -0
- package/dist/bin/core-chunks/product-GUHSUNIH.mjs +68 -0
- package/dist/bin/core-chunks/project-agent-surfaces-BXCJJXB7.mjs +7 -0
- package/dist/bin/core-chunks/project-alignment-ADKW3ZWQ.mjs +17 -0
- package/dist/bin/core-chunks/project-file-inventory-XIHHJZUP.mjs +7 -0
- package/dist/bin/core-chunks/project-memory-L5MDZYST.mjs +7 -0
- package/dist/bin/core-chunks/project-style-evolution-HIMSJQQB.mjs +7 -0
- package/dist/bin/core-chunks/prompt-47YP5JIR.mjs +25 -0
- package/dist/bin/core-chunks/protocol-4AJ4J5SI.mjs +7 -0
- package/dist/bin/core-chunks/provider-cache-IWVTFLGT.mjs +7 -0
- package/dist/bin/core-chunks/provider-status-HQUBKMH5.mjs +7 -0
- package/dist/bin/core-chunks/publish-helper-2T2EHM3V.mjs +7 -0
- package/dist/bin/core-chunks/purge-6SJKHKIY.mjs +7 -0
- package/dist/bin/core-chunks/queue-storage-BKH5XX2E.mjs +7 -0
- package/dist/bin/core-chunks/registry-YM2EYUXY.mjs +7 -0
- package/dist/bin/core-chunks/reliability-repair-JMPZWDD4.mjs +20 -0
- package/dist/bin/core-chunks/removed-verbs-EU3WPRNK.mjs +7 -0
- package/dist/bin/core-chunks/retention-QSXWKE4H.mjs +7 -0
- package/dist/bin/core-chunks/retro-B2EBN4TA.mjs +13 -0
- package/dist/bin/core-chunks/review-risk-LBPY5M3K.mjs +12 -0
- package/dist/bin/core-chunks/run-recorder-EZQ32M55.mjs +7 -0
- package/dist/bin/core-chunks/safe-artifacts-PE2TMEZQ.mjs +9 -0
- package/dist/bin/core-chunks/sdd-3WNZJ6FU.mjs +9 -0
- package/dist/bin/core-chunks/seed-MMDJE2UO.mjs +10 -0
- package/dist/bin/core-chunks/self-heal-R5FBXEVQ.mjs +7 -0
- package/dist/bin/core-chunks/session-continuity-OQDB5UYI.mjs +10 -0
- package/dist/bin/core-chunks/session-start-FM6UL7MT.mjs +7 -0
- package/dist/bin/core-chunks/session-tracker-RG2FBWMS.mjs +7 -0
- package/dist/bin/core-chunks/settings-installer-4XHM3HAZ.mjs +7 -0
- package/dist/bin/core-chunks/setup-BL36ZWPW.mjs +140 -0
- package/dist/bin/core-chunks/setup-V75BWRHU.mjs +38 -0
- package/dist/bin/core-chunks/shipping-NZVM57JJ.mjs +12 -0
- package/dist/bin/core-chunks/signals-digest-P5BG6MZF.mjs +7 -0
- package/dist/bin/core-chunks/skill-adherence-JE3N3Y67.mjs +13 -0
- package/dist/bin/core-chunks/skill-generator-LKS5BNMY.mjs +7 -0
- package/dist/bin/core-chunks/skill-index-L4UWQCQE.mjs +11 -0
- package/dist/bin/core-chunks/spec-VC3VTUI3.mjs +27 -0
- package/dist/bin/core-chunks/spec-context-inference-KOINWBC7.mjs +9 -0
- package/dist/bin/core-chunks/spec-inventory-2TT7BTFZ.mjs +9 -0
- package/dist/bin/core-chunks/spec-service-UZ53XL6X.mjs +7 -0
- package/dist/bin/core-chunks/spec-task-breakdown-3Y7YXCIQ.mjs +7 -0
- package/dist/bin/core-chunks/state-storage-6CGFWW5D.mjs +7 -0
- package/dist/bin/core-chunks/stdin-spill-Y2A6WOOW.mjs +7 -0
- package/dist/bin/core-chunks/stop-6SH36ULT.mjs +15 -0
- package/dist/bin/core-chunks/subagent-start-TVGBV2V2.mjs +7 -0
- package/dist/bin/core-chunks/subagent-stop-APWY6KMX.mjs +7 -0
- package/dist/bin/core-chunks/surface-attribution-CQVM2SWY.mjs +7 -0
- package/dist/bin/core-chunks/symbol-graph-PCS43SHZ.mjs +7 -0
- package/dist/bin/core-chunks/sync-analyzer-M37Q4LE4.mjs +7 -0
- package/dist/bin/core-chunks/sync-client-6TAOTJWR.mjs +7 -0
- package/dist/bin/core-chunks/sync-cursor-storage-GKO4X2QN.mjs +18 -0
- package/dist/bin/core-chunks/task-orchestration-GS4J4KGS.mjs +7 -0
- package/dist/bin/core-chunks/task-overview-XSMK7YEN.mjs +7 -0
- package/dist/bin/core-chunks/task-service-KFYL5NT4.mjs +7 -0
- package/dist/bin/core-chunks/tdd-P2PP4RR4.mjs +9 -0
- package/dist/bin/core-chunks/team-WKAAOEFE.mjs +42 -0
- package/dist/bin/core-chunks/template-loader-H4FE37HV.mjs +7 -0
- package/dist/bin/core-chunks/token-backfill-WPXXD5MP.mjs +12 -0
- package/dist/bin/core-chunks/token-economics-JZAQJUET.mjs +7 -0
- package/dist/bin/core-chunks/transcript-jsonl-OC7TH4Q3.mjs +7 -0
- package/dist/bin/core-chunks/trust-boundary-24F662RM.mjs +7 -0
- package/dist/bin/core-chunks/uninstall-W6EAUS7N.mjs +13 -0
- package/dist/bin/core-chunks/update-PSHEJJI5.mjs +11 -0
- package/dist/bin/core-chunks/update-checker-LZCUPWQB.mjs +7 -0
- package/dist/bin/core-chunks/usefulness-A3GRKFL3.mjs +7 -0
- package/dist/bin/core-chunks/user-home-BODIAXR4.mjs +7 -0
- package/dist/bin/core-chunks/vault-retire-notice-FDRT7BJG.mjs +8 -0
- package/dist/bin/core-chunks/velocity-storage-5T7RYOWH.mjs +7 -0
- package/dist/bin/core-chunks/verb-names-QWGYABFH.mjs +7 -0
- package/dist/bin/core-chunks/version-B5DBRVGQ.mjs +7 -0
- package/dist/bin/core-chunks/watch-service-7V3O52TW.mjs +9 -0
- package/dist/bin/core-chunks/weak-frontier-demo-ZCDTMYRO.mjs +7 -0
- package/dist/bin/core-chunks/weak-model-mode-LOAPFJPQ.mjs +7 -0
- package/dist/bin/core-chunks/work-graph-WHMCFN6U.mjs +7 -0
- package/dist/bin/core-chunks/work-graph-ZNV7S6EU.mjs +16 -0
- package/dist/bin/core-chunks/work-scope-XXPUH6TU.mjs +7 -0
- package/dist/bin/core-chunks/workflow-XM77QYRF.mjs +61 -0
- package/dist/bin/core-chunks/workflows-reference-T7RH7IGJ.mjs +7 -0
- package/dist/bin/core-chunks/workspace-occupancy-JUXKZBUZ.mjs +7 -0
- package/dist/bin/core-chunks/worktree-service-YRRPFU57.mjs +11 -0
- package/dist/bin/core-chunks/world-model-impact-FAGGNUGN.mjs +7 -0
- package/dist/bin/hook-chunks/{agent-switch-I4MTVE56.mjs → agent-switch-TAJWH2ZD.mjs} +1 -1
- package/dist/bin/hook-chunks/{analysis-VN7APBHR.mjs → analysis-34WDLUXK.mjs} +2 -2
- package/dist/bin/hook-chunks/{auto-flush-DX3FVSQE.mjs → auto-flush-7TIEBPPQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{capture-gate-MEIQD7ZS.mjs → capture-gate-JFVGG7RB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-UVATSTRF.mjs → chunk-22CBVTZ3.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-MW54MTLB.mjs → chunk-3JOZN7YJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-E7NA34VQ.mjs → chunk-4X3KUIXK.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-3AHW4XQH.mjs → chunk-5ALQBNIZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-H2DGDAQP.mjs → chunk-5VPZI2ZF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-XYKVWO23.mjs → chunk-6EHYPQ5U.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-6NMHVPAI.mjs +35 -0
- package/dist/bin/hook-chunks/chunk-7H5UVM6X.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-LR24AIEW.mjs → chunk-A3R47SP6.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-AFGXKRRP.mjs +12 -0
- package/dist/bin/hook-chunks/{chunk-64ZEBHDX.mjs → chunk-CGAKJDKT.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-EI6VQZOX.mjs → chunk-CJY4Y5SO.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-FSFURDAE.mjs +16 -0
- package/dist/bin/hook-chunks/{chunk-ZZBNFNMG.mjs → chunk-FTBBQHI4.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-G4VJKPG7.mjs +69 -0
- package/dist/bin/hook-chunks/{chunk-7PBWIO4K.mjs → chunk-GAJOSSB4.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-DB226JIV.mjs → chunk-GER6HFWV.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-LQLCYBFF.mjs → chunk-H3GIYI4Q.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-KDNUQPAK.mjs → chunk-HRU2KNEB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-33BHU4OM.mjs → chunk-LCGWETJ6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-WL6PKX3U.mjs → chunk-MG2DNP4Z.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-XV2LJVYB.mjs → chunk-MIJZT4ZR.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-NGB6JNSB.mjs +18 -0
- package/dist/bin/hook-chunks/{chunk-IJ523YO2.mjs → chunk-OALZUWC6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-EGCYDLSO.mjs → chunk-PZMBZ6GE.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-RT2DFIWF.mjs → chunk-QIB6Y6AH.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-ZQI4TJ5C.mjs → chunk-QMNZPNVY.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-YLOK4WRR.mjs → chunk-R4YDE3GU.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-WJV24WE6.mjs → chunk-RFKRKUHB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-SWJ7TLBD.mjs → chunk-RGOTJCZU.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-FZS3XGEA.mjs → chunk-RLKYEL3F.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-LF3S3MYE.mjs → chunk-T2KVL6PZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NLL5AV2G.mjs → chunk-T7DRHVK3.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-KV4NXLPT.mjs → chunk-TWFLW6OJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ADYTBOCZ.mjs → chunk-UJIOGFNP.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-Y3RHBU2R.mjs → chunk-UK24P7PV.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-OLQAMCYV.mjs → chunk-ULNGKZB6.mjs} +5 -5
- package/dist/bin/hook-chunks/{chunk-UMJ5D5I6.mjs → chunk-UWHVPO6X.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-YHOZTAZH.mjs → chunk-V6GGH6H5.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-EXVL2OFE.mjs → chunk-XC2BSGWF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-JZDZH6IV.mjs → chunk-YATXTHDL.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-DCHIPMOG.mjs → chunk-ZF2EVMY7.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-PVCEWFHS.mjs → chunk-ZPAY2NSF.mjs} +2 -2
- package/dist/bin/hook-chunks/{codex-skill-6CRFUF3A.mjs → codex-skill-BFRU5FTP.mjs} +1 -1
- package/dist/bin/hook-chunks/{command-installer-MUHZWDZA.mjs → command-installer-3XOZGKOQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{config-manager-2JJPCLKC.mjs → config-manager-UPB7NEXF.mjs} +1 -1
- package/dist/bin/hook-chunks/{context7-service-NH4BMGSJ.mjs → context7-service-7VFXEQVN.mjs} +1 -1
- package/dist/bin/hook-chunks/{cwd-changed-UTD6Y4MS.mjs → cwd-changed-USNJYUH7.mjs} +1 -1
- package/dist/bin/hook-chunks/{distill-5TNAM3LY.mjs → distill-47YVL7IH.mjs} +1 -1
- package/dist/bin/hook-chunks/{enriched-recall-6VOIUNLN.mjs → enriched-recall-CVYI52NO.mjs} +1 -1
- package/dist/bin/hook-chunks/{format-IIOFTSBF.mjs → format-DPIN45EG.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-receipt-QLV3MYFT.mjs → judgment-receipt-G2DKQR7U.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-cue-57B23PEL.mjs → land-cue-3JD2TXFP.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-synthesis-ZVPFJERV.mjs → land-synthesis-5C4KGCTB.mjs} +1 -1
- package/dist/bin/hook-chunks/{legacy-crew-sweep-GR6HRSHX.mjs → legacy-crew-sweep-XQNXNZES.mjs} +2 -2
- package/dist/bin/hook-chunks/{memory-index-XE2MWKQS.mjs → memory-index-LL6SQJ2N.mjs} +1 -1
- package/dist/bin/hook-chunks/{notification-GU2ZJP5K.mjs → notification-ACQBRJG3.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-integrity-WV5U3AFF.mjs → pack-integrity-DCXVRRJZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-manager-QLFQKP24.mjs → pack-manager-KYWKNYUY.mjs} +1 -1
- package/dist/bin/hook-chunks/{planning-VPAX5DZL.mjs → planning-KOU3XKWS.mjs} +2 -2
- package/dist/bin/hook-chunks/{post-edit-UXCFSR3Y.mjs → post-edit-CK2MYQEN.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-bash-MB4JNNYG.mjs → pre-bash-W5A5CTR3.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-commit-U7TRFKWX.mjs → pre-commit-5Q24RM4S.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-edit-MDCQXI5F.mjs → pre-edit-YIJ4BCYL.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-package-A6ZI5R64.mjs → pre-package-O4RMVA4T.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-search-ZZO3LGXJ.mjs → pre-search-WYOWC3D6.mjs} +1 -1
- package/dist/bin/hook-chunks/{prjct-md-MS52YLI2.mjs → prjct-md-2UVHFYTJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-agent-surfaces-6AIW7KL6.mjs → project-agent-surfaces-BKFYUMRV.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-memory-UDH56VFP.mjs → project-memory-OC5GTJPY.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-style-evolution-IJXT2MCP.mjs → project-style-evolution-2IFJCACQ.mjs} +1 -1
- package/dist/bin/hook-chunks/prompt-JIWMP563.mjs +26 -0
- package/dist/bin/hook-chunks/{purge-N2WN6NDB.mjs → purge-FQK3Z4QS.mjs} +1 -1
- package/dist/bin/hook-chunks/{retention-RET4P2RO.mjs → retention-2FETBJFG.mjs} +1 -1
- package/dist/bin/hook-chunks/{sdd-PB6WKSLE.mjs → sdd-V43TSJ2P.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-continuity-BIJXMN44.mjs → session-continuity-RO2ACICF.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-start-R2VMKW2L.mjs → session-start-FKKFMKQ5.mjs} +1 -1
- package/dist/bin/hook-chunks/{setup-PPIZHVXS.mjs → setup-YV2DKG5L.mjs} +2 -2
- package/dist/bin/hook-chunks/{shipping-C637PCOF.mjs → shipping-SCNFEXBY.mjs} +4 -4
- package/dist/bin/hook-chunks/{spec-context-inference-RTTDOZZO.mjs → spec-context-inference-BD3ANTXA.mjs} +1 -1
- package/dist/bin/hook-chunks/{spec-service-ENLAAMVL.mjs → spec-service-OWYOAGXS.mjs} +2 -2
- package/dist/bin/hook-chunks/{spec-task-breakdown-RUDEP3AY.mjs → spec-task-breakdown-HOTLUFDM.mjs} +1 -1
- package/dist/bin/hook-chunks/{state-storage-AJUPG7J5.mjs → state-storage-EMWLIFQJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{stop-DPXAWJFN.mjs → stop-MIXT7WXA.mjs} +3 -3
- package/dist/bin/hook-chunks/{subagent-start-AFHPXL2S.mjs → subagent-start-NO3TN65K.mjs} +1 -1
- package/dist/bin/hook-chunks/{subagent-stop-5BMV63ML.mjs → subagent-stop-CKWIXX7W.mjs} +1 -1
- package/dist/bin/hook-chunks/{surface-attribution-EGIKCVMF.mjs → surface-attribution-BYESPLXM.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-overview-F3GB77OA.mjs → task-overview-P3VRH2FD.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-service-FZABHPFV.mjs → task-service-5ONSBKKP.mjs} +1 -1
- package/dist/bin/hook-chunks/{tdd-TAMBOPN3.mjs → tdd-SESB4IG3.mjs} +1 -1
- package/dist/bin/hook-chunks/{template-loader-MXOMU4XH.mjs → template-loader-KO67FVHO.mjs} +1 -1
- package/dist/bin/hook-chunks/{weak-model-mode-BMSPGEQY.mjs → weak-model-mode-HPXBKXJT.mjs} +1 -1
- package/dist/bin/hook-chunks/{work-scope-YCS4GTXW.mjs → work-scope-RNPGACPA.mjs} +1 -1
- package/dist/bin/hook-chunks/{workspace-occupancy-JOBYNNXV.mjs → workspace-occupancy-3NEAXILW.mjs} +1 -1
- package/dist/bin/prjct-core.mjs +9 -3323
- package/dist/bin/prjct-hooks.mjs +1 -1
- package/dist/bin/prjct.mjs +7 -1
- package/dist/daemon/entry.mjs +591 -582
- package/dist/mcp/server.mjs +320 -313
- package/package.json +4 -2
- package/dist/bin/hook-chunks/chunk-3UB6SFRA.mjs +0 -11
- package/dist/bin/hook-chunks/chunk-D7DQABWO.mjs +0 -35
- package/dist/bin/hook-chunks/chunk-IWUF2LGO.mjs +0 -18
- package/dist/bin/hook-chunks/chunk-M4YM7Z3F.mjs +0 -69
- package/dist/bin/hook-chunks/chunk-TB57OYGW.mjs +0 -16
- package/dist/bin/hook-chunks/chunk-ZYCNW75E.mjs +0 -9
- package/dist/bin/hook-chunks/prompt-7VZLYONO.mjs +0 -24
|
@@ -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 e}from"./chunk-3TRXQAU4.mjs";var t={suggestedPersona:{role:"DEV",mcps:["github"]},memoryTypes:["fact","decision","learning","gotcha","pattern","anti-pattern","shipped"],workflowSlots:{ship:{description:"Publish finished work \u2014 tests, commit, push, PR."},review:{description:"Pre-commit or pre-PR review pass."}},hookSignals:[]},i={code:{name:"code",version:"1.1.0",description:"Coding work: features, bugs, refactors, TDD, shipping.",...t,suggestedTags:{domain:["auth","api","frontend","infra","data"]},configDefaults:{sdd:"advisory",tdd:"assist",maxTurnsPerCycle:25,deliveryGeometry:"advisory",land:"strict",conflictMode:"advisory"}},"code-strict":{name:"code-strict",version:"1.1.0",description:"Ship-grade coding: SDD+TDD strict, delivery-geometry gate, forced land. Opt-in.",...t,configDefaults:{sdd:"strict",tdd:"strict",maxTurnsPerCycle:25,deliveryGeometry:"strict",land:"strict",conflictMode:"strict"}},daily:{name:"daily",version:"1.0.0",description:"Day-to-day capture + review. GTD-style inbox + weekly review.",memoryTypes:["inbox","todo","idea"],workflowSlots:{morning:{description:"Morning briefing \u2014 pull open todos + upcoming commitments."},clarify:{description:"Reclassify inbox entries to real memory types."},review:{description:"Weekly/biweekly review across memory."}},hookSignals:[]},pm:{name:"pm",version:"1.0.0",description:"Product Management: specs, user interviews, roadmap, backlog triage.",suggestedPersona:{role:"PM",mcps:["linear","posthog"]},memoryTypes:["insight","question","stakeholder","decision","source"],workflowSlots:{spec:{description:"Draft a technical/product spec from captured insights."},triage:{description:"Review Linear backlog and prioritize."},interview:{description:"User interview pre-brief + post-synthesis."}},hookSignals:[{event:"UserPromptSubmit",ifMatches:"spec|requirements?|prd",inject:["type=insight","type=question"]}],suggestedTags:{audience:["team","stakeholders"],quarter:["q1","q2","q3","q4"]}},founder:{name:"founder",version:"1.0.0",description:"Founder ops: strategy, fundraising, hiring, stakeholder comms.",suggestedPersona:{role:"Founder",mcps:["gmail","linear","posthog"]},memoryTypes:["goal","okr","person","stakeholder","decision","shipped"],workflowSlots:{"investor-update":{description:"Monthly investor update draft."},"1on1":{description:"1:1 prep + synthesis."},strategy:{description:"Strategy checkpoint \u2014 OKR progress + pivots."}},hookSignals:[{event:"UserPromptSubmit",ifMatches:"investor|board|update|fundrais",inject:["type=okr","type=shipped","type=stakeholder"]}],suggestedTags:{audience:["board","investors","team"]}},lean:{name:"lean",version:"1.0.0",description:"Anti-over-engineering: minimal-code review, debt ledger, intensity modes.",memoryTypes:["over-engineering","lean-debt"],workflowSlots:{review:{description:"Flag over-engineering in the current diff."},audit:{description:"Repo-wide over-engineering assessment."},debt:{description:"Harvest deferred-simplification (lean:) markers."}},hookSignals:[{event:"UserPromptSubmit",ifMatches:"simplif|over-?engineer|yagni|too complex|leaner",inject:["type=over-engineering","type=lean-debt"]}],suggestedTags:{intensity:["lite","full","ultra"]}},research:{name:"research",version:"1.0.0",description:"Research: deep-dives, literature review, competitive scans.",suggestedPersona:{role:"Research",mcps:["web"]},memoryTypes:["source","claim","question","insight"],workflowSlots:{"lit-review":{description:"Literature review across captured sources."},analyze:{description:"Data analysis run via MCP, persist findings."}},hookSignals:[],suggestedTags:{confidence:["high","medium","low"]}}},s=Object.keys(i);function o(r){return i[r]??null}e(o,"getPackManifest");export{i as a,s as b,o as c};
|
|
@@ -0,0 +1,9 @@
|
|
|
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{c as y}from"./chunk-NOHSLOLL.mjs";import{e as O}from"./chunk-RCIWCKL7.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";var q=/(^|\/)(auth|security|crypto|migration|migrations|password|oauth|payment|billing|secret|token|session|rbac|acl)(\/|\.|$)/i;function T(e){return e?.length?e.some(n=>q.test(n)):!1}s(T,"isHotPath");function X(e,n={}){return n.harnessLevel==="H3"||n.harnessKind==="security"||T(n.paths)?"full":e==="trivial"?"skip":e==="normal"?"standard":"full"}s(X,"routeIntensity");function ge(e,n={}){let t=O(e);return{tier:t,intensity:X(t,n)}}s(ge,"intensityFromChangeset");function b(e){let n=e.title.toLowerCase().replace(/[^a-z0-9\s]/g," ").replace(/\s+/g," ").trim().slice(0,120),t=(e.file??"").toLowerCase().replace(/\\/g,"/"),i=e.line&&e.line>0?String(Math.floor(e.line/5)*5):"";return`dna:${Y(`${n}|${t}|${i}`)}`}s(b,"findingDna");function Y(e){return(e.split("").reduce((t,i)=>Math.imul(t^i.charCodeAt(0),16777619),2166136261)>>>0).toString(16).padStart(8,"0")}s(Y,"hash32");function F(e){let n=!!e.file?.trim(),t=typeof e.line=="number"&&e.line>0,i=!!(e.evidence&&e.evidence.trim().length>=12);return n&&t&&i?3:n&&t?2:n?1:0}s(F,"evidenceScore");function _(e){let n=F(e),t=e.severity,i=t==="blocker"&&n<2?"critical":t==="critical"&&n===0?"warning":t,r=i==="warning"||i==="suggestion"?"info":e.status==="info"?"candidate":e.status;return{...e,severity:i,status:r,evidenceScore:n,dna:e.dna??b(e),blast:e.blast??S({...e,severity:i,evidenceScore:n})}}s(_,"applyEvidenceTax");var Q=/\b(prefer[- ]const|use const|should be const|can be const|const instead|instead of let|never reassigned|not reassigned|let\s*→\s*const|change let to const|let is unnecessary|why let|por qu[eé] let)\b/i;function Z(e){return Q.test(e)}s(Z,"isPreferConstClaim");function fe(e){let n=`${e.title}
|
|
8
|
+
${e.evidence??""}`;if(!Z(n))return e;if(F(e)<3){let i="[CONST-ONLY TAX: include file:line + snippet and propose an immutable rewrite; title-only findings are noise]";return _({...e,severity:"suggestion",status:"info",evidence:e.evidence?`${e.evidence}
|
|
9
|
+
${i}`:i})}return e}s(fe,"applyMechanicalStyleRefute");var R={blocker:100,critical:70,warning:20,suggestion:5};function S(e){return(R[e.severity]??0)+(e.evidenceScore??0)*5+(e.file&&T([e.file])?25:0)+(e.status==="stands"?10:0)+(e.status==="open"?15:0)}s(S,"blastRank");function N(e,n){return[...e].filter(t=>f(t.severity)&&(t.status==="stands"||t.status==="candidate"||t.status==="open"||t.status==="fixed")&&A(t.file,n)).sort((t,i)=>(i.blast??S(i))-(t.blast??S(t)))}s(N,"rankFindingsForFix");function f(e){return e==="blocker"||e==="critical"}s(f,"isActionableSeverity");function j(e){let n=_(e);return f(n.severity)?n.status==="info"?{...n,status:"candidate"}:n:{...n,status:"info"}}s(j,"applySeverityFloor");function pe(e){return e.map(j)}s(pe,"applySeverityFloorAll");function ee(e,n,t,i){let r=n.dna;return r?{ghosts:(e.ghosts.find(d=>d.dna===r)?e.ghosts.map(d=>d.dna===r?{...d,times:d.times+1,lastSeenAt:t,lastReason:i??d.lastReason,title:n.title||d.title}:d):[...e.ghosts,{dna:r,title:n.title,times:1,lastSeenAt:t,lastReason:i}]).sort((d,p)=>p.times-d.times).slice(0,200),updatedAt:t}:e}s(ee,"markGhost");function me(e,n,t){return n.reduce((i,r)=>r.status==="refuted"&&r.dna?ee(i,r,t,"refuted by panel"):i,e)}s(me,"recordRefutedAsGhosts");function he(e,n){if(!n?.ghosts.length)return e;let t=new Map(n.ghosts.map(i=>[i.dna,i]));return e.map(i=>{let r=i.dna??b(i),o=t.get(r);return o?{...i,dna:r,knownFalsePositive:!0,evidence:i.evidence?`${i.evidence} [GHOST: refuted ${o.times}\xD7 in this project]`:`[GHOST: refuted ${o.times}\xD7 here \u2014 challenge hard]`}:{...i,dna:r}})}s(he,"applyGhostFilter");function ve(e,n,t=se){let i=new Map,r=s(c=>{for(let m of c.findings){let h=b(m),v=i.get(h)??[];v.push({role:c.role,raw:m}),i.set(h,v)}},"ingest");r({...e,role:"red"}),r({...n,role:"blue"});let o=[...i].map(([c,m])=>{let h=new Set(m.map(l=>l.role)),v=h.has("red"),P=h.has("blue"),H=m.filter(l=>l.role==="red"),V=m.filter(l=>l.role==="blue"),x=[...m].sort((l,B)=>{let W=R[l.raw.severity]+F(l.raw)*5;return R[B.raw.severity]+F(B.raw)*5-W})[0].raw,z=[...h],M=H.some(l=>f(l.raw.severity)),U=V.some(l=>f(l.raw.severity)),K=v&&P?M!==U?"contradicted":"agreed":v?"onlyRed":"onlyBlue";return{finding:j({id:t(),severity:x.severity,status:"candidate",title:x.title,file:x.file,line:x.line,evidence:x.evidence,judge:x.judge??[...h].join("+"),role:v&&P?void 0:v?"red":"blue",dna:c,agreedBy:z}),outcome:K}}),a=o.map(({finding:c})=>c),u=o.filter(({outcome:c})=>c==="agreed").length,d=o.filter(({outcome:c})=>c==="onlyRed").length,p=o.filter(({outcome:c})=>c==="onlyBlue").length,g=o.filter(({outcome:c})=>c==="contradicted").length,C=g>0;return{findings:a,agreed:u,onlyRed:d,onlyBlue:p,contradicted:g,shouldEscalate:C,escalateReason:C?`${g} dual-blind contradiction(s): red says actionable, blue says not (or reverse). Do not tie-break \u2014 escalate to user.`:""}}s(ve,"mergeDualJudges");function D(e){return e==="full"?3:1}s(D,"refutePanelSize");function te(e,n){let t=e??[];if(t.length===0)return"stands";if(n===1)return t[0]==="refuted"?"refuted":"stands";let i=[...t];for(;i.length<3;)i.push("stands");return i.slice(0,3).filter(o=>o==="refuted").length>=2?"refuted":"stands"}s(te,"resolveRefuteVotes");function xe(e,n,t){let i=D(t);return e.map(r=>{if(r.status==="info"||r.status==="refuted"||r.status==="verified")return r;if(!f(r.severity))return{...r,status:"info"};if(r.status!=="candidate"&&r.status!=="stands")return r;let o=n[r.id],a=te(o,i);return{...r,status:a,refuteVotes:o??r.refuteVotes}})}s(xe,"applyBatchRefutation");function k(e){return e.filter(n=>f(n.severity)&&(n.status==="stands"||n.status==="candidate"||n.status==="open"))}s(k,"actionableOpen");function ye(e){return k(e.findings).length===0?{ok:!1,reason:"no actionable open findings"}:e.fixRound>=e.maxFixRounds?{ok:!1,reason:`convergence budget exhausted (${e.fixRound}/${e.maxFixRounds}) \u2014 leftover stays open; do not start round 3`}:{ok:!0,reason:""}}s(ye,"canStartFixRound");function be(e,n){let t=e.fixRound+1;return t>e.maxFixRounds?ne(e,n):{...e,fixRound:t,updatedAt:n,verdict:"in_progress"}}s(be,"advanceFixRound");function ne(e,n){let t=e.findings.map(r=>f(r.severity)&&(r.status==="stands"||r.status==="candidate")?{...r,status:"open"}:r),i=k(t).length>0||t.some(r=>r.status==="open");return{...e,findings:t,fixRound:e.maxFixRounds,updatedAt:n,verdict:i?"blocked":"approved",precisionHint:E(t)}}s(ne,"markLeftoversOpen");function Re(e,n,t,i){let r=new Set(n),o=e.findings.map(a=>!r.has(a.id)||(t==="fixed"||t==="verified")&&!G(a,e.scopePaths)?a:{...a,status:t});return{...e,findings:o,updatedAt:i,precisionHint:E(o)}}s(Re,"markFindings");function Fe(e,n,t){if(t!=="fixed"&&t!=="verified")return[];let i=new Set(n);return e.findings.filter(r=>i.has(r.id)&&!G(r,e.scopePaths)).map(r=>r.id)}s(Fe,"markFindingsSkippedByScope");function E(e){let n=e.filter(r=>r.status==="verified").length,t=e.filter(r=>r.status==="refuted").length,i=n+t;if(i!==0)return Math.round(n/i*1e3)/1e3}s(E,"computePrecisionHint");function L(e){if(e.verdict==="escalated")return"escalated";if(e.verdict==="approved")return"approved";if(e.findings.length===0)return"in_progress";let n=k(e.findings),t=e.findings.some(r=>r.status==="open");return n.length>0||t?"blocked":e.findings.some(r=>f(r.severity)&&r.status==="candidate")?"in_progress":"approved"}s(L,"computeVerdict");function je(e,n){let t=L(e);return{...e,verdict:t,updatedAt:n,precisionHint:E(e.findings)}}s(je,"finalizeLedger");function ke(e){let t=N(e.findings.filter(i=>f(i.severity)&&(i.status==="fixed"||i.status==="stands"||i.status==="open")),e.scopePaths).map(({id:i,severity:r,status:o,title:a,file:u,line:d,blast:p,dna:g})=>({id:i,severity:r,status:o,title:a,file:u,line:d,blast:p,dna:g}));return{intensity:e.intensity,fixRound:e.fixRound,maxFixRounds:e.maxFixRounds,findings:t,fixOrder:t.map(i=>i.id),scope:(()=>{let i=e.scopePaths??[];return`Re-judge ONLY the persisted ledger findings below plus the fix-diff for those items. Confirm each fixed finding is actually resolved; report regressions on those lines only. Fix order is blast-ranked \u2014 do not reorder by preference.${i.length>0?` Frozen scope (${i.length} paths): ${i.slice(0,12).join(", ")}${i.length>12?"\u2026":""}.`:""}`})(),outOfScope:"Do NOT reopen the original full PR diff. Do NOT invent new WARNING/SUGGESTION loops. Findings whose file is outside the frozen git scope are follow-up only (info) \u2014 they do not enter fix loops. New BLOCKER/CRITICAL on in-scope fix-diff may be added as candidates (evidence tax + severity floor + challenge still apply)."}}s(ke,"buildReReviewBrief");var w="RED (attack): assume the change is hostile. Hunt production killers \u2014 races, auth holes, data loss, silent fail. Prefer over-calling; blue + refuters will kill FPs. Output severity + file:line + 1-line repro. Enforce const-only bindings with a concrete immutable rewrite when reassignment exists.",J="BLUE (defense): assume the author is competent. Only report defects you can reproduce from the code. Challenge red overclaims. Same schema: severity + file:line + evidence. For const-only findings, require a viable immutable rewrite rather than a keyword-only suggestion.";function Se(e,n){if(n==="skip"&&!e)return{kind:"skip_ship",directive:"Intensity skip \u2014 ship without judgment tax.",steps:["prjct ship"],intensity:n,fixRound:0,maxFixRounds:0,counts:$(),rankedFixIds:[]};if(!e)return{kind:"open_ledger",directive:`Open a judgment ledger (intensity=${n}).`,steps:["prjct judgment open","prjct judgment next"],intensity:n,fixRound:0,maxFixRounds:y,counts:$(),rankedFixIds:[],judgeCharters:n==="full"?{red:w,blue:J}:void 0};let t=ie(e.findings),i=N(e.findings),r={intensity:e.intensity,fixRound:e.fixRound,maxFixRounds:e.maxFixRounds,counts:t,rankedFixIds:i.map(o=>o.id),judgeCharters:e.intensity==="full"?{red:w,blue:J}:void 0};if(e.verdict==="escalated")return{...r,kind:"escalate",directive:`ESCALATED: ${e.escalateReason??"judges contradict"}. Surface to user.`,steps:["Present both judge verdicts to the user","Do not ship"]};if(e.verdict==="approved")return{...r,kind:"approve",directive:"Ledger APPROVED \u2014 ship is clear for judgment gate.",steps:["prjct ship"]};if(e.findings.length===0)return{...r,kind:"dispatch_reviewers",directive:e.intensity==="full"?"Dispatch RED + BLUE judges in parallel (blind). Then prjct judgment merge. If both find nothing: prjct judgment approve.":"Dispatch ONE focused reviewer. Record findings with prjct judgment add (or approve if truly clean).",steps:e.intensity==="full"?["Spawn RED judge (attack charter) + BLUE judge (defense charter) in parallel","prjct judgment merge --red '[...]' --blue '[...]'","prjct judgment next"]:["Spawn one fresh-context reviewer (model: sonnet)","prjct judgment add --severity \u2026 --title \u2026 --file \u2026 --line \u2026","prjct judgment challenge --verdicts \u2026"]};if(t.candidates>0&&t.stands===0&&t.fixed===0)return{...r,kind:"dispatch_refuters",directive:`Batch-challenge ${t.candidates} candidate(s). Ceiling: ${D(e.intensity)} vote(s) total \u2014 never per-finding tasks.`,steps:["Spawn ONE batched refuter (or 3-lens panel on full) over ALL candidates","prjct judgment challenge --verdicts id:stands|refuted[,\u2026]","prjct judgment next"]};if(t.stands>0||t.open>0){if(e.fixRound>=e.maxFixRounds)return{...r,kind:"blocked_budget",directive:"Convergence budget exhausted with leftovers \u2014 report open, no round 3.",steps:["prjct judgment fix-round # marks leftovers open","Surface open findings to user or escalate"]};let o=i.slice(0,5).map(a=>`${a.id}(${a.severity})`).join(", ");return{...r,kind:"fix_ranked",directive:`Fix blast-ranked stands (${t.stands} open). Top: ${o||"\u2014"}`,steps:["prjct judgment fix-round",`Implementer fixes ONLY stands \u2014 order: ${r.rankedFixIds.join(" \u2192 ")||"\u2014"}`,`prjct judgment fixed ${r.rankedFixIds.join(" ")}`,"prjct judgment brief # scoped re-judge",`prjct judgment verify ${r.rankedFixIds.join(" ")}`]}}return t.fixed>0?{...r,kind:"rejudge_scoped",directive:`Re-judge ${t.fixed} fixed finding(s) with scoped brief only.`,steps:["prjct judgment brief","Fresh judge on ledger+fix-diff only","prjct judgment verify <ids>","prjct judgment approve"]}:L(e)==="approved"?{...r,kind:"approve",directive:"Clean ledger \u2014 approve and ship.",steps:["prjct judgment approve","prjct ship"]}:{...r,kind:"idle",directive:"Ledger in progress \u2014 run prjct judgment status.",steps:["prjct judgment status","prjct judgment next"]}}s(Se,"buildNextAction");function $(){return{candidates:0,stands:0,refuted:0,fixed:0,verified:0,info:0,open:0,ghosts:0}}s($,"emptyCounts");function ie(e){let n=$();for(let t of e)t.status==="candidate"?n.candidates++:t.status==="stands"?n.stands++:t.status==="refuted"?n.refuted++:t.status==="fixed"?n.fixed++:t.status==="verified"?n.verified++:t.status==="info"?n.info++:t.status==="open"&&n.open++,t.knownFalsePositive&&n.ghosts++;return n}s(ie,"countStatuses");function we(e){switch(e){case"skip":return{intensity:e,reviewers:"none \u2014 trivial/docs-only changeset",refuters:"none",severityFloor:"n/a",evidenceTax:"n/a",maxFixRounds:0,shipExpectation:"ship without judgment ledger"};case"standard":return{intensity:e,reviewers:"exactly ONE focused review pass (fresh-context subagent)",refuters:"exactly ONE batched refuter over all BLOCKER/CRITICAL candidates",severityFloor:"only verified BLOCKER/CRITICAL enter fix loops; WARNING/SUGGESTION = info once",evidenceTax:"blocker without file:line demoted to critical; title-only critical \u2192 info",maxFixRounds:y,shipExpectation:"ledger verdict approved (or --no-spec-gate override)"};case"full":return{intensity:e,reviewers:"dual-blind RED (attack) + BLUE (defense) in parallel \u2014 merge via prjct judgment merge",refuters:"exactly THREE batched refuter votes (correctness/impact/repro); 2-of-3 kills; fail-closed stands",severityFloor:"only verified BLOCKER/CRITICAL enter fix loops; WARNING/SUGGESTION = info once",evidenceTax:"blocker without file:line demoted to critical; title-only critical \u2192 info",maxFixRounds:y,shipExpectation:"ledger verdict approved after \u22642 fix rounds (or escalate)",redCharter:w,blueCharter:J}}}s(we,"intensityProtocol");function Je(e){let{codeStrict:n,intensity:t,ledger:i,override:r}=e;if(r)return{blocked:!1,mode:"none",message:"",reason:"override"};if(t==="skip")return{blocked:!1,mode:"none",message:"",reason:"skip-intensity"};if(!i){let d=`Precision judgment required (intensity=${t}): run \`prjct judgment plan\` \u2192 \`prjct judgment open\` \u2192 follow \`prjct judgment next\`.${t==="full"?" Dual-blind RED+BLUE required (code-strict default).":""} Override only with explicit consent: \`prjct ship --no-judgment-gate\`.`;return n?{blocked:!0,mode:"hard",message:d,reason:"missing-ledger"}:{blocked:!1,mode:"soft",message:`\u2696\uFE0F ${d}`,reason:"soft-reminder"}}let o=L(i);if(o==="approved"){let u=i.precisionHint!==void 0?`, precision\u2248${Math.round(i.precisionHint*100)}%`:"";return{blocked:!1,mode:"none",message:`\u2696\uFE0F judgment ${i.id.slice(0,8)} \u2192 APPROVED (intensity=${i.intensity}, rounds=${i.fixRound}/${i.maxFixRounds}${u})`,reason:"approved"}}if(o==="escalated"){let u=`Judgment escalated: ${i.escalateReason??"judges contradict"}. Resolve with the user before ship.`;return n?{blocked:!0,mode:"hard",message:u,reason:"escalated"}:{blocked:!1,mode:"soft",message:`\u2696\uFE0F ${u}`,reason:"escalated"}}if(o==="blocked"){let u=[...k(i.findings),...i.findings.filter(g=>g.status==="open")],d=u.slice(0,5).map(g=>`${g.severity}:${g.title}`).join("; "),p=`Judgment blocked \u2014 open actionable (${u.length}): ${d||"see ledger"}. Fix blast-ranked + re-judge (\u2264${y} rounds) or escalate. \u2192 \`prjct judgment next\``;return n?{blocked:!0,mode:"hard",message:p,reason:"blocked-findings"}:{blocked:!1,mode:"soft",message:`\u2696\uFE0F ${p}`,reason:"blocked-findings"}}let a=`Judgment in progress (round ${i.fixRound}/${i.maxFixRounds}, ${i.findings.length} findings). \u2192 \`prjct judgment next\``;return n?{blocked:!0,mode:"hard",message:a,reason:"in-progress"}:{blocked:!1,mode:"soft",message:`\u2696\uFE0F ${a}`,reason:"in-progress"}}s(Je,"judgmentShipVerdict");function $e(e,n){let t=j(n),i=t.dna??b(t),r=e.findIndex(d=>(d.dna??b(d))===i);if(r<0){let d={...t,dna:i};return{findings:[...e,d],finding:d,deduped:!1}}let o=e[r],a=j({...o,severity:R[t.severity]>R[o.severity]?t.severity:o.severity,title:t.title.length>=o.title.length?t.title:o.title,file:t.file??o.file,line:t.line??o.line,evidence:(t.evidence?.length??0)>(o.evidence?.length??0)?t.evidence:o.evidence,judge:[o.judge,t.judge].filter(Boolean).join("+")||o.judge,agreedBy:[...new Set([...o.agreedBy??[],...t.agreedBy??[],t.judge].filter(Boolean))],dna:i}),u=[...e];return u[r]=a,{findings:u,finding:a,deduped:!0}}s($e,"upsertFinding");function I(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+/g,"/").replace(/\/$/,"").trim()}s(I,"normalizeScopePath");function A(e,n){if(!n||n.length===0||!e||!e.trim())return!0;let t=I(e);if(!t)return!0;for(let i of n){let r=I(i);if(r&&(t===r||t.startsWith(`${r}/`)))return!0}return!1}s(A,"pathInScope");function re(e,n){return A(e.file,n)||e.status==="info"||e.status==="refuted"?e:{...e,status:"info",evidence:(e.evidence?`${e.evidence} \xB7 `:"")+"out of frozen review scope (follow-up only; does not enter fix loops or block ship)"}}s(re,"applyScopeFreeze");function Ie(e,n){return e.map(t=>re(t,n))}s(Ie,"applyScopeFreezeAll");function G(e,n){return e.status==="info"||e.status==="refuted"?!1:A(e.file,n)}s(G,"findingInFixScope");function se(){return`jf_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}s(se,"newFindingId");function oe(){return`jl_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}s(oe,"newLedgerId");function Ee(e){let n=e.scopePaths&&e.scopePaths.length>0?[...new Set(e.scopePaths.map(I).filter(Boolean))]:void 0;return{id:oe(),target:e.target,intensity:e.intensity,maxFixRounds:y,fixRound:0,findings:[],verdict:"in_progress",createdAt:e.now,updatedAt:e.now,baseSha:e.baseSha,headSha:e.headSha,deliveryTier:e.deliveryTier,scopePaths:n,scopeFrozenAt:n?e.now:void 0}}s(Ee,"createLedger");export{q as a,T as b,X as c,ge as d,b as e,F as f,_ as g,Q as h,Z as i,fe as j,S as k,N as l,f as m,j as n,pe as o,ee as p,me as q,he as r,ve as s,D as t,te as u,xe as v,k as w,ye as x,be as y,ne as z,Re as A,Fe as B,E as C,L as D,je as E,ke as F,Se as G,we as H,Je as I,$e as J,I as K,A as L,re as M,Ie as N,G as O,se as P,oe as Q,Ee as R};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 v,c as C}from"./chunk-YLYAYRSJ.mjs";import{b as p,c as j}from"./chunk-DOJPSIMG.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";j();import k from"node:fs/promises";import E from"node:path";var h="_prjctManaged";function b(){return process.env.PRJCT_TEST_MODE==="1"?E.join(p(".prjct-tests"),"cursor","hooks.json"):p(".cursor","hooks.json")}s(b,"getCursorHooksJsonPath");function H(){let r=[];for(let e of C)e.event==="SessionStart"?r.push({cursorEvent:"sessionStart",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="UserPromptSubmit"?r.push({cursorEvent:"beforeSubmitPrompt",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PreToolUse"&&e.matcher==="Bash"?r.push({cursorEvent:"preToolUse",matcher:"Shell|Bash",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PreToolUse"&&e.matcher==="Edit|Write"?r.push({cursorEvent:"preToolUse",matcher:"Write|StrReplace|Edit",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="PostToolUse"&&e.matcher==="Edit|Write"?r.push({cursorEvent:"postToolUse",matcher:"Write|StrReplace|Edit",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="Stop"?r.push({cursorEvent:"stop",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="SubagentStart"?r.push({cursorEvent:"subagentStart",subcommand:e.subcommand,name:`prjct-${e.subcommand}`}):e.event==="SubagentStop"&&r.push({cursorEvent:"subagentStop",subcommand:e.subcommand,name:`prjct-${e.subcommand}`});return r}s(H,"cursorHookMaps");function R(r){return v(r,"PRJCT_HOOK_HOST=cursor")}s(R,"hookCommand");function l(r){return r[h]===!0||(r.name?.startsWith("prjct-")??!1)||/PRJCT_HOOK_HOST=cursor/.test(r.command)}s(l,"isPrjctHandler");function d(r){return r[h]===!0?!1:/(^|\/|\s)prjct\s+hook\s+\S+/.test(r.command??"")}s(d,"isLegacyPrjctHandler");async function g(r){try{let e=await k.readFile(r,"utf-8"),t=JSON.parse(e);return t&&typeof t=="object"?t:{version:1}}catch(e){if(e.code==="ENOENT")return{version:1};throw e}}s(g,"readHooksFile");async function S(r,e){await k.mkdir(E.dirname(r),{recursive:!0}),e.version=e.version??1,await k.writeFile(r,`${JSON.stringify(e,null,2)}
|
|
8
|
+
`,"utf-8")}s(S,"writeHooksFile");function O(r){let e={command:R(r.subcommand),timeout:30,name:r.name,[h]:!0};return r.matcher&&(e.matcher=r.matcher),e}s(O,"handlerFor");function P(r){let e=new Set(H().map(o=>o.name)),t=[];for(let o of Object.keys(r))r[o]=(r[o]??[]).filter(a=>!l(a)&&!d(a)||a.name&&e.has(a.name)?!0:(t.push(a),!1)),r[o].length===0&&delete r[o];return t.length}s(P,"pruneOrphans");async function _(r=b()){let e=await g(r),t={...e.hooks??{}},o=[],a=[];for(let u of H()){let i=(t[u.cursorEvent]??[]).filter(n=>!(d(n)&&!l(n))),m=O(u),f=i.findIndex(n=>l(n)?n.name?n.name===u.name:n.command.includes(`hook ${u.subcommand}`)&&(n.matcher??"")===(u.matcher??""):!1);if(f>=0){let n=i[f];n.command===m.command&&n.matcher===m.matcher&&n.timeout===m.timeout?a.push(u):(i[f]={...n,...m},o.push(u))}else i.push(m),o.push(u);t[u.cursorEvent]=i}let c=P(t);return e.version=1,e.hooks=t,await S(r,e),{hooksPath:r,hooksWritten:o.length,alreadyPresent:a.length,hooksPruned:c}}s(_,"installCursorHooks");async function $(r=b()){let e=await g(r);if(!e.hooks)return{hooksPath:r,hooksRemoved:0};let t=[];for(let o of Object.keys(e.hooks)){let a=e.hooks[o]?.length??0;e.hooks[o]=(e.hooks[o]??[]).filter(c=>l(c)||d(c)?(t.push(c),!1):!0),e.hooks[o].length===0&&delete e.hooks[o]}return Object.keys(e.hooks).length===0&&delete e.hooks,await S(r,e),{hooksPath:r,hooksRemoved:t.length}}s($,"uninstallCursorHooks");async function F(r=b()){let e=await g(r);return{installed:Object.values(e.hooks??{}).flat().filter(o=>l(o)||d(o)).length,expected:H().length,path:r}}s(F,"cursorHooksStatus");export{b as a,H as b,_ as c,$ as d,F as e};
|
|
@@ -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 r}from"./chunk-3TRXQAU4.mjs";var c=["Popper","Copernicus","McClintock","Volta","Ada","Turing","Hypatia","Feynman","Lovelace","Curie","Hopper","Tesla","Noether","Faraday","Kepler","Mendel","Dirac","Shannon","Babbage","Boole","Planck","Hubble","Sagan","Meitner","Ramanujan","Euclid","Gauss","Fourier","Pascal","Archimedes"];function u(e){return e.split("").reduce((t,n)=>Math.imul(t^n.charCodeAt(0),16777619),2166136261)>>>0}r(u,"hashSeed");function g(e,t=[]){let n=new Set([...t].map(i=>i.toLowerCase())),a=c.filter(i=>!n.has(i.toLowerCase())),s=a.length>0?a:[...c],o=u(e)%s.length;return s[o]}r(g,"pickCodename");function l(e,t){let n=new Set;return e.map((a,s)=>{let o=g(`${t}::${a}::${s}`,n);return n.add(o.toLowerCase()),{role:a,name:o}})}r(l,"assignAgentCast");var p=["explore","implement","review"],m=["leader","implementer","reviewer"];function C(e){return e.length===0?"":`Cast: ${e.map(t=>`${t.role}\u2192${t.name}`).join(" \xB7 ")}`}r(C,"formatAgentCastLine");function h(e){return e.length===0?"":`Name each subagent when you dispatch: ${e.map(n=>`\`${n.name}\` (${n.role})`).join(", ")}. Reuse these labels in logs/claims so the cast stays legible.`}r(h,"formatAgentCastDispatchHint");function A(e,t){return e==="parallel"?l([...p],t):e==="crew"?l([...m],t):[]}r(A,"castForFanout");export{c as a,u as b,g as c,l as d,p as e,m as f,C as g,h,A as i};
|
|
@@ -0,0 +1,12 @@
|
|
|
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 c,h as f,i as p}from"./chunk-QZ7T2EYR.mjs";import{g as u,i as C}from"./chunk-DMO3ZFUG.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";C();var g=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default|setup|config|plugin|middleware|layout|page|loader|action)$/i,h=/(?:^|\/)(?:bin\/|scripts\/|cli\.|main\.|index\.|app\.|server\.|page\.|layout\.|route\.|middleware\.)/i;function m(e){return!!(e.kind==="route"||g.test(e.name)&&e.exported||h.test(e.file)&&e.exported||/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(e.file)||e.kind==="type"||e.kind==="interface"||e.kind==="enum"||e.kind==="const")}s(m,"isEntryPoint");function x(e){let t=new Set;try{let n=u.query(e,"SELECT DISTINCT dst FROM code_symbol_edges WHERE edge_type = 'CALLS'");for(let o of n)t.add(o.dst)}catch{}return t}s(x,"loadCallersOf");function D(e,t={}){let n=t.limit??50;if(!c(e))return{ready:!1,totalSymbols:0,dead:[],skippedEntries:0,note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let o=p(e),y=x(e),i=[],b=o.filter(m).length;for(let r of o)if(!m(r)&&!(r.kind!=="function"&&r.kind!=="method"&&r.kind!=="class")&&!y.has(r.id)&&(i.push({symbol:r,reason:r.exported?"exported but no inbound CALLS in graph":"no inbound CALLS in graph"}),i.length>=n))break;return i.sort((r,d)=>{let a=r.symbol.exported?0:1,l=d.symbol.exported?0:1;return a!==l?a-l:r.symbol.file.localeCompare(d.symbol.file)}),{ready:!0,totalSymbols:f(e)?.symbolCount??o.length,dead:i,skippedEntries:b,note:"Best-effort: regex CALLS graph. Dynamic dispatch / reflection may false-positive. Entry points + tests + types excluded."}}s(D,"findDeadCode");function E(e){if(!e.ready)return`## Dead code
|
|
8
|
+
|
|
9
|
+
> ${e.note}
|
|
10
|
+
`;let t=["## Dead code (zero inbound CALLS)","",`- **Candidates**: ${e.dead.length} (cap)`,`- **Symbols scanned**: ${e.totalSymbols}`,`- **Skipped entry/types/tests**: ${e.skippedEntries}`,""];if(e.dead.length===0)t.push("_None found (or all have callers / are entries)._");else for(let n of e.dead){let o=n.symbol;t.push(`- \`${o.kind}\` **${o.name}** \u2014 \`${o.file}:${o.startLine}\`${o.exported?" (exported)":""}`),t.push(` - ${n.reason}`)}return t.push("",`_${e.note}_`),t.join(`
|
|
11
|
+
`)}s(E,"formatDeadCodeMd");function L(e){if(!e.ready)return`dead-code: ${e.note}`;let t=[`Dead code: ${e.dead.length} candidate(s) (of ${e.totalSymbols} symbols)`];for(let n of e.dead.slice(0,30))t.push(` ${n.symbol.kind} ${n.symbol.name} ${n.symbol.file}:${n.symbol.startLine}`);return t.join(`
|
|
12
|
+
`)}s(L,"formatDeadCodeText");export{D as a,E as b,L as c};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 o}from"./chunk-L4TUXFCL.mjs";import{g as a,i as c}from"./chunk-DMO3ZFUG.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";c();function E(n,e,r){try{let s=o();return a.run(n,`INSERT INTO workflow_runs
|
|
8
|
+
(id, project_id, command, work_cycle_id, status, iteration, max_iterations, started_at)
|
|
9
|
+
VALUES (?, ?, ?, ?, 'running', 0, NULL, ?)`,s,n,e,r??null,Date.now()),s}catch{return null}}i(E,"startWorkflowRun");function w(n,e,r,s,u){if(e)try{a.run(n,`INSERT INTO gate_evaluation (id, run_id, rule_id, passed, reason, evaluated_at)
|
|
10
|
+
VALUES (?, ?, ?, ?, ?, ?)`,o(),e,String(r),s?1:0,u??null,Date.now())}catch{}}i(w,"recordGateEvaluation");function R(n,e,r,s,u,l){if(e)try{a.run(n,`INSERT INTO workflow_run_step (id, run_id, rule_id, seq, status, attempt, output, ended_at)
|
|
11
|
+
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,o(),e,String(r),s,u,l??null,Date.now())}catch{}}i(R,"recordRunStep");function b(n,e=20){try{let r=a.query(n,"SELECT id, command, status, started_at, ended_at FROM workflow_runs ORDER BY started_at DESC LIMIT ?",e);if(r.length===0)return[];let s=r.map(()=>"?").join(","),u=r.map(t=>t.id),l=a.query(n,`SELECT run_id, COUNT(*) AS n FROM workflow_run_step WHERE run_id IN (${s}) GROUP BY run_id`,...u),m=a.query(n,`SELECT run_id, passed, COUNT(*) AS n FROM gate_evaluation WHERE run_id IN (${s}) GROUP BY run_id, passed`,...u),_=new Map(l.map(t=>[t.run_id,t.n])),d=new Map;for(let t of m){let g=d.get(t.run_id)??{passed:0,failed:0};t.passed?g.passed=t.n:g.failed=t.n,d.set(t.run_id,g)}return r.map(t=>({id:t.id,command:t.command,status:t.status,startedAt:t.started_at,endedAt:t.ended_at,steps:_.get(t.id)??0,gatesPassed:d.get(t.id)?.passed??0,gatesFailed:d.get(t.id)?.failed??0}))}catch{return[]}}i(b,"getRecentWorkflowRuns");function S(n,e,r){if(e)try{a.run(n,"UPDATE workflow_runs SET status = ?, ended_at = ? WHERE id = ?",r,Date.now(),e)}catch{}}i(S,"finishWorkflowRun");export{E as a,w as b,R as c,b as d,S as e};
|
|
@@ -0,0 +1,28 @@
|
|
|
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{c as ct,d as lt,e as dt}from"./chunk-Y7XOKG4O.mjs";import{a as mt,b as pt}from"./chunk-JCWA7NLM.mjs";import{e as St}from"./chunk-CFD6CW7T.mjs";import{a as at}from"./chunk-ANBDOI53.mjs";import{a as Ge}from"./chunk-JT4RNQ67.mjs";import{a as We}from"./chunk-VCSESVZ4.mjs";import{b as it,c as ot}from"./chunk-6OYLZ4NM.mjs";import{d as ut,f as cs}from"./chunk-HYMJVHAX.mjs";import{a as ft,b as ht,c as gt,d as yt}from"./chunk-P2KU4FFA.mjs";import{a as nt}from"./chunk-MG3YN3AI.mjs";import{b as Xe,c as Ze,d as et}from"./chunk-YEALP3WX.mjs";import{e as tt,f as st}from"./chunk-QZ7T2EYR.mjs";import{a as rt}from"./chunk-QWRPJARA.mjs";import{a as Qe}from"./chunk-HA7Y76GF.mjs";import{b as Ke,c as qe,d as Ye}from"./chunk-AJXELVNH.mjs";import{a as Be}from"./chunk-X433BB6F.mjs";import{a as Je}from"./chunk-KUQLXY2P.mjs";import{b as se}from"./chunk-HCPQZRR3.mjs";import{b as j}from"./chunk-EHVU2SMR.mjs";import{a as Ue}from"./chunk-E5QQDYBR.mjs";import{b as ze}from"./chunk-B7AQHL7B.mjs";import{b as H}from"./chunk-XSZOHNL4.mjs";import{b as Ve}from"./chunk-Q6C27OL7.mjs";import{c as Re}from"./chunk-DTMZBK4E.mjs";import{f as k,g as _,i as ee}from"./chunk-DMO3ZFUG.mjs";import{d as Le}from"./chunk-2FRLIQKX.mjs";import{a as f,b as $}from"./chunk-RP7F67ZT.mjs";import{a as Oe,b as Ne}from"./chunk-INJ5WT2D.mjs";import{d as te}from"./chunk-IJNKHQIS.mjs";import{A as $e,E as is,F as He,G as os,e as P,l as Z,x as _e}from"./chunk-HU5ERAAV.mjs";import{e as Ae,i as rs}from"./chunk-VWFVSNQT.mjs";import{a as je,p as as}from"./chunk-D62TAZG6.mjs";import{d as w,e as Ie}from"./chunk-623SNKDH.mjs";import{d as Me,e as Fe,f as Te,l as R,p as J}from"./chunk-HYIT7MF5.mjs";import{a as M,d as Ee,e as v,g as T}from"./chunk-225DWS4D.mjs";import{a as o}from"./chunk-3TRXQAU4.mjs";function vt(n,t){let e=[];O("Languages",n.languages,t.languages,e),O("Frameworks",n.frameworks,t.frameworks,e),(n.packageManager??"")!==(t.packageManager??"")&&e.push({field:"Package manager",type:"changed",before:n.packageManager??"(none)",after:t.packageManager??"(none)"}),(n.sourceDir??"")!==(t.sourceDir??"")&&e.push({field:"Source directory",type:"changed",before:n.sourceDir??"(none)",after:t.sourceDir??"(none)"}),(n.testDir??"")!==(t.testDir??"")&&e.push({field:"Test directory",type:"changed",before:n.testDir??"(none)",after:t.testDir??"(none)"}),O("Config files",n.configFiles,t.configFiles,e),n.fileCount!==t.fileCount&&e.push({field:"File count",type:"changed",before:String(n.fileCount),after:String(t.fileCount)});let s=n.patterns.map(c=>c.name),a=t.patterns.map(c=>c.name);O("Patterns",s,a,e);let i=n.antiPatterns.map(c=>c.issue),r=t.antiPatterns.map(c=>c.issue);return O("Anti-patterns",i,r,e),nt(e,n.commitHash??null,t.commitHash??null)}o(vt,"generateAnalysisDiff");function Vs(n){if(!n.hasChanges)return`## Analysis Diff
|
|
8
|
+
|
|
9
|
+
No changes between runs.`;let t=[];t.push("## Analysis Diff"),(n.beforeCommit||n.afterCommit)&&t.push(`> \`${n.beforeCommit?.substring(0,7)??"(none)"}\` \u2192 \`${n.afterCommit?.substring(0,7)??"(none)"}\``),t.push(""),t.push("| Change | Field | Detail |"),t.push("|--------|-------|--------|");for(let s of n.items){let a=s.type==="added"?"+":s.type==="removed"?"-":"~",i=s.type==="changed"?`${s.before} \u2192 ${s.after}`:s.after??s.before??"";t.push(`| ${a} | ${s.field} | ${i} |`)}t.push("");let e=[];return n.summary.added>0&&e.push(`${n.summary.added} added`),n.summary.removed>0&&e.push(`${n.summary.removed} removed`),n.summary.changed>0&&e.push(`${n.summary.changed} changed`),t.push(`**Summary**: ${e.join(", ")}`),t.join(`
|
|
10
|
+
`)}o(Vs,"formatAnalysisDiffMd");function zs(n){if(!n.hasChanges)return"No changes between analysis runs.";let t=[];(n.beforeCommit||n.afterCommit)&&(t.push(` ${n.beforeCommit?.substring(0,7)??"(none)"} \u2192 ${n.afterCommit?.substring(0,7)??"(none)"}`),t.push(""));for(let e of n.items)e.type==="added"?t.push(` + ${e.field}: ${e.after}`):e.type==="removed"?t.push(` - ${e.field}: ${e.before}`):t.push(` ~ ${e.field}: ${e.before} \u2192 ${e.after}`);return t.join(`
|
|
11
|
+
`)}o(zs,"formatAnalysisDiffText");function O(n,t,e,s){let a=new Set(t),i=new Set(e);for(let r of e)a.has(r)||s.push({field:n,type:"added",after:r});for(let r of t)i.has(r)||s.push({field:n,type:"removed",before:r})}o(O,"diffStringArray");T();J();import ne from"node:fs/promises";import I from"node:path";import{z as h}from"zod";function B(n,t){let e=n.filter(a=>!a.passed).length,s=n.filter(a=>a.passed).length;return{passed:e===0,checks:n,totalMs:Date.now()-t,failedCount:e,passedCount:s}}o(B,"summarizeChecks");rs();var ls=h.enum(["draft","verified","sealed"]),wt=h.object({severity:h.enum(["low","medium","high"]).optional(),language:h.string().optional(),framework:h.string().optional(),source:h.enum(["baseline","repo","context7","feedback"]).optional(),confidence:h.number().min(0).max(1).optional()}),ds=h.object({name:h.string(),description:h.string(),location:h.string().optional()}).extend(wt.shape),us=h.object({issue:h.string(),file:h.string(),suggestion:h.string()}).extend(wt.shape),re=h.object({projectId:h.string(),languages:h.array(h.string()),frameworks:h.array(h.string()),packageManager:h.string().optional(),sourceDir:h.string().optional(),testDir:h.string().optional(),configFiles:h.array(h.string()),fileCount:h.number(),patterns:h.array(ds),antiPatterns:h.array(us),analyzedAt:h.string(),modelMetadata:Ae.optional(),status:ls.default("draft"),commitHash:h.string().optional(),signature:h.string().optional(),sealedAt:h.string().optional(),verifiedAt:h.string().optional()});var ms={TypeScript:[".ts",".tsx",".mts",".cts"],JavaScript:[".js",".jsx",".mjs",".cjs"],Python:[".py",".pyw"],Java:[".java"],Go:[".go"],Rust:[".rs"],Ruby:[".rb"],PHP:[".php"],Swift:[".swift"],Kotlin:[".kt",".kts"],"C++":[".cpp",".cc",".cxx",".hpp",".h"],C:[".c",".h"],"C#":[".cs"],Elixir:[".ex",".exs"],Scala:[".scala"]};async function ps(n,t){let e=Date.now();if(n.frameworks.length===0)return{name:"Framework verification",passed:!0,output:"No frameworks declared (skipped)",durationMs:Date.now()-e};try{let s=I.join(t,"package.json"),a=await ne.readFile(s,"utf-8"),i=JSON.parse(a),r={...i.dependencies,...i.devDependencies},c=[],l=[];for(let d of n.frameworks){let m=d.toLowerCase();Object.keys(r).some(y=>y.toLowerCase().includes(m))?l.push(d):c.push(d)}return c.length===0?{name:"Framework verification",passed:!0,output:`${l.length} framework(s) verified in dependencies`,durationMs:Date.now()-e}:{name:"Framework verification",passed:!1,error:`Frameworks not found in dependencies: ${c.join(", ")}`,durationMs:Date.now()-e}}catch(s){return M(s)?{name:"Framework verification",passed:!1,error:"package.json not found (cannot verify frameworks)",durationMs:Date.now()-e}:{name:"Framework verification",passed:!1,error:`Failed to read package.json: ${s instanceof Error?s.message:"unknown error"}`,durationMs:Date.now()-e}}}o(ps,"verifyFrameworks");async function fs(n,t){let e=Date.now();if(n.languages.length===0)return{name:"Language verification",passed:!0,output:"No languages declared (skipped)",durationMs:Date.now()-e};try{let s=await Ss(t),a=new Set(s),i=[],r=[];for(let c of n.languages){let l=ms[c];if(!l)continue;l.some(m=>a.has(m))?i.push(c):r.push(c)}return r.length===0?{name:"Language verification",passed:!0,output:`${i.length} language(s) verified with matching files`,durationMs:Date.now()-e}:{name:"Language verification",passed:!1,error:`Languages without matching files: ${r.join(", ")}`,durationMs:Date.now()-e}}catch(s){return{name:"Language verification",passed:!1,error:`Failed to scan project files: ${s instanceof Error?s.message:"unknown error"}`,durationMs:Date.now()-e}}}o(fs,"verifyLanguages");async function hs(n,t){let e=Date.now(),s=n.patterns.filter(r=>r.location);if(s.length===0)return{name:"Pattern location verification",passed:!0,output:"No pattern locations specified (skipped)",durationMs:Date.now()-e};let a=[],i=[];for(let r of s){let c=r.location,l=I.join(t,c);await R(l)?i.push(c):a.push(`${r.name} (${c})`)}return a.length===0?{name:"Pattern location verification",passed:!0,output:`${i.length} pattern location(s) verified`,durationMs:Date.now()-e}:{name:"Pattern location verification",passed:!1,error:`Pattern locations not found: ${a.join(", ")}`,durationMs:Date.now()-e}}o(hs,"verifyPatternLocations");async function gs(n,t){let e=Date.now();try{let s=await vs(t),a=n.fileCount,i=.1,r=Math.abs(s-a),c=a*i;return r<=c?{name:"File count verification",passed:!0,output:`File count accurate (declared: ${a}, actual: ${s})`,durationMs:Date.now()-e}:{name:"File count verification",passed:!1,error:`File count mismatch: declared ${a}, actual ${s} (diff: ${r})`,durationMs:Date.now()-e}}catch(s){return{name:"File count verification",passed:!1,error:`Failed to count files: ${s instanceof Error?s.message:"unknown error"}`,durationMs:Date.now()-e}}}o(gs,"verifyFileCount");async function ys(n,t){let e=Date.now();if(n.antiPatterns.length===0)return{name:"Anti-pattern file verification",passed:!0,output:"No anti-patterns declared (skipped)",durationMs:Date.now()-e};let s=[],a=[];for(let i of n.antiPatterns){let r=I.join(t,i.file);await R(r)?a.push(i.file):s.push(`${i.issue} (${i.file})`)}return s.length===0?{name:"Anti-pattern file verification",passed:!0,output:`${a.length} anti-pattern file(s) verified`,durationMs:Date.now()-e}:{name:"Anti-pattern file verification",passed:!1,error:`Anti-pattern files not found: ${s.join(", ")}`,durationMs:Date.now()-e}}o(ys,"verifyAntiPatternFiles");async function Pt(n,t){let e=Date.now(),s=await Promise.all([ps(n,t),fs(n,t),hs(n,t),gs(n,t),ys(n,t)]);return B(s,e)}o(Pt,"semanticVerify");async function Ss(n){let t=new Set,e=[/node_modules/,/\.git/,/dist/,/build/,/\.next/,/\.turbo/,/coverage/];async function s(a){try{let i=await ne.readdir(a,{withFileTypes:!0});for(let r of i){let c=I.join(a,r.name),l=I.relative(n,c);if(!e.some(d=>d.test(l))){if(r.isDirectory())await s(c);else if(r.isFile()){let d=I.extname(r.name);d&&t.add(d)}}}}catch{}}return o(s,"scanDir"),await s(n),Array.from(t)}o(Ss,"getProjectExtensions");async function vs(n){let t=[/node_modules/,/\.git/,/dist/,/build/,/\.next/,/\.turbo/,/coverage/];async function e(s){try{let a=await ne.readdir(s,{withFileTypes:!0});return(await Promise.all(a.map(async r=>{let c=I.join(s,r.name),l=I.relative(n,c);return t.some(d=>d.test(l))?0:r.isDirectory()?e(c):r.isFile()?1:0}))).reduce((r,c)=>r+c,0)}catch{return 0}}return o(e,"scanDir"),e(n)}o(vs,"countProjectFiles");Z();var ae=class extends Ue{static{o(this,"AnalysisStorage")}constructor(){super("analysis.json")}getDefault(){return{draft:null,sealed:null,previousSealed:null,lastUpdated:""}}getEventType(t){return`analysis.${t}d`}async saveDraft(t,e){let s={...e,status:"draft"};re.parse(s),await this.update(t,a=>({...a,draft:s,lastUpdated:P()})),this.publishAnalysis(t,s)}publishAnalysis(t,e){Ve({projectId:t,entityType:"analysis",entityId:t,eventType:"upsert",data:{...e,id:t}})}async seal(t){let e=await this.read(t);if(!e.draft)return{success:!1,error:"No draft analysis to seal. Run `p. sync` first."};if(e.draft.status==="sealed")return{success:!1,error:"Draft is already sealed."};let s=this.computeSignature(e.draft),a=P(),i={...e.draft,status:"sealed",signature:s,sealedAt:a};return re.parse(i),await this.write(t,{draft:null,sealed:i,previousSealed:e.sealed,lastUpdated:a}),this.publishAnalysis(t,i),{success:!0,signature:s}}async getSealed(t){return(await this.read(t)).sealed}async getDraft(t){return(await this.read(t)).draft}async getActive(t){let e=await this.read(t);return e.sealed??e.draft}async getStatus(t){let e=await this.read(t);return{hasSealed:e.sealed!==null,hasDraft:e.draft!==null,hasPreviousSealed:e.previousSealed!==null,sealedCommit:e.sealed?.commitHash??null,draftCommit:e.draft?.commitHash??null,previousSealedCommit:e.previousSealed?.commitHash??null,sealedAt:e.sealed?.sealedAt??null}}async rollback(t){let e=await this.read(t);if(!e.previousSealed)return{success:!1,error:"No previous sealed version to rollback to."};let s=P();return await this.write(t,{draft:e.sealed,sealed:e.previousSealed,previousSealed:null,lastUpdated:s}),this.publishAnalysis(t,e.previousSealed),{success:!0,restoredSignature:e.previousSealed.signature}}async diff(t){let e=await this.read(t);return!e.sealed||!e.draft?null:vt(e.sealed,e.draft)}checkStaleness(t,e){return t?e?t!==e?{isStale:!0,sealedCommit:t,currentCommit:e,message:`Analysis is stale: sealed at ${t}, HEAD is ${e}. Run \`p. sync\` + \`p. seal\` to update.`}:{isStale:!1,sealedCommit:t,currentCommit:e,message:"Analysis is current."}:{isStale:!0,sealedCommit:t,currentCommit:null,message:"Cannot determine current commit. Analysis may be stale."}:{isStale:!1,sealedCommit:null,currentCommit:e,message:"No sealed analysis. Run `p. sync` then `p. seal`."}}async verify(t){let e=await this.read(t);if(!e.sealed)return{valid:!1,message:"No sealed analysis to verify."};if(!e.sealed.signature)return{valid:!1,message:"Sealed analysis has no signature."};let s=this.computeSignature({...e.sealed,signature:void 0,sealedAt:void 0});return s===e.sealed.signature?{valid:!0,message:"Signature verified. Analysis integrity confirmed."}:{valid:!1,message:`Signature mismatch. Expected ${s}, got ${e.sealed.signature}. Analysis may have been modified.`}}async semanticVerify(t,e){let s=await this.read(t),a=s.sealed??s.draft;return a?await Pt(a,e):{passed:!1,checks:[{name:"Analysis availability",passed:!1,error:"No analysis available. Run `p. sync` to generate.",durationMs:0}],totalMs:0,failedCount:1,passedCount:0}}computeSignature(t){let e={projectId:t.projectId,languages:t.languages,frameworks:t.frameworks,packageManager:t.packageManager,sourceDir:t.sourceDir,testDir:t.testDir,configFiles:t.configFiles,fileCount:t.fileCount,patterns:t.patterns,antiPatterns:t.antiPatterns,analyzedAt:t.analyzedAt,commitHash:t.commitHash};return Oe(JSON.stringify(e))}},K=new ae;import Os from"node:fs/promises";import Q from"node:path";Ie();is();os();J();$();cs();function ie(){return{branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0}}o(ie,"emptyGitData");function oe(){return{fileCount:0,version:"0.0.0",name:"unknown",ecosystem:"unknown",projectType:"simple",languages:[],frameworks:[]}}o(oe,"emptyStats");function ce(){return{install:"npm install",run:"npm run",test:"npm test",build:"npm run build",dev:"npm run dev",lint:"npm run lint",format:"npm run format"}}o(ce,"emptyCommands");function le(){return{hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]}}o(le,"emptyStack");ee();J();import kt from"node:fs/promises";import ws from"node:path";function Ps(n){return typeof Bun<"u"&&Bun.hash?`xxh64:${Bun.hash(n).toString(36)}`:`fnv1a:${([...n].reduce((e,s)=>Math.imul(e^s.charCodeAt(0),16777619),2166136261)>>>0).toString(36)}`}o(Ps,"hashContent");async function ks(n,t={}){let e=await Me(n,{skipDotfiles:!0,dotfileAllowlist:[".env.example"]}),s=new Map,a=t.changedFilesHint?.length?new Set(t.changedFilesHint):null,i=await Fe(e,100,async r=>{try{let c=ws.join(n,r),l=await kt.stat(c),d=l.mtime.toISOString(),m=t.storedHashes?.get(r),g=a?.has(r)??!1;if(m&&!g&&m.size===l.size&&m.mtime===d&&m.hash)return{path:r,hash:m.hash,size:l.size,mtime:d};let y=await kt.readFile(c,"utf-8");return{path:r,hash:Ps(y),size:l.size,mtime:d}}catch{return null}});for(let r of i)s.set(r.path,r);return s}o(ks,"computeHashes");function bs(n,t){let e=[],s=[],a=[];for(let[r,c]of n){let l=t.get(r);l?l.hash!==c.hash?s.push(r):a.push(r):e.push(r)}let i=[];for(let r of t.keys())n.has(r)||i.push(r);return{added:e,modified:s,deleted:i,unchanged:a}}o(bs,"diffHashes");function de(n,t){let e=_.getDb(n);e.transaction(()=>{e.prepare("DELETE FROM index_checksums").run();let s=e.prepare("INSERT INTO index_checksums (path, checksum, size, mtime) VALUES (?, ?, ?, ?)");for(let[,a]of t)s.run(a.path,a.hash,a.size,a.mtime)})(),_.setDoc(n,"file-hashes-meta",{fileCount:t.size,builtAt:new Date().toISOString()})}o(de,"saveHashes");function Cs(n){let t=new Map;try{let e=_.query(n,"SELECT path, checksum, size, mtime FROM index_checksums");for(let s of e)t.set(s.path,{path:s.path,hash:s.checksum,size:s.size||0,mtime:s.mtime||""})}catch{}return t}o(Cs,"loadHashes");async function ue(n,t,e){let s=Cs(t),a=await ks(n,{storedHashes:s,changedFilesHint:e});return{diff:bs(a,s),currentHashes:a}}o(ue,"detectChanges");function bt(n){return _.hasDoc(n,"file-hashes-meta")}o(bt,"hasHashRegistry");T();$();var xs=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]);async function Ct(n){let{projectId:t,projectPath:e,isFullSync:s,changedFilesHint:a}=n,i={shouldRebuildIndexes:!0,changedDomains:new Set,incrementalInfo:void 0,changedSourceFiles:[],deletedSourceFiles:[]};if(!s&&bt(t)){try{let{diff:r,currentHashes:c}=await ue(e,t,a),l=r.added.length+r.modified.length+r.deleted.length,d=(()=>{if(l===0&&!a?.length)return{shouldRebuildIndexes:!1,changedDomains:new Set,incrementalInfo:{isIncremental:!0,filesChanged:0,filesUnchanged:r.unchanged.length,indexesRebuilt:!1,affectedDomains:[]},changedSourceFiles:[],deletedSourceFiles:[]};let m=mt(r,t),g=pt(m.allAffected),y=m.allAffected.some(me);return{shouldRebuildIndexes:y,changedDomains:g,incrementalInfo:{isIncremental:!0,filesChanged:l,filesUnchanged:r.unchanged.length,indexesRebuilt:y,affectedDomains:Array.from(g)},changedSourceFiles:[...r.added,...r.modified].filter(me),deletedSourceFiles:r.deleted.filter(me)}})();return l>0&&de(t,c),d}catch(r){f.debug("Incremental detection failed, falling back to full sync",{error:v(r)})}return i}try{let{currentHashes:r}=await ue(e,t,a);de(t,r)}catch(r){f.debug("Hash computation failed (non-critical)",{error:v(r)})}return i}o(Ct,"detectIncrementalChanges");function me(n){let t=n.substring(n.lastIndexOf("."));return xs.has(t)}o(me,"isSourceFile");import{z as D}from"zod";var Dn=D.object({date:D.string(),tokensSaved:D.number(),syncs:D.number(),avgCompressionRate:D.number(),totalDuration:D.number()}),An=D.object({agentName:D.string(),usageCount:D.number(),tokensSaved:D.number()}),xt={"claude-opus-4.5":.005,"claude-sonnet-4.5":.003,"claude-haiku-4.5":.001,"claude-opus-4":.015,"claude-sonnet-4":.003,"gpt-4o":.0025,"gemini-pro":.00125,default:.003};function Dt(n,t="default"){let e=xt[t]||xt.default;return n/1e3*e}o(Dt,"estimateCostSaved");function jn(n){return n<.01?`$${(n*100).toFixed(2)}\xA2`:`$${n.toFixed(2)}`}o(jn,"formatCost");ee();var Ds=o(n=>({date:n.date,tokensSaved:n.tokens_saved,syncs:n.syncs,avgCompressionRate:n.avg_compression_rate,totalDuration:n.total_duration}),"rowToDaily"),q=o(n=>{let t=new Date;return t.setDate(t.getDate()-n),t.toISOString().split("T")[0]},"dayCutoff"),pe=class{static{o(this,"MetricsStorage")}async recordSync(t,e){let s=Math.max(0,e.originalSize-e.filteredSize),a=e.originalSize>0?s/e.originalSize:0,i=new Date().toISOString().split("T")[0];if(k.run(t,`INSERT INTO metrics_daily (date, tokens_saved, syncs, avg_compression_rate, total_duration)
|
|
12
|
+
VALUES (?, ?, 1, ?, ?)
|
|
13
|
+
ON CONFLICT(date) DO UPDATE SET
|
|
14
|
+
tokens_saved = metrics_daily.tokens_saved + excluded.tokens_saved,
|
|
15
|
+
avg_compression_rate =
|
|
16
|
+
(metrics_daily.avg_compression_rate * metrics_daily.syncs + excluded.avg_compression_rate)
|
|
17
|
+
/ (metrics_daily.syncs + 1),
|
|
18
|
+
syncs = metrics_daily.syncs + 1,
|
|
19
|
+
total_duration = metrics_daily.total_duration + excluded.total_duration`,i,s,a,e.duration),e.agents?.length){let r=Math.floor(s/e.agents.length);for(let c of e.agents)k.run(t,`INSERT INTO metrics_agent_usage (agent_name, usage_count, tokens_saved)
|
|
20
|
+
VALUES (?, 1, ?)
|
|
21
|
+
ON CONFLICT(agent_name) DO UPDATE SET
|
|
22
|
+
usage_count = metrics_agent_usage.usage_count + 1,
|
|
23
|
+
tokens_saved = metrics_agent_usage.tokens_saved + excluded.tokens_saved`,c,r)}}async getSummary(t){let e=k.get(t,`SELECT COALESCE(SUM(tokens_saved), 0) AS tokens,
|
|
24
|
+
COALESCE(SUM(syncs), 0) AS syncs,
|
|
25
|
+
COALESCE(SUM(total_duration), 0) AS duration,
|
|
26
|
+
COALESCE(SUM(avg_compression_rate * syncs), 0) AS weighted_rate
|
|
27
|
+
FROM metrics_daily`),s=e?.syncs??0,a=e?.tokens??0,i=o((m,g)=>k.get(t,g?"SELECT COALESCE(SUM(tokens_saved), 0) AS t FROM metrics_daily WHERE date >= ? AND date < ?":"SELECT COALESCE(SUM(tokens_saved), 0) AS t FROM metrics_daily WHERE date >= ?",...g?[m,g]:[m])?.t??0,"rangeTokens"),r=i(q(30)),c=i(q(60),q(30)),l=c>0?(r-c)/c*100:0,d=k.query(t,"SELECT * FROM metrics_agent_usage ORDER BY usage_count DESC LIMIT 5").map(m=>({agentName:m.agent_name,usageCount:m.usage_count,tokensSaved:m.tokens_saved}));return{totalTokensSaved:a,estimatedCostSaved:Dt(a),compressionRate:s>0?(e?.weighted_rate??0)/s:0,syncCount:s,avgSyncDuration:s>0?(e?.duration??0)/s:0,topAgents:d,last30DaysTokens:r,trend:l}}async getDailyStats(t,e=30){return k.query(t,"SELECT * FROM metrics_daily WHERE date >= ? ORDER BY date ASC",q(e)).map(Ds)}async getFirstSyncDate(t){return k.get(t,"SELECT MIN(date) AS d FROM metrics_daily")?.d??""}},At=new pe;T();Z();$();import As from"node:path";function js(n){return Ne(As.resolve(n))}o(js,"repoHash");function N(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"")}o(N,"normalizeKey");function Is(n){return se(n,t=>`${N(t.name)}::${N(t.source)}`)}o(Is,"dedupePatterns");function Es(n){return se(n,t=>`${N(t.issue)}::${N(t.file)}::${N(t.source)}`)}o(Es,"dedupeAntiPatterns");var fe=class{static{o(this,"PatternExtractor")}async extract(t){let e=js(t.projectPath),s=[];if(t.context7Verified)for(let l of t.frameworks)s.push({name:`${l} API validation via Context7`,description:`Validate ${l} APIs against current documentation through Context7 before implementation.`,framework:l,source:"context7",confidence:.7});let a=(t.feedback?.patternsDiscovered||[]).map(l=>({name:l,description:`Confirmed during completed tasks: ${l}`,source:"feedback",confidence:.75})),i=(t.feedback?.knownGotchas||[]).map(l=>({issue:l,file:"multiple",suggestion:`Recurring gotcha. Prevent this pattern during implementation: ${l}`,source:"feedback",severity:"medium",confidence:.7})),r=Is([...s,...a]),c=Es([...i]);return{patterns:r,antiPatterns:c,repoPathHash:e}}},Ms=new fe,jt=Ms;var It=200;async function Et(n,t,e){let{bm25Index:s,originalSize:a}=(()=>{try{let d=Ke(n),m=d?Object.values(d.documents).reduce((g,y)=>g+y.length,0):0;return{bm25Index:d,originalSize:m||t.fileCount*It}}catch(d){return f.debug("Could not load BM25 index for metrics",{error:v(d)}),{bm25Index:null,originalSize:t.fileCount*It}}})(),i=0,r=a>0?Math.max(0,(a-i)/a):0;try{await At.recordSync(n,{originalSize:a,filteredSize:i,duration:e,isWatch:!1})}catch(d){f.debug("Failed to record sync metrics",{error:v(d)})}try{let{velocityStorage:d}=await import("./velocity-storage-5T7RYOWH.mjs");await d.recompute(n)}catch(d){f.debug("Failed to recompute velocity",{error:v(d)})}let c=await import("./developer-evolution-AVAXGDKQ.mjs").then(({captureDeveloperSnapshot:d})=>d(n)).catch(d=>(f.debug("Failed to capture dev snapshot",{error:v(d)}),!1)),l={};try{let d=s;d&&(l.bm25Files=d.totalDocs,l.bm25AvgTokens=Math.round(d.avgDocLength),l.bm25VocabSize=Object.keys(d.invertedIndex).length);let m=Xe(n);m&&(l.importEdges=m.edgeCount,l.importFiles=m.fileCount);let g=it(n);g&&(l.cochangeCommits=g.commitsAnalyzed,l.cochangeFiles=g.filesAnalyzed)}catch(d){f.debug("Could not load index stats",{error:v(d)})}return{duration:e,originalSize:a,filteredSize:i,compressionRate:r,indexes:l,developerSnapshotCaptured:c}}o(Et,"recordSyncMetrics");async function Mt(n,t,e,s,a,i){try{let r=e.recentCommits[0]?.hash||null,c=await j.getAggregatedFeedback(n).catch(()=>{});try{let{refreshSkillIndex:d}=await import("./skill-index-L4UWQCQE.mjs");await d(n,t)}catch{}let l=await jt.extract({projectId:n,projectPath:t,languages:s.languages,frameworks:Array.from(new Set([...s.frameworks,...a.frameworks])),feedback:c,context7Verified:i});await K.saveDraft(n,{projectId:n,languages:s.languages,frameworks:s.frameworks,configFiles:[],fileCount:s.fileCount,patterns:l.patterns,antiPatterns:l.antiPatterns,analyzedAt:P(),status:"draft",commitHash:r??void 0})}catch(r){f.debug("Failed to save draft analysis (non-critical)",{error:v(r)})}}o(Mt,"saveDraftAnalysis");async function Ft(n){try{let[t,e,s,a,i]=await Promise.all([We.archiveOldShipped(n).catch(()=>0),Ge.markDormantIdeas(n).catch(()=>0),Je.removeStaleCompleted(n).catch(()=>0),j.archiveStalePausedTasks(n).catch(()=>[]),Be.capEntries(n).catch(()=>0)]),r=t+e+s+a.length+i;if(r>0){f.info("Archived stale data",{shipped:t,dormant:e,staleQueue:s,stalePaused:a.length,memoryCapped:i,total:r});let c=ze.getStats(n);f.debug("Archive stats",c)}}catch(t){f.debug("Archival failed (non-critical)",{error:v(t)})}}o(Ft,"archiveStaleData");Ie();$();var Ts=6e4,he=class extends Error{static{o(this,"SyncPhaseTimeoutError")}phase;timeoutMs;constructor(t,e){super(`sync phase '${t}' timed out after ${e}ms. Set PRJCT_SYNC_PHASE_TIMEOUT_MS to tune this guard, or run \`prjct sync --full --md\` if incremental state looks stale.`),this.name="SyncPhaseTimeoutError",this.phase=t,this.timeoutMs=e}};function Rs(){return Number(process.env.PRJCT_SYNC_PHASE_TIMEOUT_MS)||Ts}o(Rs,"syncPhaseTimeoutMs");function Tt(n,t){let e=Rs(),s=(()=>{let a=Promise.withResolvers(),i=setTimeout(()=>a.reject(new he(t,e)),e);return{promise:a.promise,cancel:o(()=>clearTimeout(i),"cancel")}})();return Promise.race([n,s.promise]).finally(s.cancel)}o(Tt,"withPhaseTimeout");async function Rt(n,t,e){let s=Date.now();f.debug("sync phase start",{phase:n});try{let a=await t(),i=Date.now()-s;return f.debug("sync phase done",{phase:n,ms:i}),e?.push({phase:n,ms:i}),a}catch(a){let i=Date.now()-s;throw f.debug("sync phase failed",{phase:n,ms:i,error:w(a)}),e?.push({phase:n,ms:i}),a}}o(Rt,"runSyncPhase");function ge(n,t={}){let e=t.now??Date.now,s=e(),i=(()=>{try{return n().then(()=>({}),r=>({error:r}))}catch(r){return Promise.resolve({error:r})}})().then(r=>{try{t.onComplete?.({totalMs:e()-s,...r})}catch{}});return{async settle(){await i}}}o(ge,"startPostIndexWork");ee();import _s from"node:fs/promises";import $s from"node:path";T();Z();$();T();J();import ye from"node:fs/promises";import Y from"node:path";var Se=".prjct/.prjct-state.md",ve=class{static{o(this,"LocalStateGenerator")}async generate(t,e){let s=Y.join(t,Se);await ye.mkdir(Y.dirname(s),{recursive:!0});let a=this.toMarkdown(e);await ye.writeFile(s,a,"utf-8")}async remove(t){try{await ye.unlink(Y.join(t,Se))}catch(e){if(!M(e))throw e}}async exists(t){let e=Y.join(t,Se);return R(e)}toMarkdown(t){let e=["<!-- Auto-generated by prjct - DO NOT EDIT -->","<!-- This file provides local state persistence for AI tools -->","","# prjct State",""];if(t.currentTask){let s=t.currentTask;if(e.push("## Current Work Cycle"),e.push(""),e.push(`**${s.description}**`),e.push(""),e.push(`- Started: ${s.startedAt}`),s.linearId&&e.push(`- Linear: ${s.linearId}`),s.branch&&e.push(`- Branch: ${s.branch}`),e.push(`- Status: ${s.status||"active"}`),e.push(""),s.subtasks&&s.subtasks.length>0){e.push("### Subtasks"),e.push(""),s.subtasks.forEach((c,l)=>{let d=c.status==="completed"?"\u2705":c.status==="in_progress"?"\u25B6\uFE0F":"\u23F3",m=l===s.currentSubtaskIndex?" \u2190 **Active**":"";e.push(`${l+1}. ${d} ${c.description}${m}`)}),e.push("");let a=s.subtasks.filter(c=>c.status==="completed").length,i=s.subtasks.length,r=Math.round(a/i*100);e.push(`**Progress**: ${a}/${i} (${r}%)`),e.push("")}}else e.push("*No active work cycle*"),e.push(""),e.push('Start work with `p. work "intent"`'),e.push("");if(t.previousTask){let s=t.previousTask;e.push("---"),e.push(""),e.push("## Previous Work Cycle"),e.push(""),e.push(`**${s.description}**`),e.push(""),e.push(`- Status: ${s.status}`),s.prUrl&&e.push(`- PR: ${s.prUrl}`),e.push("")}return e.push("---"),e.push(`*Last updated: ${t.lastUpdated||new Date().toISOString()}*`),e.push(""),e.join(`
|
|
28
|
+
`)}},_t=new ve;var Hs=["storage","context","memory","analysis","config","sync"];async function $t(n){try{await Promise.all(Hs.map(t=>_s.mkdir($s.join(n,t),{recursive:!0})))}catch(t){throw new Error(Ee(t,n,"project directories"))}}o($t,"ensureProjectDirectories");async function Ht(n){let{projectId:t,projectPath:e,cliVersion:s,git:a,stats:i}=n,r=k.getDoc(t,"project")||{},c={...r,projectId:t,repoPath:e,name:i.name,version:i.version,cliVersion:s,techStack:i.frameworks,fileCount:i.fileCount,commitCount:a.commits,stack:i.ecosystem,currentBranch:a.branch,hasUncommittedChanges:a.hasChanges,createdAt:r.createdAt||P(),lastSync:P(),lastSyncCommit:a.recentCommits[0]?.hash||null,lastSyncBranch:a.branch};k.setDoc(t,"project",c)}o(Ht,"updateProjectDoc");async function Ot(n){let{projectId:t,projectPath:e,stats:s,stack:a}=n,r={...await j.read(t)};r.projectId=t,r.stack={language:s.languages[0]||"Unknown",framework:s.frameworks[0]||null},r.domains={hasFrontend:a.hasFrontend,hasBackend:a.hasBackend,hasDatabase:a.hasDatabase,hasTesting:a.hasTesting,hasDocker:a.hasDocker},r.projectType=s.projectType,r.metrics={totalFiles:s.fileCount},r.lastSync=P(),r.lastUpdated=P(),r.context={...r.context||{},lastSession:P(),lastAction:"Synced project",nextAction:'Run `p. work "intent"` to start a work cycle'},await j.write(t,r);try{await _t.remove(e)}catch(c){f.debug("Legacy local state cleanup failed (optional)",{error:v(c)})}}o(Ot,"updateStateDoc");function Nt(n,t,e){k.appendEvent(n,"sync",{branch:t.branch,uncommitted:t.hasChanges,fileCount:e.fileCount,commitCount:t.commits})}o(Nt,"logSyncEvent");import Lt from"node:fs/promises";import we from"node:path";T();as();var Vt={async jsonFilesValid(n){let t=Date.now(),e=[],s=we.basename(n);try{await j.read(s)}catch(a){M(a)||e.push(`state: ${v(a)}`)}return{name:"State data valid",passed:e.length===0,output:e.length===0?"1 store validated":void 0,error:e.length>0?e.join("; "):void 0,durationMs:Date.now()-t}},async noSensitiveData(n){let t=Date.now(),e=we.join(n,"context"),s=[/(?:api[_-]?key|apikey)\s*[:=]\s*['"][^'"]{10,}/i,/(?:password|passwd|pwd)\s*[:=]\s*['"][^'"]{4,}/i,/(?:secret|token)\s*[:=]\s*['"][^'"]{10,}/i],a=[];try{let i=await Lt.readdir(e);for(let r of i){if(!r.endsWith(".md"))continue;let c=await Lt.readFile(we.join(e,r),"utf-8");for(let l of s)if(l.test(c)){a.push(`${r}: potential sensitive data detected`);break}}}catch(i){if(!M(i))return{name:"No sensitive data",passed:!1,error:`Could not scan: ${v(i)}`,durationMs:Date.now()-t}}return{name:"No sensitive data",passed:a.length===0,output:a.length===0?"No sensitive patterns found":void 0,error:a.length>0?a.join("; "):void 0,durationMs:Date.now()-t}}},Pe=class{static{o(this,"SyncVerifier")}async verify(t,e,s){let a=Date.now(),i=[],r=s?.failFast??!1,c=[],l=[Vt.jsonFilesValid(e),Vt.noSensitiveData(e)];for(let m of l){let g=await m;if(i.push(g),!g.passed&&r){c.push(...s?.checks?.filter(y=>y.enabled!==!1).map(y=>y.name)??[]);break}}if((!r||i.every(m=>m.passed))&&s?.checks)for(let m of s.checks){if(m.enabled===!1){c.push(m.name);continue}let g=await this.runCustomCheck(m,t);if(i.push(g),!g.passed&&r){let y=s.checks.slice(s.checks.indexOf(m)+1);c.push(...y.filter(b=>b.enabled!==!1).map(b=>b.name));break}}return{...B(i,a),skippedCount:c.length}}async runCustomCheck(t,e){let s=Date.now(),a=t.command||(t.script?`sh ${t.script}`:null);if(!a)return{name:t.name,passed:!1,error:"No command or script specified",durationMs:Date.now()-s};try{let{stdout:i,stderr:r}=await je(a,{cwd:e,timeout:3e4});return{name:t.name,passed:!0,output:(i.trim()||r.trim()).slice(0,200)||void 0,durationMs:Date.now()-s}}catch(i){let r=i;return{name:t.name,passed:!1,error:(r.stderr?.trim()||r.message).slice(0,200),durationMs:Date.now()-s}}}},zt=new Pe;var ke=class{static{o(this,"SyncService")}projectPath;projectId=null;globalPath="";cliVersion="0.0.0";constructor(){this.projectPath=process.cwd()}async sync(t=process.cwd(),e={}){this.projectPath=t;let s=Date.now(),a=[],i=o((l,d)=>Rt(l,d,a),"phase"),r={installed:!1,verified:!1,configPath:"",message:""},c=[];try{if(this.projectId=await H.getProjectId(t),!this.projectId)return{success:!1,projectId:"",cliVersion:"",git:ie(),stats:oe(),commands:ce(),stack:le(),context7:{installed:!1,verified:!1},error:"No prjct project. Run p. init first."};if(this.globalPath=He.getGlobalProjectPath(this.projectId),this.cliVersion=await this.getCliVersion(),await Os.rm(Q.join(this.globalPath,"agents"),{recursive:!0,force:!0}).catch(()=>{}),(await $e()).installed){let u=await Le({autoRepair:!0});u.verified||f.warn(`Codex p. router not ready: ${u.message||"verification failed"}`)}await i("mcp-defaults",()=>at({silent:!0,verifyContext7:!1}));let d=await _e().catch(()=>null),m=d?.name??"claude";try{Object.assign(r,await i("context7",()=>Re.ensureReady(m)))}catch(u){let p=w(u);f.warn(`Context7 MCP not ready (continuing sync): ${p}`),Object.assign(r,{verified:!1,message:p})}await $t(this.globalPath),process.env.PRJCT_SKIP_CREW_SWEEP!=="1"&&await i("legacy-crew-sweep",async()=>{try{let{legacyCrewSweep:u}=await import("./legacy-crew-sweep-G5UJT2PM.mjs"),p=await u(this.projectPath,this.projectId);(p.checkpointsMigrated||p.teamMigrated||p.checkpointsHandEditWarned||p.teamHandEditWarned||p.ghostDirsPurged.length>0||p.agentFilesRepaired.length>0||p.clientPrjctJunkPurged.length>0||p.errors.length>0)&&f.info("Legacy crew sweep ran",{checkpointsMigrated:p.checkpointsMigrated,teamMigrated:p.teamMigrated,checkpointsHandEditWarned:p.checkpointsHandEditWarned,teamHandEditWarned:p.teamHandEditWarned,ghostDirsPurged:p.ghostDirsPurged,agentFilesRepaired:p.agentFilesRepaired,ghostFilesIngested:p.ghostFilesIngested,clientPrjctJunkPurged:p.clientPrjctJunkPurged,errors:p.errors.length})}catch(u){f.debug("Legacy crew sweep failed (non-critical)",{error:w(u)})}});let[y,b,be,L]=await i("gather",()=>Tt(Promise.all([ft(this.projectPath),ht(this.projectPath),gt(this.projectPath),yt(this.projectPath)]),"gather")),{shouldRebuildIndexes:Ut,changedDomains:Ns,incrementalInfo:Ce,changedSourceFiles:V,deletedSourceFiles:z}=await i("incremental",()=>Ct({projectId:this.projectId,projectPath:this.projectPath,isFullSync:e.full===!0,changedFilesHint:e.changedFiles}));try{let{refreshFileInventory:u}=await import("./project-file-inventory-XIHHJZUP.mjs");await u(this.projectId,this.projectPath)}catch{}try{await ct(this.projectId)}catch{}Ut&&await i("index",async()=>{try{let u=Ce?.isIncremental&&(V.length>0||z.length>0);await Promise.all([u?Ye(this.projectPath,this.projectId,V,z):qe(this.projectPath,this.projectId),u?et(this.projectPath,this.projectId,V,z):Ze(this.projectPath,this.projectId),u?st(this.projectPath,this.projectId,V,z):tt(this.projectPath,this.projectId),ot(this.projectPath,this.projectId)]);let p=this.projectId,S=this.projectPath,E=await H.readConfig(S).catch(()=>null),C=lt(E);c.push(ge(()=>dt(p,{uploadToCloud:C}),{onComplete:o(({totalMs:x,error:G})=>{f.debug("sync post-index work settled",{projectId:p,uploadToCloud:C,totalMs:x,...G===void 0?{}:{error:w(G)}})},"onComplete")}))}catch(u){f.debug("File ranking index build failed (non-critical)",{error:w(u)})}});let Wt=Date.now();f.debug("sync phase start",{phase:"skills"});let Gt=await ut.generateAndInstall().catch(u=>{f.debug("Native skill generation failed (non-critical)",{error:w(u)})});f.debug("sync phase done",{phase:"skills",ms:Date.now()-Wt}),await i("update-files",()=>Promise.all([Ht({projectId:this.projectId,projectPath:this.projectPath,cliVersion:this.cliVersion,git:y,stats:b}),Ot({projectId:this.projectId,projectPath:this.projectPath,stats:b,stack:L}),Promise.resolve(Nt(this.projectId,y,b)),Mt(this.projectId,this.projectPath,y,b,L,r.verified)]));let X=await K.getActive(this.projectId),Jt={patterns:X?.patterns?.length||0,antiPatterns:X?.antiPatterns?.length||0,criticalAntiPatterns:X?.antiPatterns?.filter(u=>u.severity==="high").length||0},Bt=await(async()=>{try{let{recomputeProjectStyle:u,formatProjectStyleForSync:p}=await import("./project-style-evolution-HIMSJQQB.mjs"),S=await i("project-style",()=>u({projectId:this.projectId,projectPath:this.projectPath,stats:b,stack:L,commands:be,commitHash:y.recentCommits[0]?.hash??null,source:"sync-mechanical"})),E=p(S),C=S.snapshot.payload.metrics.styleCoverage;return{summary:S.snapshot.summary,evolutionMd:E.evolutionMd,patternCount:S.snapshot.patternCount,antiPatternCount:S.snapshot.antiPatternCount,conventionCount:S.snapshot.conventionCount,styleCoverage:typeof C=="number"?C:Number(C)||0,isFirst:S.isFirst,hasChanges:S.delta.hasChanges}}catch(u){f.debug("Project style recompute failed (non-critical)",{error:w(u)});return}})(),xe=[],U={},W=o((u,p,S)=>{xe.push(ge(async()=>{S(await i(u,p))},{onComplete:o(({totalMs:E,error:C})=>{f.debug("sync floating phase settled",{phase:u,overlapped:!0,totalMs:E,...C===void 0?{}:{error:w(C)}})},"onComplete")}))},"floatPhase"),Kt=Date.now()-s;W("metrics",()=>Et(this.projectId,b,Kt),u=>{U.syncMetrics=u}),W("install-global",async()=>{await te.installGlobalConfig(d??void 0),await te.syncCommands(d??void 0)},()=>{}),W("install-agent-surfaces",async()=>{let{detectInstalledAgents:u}=await import("./detection-KKDZYWVD.mjs"),p=await u(this.projectPath).catch(()=>[]);await rt(this.projectPath,{refreshIfAdopted:!0,agents:p})},()=>{}),W("verify",async()=>{try{let u=await H.readConfig(this.projectPath);return await zt.verify(this.projectPath,this.globalPath,u?.verification)}catch(u){f.debug("Verification failed (non-critical)",{error:w(u)});return}},u=>{U.verification=u});let qt=await i("work-cost",()=>St(this.projectId));await i("archive",()=>Ft(this.projectId));let Yt=await i("context-quality",()=>Qe(this.projectPath,this.projectId)),Qt=await i("retention",async()=>{try{let u=await H.readConfig(this.projectPath).catch(()=>null),p=u?.retention?.mode??"apply";if(p==="off")return;let S=p==="dry-run",{applyRetention:E,triageInbox:C}=await import("./retention-QSXWKE4H.mjs"),x=E(this.projectId,{dryRun:S,maxArchive:u?.retention?.maxArchive,maxDelete:u?.retention?.maxDelete}),{inboxMerged:G,inboxArchived:es}=S?{inboxMerged:0,inboxArchived:0}:(()=>{let A=C(this.projectId);return{inboxMerged:A.merged,inboxArchived:A.archived}})(),{runVaultPurge:ts,vaultHealth:ss}=await import("./purge-6SJKHKIY.mjs"),F=await ts(this.projectId,{projectPath:this.projectPath,dryRun:S,softDeletedPurgeDays:u?.retention?.softDeletedPurgeDays,archivePruneDays:u?.retention?.archivePruneDays,autoSourceMaxLive:u?.retention?.autoSourceMaxLive}),ns=ss(this.projectId);return{evaluated:x.evaluated,active:x.active,archive:x.wouldArchive,delete:x.wouldDelete,archived:x.archived,deleted:x.deleted,inboxMerged:G,inboxArchived:es,dryRun:S,samples:x.samples.map(A=>({id:A.id,type:A.type,verdict:A.verdict,score:A.score,reasons:A.reasons,excess:A.excess})),referenceSize:x.referenceSize,vault:{...ns,softDeletedPurged:F.softDeletedPurged,orphanEventsPurged:F.orphanEventsPurged,archivesPruned:F.archivesPruned,autoSourceTrimmed:F.autoSourceTrimmed,distilledDiscarded:F.distilledDiscarded,digestsWritten:F.digestsWritten}}}catch(u){f.debug("retention phase failed",{error:w(u)});return}});if(process.env.PRJCT_WORLD_MODEL_REFRESH==="1"||process.env.PRJCT_DRIFT_REFRESH==="1")try{let u=await import("node:os"),{markDriftRefreshApplied:p}=await import("./drift-refresh-XPJAO2B3.mjs"),S=process.env.PRJCT_CLI_HOME?Q.resolve(process.env.PRJCT_CLI_HOME):Q.join(u.homedir(),".prjct-cli");p(S)}catch{}await Promise.all([...c.map(u=>u.settle()),...xe.map(u=>u.settle())]);let De=U.syncMetrics,Xt=U.verification,Zt=De?.developerSnapshotCaptured===!0;return{success:!0,projectId:this.projectId,cliVersion:this.cliVersion,git:y,stats:b,commands:be,stack:L,context7:{installed:r.installed,verified:r.verified,message:r.message},analysisSummary:Jt,contextQuality:Yt,retentionDryRun:Qt,syncMetrics:De,workCost:qt,verification:Xt,incremental:Ce,projectStyle:Bt,developerSnapshotCaptured:Zt,generatedSkills:Gt,phaseTimings:a}}catch(l){return{success:!1,projectId:this.projectId||"",cliVersion:this.cliVersion,git:ie(),stats:oe(),commands:ce(),stack:le(),context7:{installed:r.installed,verified:r.verified,message:r.message},error:w(l)}}}async getCliVersion(){try{let t=Q.join(__dirname,"..","..","package.json");return(await Te(t))?.version||"0.0.0"}catch(t){return f.debug("Failed to read CLI version",{error:w(t)}),"0.0.0"}}},oa=new ke;export{Vs as a,zs as b,K as c,jn as d,At as e,oa as f};
|
|
@@ -0,0 +1,30 @@
|
|
|
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 R}from"./chunk-L5LFLI4R.mjs";import{a}from"./chunk-5YLI5V3Q.mjs";import{b as h}from"./chunk-B2HY22OD.mjs";import{f as l,i as E}from"./chunk-DMO3ZFUG.mjs";import{a as c}from"./chunk-3TRXQAU4.mjs";E();var _="land-receipt",k="judgment-receipt",g="receipt-v1";function D(e){let s=e.trapsSurfaced??[],t=e.decisions??[],n=(e.journal??[]).filter(r=>r.trim()),o=(e.openRisksNext??[]).filter(r=>r.trim()),u=e.cycleDescription?.trim()||null,y=e.tokensIn!=null||e.tokensOut!=null||!!e.model;if(!u&&s.length===0&&t.length===0&&n.length===0&&o.length===0&&!y)return null;let i=["# Judgment Receipt",""],m=[];if(u&&m.push(`cycle: "${a(u,100)}"`),n.length>0&&m.push(`journal: ${n.slice(0,4).map(r=>a(r,70)).join(" \xB7 ")}`),m.length>0&&i.push("## Applied judgment",...m.map(r=>`- ${r}`),""),s.length>0&&i.push("## Traps re-surfaced",...s.slice(0,8).map(r=>`- **[${r.type}]** ${a(r.title,100)} \`${r.id}\``),""),t.length>0&&i.push("## Decisions contested or honored",...t.slice(0,8).map(r=>`- **${r.status}** [${r.type}] ${a(r.title,100)} \`${r.id}\``),""),o.length>0||u){let r=o.length>0?o.slice(0,5).map(d=>`- ${a(d,120)}`):["- Finish or pause open cycle; next agent: `prjct prime` / `prjct work --md`."];i.push("## Open risks / next",...r,"")}if(y){let r=[];if(e.tokensIn!=null||e.tokensOut!=null){let d=e.tokensIn??0,f=e.tokensOut??0;r.push(`tokens in=${d} out=${f} total=${d+f}`)}e.model&&r.push(`model=${e.model}`),e.author&&r.push(`author=${e.author}`),i.push("## Session economics",`- ${r.join(" \xB7 ")}`,"")}return i.push("_Closed-loop judgment continuity \u2014 not bulk memory. Proof of traps prevented and decisions applied._"),i.join(`
|
|
8
|
+
`).trim()}c(D,"buildJudgmentReceipt");function I(e){if(!e)return null;let s=(e.match(/## Traps re-surfaced/g)||[]).length,t=p(e,"Traps re-surfaced"),n=p(e,"Decisions contested or honored"),o=[];return t>0&&o.push(`${t} trap(s) re-surfaced`),n>0&&o.push(`${n} decision(s) tracked`),o.length===0&&o.push("session judgment landed"),`Judgment receipt: ${o.join(", ")}`}c(I,"summarizeJudgmentReceipt");function p(e,s){let t=new RegExp(`## ${s}\\n([\\s\\S]*?)(?=\\n## |\\n_|$)`),n=e.match(t);return n?(n[1].match(/^- /gm)||[]).length:0}c(p,"countSectionBullets");async function S(e,s,t){let n=D(t);if(!n)return{wrote:!1,content:null,summary:null,reason:"nothing-to-receipt"};try{return await h.remember(e,{type:"context",content:n,tags:{source:_,topic:k,capture:g,synthesis:"deterministic"},provenance:"extracted",projectId:s}),{wrote:!0,content:n,summary:I(n)}}catch(o){return{wrote:!1,content:n,summary:I(n),reason:`remember-failed: ${o.message}`}}}c(S,"persistJudgmentReceipt");async function b(e){let s=R(e.projectId,e.cycleId),t=O(e.projectId),n=j(e.projectId);return S(e.projectPath,e.projectId,{cycleDescription:e.cycleDescription,cycleId:e.cycleId,journal:s,trapsSurfaced:t,decisions:n,tokensIn:e.tokensIn,tokensOut:e.tokensOut,model:e.model,author:e.author,openRisksNext:e.cycleDescription?["Open cycle still needs finish or pause before context dies."]:[]})}c(b,"synthesizeJudgmentReceipt");function C(e){try{let s=Date.now()-864e5,n=l.query(e,`SELECT me.id, me.content
|
|
9
|
+
FROM memory_entries me
|
|
10
|
+
JOIN memory_entry_tags t ON t.entry_id = me.id
|
|
11
|
+
WHERE me.deleted_at IS NULL
|
|
12
|
+
AND me.created_at >= ?
|
|
13
|
+
AND t.key = 'capture' AND t.value = ?
|
|
14
|
+
ORDER BY me.created_at DESC
|
|
15
|
+
LIMIT 1`,s,g)[0];return n?{id:n.id,content:n.content,trapCount:p(n.content,"Traps re-surfaced")}:null}catch{return null}}c(C,"latestJudgmentReceipt24h");function T(e,s){try{let t=s??0;return l.get(e,`SELECT COUNT(*) AS c
|
|
16
|
+
FROM memory_entries me
|
|
17
|
+
JOIN memory_entry_tags t ON t.entry_id = me.id
|
|
18
|
+
WHERE me.deleted_at IS NULL
|
|
19
|
+
AND me.created_at >= ?
|
|
20
|
+
AND t.key = 'capture' AND t.value = ?`,t,g)?.c??0}catch{return 0}}c(T,"countReceiptsWritten");function O(e){try{return l.query(e,`SELECT id, type, content FROM memory_entries
|
|
21
|
+
WHERE deleted_at IS NULL
|
|
22
|
+
AND type IN ('gotcha', 'anti-pattern')
|
|
23
|
+
ORDER BY created_at DESC
|
|
24
|
+
LIMIT 5`).map(t=>({id:t.id,type:t.type,title:t.content.replace(/\s+/g," ").trim().slice(0,120)}))}catch{return[]}}c(O,"recentSurfacedTraps");function j(e){try{return l.query(e,`SELECT me.id, me.type, me.content, t.value AS action
|
|
25
|
+
FROM memory_entries me
|
|
26
|
+
JOIN memory_entry_tags t ON t.entry_id = me.id AND t.key = 'conflict_action'
|
|
27
|
+
WHERE me.deleted_at IS NULL
|
|
28
|
+
AND me.created_at >= ?
|
|
29
|
+
ORDER BY me.created_at DESC
|
|
30
|
+
LIMIT 8`,Date.now()-864e5).map(t=>({id:t.id,type:t.type,title:t.content.replace(/\s+/g," ").trim().slice(0,120),status:t.action==="deny"||t.action==="warn"?"contested":"honored"}))}catch{return[]}}c(j,"recentConflictDecisions");export{_ as a,k as b,g as c,D as d,I as e,S as f,b as g,C as h,T as i};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
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 i}from"./chunk-EHVU2SMR.mjs";import{a as s}from"./chunk-3TRXQAU4.mjs";import r from"chalk";var c={task:"Start new work cycle",done:"Complete current work",pause:"Pause and switch context",resume:"Continue paused task",ship:"Ship the feature",reopen:"Reopen for rework",next:"View task queue",sync:"Analyze project",bug:"Report a bug",idea:"Capture an idea"},g={task:"work"};function p(e){return g[e]??e}s(p,"publicCommand");var l={task:"working",done:"completed","done-subtask":"working",pause:"paused",resume:"working",ship:"shipped",reopen:"working",next:"idle",sync:"idle",init:"idle",bug:"working",idea:"idle"};function w(e,n={}){if(n.quiet)return;let a=l[e]||"idle",d=i.getValidCommands(a);if(d.length===0)return;let t=d.map(o=>({cmd:`p. ${p(o)}`,desc:c[o]||o}));console.log(r.dim(`
|
|
8
|
+
Next:`));for(let o of t){let u=r.cyan(o.cmd.padEnd(12));console.log(r.dim(` ${u} \u2192 ${o.desc}`))}}s(w,"showNextSteps");function k(e,n=!1){let a=l[e]||"idle";return i.getValidCommands(a).map(t=>({cmd:n?`prjct ${p(t)} --md`:`p. ${p(t)}`,desc:c[t]||t}))}s(k,"getNextSteps");function S(e){let n=i.getStateInfo(e);console.log(r.dim(`\u{1F4CD} State: ${r.white(e.toUpperCase())} - ${n.description}`))}s(S,"showStateInfo");export{w as a,k as b,S as c};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 s,b as p}from"./chunk-U24YKPYX.mjs";import{a as o}from"./chunk-3TRXQAU4.mjs";p();import f from"node:fs";import g from"node:path";function c(){return g.join(s(),"config")}o(c,"configDir");function l(){return g.join(c(),"global.json")}o(l,"configFilePath");var i={config:null,stamp:""};function u(n){try{let t=f.statSync(n);return`${n}|${t.mtimeMs}|${t.size}`}catch{return`${n}|absent`}}o(u,"fileStamp");function a(){let n=l(),t=u(n);if(i.config!==null&&t===i.stamp)return i.config;let e=(()=>{try{let r=JSON.parse(f.readFileSync(n,"utf-8"));return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}})();return i.config=e,i.stamp=t,e}o(a,"readRaw");function b(n){f.mkdirSync(c(),{recursive:!0}),f.writeFileSync(l(),`${JSON.stringify(n,null,2)}
|
|
8
|
+
`,"utf-8"),i.config=n,i.stamp=u(l())}o(b,"writeRaw");function G(n){return a()[n]}o(G,"getConfig");function h(){return a()}o(h,"getAll");function C(n,t){let e=a();t===void 0?delete e[n]:e[n]=t,b(e)}o(C,"setConfig");function x(n){C(n,void 0)}o(x,"unsetConfig");function S(){return l()}o(S,"configPath");export{G as a,h as b,C as c,x as d,S as e};
|
|
@@ -0,0 +1,8 @@
|
|
|
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{e as m,l as k}from"./chunk-HU5ERAAV.mjs";import{a}from"./chunk-3TRXQAU4.mjs";k();var p=["zod","better-sqlite3","@modelcontextprotocol/sdk","@modelcontextprotocol/client","@modelcontextprotocol/server","chalk","chokidar","commander","express","fastify","hono","react","next","vue","vitest","jest","typescript","biome","lefthook","drizzle-orm","prisma","@prisma/client"];function l(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"item"}a(l,"stableStyleKey");function f(t){return t?!!(t.architecture?.style&&t.architecture.style!=="unknown"||(t.patterns?.length??0)>0||(t.conventions?.length??0)>0||(t.antiPatterns?.length??0)>0||(t.stack?.frameworks?.length??0)>0||(t.stack?.languages?.length??0)>0):!1}a(f,"isRichLlmAnalysis");function A(t){return!f(t)}a(A,"isThinLlmAnalysis");function P(t){let n=h(t),s=S(t.commands),r=f(t.llmAnalysis)?t.llmAnalysis:null,i=b(r?.conventions?.map(e=>({key:l(e.category?`${e.category}-${e.rule}`:e.rule),rule:e.rule,category:e.category}))??[],t.memoryConventions?.map(e=>({key:l(e.category?`${e.category}-${e.rule}`:e.rule),rule:e.rule,category:e.category}))??[]),o=x(r?.patterns?.map(e=>({key:l(e.name),name:e.name,description:e.description,locations:e.locations,category:e.category}))??[],t.memoryPatterns?.map(e=>({key:l(e.name),name:e.name,description:e.description}))??[]),c=C(r?.antiPatterns?.map(e=>({key:l(e.issue),issue:e.issue,suggestion:e.suggestion,severity:e.severity}))??[],t.memoryAntiPatterns?.map(e=>({key:l(e.issue),issue:e.issue,suggestion:e.suggestion}))??[]);if(r?.stack?.languages?.length)for(let e of r.stack.languages)n.languages.includes(e)||n.languages.push(e);if(r?.stack?.frameworks?.length)for(let e of r.stack.frameworks)n.frameworks.includes(e)||n.frameworks.push(e);r?.stack?.packageManager&&!n.packageManager&&(n.packageManager=r.stack.packageManager);let u={symbols:t.structural?.symbols??0,files:t.structural?.files??t.stats.fileCount??0,packages:t.structural?.packages??[]};return{payloadVersion:1,stack:n,commands:s,conventions:i,patterns:o,antiPatterns:c,structural:u,metrics:{...t.metrics??{}}}}a(P,"buildProjectStylePayload");function $(t){let n=P(t),s=t.capturedAt??m();return{id:t.id??`style_${s.replace(/[^0-9]/g,"").slice(0,14)}_${Math.random().toString(36).slice(2,8)}`,capturedAt:s,commitHash:t.commitHash??null,source:t.source??"sync-mechanical",patternCount:n.patterns.length,antiPatternCount:n.antiPatterns.length,conventionCount:n.conventions.length,frameworkCount:n.stack.frameworks.length,symbolCount:n.structural.symbols,fileCount:n.structural.files,summary:d(n),payload:n}}a($,"buildProjectStyleSnapshot");function d(t){let n=[t.stack.ecosystem!=="unknown"?t.stack.ecosystem:null,t.stack.languages.slice(0,2).join("+")||null,t.stack.frameworks.slice(0,3).join(", ")||null].filter(Boolean);return`${n.length>0?n.join(" \xB7 "):"stack unknown"}; ${t.patterns.length} patterns, ${t.antiPatterns.length} anti-patterns, ${t.conventions.length} conventions; ${t.structural.files} files`+(t.structural.symbols>0?`, ${t.structural.symbols} symbols`:"")}a(d,"buildStyleSummary");function h(t){let n=g([...t.stack.frameworks??[],...t.stats.frameworks??[]]),s=g([...t.stats.languages??[]]),r=j(t.packageDeps??{}),i=t.packageDeps??{};for(let c of r)["Hono","Express","Fastify","React","Next.js","Vue","NestJS"].includes(c)&&!n.includes(c)&&n.push(c);let o=t.stack.hasTesting===!0||!!(i.vitest||i.jest||i.mocha||i["bun-types"]||i["@types/bun"]||r.includes("Vitest")||r.includes("Jest"))||!!(t.commands?.test&&/test/i.test(t.commands.test));return{ecosystem:t.stats.ecosystem||"unknown",languages:s,frameworks:n,packageManager:t.packageManager??void 0,keyLibraries:r,hasTests:o,hasDocker:t.stack.hasDocker===!0}}a(h,"buildStack");function S(t){return t?{test:t.test,lint:t.lint,build:t.build,dev:t.dev,install:t.install,format:t.format}:{}}a(S,"buildCommands");function j(t){let n=new Set;for(let s of p)t[s]&&n.add(v(s));return[...n].slice(0,16)}a(j,"collectKeyLibraries");function v(t){return{hono:"Hono",express:"Express",fastify:"Fastify",react:"React",next:"Next.js",vue:"Vue",vitest:"Vitest",jest:"Jest",typescript:"TypeScript",zod:"Zod","better-sqlite3":"better-sqlite3","@modelcontextprotocol/sdk":"MCP SDK","@modelcontextprotocol/client":"MCP SDK","@modelcontextprotocol/server":"MCP SDK",biome:"Biome",lefthook:"Lefthook","drizzle-orm":"Drizzle",prisma:"Prisma","@prisma/client":"Prisma"}[t]??t}a(v,"displayLibName");function b(t,n){let s=new Map;for(let r of[...t,...n])s.has(r.key)||s.set(r.key,r);return[...s.values()].slice(0,40)}a(b,"mergeConventions");function x(t,n){let s=new Map;for(let r of[...t,...n])s.has(r.key)||s.set(r.key,r);return[...s.values()].slice(0,40)}a(x,"mergePatterns");function C(t,n){let s=new Map;for(let r of[...t,...n])s.has(r.key)||s.set(r.key,r);return[...s.values()].slice(0,40)}a(C,"mergeAntiPatterns");function g(t){let n=[],s=new Set;for(let r of t){let i=r.trim();if(!i)continue;let o=i.toLowerCase();s.has(o)||(s.add(o),n.push(i))}return n}a(g,"unique");function L(t,n={}){if(!t)return null;let s=n.maxConventions??5,r=n.maxPatterns??4,i=n.maxAnti??3,o=t.payload,c=["## How this repo works (project style)",""],u=[o.stack.ecosystem!=="unknown"?o.stack.ecosystem:null,o.stack.languages.join(", ")||null,o.stack.frameworks.join(", ")||null,o.stack.keyLibraries.slice(0,6).join(", ")||null].filter(Boolean);if(u.length>0&&c.push(`**Stack:** ${u.join(" \xB7 ")}`),o.conventions.length>0){c.push("","**Conventions (match):**");for(let e of o.conventions.slice(0,s))c.push(`- ${e.rule}`)}if(o.patterns.length>0){c.push("","**Patterns (match):**");for(let e of o.patterns.slice(0,r))c.push(`- **${e.name}** \u2014 ${y(e.description,120)}`)}if(o.antiPatterns.length>0){c.push("","**Anti-patterns (avoid):**");for(let e of o.antiPatterns.slice(0,i))c.push(`- ${e.issue}${e.suggestion?` \u2192 ${y(e.suggestion,80)}`:""}`)}return o.conventions.length===0&&o.patterns.length===0&&o.antiPatterns.length===0&&c.push("","_No durable house patterns yet \u2014 open a neighbor file and match local idiom. Prefer `prjct sync` + structured analysis-save-llm JSON to enrich._"),c.push("",`_${t.summary}_`),c.join(`
|
|
8
|
+
`)}a(L,"formatProjectStyleDigest");function y(t,n){let s=t.replace(/\s+/g," ").trim();return s.length>n?`${s.slice(0,n-1)}\u2026`:s}a(y,"truncate");export{f as a,A as b,$ as c,L as d};
|
|
@@ -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 o}from"./chunk-3TRXQAU4.mjs";var a={"session-start":{load:o(()=>import("./session-start-FM6UL7MT.mjs"),"load"),exportName:"runSessionStartHook"},prompt:{load:o(()=>import("./prompt-47YP5JIR.mjs"),"load"),exportName:"runPromptHook"},"pre-bash":{load:o(()=>import("./pre-bash-32ZOGNSP.mjs"),"load"),exportName:"runPreBashHook"},"pre-commit":{load:o(()=>import("./pre-commit-7TU2A7H4.mjs"),"load"),exportName:"runPreCommitHook"},"pre-secrets":{load:o(()=>import("./pre-secrets-RJELPDFY.mjs"),"load"),exportName:"runPreSecretsHook"},"pre-package":{load:o(()=>import("./pre-package-ZTZACEBB.mjs"),"load"),exportName:"runPrePackageHook"},"pre-edit":{load:o(()=>import("./pre-edit-ASEWA5TS.mjs"),"load"),exportName:"runPreEditHook"},"pre-search":{load:o(()=>import("./pre-search-MKDRFJSE.mjs"),"load"),exportName:"runPreSearchHook"},"post-edit":{load:o(()=>import("./post-edit-GTBY32JU.mjs"),"load"),exportName:"runPostEditHook"},stop:{load:o(()=>import("./stop-6SH36ULT.mjs"),"load"),exportName:"runStopHook"},"subagent-start":{load:o(()=>import("./subagent-start-TVGBV2V2.mjs"),"load"),exportName:"runSubagentStartHook"},"subagent-stop":{load:o(()=>import("./subagent-stop-APWY6KMX.mjs"),"load"),exportName:"runSubagentStopHook"},notification:{load:o(()=>import("./notification-G654IX3O.mjs"),"load"),exportName:"runNotificationHook"},"cwd-changed":{load:o(()=>import("./cwd-changed-EUJZOBIC.mjs"),"load"),exportName:"runCwdChangedHook"}},p=new Map;async function u(r){let t=p.get(r);if(t)return t;let e=a[r];if(!e)return;let i=(await e.load())[e.exportName];if(typeof i=="function")return p.set(r,i),i}o(u,"resolveRunner");var s=Object.fromEntries(Object.keys(a).map(r=>[r,async(t,e)=>{let n=await u(r);if(!n)throw new Error(`Hook runner missing export for '${r}'`);return n(t,e)}]));function d(r){return r&&a[r]?s[r]:void 0}o(d,"getHookRunner");export{s as a,d 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{a as o,c as i}from"./chunk-3TRXQAU4.mjs";import t from"node:os";import e from"node:path";function p(){let r=process.env.PRJCT_CLI_HOME?.trim();return r?e.resolve(r):e.join(t.homedir(),".prjct-cli")}var m=i(()=>{"use strict";o(p,"resolveCliHome")});export{p as a,m as b};
|
|
@@ -0,0 +1,9 @@
|
|
|
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{i as c,n as f,p as S}from"./chunk-D62TAZG6.mjs";import{a as n}from"./chunk-3TRXQAU4.mjs";S();import{createHash as C}from"node:crypto";import B from"node:fs/promises";import g from"node:path";var x="missing",T=1,u=200;function H(t){return C("sha256").update(t).digest("hex")}n(H,"sha256Hex");function v(t){return t===null?x:H(typeof t=="string"?Buffer.from(t,"utf8"):t)}n(v,"hashBlobContent");function w(t){let e=[...t].map(r=>({path:h(r.path),blobHash:r.blobHash})).filter(r=>r.path.length>0).sort((r,s)=>r.path<s.path?-1:r.path>s.path?1:0).map(r=>`${r.path}\0${r.blobHash}`);return H(e.join(`
|
|
8
|
+
`))}n(w,"buildTreeHash");function h(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").trim()}n(h,"normalizeStampPath");function A(t,e){let r=e.maxPaths??u,s=t.map(o=>({path:h(o.path),blobHash:v(o.content)})).filter(o=>o.path.length>0),i=new Map;for(let o of s)i.set(o.path,o.blobHash);let a=[...i.entries()].map(([o,m])=>({path:o,blobHash:m})).sort((o,m)=>o.path<m.path?-1:o.path>m.path?1:0),p=w(a);return{version:T,treeHash:p,pathCount:a.length,paths:a.slice(0,r),stampedAt:e.stampedAt,headSha:e.headSha}}n(A,"stampFromContents");function _(t){if(t.override)return{blocked:!1,reason:"override",message:""};if(!t.stamp?.treeHash)return t.hard?{blocked:!0,reason:"no-stamp",message:"Content-bound stamp missing: re-run `prjct judgment approve` so ship binds to the reviewed tree. Override only with consent: `prjct ship --no-judgment-gate`."}:{blocked:!1,reason:"no-stamp",message:""};if(t.stamp.pathCount===0)return{blocked:!1,reason:"empty-scope",message:"Content-bound stamp empty (no scoped paths) \u2014 advisory only.",stampedTreeHash:t.stamp.treeHash};if(t.currentTreeHash===null)return{blocked:!1,reason:"unverified",message:`\u2696\uFE0F Content-bound stamp ${d(t.stamp.treeHash)} not re-verified (IO).`,stampedTreeHash:t.stamp.treeHash};if(t.currentTreeHash===t.stamp.treeHash)return{blocked:!1,reason:"match",message:`\u2696\uFE0F Content-bound match tree=${d(t.stamp.treeHash)} (${t.stamp.pathCount} paths)`,stampedTreeHash:t.stamp.treeHash,currentTreeHash:t.currentTreeHash};let e=`Content-bound drift: approved tree=${d(t.stamp.treeHash)} now=${d(t.currentTreeHash)} (${t.stamp.pathCount} paths). Re-run \`prjct judgment approve\` after re-review. Override only with consent: \`prjct ship --no-judgment-gate\`.`;return{blocked:t.hard,reason:"drift",message:t.hard?e:`\u2696\uFE0F ${e}`,stampedTreeHash:t.stamp.treeHash,currentTreeHash:t.currentTreeHash}}n(_,"contentBoundDriftVerdict");function d(t){return t.slice(0,12)}n(d,"shortHash");async function l(t,e){return f(t,e,{timeoutMs:5e3})}n(l,"safeGit");async function b(t,e){if(e&&e.length>0)return[...new Set(e.map(h).filter(a=>a.length>0&&!a.endsWith("/")))].slice(0,u);let r=await l(t,["diff","--name-only","HEAD"])??await l(t,["diff","--name-only","--cached"])??"",s=await l(t,["diff","--name-only","HEAD~1..HEAD"])??"",i=r.trim()||s.trim();return i?[...new Set(i.split(`
|
|
9
|
+
`).map(h).filter(a=>a.length>0))].slice(0,u):[]}n(b,"resolveStampPaths");async function N(t){try{return await B.readFile(t)}catch{return null}}n(N,"readFileOrNull");async function y(t,e,r){let s=[];for(let i of e){let a=h(i);if(!a||a.includes(".."))continue;let p=g.join(t,a);p.startsWith(g.resolve(t))&&s.push({path:a,content:await N(p)})}return A(s,r)}n(y,"stampProjectPaths");async function $(t,e,r){let s=await b(t,e),i=await l(t,["rev-parse","HEAD"])??void 0;return y(t,s,{stampedAt:r,headSha:i})}n($,"stampForApprove");async function k(t,e){try{let r=e.paths.length>0?e.paths.map(i=>i.path):await b(t,null);return(await y(t,r,{stampedAt:e.stampedAt,headSha:e.headSha})).treeHash}catch(r){if(r instanceof c)throw r;return null}}n(k,"currentTreeHashForStamp");export{x as a,T as b,u as c,v as d,w as e,h as f,A as g,_ as h,d as i,b as j,y as k,$ as l,k as m};
|
|
@@ -0,0 +1,64 @@
|
|
|
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 ge}from"./chunk-NNILF7R3.mjs";import{a as Oe}from"./chunk-NZKUCQZK.mjs";import{a as Ve,c as Be,d as j}from"./chunk-H2KNJUPN.mjs";import{a as Ne}from"./chunk-6FUCOGOW.mjs";import{b as qe}from"./chunk-6U3CYLY5.mjs";import{c as me}from"./chunk-Q3LUL6LL.mjs";import{a as De}from"./chunk-E73HSXCX.mjs";import{a as re}from"./chunk-O5N6XYPU.mjs";import{a as Ge,b as de,c as pe,e as ie}from"./chunk-SROBBOJB.mjs";import{e as _e,f as Me}from"./chunk-2NI4EEK2.mjs";import{e as Fe,f as Ie,g as We}from"./chunk-BUD3R6LF.mjs";import{b as Le}from"./chunk-B2HY22OD.mjs";import{a as O}from"./chunk-X433BB6F.mjs";import{c as He,f as L,h as Ae}from"./chunk-EZRNQXCC.mjs";import{b as w}from"./chunk-EHVU2SMR.mjs";import{a as fe}from"./chunk-L4TUXFCL.mjs";import{b as ue}from"./chunk-XSZOHNL4.mjs";import{g as Pe,i as ht}from"./chunk-DMO3ZFUG.mjs";import{d as Re,e as ne,l as le}from"./chunk-HU5ERAAV.mjs";import{a as ae,b as $,e as K,i as ee,l as J,o as Ee,p as te}from"./chunk-D62TAZG6.mjs";import{f as ce,g as Te,h as H,j as W,l as Ce,o as xe,p as Se}from"./chunk-HYIT7MF5.mjs";import{e as P,g as mt}from"./chunk-225DWS4D.mjs";import{a}from"./chunk-3TRXQAU4.mjs";Ae();le();te();Ae();import{execSync as St}from"node:child_process";import Ze from"node:fs/promises";import V from"node:path";import E from"chalk";le();Se();import Ue from"node:path";var vt=["CHANGELOG.md","HISTORY.md","NEWS.md","CHANGES.md"],yt=`# Changelog
|
|
8
|
+
|
|
9
|
+
All notable changes to this project will be documented in this file.
|
|
10
|
+
|
|
11
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
12
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
13
|
+
`,se=class{static{a(this,"ChangelogService")}projectPath;constructor(e){this.projectPath=e}async detect(){for(let r of vt){let i=Ue.join(this.projectPath,r);if(await Ce(i)){let s=await H(i),o=this.detectFormat(s);return{filePath:i,fileName:r,format:o,created:!1}}}let e="CHANGELOG.md",n=Ue.join(this.projectPath,e);return await W(n,`${yt}
|
|
14
|
+
`),{filePath:n,fileName:e,format:"keepachangelog",created:!0}}async addEntry(e){let n=await this.detect(),r=await H(n.filePath);if(this.hasVersionEntry(r,e.version,n.format))return;let i=e.date||Re(new Date),s=n.format==="keepachangelog"?this.insertKeepAChangelogEntry(r,e,i):this.insertMarkdownEntry(r,e,i);await W(n.filePath,s)}hasVersionEntry(e,n,r){let i=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return(r==="keepachangelog"?new RegExp(`^## \\[${i}\\]`,"m"):new RegExp(`^## ${i}\\b`,"m")).test(e)}async addFeature(e,n){await this.addEntry({version:e,sections:{Added:[n]}})}detectFormat(e){return e.includes("Keep a Changelog")||e.includes("keepachangelog.com")||/^### (?:Added|Changed|Deprecated|Removed|Fixed|Security)\s*$/m.test(e)?"keepachangelog":"markdown"}insertKeepAChangelogEntry(e,n,r){let i=e.split(`
|
|
15
|
+
`),s=i.findIndex(c=>/^##\s*\[Unreleased\]\s*$/i.test(c));if(s!==-1){let c=i.slice(s+1).findIndex(T=>/^##\s/.test(T)),f=c===-1?i.length:s+1+c,d=i.slice(s+1,f).join(`
|
|
16
|
+
`).trim(),g=this.promoteUnreleasedBody(d,n,r);return`${[...i.slice(0,s),"## [Unreleased]","",g,"",...i.slice(f)].join(`
|
|
17
|
+
`).replace(/\n{3,}/g,`
|
|
18
|
+
|
|
19
|
+
`).trimEnd()}
|
|
20
|
+
`}let o=this.formatKeepAChangelogEntry(n,r),l=e.search(/^## /m);if(l!==-1){let c=e.slice(0,l),f=e.slice(l);return`${c}## [Unreleased]
|
|
21
|
+
|
|
22
|
+
${o}
|
|
23
|
+
${f}`}return`${e.trimEnd()}
|
|
24
|
+
|
|
25
|
+
## [Unreleased]
|
|
26
|
+
|
|
27
|
+
${o}
|
|
28
|
+
`}promoteUnreleasedBody(e,n,r){if(!e)return this.formatKeepAChangelogEntry(n,r);let i=`## [${n.version}] - ${r}`,o=(n.sections?.Added??(n.description?[n.description]:[])).filter(f=>!e.includes(f));if(o.length===0)return`${i}
|
|
29
|
+
|
|
30
|
+
${e}`;let l=o.map(f=>`- ${f}`).join(`
|
|
31
|
+
`),c=/^###\s+Added\s*$/im.test(e)?e.replace(/^###\s+Added\s*$/im,f=>`${f}
|
|
32
|
+
${l}`):`### Added
|
|
33
|
+
${l}
|
|
34
|
+
|
|
35
|
+
${e}`;return`${i}
|
|
36
|
+
|
|
37
|
+
${c}`}insertMarkdownEntry(e,n,r){let i=this.formatMarkdownEntry(n,r),s=e.indexOf(`
|
|
38
|
+
`);if(s!==-1){let o=e.slice(0,s+1),l=e.slice(s+1);return`${o}
|
|
39
|
+
${i}
|
|
40
|
+
${l}`}return`${i}
|
|
41
|
+
|
|
42
|
+
${e}`}formatKeepAChangelogEntry(e,n){let r=[`## [${e.version}] - ${n}`];return r.push(""),e.sections?this.renderSections(r,e.sections):e.description&&(r.push("### Added"),r.push(`- ${e.description}`),r.push("")),r.join(`
|
|
43
|
+
`)}renderSections(e,n){for(let[r,i]of Object.entries(n)){e.push(`### ${r}`);for(let s of i)e.push(`- ${s}`);e.push("")}}formatMarkdownEntry(e,n){let r=[`## ${e.version} - ${n}`];return r.push(""),e.sections?this.renderSections(r,e.sections):e.description&&(r.push(`- ${e.description}`),r.push("")),r.join(`
|
|
44
|
+
`)}};te();Se();import N from"node:path";var oe=class{static{a(this,"VersionService")}projectPath;constructor(e){this.projectPath=e}async detect(){let e=[()=>this.fromPackageJson(),()=>this.fromCargoToml(),()=>this.fromPyprojectToml(),()=>this.fromCsproj(),()=>this.fromVersionFile("VERSION"),()=>this.fromVersionFile("version.txt"),()=>this.fromGitTag()];for(let n of e){let r=await n();if(r)return r}return this.createFallbackVersion()}async bump(e="patch"){let n=await this.detect();if(n.file){let i=await this.readVersionFromGitHead(n.file,n.format);if(i&&this.isAheadOf(n.current,i))return n.current}let r=Et(n.current,e);return await this.writeVersion({...n,next:r}),r}async readVersionFromGitHead(e,n){let r=N.relative(this.projectPath,e),i=await K(["show",`HEAD:${r}`],{cwd:this.projectPath});if(!i.ok){if(i.kind==="exit")return null;J(i)}try{let s=i.stdout;if(n==="json")return JSON.parse(s).version??null;if(n==="plaintext"){let o=s.trim();return he(o)?o:null}return n==="toml"?ze(s)??Ke(s):n==="xml"?Je(s):null}catch{return null}}isAheadOf(e,n){let r=e.split(".").map(s=>Number.parseInt(s,10)||0),i=n.split(".").map(s=>Number.parseInt(s,10)||0);for(let s of[0,1,2]){let o=r[s]??0,l=i[s]??0;if(o>l)return!0;if(o<l)return!1}return!1}async fromPackageJson(){let e=N.join(this.projectPath,"package.json"),n=await ce(e,null);return n?.version?{current:n.version,next:D(n.version),file:e,format:"json"}:null}async fromCargoToml(){let e=N.join(this.projectPath,"Cargo.toml"),n=await H(e,"");if(!n)return null;let r=ze(n);return r?{current:r,next:D(r),file:e,format:"toml"}:null}async fromPyprojectToml(){let e=N.join(this.projectPath,"pyproject.toml"),n=await H(e,"");if(!n)return null;let r=Ke(n);return r?{current:r,next:D(r),file:e,format:"toml"}:null}async fromCsproj(){let e=await xe(this.projectPath,{extension:".csproj"});if(e.length===0)return null;let n=N.join(this.projectPath,e[0]),r=await H(n,"");if(!r)return null;let i=Je(r);return i?{current:i,next:D(i),file:n,format:"xml"}:null}async fromVersionFile(e){let n=N.join(this.projectPath,e),r=await H(n,"");if(!r)return null;let i=r.trim();return he(i)?{current:i,next:D(i),file:n,format:"plaintext"}:null}async fromGitTag(){let e=await K(["tag","--sort=-v:refname"],{cwd:this.projectPath});if(!e.ok){if(e.kind==="exit")return null;J(e)}let n=e.stdout.trim().split(`
|
|
45
|
+
`);for(let r of n){let i=r.trim().replace(/^v/,"");if(he(i))return{current:i,next:D(i),file:null,format:"git-tag"}}return null}async createFallbackVersion(){let e=N.join(this.projectPath,"VERSION");return await W(e,`0.1.0
|
|
46
|
+
`),{current:"0.1.0",next:"0.1.1",file:e,format:"plaintext"}}async writeVersion(e){if(!e.file){e.format==="git-tag"&&await $("git",["tag",`v${e.next}`],{cwd:this.projectPath});return}switch(e.format){case"json":await this.writeJsonVersion(e.file,e.next);break;case"toml":await this.writeTomlVersion(e.file,e.next);break;case"xml":await this.writeXmlVersion(e.file,e.next);break;case"plaintext":await W(e.file,`${e.next}
|
|
47
|
+
`);break}}async writeJsonVersion(e,n){let r=await ce(e,{});r&&(r.version=n,await Te(e,r))}async writeTomlVersion(e,n){let r=await H(e,"");if(!r)return;let i=r.replace(/^(\s*version\s*=\s*")([^"]+)(")/m,`$1${n}$3`);await W(e,i)}async writeXmlVersion(e,n){let r=await H(e,"");if(!r)return;let i=r.replace(/(<Version>)([^<]+)(<\/Version>)/,`$1${n}$3`);await W(e,i)}};function he(t){return/^\d+\.\d+\.\d+/.test(t)}a(he,"isSemver");function D(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return t;let[,n,r,i,s]=e;if(s){let o=s.split("."),l=o.length-1;return/^\d+$/.test(o[l])?(o[l]=String(Number(o[l])+1),`${n}.${r}.${i}-${o.join(".")}`):`${n}.${r}.${i}-${s}.1`}return`${n}.${r}.${Number(i)+1}`}a(D,"bumpPatch");function bt(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);return e?`${e[1]}.${Number(e[2])+1}.0`:t}a(bt,"bumpMinor");function $t(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);return e?`${Number(e[1])+1}.0.0`:t}a($t,"bumpMajor");function Et(t,e){return e==="major"?$t(t):e==="minor"?bt(t):D(t)}a(Et,"bumpVersion");function je(t){let e=(t??"").toLowerCase().trim();return e?/^[a-z]+(\([^)]*\))?!:/.test(e)||e.includes("breaking change")?"major":/^(fix|chore|docs|refactor|perf|style|test|build|ci|revert)(\([^)]*\))?:/.test(e)?"patch":"minor":"patch"}a(je,"inferBumpLevel");function ze(t){let e=t.match(/\[package\]([\s\S]*?)(?=\n\[|\n*$)/);return e?e[1].match(/^\s*version\s*=\s*"([^"]+)"/m)?.[1]??null:null}a(ze,"parseTomlVersion");function Ke(t){let e=t.match(/\[project\]([\s\S]*?)(?=\n\[|\n*$)/);if(e){let r=e[1].match(/^\s*version\s*=\s*"([^"]+)"/m);if(r)return r[1]}let n=t.match(/\[tool\.poetry\]([\s\S]*?)(?=\n\[|\n*$)/);if(n){let r=n[1].match(/^\s*version\s*=\s*"([^"]+)"/m);if(r)return r[1]}return null}a(Ke,"parsePyprojectVersion");function Je(t){return t.match(/<Version>([^<]+)<\/Version>/)?.[1]?.trim()??null}a(Je,"parseCsprojVersion");ht();mt();te();function Tt(t){let e=t.split(/\s+/).map(r=>r.trim()).filter(Boolean),n=[];for(let r of e){let i=r.match(/^tags:([a-zA-Z0-9_\-.]+)([=~])(.+)$/);if(i){n.push({kind:"tags",key:i[1],op:i[2],value:i[3]});continue}let s=r.match(/^branch([=~])(.+)$/);if(s){n.push({kind:"branch",op:s[1],value:s[2]});continue}let o=r.match(/^files:(.+)$/);o&&n.push({kind:"files",op:"~",value:o[1]})}return n}a(Tt,"parseWhen");var Xe=new Map;function Ct(t){let e=Xe.get(t);if(e)return e;let n=a(s=>{if(s>=t.length)return"";let o=t[s];return o==="*"?t[s+1]==="*"?`.*${n(s+2)}`:`[^/]*${n(s+1)}`:`${/[.+^${}()|[\]\\]/.test(o)?`\\${o}`:o}${n(s+1)}`},"translate"),r=n(0),i=new RegExp(`^${r}$`);return Xe.set(t,i),i}a(Ct,"globToRegex");function xt(t,e){if(t.kind==="tags"){let n=e.tags[t.key??""]??"";return t.op==="="?n===t.value:n.toLowerCase().includes(t.value.toLowerCase())}if(t.kind==="branch")return t.op==="="?e.branch===t.value:e.branch.toLowerCase().includes(t.value.toLowerCase());if(t.kind==="files"){let n=Ct(t.value);return e.filesChanged.some(r=>n.test(r))}return!0}a(xt,"matchCondition");function Ye(t,e){if(!t||!t.trim())return!0;let n=Tt(t);return n.length===0?!0:n.every(r=>xt(r,e))}a(Ye,"evaluateWhen");var Qe="status:",tt="script:",nt="mcp:",Rt="persona:context",et="version:bump",Pt="changelog:add",ke="git:commit",Ht="git:push",At="pr:ensure",rt="verify:";async function Ft(t,e,n){let r=await w.getCurrentTask(t);if(!r)throw new Error(`Cannot transition to '${n}': no active work cycle`);await O.log(e,L,{taskId:r.id,from:r.type??null,to:n,source:"workflow"})}a(Ft,"runStatusTransition");async function It(t,e){let{evaluateWorkflowRuleExecutable:n}=await import("./trust-boundary-24F662RM.mjs"),r=n(t.trustSource,t.description||t.action);if(!r.allow)throw new Error(r.denyMessage);await ae(t.action,{timeout:t.timeoutMs,cwd:e,env:{...process.env}})}a(It,"runShellAction");async function Wt(t){let{test:e}=await Ne(t);return e?.command??null}a(Wt,"detectVerifyCommand");async function _t(t,e){let{evaluateWorkflowRuleExecutable:n}=await import("./trust-boundary-24F662RM.mjs"),r=n(t.trustSource,t.description||t.action);if(!r.allow)throw new Error(r.denyMessage);let i=t.action.slice(rt.length).trim();if(!i)throw new Error(`Empty command in verify action '${t.action}'`);let s=i==="auto"?await Wt(e).then(o=>{if(!o)throw new Error("verify:auto found no test script (package.json `scripts.test`). Specify an explicit check, e.g. `verify:bun test` or `verify:npm run typecheck`.");return o}):i;try{await ae(s,{timeout:t.timeoutMs,cwd:e,env:{...process.env}})}catch(o){throw new Error(`Verification failed: \`${s}\`
|
|
48
|
+
${P(o)}
|
|
49
|
+
Stop-the-line: do not proceed. Fix the failure and re-run this check \u2014 unverified output must not advance.`)}}a(_t,"runVerifyAction");async function Mt(t,e,n){let{evaluateWorkflowRuleExecutable:r}=await import("./trust-boundary-24F662RM.mjs"),i=r(t.trustSource,t.description||t.action);if(!i.allow)throw new Error(i.denyMessage);let s=t.action.slice(tt.length).trim();if(!s)throw new Error(`Empty script path in action '${t.action}'`);if(V.isAbsolute(s)||s.includes("\0"))throw new Error(`Script path escapes workflows dir: ${s}`);let o=V.resolve(e,".prjct/workflows"),l=V.resolve(o,s),c=V.relative(o,l);if(c.startsWith("..")||V.isAbsolute(c))throw new Error(`Script path escapes workflows dir: ${s}`);let f=await Ze.realpath(l).catch(()=>{throw new Error(`Script not found: .prjct/workflows/${s}`)}),d=await Ze.realpath(o).catch(()=>o),g=V.relative(d,f);if(g.startsWith("..")||V.isAbsolute(g))throw new Error(`Script path escapes workflows dir: ${s}`);await $("bash",[f],{timeout:t.timeoutMs,cwd:e,env:{...process.env,PRJCT_BRANCH:n.branch,PRJCT_FILES_CHANGED:n.filesChanged.join(","),PRJCT_TAGS:Object.entries(n.tags).map(([k,T])=>`${k}=${T}`).join(",")}})}a(Mt,"runScriptAction");function Lt(t){let e=t.action.slice(nt.length).trim(),n=e.indexOf(":");if(n===-1)return`Call MCP tool ${JSON.stringify(e)} (server unspecified \u2014 re-author rule with format \`mcp:<server>:<tool>[:<args>]\`).`;let r=e.slice(0,n),i=e.slice(n+1),s=i.indexOf(":"),o=s===-1?i:i.slice(0,s),l=s===-1?"":i.slice(s+1),c=t.description?` (${t.description})`:"";return l?`Call MCP \`${r}.${o}\` with args ${l}${c}.`:`Call MCP \`${r}.${o}\`${c}.`}a(Lt,"buildMcpInstruction");async function Ot(t){try{let{default:e}=await import("./config-manager-QY73WM5U.mjs"),r=(await e.readConfig(t))?.persona;if(!r)return"No persona declared for this project \u2014 `.prjct/prjct.config.json` has no `persona` field.";let i=[`You are **${r.role}** in this project.`];return r.focus&&i.push(`Focus: ${r.focus}.`),r.mcps&&r.mcps.length>0&&i.push(`MCPs available: ${r.mcps.join(", ")}.`),r.packs&&r.packs.length>0&&i.push(`Active packs: ${r.packs.join(", ")}.`),i.join(" ")}catch(e){return`Could not resolve persona: ${P(e)}`}}a(Ot,"buildPersonaInstruction");async function Nt(t,e){let n=new oe(t),r=je(typeof e.feature=="string"?e.feature:void 0),i=await n.bump(r);e.version=i}a(Nt,"runVersionBump");async function Dt(t,e){let n=typeof e.version=="string"?e.version:null,r=typeof e.feature=="string"?e.feature:null;if(!n)throw new Error("changelog:add requires a prior version:bump step (no version in runContext)");if(!r)throw new Error("changelog:add requires a feature name in runContext (set by ship before rules run)");await new se(t).addFeature(n,r)}a(Dt,"runChangelogAdd");function it(t,e){return t.replace(/\$([A-Z_]+)/g,(n,r)=>{let i=r.toLowerCase(),s=e[i];return typeof s=="string"?s:""})}a(it,"expandTemplate");async function Vt(t,e,n){let i=t.slice(ke.length).replace(/^:/,"").trim()||(n.version?"feat: $FEATURE (v$VERSION)":"feat: $FEATURE"),s=`${it(i,n)}
|
|
50
|
+
|
|
51
|
+
Generated with [p/](https://www.prjct.app/)`;await $("git",["add","."],{cwd:e}),await $("git",["commit","-m",s],{cwd:e})}a(Vt,"runGitCommit");function Gt(t,e){let n=t.trim(),r=e.trim(),i=r.includes("/")?r.slice(r.indexOf("/")+1):"";return!!n&&i===n?["push"]:["push","-u","origin","HEAD"]}a(Gt,"decideGitPushArgs");async function Bt(t){let e=await $("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t}).then(i=>i.stdout.trim()).catch(()=>""),n=await $("git",["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"],{cwd:t}).then(i=>i.stdout.trim()).catch(()=>""),r=Gt(e,n);try{await $("git",r,{cwd:t,timeout:3e4})}catch(i){let s=P(i);throw new Error(`git push failed: ${s}`)}}a(Bt,"runGitPush");async function qt(t,e,n){try{let r=await $("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t}).then(c=>c.stdout.trim());if(!r||r==="main"||r==="master")return;if(!await $("gh",["--version"],{cwd:t}).then(()=>!0).catch(()=>!1)){n.instructions.push("# prjct: pr:ensure skipped \u2014 `gh` CLI not found. Install it or open the PR manually.");return}let s=await $("gh",["pr","list","--head",r,"--json","number","--jq","length"],{cwd:t}).then(c=>Number(c.stdout.trim())).catch(()=>-1);if(s<0){n.instructions.push("# prjct: pr:ensure could not check for an existing PR (gh not authenticated?) \u2014 skipped.");return}if(s>0)return;let o=it(e.version?"feat: $FEATURE (v$VERSION)":"feat: $FEATURE",e),l=await $("gh",["pr","create","--fill",...o?["--title",o]:[]],{cwd:t,timeout:3e4}).then(c=>c.stdout.trim());n.instructions.push(`# prjct: opened PR \u2014 ${l}`)}catch(r){n.instructions.push(`# prjct: pr:ensure failed (non-blocking) \u2014 ${P(r)}`)}}a(qt,"runPrEnsure");async function we(t,e,n,r,i,s){let o=t.action;if(o.startsWith(Qe)){let l=o.slice(Qe.length).trim();if(!l)throw new Error(`Empty status target in action '${o}'`);await Ft(e,n,l);return}if(o.startsWith(tt)){await Mt(t,n,r);return}if(o.startsWith(nt)){i.instructions.push(Lt(t));return}if(o===Rt){i.instructions.push(await Ot(n));return}if(o===et||o.startsWith(`${et}:`)){await Nt(n,s);return}if(o===Pt){await Dt(n,s);return}if(o===ke||o.startsWith(`${ke}:`)){await Vt(o,n,s);return}if(o===Ht){await Bt(n);return}if(o===At){await qt(n,s,i);return}if(o.startsWith(rt)){await _t(t,n);return}await It(t,n)}a(we,"runRuleAction");async function Ut(t,e){let[n,r,i]=await Promise.all([zt(e),Kt(e),Jt(t)]);return{branch:n,filesChanged:r,tags:i}}a(Ut,"buildWhenContext");async function zt(t){try{return await re(t)||""}catch{return""}}a(zt,"resolveBranch");async function Kt(t){let e={cwd:t,encoding:"utf-8"},n=a(async s=>{try{return St(s,e).split(`
|
|
52
|
+
`).map(o=>o.trim()).filter(Boolean)}catch{return[]}},"runDiff"),[r,i]=await Promise.all([n("git diff --cached --name-only"),n("git diff --name-only")]);return[...new Set([...r,...i])]}a(Kt,"resolveChangedFiles");async function Jt(t){try{let e=await w.getCurrentTask(t),n={};if(e?.type&&(n.type=e.type),!e)return n;let r=Pe.get(t,"SELECT data FROM events WHERE type = ? ORDER BY id DESC LIMIT 1",He);if(r)try{let i=JSON.parse(r.data);if(i.taskId===e.id&&i.tags)return{...n,...i.tags}}catch{}return n}catch{return{}}}a(Jt,"resolveActiveTags");async function ve(t,e,n,r={}){let i={success:!0,gatesFailed:[],hooksFailed:[],stepsRun:[],instructions:[],output:""};if(r.skipRules)return i;let s=r.runContext??{},l=Oe.getRulesForCommand(t,e).filter(u=>u.position===n),c=r.projectPath||process.cwd(),d=l.some(u=>u.whenExpr||u.type==="gate")?await Ut(t,c):{branch:"",filesChanged:[],tags:{}},g=l.filter(u=>Ye(u.whenExpr,d)),k=g.length>0?Ge(t,`${n}:${e}`):null,T=g.filter(u=>u.type==="gate");for(let u of T){let m=u.description||u.action;console.log(`
|
|
53
|
+
${E.dim(`[gate] ${n}-${e}: ${u.action}`)}`);try{let v=Date.now();await we(u,t,c,d,i,s);let R=Date.now()-v,U=R>1e3?`${(R/1e3).toFixed(1)}s`:`${R}ms`;console.log(`${E.green("\u2713")} ${E.dim(`gate passed (${U})`)}`),de(t,k,u.id,!0)}catch(v){return console.log(`${E.red("\u2717")} gate failed: ${m}`),i.gatesFailed.push(m),i.success=!1,i.output+=`Gate failed: ${m}
|
|
54
|
+
${P(v)}
|
|
55
|
+
`,de(t,k,u.id,!1,P(v)),ie(t,k,"blocked"),i}}let G=g.filter(u=>u.type==="instruction");for(let u of G){let m=u.description||u.action;console.log(`
|
|
56
|
+
${E.dim(`[instruction] ${n}-${e}: ${m}`)}`),i.instructions.push(u.action)}let B=g.filter(u=>u.type==="hook"),q=B.filter(u=>u.parallel===!1),C=B.filter(u=>u.parallel!==!1),Y=a(async u=>{console.log(`
|
|
57
|
+
${E.dim(`[hook] ${n}-${e}: ${u.action}`)}`);try{let m=Date.now();await we(u,t,c,d,i,s);let v=Date.now()-m,R=v>1e3?`${(v/1e3).toFixed(1)}s`:`${v}ms`;console.log(`${E.green("\u2713")} ${E.dim(`(${R})`)}`)}catch(m){console.log(`${E.yellow("\u26A0")} hook failed (non-blocking): ${u.action}`),i.hooksFailed.push(u.description||u.action),i.output+=`Hook failed: ${u.action}
|
|
58
|
+
${P(m)}
|
|
59
|
+
`}},"runHook");for(let u of q)await Y(u);C.length>0&&await Promise.all(C.map(Y));let Z=g.filter(u=>u.type==="step");for(let[u,m]of Z.entries()){console.log(`
|
|
60
|
+
${E.dim(`[step] ${e}: ${m.action}`)}`);try{let v=Date.now();await we(m,t,c,d,i,s);let R=Date.now()-v,U=R>1e3?`${(R/1e3).toFixed(1)}s`:`${R}ms`;console.log(`${E.green("\u2713")} ${E.dim(`step passed (${U})`)}`),i.stepsRun.push(m.description||m.action),pe(t,k,m.id,u,"ok")}catch(v){return console.log(`${E.red("\u2717")} step failed: ${m.action}`),i.gatesFailed.push(m.description||m.action),i.success=!1,i.output+=`Step failed: ${m.action}
|
|
61
|
+
${P(v)}
|
|
62
|
+
`,pe(t,k,m.id,u,"failed",P(v)),ie(t,k,"failed"),i}}return ie(t,k,"passed"),i}a(ve,"executeWorkflowRules");le();te();var jt=["cli","command","install","setup","doctor","mcp","codex","claude","statusline","statusbar","output","help"],Xt=new Set(["the","and","for","with","that","this","task","implement","implementa","fix","bug","add","agrega","crear","hacer","esto","debe"]);function X(t){let e=t.toLowerCase(),n=Yt(e),r=jt.some(d=>e.includes(d)),i=A(e,["security","seguridad","auth","permission","secret","migration","sqlite","database","arquitectura","architecture","must","critical","critico","cr\xEDtico"]),s=Zt(n,e,i),o=Qt(s,i),l=en(n,s,r),c=tn(s),f=rn(t);return{level:s,kind:n,risk:o,expectedEvidence:l,scopeHints:f,gates:c,rationale:nn(s,n,o),createdAt:ne()}}a(X,"buildTaskHarness");async function ye(t,e){let n=e.harness;if(!n||n.level==="H0")return{changedFiles:[],observedEvidence:[],warnings:[],diffSize:0};let r=await Promise.all([Ee(t),ln(t)]).then(([f,d])=>({changedFiles:f,diffSize:d,gitUnavailable:null})).catch(f=>{if(f instanceof ee)return{changedFiles:[],diffSize:0,gitUnavailable:f};throw f}),{changedFiles:i,diffSize:s,gitUnavailable:o}=r,l=sn(i),c=[];return o?(c.push(`git ${o.kind}: change evidence unavailable \u2014 completion checks skipped, not failed.`),{changedFiles:i,observedEvidence:l,warnings:c,diffSize:s}):(n.expectedEvidence.includes("regression-test")&&!l.includes("tests-changed")&&c.push(`${n.level} expects a regression test; no test file changed in the diff.`),n.expectedEvidence.includes("docs-if-public-behavior")&&cn(i)&&!l.includes("docs-changed")&&c.push("Public-facing files changed; no README/docs/changelog file changed."),s>400&&c.push(`Diff is ${s} changed lines; consider splitting or justify the scope.`),{changedFiles:i,observedEvidence:l,warnings:c,diffSize:s})}a(ye,"evaluateHarnessCompletion");function Yt(t){if(A(t,["security","seguridad","auth","authent","authoriz","permission","secret"]))return"security";if(A(t,["bug","bugs","fix","fixes","fixed","fixing","falla","fallo","error","broken","regression","no se"]))return"bug";let e=A(t,["implement","implementa","refactor","restructure","cleanup","crear","agrega","construir","build"]);return A(t,["research","investiga","investigate","analiza","analyze","analysis","an\xE1lisis","compare","compara","survey","explore","explora","revisa","revisar","review","reviewing","repasa","repasar"])&&!e?"research":A(t,["refactor","cleanup","restructure"])||/(?:^|[^a-z0-9_-])split(?:[^a-z0-9_-]|$)/.test(t)?"refactor":A(t,["doc","docs","document","readme","changelog","typo"])?"docs":A(t,["chore","format","lint","linting","linter"])?"chore":A(t,["add","agrega","crear","implement","implementa","feature","mejora"])?"feature":"unknown"}a(Yt,"detectKind");function Zt(t,e,n){return t==="docs"||t==="chore"?"H0":t==="security"?"H3":t==="research"?"H1":n&&A(e,["migration","sqlite","database","architecture","arquitectura"])?"H3":t==="feature"||t==="refactor"?"H2":"H1"}a(Zt,"detectLevel");function Qt(t,e){return t==="H3"||e?"high":t==="H2"||t==="H1"?"medium":"low"}a(Qt,"detectRisk");function en(t,e,n){let r=new Set;return t==="bug"&&(r.add("regression-test"),r.add("focused-tests"),r.add("edge-cases")),(t==="feature"||t==="refactor")&&(r.add("focused-tests"),r.add("scope-check")),n&&r.add("docs-if-public-behavior"),(e==="H2"||e==="H3")&&r.add("spec-or-design"),e==="H3"&&r.add("config-preservation"),[...r]}a(en,"expectedEvidenceFor");function tn(t){return t==="H0"?[]:t==="H1"?["verify-before-done"]:t==="H2"?["verify-before-done","scope-check"]:["spec-before-implementation","verify-before-done","scope-check","review-before-ship"]}a(tn,"gatesFor");function nn(t,e,n){return t==="H0"?`Low-risk ${e}; keep the task direct and low-friction.`:`${t} ${e}/${n}; define expected evidence up front and verify before closure.`}a(nn,"rationaleFor");function rn(t){let e=t.toLowerCase().normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").split(/[^a-z0-9_.-]+/u).filter(n=>n.length>=3&&!Xt.has(n));return[...new Set(e)].slice(0,8)}a(rn,"extractScopeHints");function A(t,e){return e.some(n=>{if(n.includes(" "))return t.includes(n);let r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=n.length>=5?`\\b${r}`:`\\b${r}\\b`;return new RegExp(i).test(t)})}a(A,"hasAny");function sn(t){let e=new Set;return t.some(on)&&e.add("tests-changed"),t.some(an)&&e.add("docs-changed"),[...e]}a(sn,"observedEvidenceFromFiles");function on(t){return/(^|\/)(__tests__|tests?|specs?)\//.test(t)||/\.(test|spec)\.[cm]?[tj]sx?$/.test(t)}a(on,"isTestFile");function an(t){return/(^|\/)(README|CHANGELOG|docs\/)/i.test(t)}a(an,"isDocsFile");function cn(t){return t.some(e=>e.startsWith("core/commands/")||e.startsWith("core/mcp/")||e.startsWith("templates/")||e==="README.md")}a(cn,"touchesPublicSurface");async function ln(t){let e=await K(["diff","--shortstat","HEAD"],{cwd:t});if(!e.ok){if(e.kind==="exit")return 0;J(e)}let n=Number.parseInt(e.stdout.match(/(\d+) insertions?/)?.[1]??"0",10),r=Number.parseInt(e.stdout.match(/(\d+) deletions?/)?.[1]??"0",10);return n+r}a(ln,"readDiffSize");var un=[/\btypo\b/i,/\bdocs?\b/i,/\breadme\b/i,/\bformat\b/i,/\bchangelog\b/i,/\brerun\b.*\btests?\b/i,/\bre-?run\b.*\btests?\b/i],fn=[/\badd\b/i,/\bimplement\b/i,/\bcreate\b/i,/\bbuild\b/i,/\bfeature\b/i,/\bbilling\b/i,/\bauth\b/i,/\bsecurity\b/i,/\bmigration\b/i,/\bretry\b/i,/\bfailure\b/i,/\brecovery\b/i,/\baudit\b/i,/\bworkflow\b/i,/\borchestrat/i];function dn(t){let e=t.trim(),n=un.some(i=>i.test(e)),r=fn.some(i=>i.test(e));return n&&!r?{kind:"trivial",station:"direct",requiresSpec:!1,requiresTestsFirst:!1,reason:"trivial-keyword"}:r?{kind:"substantive",station:"spec_required",requiresSpec:!0,requiresTestsFirst:!0,reason:"substantive-keyword"}:{kind:"trivial",station:"direct",requiresSpec:!1,requiresTestsFirst:!1,reason:"conservative-default"}}a(dn,"classifyTaskPipeline");function st(t,e){let n=dn(t);return n.kind==="substantive"&&e?{...n,station:"test_red",reason:"linked-spec"}:n}a(st,"decideTaskPipeline");function ot(t){switch(t.station){case"direct":return"Proceed directly; no spec is required for this trivial task.";case"spec_required":return"Create or link a reviewed spec before implementation; write tests before implementation from the spec acceptance criteria.";case"test_red":return"Write failing tests before implementation, covering the linked spec acceptance criteria and edge cases.";case"implementation":return"Implement the minimum code needed to make the existing tests pass.";case"verify":return"Run verification and keep the task blocked on red tests."}}a(ot,"formatTaskPipelineNextAction");var pn=["active","resume","in_progress","working"],at=120;function hr(t){let e=t.type==="decision"||t.type==="gotcha"||t.type==="fact"||t.type==="spec"?"SoT":t.type==="anti-pattern"||t.type==="pattern"||t.type==="learning"?"SUGGEST":"ctx",n=t.when?t.when.slice(0,10):"",r=t.author?` by ${t.author}`:"",i=[n,r].filter(Boolean).join(""),s=`[${e}\xB7${t.type}] ${t.title}${i?` (${i.trim()})`:""} \`${t.id}\``,o=t.decisionTrap??t.antiPattern??t.nextImplication??t.why??t.outcome??t.keyData??t.detail;if(!o)return e==="SoT"?`${s} \u2014 BINDING; supersede via prjct remember if wrong`:s;let l=o.length>at?`${o.slice(0,at-1)}\u2026`:o;if(e==="SoT")return`${s} \u2014 tip\u2192user \xB7 SoT: ${l}`;if(e==="SUGGEST"){let c=t.files&&t.files.length>0?` in \`${t.files.slice(0,2).join("`, `")}\``:"";return`${s} \u2014 tip\u2192user \xB7 suggest${c}: ${l}`}return`${s} \u2014 ${l}`}a(hr,"formatRelatedContextForAgent");function wr(t){return`[${t.label}] ${t.title} \u2014 \`${t.file}\` \`${t.id}\``}a(wr,"formatRiskForAgent");async function kr(t,e,n,r={}){let i=n.trim().toLowerCase();if(De.has(i))return{ok:!1,blocked:`'${i}' is a prjct command, not a work intent. Did you mean \`prjct ${i}\`? To start a work cycle, describe the task (e.g. \`prjct work "fix the ${i} flow"\`).`};let s=await ve(t,"task","before",{projectPath:e,skipRules:r.skipHooks});if(!s.success)return{ok:!1,blocked:s.gatesFailed.length>0?`Blocked: ${s.gatesFailed.join(", ")}`:`Hook failed: ${s.hooksFailed.join(", ")}`};let o=await ue.readConfig(e).catch(()=>null);try{let{ensureCodingAnticipationDefaults:h}=await import("./pack-manager-VN7F6R47.mjs"),p=await h(e);p.healed&&p.reason==="activated-code"?console.log("\u2139 Anticipation ON: activated pack `code` (conflictMode advisory) \u2014 traps surface before edit"):p.healed&&p.reason==="conflictMode-healed"&&console.log("\u2139 Anticipation ON: conflictMode \u2192 advisory for pack code")}catch{}{let{effectiveSddMode:h}=await import("./sdd-3WNZJ6FU.mjs"),{discussLockVerdict:p}=await import("./discuss-lock-CWXKBBYJ.mjs"),x=X(n),b=r.spec?await import("./spec-service-UZ53XL6X.mjs").then(({specService:y})=>y.get(e,r.spec)).then(y=>y?.status??null).catch(()=>null):null;if(r.spec&&b===null){let{specService:y}=await import("./spec-service-UZ53XL6X.mjs");if(await y.get(e,r.spec).then(M=>!M).catch(()=>!1))return{ok:!1,blocked:`Spec ${r.spec} not found.`}}let F=p({sddMode:h(o),harnessLevel:x.level,hasSpecId:!!r.spec,specStatus:b});if(F.blocked)return{ok:!1,blocked:F.message}}if(r.spec)try{let{effectiveSddMode:h}=await import("./sdd-3WNZJ6FU.mjs"),{effectiveTddMode:p}=await import("./tdd-P2PP4RR4.mjs"),{effectiveNyquistWorkMode:x,nyquistWorkVerdict:b}=await import("./nyquist-lite-A23B7G4B.mjs"),{specService:F}=await import("./spec-service-UZ53XL6X.mjs"),y=X(n),M=(await F.get(e,r.spec))?.content?.acceptance_criteria??[],S=b({harnessLevel:y.level,criteria:M,mode:x(h(o),p(o))});if(S.blocked)return{ok:!1,blocked:S.message??"Nyquist-lite blocked work start."};S.message&&console.log(S.message)}catch{}{let h=o?.deliveryGeometry?.mode??"off";try{let{existsSync:p}=await import("node:fs"),x=await import("node:path"),{computeWorkingTreeChangeset:b,geometryOf:F,tierOf:y,geometryBlockMessage:_,intentGeometryVerdict:M,NORMAL_MAX_LOC:S}=await import("./delivery-geometry-GSJ6LXUC.mjs"),I=X(n),z=p(x.join(e,".git"))?await b(e):null,pt=o?.deliveryGeometry?.locThreshold??S,$e=!!(z&&z.loc>=pt);if(h==="strict"&&$e&&z&&!r.geometry){let gt=F(y(z));return{ok:!1,blocked:_(z,gt)}}let Q=M({harnessLevel:I.level,harnessRisk:I.risk,mode:h,explicitGeometry:r.geometry??null,treeLarge:$e});if(Q.blocked)return{ok:!1,blocked:Q.message??"Delivery geometry required at intent."};Q.message&&console.log(Q.message)}catch(p){if(p instanceof ee&&h==="strict")return{ok:!1,blocked:`Delivery geometry gate unevaluable: ${p.message}. Re-run when git is healthy, or pass \`--geometry\` explicitly.`}}}let l=/^[A-Z]+-\d+$/.test(n)?n:void 0,c=fe(),f=r.spec,d=X(n),g=await(async()=>{try{let h=await ue.readConfig(e).catch(()=>null),[{effectiveSddMode:p},{effectiveTddMode:x}]=await Promise.all([import("./sdd-3WNZJ6FU.mjs"),import("./tdd-P2PP4RR4.mjs")]),{effectiveWeakModelMode:b}=await import("./weak-model-mode-LOAPFJPQ.mjs");return me(d,p(h),x(h),b(h),`${n}::${c}`)}catch{return me(d,"off","off","off",`${n}::${c}`)}})(),{resolveCallerIdentity:k}=await import("./agent-identity-4KFRR5OU.mjs"),T=k(n),G=await(async()=>{let h=o?.multiAgent?.autoWorktree??"auto";try{let{getOccupancy:p,shouldIsolate:x,worktreeSlugFromIntent:b}=await import("./workspace-occupancy-JUXKZBUZ.mjs"),F=await p(t,e,T),y=x(F,h,n);if(y.block)return{blocked:y.reason};if(y.isolate&&F.isMain){let{worktreeService:_}=await import("./worktree-service-YRRPFU57.mjs"),M=b(n),S=await _.create(e,M);await _.setup(S.path,await _.getMainWorktree(e));let I=y.occupant;return{effectivePath:S.path,isolation:{reason:y.reason,worktreePath:S.path,branch:S.branch,slug:S.slug,occupantSummary:I?`${[I.ownerAgent,I.ownerIdentity].filter(Boolean).join("/")||"other"} \xB7 ${I.taskId.slice(0,8)} \xB7 "${I.description.slice(0,60)}"`:"foreign cycle"}}}}catch(p){if(p instanceof Error&&p.message.includes("already active"))return{blocked:p.message}}return{effectivePath:e,isolation:void 0}})();if("blocked"in G)return{ok:!1,blocked:G.blocked};let{effectivePath:B,isolation:q}=G,C=await j(B);if(C.gitError)return{ok:!1,blocked:`git ${C.gitError}: workspace identity unknown \u2014 refusing to start work on the main fallback. Re-run when git is healthy.`};let Y=C.isMain?Be:C.workspaceId,Z={id:c,description:n,sessionId:fe(),linearId:l,linkedSpecId:f,harness:d,ownerAgent:T.agent,ownerIdentity:T.identity,ownerSessionId:T.sessionId,yieldStatus:"active"};C.isMain?await w.startTask(t,Z):await w.startTaskInWorkspace(t,{...Z,branch:C.branch??q?.branch,workspaceId:C.workspaceId,worktreePath:C.worktreePath},C.workspaceId);try{let{ensureJudgmentLedger:h,intensityFromQuality:p}=await import("./judgment-orchestrator-E3SO3NVE.mjs");g.quality!=="none"&&await h({projectId:t,projectPath:e,signals:{harnessLevel:d.level,harnessKind:d.kind},forceIntensity:p(g.quality)})}catch{}try{let{prjctDb:h}=await import("./database-UU2ZXSD4.mjs");h.run(t,"UPDATE tasks SET expected_value = ? WHERE id = ?",String(g.expectedPoints),c);let{workGraph:p}=await import("./work-graph-WHMCFN6U.mjs");p.recordComplexity(t,c,{score:g.expectedPoints,recommendedSubtasks:g.expectedPoints>=5?Math.min(g.expectedPoints,6):0,reasoning:`Triage: ${d.level} \xB7 ${g.model}/${g.effort} \xB7 fan-out ${g.fanout}`})}catch{}let u=st(n,f),m=Ve(t,{taskId:c,workspaceId:Y,classification:u.kind,station:u.station,requiresSpec:u.requiresSpec,requiresTestsFirst:u.requiresTestsFirst,reason:u.reason,linkedSpecId:f??null});if(f)try{let{specService:h}=await import("./spec-service-UZ53XL6X.mjs");await h.linkTask(e,f,c)}catch{}let v=await qe.ensureAuthor();await O.log(e,"task_started",{task:n,taskId:c,harness:d,timestamp:ne()},v.name),await ve(t,"task","after",{projectPath:e,skipRules:r.skipHooks});let R=q?.branch??await re(B).catch(()=>""),U=await hn(e,t,n),be=await mn(e,t,n),ft=gn(t,be),dt=await(async()=>{try{let{buildCycleBudgetCard:h}=await import("./cycle-budget-card-H37XRAIX.mjs"),{contextPressureVerdict:p}=await import("./context-pressure-5URQVNBC.mjs"),x=p(o,{turnCount:0,tokensIn:0,tokensOut:0}),b=h({turns:0,turnLimit:o?.maxTurnsPerCycle??x.limit,tokensSpent:0,tokenBudget:o?.maxTokensPerCycle??null,pressureLevel:x.level});return console.log(b.line),b.line}catch{return null}})();return{ok:!0,taskId:c,description:n,branch:R,linearId:l,linkedSpecId:f,harness:d,orchestration:g,ownerAgent:T.agent,ownerIdentity:T.identity,isolation:q,pipeline:{classification:m.classification,station:m.station,nextAction:ot(u),requiresSpec:m.requiresSpec,requiresTestsFirst:m.requiresTestsFirst},instructions:s.instructions,relatedContext:U,likelyFiles:be,risks:ft,cycleBudget:dt}}a(kr,"startTask");function gn(t,e){let n=new Set,r=[];try{for(let i of e.slice(0,5)){let s=Le.recallForFile(t,i.path,2,{preventiveOnly:!0});for(let o of s)if(!n.has(o.id)&&(n.add(o.id),r.push({id:o.id,label:Fe(o),title:We(o),file:i.path}),r.length>=4))return r}}catch{}return r}a(gn,"recallRisksForFiles");async function mn(t,e,n){try{let{resolveWorkScope:r,toLikelyFileHits:i}=await import("./work-scope-XXPUH6TU.mjs"),s=await r(t,e,n,8);return s.files.length>0?i(s.files):ge(e,n)}catch{try{return ge(e,n)}catch{return[]}}}a(mn,"recallLikelyFiles");async function hn(t,e,n){try{let{enrichedRecall:r}=await import("./enriched-recall-MKBOXB7M.mjs"),{deriveTitle:i}=await import("./format-SYVL4CV5.mjs"),s=await r(t,e,{topic:n,types:["decision","gotcha","fact","spec","anti-pattern","pattern","learning","context"],limit:8});if(s.length===0)return[];let{recordSurfacedForActiveTask:o}=await import("./surface-attribution-CQVM2SWY.mjs");return await o(e,t,s.map(l=>l.id)),s.map(l=>{let c=Me(l.content),f=c.relatedFiles??l.tags?.related_files?.split(",").filter(Boolean)??l.tags?.files?.split(",").filter(Boolean);return{id:l.id,type:l.type,title:i(l),detail:c.contextSynthesis??Ie(l.content,180),when:l.rememberedAt,author:c.whoAuthor??l.tags?.author,keyData:c.keyData??l.tags?.key_data,feature:c.featureDomain??l.tags?.feature,files:f,why:c.whyItMattered,pattern:c.pattern,antiPattern:c.antiPattern,decisionTrap:c.decisionTrap,outcome:c.outcome,nextImplication:c.nextImplication}})}catch{return[]}}a(hn,"recallRelatedContext");var ct=_e();async function vr(t,e,n){let r=n.toLowerCase(),i=pn.includes(r),s=await j(e);if(s.gitError)return{ok:!1,reason:"unsupported",message:`git ${s.gitError}: workspace identity unknown \u2014 refusing to change task status on the main fallback. Re-run when git is healthy.`};if(!s.isMain){let f=await w.getCurrentTaskForWorkspace(t,s.workspaceId);if(!f)return{ok:!1,reason:"no-active-task"};if(r==="done"||r==="completed"){let d=await ut(t,f.id),g=await ye(e,f);await O.log(e,L,{taskId:f.id,from:d??null,to:n,workspaceId:s.workspaceId,harnessWarnings:g.warnings}),await w.completeTaskInWorkspace(t,s.workspaceId),await lt(t,f.id,g.diffSize);try{let{usefulnessService:k}=await import("./usefulness-A3GRKFL3.mjs");k.creditShippedTask(t,f.id)}catch{}try{let{applyRetentionIncremental:k}=await import("./retention-QSXWKE4H.mjs");k(t)}catch{}return{ok:!0,taskId:f.id,status:n,verificationWarnings:g.warnings,contextPrompt:ct}}return{ok:!1,reason:"unsupported",message:`'${n}' isn't supported for a worktree task yet \u2014 only 'done'. (pause/resume per-worktree is a planned follow-up)`}}if(i&&!await w.getCurrentTask(t)){let d=await w.resumeTask(t);if(d)return await O.log(e,L,{taskId:d.id,from:"paused",to:n}),{ok:!0,taskId:d.id,status:n}}let o=await w.getCurrentTask(t);if(!o)return{ok:!1,reason:"no-active-task"};let l=await ut(t,o.id),c=r==="done"||r==="completed"?await ye(e,o):{warnings:[],diffSize:0};await O.log(e,L,{taskId:o.id,from:l??null,to:n,harnessWarnings:c.warnings});try{if(r==="done"||r==="completed"){await w.completeTask(t),await lt(t,o.id,c.diffSize);try{let{usefulnessService:f}=await import("./usefulness-A3GRKFL3.mjs");f.creditShippedTask(t,o.id)}catch{}try{let{applyRetentionIncremental:f}=await import("./retention-QSXWKE4H.mjs");f(t)}catch{}}else r==="paused"||r==="pause"?await w.pauseTask(t):i&&(await w.getCurrentTask(t)||await w.resumeTask(t))}catch{}return{ok:!0,taskId:o.id,status:n,verificationWarnings:c.warnings,contextPrompt:r==="done"||r==="completed"?ct:void 0}}a(vr,"setTaskStatus");async function yr(t,e){let n=await j(e);return n.gitError?null:n.isMain?w.getCurrentTask(t):w.getCurrentTaskForWorkspace(t,n.workspaceId)}a(yr,"resolveActiveTask");async function lt(t,e,n){try{let{prjctDb:r}=await import("./database-UU2ZXSD4.mjs"),{pointsFromDiffLines:i}=await import("./task-orchestration-GS4J4KGS.mjs"),s=r.get(t,"SELECT expected_value FROM tasks WHERE id = ?",e),o=Number(s?.expected_value);if(!Number.isFinite(o)||o<=0)return;r.run(t,`UPDATE tasks SET data = json_set(COALESCE(data, '{}'),
|
|
63
|
+
'$.expectedPoints', ?, '$.actualPoints', ?, '$.diffLines', ?)
|
|
64
|
+
WHERE id = ?`,o,i(n),n,e)}catch{}}a(lt,"recordEstimationOutcome");async function br(t,e,n){let r=await j(e);return r.gitError?null:r.isMain?w.completeTask(t,n):w.completeTaskInWorkspace(t,r.workspaceId,n)}a(br,"completeActiveTask");async function ut(t,e){try{let{default:n}=await import("./database-UU2ZXSD4.mjs"),r=n.query(t,"SELECT data FROM events WHERE type = ? ORDER BY id DESC LIMIT 10",`memory.${L}`);for(let i of r)try{let s=JSON.parse(i.data);if(s.taskId===e&&s.to)return s.to}catch{}}catch{}return null}a(ut,"readLastStatus");export{ve as a,X as b,hr as c,wr as d,kr as e,gn as f,ct as g,vr as h,yr as i,br as j,ut as k};
|
|
@@ -0,0 +1,12 @@
|
|
|
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{b as h}from"./chunk-YEALP3WX.mjs";import{g as b,h as p,i as k,j as $,o as A}from"./chunk-QZ7T2EYR.mjs";import{a}from"./chunk-3TRXQAU4.mjs";var _=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default)$/i;function j(t){let i=p(t);if(!b(t))return{ready:!1,builtAt:i?.builtAt??null,symbols:0,edges:0,files:0,languages:[],kinds:[],routes:[],hotspots:[],entryCandidates:[],packages:[],note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let c=k(t),u=new Map,r=new Map,d=new Map,g=[],o=[];for(let e of c){u.set(e.kind,(u.get(e.kind)??0)+1),r.set(e.file,(r.get(e.file)??0)+1);let n=e.file.includes(".")?e.file.slice(e.file.lastIndexOf(".")):"(none)";d.set(n,(d.get(n)??0)+1),e.kind==="route"&&g.push({name:e.name,file:e.file,line:e.startLine}),e.exported&&_.test(e.name)&&(e.kind==="function"||e.kind==="class")&&!/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(e.file)&&o.push({name:e.name,file:e.file,kind:e.kind})}let l=[...r.keys()],f=[],x=A(t),S=l.length>400?l.slice(0,400):l;for(let e of S){let n=x.get(e)??0;n>0&&f.push({file:e,fanIn:n,symbolCount:r.get(e)??0})}f.sort((e,n)=>n.fanIn-e.fanIn);let m=new Set,y=h(t);if(y)for(let e of Object.keys(y.forward).slice(0,2e3)){let n=e.includes("/")?e.slice(0,e.indexOf("/")):e;n&&!n.startsWith(".")&&m.add(n)}for(let e of l.slice(0,2e3)){let n=e.includes("/")?e.slice(0,e.indexOf("/")):".";n&&n!=="."&&m.add(n)}if(o.length<8)for(let e of c){if(o.length>=12)break;e.exported&&e.kind==="class"&&!o.some(n=>n.file===e.file)&&o.push({name:e.name,file:e.file,kind:e.kind})}return{ready:!0,builtAt:i?.builtAt??null,symbols:i?.symbolCount??c.length,edges:i?.edgeCount??0,files:i?.fileCount??r.size,languages:[...d.entries()].map(([e,n])=>({ext:e,count:n})).sort((e,n)=>n.count-e.count).slice(0,12),kinds:[...u.entries()].map(([e,n])=>({kind:e,count:n})).sort((e,n)=>n.count-e.count),routes:g.slice(0,30),hotspots:f.slice(0,15),entryCandidates:o.slice(0,15),packages:[...m].sort().slice(0,40),note:"Structural only (symbol + import graphs). Narrative architecture lives in prjct analysis / memory decisions."}}a(j,"buildArchitectureSnapshot");function I(t){return t.ready?["## Architecture (structural)","",`- **Symbols**: ${t.symbols} \xB7 **Edges**: ${t.edges} \xB7 **Files**: ${t.files}`,t.builtAt?`- **Index built**: ${t.builtAt}`:"","","### Languages (by symbol files)",...t.languages.map(s=>`- \`${s.ext}\`: ${s.count}`),"","### Symbol kinds",...t.kinds.map(s=>`- **${s.kind}**: ${s.count}`),"","### Top-level packages / dirs",t.packages.length?t.packages.map(s=>`\`${s}\``).join(", "):"_none detected_","","### Hotspots (call fan-in)",...t.hotspots.length?t.hotspots.map(s=>`- \`${s.file}\` \u2014 fan-in **${s.fanIn}** \xB7 ${s.symbolCount} symbol(s)`):["_no call edges yet_"],"","### Entry candidates",...t.entryCandidates.length?t.entryCandidates.map(s=>`- **${s.name}** (${s.kind}) \u2014 \`${s.file}\``):["_none_"],"","### Routes",...t.routes.length?t.routes.map(s=>`- \`${s.name}\` \u2014 \`${s.file}:${s.line}\``):["_no HTTP route nodes detected_"],"",`_${t.note}_`].filter(s=>s!=="").join(`
|
|
8
|
+
`):`## Architecture
|
|
9
|
+
|
|
10
|
+
> ${t.note}
|
|
11
|
+
`}a(I,"formatArchitectureMd");function v(t){return t.ready?[`Architecture: ${t.symbols} symbols \xB7 ${t.edges} edges \xB7 ${t.files} files`,`Kinds: ${t.kinds.map(i=>`${i.kind}=${i.count}`).join(" ")}`,`Hotspots: ${t.hotspots.slice(0,5).map(i=>`${i.file}(${i.fanIn})`).join(", ")||"\u2014"}`,`Packages: ${t.packages.slice(0,12).join(", ")}`,"Detail: prjct code architecture --md"].join(`
|
|
12
|
+
`):`architecture: ${t.note}`}a(v,"formatArchitectureText");export{j as a,I as b,v as c};
|