prjct-cli 3.97.0 → 3.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/bin/core-chunks/{agent-HCP5FF77.mjs → agent-3N2MSSGT.mjs} +1 -1
- package/dist/bin/core-chunks/{agent-switch-AVSX6SLY.mjs → agent-switch-4SE6GF7R.mjs} +1 -1
- package/dist/bin/core-chunks/{agents-OAQXBGH3.mjs → agents-ZPNNCOH7.mjs} +1 -1
- package/dist/bin/core-chunks/{analysis-3A7ODSSI.mjs → analysis-OARMM4AH.mjs} +2 -2
- package/dist/bin/core-chunks/{auto-flush-EWSVMKQN.mjs → auto-flush-XA3V7BJ6.mjs} +1 -1
- package/dist/bin/core-chunks/{bin-commands-LLHG2NSY.mjs → bin-commands-FYID6EYI.mjs} +5 -5
- package/dist/bin/core-chunks/{capture-7LQ52T6L.mjs → capture-3JJPWIF3.mjs} +1 -1
- package/dist/bin/core-chunks/{capture-gate-M4HM7WAI.mjs → capture-gate-G5LGVDME.mjs} +1 -1
- package/dist/bin/core-chunks/{ceremonies-4OZ3FKRE.mjs → ceremonies-B565WDCA.mjs} +4 -4
- package/dist/bin/core-chunks/{changelog-CUNVCEL5.mjs → changelog-LPJ4GKB6.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-DN46DLU3.mjs → chunk-2FRLIQKX.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-X4FR5S7E.mjs → chunk-2VRS5CUH.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-ZK7BMUMR.mjs → chunk-2VXPFULA.mjs} +1 -1
- package/dist/bin/core-chunks/chunk-3OWKIRK6.mjs +7 -0
- package/dist/bin/core-chunks/{chunk-V5VCXMKO.mjs → chunk-5DZ2LTII.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-5ONMON5L.mjs → chunk-5OWPZWEU.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-KWC2PCPC.mjs → chunk-5TGZSK4C.mjs} +1 -1
- package/dist/bin/core-chunks/chunk-5ZBACKED.mjs +14 -0
- package/dist/bin/core-chunks/{chunk-X35YYOFE.mjs → chunk-6KNMT46X.mjs} +2 -2
- package/dist/bin/core-chunks/{chunk-5MN22JFI.mjs → chunk-6POAOY5C.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-7CI4AMVO.mjs → chunk-6U3CYLY5.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-J7T5IEFJ.mjs → chunk-6U3MV7KZ.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-2ZPM4Z6W.mjs → chunk-7BU6SJBC.mjs} +4 -4
- package/dist/bin/core-chunks/{chunk-ZKJZDOPT.mjs → chunk-ACIOJQSI.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-UE3XKXWM.mjs → chunk-ALTQ3KL4.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-IVGWOY3U.mjs → chunk-ANBDOI53.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-LZC6NGB6.mjs → chunk-B2HY22OD.mjs} +2 -2
- package/dist/bin/core-chunks/{chunk-6AFXUX2M.mjs → chunk-BUD3R6LF.mjs} +2 -2
- package/dist/bin/core-chunks/{chunk-MDONTD7O.mjs → chunk-CA2VFWFP.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-56FW4P6U.mjs → chunk-CB3CNJTL.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-6FFOWWH2.mjs → chunk-CVKMV22J.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-5UUITMRX.mjs → chunk-CXKDKMYE.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-XSZG3CBO.mjs → chunk-DTMZBK4E.mjs} +1 -1
- package/dist/bin/core-chunks/chunk-DW4QMD6J.mjs +10 -0
- package/dist/bin/core-chunks/{chunk-CDLZLTRY.mjs → chunk-DZDEBDAB.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-WGDE3L33.mjs → chunk-FOUBHU4X.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-CNWEQUB7.mjs → chunk-HA7Y76GF.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-MTDCRYLP.mjs → chunk-HVXWQ2XZ.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-OYXQRBVM.mjs → chunk-IJNKHQIS.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-KIRU4QFX.mjs → chunk-J6Y7IVFQ.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-3FXNIJCS.mjs → chunk-JGGQSMZC.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-6P4GMVUZ.mjs → chunk-KI4OY3UQ.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-BTCCUMKI.mjs → chunk-L3DJN3XD.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-CEOTHJIY.mjs → chunk-LFOQ7FCR.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-XU3BQPBU.mjs → chunk-LGX2GM45.mjs} +1 -1
- package/dist/bin/core-chunks/chunk-LTKUTRRL.mjs +7 -0
- package/dist/bin/core-chunks/{chunk-BQKDJ3U6.mjs → chunk-LZILSE5H.mjs} +1 -1
- package/dist/bin/core-chunks/chunk-MPU3VM6Z.mjs +7 -0
- package/dist/bin/core-chunks/{chunk-INM5COWM.mjs → chunk-MXJF3FA7.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-VDXTMAMO.mjs → chunk-NNILF7R3.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-WZXUFSVT.mjs → chunk-O5VCBMEK.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-XYDLXF5A.mjs → chunk-OE27RFLJ.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-HEXSVBUP.mjs → chunk-OGM34Z6W.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-KKIJAEYU.mjs → chunk-OXKGN3HG.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-QLMZW4K7.mjs → chunk-PQTR6XVW.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-53ZPEZLU.mjs → chunk-Q7GJIU6D.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-IFLBZKKK.mjs → chunk-QWRPJARA.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-TGNZI4KF.mjs → chunk-STFUT7R7.mjs} +2 -2
- package/dist/bin/core-chunks/{chunk-IMQCXC3R.mjs → chunk-SUXIKMTS.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-WP5IU4W4.mjs → chunk-TOORPP6K.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-7QMBIMEX.mjs → chunk-UAYTDSYG.mjs} +3 -3
- package/dist/bin/core-chunks/{chunk-PPERWRFS.mjs → chunk-UNIBFM6J.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-5YSPND5J.mjs → chunk-UX2ORID4.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-3JD6KRNJ.mjs → chunk-VJCTTFKP.mjs} +1 -1
- package/dist/bin/core-chunks/chunk-W23JLJJZ.mjs +109 -0
- package/dist/bin/core-chunks/{chunk-DCVPNFS4.mjs → chunk-WCTVZQBG.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-GOIBJ7PV.mjs → chunk-WZ6W5ZQ5.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-XPRLQIVQ.mjs → chunk-X433BB6F.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-ZHTYSYZC.mjs → chunk-XBR63NJA.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-ZS7XJUPE.mjs → chunk-XJTEPHLC.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-K25HGTC3.mjs → chunk-XLAGA5B7.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-3USVY66O.mjs → chunk-XSZOHNL4.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-TTN2CFZC.mjs → chunk-XWLTEAGN.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-V3Y3G2DE.mjs → chunk-YOWW4LHK.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-P53YMOKR.mjs → chunk-YPLFWN62.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-ZQHSJ6FF.mjs → chunk-ZAUJWUUN.mjs} +3 -3
- package/dist/bin/core-chunks/{chunk-WSVMQYYU.mjs → chunk-ZQ2XH76U.mjs} +2 -2
- package/dist/bin/core-chunks/{chunk-RXXXA7Z6.mjs → chunk-ZSANMA7K.mjs} +1 -1
- package/dist/bin/core-chunks/{chunk-AJTBFIH2.mjs → chunk-ZZR3LXCK.mjs} +1 -1
- package/dist/bin/core-chunks/{cleanup-installs-WHXUGAHM.mjs → cleanup-installs-LD43GI4K.mjs} +1 -1
- package/dist/bin/core-chunks/{cloud-FFUJZLDV.mjs → cloud-RXHFZ7MX.mjs} +1 -1
- package/dist/bin/core-chunks/{code-SU7GCPH6.mjs → code-IYK65A62.mjs} +1 -1
- package/dist/bin/core-chunks/{codex-hooks-GOLMCL2Q.mjs → codex-hooks-N5UHKK5B.mjs} +1 -1
- package/dist/bin/core-chunks/{codex-mcp-K4X2UIQF.mjs → codex-mcp-G7WNAT6T.mjs} +1 -1
- package/dist/bin/core-chunks/{codex-skill-3HNVU4T4.mjs → codex-skill-IZNP76BJ.mjs} +1 -1
- package/dist/bin/core-chunks/{command-installer-XIQK2G6W.mjs → command-installer-4ENM4GZR.mjs} +1 -1
- package/dist/bin/core-chunks/{config-W3RHV3GK.mjs → config-UVF7YOR6.mjs} +1 -1
- package/dist/bin/core-chunks/{config-manager-QVFHXIKI.mjs → config-manager-QY73WM5U.mjs} +1 -1
- package/dist/bin/core-chunks/{context-4KGTUAC4.mjs → context-4GB6ICXK.mjs} +1 -1
- package/dist/bin/core-chunks/{context-DDHC7VIC.mjs → context-MPHOQPXF.mjs} +2 -2
- package/dist/bin/core-chunks/{context-checkpoint-4CEUPEVG.mjs → context-checkpoint-NBI5HKPV.mjs} +1 -1
- package/dist/bin/core-chunks/{context-tiers-4S6H22NP.mjs → context-tiers-NOKJ75QP.mjs} +1 -1
- package/dist/bin/core-chunks/{context7-service-AZWDYK5Z.mjs → context7-service-2MYRUNKY.mjs} +1 -1
- package/dist/bin/core-chunks/{core-PR5WEQCS.mjs → core-WMEHDCOK.mjs} +1 -1
- package/dist/bin/core-chunks/{crew-JQCG6NS3.mjs → crew-EYVSIX4L.mjs} +1 -1
- package/dist/bin/core-chunks/{cwd-changed-ODKZVSPB.mjs → cwd-changed-EUJZOBIC.mjs} +1 -1
- package/dist/bin/core-chunks/{daemon-2NQTBFVR.mjs → daemon-QARP3RVX.mjs} +1 -1
- package/dist/bin/core-chunks/{developer-profile-MRPBWL2K.mjs → developer-profile-2VSFJGCU.mjs} +1 -1
- package/dist/bin/core-chunks/{distill-MLDZG5RA.mjs → distill-ZF7WHGCZ.mjs} +1 -1
- package/dist/bin/core-chunks/doctor-heal-XFSVPSEY.mjs +7 -0
- package/dist/bin/core-chunks/{doctor-service-WXLB2FEE.mjs → doctor-service-6ZJBWIXR.mjs} +1 -1
- package/dist/bin/core-chunks/{dynasty-outcomes-H2O546OL.mjs → dynasty-outcomes-KDWIEA4Y.mjs} +1 -1
- package/dist/bin/core-chunks/{embeddings-7A5Z5I67.mjs → embeddings-354ZYFKX.mjs} +1 -1
- package/dist/bin/core-chunks/{enriched-recall-YXK7EIKH.mjs → enriched-recall-MKBOXB7M.mjs} +1 -1
- package/dist/bin/core-chunks/{eval-4YFUBFLV.mjs → eval-O4YD6YOV.mjs} +2 -2
- package/dist/bin/core-chunks/{format-5V6GF6JJ.mjs → format-SYVL4CV5.mjs} +1 -1
- package/dist/bin/core-chunks/{gemini-settings-ZTU3VQU3.mjs → gemini-settings-RGD7JLSP.mjs} +1 -1
- package/dist/bin/core-chunks/{grok-mcp-F3SRFMCW.mjs → grok-mcp-IE2RRRRW.mjs} +1 -1
- package/dist/bin/core-chunks/{grok-plugin-4CE2WUYI.mjs → grok-plugin-SSANHBS7.mjs} +1 -1
- package/dist/bin/core-chunks/{grok-skill-GLSBOOKW.mjs → grok-skill-7ZP7R7KO.mjs} +1 -1
- package/dist/bin/core-chunks/{guard-FJBJ6IAE.mjs → guard-RT7U3LJX.mjs} +1 -1
- package/dist/bin/core-chunks/{guards-LFUFKVVH.mjs → guards-AXH6V2IJ.mjs} +1 -1
- package/dist/bin/core-chunks/{harness-FN3HASSA.mjs → harness-V7J7WIT2.mjs} +2 -2
- package/dist/bin/core-chunks/{health-W2VWME7Z.mjs → health-TNB5OC37.mjs} +1 -1
- package/dist/bin/core-chunks/{help-I37I3V2R.mjs → help-P7EYELVK.mjs} +1 -1
- package/dist/bin/core-chunks/{hooks-service-C2P5DRCH.mjs → hooks-service-REI56DDC.mjs} +1 -1
- package/dist/bin/core-chunks/{install-XP4S6HWQ.mjs → install-FZQJJWT5.mjs} +2 -2
- package/dist/bin/core-chunks/{judgment-GJE332LF.mjs → judgment-G5KH6QFC.mjs} +2 -2
- package/dist/bin/core-chunks/{judgment-receipt-WT4EMCAV.mjs → judgment-receipt-GO6QEZQC.mjs} +1 -1
- package/dist/bin/core-chunks/{kimi-hooks-2UEUIKXV.mjs → kimi-hooks-TR6J3OVG.mjs} +1 -1
- package/dist/bin/core-chunks/{kimi-mcp-DJCXZ2JY.mjs → kimi-mcp-ETG7O6O5.mjs} +1 -1
- package/dist/bin/core-chunks/{land-cue-5USQ64MS.mjs → land-cue-3BUD3KJJ.mjs} +1 -1
- package/dist/bin/core-chunks/{land-rho-ISNVEPVC.mjs → land-rho-MCTQDPRH.mjs} +1 -1
- package/dist/bin/core-chunks/{land-synthesis-CHARJMUP.mjs → land-synthesis-MU4EZEYL.mjs} +1 -1
- package/dist/bin/core-chunks/{lean-L53CKZNH.mjs → lean-26BWCUOR.mjs} +1 -1
- package/dist/bin/core-chunks/{legacy-crew-sweep-2TLKJTHI.mjs → legacy-crew-sweep-G5UJT2PM.mjs} +2 -2
- package/dist/bin/core-chunks/{llm-XMH7WTHV.mjs → llm-KMVXVBHG.mjs} +1 -1
- package/dist/bin/core-chunks/{mcp-FLVIZBV2.mjs → mcp-BD5TOTCK.mjs} +1 -1
- package/dist/bin/core-chunks/{memory-dream-EJWI4FJO.mjs → memory-dream-6GFV2GXN.mjs} +1 -1
- package/dist/bin/core-chunks/{memory-export-27HTNNFI.mjs → memory-export-WJ4H7CFV.mjs} +1 -1
- package/dist/bin/core-chunks/{memory-index-BRZDZ2BY.mjs → memory-index-7NIU34EI.mjs} +1 -1
- package/dist/bin/core-chunks/{notification-KJ4FQJAW.mjs → notification-G654IX3O.mjs} +1 -1
- package/dist/bin/core-chunks/{notify-76B7AICZ.mjs → notify-EWYUBKGO.mjs} +1 -1
- package/dist/bin/core-chunks/{opencode-mcp-5YSIYDI3.mjs → opencode-mcp-L7NC77JF.mjs} +1 -1
- package/dist/bin/core-chunks/{pack-integrity-GXN67LJB.mjs → pack-integrity-X277OVRB.mjs} +1 -1
- package/dist/bin/core-chunks/{pack-manager-46SPIPPD.mjs → pack-manager-VN7F6R47.mjs} +1 -1
- package/dist/bin/core-chunks/package-R4FUTGOE.mjs +7 -0
- package/dist/bin/core-chunks/{pi-skill-SDHTUK3V.mjs → pi-skill-IZQEUILZ.mjs} +1 -1
- package/dist/bin/core-chunks/{planning-S3MYVWH6.mjs → planning-NOWLKZDS.mjs} +2 -2
- package/dist/bin/core-chunks/{post-edit-5YSNEMK7.mjs → post-edit-GTBY32JU.mjs} +1 -1
- package/dist/bin/core-chunks/{pre-bash-GLDILCRF.mjs → pre-bash-32ZOGNSP.mjs} +1 -1
- package/dist/bin/core-chunks/{pre-commit-U6HPPNIC.mjs → pre-commit-7TU2A7H4.mjs} +1 -1
- package/dist/bin/core-chunks/{pre-edit-PEYQA6P6.mjs → pre-edit-ASEWA5TS.mjs} +1 -1
- package/dist/bin/core-chunks/{pre-package-76JR5GLO.mjs → pre-package-ZTZACEBB.mjs} +1 -1
- package/dist/bin/core-chunks/{pre-search-5EHNUOP3.mjs → pre-search-MKDRFJSE.mjs} +1 -1
- package/dist/bin/core-chunks/{preferences-BTSYWYUM.mjs → preferences-KO5U2ELK.mjs} +1 -1
- package/dist/bin/core-chunks/{primitives-IXAYLX7U.mjs → primitives-GNUMBYOK.mjs} +1 -1
- package/dist/bin/core-chunks/{prjct-md-SUDFWDCS.mjs → prjct-md-BSFV7OQQ.mjs} +1 -1
- package/dist/bin/core-chunks/{product-KKGJ6MMF.mjs → product-GUHSUNIH.mjs} +1 -1
- package/dist/bin/core-chunks/{project-agent-surfaces-I2CUZUIN.mjs → project-agent-surfaces-BXCJJXB7.mjs} +1 -1
- package/dist/bin/core-chunks/{project-memory-GYLYIJQD.mjs → project-memory-L5MDZYST.mjs} +1 -1
- package/dist/bin/core-chunks/{project-style-evolution-5W25UPPN.mjs → project-style-evolution-HIMSJQQB.mjs} +1 -1
- package/dist/bin/core-chunks/prompt-47YP5JIR.mjs +25 -0
- package/dist/bin/core-chunks/{purge-5EPJV25P.mjs → purge-6SJKHKIY.mjs} +1 -1
- package/dist/bin/core-chunks/{registry-LK6IQ5UX.mjs → registry-YM2EYUXY.mjs} +1 -1
- package/dist/bin/core-chunks/{retention-S22T3SPT.mjs → retention-QSXWKE4H.mjs} +1 -1
- package/dist/bin/core-chunks/{retro-CLKOHAN6.mjs → retro-B2EBN4TA.mjs} +1 -1
- package/dist/bin/core-chunks/{review-risk-LLLBKUXT.mjs → review-risk-LBPY5M3K.mjs} +1 -1
- package/dist/bin/core-chunks/{safe-artifacts-RW5WQUUJ.mjs → safe-artifacts-PE2TMEZQ.mjs} +1 -1
- package/dist/bin/core-chunks/{sdd-HE7O6N5S.mjs → sdd-3WNZJ6FU.mjs} +1 -1
- package/dist/bin/core-chunks/{seed-JX7W53E5.mjs → seed-MMDJE2UO.mjs} +2 -2
- package/dist/bin/core-chunks/{self-heal-DFUEKNF3.mjs → self-heal-R5FBXEVQ.mjs} +1 -1
- package/dist/bin/core-chunks/{session-continuity-BFSW4OL6.mjs → session-continuity-OQDB5UYI.mjs} +1 -1
- package/dist/bin/core-chunks/{session-start-HVYUKJL2.mjs → session-start-FM6UL7MT.mjs} +1 -1
- package/dist/bin/core-chunks/{setup-GHS24ER5.mjs → setup-BL36ZWPW.mjs} +2 -2
- package/dist/bin/core-chunks/{setup-J4JFYT63.mjs → setup-V75BWRHU.mjs} +2 -2
- package/dist/bin/core-chunks/{shipping-I4D4AVTE.mjs → shipping-NZVM57JJ.mjs} +4 -4
- package/dist/bin/core-chunks/{signals-digest-V44KYN6Z.mjs → signals-digest-P5BG6MZF.mjs} +1 -1
- package/dist/bin/core-chunks/{skill-adherence-MHY4BZL4.mjs → skill-adherence-JE3N3Y67.mjs} +1 -1
- package/dist/bin/core-chunks/{spec-2XXPLHUZ.mjs → spec-VC3VTUI3.mjs} +3 -3
- package/dist/bin/core-chunks/{spec-context-inference-THFMXC7S.mjs → spec-context-inference-KOINWBC7.mjs} +1 -1
- package/dist/bin/core-chunks/{spec-service-I23KJKKP.mjs → spec-service-UZ53XL6X.mjs} +1 -1
- package/dist/bin/core-chunks/{spec-task-breakdown-HTG6ME6G.mjs → spec-task-breakdown-3Y7YXCIQ.mjs} +1 -1
- package/dist/bin/core-chunks/{stop-2H57XCGZ.mjs → stop-6SH36ULT.mjs} +3 -3
- package/dist/bin/core-chunks/{subagent-start-5LPASXOS.mjs → subagent-start-TVGBV2V2.mjs} +1 -1
- package/dist/bin/core-chunks/{subagent-stop-ANLSG3KN.mjs → subagent-stop-APWY6KMX.mjs} +1 -1
- package/dist/bin/core-chunks/{surface-attribution-WL7S53XX.mjs → surface-attribution-CQVM2SWY.mjs} +1 -1
- package/dist/bin/core-chunks/{task-service-FK7FC3PE.mjs → task-service-KFYL5NT4.mjs} +1 -1
- package/dist/bin/core-chunks/{tdd-NQDHU62B.mjs → tdd-P2PP4RR4.mjs} +1 -1
- package/dist/bin/core-chunks/{team-XZ4Q6UBV.mjs → team-WKAAOEFE.mjs} +1 -1
- package/dist/bin/core-chunks/{template-loader-33OVJ4G5.mjs → template-loader-H4FE37HV.mjs} +1 -1
- package/dist/bin/core-chunks/{uninstall-6NFON7FO.mjs → uninstall-W6EAUS7N.mjs} +1 -1
- package/dist/bin/core-chunks/{update-4IE6SA6M.mjs → update-PSHEJJI5.mjs} +2 -2
- package/dist/bin/core-chunks/{update-checker-FK7MWNWN.mjs → update-checker-LZCUPWQB.mjs} +1 -1
- package/dist/bin/core-chunks/{version-252QLBN2.mjs → version-B5DBRVGQ.mjs} +1 -1
- package/dist/bin/core-chunks/{watch-service-7ZERG7RC.mjs → watch-service-7V3O52TW.mjs} +1 -1
- package/dist/bin/core-chunks/weak-frontier-demo-ZCDTMYRO.mjs +7 -0
- package/dist/bin/core-chunks/{weak-model-mode-DH66XMD2.mjs → weak-model-mode-LOAPFJPQ.mjs} +1 -1
- package/dist/bin/core-chunks/{work-graph-JGJWE3AV.mjs → work-graph-ZNV7S6EU.mjs} +1 -1
- package/dist/bin/core-chunks/{work-scope-3LXOEIUX.mjs → work-scope-XXPUH6TU.mjs} +1 -1
- package/dist/bin/core-chunks/{workflow-FGJVLRQ3.mjs → workflow-XM77QYRF.mjs} +2 -2
- package/dist/bin/core-chunks/{workflows-reference-UWKRZ6BJ.mjs → workflows-reference-T7RH7IGJ.mjs} +1 -1
- package/dist/bin/core-chunks/{world-model-impact-RH5WH2B3.mjs → world-model-impact-FAGGNUGN.mjs} +1 -1
- package/dist/bin/hook-chunks/{agent-switch-7GOGG4KG.mjs → agent-switch-TAJWH2ZD.mjs} +1 -1
- package/dist/bin/hook-chunks/{analysis-UI2JRLJO.mjs → analysis-34WDLUXK.mjs} +2 -2
- package/dist/bin/hook-chunks/{auto-flush-JKIXTI2I.mjs → auto-flush-7TIEBPPQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{capture-gate-DIPHPNIC.mjs → capture-gate-JFVGG7RB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-XXVHUYL7.mjs → chunk-22CBVTZ3.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ZH2MF7H7.mjs → chunk-3JOZN7YJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-Y7RDBMNC.mjs → chunk-4X3KUIXK.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-6RS7PNAN.mjs → chunk-5ALQBNIZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-IL36ER4U.mjs → chunk-5VPZI2ZF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-FBEDUKMG.mjs → chunk-6EHYPQ5U.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-7H5UVM6X.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-IDPBMN3Q.mjs → chunk-A3R47SP6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-UI25YRTY.mjs → chunk-CGAKJDKT.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-6LU777GI.mjs → chunk-CJY4Y5SO.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-WIA6ORIY.mjs → chunk-FSFURDAE.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-6WDRJ7J7.mjs → chunk-FTBBQHI4.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-25OGCQTR.mjs → chunk-G4VJKPG7.mjs} +3 -3
- package/dist/bin/hook-chunks/{chunk-PFORBQBF.mjs → chunk-GAJOSSB4.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-KOLXYWOA.mjs → chunk-H3GIYI4Q.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-B7MHIUFA.mjs → chunk-HRU2KNEB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-JF6DFOQK.mjs → chunk-LCGWETJ6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-PQJ64L6U.mjs → chunk-MG2DNP4Z.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-NGB6JNSB.mjs +18 -0
- package/dist/bin/hook-chunks/{chunk-AEDB75AK.mjs → chunk-OALZUWC6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-IFIENAZU.mjs → chunk-PZMBZ6GE.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-F3PNT2DQ.mjs → chunk-QIB6Y6AH.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-ZXON2U5F.mjs → chunk-QMNZPNVY.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-B2ZA5ZAO.mjs → chunk-R4YDE3GU.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-UBWUQ64A.mjs → chunk-RFKRKUHB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NMB6YSAH.mjs → chunk-RGOTJCZU.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ANSRNEEI.mjs → chunk-T2KVL6PZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-HNZ24HIK.mjs → chunk-T7DRHVK3.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-IHEOOJJT.mjs → chunk-TWFLW6OJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ONGVBXBD.mjs → chunk-UJIOGFNP.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NSTXHVTH.mjs → chunk-UK24P7PV.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-63P5VOR6.mjs → chunk-ULNGKZB6.mjs} +4 -4
- package/dist/bin/hook-chunks/{chunk-UMJ5D5I6.mjs → chunk-UWHVPO6X.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-A6LRNS6R.mjs → chunk-XC2BSGWF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-7PA4KPSR.mjs → chunk-ZPAY2NSF.mjs} +2 -2
- package/dist/bin/hook-chunks/{codex-skill-UZZCACMB.mjs → codex-skill-BFRU5FTP.mjs} +1 -1
- package/dist/bin/hook-chunks/{command-installer-FJ73C2ZW.mjs → command-installer-3XOZGKOQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{config-manager-XDKOTIJM.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-STP3LH6Y.mjs → cwd-changed-USNJYUH7.mjs} +1 -1
- package/dist/bin/hook-chunks/{distill-63BHUJAC.mjs → distill-47YVL7IH.mjs} +1 -1
- package/dist/bin/hook-chunks/{enriched-recall-6F6LBYAB.mjs → enriched-recall-CVYI52NO.mjs} +1 -1
- package/dist/bin/hook-chunks/{format-VJ2YQ4XQ.mjs → format-DPIN45EG.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-receipt-LSJCAYBT.mjs → judgment-receipt-G2DKQR7U.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-cue-DEO2AZW4.mjs → land-cue-3JD2TXFP.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-synthesis-GTMFIGDM.mjs → land-synthesis-5C4KGCTB.mjs} +1 -1
- package/dist/bin/hook-chunks/{legacy-crew-sweep-QPKU7ITU.mjs → legacy-crew-sweep-XQNXNZES.mjs} +2 -2
- package/dist/bin/hook-chunks/{memory-index-KCMXQGKX.mjs → memory-index-LL6SQJ2N.mjs} +1 -1
- package/dist/bin/hook-chunks/{notification-DX6ZHOUC.mjs → notification-ACQBRJG3.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-integrity-UMLIB5RQ.mjs → pack-integrity-DCXVRRJZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-manager-YXRK2TJ4.mjs → pack-manager-KYWKNYUY.mjs} +1 -1
- package/dist/bin/hook-chunks/{planning-JR7O5MYW.mjs → planning-KOU3XKWS.mjs} +2 -2
- package/dist/bin/hook-chunks/{post-edit-IPTVSRVG.mjs → post-edit-CK2MYQEN.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-bash-5WWTH36N.mjs → pre-bash-W5A5CTR3.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-commit-KZ5TNTPW.mjs → pre-commit-5Q24RM4S.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-edit-XHPYBXRU.mjs → pre-edit-YIJ4BCYL.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-package-U3HDW3SX.mjs → pre-package-O4RMVA4T.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-search-R5CRK66E.mjs → pre-search-WYOWC3D6.mjs} +1 -1
- package/dist/bin/hook-chunks/{prjct-md-IBQTJBK7.mjs → prjct-md-2UVHFYTJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-agent-surfaces-TPZO73ZV.mjs → project-agent-surfaces-BKFYUMRV.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-memory-YQLZX5RG.mjs → project-memory-OC5GTJPY.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-style-evolution-NOFCIIZZ.mjs → project-style-evolution-2IFJCACQ.mjs} +1 -1
- package/dist/bin/hook-chunks/prompt-JIWMP563.mjs +26 -0
- package/dist/bin/hook-chunks/{purge-5W3K2MZL.mjs → purge-FQK3Z4QS.mjs} +1 -1
- package/dist/bin/hook-chunks/{retention-GWJ4AX7I.mjs → retention-2FETBJFG.mjs} +1 -1
- package/dist/bin/hook-chunks/{sdd-GWBRD4KI.mjs → sdd-V43TSJ2P.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-continuity-VH645RGR.mjs → session-continuity-RO2ACICF.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-start-4TYTI27B.mjs → session-start-FKKFMKQ5.mjs} +1 -1
- package/dist/bin/hook-chunks/{setup-VF4UHUBX.mjs → setup-YV2DKG5L.mjs} +2 -2
- package/dist/bin/hook-chunks/{shipping-2ULWBGRX.mjs → shipping-SCNFEXBY.mjs} +4 -4
- package/dist/bin/hook-chunks/{spec-context-inference-HVENYOIO.mjs → spec-context-inference-BD3ANTXA.mjs} +1 -1
- package/dist/bin/hook-chunks/{spec-service-4XGQQPGP.mjs → spec-service-OWYOAGXS.mjs} +2 -2
- package/dist/bin/hook-chunks/{spec-task-breakdown-JXF556UH.mjs → spec-task-breakdown-HOTLUFDM.mjs} +1 -1
- package/dist/bin/hook-chunks/{stop-NJDYIIXR.mjs → stop-MIXT7WXA.mjs} +3 -3
- package/dist/bin/hook-chunks/{subagent-start-2YMGD4SY.mjs → subagent-start-NO3TN65K.mjs} +1 -1
- package/dist/bin/hook-chunks/{subagent-stop-4TZJ2NSJ.mjs → subagent-stop-CKWIXX7W.mjs} +1 -1
- package/dist/bin/hook-chunks/{surface-attribution-UNK4J5W2.mjs → surface-attribution-BYESPLXM.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-service-SPUES5DO.mjs → task-service-5ONSBKKP.mjs} +1 -1
- package/dist/bin/hook-chunks/{tdd-MYF7I5FS.mjs → tdd-SESB4IG3.mjs} +1 -1
- package/dist/bin/hook-chunks/{template-loader-4SYVR2UB.mjs → template-loader-KO67FVHO.mjs} +1 -1
- package/dist/bin/hook-chunks/{weak-model-mode-TYJJT6JJ.mjs → weak-model-mode-HPXBKXJT.mjs} +1 -1
- package/dist/bin/hook-chunks/{work-scope-A6XPENFE.mjs → work-scope-RNPGACPA.mjs} +1 -1
- package/dist/bin/prjct-core.mjs +3 -3
- package/dist/bin/prjct-hooks.mjs +1 -1
- package/dist/daemon/entry.mjs +591 -583
- package/dist/mcp/server.mjs +318 -312
- package/package.json +2 -1
- package/dist/bin/core-chunks/chunk-GDLAQV3Q.mjs +0 -14
- package/dist/bin/core-chunks/chunk-R7LLMJDP.mjs +0 -7
- package/dist/bin/core-chunks/chunk-UT425KVX.mjs +0 -10
- package/dist/bin/core-chunks/chunk-VILH3VYH.mjs +0 -103
- package/dist/bin/core-chunks/chunk-Y5SEUYET.mjs +0 -7
- package/dist/bin/core-chunks/doctor-heal-ZUZ2RHGY.mjs +0 -7
- package/dist/bin/core-chunks/package-DCGCOAGQ.mjs +0 -7
- package/dist/bin/core-chunks/prompt-SW5XDRMX.mjs +0 -23
- package/dist/bin/core-chunks/weak-frontier-demo-5C4FR3OA.mjs +0 -7
- package/dist/bin/hook-chunks/chunk-IWUF2LGO.mjs +0 -18
- package/dist/bin/hook-chunks/chunk-ZYCNW75E.mjs +0 -9
- package/dist/bin/hook-chunks/prompt-DJWONMTZ.mjs +0 -24
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{c as 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-
|
|
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
8
|
|
|
9
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
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(`
|
|
@@ -25,4 +25,4 @@ No changes between runs.`;let t=[];t.push("## Analysis Diff"),(n.beforeCommit||n
|
|
|
25
25
|
COALESCE(SUM(total_duration), 0) AS duration,
|
|
26
26
|
COALESCE(SUM(avg_compression_rate * syncs), 0) AS weighted_rate
|
|
27
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-2TLKJTHI.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-5W25UPPN.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-S22T3SPT.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-5EPJV25P.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};
|
|
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};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as R}from"./chunk-L5LFLI4R.mjs";import{a}from"./chunk-5YLI5V3Q.mjs";import{b as h}from"./chunk-
|
|
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
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
9
|
FROM memory_entries me
|
|
10
10
|
JOIN memory_entry_tags t ON t.entry_id = me.id
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as o}from"./chunk-3TRXQAU4.mjs";var a={"session-start":{load:o(()=>import("./session-start-
|
|
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};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as ge}from"./chunk-
|
|
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
8
|
|
|
9
9
|
All notable changes to this project will be documented in this file.
|
|
10
10
|
|
|
@@ -46,7 +46,7 @@ ${e}`}formatKeepAChangelogEntry(e,n){let r=[`## [${e.version}] - ${n}`];return r
|
|
|
46
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
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
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-
|
|
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
50
|
|
|
51
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
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(`
|
|
@@ -59,6 +59,6 @@ ${P(m)}
|
|
|
59
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
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
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-46SPIPPD.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-HE7O6N5S.mjs"),{discussLockVerdict:p}=await import("./discuss-lock-CWXKBBYJ.mjs"),x=X(n),b=r.spec?await import("./spec-service-I23KJKKP.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-I23KJKKP.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-HE7O6N5S.mjs"),{effectiveTddMode:p}=await import("./tdd-NQDHU62B.mjs"),{effectiveNyquistWorkMode:x,nyquistWorkVerdict:b}=await import("./nyquist-lite-A23B7G4B.mjs"),{specService:F}=await import("./spec-service-I23KJKKP.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-HE7O6N5S.mjs"),import("./tdd-NQDHU62B.mjs")]),{effectiveWeakModelMode:b}=await import("./weak-model-mode-DH66XMD2.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-I23KJKKP.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-3LXOEIUX.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-YXK7EIKH.mjs"),{deriveTitle:i}=await import("./format-5V6GF6JJ.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-WL7S53XX.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-S22T3SPT.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-S22T3SPT.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, '{}'),
|
|
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
63
|
'$.expectedPoints', ?, '$.actualPoints', ?, '$.diffLines', ?)
|
|
64
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};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as T,c as E}from"./chunk-XC6YAP36.mjs";import{a as L}from"./chunk-
|
|
7
|
+
import{b as T,c as E}from"./chunk-XC6YAP36.mjs";import{a as L}from"./chunk-6U3MV7KZ.mjs";import{a as M}from"./chunk-VRFYDYQY.mjs";import{a as D,b as x,d as A,e as H,f as N}from"./chunk-6XTLPAPZ.mjs";import{a as P}from"./chunk-AS3LWTQ4.mjs";import{i as $}from"./chunk-UAYTDSYG.mjs";import{c as C,d as w}from"./chunk-H2KNJUPN.mjs";import{b as R,c as y,d as S}from"./chunk-ESB4ALH2.mjs";import{b as h}from"./chunk-EHVU2SMR.mjs";import{b as k}from"./chunk-XSZOHNL4.mjs";import{f as g,i as z}from"./chunk-DMO3ZFUG.mjs";import{E as W,t as v}from"./chunk-HU5ERAAV.mjs";import{b,e as O}from"./chunk-6RT2P22O.mjs";import{a as f}from"./chunk-3TRXQAU4.mjs";W();import{spawn as F}from"node:child_process";z();O();async function K(t,n,i,e){let o=await k.readConfig(n).catch(()=>null),r=await $(t,n).catch(()=>null),d=r?.turnCount??0,a=M(o,r),c=P(o,r),s=(()=>{try{return e?g.query(t,`SELECT DISTINCT json_extract(data, '$.file') AS file
|
|
8
8
|
FROM events
|
|
9
9
|
WHERE type = 'memory.post_edit' AND timestamp >= ?
|
|
10
10
|
LIMIT 20`,e).map(u=>u.file).filter(Boolean):[]}catch{return[]}})(),l=(()=>{try{return g.query(t,"SELECT content FROM task_log WHERE task_id = ? ORDER BY id DESC LIMIT 5",i).map(u=>u.content).filter(Boolean)}catch{return[]}})();return{turns:d,files:s,pressure:c.level!=="ok"?c.level:void 0,loopStopped:a.stopped||void 0,journal:l.length>0?l:void 0}}f(K,"buildEvidence");function Y(t,n,i){let e=t?.trim();if(e)return e.slice(0,500);let o=[`Yielded cycle "${i.slice(0,80)}"`];return n.turns&&n.turns>0&&o.push(`after ${n.turns} turns`),n.loopStopped&&o.push("loop-guard stopped"),n.pressure&&o.push(`context pressure ${n.pressure}`),n.files&&n.files.length>0&&o.push(`files: ${n.files.slice(0,5).join(", ")}`),o.push("\u2014 continue from current branch state; do not restart from zero"),o.join(" ").slice(0,500)}f(Y,"composeReason");function q(t){let n=[t.fromAgent,t.fromIdentity].filter(Boolean).join("/");return[`# prjct handoff \u2192 ${t.toAgent}`,"",`Task: \`${t.taskId}\` \u2014 ${t.taskDescription}`,`From: ${n} \xB7 handoff \`${t.id}\``,`Reason: ${t.reason}`,t.branch?`Branch: \`${t.branch}\``:null,t.worktreePath?`Path: \`${t.worktreePath}\``:null,"","## Accept (target agent)","","```bash",`cd ${t.worktreePath??"."}`,`prjct accept ${t.id} --md`,"```","","Then continue the cycle \u2014 do not start a new `prjct work` for the same intent."].filter(i=>i!==null).join(`
|
|
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{d as c,g as L}from"./chunk-4T7NGLNQ.mjs";import{e as a,g as T}from"./chunk-2EEMQV7N.mjs";import{a as r}from"./chunk-3TRXQAU4.mjs";import{Buffer as x}from"node:buffer";var y={"claude-opus-4.5":{input:.005,output:.025},"claude-sonnet-4.5":{input:.003,output:.015},"claude-haiku-4.5":{input:.001,output:.005},"claude-opus-4":{input:.015,output:.075},"claude-opus-4-6":{input:.015,output:.075},"gpt-4o":{input:.0025,output:.01},"gpt-4-turbo":{input:.01,output:.03},"gpt-4o-mini":{input:15e-5,output:6e-4},"gemini-1.5-pro":{input:.00125,output:.005},"gemini-1.5-flash":{input:75e-6,output:3e-4}},C="claude-sonnet-4.5";function s(e){return!e||e.length===0?0:Math.ceil(e.length/4)}r(s,"countTokens");var d=["claude-sonnet-4.5","claude-opus-4.5","claude-opus-4-6","gpt-4o","gemini-1.5-pro"];function p(e,t){let o=y[t],n=e/1e3*o.input,i=e/1e3*o.output*.3;return{inputSaved:n,outputPotential:i,total:n+i}}r(p,"calculateModelCost");function P(e){return e<.001?"<$0.01":e<.01?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}r(P,"formatCostSaved");function $(e,t){let o=s(e),n=s(t),i=Math.max(0,o-n),k=o>0?(o-n)/o:0,u=p(i,C),M=d.map(l=>({model:l,...p(i,l)}));return{tokens:{original:o,filtered:n,saved:i},compression:Math.max(0,Math.min(1,k)),cost:{saved:u.total,formatted:P(u.total),byModel:M}}}r($,"measureCompression");function R(e){let t=s(e);return{tokens:{original:t,filtered:t,saved:0},compression:0,cost:{saved:0,formatted:"$0.00",byModel:d.map(o=>({model:o,inputSaved:0,outputPotential:0,total:0}))}}}r(R,"noCompression");T();L();var m=1e3,f=400,A=12,g=1400,_=[{id:"L0",name:"always-on",load:"every turn (skill + AGENTS/CLAUDE routing)",contents:["prjct skill body","minimal routing map (work/ship/pull verbs)","PRJCT.md hub (routing map + verified per-project commands/stack)"],pull:"installed skill + `AGENTS.md` / `CLAUDE.md` pointer \u2192 `PRJCT.md`",antiPattern:"Do NOT paste memory dumps, full specs, or search results into L0."},{id:"L1",name:"session",load:"SessionStart / cold prime / `prjct prime`",contents:["active work cycle","context-pressure / loop cues","last land hand-off (when present)","persona + cold-start knowledge digest"],pull:"`prjct work --md` \xB7 `prjct context --md` \xB7 SessionStart hook",antiPattern:"Do NOT re-inject L1 on every UserPromptSubmit (cache thrash)."},{id:"L2",name:"pull",load:"on demand when the turn needs prior knowledge",contents:["memory search / topic recall","file guard traps","MCP prjct_* tools","spec show / relevant files"],pull:"`prjct search` \xB7 `prjct context memory <topic>` \xB7 `prjct guard <file>` \xB7 MCP",antiPattern:"Do NOT copy L2 bodies into skill, routing, or always-on prompts."},{id:"L3",name:"cold",load:"explicit archive / distill / historical query only",contents:["soft-deleted / archived memory","distilled retention tails","old ships beyond recent window","checkpoint files under checkpoints/"],pull:"`prjct land` Rho \xB7 archive surfaces \xB7 `prjct context-restore`",antiPattern:"Do NOT load L3 wholesale into the hot window."}];function S(){let e=c(),t=s(e),o=x.byteLength(a,"utf-8"),n=t<=m,i=o<=f;return{skillTokens:t,skillMax:m,routingBytes:o,routingMax:f,skillOk:n,routingOk:i,ok:n&&i}}r(S,"measureL0Budget");async function I(e){let{buildPrjctMdBody:t}=await import("./prjct-md-
|
|
7
|
+
import{d as c,g as L}from"./chunk-4T7NGLNQ.mjs";import{e as a,g as T}from"./chunk-2EEMQV7N.mjs";import{a as r}from"./chunk-3TRXQAU4.mjs";import{Buffer as x}from"node:buffer";var y={"claude-opus-4.5":{input:.005,output:.025},"claude-sonnet-4.5":{input:.003,output:.015},"claude-haiku-4.5":{input:.001,output:.005},"claude-opus-4":{input:.015,output:.075},"claude-opus-4-6":{input:.015,output:.075},"gpt-4o":{input:.0025,output:.01},"gpt-4-turbo":{input:.01,output:.03},"gpt-4o-mini":{input:15e-5,output:6e-4},"gemini-1.5-pro":{input:.00125,output:.005},"gemini-1.5-flash":{input:75e-6,output:3e-4}},C="claude-sonnet-4.5";function s(e){return!e||e.length===0?0:Math.ceil(e.length/4)}r(s,"countTokens");var d=["claude-sonnet-4.5","claude-opus-4.5","claude-opus-4-6","gpt-4o","gemini-1.5-pro"];function p(e,t){let o=y[t],n=e/1e3*o.input,i=e/1e3*o.output*.3;return{inputSaved:n,outputPotential:i,total:n+i}}r(p,"calculateModelCost");function P(e){return e<.001?"<$0.01":e<.01?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}r(P,"formatCostSaved");function $(e,t){let o=s(e),n=s(t),i=Math.max(0,o-n),k=o>0?(o-n)/o:0,u=p(i,C),M=d.map(l=>({model:l,...p(i,l)}));return{tokens:{original:o,filtered:n,saved:i},compression:Math.max(0,Math.min(1,k)),cost:{saved:u.total,formatted:P(u.total),byModel:M}}}r($,"measureCompression");function R(e){let t=s(e);return{tokens:{original:t,filtered:t,saved:0},compression:0,cost:{saved:0,formatted:"$0.00",byModel:d.map(o=>({model:o,inputSaved:0,outputPotential:0,total:0}))}}}r(R,"noCompression");T();L();var m=1e3,f=400,A=12,g=1400,_=[{id:"L0",name:"always-on",load:"every turn (skill + AGENTS/CLAUDE routing)",contents:["prjct skill body","minimal routing map (work/ship/pull verbs)","PRJCT.md hub (routing map + verified per-project commands/stack)"],pull:"installed skill + `AGENTS.md` / `CLAUDE.md` pointer \u2192 `PRJCT.md`",antiPattern:"Do NOT paste memory dumps, full specs, or search results into L0."},{id:"L1",name:"session",load:"SessionStart / cold prime / `prjct prime`",contents:["active work cycle","context-pressure / loop cues","last land hand-off (when present)","persona + cold-start knowledge digest"],pull:"`prjct work --md` \xB7 `prjct context --md` \xB7 SessionStart hook",antiPattern:"Do NOT re-inject L1 on every UserPromptSubmit (cache thrash)."},{id:"L2",name:"pull",load:"on demand when the turn needs prior knowledge",contents:["memory search / topic recall","file guard traps","MCP prjct_* tools","spec show / relevant files"],pull:"`prjct search` \xB7 `prjct context memory <topic>` \xB7 `prjct guard <file>` \xB7 MCP",antiPattern:"Do NOT copy L2 bodies into skill, routing, or always-on prompts."},{id:"L3",name:"cold",load:"explicit archive / distill / historical query only",contents:["soft-deleted / archived memory","distilled retention tails","old ships beyond recent window","checkpoint files under checkpoints/"],pull:"`prjct land` Rho \xB7 archive surfaces \xB7 `prjct context-restore`",antiPattern:"Do NOT load L3 wholesale into the hot window."}];function S(){let e=c(),t=s(e),o=x.byteLength(a,"utf-8"),n=t<=m,i=o<=f;return{skillTokens:t,skillMax:m,routingBytes:o,routingMax:f,skillOk:n,routingOk:i,ok:n&&i}}r(S,"measureL0Budget");async function I(e){let{buildPrjctMdBody:t}=await import("./prjct-md-BSFV7OQQ.mjs"),o=await t(e),n=x.byteLength(o,"utf-8");return{bytes:n,max:g,ok:n<=g}}r(I,"measurePrjctMdBudget");function h(){return{tiers:_,l0:S(),rule:"Never stuff L2/L3 into L0. Pull L2 on demand; L3 only explicitly."}}r(h,"buildContextTiersReport");function F(){return"Context tiers: L0 always \xB7 L1 session/prime \xB7 L2 pull (search/guard/MCP) \xB7 L3 cold \u2014 never stuff L2 into L0."}r(F,"contextTiersOneLiner");function G(e=h()){let t=["# prjct context cache tiers","",e.rule,"","| Tier | Name | Load | Pull |","|---|---|---|---|"];for(let o of e.tiers){let n=o.pull.replace(/\|/g,"\\|");t.push(`| **${o.id}** | ${o.name} | ${o.load} | ${n} |`)}t.push(""),t.push("## L0 budget (enforced)"),t.push(""),t.push(`- Skill: **${e.l0.skillTokens}** / ${e.l0.skillMax} tok ${e.l0.skillOk?"\u2713":"\u2717"}`),t.push(`- Routing: **${e.l0.routingBytes}** / ${e.l0.routingMax} B ${e.l0.routingOk?"\u2713":"\u2717"}`),t.push(""),t.push("## Anti-patterns"),t.push("");for(let o of e.tiers)t.push(`- **${o.id}**: ${o.antiPattern}`);t.push(""),t.push("## Contents by tier"),t.push("");for(let o of e.tiers){t.push(`### ${o.id} \u2014 ${o.name}`);for(let n of o.contents)t.push(`- ${n}`);t.push("")}return`${t.join(`
|
|
8
8
|
`).trimEnd()}
|
|
9
9
|
`}r(G,"formatContextTiersMd");function K(e=h()){return{rule:e.rule,l0:e.l0,tiers:e.tiers.map(t=>({id:t.id,name:t.name,load:t.load,contents:t.contents,pull:t.pull,antiPattern:t.antiPattern}))}}r(K,"formatContextTiersJson");export{s as a,$ as b,R as c,m as d,f as e,A as f,g,_ as h,S as i,I as j,h as k,F as l,G as m,K as n};
|
|
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{F as m,G as U}from"./chunk-HU5ERAAV.mjs";import{e as w,g as N}from"./chunk-
|
|
7
|
+
import{F as m,G as U}from"./chunk-HU5ERAAV.mjs";import{e as w,g as N}from"./chunk-XWLTEAGN.mjs";import{f as g,g as C,l as k,p as P}from"./chunk-HYIT7MF5.mjs";import{e as y,g as j}from"./chunk-225DWS4D.mjs";import{a as i}from"./chunk-3TRXQAU4.mjs";j();P();N();U();import{spawn as A}from"node:child_process";import d from"node:fs";import S from"node:https";import p from"node:path";import l from"chalk";var f=class{static{i(this,"UpdateChecker")}packageName;cacheDir;cacheFile;checkInterval;constructor(){this.packageName="prjct-cli",this.cacheDir=m.globalConfigDir,this.cacheFile=p.join(this.cacheDir,"update-cache.json"),this.checkInterval=1440*60*1e3}async getCurrentVersion(){try{let t=p.join(__dirname,"..","..","package.json");return(await g(t))?.version??null}catch(t){return console.error("Error reading package version:",y(t)),null}}async getLatestVersion(){return new Promise((t,e)=>{let a=Date.now(),r={hostname:"registry.npmjs.org",path:`/${this.packageName}/latest?prjct_bust=${a}`,method:"GET",headers:{"User-Agent":"prjct-cli-update-checker",Accept:"application/json","Cache-Control":"no-cache, no-store",Pragma:"no-cache"}},s=S.request(r,c=>{let u=[];c.on("data",o=>{u.push(String(o))}),c.on("end",()=>{try{if(c.statusCode===200){let o=JSON.parse(u.join("")),h=typeof o.version=="string"?o.version.trim():"";if(!/^\d+\.\d+\.\d+/.test(h)){e(new Error(`npm registry returned invalid version: ${h||"(empty)"}`));return}t(h)}else e(new Error(`npm registry returned status ${c.statusCode}`))}catch(o){e(o)}})});s.on("error",c=>{e(c)}),s.setTimeout(5e3,()=>{s.destroy(),e(new Error("Request timeout"))}),s.end()})}compareVersions(t,e){let a=t.split(".").map(Number),r=e.split(".").map(Number);return[0,1,2].map(s=>Math.sign((a[s]||0)-(r[s]||0))).find(s=>s!==0)??0}async readCache(){try{if(await k(this.cacheFile))return await g(this.cacheFile)}catch{}return null}async writeCache(t){try{await C(this.cacheFile,t)}catch{}}async checkForUpdates(){try{let t=await this.getCurrentVersion();if(!t)return null;let e=await this.readCache(),a=Date.now();if(e?.lastCheck&&a-e.lastCheck<this.checkInterval)return e.latestVersion&&this.compareVersions(e.latestVersion,t)>0?{updateAvailable:!0,currentVersion:t,latestVersion:e.latestVersion}:{updateAvailable:!1,currentVersion:t,latestVersion:t};let r=await this.getLatestVersion();return await this.writeCache({lastCheck:a,latestVersion:r}),{updateAvailable:this.compareVersions(r,t)>0,currentVersion:t,latestVersion:r}}catch{return null}}async getUpdateNotification(){let t=await this.checkForUpdates();return!t||!t.updateAvailable?null:$(t.currentVersion,t.latestVersion)}},q=f,b=i(()=>m.globalConfigDir,"updateCacheDir"),v=i(()=>p.join(b(),"update-cache.json"),"updateCacheFile"),D=1440*60*1e3;function E(n,t){let e=n.split(".").map(Number),a=t.split(".").map(Number);return[0,1,2].map(r=>Math.sign((e[r]||0)-(a[r]||0))).find(r=>r!==0)??0}i(E,"compareSemver");function V(){try{let n=d.readFileSync(v(),"utf-8");return JSON.parse(n)}catch{return null}}i(V,"readCacheSync");function $(n,t){let e=`Update available! ${n} \u2192 ${t}`,a="prjct upgrade",r=Math.max(e.length,`Run: ${a}`.length)+4,s=`\u250C${"\u2500".repeat(r)}\u2510`,c=`\u2514${"\u2500".repeat(r)}\u2518`,u=i(o=>`\u2502 ${o}${" ".repeat(r-o.length-2)}\u2502`,"pad");return["",l.yellow(s),l.yellow(u("")),l.yellow(`\u2502 ${l.bold(e)}${" ".repeat(r-e.length-2)}\u2502`),l.yellow(`\u2502 Run: ${l.cyan(a)}${" ".repeat(r-a.length-7)}\u2502`),l.yellow(u("")),l.yellow(c),""].join(`
|
|
8
8
|
`)}i($,"formatUpdateBanner");function L(n){if(!n)return null;let t=V();return!t?.latestVersion||E(t.latestVersion,n)<=0?null:$(n,t.latestVersion)}i(L,"getUpdateNotificationSync");function B(){try{let t=V();if(t?.lastCheck&&Date.now()-t.lastCheck<D)return}catch{}try{d.mkdirSync(b(),{recursive:!0})}catch{return}let n=p.join(w,"assets","scripts","refresh-update.mjs");if(d.existsSync(n))try{A(process.execPath,[n,v()],{detached:!0,stdio:"ignore"}).unref()}catch{}}i(B,"triggerBackgroundRefreshIfStale");export{q as a,L as b,B as c};
|