prjct-cli 3.94.0 → 3.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +27 -21
- package/dist/bin/hook-chunks/{agent-identity-45BYQBU2.mjs → agent-identity-DH6DX72X.mjs} +1 -1
- package/dist/bin/hook-chunks/{agent-switch-2U2LOBGR.mjs → agent-switch-I4MTVE56.mjs} +1 -1
- package/dist/bin/hook-chunks/{analysis-N4NYGIG3.mjs → analysis-VN7APBHR.mjs} +3 -3
- package/dist/bin/hook-chunks/{auth-config-SP4PBALR.mjs → auth-config-JIITQ6GY.mjs} +1 -1
- package/dist/bin/hook-chunks/{auto-flush-BN6L6QHO.mjs → auto-flush-DX3FVSQE.mjs} +1 -1
- package/dist/bin/hook-chunks/{capture-gate-FRF2G3IG.mjs → capture-gate-MEIQD7ZS.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-OZJ6UKKP.mjs → chunk-22GFTUER.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-32RX4YGI.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-Q3EYM4GJ.mjs → chunk-33BHU4OM.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-HNEKXKOI.mjs → chunk-3AHW4XQH.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-JMCMTX6U.mjs → chunk-3CKNJ5RA.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-6RLCUGGG.mjs → chunk-3FEXJUO2.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-7GNWHWOO.mjs → chunk-3HGQPUKG.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-D6IONKRA.mjs → chunk-3UB6SFRA.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-AVRNHROK.mjs → chunk-64ZEBHDX.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-MI3JEFON.mjs → chunk-7PBWIO4K.mjs} +3 -3
- package/dist/bin/hook-chunks/{chunk-UA4Z5TGG.mjs → chunk-7WO5CEH3.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-A6K4H3YT.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-3VWBNLBC.mjs → chunk-ADYTBOCZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-TG5CQJD5.mjs → chunk-AORD3YDQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-EHEQOF6Z.mjs → chunk-B36LC2JR.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-FX6VHIKB.mjs → chunk-BKJHD5JI.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-S7HQQILD.mjs → chunk-BVK7ZDLX.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-HHIGNKDO.mjs → chunk-CPR4FPXG.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-6UH244CC.mjs → chunk-D7DQABWO.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-Y4DUB7UN.mjs → chunk-DB226JIV.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-KOCROTRM.mjs → chunk-DCHIPMOG.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-IKIB42F7.mjs → chunk-E7NA34VQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-MHQTGU45.mjs → chunk-EGCYDLSO.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ZMKTR2IO.mjs → chunk-EI6VQZOX.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-INXNK57E.mjs → chunk-ETTDRXQ6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-EQ5KNMLG.mjs → chunk-EXVL2OFE.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-5EQLQ7GF.mjs → chunk-FZS3XGEA.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-QYEASMFV.mjs → chunk-GSPDJSJ5.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-TKWAFYF7.mjs → chunk-H2DGDAQP.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-H5AVBDCH.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-SDUS2AT7.mjs → chunk-HGZQWYBL.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-EMTCZG5I.mjs → chunk-IJ523YO2.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NBKEOLDH.mjs → chunk-IWUF2LGO.mjs} +5 -5
- package/dist/bin/hook-chunks/chunk-JGZ3QGWX.mjs +11 -0
- package/dist/bin/hook-chunks/{chunk-66GE3IHX.mjs → chunk-JZDZH6IV.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-PUHX3ECX.mjs → chunk-KDNUQPAK.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-KV4NXLPT.mjs +11 -0
- package/dist/bin/hook-chunks/{chunk-XE4MJNBQ.mjs → chunk-LF3S3MYE.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-LQLCYBFF.mjs +36 -0
- package/dist/bin/hook-chunks/{chunk-YUKGWWL7.mjs → chunk-LR24AIEW.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-2HB2JHQE.mjs → chunk-M4YM7Z3F.mjs} +15 -15
- package/dist/bin/hook-chunks/{chunk-F4T7IAA7.mjs → chunk-MW54MTLB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-7O6OMD4X.mjs → chunk-NCLONKOT.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-HRWXMF7P.mjs → chunk-NJ74RHNC.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-JUZ5LNDI.mjs → chunk-NLL5AV2G.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-OIU4Y5WL.mjs → chunk-OC4CYF7V.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-OLQAMCYV.mjs +18 -0
- package/dist/bin/hook-chunks/{chunk-C3W2HLJT.mjs → chunk-PPWPUEBH.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-PVCEWFHS.mjs +51 -0
- package/dist/bin/hook-chunks/{chunk-Y3J7UUMR.mjs → chunk-QOQZHR3E.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-2UC4DTDO.mjs → chunk-QXCEBAIA.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-RT2DFIWF.mjs +19 -0
- package/dist/bin/hook-chunks/{chunk-NCOOKPXX.mjs → chunk-SQW2B7NW.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-IHECXD2M.mjs → chunk-SWJ7TLBD.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-X2AGNDGD.mjs → chunk-TB57OYGW.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-QPRNRLG6.mjs → chunk-TF6PN7IB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-KG7Z6OMK.mjs → chunk-TKXOMN4K.mjs} +4 -4
- package/dist/bin/hook-chunks/chunk-UMJ5D5I6.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-NWIQNII6.mjs → chunk-UVATSTRF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NHIWYDQD.mjs → chunk-WJV24WE6.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-Q3Z53QTH.mjs → chunk-WL6PKX3U.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-WUOVBBPC.mjs +11 -0
- package/dist/bin/hook-chunks/{chunk-TYEAIX3X.mjs → chunk-XDBJSJOT.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-JCYXFHQZ.mjs → chunk-XSJ7SPVR.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-J6TAD3OZ.mjs → chunk-XV2LJVYB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-7JEKBJAP.mjs → chunk-XYKVWO23.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-4O4D6DV7.mjs → chunk-Y3RHBU2R.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-JPSJWCFD.mjs → chunk-Y7MZA2G4.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-T2FCU3ZS.mjs → chunk-YHOZTAZH.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-YLOK4WRR.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-OENWCYLF.mjs → chunk-ZJW27EUC.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-VWOIUTAX.mjs → chunk-ZQI4TJ5C.mjs} +3 -3
- package/dist/bin/hook-chunks/chunk-ZYCNW75E.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-AZHE4VOM.mjs → chunk-ZZBNFNMG.mjs} +1 -1
- package/dist/bin/hook-chunks/{client-ERZ5CM3D.mjs → client-K3ZA2BLB.mjs} +3 -3
- package/dist/bin/hook-chunks/{code-graph-cloud-4GRWQSUK.mjs → code-graph-cloud-XGQF7XYC.mjs} +1 -1
- package/dist/bin/hook-chunks/{codex-skill-6DYQMPDJ.mjs → codex-skill-6CRFUF3A.mjs} +1 -1
- package/dist/bin/hook-chunks/{command-installer-MF4KUM3X.mjs → command-installer-MUHZWDZA.mjs} +1 -1
- package/dist/bin/hook-chunks/{config-manager-2VZPHUDG.mjs → config-manager-2JJPCLKC.mjs} +1 -1
- package/dist/bin/hook-chunks/{context7-service-V7CIDF3Q.mjs → context7-service-NH4BMGSJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{custom-workflow-storage-UOBQXY42.mjs → custom-workflow-storage-VBMWLKA7.mjs} +1 -1
- package/dist/bin/hook-chunks/cwd-changed-UTD6Y4MS.mjs +8 -0
- package/dist/bin/hook-chunks/{database-XYKQF3KR.mjs → database-ZCP76LMM.mjs} +1 -1
- package/dist/bin/hook-chunks/{detect-changes-DFRJOOB3.mjs → detect-changes-5W6EGEZG.mjs} +1 -1
- package/dist/bin/hook-chunks/{developer-evolution-SLC34HUU.mjs → developer-evolution-UTY3CWOK.mjs} +1 -1
- package/dist/bin/hook-chunks/{distill-U2LJGUG3.mjs → distill-5TNAM3LY.mjs} +1 -1
- package/dist/bin/hook-chunks/{editors-config-6XFYIOE6.mjs → editors-config-2CACBNS4.mjs} +1 -1
- package/dist/bin/hook-chunks/{enriched-recall-X6RDNNIE.mjs → enriched-recall-6VOIUNLN.mjs} +1 -1
- package/dist/bin/hook-chunks/{format-ALUX4QSI.mjs → format-IIOFTSBF.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-ledger-storage-SCGU3URM.mjs → judgment-ledger-storage-7Q7AEEY6.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-orchestrator-BYPG65RS.mjs → judgment-orchestrator-AAON4ZJ4.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-receipt-GWSSCLAB.mjs → judgment-receipt-QLV3MYFT.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-cue-MMISX2BI.mjs → land-cue-57B23PEL.mjs} +1 -1
- package/dist/bin/hook-chunks/{land-synthesis-WG5JAS7B.mjs → land-synthesis-ZVPFJERV.mjs} +1 -1
- package/dist/bin/hook-chunks/{legacy-crew-sweep-2WSO5KEB.mjs → legacy-crew-sweep-GR6HRSHX.mjs} +2 -2
- package/dist/bin/hook-chunks/{memory-index-QK5QJOFJ.mjs → memory-index-XE2MWKQS.mjs} +1 -1
- package/dist/bin/hook-chunks/{notification-MPVWVV52.mjs → notification-GU2ZJP5K.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-integrity-XRYOROK5.mjs → pack-integrity-WV5U3AFF.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-manager-WWGQNJDQ.mjs → pack-manager-QLFQKP24.mjs} +1 -1
- package/dist/bin/hook-chunks/{path-manager-ZR5RAKTK.mjs → path-manager-375HH6TB.mjs} +1 -1
- package/dist/bin/hook-chunks/{planning-S55KBPN2.mjs → planning-VPAX5DZL.mjs} +2 -2
- package/dist/bin/hook-chunks/{post-edit-QMHSZHDN.mjs → post-edit-UXCFSR3Y.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-bash-RAM6L3G4.mjs → pre-bash-MB4JNNYG.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-commit-736ZLMDL.mjs → pre-commit-U7TRFKWX.mjs} +1 -1
- package/dist/bin/hook-chunks/pre-edit-MDCQXI5F.mjs +11 -0
- package/dist/bin/hook-chunks/{pre-package-LCIAWWGK.mjs → pre-package-A6ZI5R64.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-search-J5EOFMYN.mjs → pre-search-ZZO3LGXJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{pre-secrets-TSUMTXHH.mjs → pre-secrets-MWPPZPWK.mjs} +1 -1
- package/dist/bin/hook-chunks/{prjct-md-T2DG236Y.mjs → prjct-md-MS52YLI2.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-agent-surfaces-VRY22I66.mjs → project-agent-surfaces-6AIW7KL6.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-file-inventory-5DEN5VLF.mjs → project-file-inventory-HHURZTMH.mjs} +1 -1
- package/dist/bin/hook-chunks/project-memory-UDH56VFP.mjs +8 -0
- package/dist/bin/hook-chunks/{project-style-evolution-7MAUSED2.mjs → project-style-evolution-IJXT2MCP.mjs} +1 -1
- package/dist/bin/hook-chunks/prompt-7VZLYONO.mjs +24 -0
- package/dist/bin/hook-chunks/{publish-helper-G54XQV5K.mjs → publish-helper-ZSL27HSX.mjs} +1 -1
- package/dist/bin/hook-chunks/{purge-MC5LFSAO.mjs → purge-N2WN6NDB.mjs} +1 -1
- package/dist/bin/hook-chunks/retention-RET4P2RO.mjs +8 -0
- package/dist/bin/hook-chunks/{sdd-5UCVX43H.mjs → sdd-PB6WKSLE.mjs} +1 -1
- package/dist/bin/hook-chunks/{session-continuity-RKNAJJHR.mjs → session-continuity-BIJXMN44.mjs} +1 -1
- package/dist/bin/hook-chunks/session-start-R2VMKW2L.mjs +8 -0
- package/dist/bin/hook-chunks/settings-installer-CQKMGMRG.mjs +9 -0
- package/dist/bin/hook-chunks/{setup-WQRJ6TQL.mjs → setup-PPIZHVXS.mjs} +3 -3
- package/dist/bin/hook-chunks/{shipping-5D5LTJ3P.mjs → shipping-C637PCOF.mjs} +4 -4
- package/dist/bin/hook-chunks/{skill-index-RAVJMC4P.mjs → skill-index-55I3HLAI.mjs} +1 -1
- package/dist/bin/hook-chunks/{spec-context-inference-7DDSTRTV.mjs → spec-context-inference-RTTDOZZO.mjs} +1 -1
- package/dist/bin/hook-chunks/{spec-service-LAO5Z2M5.mjs → spec-service-ENLAAMVL.mjs} +2 -2
- package/dist/bin/hook-chunks/{spec-task-breakdown-K3GMQKGH.mjs → spec-task-breakdown-RUDEP3AY.mjs} +1 -1
- package/dist/bin/hook-chunks/{state-storage-EIFGUO7X.mjs → state-storage-AJUPG7J5.mjs} +1 -1
- package/dist/bin/hook-chunks/stop-DPXAWJFN.mjs +16 -0
- package/dist/bin/hook-chunks/subagent-start-AFHPXL2S.mjs +8 -0
- package/dist/bin/hook-chunks/{subagent-stop-RBD2OILE.mjs → subagent-stop-5BMV63ML.mjs} +1 -1
- package/dist/bin/hook-chunks/{surface-attribution-K37N2NK7.mjs → surface-attribution-EGIKCVMF.mjs} +1 -1
- package/dist/bin/hook-chunks/{symbol-graph-BKQIMFRG.mjs → symbol-graph-MH42JSPX.mjs} +1 -1
- package/dist/bin/hook-chunks/{sync-client-EGBMWF3J.mjs → sync-client-PIRHMHXL.mjs} +1 -1
- package/dist/bin/hook-chunks/{sync-cursor-storage-E3LMZISA.mjs → sync-cursor-storage-ZB7FGT6D.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-orchestration-2ZYE5M6J.mjs → task-orchestration-7NGRIISS.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-overview-ITY5OSHX.mjs → task-overview-F3GB77OA.mjs} +1 -1
- package/dist/bin/hook-chunks/task-service-FZABHPFV.mjs +8 -0
- package/dist/bin/hook-chunks/{tdd-7S55S5C3.mjs → tdd-TAMBOPN3.mjs} +1 -1
- package/dist/bin/hook-chunks/{template-loader-SCM4C2A3.mjs → template-loader-MXOMU4XH.mjs} +1 -1
- package/dist/bin/hook-chunks/{transcript-jsonl-6X4DDD6R.mjs → transcript-jsonl-7W2NOJPZ.mjs} +1 -1
- package/dist/bin/hook-chunks/{usefulness-SCH5ARGV.mjs → usefulness-TBD5EYAL.mjs} +1 -1
- package/dist/bin/hook-chunks/{vault-retire-notice-HT756AND.mjs → vault-retire-notice-7XHVNHU6.mjs} +1 -1
- package/dist/bin/hook-chunks/{velocity-storage-47CF3XWZ.mjs → velocity-storage-IOCVK2LU.mjs} +1 -1
- package/dist/bin/hook-chunks/{weak-model-mode-FLCEQ2BV.mjs → weak-model-mode-BMSPGEQY.mjs} +1 -1
- package/dist/bin/hook-chunks/{work-graph-JQHVVXIZ.mjs → work-graph-AVAOKY63.mjs} +1 -1
- package/dist/bin/hook-chunks/work-scope-YCS4GTXW.mjs +8 -0
- package/dist/bin/hook-chunks/{workspace-occupancy-UUW4UGGB.mjs → workspace-occupancy-JOBYNNXV.mjs} +1 -1
- package/dist/bin/hook-fast-darwin-arm64 +0 -0
- package/dist/bin/hook-fast-darwin-x64 +0 -0
- package/dist/bin/hook-fast-linux-x64 +0 -0
- package/dist/bin/prjct-core.mjs +739 -714
- package/dist/bin/prjct-hooks.mjs +3 -3
- package/dist/bin/prjct.mjs +22 -9
- package/dist/daemon/entry.mjs +620 -593
- package/dist/mcp/server.mjs +317 -303
- package/package.json +3 -5
- package/scripts/install.sh +28 -496
- package/dist/bin/hook-chunks/chunk-27XFSCOE.mjs +0 -43
- package/dist/bin/hook-chunks/chunk-4SKJWNKE.mjs +0 -11
- package/dist/bin/hook-chunks/chunk-AZYQFRPJ.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-DRGI5UHQ.mjs +0 -10
- package/dist/bin/hook-chunks/chunk-GFY4GY3Z.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-JAMSIKDE.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-NUJASVHN.mjs +0 -18
- package/dist/bin/hook-chunks/chunk-NWZEBCTC.mjs +0 -19
- package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-TFCLMTJ5.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-TRMBRDKH.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-V2BSS7HW.mjs +0 -36
- package/dist/bin/hook-chunks/chunk-ZJXH76Q5.mjs +0 -11
- package/dist/bin/hook-chunks/cwd-changed-J6O46KS7.mjs +0 -8
- package/dist/bin/hook-chunks/pre-edit-GZ4QJ2MU.mjs +0 -11
- package/dist/bin/hook-chunks/project-memory-KKEMTEMP.mjs +0 -8
- package/dist/bin/hook-chunks/prompt-DVF6V2X2.mjs +0 -22
- package/dist/bin/hook-chunks/retention-LWETHQX3.mjs +0 -8
- package/dist/bin/hook-chunks/session-start-MFMFKUPK.mjs +0 -8
- package/dist/bin/hook-chunks/settings-installer-QDM3GB6J.mjs +0 -9
- package/dist/bin/hook-chunks/stop-RYLI4FGF.mjs +0 -16
- package/dist/bin/hook-chunks/subagent-start-CCUPSANT.mjs +0 -8
- package/dist/bin/hook-chunks/task-service-XREJLWEF.mjs +0 -8
- package/dist/bin/hook-chunks/work-scope-CDLSZ4U5.mjs +0 -8
|
@@ -5,14 +5,14 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{b as y,c as ne,d as re}from"./chunk-JQE2F2RK.mjs";import{a as
|
|
8
|
+
import{b as y,c as ne,d as re}from"./chunk-JQE2F2RK.mjs";import{a as N,b as ee}from"./chunk-WUHGODSQ.mjs";import{g as P,o as V}from"./chunk-UH4MD3F3.mjs";import{b as A,p as te}from"./chunk-QWQFF2UG.mjs";import{a as D,e as g,f as I}from"./chunk-BUDZL4DW.mjs";import{a as o,b as O}from"./chunk-E66B27AL.mjs";re();ee();I();import{constants as de}from"node:fs";import d from"node:fs/promises";import j from"node:os";import a from"node:path";ne();import k from"node:fs/promises";import ae from"node:path";I();V();import m from"node:fs";import _ from"node:fs/promises";import M from"node:os";import p from"node:path";var w="mcp-remote@0.1.38";var E="prjct: agentic harness with project memory, workflow gates, intent briefs, and performance context. Use prjct_task_start as the MCP entrypoint for a work cycle; prjct retrieves focused context, persists evidence stations, and keeps humans in the loop for risky gates. Agents resume from prjct_task_status/workflow output, create or link reviewed intent/spec briefs when required, and persist synthesized learning instead of raw transcript fragments.";function se(){let t=oe();if(t)return t;if(process.env.PRJCT_MCP_ALLOW_LOCAL==="1"){let e=ie();if(e)return{command:e,args:["mcp-server"],description:E}}return{command:"npx",args:["-y","prjct-cli@latest","mcp-server"],description:E}}o(se,"getPrjctMcpConfig");function $(t){let e=t.replace(/\\/g,"/");return!!(e.includes("/.worktrees/")||e.includes("/prjct-cli/bin/prjct")&&!e.includes("/node_modules/prjct-cli/"))}o($,"isNonProductionPrjctPath");function oe(){let t=[];try{t.push(p.dirname(O.resolve("prjct-cli/package.json")))}catch{}let e=M.homedir();for(let n of[process.env.NVM_BIN?p.resolve(process.env.NVM_BIN,".."):"",p.join(e,".nvm","versions","node",process.version,"lib"),"/opt/homebrew/lib","/usr/local/lib"].filter(Boolean))t.push(p.join(n,"node_modules","prjct-cli"));for(let n of t){if($(n))continue;let r=p.join(n,"bin","prjct.cjs"),i=m.existsSync(p.join(n,"dist","bin","prjct.mjs"))||m.existsSync(p.join(n,"dist","bin","prjct-core.mjs"));if(!m.existsSync(r)||!i)continue;let c=[process.execPath,p.join(p.dirname(process.execPath),"node"),p.join(n,"..","..","bin","node")].find(x=>x&&m.existsSync(x)),u=p.resolve(n,"..","..","..","bin","node"),f=m.existsSync(u)?u:c??process.execPath;return{command:f,args:[r,"mcp-server"],env:{PATH:`${p.dirname(f)}${p.delimiter}/usr/bin${p.delimiter}/bin`},description:E}}return null}o(oe,"resolvePublishedPrjctMcpConfig");function ie(){let t=process.argv[1],e=[t?p.resolve(p.dirname(t),"prjct"):"",t?p.resolve(p.dirname(t),"..","bin","prjct"):"",p.resolve(process.cwd(),"bin","prjct")].filter(Boolean);for(let n of e){if(!m.existsSync(n))continue;let r=(()=>{try{return m.realpathSync(n)}catch{return n}})();if(!$(r))return r}return null}o(ie,"resolveLocalPrjctBin");var h={context7:{command:"npx",args:["-y","@upstash/context7-mcp@latest"],description:"Library documentation lookup"},prjct:se(),linear:{command:"npx",args:["-y",w,"https://mcp.linear.app/mcp"],description:"Linear MCP server (OAuth)"},jira:{command:"npx",args:["-y",w,"https://mcp.atlassian.com/v1/mcp"],description:"Atlassian MCP server for Jira (OAuth)"}};function S(){return process.env.PRJCT_TEST_MODE==="1"?p.join(M.tmpdir(),"prjct-context7-test","mcp.json"):p.join(M.homedir(),".claude","mcp.json")}o(S,"getClaudeMcpConfigPath");async function L(t=S()){try{let e=await _.readFile(t,"utf-8");return JSON.parse(e)}catch(e){let n=g(e).toLowerCase();if(n.includes("no such file")||n.includes("enoent"))return{};throw new Error(`Failed to read MCP config at ${t}: ${g(e)}`)}}o(L,"readMcpConfig");async function ce(t,e=S()){await P(e,t)}o(ce,"writeMcpConfig");async function Oe(t,e,n=S()){let r=await L(n),i={...r.mcpServers||{}},s=i[t];i[t]=e,r.mcpServers=i;let c=JSON.stringify(s)!==JSON.stringify(e);return await ce(r,n),{path:n,changed:c}}o(Oe,"upsertMcpServer");async function Ne(t,e=S()){return!!(await L(e)).mcpServers?.[t]}o(Ne,"hasMcpServer");function b(t,e,n,r,i){let s=t.indexOf(n),c=t.indexOf(r);if(s!==-1&&c!==-1&&c>s){let u=t.slice(0,s),f=t.slice(c+r.length),x=f.startsWith(`
|
|
9
9
|
`)?f.slice(1):f;return{next:u+e+x}}return new RegExp(`^\\s*\\[mcp_servers\\.${i}\\]`,"m").test(t)?{next:t,skipped:"user-managed"}:t.trim().length>0?{next:`${t.trimEnd()}
|
|
10
10
|
|
|
11
|
-
${e}`}:{next:e}}o(
|
|
12
|
-
`)}o(K,"buildMcpTomlBlock");function ue(t=h.prjct){return K("prjct",t,F
|
|
13
|
-
`)}o(fe,"buildCodexStatusLineToml");function le(t){return/^\s*(?:tui\.)?status_line\s*=/m.test(t)}o(le,"hasCodexStatusLine");function me(t){if(le(t))return{toml:t,changed:!1};let n=`status_line = [${H.map(
|
|
11
|
+
${e}`}:{next:e}}o(b,"upsertMarkedBlock");async function T(t,e,n){return n===e?{path:t,changed:!1}:(await _.mkdir(p.dirname(t),{recursive:!0}),await _.writeFile(t,n,"utf-8"),{path:t,changed:!0})}o(T,"writeConfigIfChanged");var J="# prjct:mcp:start - managed by prjct, do not edit between markers",F="# prjct:mcp:end",B="# prjct:mcp:context7:start - managed by prjct, do not edit between markers",X="# prjct:mcp:context7:end",H=["model-with-reasoning","current-dir","git-branch","context-remaining","five-hour-limit","weekly-limit","task-progress"];function C(){return process.env.PRJCT_TEST_MODE==="1"?ae.join(y(".prjct-tests"),"codex","config.toml"):y(".codex","config.toml")}o(C,"getCodexConfigTomlPath");function v(t){return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}o(v,"tomlString");function K(t,e,n,r){let i=(e.args??[]).map(v).join(", "),s=[n,`[mcp_servers.${t}]`,`command = ${v(e.command)}`,`args = [${i}]`];if(e.env&&Object.keys(e.env).length>0){let c=Object.entries(e.env).map(([u,f])=>`${u} = ${v(f)}`).join(", ");s.push(`env = { ${c} }`)}return s.push(r,""),s.join(`
|
|
12
|
+
`)}o(K,"buildMcpTomlBlock");function ue(t=h.prjct){return K("prjct",t,J,F)}o(ue,"buildPrjctMcpTomlBlock");function pe(t=h.context7){return K("context7",t,B,X)}o(pe,"buildContext7McpTomlBlock");function fe(){return["[tui]",`status_line = [${H.map(v).join(", ")}]`,""].join(`
|
|
13
|
+
`)}o(fe,"buildCodexStatusLineToml");function le(t){return/^\s*(?:tui\.)?status_line\s*=/m.test(t)}o(le,"hasCodexStatusLine");function me(t){if(le(t))return{toml:t,changed:!1};let n=`status_line = [${H.map(v).join(", ")}]
|
|
14
14
|
`,r=/^\s*\[tui\]\s*$/m.exec(t);if(r){let s=r.index+r[0].length,c=t.slice(0,s),u=t.slice(s),f=u.startsWith(`
|
|
15
15
|
`)?u.slice(1):u;return{toml:`${c}
|
|
16
16
|
${n}${f}`,changed:!0}}let i=fe();return{toml:t.trim().length>0?`${t.trimEnd()}
|
|
17
17
|
|
|
18
|
-
${i}`:i,changed:!0}}o(me,"ensureCodexStatusLineToml");async function
|
|
18
|
+
${i}`:i,changed:!0}}o(me,"ensureCodexStatusLineToml");async function Je(t=C()){let e=await k.readFile(t,"utf-8").catch(()=>""),n=ue(),r=b(e,n,J,F,"prjct"),i=r.skipped,s=me(r.next),c=s.toml,u=await T(t,e,c);return{...u,skipped:i,...u.changed?{statusLineChanged:s.changed}:{}}}o(Je,"ensureCodexMcpServer");async function U(t=C()){let e=await k.readFile(t,"utf-8").catch(()=>""),n=pe(),{next:r,skipped:i}=b(e,n,B,X,"context7");return{...await T(t,e,r),skipped:i}}o(U,"ensureCodexContext7Server");async function q(t=C()){try{let e=await k.readFile(t,"utf-8");return/^\s*\[mcp_servers\.context7\]/m.test(e)}catch{return!1}}o(q,"codexHasContext7Server");te();V();function Q(){return process.env.NODE_ENV==="test"?a.join(j.tmpdir(),"prjct-context7-test","verify-cache.json"):a.join(N(),"state","context7-verify.json")}o(Q,"getVerifyCachePath");async function ge(){try{let t=await d.readFile(Q(),"utf-8"),e=JSON.parse(t);if(typeof e?.at=="number"&&e.status)return{...e,provider:e.provider??"claude"}}catch{}return null}o(ge,"readPersistedVerify");async function he(t,e,n){let r=Q();try{await d.mkdir(a.dirname(r),{recursive:!0}),await d.writeFile(r,JSON.stringify({at:t,provider:e,status:n}),"utf-8")}catch{}}o(he,"writePersistedVerify");var Z=h.context7,l={value:null},ve=[a.dirname(process.execPath),"/opt/homebrew/bin","/usr/local/bin","/opt/local/bin","/usr/bin","/bin"],Ce=[[".bun","bin"],[".local","bin"],[".volta","bin"],[".asdf","shims"],[".local","share","mise","shims"],[".rtx","shims"],[".npm-global","bin"]];async function G(t){try{return(await d.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name)}catch{return[]}}o(G,"listChildDirs");async function xe(t){let e=[],n=process.env.NVM_DIR||a.join(t,".nvm"),r=a.join(n,"versions","node");for(let c of await G(r))e.push(a.join(r,c,"bin"));let i=process.env.FNM_DIR||a.join(t,".local","share","fnm"),s=a.join(i,"node-versions");for(let c of await G(s))e.push(a.join(s,c,"installation","bin"));return e}o(xe,"discoverNodeManagerBinDirs");async function Pe(t=process.env.PATH||"",e=j.homedir()){let n=new Set,r=[],i=Ce.map(c=>a.join(e,...c)),s=[...ve,...i,...process.env.NVM_BIN?[process.env.NVM_BIN]:[],...process.env.VOLTA_HOME?[a.join(process.env.VOLTA_HOME,"bin")]:[],...process.env.ASDF_DIR?[a.join(process.env.ASDF_DIR,"shims")]:[],...process.env.MISE_DATA_DIR?[a.join(process.env.MISE_DATA_DIR,"shims")]:[],...await xe(e)];for(let c of[...t.split(a.delimiter),...s]){let u=c.trim();!u||n.has(u)||(n.add(u),r.push(u))}return r.join(a.delimiter)}o(Pe,"buildContext7SmokePath");async function Se(t,e){if(a.isAbsolute(t)||t.includes(a.sep))return t;let n=process.platform==="win32"?(process.env.PATHEXT||".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean):[""];for(let r of e.split(a.delimiter))if(r)for(let i of n){let s=a.join(r,t+i);try{return await d.access(s,de.X_OK),s}catch{}}return t}o(Se,"resolveExecutable");function Y(){return process.env.PRJCT_CONTEXT7_CONFIG?process.env.PRJCT_CONTEXT7_CONFIG:process.env.NODE_ENV==="test"?a.join(j.tmpdir(),"prjct-context7-test","mcp.json"):a.join(j.homedir(),".claude","mcp.json")}o(Y,"getConfigPath");async function z(t){try{let e=await d.readFile(t,"utf-8");return JSON.parse(e)}catch(e){if(D(e))return{};throw e}}o(z,"readConfig");async function je(){if(process.env.PRJCT_SKIP_CONTEXT7_SMOKE==="1"||process.env.NODE_ENV==="test")return;let t=Z,e=[...t.args||[],"--help"],n=await Pe(),r=await Se(t.command||"npx",n);await A(r,e,{timeout:15e3,env:{...process.env,PATH:n}})}o(je,"runSmokeCheck");var R=class{static{o(this,"Context7Service")}async install(e="claude"){if(e==="codex")return this.installCodex();if(e!=="claude")return{installed:!1,verified:!1,configPath:"",message:`Context7 auto-config not supported for ${e}; skipping`};let n=Y(),r=a.dirname(n);await d.mkdir(r,{recursive:!0});let i=await z(n),s=i.mcpServers||{},c=Z,u=s.context7;return u&&JSON.stringify(u)===JSON.stringify(c)?{installed:!0,verified:!1,configPath:n,message:"Context7 MCP already configured"}:(s.context7=c,i.mcpServers=s,await P(n,i),l.value=null,{installed:!0,verified:!1,configPath:n,message:"Context7 MCP configured"})}async installCodex(){let e=await U();return e.changed&&(l.value=null),{installed:!0,verified:!1,configPath:e.path,message:e.skipped==="user-managed"?"Context7 MCP user-managed in config.toml":"Context7 MCP configured in config.toml"}}async resolveConfigured(e){if(e==="codex"){let c=C();return await q(c)?{ok:!0,configPath:c}:{ok:!1,configPath:c,message:"Context7 MCP not configured in ~/.codex/config.toml"}}if(e!=="claude")return{ok:!1,configPath:"",message:`Context7 not managed for ${e}`};let n=Y(),s=((await z(n)).mcpServers||{}).context7;return!s?.command||!Array.isArray(s.args)||s.args.length===0?{ok:!1,configPath:n,message:"Context7 MCP not configured in ~/.claude/mcp.json"}:{ok:!0,configPath:n}}async verify(e="claude"){let n=Date.now();if(l.value&&l.value.provider===e&&n-l.value.at<864e5)return l.value.status;let r=await ge();if(r?.status.verified&&r.provider===e&&n-r.at<864e5)return l.value=r,r.status;let i=await this.resolveConfigured(e);if(!i.ok)return{installed:!1,verified:!1,configPath:i.configPath,message:i.message};try{await je();let s={installed:!0,verified:!0,configPath:i.configPath};return l.value={at:n,provider:e,status:s},await he(n,e,s),s}catch(s){let c={installed:!0,verified:!1,configPath:i.configPath,message:`Context7 smoke check failed: ${g(s)}`};return l.value={at:n,provider:e,status:c},c}}async ensureReady(e="claude"){await this.install(e);let n=await this.verify(e);if(!n.verified){let r=n.message||"Context7 MCP is required but not ready. Run `prjct start` to repair configuration.";throw new Error(r)}return n}},ye=new R,et=ye;export{h as a,S as b,Oe as c,Ne as d,Je as e,U as f,Q as g,Pe as h,et as i};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{a as u}from"./chunk-GAOQHD5S.mjs";import{a as r}from"./chunk-E66B27AL.mjs";import{readSync as c}from"node:fs";import{isatty as d}from"node:tty";var p=new Set(["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse"]);function T(e,t){return{hookSpecificOutput:{hookEventName:e,permissionDecision:"deny",permissionDecisionReason:a(t)}}}r(T,"buildDenyOutput");function f(e){let t=(e??"claude").trim().toLowerCase();return t==="gemini"||t==="codex"||t==="cursor"||t==="kimi"?t:"claude"}r(f,"hookHostFrom");function g(){return f(process.env.PRJCT_HOOK_HOST)}r(g,"currentHookHost");function m(e,t=g()){return t==="claude"||t==="codex"||!e||Object.keys(e).length===0?e:t==="gemini"?h(e):t==="cursor"?k(e):t==="kimi"?l(e):e}r(m,"adaptHookOutputForHost");function l(e){if(e.hookSpecificOutput?.permissionDecision==="deny")return e;let n=e;return n.hookSpecificOutput?.additionalContext?n.hookSpecificOutput.additionalContext:n.systemMessage?n.systemMessage:e}r(l,"adaptForKimi");function h(e){let t=e;if(t.hookSpecificOutput?.permissionDecision==="deny")return{decision:"deny",reason:t.hookSpecificOutput.permissionDecisionReason??"blocked by prjct"};let n=e,o=n.hookSpecificOutput;return o?.additionalContext?{hookSpecificOutput:{hookEventName:y(o.hookEventName),additionalContext:o.additionalContext}}:n.systemMessage?{systemMessage:n.systemMessage}:e}r(h,"adaptForGemini");function k(e){let t=e;if(t.hookSpecificOutput?.permissionDecision==="deny")return{decision:"deny",reason:t.hookSpecificOutput.permissionDecisionReason??"blocked by prjct",permissionDecision:"deny",permissionDecisionReason:t.hookSpecificOutput.permissionDecisionReason??"blocked by prjct"};let n=e,o=n.hookSpecificOutput;return o?.additionalContext?{hookSpecificOutput:{hookEventName:S(o.hookEventName),additional_context:o.additionalContext},additional_context:o.additionalContext}:n.systemMessage?{systemMessage:n.systemMessage}:e}r(k,"adaptForCursor");function y(e){switch(e){case"UserPromptSubmit":return"BeforeAgent";case"PreToolUse":return"BeforeTool";case"PostToolUse":return"AfterTool";case"Stop":return"AfterAgent";default:return e}}r(y,"mapClaudeEventToGemini");function S(e){switch(e){case"SessionStart":return"sessionStart";case"UserPromptSubmit":return"beforeSubmitPrompt";case"PreToolUse":return"preToolUse";case"PostToolUse":return"postToolUse";case"Stop":return"stop";case"SubagentStart":return"subagentStart";case"SubagentStop":return"subagentStop";default:return e.charAt(0).toLowerCase()+e.slice(1)}}r(S,"mapClaudeEventToCursor");function O(e){if(d(0))return Buffer.alloc(0);try{process.stdin.fd}catch{}let t=Date.now()+e,n=new Int32Array(new SharedArrayBuffer(4)),o=Buffer.alloc(65536),i=[];for(;;)try{let s=c(0,o,0,o.length,null);if(s===0)break;i.push(Buffer.from(o.subarray(0,s)))}catch(s){if(s.code==="EAGAIN"&&Date.now()<t){Atomics.wait(n,0,0,1);continue}break}return Buffer.concat(i)}r(O,"readStdinRaw");function C(){try{let e=O(200).toString("utf-8").trim();return e?JSON.parse(e):{}}catch{return{}}}r(C,"readStdinSafe");function w(e){let t=m(e);process.stdout.write(typeof t=="string"?`${t}
|
|
9
|
+
`:`${JSON.stringify(t)}
|
|
10
|
+
`)}r(w,"emit");function D(){w({})}r(D,"emitEmpty");async function v(e){try{await e()}catch{D()}}r(v,"safeRun");var b=new Set(["this","that","with","from","have","your","please","would","about","there","these","those","what","when","where","which","while","will","been","were","they","them","their","que","como","cuando","donde","porque","para","pero","por","con","sin","los","las","del","una","uno","unos","unas","este","esta","esto","estos","estas","eso","esos","esas","mas","muy","todo","toda","todos","todas","sobre","entre","hasta","desde","hace","hacer","tiene","tienen","debe","deben","puede","pueden","estan","ser","son","algo","ahora","aqui","bien","cada","dale"]);function E(e,t=8){let n=u(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2")).toLowerCase(),o=new Set,i=[];for(let s of n.split(/[^\p{L}\p{N}]+/u))if(!(s.length<3)&&!b.has(s)&&!o.has(s)&&(o.add(s),i.push(s),i.length>=t))break;return i}r(E,"extractKeywords");function a(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD")}r(a,"stripLoneSurrogates");function A(e,t,n=`
|
|
11
|
+
\u2026 [truncated]`){if(e.length<=t)return e;let o=Math.max(0,t-n.length),i=e.charCodeAt(o-1),s=i>=55296&&i<=56319?o-1:o;return e.slice(0,Math.max(0,s))+n}r(A,"safeTruncate");function N(e,t){if(!t)return{};let n=a(t);return p.has(e)?{hookSpecificOutput:{hookEventName:e,additionalContext:n}}:{systemMessage:n}}r(N,"buildHookOutput");export{T as a,g as b,m as c,O as d,C as e,w as f,v as g,E as h,A as i,N as j};
|
|
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{a as E}from"./chunk-
|
|
8
|
+
import{a as E}from"./chunk-ETTDRXQ6.mjs";import{a as m,b as l,c as y}from"./chunk-FZS3XGEA.mjs";import{d as s,g as v}from"./chunk-TKXOMN4K.mjs";import{b as u,c as p,h as S}from"./chunk-A6K4H3YT.mjs";import{a as d}from"./chunk-E66B27AL.mjs";import{z as t}from"zod";var T=t.enum(["low","medium","high"]),R=t.enum(["pending","converted","completed","archived","dormant"]),I=t.enum(["high","medium","low"]),P=t.object({impact:I,effort:I}),f=t.object({frontend:t.string().optional(),backend:t.string().optional(),payments:t.string().optional(),ai:t.string().optional(),deploy:t.string().optional(),other:t.array(t.string()).optional()}),A=t.object({name:t.string(),description:t.string()}),D=t.object({name:t.string(),description:t.string().optional()}),O=t.object({id:t.string(),text:t.string(),details:t.string().optional(),priority:T,status:R,tags:t.array(t.string()),addedAt:t.string(),completedAt:t.string().optional(),convertedTo:t.string().optional(),source:t.string().optional(),sourceFiles:t.array(t.string()).optional(),painPoints:t.array(t.string()).optional(),solutions:t.array(t.string()).optional(),filesAffected:t.array(t.string()).optional(),impactEffort:P.optional(),implementationNotes:t.string().optional(),stack:f.optional(),modules:t.array(A).optional(),roles:t.array(D).optional(),risks:t.array(t.string()).optional(),risksCount:t.number().optional()}),h=t.object({ideas:t.array(O),lastUpdated:t.string()});S();v();function o(n){let e=(()=>{if(!n.tags)return[];try{let i=JSON.parse(n.tags);return Array.isArray(i)?i:[]}catch{return[]}})(),r={...(()=>{if(!n.data)return{};try{return JSON.parse(n.data)}catch{return{}}})(),id:n.id,text:n.text,status:n.status,priority:n.priority,tags:e,addedAt:n.added_at};return n.converted_to!=null&&(r.convertedTo=n.converted_to),n.details!=null&&(r.details=n.details),r}d(o,"rowToIdea");var g=class extends E{static{d(this,"IdeasStorage")}constructor(){super("ideas.json",h)}getDefault(){return{ideas:[],lastUpdated:""}}getEventType(e){return`ideas.${e}d`}async getAll(e){return s.query(e,"SELECT * FROM ideas ORDER BY added_at DESC").map(o)}async getPending(e){return s.query(e,"SELECT * FROM ideas WHERE status = 'pending' ORDER BY added_at DESC").map(o)}async addIdea(e,a,r={}){let i={id:m(),text:a,status:"pending",priority:r.priority||"medium",tags:r.tags||[],addedAt:u()};return s.run(e,`INSERT INTO ideas (id, text, status, priority, tags, added_at, converted_to, details, data)
|
|
9
9
|
VALUES (?, ?, ?, ?, ?, ?, NULL, NULL, NULL)`,i.id,i.text,i.status,i.priority,i.tags.length?JSON.stringify(i.tags):null,i.addedAt),await this.publishEvent(e,"idea.created",{ideaId:i.id,text:i.text,priority:i.priority}),i}async upsertIdea(e,a){s.run(e,`INSERT INTO ideas (id, text, status, priority, tags, added_at)
|
|
10
10
|
VALUES (?, ?, ?, ?, NULL, ?)
|
|
11
11
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{c as L}from"./chunk-
|
|
8
|
+
import{c as L}from"./chunk-TF6PN7IB.mjs";import{e as g}from"./chunk-XYKVWO23.mjs";import{b as m}from"./chunk-PVCEWFHS.mjs";import{d as y,g as R}from"./chunk-TKXOMN4K.mjs";import{b as M,h as j}from"./chunk-A6K4H3YT.mjs";import{b as x}from"./chunk-GCKILEXJ.mjs";import{a as l}from"./chunk-E66B27AL.mjs";R();j();var A=6;function v(e,t=A){let r=[],u=new Set,o=l((s,i,a)=>{let p=D(s);if(!p||p.length<12)return;let c=p.toLowerCase();u.has(c)||(u.add(c),r.push({rule:p,sourceId:i,kind:a}))},"push");for(let s of e.filter(i=>i.type==="feedback")){if(r.length>=t)break;o(s.content,s.id,"preference")}for(let s of e.filter(i=>i.type==="improvement-signal"&&i.tags?.source==="friction-detector")){if(r.length>=t)break;let i=N(s.content)??T(s.content);i&&o(i,s.id,"friction")}return r}l(v,"extractDeveloperRules");function D(e){return e.replace(/\s+/g," ").trim().replace(/^[-*•]\s+/,"")}l(D,"normalizeRule");function N(e){return e.match(/^Next action:\s*(.+)$/im)?.[1]?.trim()||null}l(N,"extractNextAction");function T(e){let t=e.split(`
|
|
9
9
|
`).map(u=>u.trim())[0]??"",r=t.match(/^\[[^\]]+\]\s+Lesson:\s*(.+)$/i);return r?.[1]?r[1].trim():/^\[[^\]]+\]/.test(t)&&t.length>20?t:null}l(T,"extractLesson");var _="memory:l0-index",E=4e3,C=1440*60*1e3,k=3,F=4,P=2,I={minTeaser:20,maxTeaser:80},S=["decision","gotcha","anti-pattern","learning","fact","feedback"];function X(e){try{let t=B(e);return t?(y.setDoc(e.projectId,_,t),t):null}catch{return null}}l(X,"buildAndStoreMemoryL0Index");function B(e){let t=m.allEntriesForIndex(e.projectId).filter(n=>x(n)||n.type==="inbox"||n.type==="improvement-signal");if(t.length===0)return null;let r={};for(let n of t)r[n.type]=(r[n.type]??0)+1;if(t.filter(n=>n.type!=="improvement-signal"&&x(n)).length===0&&(r.inbox??0)===0)return null;let o=["## What this project already knows","","> Carried across sessions and model updates \u2014 this survived even if your conversation context did not. Apply these; do not re-derive from source.","",`_L0 index \xB7 live=${t.length} \xB7 pull L2: \`prjct search\` / \`prjct context memory <topic>\` / \`prjct guard <file>\`_`,""],s=new Set;try{let n=m.recall(e.projectId,{types:["feedback","improvement-signal"],limit:40,dedupeByKey:!1}),d=v(n,F);if(d.length>0){o.push("**How this developer works (act as them):**");for(let f of d){let w=f.rule.length>140?`${f.rule.slice(0,139)}\u2026`:f.rule;o.push(`- ${w} \`${f.sourceId}\``)}o.push("")}}catch{}let i=[{title:"Traps to avoid",types:["gotcha","anti-pattern"],suppressMiss:!0},{title:"Decisions in force",types:["decision"],suppressMiss:!0},{title:"Learnings",types:["learning"]},{title:"Facts",types:["fact"]}];for(let n of i){let d=L.rerank(e.projectId,m.recall(e.projectId,{types:n.types,limit:k*4})).slice(0,k);if(d.length!==0){o.push(`**${n.title}:**`);for(let f of d)o.push(`- ${g(f,I)}`),n.suppressMiss&&s.add(f.id);o.push("")}}let a=O(e.projectId,s);a&&o.push("**Keeps being missed:**",`- ${g(a.entry,I)} \u2014 flagged relevant-but-unused ${a.count}\xD7. Apply it or supersede it.`,"");let p=t.filter(n=>n.type==="inbox").slice(0,3),c=r.inbox??0;if(c>0){o.push(`**Inbox (${c}):**`);for(let n of p)o.push(`- ${g(n,I)}`);c>p.length&&o.push(`- \u2026 +${c-p.length} more`),o.push("",'> Close resolved: `prjct close <id> --reason "\u2026"`. Forget noise: `prjct forget <id>`.',"")}let b=S.filter(n=>(r[n]??0)>0).map(n=>`${n}=${r[n]}`).concat(Object.keys(r).filter(n=>!S.includes(n)&&(r[n]??0)>0).sort().slice(0,8).map(n=>`${n}=${r[n]}`));b.length>0&&o.push(`_Counts: ${b.join(" \xB7 ")}_`,""),o.push("> Resolve any `mem_id` with `prjct search <id>`. Full developer model: MCP `prjct_developer`. Consolidate: `prjct dream`. Never stuff L2 into L0.");let h=o.join(`
|
|
10
10
|
`),$=h.length>E?`${h.slice(0,E-20).trimEnd()}
|
|
11
11
|
\u2026(truncated)`:h;return{version:1,builtAt:M(),projectId:e.projectId,live:t.length,byType:r,markdown:$,source:e.source??"manual"}}l(B,"buildMemoryL0Index");function H(e){try{let t=y.getDoc(e,_);return!t||t.version!==1||!t.markdown?null:t}catch{return null}}l(H,"loadMemoryL0Index");function K(e,t=Date.now()){if(!e?.builtAt)return!1;let r=Date.parse(e.builtAt);return Number.isFinite(r)?t-r<=C:!1}l(K,"isMemoryL0IndexFresh");function oe(e,t={}){try{let r=H(e),u=(!r||!K(r))&&t.rebuildIfStale!==!1?X({projectId:e,source:"session-start"}):r;return u?.markdown?.trim()?u.markdown.trim():null}catch{return null}}l(oe,"memoryL0IndexForSession");function O(e,t){try{let r=m.recall(e,{types:["improvement-signal"],tags:{kind:"skill-miss"},limit:50,dedupeByKey:!1}),u=new Map;for(let p of r){let c=p.tags?.relates;c&&u.set(c,(u.get(c)??0)+1)}let o=[...u].sort((p,c)=>c[1]-p[1])[0];if(!o||o[1]<P||t.has(o[0]))return null;let[s,i]=o,a=m.getById(e,s);return a?{entry:a,count:i}:null}catch{return null}}l(O,"findRepeatMissedEntry");export{v as a,_ as b,E as c,C as d,X as e,B as f,H as g,K as h,oe as i,O as j};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{p as j,t as L,u as I}from"./chunk-A6K4H3YT.mjs";import{a as A,b as a,c as S}from"./chunk-JQE2F2RK.mjs";import{i as R,k,o as E}from"./chunk-UH4MD3F3.mjs";import{c as M}from"./chunk-EXVL2OFE.mjs";import{a as O}from"./chunk-SYHDEUVU.mjs";import{d as N,e as G}from"./chunk-IJ523YO2.mjs";import{e as l,f as b}from"./chunk-BUDZL4DW.mjs";import{a as c,e as C}from"./chunk-E66B27AL.mjs";b();E();I();import s from"node:fs/promises";import o from"node:path";import P from"node:fs/promises";import D from"node:path";b();E();var y='<!-- prjct:start - DO NOT REMOVE THIS MARKER -->\n# p/ \u2014 Project knowledge layer\n\nprjct stores project memory (decisions, learnings, gotchas, patterns, ships, analyses) per project in SQLite and serves it to you through tools. **Query it \u2014 don\'t re-read source from scratch.**\n\nprjct remembers and shows the path; it does not own execution. Treat prjct output as durable signals (task state, memories, specs, workflows, risks, recent learnings). Claude, GPT, and other agents decide the concrete HOW with their own native tools and judgment, then persist meaningful outcomes back to prjct.\n\nYou are in a prjct project when `.prjct/` is in cwd OR `~/.prjct-cli/projects/` has an entry for the current path.\n\n## Lookup FIRST, source LAST\n\nBefore reading source code or running broad searches for ANY question about the project (architecture, conventions, decisions, recent ships, bugs, patterns, tech debt, past analyses), QUERY prjct first \u2014 bounded, ranked answers from SQLite, no markdown trees to wade through:\n\n- `prjct context memory <topic>` / `prjct search "<q>"` \u2014 captured decisions, gotchas, learnings, facts\n- `prjct context --md` \u2014 current state: active cycle, ships, recent learnings\n- architecture / conventions / patterns / anti-patterns / tech-debt / insights \u2192 MCP `prjct_analysis` (add `mode:archive` for history)\n- developer preferences \u2192 MCP `prjct_developer`; machine signals \u2192 MCP `prjct_signals`\n- specs \u2192 MCP `prjct_spec_list` / `prjct_spec_get`; per-file traps before editing \u2192 `prjct guard <file>`\n\nOnly fall through to source/repo reading when prjct does not contain the answer.\n\n**Skill \u2260 project identity.** The prjct skill is a portable multi-LLM contract (L0). Live name/stack/branch come from SessionStart + `prjct context --md` for **this cwd**. If skill text and the tree disagree, trust the cwd and the tree.\n\n## Capture analyses BACK to prjct\n\nWhen you complete substantive work \u2014 analysis, decision, learning, gotcha \u2014 persist it: `prjct remember <decision|learning|gotcha|fact> "..."` or `prjct capture "<text>" --tags k:v`. **Author every entry in ENGLISH**, whatever language the user speaks. **Default to capturing \u2014 under-capture is the failure mode that makes prjct useless.** The full verb map and task workflow live in the `prjct` skill.\n\n## Where things live\n\n- Source of truth: SQLite at `~/.prjct-cli/projects/<id>/` (don\'t read directly \u2014 use `prjct` CLI / MCP tools)\n- Project config: `.prjct/prjct.config.json` in repo root\n\n**Auto-managed by prjct-cli** | https://prjct.app\n<!-- prjct:end - DO NOT REMOVE THIS MARKER -->\n';async function v(d){let t=(I(),C(L)),e=d??await t.getActiveProvider(),i=e.name;if(d){if(!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"}}else if(!(await t.detectProvider(i)).installed&&!e.configDir)return{success:!1,error:`${e.displayName} not detected`,action:"skipped"};try{await P.mkdir(e.configDir,{recursive:!0});let n=D.join(e.configDir,e.contextFile),m=await(async()=>{if(i==="claude")return y;let u=M(`global/${e.contextFile}`);if(u)return u;let{PACKAGE_ROOT:g}=(G(),C(N)),T=D.join(g,"templates","global",e.contextFile);return P.readFile(T,"utf-8").catch(()=>i==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await R(n),p="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",x=(()=>{if(!r.content.includes(p)||!r.content.includes(f))return r.content;let u=r.content.substring(0,r.content.indexOf(p)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(u+g).replace(/\n{3,}/g,`
|
|
9
|
+
|
|
10
|
+
`).trim()}
|
|
11
|
+
`})(),h=O(r.exists?x:"",m,"<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");return r.exists&&r.content===h.content?{success:!0,action:"unchanged",path:n}:(await P.writeFile(n,h.content,"utf-8"),{success:!0,action:h.action,path:n})}catch(n){return{success:!1,error:l(n),action:"failed"}}}c(v,"installGlobalConfig");S();async function rt(d){return v(d)}c(rt,"installGlobalConfig");var w=class{static{c(this,"CommandInstaller")}commandsPath="";configPath="";_initialized=!1;async ensureInit(t){if(this._initialized)return;let e=t??await j();this.configPath=e.configDir??"",this.commandsPath=this.configPath?o.join(this.configPath,"commands"):"",this._initialized=!0}async detectActiveProvider(t){return await this.ensureInit(t),k(this.configPath)}async installCommands(){let t=await this.detectActiveProvider(),e=await j();return t?(await this.cleanupRouter(),{success:!0,installed:[],path:this.commandsPath}):{success:!1,error:`${e.displayName} not detected. Please install it first.`}}async uninstallCommands(){try{let t=[];await this.ensureInit();for(let e of["p.md","p.toml"]){let i=o.join(this.commandsPath,e);try{await s.unlink(i),t.push(e)}catch(n){if(n.code!=="ENOENT")return{success:!1,error:l(n)}}}return{success:!0,uninstalled:t}}catch(t){return{success:!1,error:l(t)}}}async checkInstallation(){return await this.detectActiveProvider()?{installed:!0,providerDetected:!0,commands:[],path:this.commandsPath}:{installed:!1,providerDetected:!1}}async getInstallPath(){return await this.ensureInit(),this.commandsPath}async syncCommands(t){if(!await this.detectActiveProvider(t))return{success:!1,error:"AI agent not detected",added:0,updated:0,removed:0};try{return{success:!0,added:0,updated:0,removed:await this.cleanupRouter()?1:0}}catch(i){return{success:!1,error:l(i),added:0,updated:0,removed:0}}}async cleanupRouter(){return await this.ensureInit(),(await Promise.all(["p.md","p.toml"].map(async e=>{try{return await s.unlink(o.join(this.commandsPath,e)),!0}catch{return!1}}))).some(Boolean)}async cleanupLegacyCommands(){await this.ensureInit();let t=o.join(this.commandsPath,"p");try{if((await s.stat(t).catch(()=>null))?.isDirectory())return await s.rm(t,{recursive:!0,force:!0}),!0}catch{}return!1}async installGlobalConfig(t){return v(t)}async cleanupAllLegacy(){let t=A(),e=[],i=[o.join(t,".claude","commands","p.md"),o.join(t,".claude","commands","p.toml"),o.join(t,".gemini","commands","p.md"),o.join(t,".gemini","commands","p.toml")];for(let r of i)try{await s.unlink(r),e.push(r)}catch{}let n=[o.join(t,".claude","commands","p"),o.join(t,".gemini","commands","p")];for(let r of n)try{(await s.stat(r).catch(()=>null))?.isDirectory()&&(await s.rm(r,{recursive:!0,force:!0}),e.push(r))}catch{}let m=[o.join(t,".prjct-cli","config","homebrew-migrated")];for(let r of m)try{await s.unlink(r),e.push(r)}catch{}return{cleaned:e}}};function nt(){return{claude:{commands:a(".claude","commands"),config:a(".claude"),router:a(".claude","commands","p.md")},gemini:{commands:a(".gemini","commands"),config:a(".gemini"),router:a(".gemini","commands","p.toml")}}}c(nt,"getProviderPaths");var _=new w,ot=_;export{rt as a,w as b,nt as c,ot as d};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{c as r,g as o}from"./chunk-
|
|
8
|
+
import{c as r,g as o}from"./chunk-NLL5AV2G.mjs";import{a as i}from"./chunk-E66B27AL.mjs";var s=8;function g(t,e,n=s){return o(r(t,e,n).files)}i(g,"rankLikelyFiles");function u(t,e){let n=r(t,e,s);return n.files.length===0?null:n.agentBlock||null}i(u,"buildIndexedFileCue");export{g as a,u as b};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{b as Tt}from"./chunk-QOQZHR3E.mjs";import{a as bt,b as Pt,c as Ct,d as xt,e as Dt}from"./chunk-TXJT3G53.mjs";import{a as St}from"./chunk-UMJ5D5I6.mjs";import{a as Ze}from"./chunk-JZDZH6IV.mjs";import{a as Xe}from"./chunk-XV2LJVYB.mjs";import{a as et}from"./chunk-YHOZTAZH.mjs";import{a as tt,b as Mt}from"./chunk-Y3RHBU2R.mjs";import{a as wt,b as kt}from"./chunk-NLL5AV2G.mjs";import{d as vt}from"./chunk-UVATSTRF.mjs";import{a as jt,b as At,c as It,d as Et}from"./chunk-LNB2GLYI.mjs";import{a as p}from"./chunk-DYHYDHCW.mjs";import{a as gt}from"./chunk-JR542RI2.mjs";import{b as Y,c as it,d as ct}from"./chunk-CPR4FPXG.mjs";import{a as lt,b as dt,e as ut,f as mt,g as ie,h as pt,i as ft}from"./chunk-3HGQPUKG.mjs";import{a as ht}from"./chunk-ZQI4TJ5C.mjs";import{i as yt}from"./chunk-IWUF2LGO.mjs";import{a as ot}from"./chunk-YLOK4WRR.mjs";import{b as st,c as nt,d as at}from"./chunk-3CKNJ5RA.mjs";import{b as ae}from"./chunk-R4ILCXKE.mjs";import{a as rt}from"./chunk-LR24AIEW.mjs";import{a as oe,b as I}from"./chunk-D7DQABWO.mjs";import{a as Qe}from"./chunk-ETTDRXQ6.mjs";import{c as Ye}from"./chunk-FZS3XGEA.mjs";import{b as Ke}from"./chunk-7WO5CEH3.mjs";import{a as Be,b as qe}from"./chunk-M5E2YOZ4.mjs";import{b as F}from"./chunk-ZZBNFNMG.mjs";import{d as b,e as R,g as K}from"./chunk-TKXOMN4K.mjs";import{d as ne}from"./chunk-KV4NXLPT.mjs";import{b as v,h as se,p as We,r as Ve,u as Tr,v as q,w as Ue}from"./chunk-A6K4H3YT.mjs";import{b as ze,f as Er}from"./chunk-HDSS6UB3.mjs";import{d as He,e as Le,f as Ge,k as N,o as B}from"./chunk-UH4MD3F3.mjs";import{a as Oe,p as Ir}from"./chunk-QWQFF2UG.mjs";import{a as Je}from"./chunk-EXVL2OFE.mjs";import{d as w}from"./chunk-PKDYFXMI.mjs";import{a as M,d as Ne,e as k,f as O}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";function Rt(r,e){let t=[];H("Languages",r.languages,e.languages,t),H("Frameworks",r.frameworks,e.frameworks,t),(r.packageManager??"")!==(e.packageManager??"")&&t.push({field:"Package manager",type:"changed",before:r.packageManager??"(none)",after:e.packageManager??"(none)"}),(r.sourceDir??"")!==(e.sourceDir??"")&&t.push({field:"Source directory",type:"changed",before:r.sourceDir??"(none)",after:e.sourceDir??"(none)"}),(r.testDir??"")!==(e.testDir??"")&&t.push({field:"Test directory",type:"changed",before:r.testDir??"(none)",after:e.testDir??"(none)"}),H("Config files",r.configFiles,e.configFiles,t),r.fileCount!==e.fileCount&&t.push({field:"File count",type:"changed",before:String(r.fileCount),after:String(e.fileCount)});let s=r.patterns.map(c=>c.name),a=e.patterns.map(c=>c.name);H("Patterns",s,a,t);let o=r.antiPatterns.map(c=>c.issue),n=e.antiPatterns.map(c=>c.issue);return H("Anti-patterns",o,n,t),gt(t,r.commitHash??null,e.commitHash??null)}i(Rt,"generateAnalysisDiff");function Cs(r){if(!r.hasChanges)return`## Analysis Diff
|
|
9
|
+
|
|
10
|
+
No changes between runs.`;let e=[];e.push("## Analysis Diff"),(r.beforeCommit||r.afterCommit)&&e.push(`> \`${r.beforeCommit?.substring(0,7)??"(none)"}\` \u2192 \`${r.afterCommit?.substring(0,7)??"(none)"}\``),e.push(""),e.push("| Change | Field | Detail |"),e.push("|--------|-------|--------|");for(let s of r.items){let a=s.type==="added"?"+":s.type==="removed"?"-":"~",o=s.type==="changed"?`${s.before} \u2192 ${s.after}`:s.after??s.before??"";e.push(`| ${a} | ${s.field} | ${o} |`)}e.push("");let t=[];return r.summary.added>0&&t.push(`${r.summary.added} added`),r.summary.removed>0&&t.push(`${r.summary.removed} removed`),r.summary.changed>0&&t.push(`${r.summary.changed} changed`),e.push(`**Summary**: ${t.join(", ")}`),e.join(`
|
|
11
|
+
`)}i(Cs,"formatAnalysisDiffMd");function xs(r){if(!r.hasChanges)return"No changes between analysis runs.";let e=[];(r.beforeCommit||r.afterCommit)&&(e.push(` ${r.beforeCommit?.substring(0,7)??"(none)"} \u2192 ${r.afterCommit?.substring(0,7)??"(none)"}`),e.push(""));for(let t of r.items)t.type==="added"?e.push(` + ${t.field}: ${t.after}`):t.type==="removed"?e.push(` - ${t.field}: ${t.before}`):e.push(` ~ ${t.field}: ${t.before} \u2192 ${t.after}`);return e.join(`
|
|
12
|
+
`)}i(xs,"formatAnalysisDiffText");function H(r,e,t,s){let a=new Set(e),o=new Set(t);for(let n of t)a.has(n)||s.push({field:r,type:"added",after:n});for(let n of e)o.has(n)||s.push({field:r,type:"removed",before:n})}i(H,"diffStringArray");O();B();import ce from"node:fs/promises";import E from"node:path";import{z as g}from"zod";function Q(r,e){let t=r.filter(a=>!a.passed).length,s=r.filter(a=>a.passed).length;return{passed:t===0,checks:r,totalMs:Date.now()-e,failedCount:t,passedCount:s}}i(Q,"summarizeChecks");Er();var Mr=g.enum(["draft","verified","sealed"]),Ft=g.object({severity:g.enum(["low","medium","high"]).optional(),language:g.string().optional(),framework:g.string().optional(),source:g.enum(["baseline","repo","context7","feedback"]).optional(),confidence:g.number().min(0).max(1).optional()}),Rr=g.object({name:g.string(),description:g.string(),location:g.string().optional()}).extend(Ft.shape),Fr=g.object({issue:g.string(),file:g.string(),suggestion:g.string()}).extend(Ft.shape),le=g.object({projectId:g.string(),languages:g.array(g.string()),frameworks:g.array(g.string()),packageManager:g.string().optional(),sourceDir:g.string().optional(),testDir:g.string().optional(),configFiles:g.array(g.string()),fileCount:g.number(),patterns:g.array(Rr),antiPatterns:g.array(Fr),analyzedAt:g.string(),modelMetadata:ze.optional(),status:Mr.default("draft"),commitHash:g.string().optional(),signature:g.string().optional(),sealedAt:g.string().optional(),verifiedAt:g.string().optional()});var _r={TypeScript:[".ts",".tsx",".mts",".cts"],JavaScript:[".js",".jsx",".mjs",".cjs"],Python:[".py",".pyw"],Java:[".java"],Go:[".go"],Rust:[".rs"],Ruby:[".rb"],PHP:[".php"],Swift:[".swift"],Kotlin:[".kt",".kts"],"C++":[".cpp",".cc",".cxx",".hpp",".h"],C:[".c",".h"],"C#":[".cs"],Elixir:[".ex",".exs"],Scala:[".scala"]};async function $r(r,e){let t=Date.now();if(r.frameworks.length===0)return{name:"Framework verification",passed:!0,output:"No frameworks declared (skipped)",durationMs:Date.now()-t};try{let s=E.join(e,"package.json"),a=await ce.readFile(s,"utf-8"),o=JSON.parse(a),n={...o.dependencies,...o.devDependencies},c=[],l=[];for(let d of r.frameworks){let m=d.toLowerCase();Object.keys(n).some(y=>y.toLowerCase().includes(m))?l.push(d):c.push(d)}return c.length===0?{name:"Framework verification",passed:!0,output:`${l.length} framework(s) verified in dependencies`,durationMs:Date.now()-t}:{name:"Framework verification",passed:!1,error:`Frameworks not found in dependencies: ${c.join(", ")}`,durationMs:Date.now()-t}}catch(s){return M(s)?{name:"Framework verification",passed:!1,error:"package.json not found (cannot verify frameworks)",durationMs:Date.now()-t}:{name:"Framework verification",passed:!1,error:`Failed to read package.json: ${s instanceof Error?s.message:"unknown error"}`,durationMs:Date.now()-t}}}i($r,"verifyFrameworks");async function Or(r,e){let t=Date.now();if(r.languages.length===0)return{name:"Language verification",passed:!0,output:"No languages declared (skipped)",durationMs:Date.now()-t};try{let s=await Gr(e),a=new Set(s),o=[],n=[];for(let c of r.languages){let l=_r[c];if(!l)continue;l.some(m=>a.has(m))?o.push(c):n.push(c)}return n.length===0?{name:"Language verification",passed:!0,output:`${o.length} language(s) verified with matching files`,durationMs:Date.now()-t}:{name:"Language verification",passed:!1,error:`Languages without matching files: ${n.join(", ")}`,durationMs:Date.now()-t}}catch(s){return{name:"Language verification",passed:!1,error:`Failed to scan project files: ${s instanceof Error?s.message:"unknown error"}`,durationMs:Date.now()-t}}}i(Or,"verifyLanguages");async function Nr(r,e){let t=Date.now(),s=r.patterns.filter(n=>n.location);if(s.length===0)return{name:"Pattern location verification",passed:!0,output:"No pattern locations specified (skipped)",durationMs:Date.now()-t};let a=[],o=[];for(let n of s){let c=n.location,l=E.join(e,c);await N(l)?o.push(c):a.push(`${n.name} (${c})`)}return a.length===0?{name:"Pattern location verification",passed:!0,output:`${o.length} pattern location(s) verified`,durationMs:Date.now()-t}:{name:"Pattern location verification",passed:!1,error:`Pattern locations not found: ${a.join(", ")}`,durationMs:Date.now()-t}}i(Nr,"verifyPatternLocations");async function Hr(r,e){let t=Date.now();try{let s=await zr(e),a=r.fileCount,o=.1,n=Math.abs(s-a),c=a*o;return n<=c?{name:"File count verification",passed:!0,output:`File count accurate (declared: ${a}, actual: ${s})`,durationMs:Date.now()-t}:{name:"File count verification",passed:!1,error:`File count mismatch: declared ${a}, actual ${s} (diff: ${n})`,durationMs:Date.now()-t}}catch(s){return{name:"File count verification",passed:!1,error:`Failed to count files: ${s instanceof Error?s.message:"unknown error"}`,durationMs:Date.now()-t}}}i(Hr,"verifyFileCount");async function Lr(r,e){let t=Date.now();if(r.antiPatterns.length===0)return{name:"Anti-pattern file verification",passed:!0,output:"No anti-patterns declared (skipped)",durationMs:Date.now()-t};let s=[],a=[];for(let o of r.antiPatterns){let n=E.join(e,o.file);await N(n)?a.push(o.file):s.push(`${o.issue} (${o.file})`)}return s.length===0?{name:"Anti-pattern file verification",passed:!0,output:`${a.length} anti-pattern file(s) verified`,durationMs:Date.now()-t}:{name:"Anti-pattern file verification",passed:!1,error:`Anti-pattern files not found: ${s.join(", ")}`,durationMs:Date.now()-t}}i(Lr,"verifyAntiPatternFiles");async function _t(r,e){let t=Date.now(),s=await Promise.all([$r(r,e),Or(r,e),Nr(r,e),Hr(r,e),Lr(r,e)]);return Q(s,t)}i(_t,"semanticVerify");async function Gr(r){let e=new Set,t=[/node_modules/,/\.git/,/dist/,/build/,/\.next/,/\.turbo/,/coverage/];async function s(a){try{let o=await ce.readdir(a,{withFileTypes:!0});for(let n of o){let c=E.join(a,n.name),l=E.relative(r,c);if(!t.some(d=>d.test(l))){if(n.isDirectory())await s(c);else if(n.isFile()){let d=E.extname(n.name);d&&e.add(d)}}}}catch{}}return i(s,"scanDir"),await s(r),Array.from(e)}i(Gr,"getProjectExtensions");async function zr(r){let e=[/node_modules/,/\.git/,/dist/,/build/,/\.next/,/\.turbo/,/coverage/];async function t(s){try{let a=await ce.readdir(s,{withFileTypes:!0});return(await Promise.all(a.map(async n=>{let c=E.join(s,n.name),l=E.relative(r,c);return e.some(d=>d.test(l))?0:n.isDirectory()?t(c):n.isFile()?1:0}))).reduce((n,c)=>n+c,0)}catch{return 0}}return i(t,"scanDir"),t(r)}i(zr,"countProjectFiles");se();var de=class extends Qe{static{i(this,"AnalysisStorage")}constructor(){super("analysis.json")}getDefault(){return{draft:null,sealed:null,previousSealed:null,lastUpdated:""}}getEventType(e){return`analysis.${e}d`}async saveDraft(e,t){let s={...t,status:"draft"};le.parse(s),await this.update(e,a=>({...a,draft:s,lastUpdated:v()})),this.publishAnalysis(e,s)}publishAnalysis(e,t){Ke({projectId:e,entityType:"analysis",entityId:e,eventType:"upsert",data:{...t,id:e}})}async seal(e){let t=await this.read(e);if(!t.draft)return{success:!1,error:"No draft analysis to seal. Run `p. sync` first."};if(t.draft.status==="sealed")return{success:!1,error:"Draft is already sealed."};let s=this.computeSignature(t.draft),a=v(),o={...t.draft,status:"sealed",signature:s,sealedAt:a};return le.parse(o),await this.write(e,{draft:null,sealed:o,previousSealed:t.sealed,lastUpdated:a}),this.publishAnalysis(e,o),{success:!0,signature:s}}async getSealed(e){return(await this.read(e)).sealed}async getDraft(e){return(await this.read(e)).draft}async getActive(e){let t=await this.read(e);return t.sealed??t.draft}async getStatus(e){let t=await this.read(e);return{hasSealed:t.sealed!==null,hasDraft:t.draft!==null,hasPreviousSealed:t.previousSealed!==null,sealedCommit:t.sealed?.commitHash??null,draftCommit:t.draft?.commitHash??null,previousSealedCommit:t.previousSealed?.commitHash??null,sealedAt:t.sealed?.sealedAt??null}}async rollback(e){let t=await this.read(e);if(!t.previousSealed)return{success:!1,error:"No previous sealed version to rollback to."};let s=v();return await this.write(e,{draft:t.sealed,sealed:t.previousSealed,previousSealed:null,lastUpdated:s}),this.publishAnalysis(e,t.previousSealed),{success:!0,restoredSignature:t.previousSealed.signature}}async diff(e){let t=await this.read(e);return!t.sealed||!t.draft?null:Rt(t.sealed,t.draft)}checkStaleness(e,t){return e?t?e!==t?{isStale:!0,sealedCommit:e,currentCommit:t,message:`Analysis is stale: sealed at ${e}, HEAD is ${t}. Run \`p. sync\` + \`p. seal\` to update.`}:{isStale:!1,sealedCommit:e,currentCommit:t,message:"Analysis is current."}:{isStale:!0,sealedCommit:e,currentCommit:null,message:"Cannot determine current commit. Analysis may be stale."}:{isStale:!1,sealedCommit:null,currentCommit:t,message:"No sealed analysis. Run `p. sync` then `p. seal`."}}async verify(e){let t=await this.read(e);if(!t.sealed)return{valid:!1,message:"No sealed analysis to verify."};if(!t.sealed.signature)return{valid:!1,message:"Sealed analysis has no signature."};let s=this.computeSignature({...t.sealed,signature:void 0,sealedAt:void 0});return s===t.sealed.signature?{valid:!0,message:"Signature verified. Analysis integrity confirmed."}:{valid:!1,message:`Signature mismatch. Expected ${s}, got ${t.sealed.signature}. Analysis may have been modified.`}}async semanticVerify(e,t){let s=await this.read(e),a=s.sealed??s.draft;return a?await _t(a,t):{passed:!1,checks:[{name:"Analysis availability",passed:!1,error:"No analysis available. Run `p. sync` to generate.",durationMs:0}],totalMs:0,failedCount:1,passedCount:0}}computeSignature(e){let t={projectId:e.projectId,languages:e.languages,frameworks:e.frameworks,packageManager:e.packageManager,sourceDir:e.sourceDir,testDir:e.testDir,configFiles:e.configFiles,fileCount:e.fileCount,patterns:e.patterns,antiPatterns:e.antiPatterns,analyzedAt:e.analyzedAt,commitHash:e.commitHash};return Be(JSON.stringify(t))}},X=new de;import ws from"node:fs/promises";import te from"node:path";Tr();Ue();B();import ue from"node:fs/promises";import $t from"node:path";import{gunzipSync as Wr,gzipSync as Vr}from"node:zlib";Ue();K();var Ur="code-graph.json.gz";function Ot(r){return $t.join(q.getGlobalProjectPath(r),Ur)}i(Ot,"artifactPath");async function Jr(r){if(!ie(r))return null;let e=ft(r),t=dt(r),s=pt(r)??{symbolCount:e.length,edgeCount:t.length,fileCount:new Set(e.map(l=>l.file)).size,builtAt:new Date().toISOString()},a={version:1,projectId:r,exportedAt:new Date().toISOString(),meta:s,symbols:e,edges:t},o=Buffer.from(JSON.stringify(a),"utf-8"),n=Vr(o,{level:6}),c=Ot(r);return await ue.mkdir($t.dirname(c),{recursive:!0}),await ue.writeFile(c,n),{path:c,bytes:n.length,symbols:e.length,edges:t.length}}i(Jr,"exportCodeGraphArtifact");async function Br(r){let e=Ot(r),t=await ue.readFile(e).catch(()=>null);if(!t)return{imported:!1,symbols:0,edges:0,reason:"no per-project artifact"};let s=(()=>{try{let o=Wr(t).toString("utf-8");return{payload:JSON.parse(o)}}catch(o){return{error:`corrupt artifact: ${o instanceof Error?o.message:String(o)}`}}})();if("error"in s)return{imported:!1,symbols:0,edges:0,reason:s.error};let a=s.payload;return a.version!==1||!Array.isArray(a.symbols)?{imported:!1,symbols:0,edges:0,reason:"unsupported artifact version"}:a.projectId&&a.projectId!==r?{imported:!1,symbols:0,edges:0,reason:`artifact projectId mismatch (got ${a.projectId}, expected ${r})`}:(lt(r,{symbols:a.symbols,edges:a.edges}),R.setDoc(r,"symbol-graph",{...a.meta,builtAt:a.meta.builtAt??a.exportedAt}),{imported:!0,symbols:a.symbols.length,edges:a.edges.length})}i(Br,"importCodeGraphArtifact");async function Nt(r){if(ie(r))return{bootstrapped:!1,detail:"local index already present"};let e=await Br(r);return e.imported?{bootstrapped:!0,detail:`imported ${e.symbols} symbols / ${e.edges} edges from per-project cache`}:{bootstrapped:!1,detail:e.reason??"import failed"}}i(Nt,"bootstrapCodeGraphFromArtifact");function Ht(r){return r?.cloud?.enabled===!0&&r.cloud.paused!==!0}i(Ht,"shouldAutoUploadCodeGraph");async function Lt(r,e){try{await Jr(r)}catch{}if(e.uploadToCloud)try{await qr(r,e.uploadDependencies)}catch{}}i(Lt,"maybeExportAfterIndex");async function qr(r,e={}){let t=await import("./code-graph-cloud-XGQF7XYC.mjs"),s=(e.buildSnapshot??t.buildCloudCodeGraphSnapshot)(r);if(!t.isUploadableGraph(s))return{uploaded:!1,reason:"no symbol index or empty graph"};try{let o=await(e.upload??(async(n,c)=>{let{default:l}=await import("./sync-client-PIRHMHXL.mjs");return l.uploadCodeGraph(n,c)}))(r,s);return o.ok?{uploaded:!0,nodes:o.nodes??s.nodes.length,links:o.links??s.links.length}:{uploaded:!1,reason:o.reason??"upload failed or unauthenticated",nodes:s.nodes.length,links:s.links.length}}catch(a){return{uploaded:!1,reason:a instanceof Error?a.message:String(a)}}}i(qr,"maybeUploadCodeGraphToCloud");import _ from"node:fs/promises";import Kr from"node:os";import x from"node:path";var me=[{name:"prjct",description:bt,allowedTools:[...Pt],body:i(()=>xt(),"body"),reference:i(()=>Dt(),"reference"),referenceFile:Ct}];function Yr(r){let e=r.userInvocable!==!1;return`---
|
|
13
|
+
description: "${r.description}"
|
|
14
|
+
allowed-tools: [${r.allowedTools.map(t=>`"${t}"`).join(", ")}]
|
|
15
|
+
user-invocable: ${e}
|
|
16
|
+
---`}i(Yr,"buildFrontmatter");function Qr(r){return`${Yr(r)}
|
|
17
|
+
|
|
18
|
+
${r.body()}`}i(Qr,"buildSkillContent");function Gt(){return process.env.HOME||Kr.homedir()}i(Gt,"homeDir");function Xr(){return x.join(Gt(),".claude","skills")}i(Xr,"claudeSkillsRoot");function Zr(){let r=Gt();return[x.join(r,".codex","skills"),x.join(r,".gemini","skills"),x.join(r,".gemini","antigravity","global_skills"),x.join(r,".agents","skills")]}i(Zr,"compactSkillRoots");function es(r){return!!(/^# [^\n]+\n[^\n]*\|\s*\d+\s+files\s*\|/m.test(r)||/## Recent Deliveries/m.test(r)||/## Velocity/m.test(r)&&/pts\/sprint/m.test(r))}i(es,"skillBodyHasProjectStamp");var pe=class{static{i(this,"SkillGenerator")}async generateAndInstall(){let e={generated:[],skipped:[]},t=Xr();for(let o of me)try{let n=Qr(o);if(es(n))throw new Error("refusing to install project-stamped skill body (isolation guard)");let c=x.join(t,o.name),l=x.join(c,"SKILL.md");await _.mkdir(c,{recursive:!0}),await _.writeFile(l,n,"utf-8"),o.reference&&o.referenceFile&&await _.writeFile(x.join(c,o.referenceFile),o.reference(),"utf-8"),e.generated.push({name:o.name,path:l})}catch(n){p.debug(`Failed to generate skill ${o.name}`,{error:w(n)}),e.skipped.push({name:o.name,reason:w(n)})}let s=Je();for(let o of Zr())try{let n=x.join(o,"prjct"),c=x.join(n,"SKILL.md");await _.mkdir(n,{recursive:!0}),await _.writeFile(c,s,"utf-8"),e.generated.push({name:"prjct-compact",path:c})}catch(n){p.debug("Compact skill install skipped",{root:o,error:w(n)})}let a=new Set(me.map(o=>o.name));try{let o=await _.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of o)n.isDirectory()&&n.name.startsWith("prjct-")&&!a.has(n.name)&&await _.rm(x.join(t,n.name),{recursive:!0,force:!0}).catch(()=>{})}catch{}return e.generated.length>0&&p.info("Generated portable multi-host skills",{count:e.generated.length,skills:e.generated.map(o=>o.name)}),e}getDefinitions(){return me}},zt=new pe;function fe(){return{branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0}}i(fe,"emptyGitData");function ge(){return{fileCount:0,version:"0.0.0",name:"unknown",ecosystem:"unknown",projectType:"simple",languages:[],frameworks:[]}}i(ge,"emptyStats");function he(){return{install:"npm install",run:"npm run",test:"npm test",build:"npm run build",dev:"npm run dev",lint:"npm run lint",format:"npm run format"}}i(he,"emptyCommands");function ye(){return{hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]}}i(ye,"emptyStack");function Wt(r,e){let t=[...r.added,...r.modified],s=new Set(t),a=new Set,o=Y(e);if(o)for(let l of t){let d=o.reverse[l];if(d)for(let m of d)s.has(m)||a.add(m)}let n=Array.from(a),c=[...t,...n];return{directlyChanged:t,affectedByImports:n,deleted:r.deleted,allAffected:c}}i(Wt,"propagateChanges");function Vt(r){let e=new Set;for(let t of r){let s=t.toLowerCase();(s.endsWith(".tsx")||s.endsWith(".jsx")||s.endsWith(".css")||s.endsWith(".scss")||s.endsWith(".vue")||s.endsWith(".svelte")||s.includes("/components/")||s.includes("/pages/")||s.includes("/app/"))&&(e.add("frontend"),e.add("uxui")),(s.includes(".test.")||s.includes(".spec.")||s.includes("__tests__")||s.includes("/test/"))&&e.add("testing"),(s.includes("dockerfile")||s.includes("docker-compose")||s.includes(".dockerignore")||s.includes(".github/")||s.includes("ci/")||s.includes("cd/"))&&e.add("devops"),(s.endsWith(".sql")||s.includes("prisma")||s.includes("drizzle")||s.includes("migration")||s.includes("/db/"))&&e.add("database"),(s.endsWith(".ts")||s.endsWith(".js"))&&!s.includes(".test.")&&!s.includes(".spec.")&&!s.endsWith(".d.ts")&&e.add("backend")}return e}i(Vt,"affectedDomains");K();B();import Ut from"node:fs/promises";import ts from"node:path";function rs(r){return typeof Bun<"u"&&Bun.hash?`xxh64:${Bun.hash(r).toString(36)}`:`fnv1a:${([...r].reduce((t,s)=>Math.imul(t^s.charCodeAt(0),16777619),2166136261)>>>0).toString(36)}`}i(rs,"hashContent");async function ss(r,e={}){let t=await He(r,{skipDotfiles:!0,dotfileAllowlist:[".env.example"]}),s=new Map,a=e.changedFilesHint?.length?new Set(e.changedFilesHint):null,o=await Le(t,100,async n=>{try{let c=ts.join(r,n),l=await Ut.stat(c),d=l.mtime.toISOString(),m=e.storedHashes?.get(n),h=a?.has(n)??!1;if(m&&!h&&m.size===l.size&&m.mtime===d&&m.hash)return{path:n,hash:m.hash,size:l.size,mtime:d};let y=await Ut.readFile(c,"utf-8");return{path:n,hash:rs(y),size:l.size,mtime:d}}catch{return null}});for(let n of o)s.set(n.path,n);return s}i(ss,"computeHashes");function ns(r,e){let t=[],s=[],a=[];for(let[n,c]of r){let l=e.get(n);l?l.hash!==c.hash?s.push(n):a.push(n):t.push(n)}let o=[];for(let n of e.keys())r.has(n)||o.push(n);return{added:t,modified:s,deleted:o,unchanged:a}}i(ns,"diffHashes");function Se(r,e){let t=R.getDb(r);t.transaction(()=>{t.prepare("DELETE FROM index_checksums").run();let s=t.prepare("INSERT INTO index_checksums (path, checksum, size, mtime) VALUES (?, ?, ?, ?)");for(let[,a]of e)s.run(a.path,a.hash,a.size,a.mtime)})(),R.setDoc(r,"file-hashes-meta",{fileCount:e.size,builtAt:new Date().toISOString()})}i(Se,"saveHashes");function as(r){let e=new Map;try{let t=R.query(r,"SELECT path, checksum, size, mtime FROM index_checksums");for(let s of t)e.set(s.path,{path:s.path,hash:s.checksum,size:s.size||0,mtime:s.mtime||""})}catch{}return e}i(as,"loadHashes");async function we(r,e,t){let s=as(e),a=await ss(r,{storedHashes:s,changedFilesHint:t});return{diff:ns(a,s),currentHashes:a}}i(we,"detectChanges");function Jt(r){return R.hasDoc(r,"file-hashes-meta")}i(Jt,"hasHashRegistry");O();var os=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]);async function Bt(r){let{projectId:e,projectPath:t,isFullSync:s,changedFilesHint:a}=r,o={shouldRebuildIndexes:!0,changedDomains:new Set,incrementalInfo:void 0,changedSourceFiles:[],deletedSourceFiles:[]};if(!s&&Jt(e)){try{let{diff:n,currentHashes:c}=await we(t,e,a),l=n.added.length+n.modified.length+n.deleted.length,d=(()=>{if(l===0&&!a?.length)return{shouldRebuildIndexes:!1,changedDomains:new Set,incrementalInfo:{isIncremental:!0,filesChanged:0,filesUnchanged:n.unchanged.length,indexesRebuilt:!1,affectedDomains:[]},changedSourceFiles:[],deletedSourceFiles:[]};let m=Wt(n,e),h=Vt(m.allAffected),y=m.allAffected.some(ke);return{shouldRebuildIndexes:y,changedDomains:h,incrementalInfo:{isIncremental:!0,filesChanged:l,filesUnchanged:n.unchanged.length,indexesRebuilt:y,affectedDomains:Array.from(h)},changedSourceFiles:[...n.added,...n.modified].filter(ke),deletedSourceFiles:n.deleted.filter(ke)}})();return l>0&&Se(e,c),d}catch(n){p.debug("Incremental detection failed, falling back to full sync",{error:k(n)})}return o}try{let{currentHashes:n}=await we(t,e,a);Se(e,n)}catch(n){p.debug("Hash computation failed (non-critical)",{error:k(n)})}return o}i(Bt,"detectIncrementalChanges");function ke(r){let e=r.substring(r.lastIndexOf("."));return os.has(e)}i(ke,"isSourceFile");import{z as j}from"zod";var En=j.object({date:j.string(),tokensSaved:j.number(),syncs:j.number(),avgCompressionRate:j.number(),totalDuration:j.number()}),Tn=j.object({agentName:j.string(),usageCount:j.number(),tokensSaved:j.number()}),qt={"claude-opus-4.5":.005,"claude-sonnet-4.5":.003,"claude-haiku-4.5":.001,"claude-opus-4":.015,"claude-sonnet-4":.003,"gpt-4o":.0025,"gemini-pro":.00125,default:.003};function Kt(r,e="default"){let t=qt[e]||qt.default;return r/1e3*t}i(Kt,"estimateCostSaved");function Mn(r){return r<.01?`$${(r*100).toFixed(2)}\xA2`:`$${r.toFixed(2)}`}i(Mn,"formatCost");K();var is=i(r=>({date:r.date,tokensSaved:r.tokens_saved,syncs:r.syncs,avgCompressionRate:r.avg_compression_rate,totalDuration:r.total_duration}),"rowToDaily"),Z=i(r=>{let e=new Date;return e.setDate(e.getDate()-r),e.toISOString().split("T")[0]},"dayCutoff"),ve=class{static{i(this,"MetricsStorage")}async recordSync(e,t){let s=Math.max(0,t.originalSize-t.filteredSize),a=t.originalSize>0?s/t.originalSize:0,o=new Date().toISOString().split("T")[0];if(b.run(e,`INSERT INTO metrics_daily (date, tokens_saved, syncs, avg_compression_rate, total_duration)
|
|
19
|
+
VALUES (?, ?, 1, ?, ?)
|
|
20
|
+
ON CONFLICT(date) DO UPDATE SET
|
|
21
|
+
tokens_saved = metrics_daily.tokens_saved + excluded.tokens_saved,
|
|
22
|
+
avg_compression_rate =
|
|
23
|
+
(metrics_daily.avg_compression_rate * metrics_daily.syncs + excluded.avg_compression_rate)
|
|
24
|
+
/ (metrics_daily.syncs + 1),
|
|
25
|
+
syncs = metrics_daily.syncs + 1,
|
|
26
|
+
total_duration = metrics_daily.total_duration + excluded.total_duration`,o,s,a,t.duration),t.agents?.length){let n=Math.floor(s/t.agents.length);for(let c of t.agents)b.run(e,`INSERT INTO metrics_agent_usage (agent_name, usage_count, tokens_saved)
|
|
27
|
+
VALUES (?, 1, ?)
|
|
28
|
+
ON CONFLICT(agent_name) DO UPDATE SET
|
|
29
|
+
usage_count = metrics_agent_usage.usage_count + 1,
|
|
30
|
+
tokens_saved = metrics_agent_usage.tokens_saved + excluded.tokens_saved`,c,n)}}async getSummary(e){let t=b.get(e,`SELECT COALESCE(SUM(tokens_saved), 0) AS tokens,
|
|
31
|
+
COALESCE(SUM(syncs), 0) AS syncs,
|
|
32
|
+
COALESCE(SUM(total_duration), 0) AS duration,
|
|
33
|
+
COALESCE(SUM(avg_compression_rate * syncs), 0) AS weighted_rate
|
|
34
|
+
FROM metrics_daily`),s=t?.syncs??0,a=t?.tokens??0,o=i((m,h)=>b.get(e,h?"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 >= ?",...h?[m,h]:[m])?.t??0,"rangeTokens"),n=o(Z(30)),c=o(Z(60),Z(30)),l=c>0?(n-c)/c*100:0,d=b.query(e,"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:Kt(a),compressionRate:s>0?(t?.weighted_rate??0)/s:0,syncCount:s,avgSyncDuration:s>0?(t?.duration??0)/s:0,topAgents:d,last30DaysTokens:n,trend:l}}async getDailyStats(e,t=30){return b.query(e,"SELECT * FROM metrics_daily WHERE date >= ? ORDER BY date ASC",Z(t)).map(is)}async getFirstSyncDate(e){return b.get(e,"SELECT MIN(date) AS d FROM metrics_daily")?.d??""}},Yt=new ve;O();se();import cs from"node:path";function ls(r){return qe(cs.resolve(r))}i(ls,"repoHash");function L(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"")}i(L,"normalizeKey");function ds(r){return ae(r,e=>`${L(e.name)}::${L(e.source)}`)}i(ds,"dedupePatterns");function us(r){return ae(r,e=>`${L(e.issue)}::${L(e.file)}::${L(e.source)}`)}i(us,"dedupeAntiPatterns");var be=class{static{i(this,"PatternExtractor")}async extract(e){let t=ls(e.projectPath),s=[];if(e.context7Verified)for(let l of e.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=(e.feedback?.patternsDiscovered||[]).map(l=>({name:l,description:`Confirmed during completed tasks: ${l}`,source:"feedback",confidence:.75})),o=(e.feedback?.knownGotchas||[]).map(l=>({issue:l,file:"multiple",suggestion:`Recurring gotcha. Prevent this pattern during implementation: ${l}`,source:"feedback",severity:"medium",confidence:.7})),n=ds([...s,...a]),c=us([...o]);return{patterns:n,antiPatterns:c,repoPathHash:t}}},ms=new be,Qt=ms;var Xt=200;async function Zt(r,e,t){let{bm25Index:s,originalSize:a}=(()=>{try{let d=st(r),m=d?Object.values(d.documents).reduce((h,y)=>h+y.length,0):0;return{bm25Index:d,originalSize:m||e.fileCount*Xt}}catch(d){return p.debug("Could not load BM25 index for metrics",{error:k(d)}),{bm25Index:null,originalSize:e.fileCount*Xt}}})(),o=0,n=a>0?Math.max(0,(a-o)/a):0;try{await Yt.recordSync(r,{originalSize:a,filteredSize:o,duration:t,isWatch:!1})}catch(d){p.debug("Failed to record sync metrics",{error:k(d)})}try{let{velocityStorage:d}=await import("./velocity-storage-IOCVK2LU.mjs");await d.recompute(r)}catch(d){p.debug("Failed to recompute velocity",{error:k(d)})}let c=await import("./developer-evolution-UTY3CWOK.mjs").then(({captureDeveloperSnapshot:d})=>d(r)).catch(d=>(p.debug("Failed to capture dev snapshot",{error:k(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=Y(r);m&&(l.importEdges=m.edgeCount,l.importFiles=m.fileCount);let h=wt(r);h&&(l.cochangeCommits=h.commitsAnalyzed,l.cochangeFiles=h.filesAnalyzed)}catch(d){p.debug("Could not load index stats",{error:k(d)})}return{duration:t,originalSize:a,filteredSize:o,compressionRate:n,indexes:l,developerSnapshotCaptured:c}}i(Zt,"recordSyncMetrics");async function er(r,e,t,s,a,o){try{let n=t.recentCommits[0]?.hash||null,c=await I.getAggregatedFeedback(r).catch(()=>{});try{let{refreshSkillIndex:d}=await import("./skill-index-55I3HLAI.mjs");await d(r,e)}catch{}let l=await Qt.extract({projectId:r,projectPath:e,languages:s.languages,frameworks:Array.from(new Set([...s.frameworks,...a.frameworks])),feedback:c,context7Verified:o});await X.saveDraft(r,{projectId:r,languages:s.languages,frameworks:s.frameworks,configFiles:[],fileCount:s.fileCount,patterns:l.patterns,antiPatterns:l.antiPatterns,analyzedAt:v(),status:"draft",commitHash:n??void 0})}catch(n){p.debug("Failed to save draft analysis (non-critical)",{error:k(n)})}}i(er,"saveDraftAnalysis");async function tr(r){try{let[e,t,s,a,o]=await Promise.all([Xe.archiveOldShipped(r).catch(()=>0),Ze.markDormantIdeas(r).catch(()=>0),et.removeStaleCompleted(r).catch(()=>0),I.archiveStalePausedTasks(r).catch(()=>[]),rt.capEntries(r).catch(()=>0)]),n=e+t+s+a.length+o;if(n>0){p.info("Archived stale data",{shipped:e,dormant:t,staleQueue:s,stalePaused:a.length,memoryCapped:o,total:n});let c=Ye.getStats(r);p.debug("Archive stats",c)}}catch(e){p.debug("Archival failed (non-critical)",{error:k(e)})}}i(tr,"archiveStaleData");var fs=6e4,Pe=class extends Error{static{i(this,"SyncPhaseTimeoutError")}phase;timeoutMs;constructor(e,t){super(`sync phase '${e}' timed out after ${t}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=e,this.timeoutMs=t}};function gs(){return Number(process.env.PRJCT_SYNC_PHASE_TIMEOUT_MS)||fs}i(gs,"syncPhaseTimeoutMs");function rr(r,e){let t=gs(),s=(()=>{let a=Promise.withResolvers(),o=setTimeout(()=>a.reject(new Pe(e,t)),t);return{promise:a.promise,cancel:i(()=>clearTimeout(o),"cancel")}})();return Promise.race([r,s.promise]).finally(s.cancel)}i(rr,"withPhaseTimeout");async function sr(r,e,t){let s=Date.now();p.debug("sync phase start",{phase:r});try{let a=await e(),o=Date.now()-s;return p.debug("sync phase done",{phase:r,ms:o}),t?.push({phase:r,ms:o}),a}catch(a){let o=Date.now()-s;throw p.debug("sync phase failed",{phase:r,ms:o,error:w(a)}),t?.push({phase:r,ms:o}),a}}i(sr,"runSyncPhase");function Ce(r,e={}){let t=e.now??Date.now,s=t(),o=(()=>{try{return r().then(()=>({}),n=>({error:n}))}catch(n){return Promise.resolve({error:n})}})().then(n=>{try{e.onComplete?.({totalMs:t()-s,...n})}catch{}});return{async settle(){await o}}}i(Ce,"startPostIndexWork");K();import hs from"node:fs/promises";import ys from"node:path";O();se();O();B();import xe from"node:fs/promises";import ee from"node:path";var De=".prjct/.prjct-state.md",je=class{static{i(this,"LocalStateGenerator")}async generate(e,t){let s=ee.join(e,De);await xe.mkdir(ee.dirname(s),{recursive:!0});let a=this.toMarkdown(t);await xe.writeFile(s,a,"utf-8")}async remove(e){try{await xe.unlink(ee.join(e,De))}catch(t){if(!M(t))throw t}}async exists(e){let t=ee.join(e,De);return N(t)}toMarkdown(e){let t=["<!-- Auto-generated by prjct - DO NOT EDIT -->","<!-- This file provides local state persistence for AI tools -->","","# prjct State",""];if(e.currentTask){let s=e.currentTask;if(t.push("## Current Work Cycle"),t.push(""),t.push(`**${s.description}**`),t.push(""),t.push(`- Started: ${s.startedAt}`),s.linearId&&t.push(`- Linear: ${s.linearId}`),s.branch&&t.push(`- Branch: ${s.branch}`),t.push(`- Status: ${s.status||"active"}`),t.push(""),s.subtasks&&s.subtasks.length>0){t.push("### Subtasks"),t.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**":"";t.push(`${l+1}. ${d} ${c.description}${m}`)}),t.push("");let a=s.subtasks.filter(c=>c.status==="completed").length,o=s.subtasks.length,n=Math.round(a/o*100);t.push(`**Progress**: ${a}/${o} (${n}%)`),t.push("")}}else t.push("*No active work cycle*"),t.push(""),t.push('Start work with `p. work "intent"`'),t.push("");if(e.previousTask){let s=e.previousTask;t.push("---"),t.push(""),t.push("## Previous Work Cycle"),t.push(""),t.push(`**${s.description}**`),t.push(""),t.push(`- Status: ${s.status}`),s.prUrl&&t.push(`- PR: ${s.prUrl}`),t.push("")}return t.push("---"),t.push(`*Last updated: ${e.lastUpdated||new Date().toISOString()}*`),t.push(""),t.join(`
|
|
35
|
+
`)}},nr=new je;var Ss=["storage","context","memory","analysis","config","sync"];async function ar(r){try{await Promise.all(Ss.map(e=>hs.mkdir(ys.join(r,e),{recursive:!0})))}catch(e){throw new Error(Ne(e,r,"project directories"))}}i(ar,"ensureProjectDirectories");async function or(r){let{projectId:e,projectPath:t,cliVersion:s,git:a,stats:o}=r,n=b.getDoc(e,"project")||{},c={...n,projectId:e,repoPath:t,name:o.name,version:o.version,cliVersion:s,techStack:o.frameworks,fileCount:o.fileCount,commitCount:a.commits,stack:o.ecosystem,currentBranch:a.branch,hasUncommittedChanges:a.hasChanges,createdAt:n.createdAt||v(),lastSync:v(),lastSyncCommit:a.recentCommits[0]?.hash||null,lastSyncBranch:a.branch};b.setDoc(e,"project",c)}i(or,"updateProjectDoc");async function ir(r){let{projectId:e,projectPath:t,stats:s,stack:a}=r,n={...await I.read(e)};n.projectId=e,n.stack={language:s.languages[0]||"Unknown",framework:s.frameworks[0]||null},n.domains={hasFrontend:a.hasFrontend,hasBackend:a.hasBackend,hasDatabase:a.hasDatabase,hasTesting:a.hasTesting,hasDocker:a.hasDocker},n.projectType=s.projectType,n.metrics={totalFiles:s.fileCount},n.lastSync=v(),n.lastUpdated=v(),n.context={...n.context||{},lastSession:v(),lastAction:"Synced project",nextAction:'Run `p. work "intent"` to start a work cycle'},await I.write(e,n);try{await nr.remove(t)}catch(c){p.debug("Legacy local state cleanup failed (optional)",{error:k(c)})}}i(ir,"updateStateDoc");function cr(r,e,t){b.appendEvent(r,"sync",{branch:e.branch,uncommitted:e.hasChanges,fileCount:t.fileCount,commitCount:e.commits})}i(cr,"logSyncEvent");import lr from"node:fs/promises";import Ae from"node:path";O();Ir();var dr={async jsonFilesValid(r){let e=Date.now(),t=[],s=Ae.basename(r);try{await I.read(s)}catch(a){M(a)||t.push(`state: ${k(a)}`)}return{name:"State data valid",passed:t.length===0,output:t.length===0?"1 store validated":void 0,error:t.length>0?t.join("; "):void 0,durationMs:Date.now()-e}},async noSensitiveData(r){let e=Date.now(),t=Ae.join(r,"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 o=await lr.readdir(t);for(let n of o){if(!n.endsWith(".md"))continue;let c=await lr.readFile(Ae.join(t,n),"utf-8");for(let l of s)if(l.test(c)){a.push(`${n}: potential sensitive data detected`);break}}}catch(o){if(!M(o))return{name:"No sensitive data",passed:!1,error:`Could not scan: ${k(o)}`,durationMs:Date.now()-e}}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()-e}}},Ie=class{static{i(this,"SyncVerifier")}async verify(e,t,s){let a=Date.now(),o=[],n=s?.failFast??!1,c=[],l=[dr.jsonFilesValid(t),dr.noSensitiveData(t)];for(let m of l){let h=await m;if(o.push(h),!h.passed&&n){c.push(...s?.checks?.filter(y=>y.enabled!==!1).map(y=>y.name)??[]);break}}if((!n||o.every(m=>m.passed))&&s?.checks)for(let m of s.checks){if(m.enabled===!1){c.push(m.name);continue}let h=await this.runCustomCheck(m,e);if(o.push(h),!h.passed&&n){let y=s.checks.slice(s.checks.indexOf(m)+1);c.push(...y.filter(P=>P.enabled!==!1).map(P=>P.name));break}}return{...Q(o,a),skippedCount:c.length}}async runCustomCheck(e,t){let s=Date.now(),a=e.command||(e.script?`sh ${e.script}`:null);if(!a)return{name:e.name,passed:!1,error:"No command or script specified",durationMs:Date.now()-s};try{let{stdout:o,stderr:n}=await Oe(a,{cwd:t,timeout:3e4});return{name:e.name,passed:!0,output:(o.trim()||n.trim()).slice(0,200)||void 0,durationMs:Date.now()-s}}catch(o){let n=o;return{name:e.name,passed:!1,error:(n.stderr?.trim()||n.message).slice(0,200),durationMs:Date.now()-s}}}},ur=new Ie;var Ee=class{static{i(this,"SyncService")}projectPath;projectId=null;globalPath="";cliVersion="0.0.0";constructor(){this.projectPath=process.cwd()}async sync(e=process.cwd(),t={}){this.projectPath=e;let s=Date.now(),a=[],o=i((l,d)=>sr(l,d,a),"phase"),n={installed:!1,verified:!1,configPath:"",message:""},c=[];try{if(this.projectId=await F.getProjectId(e),!this.projectId)return{success:!1,projectId:"",cliVersion:"",git:fe(),stats:ge(),commands:he(),stack:ye(),context7:{installed:!1,verified:!1},error:"No prjct project. Run p. init first."};if(this.globalPath=q.getGlobalProjectPath(this.projectId),this.cliVersion=await this.getCliVersion(),await ws.rm(te.join(this.globalPath,"agents"),{recursive:!0,force:!0}).catch(()=>{}),(await Ve()).installed){let u=await vt({autoRepair:!0});u.verified||p.warn(`Codex p. router not ready: ${u.message||"verification failed"}`)}await o("mcp-defaults",()=>St({silent:!0,verifyContext7:!1}));let d=await We().catch(()=>null),m=d?.name??"claude";try{Object.assign(n,await o("context7",()=>yt.ensureReady(m)))}catch(u){let f=w(u);p.warn(`Context7 MCP not ready (continuing sync): ${f}`),Object.assign(n,{verified:!1,message:f})}await ar(this.globalPath),process.env.PRJCT_SKIP_CREW_SWEEP!=="1"&&await o("legacy-crew-sweep",async()=>{try{let{legacyCrewSweep:u}=await import("./legacy-crew-sweep-GR6HRSHX.mjs"),f=await u(this.projectPath,this.projectId);(f.checkpointsMigrated||f.teamMigrated||f.checkpointsHandEditWarned||f.teamHandEditWarned||f.ghostDirsPurged.length>0||f.agentFilesRepaired.length>0||f.clientPrjctJunkPurged.length>0||f.errors.length>0)&&p.info("Legacy crew sweep ran",{checkpointsMigrated:f.checkpointsMigrated,teamMigrated:f.teamMigrated,checkpointsHandEditWarned:f.checkpointsHandEditWarned,teamHandEditWarned:f.teamHandEditWarned,ghostDirsPurged:f.ghostDirsPurged,agentFilesRepaired:f.agentFilesRepaired,ghostFilesIngested:f.ghostFilesIngested,clientPrjctJunkPurged:f.clientPrjctJunkPurged,errors:f.errors.length})}catch(u){p.debug("Legacy crew sweep failed (non-critical)",{error:w(u)})}});let[y,P,Re,G]=await o("gather",()=>rr(Promise.all([jt(this.projectPath),At(this.projectPath),It(this.projectPath),Et(this.projectPath)]),"gather")),{shouldRebuildIndexes:fr,changedDomains:bs,incrementalInfo:Fe,changedSourceFiles:z,deletedSourceFiles:W}=await o("incremental",()=>Bt({projectId:this.projectId,projectPath:this.projectPath,isFullSync:t.full===!0,changedFilesHint:t.changedFiles}));try{let{refreshFileInventory:u}=await import("./project-file-inventory-HHURZTMH.mjs");await u(this.projectId,this.projectPath)}catch{}try{await Nt(this.projectId)}catch{}fr&&await o("index",async()=>{try{let u=Fe?.isIncremental&&(z.length>0||W.length>0);await Promise.all([u?at(this.projectPath,this.projectId,z,W):nt(this.projectPath,this.projectId),u?ct(this.projectPath,this.projectId,z,W):it(this.projectPath,this.projectId),u?mt(this.projectPath,this.projectId,z,W):ut(this.projectPath,this.projectId),kt(this.projectPath,this.projectId)]);let f=this.projectId,S=this.projectPath,T=await F.readConfig(S).catch(()=>null),C=Ht(T);c.push(Ce(()=>Lt(f,{uploadToCloud:C}),{onComplete:i(({totalMs:D,error:J})=>{p.debug("sync post-index work settled",{projectId:f,uploadToCloud:C,totalMs:D,...J===void 0?{}:{error:w(J)}})},"onComplete")}))}catch(u){p.debug("File ranking index build failed (non-critical)",{error:w(u)})}});let gr=Date.now();p.debug("sync phase start",{phase:"skills"});let hr=await zt.generateAndInstall().catch(u=>{p.debug("Native skill generation failed (non-critical)",{error:w(u)})});p.debug("sync phase done",{phase:"skills",ms:Date.now()-gr}),await o("update-files",()=>Promise.all([or({projectId:this.projectId,projectPath:this.projectPath,cliVersion:this.cliVersion,git:y,stats:P}),ir({projectId:this.projectId,projectPath:this.projectPath,stats:P,stack:G}),Promise.resolve(cr(this.projectId,y,P)),er(this.projectId,this.projectPath,y,P,G,n.verified)]));let re=await X.getActive(this.projectId),yr={patterns:re?.patterns?.length||0,antiPatterns:re?.antiPatterns?.length||0,criticalAntiPatterns:re?.antiPatterns?.filter(u=>u.severity==="high").length||0},Sr=await(async()=>{try{let{recomputeProjectStyle:u,formatProjectStyleForSync:f}=await import("./project-style-evolution-IJXT2MCP.mjs"),S=await o("project-style",()=>u({projectId:this.projectId,projectPath:this.projectPath,stats:P,stack:G,commands:Re,commitHash:y.recentCommits[0]?.hash??null,source:"sync-mechanical"})),T=f(S),C=S.snapshot.payload.metrics.styleCoverage;return{summary:S.snapshot.summary,evolutionMd:T.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){p.debug("Project style recompute failed (non-critical)",{error:w(u)});return}})(),_e=[],V={},U=i((u,f,S)=>{_e.push(Ce(async()=>{S(await o(u,f))},{onComplete:i(({totalMs:T,error:C})=>{p.debug("sync floating phase settled",{phase:u,overlapped:!0,totalMs:T,...C===void 0?{}:{error:w(C)}})},"onComplete")}))},"floatPhase"),wr=Date.now()-s;U("metrics",()=>Zt(this.projectId,P,wr),u=>{V.syncMetrics=u}),U("install-global",async()=>{await ne.installGlobalConfig(d??void 0),await ne.syncCommands(d??void 0)},()=>{}),U("install-agent-surfaces",async()=>{let{detectInstalledAgents:u}=await import("./detection-QRVSNMKL.mjs"),f=await u(this.projectPath).catch(()=>[]);await ht(this.projectPath,{refreshIfAdopted:!0,agents:f})},()=>{}),U("verify",async()=>{try{let u=await F.readConfig(this.projectPath);return await ur.verify(this.projectPath,this.globalPath,u?.verification)}catch(u){p.debug("Verification failed (non-critical)",{error:w(u)});return}},u=>{V.verification=u});let kr=await o("work-cost",()=>Tt(this.projectId));await o("archive",()=>tr(this.projectId));let vr=await o("context-quality",()=>ot(this.projectPath,this.projectId)),br=await o("retention",async()=>{try{let u=await F.readConfig(this.projectPath).catch(()=>null),f=u?.retention?.mode??"apply";if(f==="off")return;let S=f==="dry-run",{applyRetention:T,triageInbox:C}=await import("./retention-RET4P2RO.mjs"),D=T(this.projectId,{dryRun:S,maxArchive:u?.retention?.maxArchive,maxDelete:u?.retention?.maxDelete}),{inboxMerged:J,inboxArchived:xr}=S?{inboxMerged:0,inboxArchived:0}:(()=>{let A=C(this.projectId);return{inboxMerged:A.merged,inboxArchived:A.archived}})(),{runVaultPurge:Dr,vaultHealth:jr}=await import("./purge-N2WN6NDB.mjs"),$=await Dr(this.projectId,{projectPath:this.projectPath,dryRun:S,softDeletedPurgeDays:u?.retention?.softDeletedPurgeDays,archivePruneDays:u?.retention?.archivePruneDays,autoSourceMaxLive:u?.retention?.autoSourceMaxLive}),Ar=jr(this.projectId);return{evaluated:D.evaluated,active:D.active,archive:D.wouldArchive,delete:D.wouldDelete,archived:D.archived,deleted:D.deleted,inboxMerged:J,inboxArchived:xr,dryRun:S,samples:D.samples.map(A=>({id:A.id,type:A.type,verdict:A.verdict,score:A.score,reasons:A.reasons,excess:A.excess})),referenceSize:D.referenceSize,vault:{...Ar,softDeletedPurged:$.softDeletedPurged,orphanEventsPurged:$.orphanEventsPurged,archivesPruned:$.archivesPruned,autoSourceTrimmed:$.autoSourceTrimmed,distilledDiscarded:$.distilledDiscarded,digestsWritten:$.digestsWritten}}}catch(u){p.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:f}=await import("./drift-refresh-TD3PYPJN.mjs"),S=process.env.PRJCT_CLI_HOME?te.resolve(process.env.PRJCT_CLI_HOME):te.join(u.homedir(),".prjct-cli");f(S)}catch{}await Promise.all([...c.map(u=>u.settle()),..._e.map(u=>u.settle())]);let $e=V.syncMetrics,Pr=V.verification,Cr=$e?.developerSnapshotCaptured===!0;return{success:!0,projectId:this.projectId,cliVersion:this.cliVersion,git:y,stats:P,commands:Re,stack:G,context7:{installed:n.installed,verified:n.verified,message:n.message},analysisSummary:yr,contextQuality:vr,retentionDryRun:br,syncMetrics:$e,workCost:kr,verification:Pr,incremental:Fe,projectStyle:Sr,developerSnapshotCaptured:Cr,generatedSkills:hr,phaseTimings:a}}catch(l){return{success:!1,projectId:this.projectId||"",cliVersion:this.cliVersion,git:fe(),stats:ge(),commands:he(),stack:ye(),context7:{installed:n.installed,verified:n.verified,message:n.message},error:w(l)}}}async getCliVersion(){try{let e=te.join(__dirname,"..","..","package.json");return(await Ge(e))?.version||"0.0.0"}catch(e){return p.debug("Failed to read CLI version",{error:w(e)}),"0.0.0"}}},mo=new Ee;import Te from"chalk";var mr={task:"Start new work cycle",done:"Complete current work",pause:"Pause and switch context",resume:"Continue paused task",ship:"Ship the feature",reopen:"Reopen for rework",next:"View task queue",sync:"Analyze project",bug:"Report a bug",idea:"Capture an idea"},ks={task:"work"};function Me(r){return ks[r]??r}i(Me,"publicCommand");var pr={task:"working",done:"completed","done-subtask":"working",pause:"paused",resume:"working",ship:"shipped",reopen:"working",next:"idle",sync:"idle",init:"idle",bug:"working",idea:"idle"};function yo(r,e={}){if(e.quiet)return;let t=pr[r]||"idle",s=oe.getValidCommands(t);if(s.length===0)return;let a=s.map(o=>({cmd:`p. ${Me(o)}`,desc:mr[o]||o}));console.log(Te.dim(`
|
|
36
|
+
Next:`));for(let o of a){let n=Te.cyan(o.cmd.padEnd(12));console.log(Te.dim(` ${n} \u2192 ${o.desc}`))}}i(yo,"showNextSteps");function So(r,e=!1){let t=pr[r]||"idle";return oe.getValidCommands(t).map(a=>({cmd:e?`prjct ${Me(a)} --md`:`p. ${Me(a)}`,desc:mr[a]||a}))}i(So,"getNextSteps");async function vs(r,e={}){let t=await F.getProjectId(r);return t?{ok:!0,value:t}:(e.md?console.log("> No project ID found. Run `prjct init` first."):tt.failWithHint("NO_PROJECT_ID"),{ok:!1,result:{success:!1,error:"No project ID found"}})}i(vs,"requireProjectId");async function Mo(r,e={}){let t=await Mt.ensureInit(r);return t.success?vs(r,e):{ok:!1,result:t}}i(Mo,"requireProject");export{Cs as a,xs as b,X as c,Mn as d,Yt as e,mo as f,yo as g,So as h,Mo as i};
|
|
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{d as c,e as p,h as l}from"./chunk-UUULLTQV.mjs";import{b as E,c as d}from"./chunk-
|
|
8
|
+
import{d as c,e as p,h as l}from"./chunk-UUULLTQV.mjs";import{b as E,c as d}from"./chunk-FZS3XGEA.mjs";import{b as m}from"./chunk-ZZBNFNMG.mjs";import{e as i,g as R}from"./chunk-TKXOMN4K.mjs";import{a as g}from"./chunk-E66B27AL.mjs";l();R();var y=class{static{g(this,"MemoryService")}async log(t,r,n,o,s){try{let e=s?.projectId??await m.getProjectId(t);return e?{eventId:i.appendEvent(e,`memory.${r}`,{...n,author:o}),projectId:e}:null}catch(e){let a=e instanceof Error?e.message:String(e);if(s?.required)throw new Error(a);return console.error(`Memory log error: ${a}`),null}}async clear(t){try{let r=await m.getProjectId(t);if(!r)return;i.run(r,"DELETE FROM events WHERE type >= ? AND type < ?",...c)}catch(r){console.error(`Memory clear error: ${r instanceof Error?r.message:String(r)}`)}}async getRecentEvents(t,r=100){try{return i.query(t,"SELECT type, data, timestamp FROM events WHERE type >= ? AND type < ? ORDER BY id DESC LIMIT ?",...c,r).reverse().map(o=>{let s=JSON.parse(o.data);return{timestamp:o.timestamp,action:o.type.replace("memory.",""),...s}})}catch(n){return console.error(`Memory read error: ${n instanceof Error?n.message:String(n)}`),[]}}async capEntries(t){try{let n=i.get(t,"SELECT COUNT(*) as cnt FROM events WHERE type >= ? AND type < ? AND NOT (type >= ? AND type < ?)",...c,...p)?.cnt??0;if(n<=E.MEMORY_MAX_ENTRIES)return 0;let o=n-E.MEMORY_MAX_ENTRIES,s=i.query(t,"SELECT id, type, data, timestamp FROM events WHERE type >= ? AND type < ? AND NOT (type >= ? AND type < ?) ORDER BY id ASC LIMIT ?",...c,...p,o);return d.archiveMany(t,s.map((e,a)=>({entityType:"memory_entry",entityId:`memory-${e.timestamp||a}`,entityData:{type:e.type,data:JSON.parse(e.data),timestamp:e.timestamp},summary:e.type.replace("memory.",""),reason:"overflow"}))),i.transaction(t,e=>{let a=e.prepare("DELETE FROM events WHERE id = ?");for(let u of s)a.run(u.id)}),o}catch(r){return console.error(`Memory cap error: ${r instanceof Error?r.message:String(r)}`),0}}},O=new y;export{O as a};
|