prjct-cli 3.92.0 → 3.94.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/dist/bin/hook-chunks/{agent-switch-XMFUTNNV.mjs → agent-switch-2U2LOBGR.mjs} +1 -1
- package/dist/bin/hook-chunks/analysis-N4NYGIG3.mjs +42 -0
- package/dist/bin/hook-chunks/{auth-config-WNUARXTJ.mjs → auth-config-SP4PBALR.mjs} +1 -1
- package/dist/bin/hook-chunks/auto-flush-BN6L6QHO.mjs +8 -0
- package/dist/bin/hook-chunks/{auto-updater-EHRRMCYY.mjs → auto-updater-4TIXYSEX.mjs} +1 -1
- package/dist/bin/hook-chunks/capture-gate-FRF2G3IG.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-DGBDMUBL.mjs → chunk-27XFSCOE.mjs} +4 -4
- package/dist/bin/hook-chunks/chunk-2HB2JHQE.mjs +69 -0
- package/dist/bin/hook-chunks/{chunk-MAHTF6JG.mjs → chunk-3VWBNLBC.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-V37VTXDW.mjs → chunk-4KVPAHFV.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-2HTDCLZD.mjs → chunk-4O4D6DV7.mjs} +2 -2
- package/dist/bin/hook-chunks/chunk-4SKJWNKE.mjs +11 -0
- package/dist/bin/hook-chunks/{chunk-3LG3ACQV.mjs → chunk-5EQLQ7GF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-HZIORCPO.mjs → chunk-66GE3IHX.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-MEQS4VPO.mjs → chunk-6RLCUGGG.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-BISPGBNN.mjs → chunk-6UH244CC.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-7GNWHWOO.mjs +26 -0
- package/dist/bin/hook-chunks/chunk-7JEKBJAP.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-LLQUB6YR.mjs → chunk-7O6OMD4X.mjs} +2 -2
- package/dist/bin/hook-chunks/chunk-7YT2FGO7.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-XHDNPEAN.mjs → chunk-AVRNHROK.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-AZHE4VOM.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-7OZDWT6C.mjs → chunk-AZYQFRPJ.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-BCAHWZH7.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-Q5I2UPD6.mjs → chunk-C3W2HLJT.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ZX2KFQV5.mjs → chunk-D6IONKRA.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-DRGI5UHQ.mjs +10 -0
- package/dist/bin/hook-chunks/{chunk-7SI6X3Z7.mjs → chunk-EHEQOF6Z.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ZX6BC2EB.mjs → chunk-EMTCZG5I.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ZNQXFWSI.mjs → chunk-EQ5KNMLG.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-S4TB2OFJ.mjs → chunk-F4T7IAA7.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ODWWIFSN.mjs → chunk-FEFP6JOL.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-2OU2MKNS.mjs → chunk-FX6VHIKB.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-2WPR5GFT.mjs → chunk-GFY4GY3Z.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-PSSR7LSW.mjs → chunk-H4CA3XZ6.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-HHIGNKDO.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-HNEKXKOI.mjs +16 -0
- package/dist/bin/hook-chunks/{chunk-45I2C2UB.mjs → chunk-HRWXMF7P.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-AWD2AQVJ.mjs → chunk-IHECXD2M.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-IKIB42F7.mjs +31 -0
- package/dist/bin/hook-chunks/chunk-INXNK57E.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-WDGDFXSB.mjs → chunk-J6TAD3OZ.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-JAMSIKDE.mjs +9 -0
- package/dist/bin/hook-chunks/{chunk-CREPUNOS.mjs → chunk-JCYXFHQZ.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-JMCMTX6U.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-D7TRY3CO.mjs → chunk-JPSJWCFD.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-QDQ7DTDV.mjs → chunk-JR542RI2.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-JUZ5LNDI.mjs +14 -0
- package/dist/bin/hook-chunks/{chunk-HDHVBB6Q.mjs → chunk-KG7Z6OMK.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-OGOCHZ3S.mjs → chunk-KOCROTRM.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-75UJIVMO.mjs → chunk-KOGZCFBC.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-ZTZTVBAZ.mjs → chunk-LNB2GLYI.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-M5E2YOZ4.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-BZ5UR7G3.mjs → chunk-MHQTGU45.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-OL6ITIAZ.mjs → chunk-MI3JEFON.mjs} +2 -2
- package/dist/bin/hook-chunks/chunk-NBKEOLDH.mjs +18 -0
- package/dist/bin/hook-chunks/{chunk-EM6ZDJAK.mjs → chunk-NCOOKPXX.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-NHIWYDQD.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-NUJASVHN.mjs +18 -0
- package/dist/bin/hook-chunks/chunk-NWIQNII6.mjs +11 -0
- package/dist/bin/hook-chunks/{chunk-OP467HW6.mjs → chunk-NWZEBCTC.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-6EWGHM32.mjs → chunk-OENWCYLF.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-3JUE6MNF.mjs → chunk-OIU4Y5WL.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-OUAS3LZ3.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-X5RDLFPM.mjs → chunk-OWOPA2O7.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NLG2EW6M.mjs → chunk-OZJ6UKKP.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-PUHX3ECX.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-Q3EYM4GJ.mjs +19 -0
- package/dist/bin/hook-chunks/{chunk-I5BDN25C.mjs → chunk-Q3Z53QTH.mjs} +3 -3
- package/dist/bin/hook-chunks/{chunk-ZZ65CN5F.mjs → chunk-QPRNRLG6.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-QWQFF2UG.mjs +10 -0
- package/dist/bin/hook-chunks/{chunk-DMXFGLZE.mjs → chunk-QYEASMFV.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-R4ILCXKE.mjs +8 -0
- package/dist/bin/hook-chunks/{chunk-4WHS7CO7.mjs → chunk-S7HQQILD.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-SDUS2AT7.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-T2FCU3ZS.mjs +12 -0
- package/dist/bin/hook-chunks/{chunk-A5RNWWTH.mjs → chunk-TFCLMTJ5.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-AUUWQH3S.mjs → chunk-TG5CQJD5.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-CQUG6SO2.mjs → chunk-TKWAFYF7.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-YUOTOCKK.mjs → chunk-TYEAIX3X.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-AOPJ4Z6O.mjs → chunk-UA4Z5TGG.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-UH4MD3F3.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-V2BSS7HW.mjs +36 -0
- package/dist/bin/hook-chunks/{chunk-MQVVNX63.mjs → chunk-VWOIUTAX.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-NLDL3N6R.mjs → chunk-X2AGNDGD.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-5PEHJEFE.mjs → chunk-XE4MJNBQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-2NMSEZTQ.mjs → chunk-XFQ7NNLN.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-SOPRYWUY.mjs → chunk-XS45K7ZQ.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-Y3J7UUMR.mjs +47 -0
- package/dist/bin/hook-chunks/{chunk-HIFIDMH5.mjs → chunk-Y4DUB7UN.mjs} +2 -2
- package/dist/bin/hook-chunks/{chunk-6IKHMK2U.mjs → chunk-YQ55MHKL.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-DVBBB5BS.mjs → chunk-YUKGWWL7.mjs} +1 -1
- package/dist/bin/hook-chunks/chunk-ZJXH76Q5.mjs +11 -0
- package/dist/bin/hook-chunks/{chunk-TBM7736J.mjs → chunk-ZMKTR2IO.mjs} +1 -1
- package/dist/bin/hook-chunks/{chunk-54LH63LM.mjs → chunk-ZMLA5SKR.mjs} +1 -0
- package/dist/bin/hook-chunks/client-ERZ5CM3D.mjs +10 -0
- package/dist/bin/hook-chunks/code-graph-cloud-4GRWQSUK.mjs +8 -0
- package/dist/bin/hook-chunks/{codex-skill-2N6656SR.mjs → codex-skill-6DYQMPDJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{command-installer-XSKQS3IS.mjs → command-installer-MF4KUM3X.mjs} +1 -1
- package/dist/bin/hook-chunks/{config-manager-YZANYLPV.mjs → config-manager-2VZPHUDG.mjs} +1 -1
- package/dist/bin/hook-chunks/{content-bound-stamp-72EQVZLP.mjs → content-bound-stamp-OG2KKN3L.mjs} +1 -1
- package/dist/bin/hook-chunks/{context7-service-4C6VNJUS.mjs → context7-service-V7CIDF3Q.mjs} +1 -1
- package/dist/bin/hook-chunks/custom-workflow-storage-UOBQXY42.mjs +8 -0
- package/dist/bin/hook-chunks/cwd-changed-J6O46KS7.mjs +8 -0
- package/dist/bin/hook-chunks/{database-SLDTQXWG.mjs → database-XYKQF3KR.mjs} +1 -1
- package/dist/bin/hook-chunks/{delivery-geometry-VHCURJ7E.mjs → delivery-geometry-WYOEMKMO.mjs} +1 -1
- package/dist/bin/hook-chunks/detect-changes-DFRJOOB3.mjs +19 -0
- package/dist/bin/hook-chunks/{detection-MEYHME4X.mjs → detection-QRVSNMKL.mjs} +1 -1
- package/dist/bin/hook-chunks/developer-evolution-SLC34HUU.mjs +12 -0
- package/dist/bin/hook-chunks/distill-U2LJGUG3.mjs +8 -0
- package/dist/bin/hook-chunks/{editors-config-3N6VREZR.mjs → editors-config-6XFYIOE6.mjs} +1 -1
- package/dist/bin/hook-chunks/enriched-recall-X6RDNNIE.mjs +8 -0
- package/dist/bin/hook-chunks/exec-2P5VOBHM.mjs +8 -0
- package/dist/bin/hook-chunks/format-ALUX4QSI.mjs +8 -0
- package/dist/bin/hook-chunks/{git-helpers-6JLP2OJZ.mjs → git-helpers-HELM6DXJ.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-ledger-storage-UKROWRVA.mjs → judgment-ledger-storage-SCGU3URM.mjs} +1 -1
- package/dist/bin/hook-chunks/{judgment-orchestrator-UFGNBTEK.mjs → judgment-orchestrator-BYPG65RS.mjs} +1 -1
- package/dist/bin/hook-chunks/judgment-receipt-GWSSCLAB.mjs +8 -0
- package/dist/bin/hook-chunks/land-cue-MMISX2BI.mjs +9 -0
- package/dist/bin/hook-chunks/land-synthesis-WG5JAS7B.mjs +8 -0
- package/dist/bin/hook-chunks/legacy-crew-sweep-2WSO5KEB.mjs +24 -0
- package/dist/bin/hook-chunks/memory-index-QK5QJOFJ.mjs +8 -0
- package/dist/bin/hook-chunks/notification-MPVWVV52.mjs +8 -0
- package/dist/bin/hook-chunks/{pack-integrity-BKLDNYE5.mjs → pack-integrity-XRYOROK5.mjs} +1 -1
- package/dist/bin/hook-chunks/{pack-manager-ASWLKYGP.mjs → pack-manager-WWGQNJDQ.mjs} +1 -1
- package/dist/bin/hook-chunks/{package-legitimacy-HXC4L73B.mjs → package-legitimacy-MIR3VZSF.mjs} +1 -1
- package/dist/bin/hook-chunks/{path-manager-F2HE2GGK.mjs → path-manager-ZR5RAKTK.mjs} +1 -1
- package/dist/bin/hook-chunks/{planning-QBSY272P.mjs → planning-S55KBPN2.mjs} +2 -2
- package/dist/bin/hook-chunks/post-edit-QMHSZHDN.mjs +8 -0
- package/dist/bin/hook-chunks/{pr-convention-7UGI7TFA.mjs → pr-convention-5NPXQJ2R.mjs} +1 -1
- package/dist/bin/hook-chunks/pre-bash-RAM6L3G4.mjs +11 -0
- package/dist/bin/hook-chunks/pre-commit-736ZLMDL.mjs +8 -0
- package/dist/bin/hook-chunks/pre-edit-GZ4QJ2MU.mjs +11 -0
- package/dist/bin/hook-chunks/pre-package-LCIAWWGK.mjs +8 -0
- package/dist/bin/hook-chunks/pre-search-J5EOFMYN.mjs +9 -0
- package/dist/bin/hook-chunks/pre-secrets-TSUMTXHH.mjs +8 -0
- package/dist/bin/hook-chunks/{precision-judgment-WPTCNTGV.mjs → precision-judgment-TT3DRNAX.mjs} +1 -1
- package/dist/bin/hook-chunks/{prjct-md-WE6WFVL3.mjs → prjct-md-T2DG236Y.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-agent-surfaces-A6HGZPAL.mjs → project-agent-surfaces-VRY22I66.mjs} +1 -1
- package/dist/bin/hook-chunks/{project-file-inventory-ZAPKPKY6.mjs → project-file-inventory-5DEN5VLF.mjs} +1 -1
- package/dist/bin/hook-chunks/project-memory-KKEMTEMP.mjs +8 -0
- package/dist/bin/hook-chunks/project-style-evolution-7MAUSED2.mjs +8 -0
- package/dist/bin/hook-chunks/{prompt-JIOMJCGV.mjs → prompt-DVF6V2X2.mjs} +7 -7
- package/dist/bin/hook-chunks/{velocity-storage-UPW6TLK6.mjs → publish-helper-G54XQV5K.mjs} +1 -1
- package/dist/bin/hook-chunks/purge-MC5LFSAO.mjs +8 -0
- package/dist/bin/hook-chunks/retention-LWETHQX3.mjs +8 -0
- package/dist/bin/hook-chunks/sdd-5UCVX43H.mjs +10 -0
- package/dist/bin/hook-chunks/session-continuity-RKNAJJHR.mjs +11 -0
- package/dist/bin/hook-chunks/session-start-MFMFKUPK.mjs +8 -0
- package/dist/bin/hook-chunks/setup-WQRJ6TQL.mjs +141 -0
- package/dist/bin/hook-chunks/{shipping-LVTFVSWJ.mjs → shipping-5D5LTJ3P.mjs} +5 -5
- package/dist/bin/hook-chunks/{skill-index-OOVAXHYJ.mjs → skill-index-RAVJMC4P.mjs} +1 -1
- package/dist/bin/hook-chunks/{spec-context-inference-U6BGGB2Q.mjs → spec-context-inference-7DDSTRTV.mjs} +1 -1
- package/dist/bin/hook-chunks/{spec-service-2DVDFOR7.mjs → spec-service-LAO5Z2M5.mjs} +2 -2
- package/dist/bin/hook-chunks/spec-task-breakdown-K3GMQKGH.mjs +8 -0
- package/dist/bin/hook-chunks/state-storage-EIFGUO7X.mjs +8 -0
- package/dist/bin/hook-chunks/stop-RYLI4FGF.mjs +16 -0
- package/dist/bin/hook-chunks/subagent-start-CCUPSANT.mjs +8 -0
- package/dist/bin/hook-chunks/subagent-stop-RBD2OILE.mjs +8 -0
- package/dist/bin/hook-chunks/{surface-attribution-BDKFYUOJ.mjs → surface-attribution-K37N2NK7.mjs} +1 -1
- package/dist/bin/hook-chunks/symbol-graph-BKQIMFRG.mjs +8 -0
- package/dist/bin/hook-chunks/{sync-analyzer-FKC57RTV.mjs → sync-analyzer-6U5GHYV3.mjs} +1 -1
- package/dist/bin/hook-chunks/{sync-client-DJWOG2ZQ.mjs → sync-client-EGBMWF3J.mjs} +1 -1
- package/dist/bin/hook-chunks/{sync-cursor-storage-2VKG757H.mjs → sync-cursor-storage-E3LMZISA.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-orchestration-MLOCR7GA.mjs → task-orchestration-2ZYE5M6J.mjs} +1 -1
- package/dist/bin/hook-chunks/{task-overview-6ZQKJGSH.mjs → task-overview-ITY5OSHX.mjs} +1 -1
- package/dist/bin/hook-chunks/task-service-XREJLWEF.mjs +8 -0
- package/dist/bin/hook-chunks/tdd-7S55S5C3.mjs +10 -0
- package/dist/bin/hook-chunks/{template-loader-BFTLPG2W.mjs → template-loader-SCM4C2A3.mjs} +1 -1
- package/dist/bin/hook-chunks/{trust-boundary-ERMDF2C5.mjs → trust-boundary-EX65SUYR.mjs} +1 -1
- package/dist/bin/hook-chunks/{usefulness-253CZLNY.mjs → usefulness-SCH5ARGV.mjs} +1 -1
- package/dist/bin/hook-chunks/{vault-retire-notice-GRT3QRLZ.mjs → vault-retire-notice-HT756AND.mjs} +1 -1
- package/dist/bin/hook-chunks/velocity-storage-47CF3XWZ.mjs +8 -0
- package/dist/bin/hook-chunks/weak-model-mode-FLCEQ2BV.mjs +8 -0
- package/dist/bin/hook-chunks/work-graph-JQHVVXIZ.mjs +49 -0
- package/dist/bin/hook-chunks/work-scope-CDLSZ4U5.mjs +8 -0
- package/dist/bin/hook-chunks/{workspace-occupancy-UVIRHY5Z.mjs → workspace-occupancy-UUW4UGGB.mjs} +1 -1
- package/dist/bin/hook-chunks/{worktree-service-XGRN5TTE.mjs → worktree-service-AS7JVBK5.mjs} +1 -1
- package/dist/bin/prjct-core.mjs +736 -746
- package/dist/bin/prjct-hooks.mjs +2 -2
- package/dist/daemon/entry.mjs +625 -632
- package/dist/mcp/server.mjs +323 -323
- package/package.json +1 -1
- package/dist/bin/hook-chunks/analysis-PFGKPYWQ.mjs +0 -42
- package/dist/bin/hook-chunks/auto-flush-QZ3YIQP6.mjs +0 -8
- package/dist/bin/hook-chunks/capture-gate-2FXYVHNF.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-3X7TBM4A.mjs +0 -19
- package/dist/bin/hook-chunks/chunk-4DDCWMI6.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-4KY2EHXS.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-7JE6VTLN.mjs +0 -71
- package/dist/bin/hook-chunks/chunk-AKIN5WSQ.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-CDCCAU22.mjs +0 -11
- package/dist/bin/hook-chunks/chunk-CPHUFXD2.mjs +0 -14
- package/dist/bin/hook-chunks/chunk-CQHPIYNM.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-CTWZQ7YI.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-FGQZ62ZP.mjs +0 -47
- package/dist/bin/hook-chunks/chunk-GELCZWKW.mjs +0 -11
- package/dist/bin/hook-chunks/chunk-HJ4HEI45.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-HX42HFII.mjs +0 -18
- package/dist/bin/hook-chunks/chunk-J6JZ4PQA.mjs +0 -18
- package/dist/bin/hook-chunks/chunk-KB3P6XTL.mjs +0 -38
- package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +0 -13
- package/dist/bin/hook-chunks/chunk-LT5WSSQO.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-N5WOHG36.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-NJAMZSHM.mjs +0 -26
- package/dist/bin/hook-chunks/chunk-NWY5M34K.mjs +0 -12
- package/dist/bin/hook-chunks/chunk-OLKNK2HB.mjs +0 -8
- package/dist/bin/hook-chunks/chunk-SVZHJZ5T.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-SY2FRLJF.mjs +0 -31
- package/dist/bin/hook-chunks/chunk-WSFHSXBZ.mjs +0 -9
- package/dist/bin/hook-chunks/chunk-Y7CKMFNW.mjs +0 -16
- package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +0 -8
- package/dist/bin/hook-chunks/client-SKFMAUI5.mjs +0 -10
- package/dist/bin/hook-chunks/code-graph-cloud-65GCWNII.mjs +0 -8
- package/dist/bin/hook-chunks/custom-workflow-storage-M77INP6Z.mjs +0 -8
- package/dist/bin/hook-chunks/cwd-changed-NJ6RYVOJ.mjs +0 -8
- package/dist/bin/hook-chunks/detect-changes-6N4DCWXQ.mjs +0 -17
- package/dist/bin/hook-chunks/developer-evolution-R5BXQH6G.mjs +0 -12
- package/dist/bin/hook-chunks/distill-IABVRW2U.mjs +0 -8
- package/dist/bin/hook-chunks/enriched-recall-NDASPZXZ.mjs +0 -8
- package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +0 -8
- package/dist/bin/hook-chunks/format-NIBVWBGR.mjs +0 -8
- package/dist/bin/hook-chunks/judgment-receipt-HTNEOJLT.mjs +0 -8
- package/dist/bin/hook-chunks/land-cue-FNLP4IAB.mjs +0 -9
- package/dist/bin/hook-chunks/land-synthesis-HBPIXP5S.mjs +0 -8
- package/dist/bin/hook-chunks/legacy-crew-sweep-2MLYPNQR.mjs +0 -24
- package/dist/bin/hook-chunks/memory-index-MQCHZFUE.mjs +0 -10
- package/dist/bin/hook-chunks/notification-VQM2AMNS.mjs +0 -8
- package/dist/bin/hook-chunks/post-edit-VTLDHWI3.mjs +0 -8
- package/dist/bin/hook-chunks/pre-bash-JR6257XO.mjs +0 -11
- package/dist/bin/hook-chunks/pre-commit-BYUFDN2N.mjs +0 -8
- package/dist/bin/hook-chunks/pre-edit-MHROFDS3.mjs +0 -11
- package/dist/bin/hook-chunks/pre-package-P7CLTJJV.mjs +0 -8
- package/dist/bin/hook-chunks/pre-search-BCQHPE46.mjs +0 -9
- package/dist/bin/hook-chunks/pre-secrets-IE5NX5X5.mjs +0 -8
- package/dist/bin/hook-chunks/project-memory-ON54KZEM.mjs +0 -8
- package/dist/bin/hook-chunks/project-style-evolution-T27I5N65.mjs +0 -8
- package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +0 -8
- package/dist/bin/hook-chunks/purge-QQ6XILZD.mjs +0 -8
- package/dist/bin/hook-chunks/retention-E7WGFL47.mjs +0 -8
- package/dist/bin/hook-chunks/sdd-PV6KWXE4.mjs +0 -10
- package/dist/bin/hook-chunks/session-continuity-5CLT5YBL.mjs +0 -11
- package/dist/bin/hook-chunks/session-start-ATYLOUKB.mjs +0 -8
- package/dist/bin/hook-chunks/setup-VL7YXVE5.mjs +0 -142
- package/dist/bin/hook-chunks/spec-task-breakdown-MPNRRTNZ.mjs +0 -8
- package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +0 -8
- package/dist/bin/hook-chunks/stop-GBUGB5OE.mjs +0 -17
- package/dist/bin/hook-chunks/subagent-start-HURF2GI7.mjs +0 -8
- package/dist/bin/hook-chunks/subagent-stop-WJECHEXI.mjs +0 -8
- package/dist/bin/hook-chunks/symbol-graph-LZM4RZXZ.mjs +0 -8
- package/dist/bin/hook-chunks/task-service-BM2JQXMS.mjs +0 -8
- package/dist/bin/hook-chunks/tdd-UJDJUJ3E.mjs +0 -10
- package/dist/bin/hook-chunks/weak-model-mode-GLXXHG32.mjs +0 -8
- package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +0 -49
- package/dist/bin/hook-chunks/work-scope-VTF6SKLY.mjs +0 -8
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __pathDirname } from 'path';
|
|
5
|
-
const require = __createRequire(import.meta.url);
|
|
6
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = __pathDirname(__filename);
|
|
8
|
-
import{c as y,d as D,e as Q,f as vt}from"./chunk-HDSS6UB3.mjs";import{a as Y,b as m,c as q,d as wt}from"./chunk-JQE2F2RK.mjs";import{a as W,b as Dt}from"./chunk-WUHGODSQ.mjs";import{g as K,j as u,k as R,l as P,n as C}from"./chunk-SVZHJZ5T.mjs";import{a as z,b as F,o as J}from"./chunk-CTWZQ7YI.mjs";import{a as i,c as h,d as yt,e as A}from"./chunk-E66B27AL.mjs";function Ot(e){let t=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0");return`${t}-${r}-${n}`}function X(e){return{year:e.getFullYear().toString(),month:(e.getMonth()+1).toString().padStart(2,"0"),day:e.getDate().toString().padStart(2,"0")}}function $t(){return new Date().toISOString()}function _t(e){let t=new Date;return t.setDate(t.getDate()-e),t}function Bt(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),n=Math.floor(r/60),s=Math.floor(n/24);return s>0?`${s}d ${n%24}h`:n>0?`${n}h ${r%60}m`:r>0?`${r}m`:`${t}s`}var Ut,Z=h(()=>{"use strict";i(Ot,"formatDate");i(X,"getYearMonthDay");i($t,"getTimestamp");i(_t,"getDaysAgo");i(Bt,"formatDuration");Ut=new Intl.RelativeTimeFormat("en",{numeric:"always"})});import St from"node:fs";import w from"node:fs/promises";import l from"node:path";async function T(e){let t={isMonorepo:!1,type:null,rootPath:e,packages:[]},r=[{file:"pnpm-workspace.yaml",type:"pnpm"},{file:"lerna.json",type:"lerna"},{file:"nx.json",type:"nx"},{file:"rush.json",type:"rush"},{file:"turbo.json",type:"turborepo"}];for(let n of r)if(await u(l.join(e,n.file))){t.isMonorepo=!0,t.type=n.type;break}if(!t.isMonorepo){let n=l.join(e,"package.json");if(await u(n))try{JSON.parse(await w.readFile(n,"utf-8")).workspaces&&(t.isMonorepo=!0,t.type="npm")}catch{}}return t.isMonorepo&&(t.packages=await E(e,t.type)),t}async function E(e,t){let r=[];try{let n=await(async()=>{if(t==="pnpm"){let g=(await w.readFile(l.join(e,"pnpm-workspace.yaml"),"utf-8")).match(/packages:\s*\n((?:\s*-\s*.+\n?)+)/);return g?g[1].split(`
|
|
9
|
-
`).map(c=>c.replace(/^\s*-\s*['"]?|['"]?\s*$/g,"")).filter(Boolean):[]}if(t==="npm"||t==="lerna"){let a=l.join(e,"package.json"),g=JSON.parse(await w.readFile(a,"utf-8")),c=Array.isArray(g.workspaces)?g.workspaces:g.workspaces?.packages??[];if(t==="lerna"){let d=l.join(e,"lerna.json");if(await u(d)){let p=JSON.parse(await w.readFile(d,"utf-8"));if(p.packages)return p.packages}}return c}if(t==="nx")return["apps/*","libs/*","packages/*"];if(t==="turborepo"){let a=JSON.parse(await w.readFile(l.join(e,"package.json"),"utf-8"));return Array.isArray(a.workspaces)?a.workspaces:[]}return[]})(),s=n.length>0?n:["packages/*","apps/*","libs/*"];for(let a of s){if(a.startsWith("!"))continue;let g=Ct(a,{cwd:e});for(let c of g){let d=l.join(e,c),p=l.join(d,"package.json");if(await u(p))try{let f=JSON.parse(await w.readFile(p,"utf-8")),j=l.join(d,"PRJCT.md");r.push({name:f.name||l.basename(c),path:d,relativePath:c,hasPrjctMd:await u(j)})}catch{}}}}catch{}return r}async function tt(e,t){if(!t.isMonorepo)return null;let r=l.resolve(e);for(let n of t.packages){let s=l.resolve(n.path);if(r.startsWith(s))return n}return null}async function N(e){let t=l.resolve(e),r=l.parse(t).root;return t===r?null:(await T(t)).isMonorepo?t:N(l.dirname(t))}var Ct,et=h(()=>{"use strict";C();Ct=St.globSync;i(T,"detectMonorepo");i(E,"discoverMonorepoPackages");i(tt,"findContainingPackage");i(N,"findMonorepoRoot")});function nt(e,t){let r=typeof e=="string"?new Date(e).getTime():e;return Date.now()-r>t}var rt,it=h(()=>{"use strict";i(nt,"isExpired");rt=class{static{i(this,"TTLCache")}cache=new Map;ttl;maxSize;constructor(t={}){this.ttl=t.ttl??5e3,this.maxSize=t.maxSize??50}isValid(t){let r=this.cache.get(t);return r?Date.now()-r.timestamp<this.ttl:!1}get(t){let r=this.cache.get(t);return r?this.isValid(t)?r.data:(this.cache.delete(t),null):null}set(t,r){this.cache.set(t,{data:r,timestamp:Date.now()}),this.evictOldEntries()}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}has(t){return this.cache.has(t)}get size(){return this.cache.size}evictOldEntries(){if(this.cache.size<=this.maxSize)return;let r=Array.from(this.cache.entries()).sort((n,s)=>n[1].timestamp-s[1].timestamp).slice(0,this.cache.size-this.maxSize);for(let[n]of r)this.cache.delete(n)}stats(){return{size:this.cache.size,maxSize:this.maxSize,ttl:this.ttl}}prune(){let t=[...this.cache.keys()].filter(r=>!this.isValid(r));for(let r of t)this.cache.delete(r);return t.length}}});import bt from"node:fs/promises";import kt from"node:path";async function st(){try{let e=await bt.readFile(ot(),"utf-8"),t=JSON.parse(e);return!t.timestamp||!t.detection||!t.detection.claude||!t.detection.gemini||!t.detection.codex||nt(t.timestamp,Mt)?null:t.detection}catch{return null}}async function at(e){let t={timestamp:new Date().toISOString(),detection:e};await K(ot(),t)}var ot,Mt,ct=h(()=>{"use strict";ut();it();C();ot=i(()=>kt.join(lt.getCachePath(),"providers.json"),"cacheFile"),Mt=600*1e3;i(st,"readProviderCache");i(at,"writeProviderCache")});import{execFileSync as G}from"node:child_process";function x(e){for(let t of e.split(/\r?\n/)){let r=t.trim();if(r)return r}return null}function gt(e){if(!e||e.includes("\0"))return null;try{if(process.platform==="win32"){let t=G("where.exe",[e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],windowsHide:!0});return x(t)}try{let t=G("which",[e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return x(t)}catch{let t=G("/bin/sh",["-c",`command -v ${JSON.stringify(e)}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return x(t)}}catch{return null}}async function H(e){if(!e||e.includes("\0"))return null;try{if(process.platform==="win32"){let{stdout:t}=await F("where.exe",[e],{encoding:"utf-8",windowsHide:!0});return x(String(t))}try{let{stdout:t}=await F("which",[e]);return x(String(t))}catch{return gt(e)}}catch{return null}}function se(e){return gt(e)!==null}var mt=h(()=>{"use strict";J();i(x,"firstNonEmptyLine");i(gt,"whichSync");i(H,"whichAsync");i(se,"commandOnPath")});var k={};yt(k,{ClaudeProvider:()=>b,CursorProvider:()=>pt,GeminiProvider:()=>_,Providers:()=>v,detectAllProviders:()=>L,detectAntigravity:()=>Tt,detectCodex:()=>ht,detectKimi:()=>Et,detectProvider:()=>$,getActiveProvider:()=>Ft,getProviderBranding:()=>Rt,selectProvider:()=>Nt,validateCliVersion:()=>ft});import O from"node:path";async function U(e){let t=await H(e);return t||(process.platform==="win32"?H(`${e}.cmd`):null)}async function At(e){try{let{stdout:t}=await z(`${e} --version`,{timeout:2e3}),r=t.match(/\d+\.\d+\.\d+/);return r?r[0]:t.trim()}catch{return null}}async function $(e){let t=v[e];if(!t.cliCommand)return{installed:!1};let r=await U(t.cliCommand);if(!r)return{installed:!1};let n=await At(t.cliCommand),s=ft(e,n||void 0);return{installed:!0,version:n||void 0,path:r,versionWarning:s||void 0}}function ft(e,t){let r=v[e];return!r.minCliVersion||!t?null:Q(t,r.minCliVersion)<0?`\u26A0\uFE0F ${r.displayName} v${t} is below minimum v${r.minCliVersion}. Some features may not work correctly.`:null}async function L(e=!1){if(!e){let g=await st();if(g)return g}let[t,r,n]=await Promise.all([$("claude"),$("gemini"),ht()]),s={installed:n.installed},a={claude:t,gemini:r,codex:s};return await at(a).catch(()=>{}),a}async function Ft(e){if(e&&v[e])return v[e];let t=await L(),r=[t.claude.installed?"claude":null,t.gemini.installed?"gemini":null,t.codex.installed?"codex":null].filter(Boolean);return r.length===1?v[r[0]]:t.claude.installed?b:t.gemini.installed?_:t.codex.installed?B:b}function Rt(e){return{commitFooter:"Generated with [p/](https://www.prjct.app/)",signature:{claude:"\u26A1 prjct + Claude",gemini:"\u26A1 prjct + Gemini",cursor:"\u26A1 prjct + Cursor",antigravity:"\u26A1 prjct + Antigravity",codex:"\u26A1 prjct + Codex"}[e]||"\u26A1 prjct"}}async function Tt(){let e=dt.configDir;if(!e)return{installed:!1,skillInstalled:!1};let t=O.join(e,"skills","prjct","SKILL.md"),[r,n]=await Promise.all([u(e),u(t)]);return{installed:r,skillInstalled:n,configPath:r?e:void 0}}async function ht(){let e=B.configDir;if(!e)return{installed:!1,skillInstalled:!1};let t=await U("codex"),r=O.join(e,"skills","prjct","SKILL.md"),n=await u(r),s=!!t||await u(O.join(e,"auth.json"));return{installed:s,skillInstalled:n,configPath:s?e:void 0}}async function Et(){let e=m(".kimi"),[t,r]=await Promise.all([U("kimi"),u(e)]),n=!!t||r;return{installed:n,configPath:n?e:void 0}}async function Nt(){let e=await L();return{provider:e.claude.installed?"claude":e.gemini.installed?"gemini":e.codex.installed?"codex":"claude",detection:e}}var b,_,dt,pt,B,v,M=h(()=>{"use strict";wt();vt();J();C();ct();mt();q();b={name:"claude",displayName:"Claude Code",cliCommand:"claude",get configDir(){return m(".claude")},contextFile:"CLAUDE.md",get skillsDir(){return m(".claude","skills")},commandsDir:".claude/commands",commandFormat:"md",settingsFile:"settings.json",projectSettingsFile:"settings.local.json",ignoreFile:".claudeignore",websiteUrl:"https://www.anthropic.com/claude",docsUrl:"https://docs.anthropic.com/claude-code",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:"1.0.0"},_={name:"gemini",displayName:"Gemini CLI",cliCommand:"gemini",get configDir(){return m(".gemini")},contextFile:"GEMINI.md",get skillsDir(){return m(".gemini","skills")},commandsDir:".gemini/commands",commandFormat:"toml",settingsFile:"settings.json",projectSettingsFile:"settings.json",ignoreFile:".geminiignore",websiteUrl:"https://geminicli.com",docsUrl:"https://geminicli.com/docs",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:"1.0.0"},dt={name:"antigravity",displayName:"Google Antigravity",cliCommand:null,get configDir(){return m(".gemini","antigravity")},contextFile:"ANTIGRAVITY.md",get skillsDir(){return m(".gemini","antigravity","global_skills")},commandsDir:".agent/skills",commandFormat:"md",settingsFile:"mcp_config.json",projectSettingsFile:null,ignoreFile:".agentignore",websiteUrl:"https://gemini.google.com/app/antigravity",docsUrl:"https://gemini.google.com/app/antigravity",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:null},pt={name:"cursor",displayName:"Cursor IDE",cliCommand:null,configDir:null,contextFile:"prjct.mdc",skillsDir:null,commandsDir:".cursor/commands",rulesDir:".cursor/rules",commandFormat:"md",settingsFile:null,projectSettingsFile:null,ignoreFile:".cursorignore",isProjectLevel:!0,websiteUrl:"https://cursor.com",docsUrl:"https://cursor.com/docs",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:null},B={name:"codex",displayName:"OpenAI Codex",cliCommand:"codex",get configDir(){return m(".codex")},contextFile:"AGENTS.md",get skillsDir(){return m(".codex","skills")},commandsDir:".agents/skills",commandFormat:"md",settingsFile:null,projectSettingsFile:null,ignoreFile:".codexignore",websiteUrl:"https://openai.com/codex",docsUrl:"https://github.com/openai/codex",get defaultModel(){return D(this.name)},get supportedModels(){return y(this.name)},minCliVersion:null},v={claude:b,gemini:_,cursor:pt,antigravity:dt,codex:B};i(U,"whichCommand");i(At,"getCliVersion");i($,"detectProvider");i(ft,"validateCliVersion");i(L,"detectAllProviders");i(Ft,"getActiveProvider");i(Rt,"getProviderBranding");i(Tt,"detectAntigravity");i(ht,"detectCodex");i(Et,"detectKimi");i(Nt,"selectProvider")});import Gt from"node:crypto";import I from"node:fs/promises";import o from"node:path";var V,Ht,lt,ut=h(()=>{Z();C();Dt();et();q();V=class{static{i(this,"PathManager")}globalBaseDir;globalConfigDir;constructor(){this.globalBaseDir=W(),this.globalConfigDir=o.join(this.globalBaseDir,"config")}get globalProjectsDir(){let t=process.env.PRJCT_PROJECTS_DIR;return t?o.resolve(t):o.join(this.globalBaseDir,"projects")}setGlobalBaseDir(t){this.globalBaseDir=o.resolve(t),this.globalConfigDir=o.join(this.globalBaseDir,"config")}generateProjectId(t){return Gt.randomUUID()}getGlobalBasePath(){return this.globalBaseDir}getGlobalProjectPath(t){return o.join(this.globalProjectsDir,t)}getLocalConfigPath(t){return o.join(t,".prjct","prjct.config.json")}getGlobalProjectConfigPath(t){return o.join(this.getGlobalProjectPath(t),"project.json")}getLegacyPrjctPath(t){return o.join(t,".prjct")}async hasLegacyStructure(t){return await R(this.getLegacyPrjctPath(t))}async hasConfig(t){return await u(this.getLocalConfigPath(t))}async ensureGlobalStructure(){await P(this.globalBaseDir),await P(this.globalProjectsDir),await P(this.globalConfigDir)}async ensureProjectStructure(t){await this.ensureGlobalStructure();let r=this.getGlobalProjectPath(t),n=["analysis","memory"];for(let s of n)await P(o.join(r,s));return await P(o.join(r,"sessions")),r}getSessionPath(t,r=new Date){let{year:n,month:s,day:a}=X(r);return o.join(this.getGlobalProjectPath(t),"sessions",n,s,a)}getCurrentSessionPath(t){return this.getSessionPath(t,new Date)}async ensureSessionPath(t,r=new Date){let n=this.getSessionPath(t,r);return await P(n),n}async listSessions(t,r=null,n=null){let s=o.join(this.getGlobalProjectPath(t),"sessions"),a=[];try{let g=await I.readdir(s,{withFileTypes:!0});for(let c of g){if(!c.isDirectory()||r&&c.name!==r.toString())continue;let d=o.join(s,c.name),p=await I.readdir(d,{withFileTypes:!0});for(let f of p){if(!f.isDirectory()||n&&f.name!==n.toString().padStart(2,"0"))continue;let j=o.join(d,f.name),Pt=await I.readdir(j,{withFileTypes:!0});for(let S of Pt)S.isDirectory()&&a.push({year:c.name,month:f.name,day:S.name,path:o.join(j,S.name),date:new Date(`${c.name}-${f.name}-${S.name}`)})}}return a.sort((c,d)=>d.date.getTime()-c.date.getTime()),a}catch{return[]}}async getSessionsInRange(t,r,n=new Date){return(await this.listSessions(t)).filter(a=>a.date>=r&&a.date<=n)}getFilePath(t,r,n){return o.join(this.getGlobalProjectPath(t),r,n)}async listProjects(){try{return await this.ensureGlobalStructure(),(await I.readdir(this.globalProjectsDir,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>r.name)}catch{return[]}}async projectExists(t){return await R(this.getGlobalProjectPath(t))}getDisplayPath(t){let r=Y();return t.startsWith(r)?t.replace(r,"~"):t}getAuthConfigPath(){return o.join(this.globalConfigDir,"auth.json")}getSyncPendingPath(t){return o.join(this.getGlobalProjectPath(t),"sync","pending.json")}getLastSyncPath(t){return o.join(this.getGlobalProjectPath(t),"sync","last-sync.json")}getRunningStatusPath(){return o.join(this.globalBaseDir,".running")}getCachePath(){return o.join(this.globalBaseDir,"cache")}getStatePath(){return o.join(this.globalBaseDir,"state")}getStatusLinePath(){return o.join(this.globalBaseDir,"statusline")}async getAgentDir(){return(await(M(),A(k)).getActiveProvider()).configDir}async getAgentSettingsPath(){let t=await(M(),A(k)).getActiveProvider();return(M(),A(k)).getGlobalSettingsPath(t.name)}getClaudeDir(){return m(".claude")}getClaudeSettingsPath(){return o.join(this.getClaudeDir(),"settings.json")}getStoragePath(t,r){return o.join(this.getGlobalProjectPath(t),"storage",r)}getContextPath(t){return o.join(this.getGlobalProjectPath(t),"context")}async detectMonorepo(t){return T(t)}async discoverMonorepoPackages(t,r){return E(t,r)}async findContainingPackage(t,r){return tt(t,r)}async findMonorepoRoot(t){return N(t)}},Ht=new V,lt=Ht});export{Ot as a,$t as b,_t as c,Bt as d,Z as e,nt as f,rt as g,it as h,H as i,se as j,mt as k,v as l,Ft as m,Rt as n,ht as o,Et as p,k as q,M as r,lt as s,ut as t};
|
|
@@ -1,11 +0,0 @@
|
|
|
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{m as j,q as L,r as M}from"./chunk-AKIN5WSQ.mjs";import{a as E,b as a,c as S}from"./chunk-JQE2F2RK.mjs";import{j as C,n as I}from"./chunk-SVZHJZ5T.mjs";import{c as x}from"./chunk-ZNQXFWSI.mjs";import{a as O}from"./chunk-SYHDEUVU.mjs";import{d as N,e as G}from"./chunk-ZX6BC2EB.mjs";import{a as R,e as l,f as k}from"./chunk-BUDZL4DW.mjs";import{a as c,e as b}from"./chunk-E66B27AL.mjs";k();I();M();import i from"node:fs/promises";import n from"node:path";import u from"node:fs/promises";import A from"node:path";k();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 P(){let m=(M(),b(L)),t=await m.getActiveProvider(),e=t.name;if(!(await m.detectProvider(e)).installed&&!t.configDir)return{success:!1,error:`${t.displayName} not detected`,action:"skipped"};try{await u.mkdir(t.configDir,{recursive:!0});let s=A.join(t.configDir,t.contextFile),p=await(async()=>{if(e==="claude")return y;let o=x(`global/${t.contextFile}`);if(o)return o;let{PACKAGE_ROOT:g}=(G(),b(N)),T=A.join(g,"templates","global",t.contextFile);return u.readFile(T,"utf-8").catch(()=>e==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await u.readFile(s,"utf-8").then(o=>({content:o,exists:!0})).catch(o=>{if(R(o))return{content:"",exists:!1};throw o}),h="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",D=(()=>{if(!r.content.includes(h)||!r.content.includes(f))return r.content;let o=r.content.substring(0,r.content.indexOf(h)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(o+g).replace(/\n{3,}/g,`
|
|
9
|
-
|
|
10
|
-
`).trim()}
|
|
11
|
-
`})(),w=O(r.exists?D:"",p,"<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");return await u.writeFile(s,w.content,"utf-8"),{success:!0,action:w.action,path:s}}catch(s){return{success:!1,error:l(s),action:"failed"}}}c(P,"installGlobalConfig");S();async function et(){return P()}c(et,"installGlobalConfig");var v=class{static{c(this,"CommandInstaller")}commandsPath="";configPath="";_initialized=!1;async ensureInit(){if(this._initialized)return;let t=await j();this.configPath=t.configDir??"",this.commandsPath=this.configPath?n.join(this.configPath,"commands"):"",this._initialized=!0}async detectActiveProvider(){return await this.ensureInit(),C(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 d=n.join(this.commandsPath,e);try{await i.unlink(d),t.push(e)}catch(s){if(s.code!=="ENOENT")return{success:!1,error:l(s)}}}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(){if(!await this.detectActiveProvider())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(e){return{success:!1,error:l(e),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 i.unlink(n.join(this.commandsPath,e)),!0}catch{return!1}}))).some(Boolean)}async cleanupLegacyCommands(){await this.ensureInit();let t=n.join(this.commandsPath,"p");try{if((await i.stat(t).catch(()=>null))?.isDirectory())return await i.rm(t,{recursive:!0,force:!0}),!0}catch{}return!1}async installGlobalConfig(){return P()}async cleanupAllLegacy(){let t=E(),e=[],d=[n.join(t,".claude","commands","p.md"),n.join(t,".claude","commands","p.toml"),n.join(t,".gemini","commands","p.md"),n.join(t,".gemini","commands","p.toml")];for(let r of d)try{await i.unlink(r),e.push(r)}catch{}let s=[n.join(t,".claude","commands","p"),n.join(t,".gemini","commands","p")];for(let r of s)try{(await i.stat(r).catch(()=>null))?.isDirectory()&&(await i.rm(r,{recursive:!0,force:!0}),e.push(r))}catch{}let p=[n.join(t,".prjct-cli","config","homebrew-migrated")];for(let r of p)try{await i.unlink(r),e.push(r)}catch{}return{cleaned:e}}};function rt(){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(rt,"getProviderPaths");var _=new v,nt=_;export{et as a,v as b,rt as c,nt as d};
|
|
@@ -1,14 +0,0 @@
|
|
|
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{e as T,g as D,h as v,i as O,j as G}from"./chunk-2OU2MKNS.mjs";import{a as W,b as C}from"./chunk-YJMWY4Y6.mjs";import{e as H,i as z}from"./chunk-NJAMZSHM.mjs";import{a as A,e as B}from"./chunk-4DDCWMI6.mjs";import{a as I}from"./chunk-DGBDMUBL.mjs";import{e as w,g as oe}from"./chunk-HDHVBB6Q.mjs";import{a as L,o as re}from"./chunk-CTWZQ7YI.mjs";import{a as c}from"./chunk-E66B27AL.mjs";oe();re();async function ie(e,t=100){try{let{stdout:r}=await L(`git log --name-only --pretty=format:'---COMMIT---' -${t}`,{cwd:e,maxBuffer:10485760}),n=r.split(`
|
|
9
|
-
`).reduce((o,i)=>{let m=i.trim();return m==="---COMMIT---"?(o.currentFiles&&o.currentFiles.size>0&&o.currentFiles.size<=30&&o.commits.push(o.currentFiles),o.currentFiles=new Set):m&&o.currentFiles&&ce(m)&&o.currentFiles.add(m),o},{commits:[],currentFiles:null});return n.currentFiles&&n.currentFiles.size>0&&n.currentFiles.size<=30&&n.commits.push(n.currentFiles),n.commits}catch{return[]}}c(ie,"parseGitLog");function ce(e){return/\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|java|cs|rb|php|vue|svelte)$/i.test(e)&&!e.includes("node_modules/")}c(ce,"isSourceFile");async function ae(e,t=100){let r=await ie(e,t),n=new Map,o=new Map;for(let m of r){let p=Array.from(m);for(let g of p)n.set(g,(n.get(g)||0)+1);for(let[g,f]of p.entries())for(let d of p.slice(g+1)){let h=le(f,d);o.set(h,(o.get(h)||0)+1)}}let i={};for(let[m,p]of o){let[g,f]=m.split("\0"),d=n.get(g)||0,h=n.get(f)||0;if(d<2||h<2)continue;let s=d+h-p,a=s>0?p/s:0;a<.1||(i[g]||(i[g]={}),i[f]||(i[f]={}),i[g][f]=a,i[f][g]=a)}return{matrix:i,commitsAnalyzed:r.length,filesAnalyzed:n.size,builtAt:new Date().toISOString()}}c(ae,"buildMatrix");function le(e,t){return e<t?`${e}\0${t}`:`${t}\0${e}`}c(le,"pairKey");function _(e,t){let r=new Set(e),n=new Map;for(let o of e){let i=t.matrix[o];if(i)for(let[m,p]of Object.entries(i)){if(r.has(m))continue;let g=n.get(m)||0;p>g&&n.set(m,p)}}return Array.from(n.entries()).map(([o,i])=>({path:o,score:i})).sort((o,i)=>i.score-o.score)}c(_,"scoreFromSeeds");var N="cochange-index",R=new Map;function me(e,t){w.setDoc(e,N,t),R.delete(e)}c(me,"saveMatrix");function F(e){let t=w.get(e,"SELECT updated_at FROM kv_store WHERE key = ?",N);if(!t)return R.delete(e),null;let r=R.get(e);if(r&&r.updatedAt===t.updated_at)return r.matrix;let n=w.getDoc(e,N);return n&&R.set(e,{matrix:n,updatedAt:t.updated_at}),n}c(F,"loadMatrix");async function ge(e,t){try{let{stdout:r}=await L(`git rev-list --max-count=${t} HEAD`,{cwd:e,maxBuffer:1048576}),n=r.split(`
|
|
10
|
-
`).map(o=>o.trim()).filter(Boolean);return n.length>0?n.join(`
|
|
11
|
-
`):null}catch{return null}}c(ge,"recentHistoryFingerprint");async function xe(e,t,r=100){let n=await ge(e,r),o=n?F(t):null;if(o?.historyFingerprint===n)return o;let i=await ae(e,r);return n&&(i.historyFingerprint=n),me(t,i),i}c(xe,"indexCoChanges");function E(e){if(e.length===0)return[];let t=e[0]?.score||1;return e.map(r=>({path:r.path,score:r.score/t}))}c(E,"normalize");var M=[{name:"bm25",kind:"query",defaultWeight:.45,hasIndex:c(e=>A(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(B(e,t,r)),"scoreFromQuery")},{name:"symbols",kind:"query",defaultWeight:.2,hasIndex:c(e=>H(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(z(e,t,r)),"scoreFromQuery")},{name:"imports",kind:"seed",defaultWeight:.2,hasIndex:c(e=>C(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t,r)=>{let n=C(e);return n?E(W(t,n,r.importDepth)):[]},"scoreFromSeeds")},{name:"cochange",kind:"seed",defaultWeight:.15,hasIndex:c(e=>F(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t)=>{let r=F(e);return r?E(_(t,r)):[]},"scoreFromSeeds")}];var pe={bm25Weight:.45,importWeight:.2,cochangeWeight:.15,symbolsWeight:.2,topN:15,importDepth:2},P=10;function Q(e,t,r={}){let n={...pe,...r},o={bm25:n.bm25Weight,symbols:n.symbolsWeight,imports:n.importWeight,cochange:n.cochangeWeight},i=M.filter(s=>s.kind==="query"),m=M.filter(s=>s.kind==="seed"),p=new Map,g=new Map;for(let s of i){let a=s.scoreFromQuery(e,t,n.topN*3);if(a.length!==0){p.set(s.name,new Map(a.map(u=>[u.path,u.score])));for(let u of a.slice(0,P))g.set(u.path,Math.max(g.get(u.path)??0,u.score))}}if(p.size===0)return[];let f=[...g.entries()].sort((s,a)=>a[1]-s[1]).slice(0,P).map(([s])=>s);for(let s of m){let a=s.scoreFromSeeds(e,f,{importDepth:n.importDepth});a.length!==0&&p.set(s.name,new Map(a.map(u=>[u.path,u.score])))}let d=new Set;for(let s of p.values())for(let a of s.keys())d.add(a);let h=[];for(let s of d){let a=[...p].reduce((u,[l,y])=>{let b=y.get(s)??0,k=o[l]??M.find(S=>S.name===l)?.defaultWeight??0;return u+b*k},0);h.push({path:s,finalScore:a,signals:{bm25:p.get("bm25")?.get(s)??0,imports:p.get("imports")?.get(s)??0,cochange:p.get("cochange")?.get(s)??0,symbols:p.get("symbols")?.get(s)??0}})}return h.sort((s,a)=>a.finalScore-s.finalScore),h.slice(0,n.topN)}c(Q,"rankFiles");function U(e){let t={};for(let r of M)t[r.name]=r.hasIndex(e);return{bm25:t.bm25??!1,imports:t.imports??!1,cochange:t.cochange??!1,symbols:t.symbols??!1}}c(U,"hasIndexes");function K(e,t,r=8){let n=t.map(s=>s.trim()).filter(Boolean),o=!!C(e),i=!!F(e),m=new Map;if(n.length>0&&o)try{for(let s of W(n,C(e),2)){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("imports"),m.set(s.path,a)}}catch{}if(n.length>0&&i)try{for(let s of _(n,F(e))){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("cochange"),m.set(s.path,a)}}catch{}let p=[...m.entries()].map(([s,a])=>({path:s,score:a.score,via:a.via.size>1?"both":[...a.via][0]??"imports"})).sort((s,a)=>a.score-s.score).slice(0,r),g=[];for(let s of n.slice(0,5))try{let a=I.recallForFile(e,s,2,{preventiveOnly:!0});for(let u of a)g.push({id:u.id,type:u.type,title:u.content.replace(/\s+/g," ").trim().slice(0,100),file:s})}catch{}let f=p.length>0?`related=${p.slice(0,3).map(s=>s.path.split("/").pop()).join(",")}`:o||i?"related=none-strong":"indexes=cold",d=g.length>0?`traps=${g.length}`:"traps=0",h=n.length===0?"World model: no seed files":`World model impact: seeds=${n.length} \xB7 ${f} \xB7 ${d}`;return{seeds:n,neighbors:p,traps:g.slice(0,r),line:h,hasIndexes:{imports:o,cochange:i}}}c(K,"breakImpact");var Y=8,X=/(?:^|[\s`"'(])((?:@?[\w.-]+\/)+[\w.-]+\.[\w.-]+)(?:$|[\s`"'),;:])/g;function Te(e,t,r=Y){let n=t.trim();if(!n)return ne();let o=V(e,n);return J(e,n,o,r)}c(Te,"resolveWorkScopeSync");async function De(e,t,r,n=Y){let o=r.trim();if(!o)return ne();let i=new Set(V(t,o));try{let{enrichedRecall:m}=await import("./enriched-recall-NDASPZXZ.mjs"),p=await m(e,t,{topic:o,types:["context","decision","gotcha","anti-pattern","learning"],limit:12});for(let g of Z(p,t))i.add(g)}catch{}return J(t,o,i,n)}c(De,"resolveWorkScope");function J(e,t,r,n){let o=U(e),i=new Map,m=T(e),p=D(e),g=c((l,y,b,k)=>{if(!v(e,l))return;let S=y*O(e,l),x=i.get(l);if(!x){i.set(l,{path:l,score:S,signals:[b],reason:k});return}x.score+=S,x.signals.includes(b)||x.signals.push(b),S>=.4&&(x.reason=k)},"bump");for(let l of r)g(l,ue(l,p),"memory","linked from project judgment memory (decision/gotcha/context)");let f=(()=>{if(!(o.bm25||o.symbols))return[];try{return Q(e,t,{topN:Math.max(n*2,12)})}catch{return[]}})();for(let l of f){let y=l.signals.symbols??0,b=[l.signals.bm25>0?"bm25":null,y>0?"symbols":null,l.signals.imports>0?"imports":null,l.signals.cochange>0?"cochange":null].filter(x=>x!==null),k=Math.max(l.signals.bm25,y,l.signals.imports,l.signals.cochange),S=y>=k&&y>0?"matches function/class/route symbols in code graph":l.signals.bm25>=l.signals.imports&&l.signals.bm25>=l.signals.cochange?"matches task terms in code index (BM25)":l.signals.imports>=l.signals.cochange?"import-graph neighbor of matched files":"historically co-changes with matched files";g(l.path,l.finalScore,b[0]??"bm25",S);for(let x of b.slice(1)){let $=i.get(l.path);$&&!$.signals.includes(x)&&$.signals.push(x)}}let d=f.length,h=[...i.keys()].slice(0,5);h.length===0&&r.size>0&&h.push(...[...r].slice(0,5));let s=(()=>{if(h.length===0)return null;try{return K(e,h,n)}catch{return null}})();if(s)for(let l of s.neighbors)g(l.path,.35*Math.min(1,l.score+.1),l.via==="both"?"imports":l.via,l.via==="cochange"?"historically co-changes with seed files":"import-graph neighbor of seed files");let a=s?.neighbors.length??0,u=[...i.values()].sort((l,y)=>y.score-l.score).slice(0,n);return{files:u,indexesReady:o.bm25||o.imports||o.cochange||o.symbols,sources:{memorySeeds:r.size,indexHits:d,graphNeighbors:a},agentBlock:fe(u,{indexesReady:o.bm25||o.imports||o.cochange||o.symbols,memorySeeds:r.size,inventoryLine:G(m)})}}c(J,"mergeScope");function V(e,t){let r=new Set;try{let n=t.split(/\s+/).filter(m=>m.length>2).slice(0,12),o=n.length>0?(()=>{try{return I.searchFts(e,n,15)}catch{return[]}})():[],i=o.length>0?o:I.recall(e,{types:["gotcha","decision","anti-pattern","context"],limit:20});for(let m of Z(i,e))r.add(m)}catch{}return r}c(V,"memoryFileSeedsSync");function Z(e,t){let r=new Set,n=c(o=>{let i=ee(o);i&&(t?v(t,i)&&r.add(i):te(i)&&r.add(i))},"accept");for(let o of e){let i=o.tags?.file?.trim();i&&n(i);let m=o.tags?.files?.trim();if(m)for(let g of m.split(",")){let f=g.trim();f&&n(f)}let p=o.content??"";X.lastIndex=0;for(let g of p.matchAll(X))n(g[1])}return[...r]}c(Z,"extractFilePathsFromEntries");function ee(e){return e.replace(/^\.\//,"").replace(/\\/g,"/")}c(ee,"normalizePath");function te(e){let t=ee(e).trim();return!t||t.length<3?!1:t.includes("/")&&t.includes(".")}c(te,"looksLikeRepoPath");function ue(e,t){let r=(e.split("/").pop()??e).toLowerCase(),n=r.includes(".")?`.${r.split(".").pop()}`:"";return r==="package.json"||r==="cargo.toml"||r==="go.mod"?.4:t.size>0&&n&&t.has(n)?e.includes("/")?.9:.75:e.includes("/")&&r.includes(".")?.7:.5}c(ue,"memorySeedWeight");function ne(){return{files:[],indexesReady:!1,sources:{memorySeeds:0,indexHits:0,graphNeighbors:0},agentBlock:""}}c(ne,"emptyResult");function fe(e,t){if(e.length===0)return t?.indexesReady===!1?["**Work scope (prjct):** indexes cold \u2014 run `prjct sync` once, then re-resolve scope.",t.inventoryLine?`_${t.inventoryLine}_`:"","Until then: prefer `prjct search` / `prjct context memory <topic>` over raw Grep/Glob walks."].filter(Boolean).join(`
|
|
12
|
-
`):["**Work scope (prjct):** no high-confidence file hits for this query.",t?.inventoryLine?`_${t.inventoryLine}_`:"","MUST still try `prjct context memory <topic>` + `prjct search` before a broad Grep/Glob walk."].filter(Boolean).join(`
|
|
13
|
-
`);let r=["**Work scope \u2014 prjct (MUST read before Grep/Glob):**","> Do NOT walk the tree. Open these first. Expand only via `prjct guard <file>` (graph neighbors + traps) or MCP `prjct_relevant_files` / `prjct_impact_analysis`.",...e.map(n=>{let o=n.signals.length>0?` (${n.signals.join("+")})`:"";return`- \`${n.path}\` \u2014 ${n.reason}${o}`})];return t?.memorySeeds&&t.memorySeeds>0&&r.push(`_Seeded from ${t.memorySeeds} memory path hit(s) + code index + graph._`),t?.inventoryLine&&r.push(`_${t.inventoryLine}_`),r.join(`
|
|
14
|
-
`)}c(fe,"formatWorkScopeBlock");function Oe(e){return e.map(({path:t,signals:r,reason:n})=>({path:t,signals:r,reason:n}))}c(Oe,"toLikelyFileHits");function Ge(e,t){return t?v(t,e):te(e)}c(Ge,"isUsefulScopePath");export{F as a,xe as b,Te as c,De as d,Z as e,fe as f,Oe as g,Ge as h};
|
|
@@ -1,8 +0,0 @@
|
|
|
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 r,o}from"./chunk-CTWZQ7YI.mjs";import{a as i}from"./chunk-E66B27AL.mjs";o();import{existsSync as u}from"node:fs";import a from"node:path";var l=[".github/pull_request_template.md",".github/PULL_REQUEST_TEMPLATE.md",".github/PULL_REQUEST_TEMPLATE/default.md","docs/pull_request_template.md",".gitlab/merge_request_templates/default.md"];function m(t){for(let n of l)if(u(a.join(t,n)))return n;return null}i(m,"findPrTemplate");async function g(t){try{let{stdout:n}=await r("git",["remote","get-url","origin"],{cwd:t,timeout:3e3}),e=n.toString().trim();return e?/(^|[./@])github\.com([/:]|$)/.test(e)?"github":"other":null}catch{return null}}i(g,"getRemoteHost");async function f(t){let n=m(t);if(n)return{kind:"template",templatePath:n};let e=await g(t);return e==="github"?{kind:"github-ambiguous"}:e==="other"?{kind:"non-github"}:{kind:"no-remote"}}i(f,"detectPrConventionSignal");function h(t){return t.kind==="non-github"||t.kind==="no-remote"?"manual":"auto"}i(h,"defaultPrConventionFor");export{f as a,h as b};
|
|
@@ -1,8 +0,0 @@
|
|
|
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 t,c as L}from"./chunk-E66B27AL.mjs";import{exec as A,execFile as O,spawn as h}from"node:child_process";import{promisify as M}from"node:util";function B(r){try{process.platform==="win32"?r.pid!==void 0&&h("taskkill",["/pid",String(r.pid),"/T","/F"],{stdio:"ignore"}).unref():r.pid!==void 0&&process.kill(-r.pid,"SIGKILL")}catch{}try{r.kill("SIGKILL")}catch{}}function y(r,e){if(r.length===0)return"";let o=Buffer.concat(r);return(o.length>e?o.subarray(0,e):o).toString("utf8")}function N(r){let e=r.code;return typeof e=="string"?e:void 0}function D(r,e,o={}){let s=o.timeoutMs??_,u=o.maxBuffer??U,b=u,T=o.spawnFn??h,d=[r,...e],$=Date.now(),f=t(()=>Date.now()-$,"duration");return o.signal?.aborted?Promise.resolve({ok:!1,kind:"timeout",budgetMs:0,budgetSource:"abort",args:d,stdout:"",stderr:"",durationMs:0}):new Promise(I=>{let w=[],P=[],i={settled:!1,overflow:!1,outBytes:0,errBytes:0},c=T(r,e,{cwd:o.cwd,env:o.env,detached:process.platform!=="win32",stdio:["ignore","pipe","pipe"]}),l=t(n=>{i.settled||(i.settled=!0,clearTimeout(F),o.signal?.removeEventListener("abort",E),I(n))},"finish"),k=t(()=>({stdout:y(w,b),stderr:y(P,b)}),"partials"),v=t((n,a)=>{B(c);let{stdout:p,stderr:m}=k();l({ok:!1,kind:"timeout",budgetMs:a,budgetSource:n,args:d,stdout:p,stderr:m,durationMs:f()})},"finishTimeout"),C=t(()=>{B(c);let{stdout:n,stderr:a}=k();l({ok:!1,kind:"overflow",maxBuffer:u,args:d,stdout:n,stderr:a||`maxBuffer exceeded (${u} bytes)`,durationMs:f()})},"finishOverflow"),F=setTimeout(()=>v("timeout",s),s),E=t(()=>v("abort",s),"onAbort");o.signal?.addEventListener("abort",E,{once:!0});let S=t((n,a)=>{i.settled||(a?(P.push(n),i.errBytes+=n.length):(w.push(n),i.outBytes+=n.length),!i.overflow&&i.outBytes+i.errBytes>u&&(i.overflow=!0,C()))},"onChunk");c.stdout?.on("data",n=>S(n,!1)),c.stderr?.on("data",n=>S(n,!0)),c.on("error",n=>{l({ok:!1,kind:"spawn",cause:n,code:N(n),args:d,durationMs:f()})}),c.on("close",(n,a)=>{if(i.settled)return;let{stdout:p,stderr:m}=k();l(n===0?{ok:!0,stdout:p,stderr:m,durationMs:f()}:{ok:!1,kind:"exit",code:n??-1,signal:a,stdout:p,stderr:m.trim(),args:d,durationMs:f()})})})}function G(r,e={}){return D("git",r,e)}function q(r){return!r.ok&&(r.kind==="timeout"||r.kind==="spawn"||r.kind==="overflow")}function H(r,e){return!Number.isInteger(e)||e<0?!1:!r.ok&&r.kind==="exit"&&r.code===e}function x(r,e=K){let s=r.replace(/[\r\n\t]+/g," ").replace(/\s+/g," ").trim().replace(/(?:[A-Za-z]:)?(?:\/|\\)(?:Users|home|tmp|var|private|Users)(?:\/|\\)[^\s]*/gi,"\u2026").replace(/\/(?:Users|home|tmp|var|private)\/[^\s]*/gi,"\u2026");return s.length<=e?s:`${s.slice(0,Math.max(0,e-1))}\u2026`}function R(r){return r.ok||r.kind==="exit"?null:r.kind==="timeout"?new g("timeout",r.args,r.budgetSource==="abort"?"aborted by caller signal":`exceeded ${r.budgetMs}ms`,{budgetSource:r.budgetSource}):r.kind==="overflow"?new g("overflow",r.args,`maxBuffer ${r.maxBuffer} bytes`):new g("spawn",r.args,r.cause.message)}function J(r){if(r.ok)return null;if(r.kind==="exit"){let e=r.stderr?` \u2014 ${x(r.stderr,120)}`:"",o=r.signal?` signal=${r.signal}`:"";return new Error(x(`command failed (exit ${r.code}${o}): ${r.args.join(" ")}${e}`))}return R(r)}function Q(r){throw r.ok?new Error("throwProc called on ok result"):J(r)??new Error(`process failed (${r.kind})`)}function W(r,e){if(r.ok)return e.ok(r);switch(r.kind){case"exit":return e.exit(r);case"timeout":return e.timeout(r);case"spawn":return e.spawn(r);case"overflow":return e.overflow(r);default:return r}}async function Y(r,e,o={}){let s=await G(e,{...o,cwd:r});if(s.ok)return s.stdout.trim();let u=R(s);if(u)throw u;return null}var V,Z,_,U,K,g,j=L(()=>{V=M(A),Z=M(O),_=1e4,U=1024*1024,K=240;t(B,"killProcessTree");t(y,"joinChunks");t(N,"nodeErrorCode");t(D,"runProc");t(G,"runGit");t(q,"isProcInfra");t(H,"exitCodeMeans");t(x,"sanitizeProcEnvelope");g=class extends Error{static{t(this,"GitInfraError")}kind;args;detail;budgetSource;constructor(e,o,s,u){super(x(`git ${e} failure (${o.join(" ")}): ${s}`)),this.name="GitInfraError",this.kind=e,this.args=o,this.detail=s,this.budgetSource=u?.budgetSource}};t(R,"gitInfraErrorOf");t(J,"procErrorOf");t(Q,"throwProc");t(W,"matchProc");t(Y,"gitStdout")});export{V as a,Z as b,K as c,D as d,G as e,q as f,H as g,x as h,g as i,R as j,J as k,Q as l,W as m,Y as n,j as o};
|
|
@@ -1,47 +0,0 @@
|
|
|
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 H}from"./chunk-AOPJ4Z6O.mjs";import{e as k,g as G}from"./chunk-HDHVBB6Q.mjs";import{a as c}from"./chunk-E66B27AL.mjs";G();var X="memory.task_tokens",_=1e7;function ae(e,n,t,r,s){if(!n||t+r<=0)return;let i=5e7;if(t>i||r>i)return;let a=t>_||r>_,u=Math.min(Math.round(t),_),d=Math.min(Math.round(r),_);a&&(s={...s,isEstimated:!0});try{k.appendEvent(e,X,{taskId:n,tokensIn:u,tokensOut:d,...s?.description?{description:s.description}:{},...s?.agent?{agent:s.agent}:{},...s?.model?{model:s.model}:{},...s?.runtime?{runtime:s.runtime}:{},...s?.isEstimated!==void 0?{isEstimated:s.isEstimated}:{},...s?.source?{source:s.source}:{}},n)}catch{}if(u>=0&&u<=_&&d>=0&&d<=_)try{k.run(e,"UPDATE tasks SET tokens_in = ?, tokens_out = ? WHERE id = ?",u,d,n)}catch{}try{let E=s?.source??"cli",T=`${n}:${E}`,S=Date.now();k.run(e,`INSERT INTO token_usage
|
|
9
|
-
(id, work_cycle_id, event_key, source, is_estimated, input_tokens, output_tokens, model_id, description, measured_at, created_at)
|
|
10
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
11
|
-
ON CONFLICT(event_key) DO UPDATE SET
|
|
12
|
-
input_tokens = excluded.input_tokens,
|
|
13
|
-
output_tokens = excluded.output_tokens,
|
|
14
|
-
is_estimated = excluded.is_estimated,
|
|
15
|
-
model_id = excluded.model_id,
|
|
16
|
-
description = COALESCE(excluded.description, token_usage.description),
|
|
17
|
-
measured_at = excluded.measured_at`,T,n,T,E,s?.isEstimated?1:0,u,d,s?.model??null,s?.description??null,S,S)}catch{}}c(ae,"recordTaskTokenUsage");function B(e,n){let t=Date.parse(n),r=y(e,`SELECT work_cycle_id, input_tokens, output_tokens, is_estimated, description
|
|
18
|
-
FROM token_usage
|
|
19
|
-
WHERE measured_at >= ?
|
|
20
|
-
ORDER BY measured_at DESC`,Number.isFinite(t)?t:0),s=new Map;for(let i of r){let a=i.work_cycle_id;if(!a||s.has(a))continue;let u=b(i.input_tokens)??0,d=b(i.output_tokens)??0;u+d<=0||s.set(a,{id:a,description:i.description??a,status:i.is_estimated?"estimated":"measured",tokensIn:u,tokensOut:d,tokensTotal:u+d,minutes:null})}return s}c(B,"measuredCyclesFromTokenUsage");function Z(e,n){let t=se(n),r=new Date().toISOString(),s=y(e,`SELECT id, description, status, started_at, completed_at, shipped_at, tokens_in, tokens_out
|
|
21
|
-
FROM tasks
|
|
22
|
-
WHERE COALESCE(completed_at, shipped_at, started_at) >= ?
|
|
23
|
-
ORDER BY COALESCE(completed_at, shipped_at, started_at) DESC`,t),i=new Map;for(let o of s.map(j))o&&i.set(o.id,o);for(let[o,m]of B(e,t)){let h=i.get(o);i.set(o,{...m,description:h?.description??m.description,minutes:h?.minutes??m.minutes})}let a=[...i.values()].sort((o,m)=>m.tokensTotal-o.tokensTotal),u=g(e,"memory.task_started",t),d=g(e,"memory.status.changed",t),R=g(e,"memory.feature_shipped",t),E=g(e,"sync",t),T=l(e,"SELECT COUNT(*) AS value FROM events WHERE type >= ? AND type < ? AND timestamp >= ?","memory.","memory/",t),S=g(e,"memory.post_edit",t),q=l(e,"SELECT COUNT(*) AS value FROM agent_sessions WHERE started_at >= ?",t),I=(()=>{try{return l(e,"SELECT COUNT(*) AS value FROM cli_sessions WHERE created_at >= ?",t)}catch{return 0}})(),A=q+I,w=l(e,"SELECT COUNT(DISTINCT memory_id) AS value FROM memory_surface_log WHERE created_at >= ?",t),K=l(e,`SELECT COUNT(DISTINCT s.memory_id) AS value
|
|
24
|
-
FROM memory_surface_log s
|
|
25
|
-
INNER JOIN memory_usefulness u ON u.memory_id = s.memory_id
|
|
26
|
-
WHERE s.created_at >= ?
|
|
27
|
-
AND u.score > 0`,t),Y=(()=>{try{return l(e,`SELECT COUNT(DISTINCT t.id) AS value
|
|
28
|
-
FROM tasks t
|
|
29
|
-
INNER JOIN agent_sessions a ON a.task_id = t.id
|
|
30
|
-
WHERE (t.completed_at IS NOT NULL OR t.shipped_at IS NOT NULL)
|
|
31
|
-
AND COALESCE(t.completed_at, t.shipped_at, t.started_at) >= ?`,t)}catch{return 0}})(),$=l(e,"SELECT COUNT(*) AS value FROM context_zone_events WHERE timestamp >= ?",t),z=l(e,"SELECT COUNT(*) AS value FROM context_compactions WHERE timestamp >= ?",t),D=P(e,"command_duration",t),x=P(e,"startup_time",t),N=ee(e,t),W=a.reduce((o,m)=>o+m.tokensIn,0),L=a.reduce((o,m)=>o+m.tokensOut,0),C=Math.max(s.length,u,R),f=s.filter(o=>o.completed_at||o.shipped_at),O=new Set(B(e,t).keys()),J=(()=>{try{return new Set(k.query(e,`SELECT DISTINCT task_id AS task_id FROM agent_sessions
|
|
32
|
-
WHERE task_id IS NOT NULL AND started_at >= ?`,t).map(o=>o.task_id).filter(Boolean))}catch{return new Set}})(),M=f.filter(o=>{let m=Number(o.tokens_in??0),h=Number(o.tokens_out??0);return m+h>0||O.has(o.id)}).length,U=f.filter(o=>Number(o.tokens_in??0)+Number(o.tokens_out??0)>0||O.has(o.id)||J.has(o.id)).length,v=U>0?U:f.length>0?f.length:s.length>0?s.length:C,F=Math.max(M,a.length),p=[];C===0?p.push("No work cycles were found in tasks or historical events for this window."):s.length===0&&p.push("Work history was rescued from events, but normalized task rows are missing."),v>0&&M===0&&F===0&&p.push("Work cycles exist, but none have exact token totals. Capture exact or estimated usage at task close."),A===0&&p.push("No agent sessions were recorded. Session-level model/runtime/cost cannot be attributed yet."),w===0&&p.push("No surfaced context was logged in this window, so reuse and re-exploration waste cannot be proven.");let V=(()=>{try{return k.query(e,`SELECT COALESCE(model_id, 'unknown') AS model,
|
|
33
|
-
SUM(input_tokens) AS t_in, SUM(output_tokens) AS t_out
|
|
34
|
-
FROM token_usage
|
|
35
|
-
WHERE model_id IS NOT NULL AND measured_at >= ?
|
|
36
|
-
GROUP BY COALESCE(model_id, 'unknown')
|
|
37
|
-
ORDER BY t_in + t_out DESC`,Date.parse(t)).map(o=>({model:o.model,tokensIn:o.t_in,tokensOut:o.t_out}))}catch{return[]}})();return{id:`work-cost-${n}d`,windowDays:n,generatedAt:r,workCycles:s.length>0?s.length:C,knownTokenCycles:F,tokensIn:W,tokensOut:L,tokensTotal:W+L,tokenCoveragePercent:v===0?0:Math.min(100,Math.round(Math.max(M,a.filter(o=>O.has(o.id)||o.tokensTotal>0).length)/v*100)),measuredSessions:Math.max(A,Y),surfacedContext:w,usefulContext:K,contextZoneEvents:$,compactions:z,commandSamples:D.samples,commandMs:Math.round(D.total??0),avgStartupMs:x.average===null?null:Math.round(x.average),mostExpensive:a.slice(0,8),byModel:V,historicalRescue:{inferredWorkCycles:C,taskTableCycles:s.length,eventWorkStarts:u,eventStatusChanges:d,eventShips:R,syncRuns:E,memoryEvents:T,postEditEvents:S,declaredTokenMentions:N.length,declaredTokensTotal:N.reduce((o,m)=>o+m.tokens,0),topDeclaredTokenMentions:N.slice(0,5)},gaps:p}}c(Z,"buildWorkCostSnapshot");async function ue(e,n=[7,30,90]){let t=n.map(r=>Z(e,r));for(let r of t)await H({projectId:e,entityType:"work_cost_snapshots",entityId:r.id,eventType:"upsert",data:Q(r)});return t}c(ue,"publishWorkCostSnapshots");function Q(e){return{...e,mostExpensive:e.mostExpensive.map(n=>({...n,description:"[redacted]"})),historicalRescue:{...e.historicalRescue,topDeclaredTokenMentions:e.historicalRescue.topDeclaredTokenMentions.map(n=>({tokens:n.tokens,sourceType:n.sourceType,occurredAt:n.occurredAt,summary:"[redacted]"}))}}}c(Q,"redactSnapshotForCloud");function j(e){let n=b(e.tokens_in)??0,t=b(e.tokens_out)??0,r=n+t;return r<=0?null:{id:e.id,description:e.description,status:e.status,tokensIn:n,tokensOut:t,tokensTotal:r,minutes:oe(e.started_at,e.completed_at??e.shipped_at)}}c(j,"toCostTask");function ee(e,n){let t=y(e,`SELECT type, data, timestamp
|
|
38
|
-
FROM events
|
|
39
|
-
WHERE timestamp >= ?
|
|
40
|
-
AND type >= ?
|
|
41
|
-
AND type < ?
|
|
42
|
-
AND json_valid(data)
|
|
43
|
-
AND json_extract(data, '$.content') LIKE '%token%'
|
|
44
|
-
ORDER BY timestamp DESC
|
|
45
|
-
LIMIT 200`,n,"memory.remember.","memory.remember/"),r=[];for(let s of t){let i=(()=>{try{let u=JSON.parse(s.data);return typeof u.content=="string"?u.content:""}catch{return""}})();if(!i)continue;let a=te(i);for(let u of a)r.push({tokens:u,sourceType:s.type,occurredAt:s.timestamp,summary:ne(i)})}return r.sort((s,i)=>i.tokens-s.tokens)}c(ee,"declaredTokenMentions");function te(e){let n=[],t=/\b(\d+(?:\.\d+)?)\s*([kKmM])?\s*(?:tokens?|tok)\b/g;for(let r of e.matchAll(t)){let s=Number.parseFloat(r[1]??"0"),i=r[2]?.toLowerCase();if(!Number.isFinite(s)||s<=0)continue;let a=i==="m"?1e6:i==="k"?1e3:1;n.push(Math.round(s*a))}return n}c(te,"extractTokenCounts");function ne(e){let n=e.replace(/\s+/g," ").trim();return n.length<=140?n:`${n.slice(0,137)}...`}c(ne,"summarize");function g(e,n,t){return l(e,"SELECT COUNT(*) AS value FROM events WHERE type = ? AND timestamp >= ?",n,t)}c(g,"eventCount");function P(e,n,t){return y(e,`SELECT COUNT(*) AS samples, COALESCE(SUM(value), 0) AS total, AVG(value) AS average
|
|
46
|
-
FROM perf_samples
|
|
47
|
-
WHERE metric = ? AND timestamp >= ?`,n,t)[0]??{samples:0,total:0,average:null}}c(P,"aggregatePerf");function l(e,n,...t){try{return Number(k.get(e,n,...t)?.value??0)}catch{return 0}}c(l,"count");function y(e,n,...t){try{return k.query(e,n,...t)}catch{return[]}}c(y,"query");function se(e){let n=new Date;return n.setDate(n.getDate()-e),n.toISOString()}c(se,"sinceIso");function b(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}c(b,"nullableNumber");function oe(e,n){if(!e||!n)return null;let t=Date.parse(e),r=Date.parse(n);return!Number.isFinite(t)||!Number.isFinite(r)||r<t?null:Math.round((r-t)/6e4)}c(oe,"durationMinutes");export{ae as a,ue as b};
|
|
@@ -1,11 +0,0 @@
|
|
|
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 g}from"./chunk-QDQ7DTDV.mjs";import{a as o}from"./chunk-DYHYDHCW.mjs";import{o as x,r as R}from"./chunk-AKIN5WSQ.mjs";import{j as d,n as H}from"./chunk-SVZHJZ5T.mjs";import{c as h}from"./chunk-ZNQXFWSI.mjs";import{b as m,e as j}from"./chunk-ZX6BC2EB.mjs";import{e as p,f as v}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";import l from"node:fs/promises";import b from"node:os";import S from"node:path";v();H();j();R();var k="prjct-codex-router",C=1024;function w(){return S.join(b.homedir(),".codex","skills","prjct","SKILL.md")}i(w,"getCodexSkillPath");function E(t){return`<!-- ${k}: ${JSON.stringify({v:m,h:t})} -->`}i(E,"getCodexSkillMetadata");function I(t){let e=t.match(new RegExp(`<!--\\s*${k}:\\s*(\\{[\\s\\S]*?\\})\\s*-->`));if(!e)return null;try{let r=JSON.parse(e[1]);return{version:r.v??r.version,templateHash:r.h??r.templateHash}}catch{return null}}i(I,"parseCodexSkillMetadata");function K(t){return g(t).slice(0,12)}i(K,"hashContent");async function y(){return h("codex/SKILL.md")}i(y,"loadCodexSkillTemplate");function L(t){let e=t.trimEnd(),r=K(e),s=E(r);return{content:`${e}
|
|
9
|
-
|
|
10
|
-
${s}
|
|
11
|
-
`,templateHash:r}}i(L,"buildCodexSkillContent");async function P(){try{let t=w(),e=S.dirname(t);await l.mkdir(e,{recursive:!0});let r=await d(t),s=await y();if(!s)return o.warn("Codex SKILL.md template not found"),{success:!1,action:null};let a=L(s),n=Buffer.byteLength(a.content,"utf-8");return n>C&&o.warn(`Codex SKILL.md is ${n} bytes \u2014 over Codex's ~${C}-byte hard limit; the skill may be rejected. Trim editor-surfaces.ts.`),r&&await l.readFile(t,"utf-8").catch(()=>"")===a.content?{success:!0,action:"unchanged"}:(await l.writeFile(t,a.content,"utf-8"),{success:!0,action:r?"updated":"created"})}catch(t){return o.warn(`Codex skill warning: ${p(t)}`),{success:!1,action:null}}}i(P,"installCodexSkill");async function B(t={}){let e=w();if(!(await x()).installed)return{installed:!1,verified:!0,skillPath:e,message:"Codex not detected"};let s=await y();if(!s)return{installed:!0,verified:!1,skillPath:e,message:"Codex SKILL.md template missing from prjct installation",fix:["Reinstall prjct-cli package","Run `prjct setup`"]};let a=L(s),n=i(async()=>t.autoRepair?(await P()).success:!1,"maybeRepair");if(!await d(e)&&!await n())return{installed:!0,verified:!1,skillPath:e,templateHash:a.templateHash,message:"Codex skill missing at ~/.codex/skills/prjct/SKILL.md",fix:["Run `prjct start` to install Codex skill"]};let c=i(async()=>{let u=await l.readFile(e,"utf-8").catch(()=>""),f=I(u);return{matches:f?.version===m&&f?.templateHash===a.templateHash}},"readVerification");if(!(await c()).matches){if(!await n())return{installed:!0,verified:!1,skillPath:e,templateHash:a.templateHash,message:"Codex skill metadata mismatch (outdated router)",fix:["Run `prjct start` or `prjct setup` to refresh Codex skill"]};if(!(await c()).matches)return{installed:!0,verified:!1,skillPath:e,templateHash:a.templateHash,message:"Codex skill could not be repaired automatically",fix:["Delete ~/.codex/skills/prjct/SKILL.md","Run `prjct setup`"]}}return{installed:!0,verified:!0,skillPath:e,templateHash:a.templateHash,message:"Codex p. router ready"}}i(B,"verifyCodexPRouterReady");export{C as a,L as b,P as c,B as d};
|
|
@@ -1,8 +0,0 @@
|
|
|
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 h}from"./chunk-AUUWQH3S.mjs";import{d as c,g as l}from"./chunk-HDHVBB6Q.mjs";import{b as a,e as f,g as d,h as g}from"./chunk-AKIN5WSQ.mjs";import{a as r}from"./chunk-E66B27AL.mjs";import m from"node:crypto";g();f();l();function v(s){let[e,t]=s.split(".");return e?{entityType:e.endsWith("s")?e:`${e}s`,eventType:t==="deleted"||t==="archived"||t==="removed"?"delete":"upsert"}:{}}r(v,"deriveEntityShape");function T(s){if(!s||typeof s!="object")return;let e=s;for(let t of["taskId","task_id","id","feature_id","featureId","specId","spec_id"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}r(T,"entityIdOf");function w(s){let e=s&&typeof s=="object"&&!Array.isArray(s)?JSON.stringify(k(s)):JSON.stringify(s);return m.createHash("sha256").update(e).digest("hex")}r(w,"hashPayload");function k(s){let e={};for(let t of Object.keys(s).sort())e[t]=s[t];return e}r(k,"sortKeys");var u={value:null};async function b(){if(u.value)return u.value;try{let{default:s}=await import("./auth-config-WNUARXTJ.mjs"),e=s;if(typeof e.getDeviceId=="function"){let t=await e.getDeviceId();return u.value=t,t}return"unknown-device"}catch{return"unknown-device"}}r(b,"_resolveDeviceId");var y=class{static{r(this,"StorageManager")}filename;cache;constructor(e,t){this.filename=e,this.cache=new d({ttl:5e3,maxSize:50})}getStoreKey(){return this.filename.replace(".json","")}async read(e){if(!(process.env.PRJCT_IN_DAEMON==="1")){let n=this.cache.get(e);if(n!==null)return n}try{let n=c.getDoc(e,this.getStoreKey());if(n!==null)return this.cache.set(e,n),n}catch{}return this.getDefault()}async write(e,t){c.setDoc(e,this.getStoreKey(),t),this.cache.set(e,t)}async update(e,t){let n=this.getStoreKey(),i=c.updateDoc(e,n,t,()=>this.getDefault());return this.cache.set(e,i),i}async publishEvent(e,t,n){let i=v(t),o={type:t,path:[this.filename.replace(".json","")],data:n,timestamp:a(),projectId:e,entityType:i.entityType,entityId:T(n),eventType:i.eventType,contentHash:w(n),deviceId:await b(),revisionCount:1};await h.publish(o)}async publishEntityEvent(e,t,n,i){let o=`${t}.${n}`,p={...i,timestamp:a()};await this.publishEvent(e,o,p)}async exists(e){try{return c.hasDoc(e,this.getStoreKey())}catch{return!1}}clearCache(e){e?this.cache.delete(e):this.cache.clear()}getCacheStats(){return this.cache.stats()}};export{y as a};
|
|
@@ -1,18 +0,0 @@
|
|
|
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 Y}from"./chunk-45I2C2UB.mjs";import{b as A,c as J}from"./chunk-L4COZ7ZH.mjs";import{a as K}from"./chunk-4KY2EHXS.mjs";import{a as G}from"./chunk-3X7TBM4A.mjs";import{e as B}from"./chunk-7OZDWT6C.mjs";import{c as I}from"./chunk-ZZ65CN5F.mjs";import{d as _}from"./chunk-WSFHSXBZ.mjs";import{a as w}from"./chunk-DGBDMUBL.mjs";import{b as $}from"./chunk-OLKNK2HB.mjs";import{d as f,g as W}from"./chunk-HDHVBB6Q.mjs";import{b as j,d as b,e as rt,f as O,h as at,s as U,t as lt}from"./chunk-AKIN5WSQ.mjs";import{d as ct}from"./chunk-JQE2F2RK.mjs";import{e as k,o as it}from"./chunk-CTWZQ7YI.mjs";import{b as T,e as ut}from"./chunk-ZX6BC2EB.mjs";import{e as F,f as ot}from"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";lt();import M from"node:fs";import mt from"node:path";var q=l(()=>U.getStatePath(),"stampDir"),X=l(()=>mt.join(q(),"installed-version"),"stampPath");function dt(){try{return M.readFileSync(X(),"utf-8").trim()}catch{return null}}l(dt,"readStamp");function pt(i){try{M.mkdirSync(q(),{recursive:!0}),M.writeFileSync(X(),i,"utf-8")}catch{}}l(pt,"writeStamp");function V(i){return i?dt()===i:!0}l(V,"isSyncCurrent");async function z(i){if(i&&process.env.PRJCT_NO_SELF_SYNC!=="1"){try{let{installGlobalConfig:n}=await import("./command-installer-XSKQS3IS.mjs");await n()}catch{}try{await(await import("./settings-installer-QDM3GB6J.mjs")).install()}catch{}try{let{SetupCommands:n}=await import("./setup-VL7YXVE5.mjs");await new n().installStatusLine()}catch{}pt(i)}}l(z,"runSelfHeal");W();ot();it();ct();W();at();rt();var ft=50,H=class{static{l(this,"SessionTracker")}currentRow(n){try{return f.get(n,"SELECT * FROM cli_sessions WHERE status = 'active' ORDER BY last_activity DESC LIMIT 1")??null}catch{return null}}isExpired(n){return O(n,18e5)}toSessionData(n,t){return{id:t.id,projectId:n,status:t.status,createdAt:t.created_at,lastActivity:t.last_activity,commands:[],files:[]}}async touch(n){let t=j(),e=this.currentRow(n);if(e&&!this.isExpired(e.last_activity))return f.run(n,"UPDATE cli_sessions SET last_activity = ? WHERE id = ?",t,e.id),this.toSessionData(n,{...e,last_activity:t});e&&f.run(n,"UPDATE cli_sessions SET status = 'expired' WHERE id = ?",e.id);let s=crypto.randomUUID();return f.run(n,"INSERT INTO cli_sessions (id, status, created_at, last_activity) VALUES (?, 'active', ?, ?)",s,t,t),this.toSessionData(n,{id:s,status:"active",created_at:t,last_activity:t})}async trackCommand(n,t,e){let s=this.currentRow(n);if(!s)return;let r=j();try{f.run(n,"INSERT INTO cli_session_commands (session_id, command, timestamp, duration_ms) VALUES (?, ?, ?, ?)",s.id,t,r,Math.round(e)),f.run(n,"UPDATE cli_sessions SET last_activity = ? WHERE id = ?",r,s.id)}catch{}}async getInfo(n){let t=this.currentRow(n);if(!t||this.isExpired(t.last_activity))return{active:!1,id:null,duration:null,idleSince:null,idleMs:0,expiresIn:null,commandCount:0,commands:[],filesRead:0,filesWritten:0};let e=Date.now(),s=new Date(t.created_at).getTime(),r=new Date(t.last_activity).getTime(),c=e-r,a=Math.max(0,18e5-c),o=f.query(n,"SELECT command FROM cli_session_commands WHERE session_id = ? ORDER BY timestamp DESC LIMIT ?",t.id,ft);return{active:!0,id:t.id,duration:b(e-s),idleSince:t.last_activity,idleMs:c,expiresIn:b(a),commandCount:o.length,commands:o.map(m=>m.command).reverse(),filesRead:0,filesWritten:0}}async expire(n){try{f.run(n,"UPDATE cli_sessions SET status = 'expired' WHERE status = 'active'")}catch{}}async expireIfStale(n){let t=this.currentRow(n);return t&&this.isExpired(t.last_activity)?(f.run(n,"UPDATE cli_sessions SET status = 'expired' WHERE id = ?",t.id),!0):!1}},Z=new H;var ht={commitThreshold:10,dayThreshold:3,significantFiles:["package.json","tsconfig.json","Cargo.toml","go.mod","requirements.txt","pyproject.toml",".env.example","docker-compose.yml","Dockerfile"]},L=class{static{l(this,"StalenessChecker")}projectPath;config;constructor(n,t={}){this.projectPath=n,this.config={...ht,...t}}async check(n){let t={isStale:!1,reason:null,lastSyncCommit:null,currentCommit:null,commitsSinceSync:0,daysSinceSync:0,changedFiles:[],significantChanges:[]};try{let e=(()=>{try{return f.getDoc(n,"project")}catch{return null}})();if(!e)return t.isStale=!0,t.reason="No sync history found. Run `prjct sync` to initialize.",t;t.lastSyncCommit=e.lastSyncCommit||null;let s=e.lastSync;if(!t.lastSyncCommit)return t.isStale=!0,t.reason="No sync commit recorded. Run `prjct sync` to track.",t;let c={cwd:this.projectPath,timeoutMs:3e3,maxBuffer:1024*256},a=`${t.lastSyncCommit}..HEAD`,[o,m]=await Promise.all([k(["rev-parse","--short","HEAD"],c),k(["rev-list","--count",a],c)]);if(!o.ok)return t.reason=o.kind==="exit"?"Not a git repository":`git ${o.kind} \u2014 staleness unknown`,t;if(t.currentCommit=o.stdout.trim(),t.lastSyncCommit===t.currentCommit)return t.reason="Context is up to date",t;if(!m.ok)return m.kind==="exit"?(t.isStale=!0,t.reason="Sync commit no longer exists (history changed). Run `prjct sync`."):t.reason=`git ${m.kind} reading history \u2014 staleness unknown. Retry shortly.`,t;if(t.commitsSinceSync=parseInt(m.stdout.trim(),10)||0,s){let y=new Date(s),g=new Date;t.daysSinceSync=Math.floor((g.getTime()-y.getTime())/(1e3*60*60*24))}if(t.commitsSinceSync>0&&t.commitsSinceSync<this.config.commitThreshold){let y=await k(["diff","--name-only",a],c),g=y.ok?y.stdout.trim().split(`
|
|
9
|
-
`).filter(Boolean).slice(0,200):[];t.changedFiles=g,t.significantChanges=g.filter(d=>this.config.significantFiles.some(p=>d.endsWith(p)||d.includes(p)))}else t.changedFiles=[],t.significantChanges=[];return t.commitsSinceSync>=this.config.commitThreshold?(t.isStale=!0,t.reason=`${t.commitsSinceSync} commits since last sync (threshold: ${this.config.commitThreshold})`):t.daysSinceSync>=this.config.dayThreshold?(t.isStale=!0,t.reason=`${t.daysSinceSync} days since last sync (threshold: ${this.config.dayThreshold})`):t.significantChanges.length>0?(t.isStale=!0,t.reason=`Significant files changed: ${t.significantChanges.join(", ")}`):t.commitsSinceSync>0?t.reason=`${t.commitsSinceSync} commits since sync (threshold: ${this.config.commitThreshold})`:t.reason="Context is up to date",t}catch(e){return t.reason=`Error checking staleness: ${F(e)}`,t}}formatStatus(n){let t=[];n.isStale?t.push("CLAUDE.md status: \u26A0\uFE0F STALE"):t.push("CLAUDE.md status: \u2713 Fresh");let e=[];if(n.lastSyncCommit&&e.push(`Last sync: ${n.lastSyncCommit}`),n.currentCommit&&e.push(`Current: ${n.currentCommit}`),n.commitsSinceSync>0&&e.push(`Commits since: ${n.commitsSinceSync}`),n.daysSinceSync>0&&e.push(`Days since: ${n.daysSinceSync}`),n.changedFiles.length>0&&e.push(`Files changed: ${n.changedFiles.length}`),e.length>0){let s=Math.max(...e.map(c=>c.length)),r="\u2500".repeat(s+2);t.push(`\u250C${r}\u2510`);for(let c of e)t.push(`\u2502 ${c.padEnd(s)} \u2502`);t.push(`\u2514${r}\u2518`)}if(n.significantChanges.length>0){t.push(""),t.push("Significant changes:");for(let s of n.significantChanges.slice(0,5))t.push(` \u2022 ${s}`);n.significantChanges.length>5&&t.push(` ... and ${n.significantChanges.length-5} more`)}return n.reason&&(t.push(""),t.push(n.reason)),n.isStale&&(t.push(""),t.push("Run `prjct sync` to update context")),t.join(`
|
|
10
|
-
`)}async getSessionInfo(n){return Z.getInfo(n)}formatSessionInfo(n){let t=[];if(!n.active)return t.push("Session: \u25CB No active session"),t.join(`
|
|
11
|
-
`);t.push(`Session: \u25B6 Active (${n.duration})`);let e=[];if(n.commandCount>0){let s=new Set,r=[];for(let c of n.commands)s.has(c)||(s.add(c),r.push(c));e.push(`Commands: ${r.join(" \u2192 ")} (${n.commandCount} total)`)}if((n.filesRead>0||n.filesWritten>0)&&e.push(`Files: ${n.filesRead} read, ${n.filesWritten} written`),e.push(`Idle: ${n.expiresIn} until timeout`),e.length>0){let s=Math.max(...e.map(c=>c.length)),r="\u2500".repeat(s+2);t.push(`\u250C${r}\u2510`);for(let c of e)t.push(`\u2502 ${c.padEnd(s)} \u2502`);t.push(`\u2514${r}\u2518`)}return t.join(`
|
|
12
|
-
`)}getWarning(n){return n.isStale?n.commitsSinceSync>0?`\u26A0\uFE0F Context stale (${n.commitsSinceSync} commits behind). Run \`prjct sync\``:n.daysSinceSync>0?`\u26A0\uFE0F Context stale (${n.daysSinceSync} days old). Run \`prjct sync\``:"\u26A0\uFE0F Context may be stale. Run `prjct sync`":null}},tt=l((i,n)=>new L(i,n),"createStalenessChecker");ut();var gt=1600,P=3,yt=4;async function St(i,n,t={}){let e=n??await $.readConfig(i);if(!e?.projectId)return null;let s=e.persona,r=t.digest?await(async()=>{try{let{memoryL0IndexForSession:h}=await import("./memory-index-MQCHZFUE.mjs");return h(e.projectId,{rebuildIfStale:!0})||nt(e.projectId)}catch{return nt(e.projectId)}})():null,c=Ct(i,e.projectId),a=import("./vault-retire-notice-GRT3QRLZ.mjs").then(({vaultRetirementNotice:h})=>h(e,e.projectId)),o=(async()=>{try{let{buildLandCue:h}=await import("./land-cue-FNLP4IAB.mjs");return await h(e.projectId,i,e)}catch{return null}})(),m=(async()=>{try{let{effectiveWeakModelMode:h,weakModelBanner:C}=await import("./weak-model-mode-GLXXHG32.mjs");return h(e)==="on"?C():null}catch{return null}})(),v=t.digest?(async()=>{try{let{formatPendingHandoffCue:h}=await import("./agent-switch-XMFUTNNV.mjs"),C=h(e.projectId);return C?`# prjct: pending handoff
|
|
13
|
-
${C}`:null}catch{return null}})():Promise.resolve(null),y=t.digest?(async()=>{try{let{loadSessionContinuity:h,formatContinuitySessionCue:C}=await import("./session-continuity-5CLT5YBL.mjs");return C(h(e.projectId))}catch{return null}})():Promise.resolve(null),g=$t(i,e.projectId),[d,p,S,E,x,R,D]=await Promise.all([c,a,o,m,v,y,g]);if(!D&&!s&&!r&&!d&&!p&&!S&&!E&&!x&&!R)return null;let u=["# prjct: project context",""];return D&&u.push(D,""),s&&u.push(Et(s),"","> Exposed as state, not prescription. Decide whether any of this matters for the current turn."),r&&(s&&u.push(""),u.push(r)),d&&((s||r)&&u.push(""),u.push(d)),p&&((s||r||d)&&u.push(""),u.push(p)),S&&((s||r||d||p)&&u.push(""),u.push(S)),E&&((s||r||d||p||S)&&u.push(""),u.push(E)),x&&((s||r||d||p||S||E)&&u.push(""),u.push(x)),R&&((s||r||d||p||S||E||x)&&u.push(""),u.push(R)),u.join(`
|
|
14
|
-
`)}l(St,"buildSessionContext");async function Ct(i,n){try{let t=tt(i),e=await t.check(n);if(!e.isStale||e.commitsSinceSync<=0)return null;let s=t.getWarning(e);if(!s)return null;try{let c=await import("node:path"),a=await import("node:os"),{maybeDetachDriftRefresh:o,readDriftStamp:m,formatDriftNotice:v,driftStaleResolved:y}=await import("./drift-refresh-TD3PYPJN.mjs"),g=process.env.PRJCT_CLI_HOME?c.resolve(process.env.PRJCT_CLI_HOME):c.join(a.homedir(),".prjct-cli"),d=m(g);if(y(d))return v({warning:s,commitsSinceSync:e.commitsSinceSync,stamp:d,refreshScheduled:!1});let p=o({projectPath:i,cliHome:g,commitsSinceSync:e.commitsSinceSync}),S=m(g);return v({warning:s,commitsSinceSync:e.commitsSinceSync,stamp:S,refreshScheduled:p})}catch{}let r=await(async()=>{try{let{hasSymbolIndex:c,loadMeta:a}=await import("./symbol-graph-LZM4RZXZ.mjs");if(!c(n))return" Code graph empty \u2014 `prjct code reindex` (or `prjct sync`) before trace/impact.";if(e.commitsSinceSync<5)return"";let o=a(n);return` Symbol index may lag${o?.builtAt?` (index ${o.builtAt.slice(0,10)})`:""} \u2014 prefer \`prjct code reindex\` after big pulls.`}catch{return""}})();return`**Understanding may be stale:** ${s} \u2014 run \`prjct sync\` before big calls.${r}`}catch{return null}}l(Ct,"buildStalenessNotice");function nt(i){let n=(()=>{try{let o=I.rerank(i,w.recall(i,{types:["gotcha","anti-pattern"],limit:P*4})).slice(0,P),m=I.rerank(i,w.recall(i,{types:["decision"],limit:P*4})).slice(0,P);return{gotchas:o,decisions:m}}catch{return null}})();if(!n)return null;let{gotchas:t,decisions:e}=n,s=(()=>{try{let o=w.recall(i,{types:["feedback","improvement-signal"],limit:40,dedupeByKey:!1});return K(o,yt)}catch{return[]}})(),r=st(i,new Set([...t,...e].map(o=>o.id))),c=(()=>{try{let o=G(i);return o?B(o,{maxConventions:4,maxPatterns:3,maxAnti:2}):null}catch{return null}})();if(t.length===0&&e.length===0&&!r&&s.length===0&&!c)return null;let a=["## What this project already knows",""];if(a.push("> Carried across sessions and model updates \u2014 this survived even if your conversation context did not. Apply these; do not re-derive from source."),s.length>0){a.push("","**How this developer works (act as them):**");for(let o of s){let m=o.rule.length>140?`${o.rule.slice(0,139)}\u2026`:o.rule;a.push(`- ${m} \`${o.sourceId}\``)}}if(c){let o=c.replace(/^## How this repo works \(project style\)\n?/,"").trim();o&&a.push("","**How this repo works (match house style):**",o)}if(t.length>0){a.push("","**Traps to avoid:**");for(let o of t)a.push(`- ${N(o)}`)}if(e.length>0){a.push("","**Decisions in force:**");for(let o of e)a.push(`- ${N(o)}`)}return r&&a.push("","**Keeps being missed:**",`- ${N(r.entry)} \u2014 flagged relevant-but-unused ${r.count}\xD7. Apply it or supersede it.`),a.push("","> Resolve any `mem_id` with `prjct search <id>`. Full developer model: MCP `prjct_developer`. Project style: `prjct analysis` / sync evolution."),A(a.join(`
|
|
15
|
-
`),gt)}l(nt,"buildKnowledgeDigest");function N(i){let n=_(i),t=(i.content??"").replace(/\s+/g," ").trim();if(t.length<=n.length+8)return`${n} \`${i.id}\``;let e=t.slice(n.length).replace(/^[\s.:;—-]+/,"").trim();if(e.length<24)return`${n} \`${i.id}\``;let s=e.length>90?`${e.slice(0,89)}\u2026`:e;return`${n} \u2014 ${s} \`${i.id}\``}l(N,"digestLine");var wt=2;function st(i,n){try{let t=w.recall(i,{types:["improvement-signal"],tags:{kind:"skill-miss"},limit:50,dedupeByKey:!1}),e=new Map;for(let a of t){let o=a.tags?.relates;o&&e.set(o,(e.get(o)??0)+1)}let[s,r]=[...e].reduce((a,o)=>o[1]>a[1]?o:a,[null,0]);if(!s||r<wt||n.has(s))return null;let c=w.getById(i,s);return c?{entry:c,count:r}:null}catch{return null}}l(st,"findRepeatMissedEntry");var vt=500,et=2;async function tn(i){let n=await $.readConfig(i).catch(()=>null);if(!n?.projectId)return null;let t=["# prjct: subagent context"];n.persona?.role&&t.push(`Role in this project: ${n.persona.role}`);try{let{resolveActiveTask:e}=await import("./task-service-BM2JQXMS.mjs"),s=await e(n.projectId,i);s&&t.push(`Active work cycle (this worktree): ${s.description}`)}catch{}try{let e=I.rerank(n.projectId,w.recall(n.projectId,{types:["gotcha","anti-pattern"],limit:et*4})).slice(0,et);if(e.length>0){t.push("Traps to avoid:");for(let r of e)t.push(`- ${_(r)} \`${r.id}\``)}let s=st(n.projectId,new Set(e.map(r=>r.id)));s&&t.push(`Keeps being missed: ${_(s.entry)} \`${s.entry.id}\``)}catch{}return t.length<=1?null:A(t.join(`
|
|
16
|
-
`),vt)}l(tn,"buildSubagentDigest");function Et(i){let n=[];return n.push(`## Your role in this project: **${i.role}**`),i.focus&&n.push(`Focus: ${i.focus}`),i.mcps&&i.mcps.length>0&&n.push(`Available MCPs this project expects: ${i.mcps.join(", ")}`),i.packs&&i.packs.length>0&&n.push(`Active packs: ${i.packs.join(", ")}`),n.join(`
|
|
17
|
-
`)}l(Et,"formatPersona");async function $t(i,n){try{let t=await import("node:path"),{execFileAsync:e}=await import("./exec-I7XE7NMD.mjs"),s=t.basename(i),r=await(async()=>{try{let{stdout:o}=await e("git",["branch","--show-current"],{cwd:i});return o.trim()}catch{return""}})(),c=n.length>12?`${n.slice(0,8)}\u2026`:n,a=["## Project identity (cwd)",`- **${s}** \xB7 id \`${c}\``];return r&&a.push(`- Branch: \`${r}\``),a.push("- Skill is portable L0 \u2014 if skill text names another project, ignore it; trust this block + `prjct context --md`."),a.join(`
|
|
18
|
-
`)}catch{return null}}l($t,"buildProjectIdentityLine");function nn(i=process.cwd(),n){let t=$.readConfig(i).catch(()=>null);return J({event:"SessionStart",projectPath:i,build:l(async(e,s)=>{let r=s===i?await t:await $.readConfig(s).catch(()=>null),c=e.source??"startup";return St(s,r,{digest:c==="startup"||c==="clear"||c==="compact"})},"build"),afterEmit:l(async(e,s)=>{let r=await t;if(r?.projectId){let c=await(async()=>{try{let{collectActiveTasks:a}=await import("./task-overview-6ZQKJGSH.mjs"),o=await a(r.projectId,s);return{taskId:o.current?.id??null,goal:o.current?.description??e.source??null}}catch{return{taskId:null,goal:e.source??null}}})();Y({projectId:r.projectId,sessionId:e.session_id,directory:s,taskId:c.taskId,goal:c.goal})}V(T)||await z(T).catch(()=>{});try{let{maybeAutoUpdate:c}=await import("./auto-updater-EHRRMCYY.mjs");c(T)}catch{}},"afterEmit")},n)}l(nn,"runSessionStartHook");export{St as a,tn as b,$t as c,nn as d};
|
|
@@ -1,18 +0,0 @@
|
|
|
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 w,c as te,d as ne}from"./chunk-JQE2F2RK.mjs";import{a as D,b as ee}from"./chunk-WUHGODSQ.mjs";import{g as S,n as A}from"./chunk-SVZHJZ5T.mjs";import{b as R,o as Z}from"./chunk-CTWZQ7YI.mjs";import{a as O,e as h,f as N}from"./chunk-BUDZL4DW.mjs";import{a as i,b as k}from"./chunk-E66B27AL.mjs";ne();ee();N();import{constants as me}from"node:fs";import g from"node:fs/promises";import y from"node:os";import a from"node:path";te();import d from"node:fs/promises";import T from"node:path";N();A();import m from"node:fs";import re from"node:fs/promises";import M from"node:os";import u from"node:path";var _="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 e=oe();if(e)return e;if(process.env.PRJCT_MCP_ALLOW_LOCAL==="1"){let t=ie();if(t)return{command:t,args:["mcp-server"],description:E}}return{command:"npx",args:["-y","prjct-cli@latest","mcp-server"],description:E}}i(se,"getPrjctMcpConfig");function I(e){let t=e.replace(/\\/g,"/");return!!(t.includes("/.worktrees/")||t.includes("/prjct-cli/bin/prjct")&&!t.includes("/node_modules/prjct-cli/"))}i(I,"isNonProductionPrjctPath");function oe(){let e=[];try{e.push(u.dirname(k.resolve("prjct-cli/package.json")))}catch{}let t=M.homedir();for(let n of[process.env.NVM_BIN?u.resolve(process.env.NVM_BIN,".."):"",u.join(t,".nvm","versions","node",process.version,"lib"),"/opt/homebrew/lib","/usr/local/lib"].filter(Boolean))e.push(u.join(n,"node_modules","prjct-cli"));for(let n of e){if(I(n))continue;let r=u.join(n,"bin","prjct.cjs"),o=m.existsSync(u.join(n,"dist","bin","prjct.mjs"))||m.existsSync(u.join(n,"dist","bin","prjct-core.mjs"));if(!m.existsSync(r)||!o)continue;let c=[process.execPath,u.join(u.dirname(process.execPath),"node"),u.join(n,"..","..","bin","node")].find(P=>P&&m.existsSync(P)),p=u.resolve(n,"..","..","..","bin","node"),f=m.existsSync(p)?p:c??process.execPath;return{command:f,args:[r,"mcp-server"],env:{PATH:`${u.dirname(f)}${u.delimiter}/usr/bin${u.delimiter}/bin`},description:E}}return null}i(oe,"resolvePublishedPrjctMcpConfig");function ie(){let e=process.argv[1],t=[e?u.resolve(u.dirname(e),"prjct"):"",e?u.resolve(u.dirname(e),"..","bin","prjct"):"",u.resolve(process.cwd(),"bin","prjct")].filter(Boolean);for(let n of t){if(!m.existsSync(n))continue;let r=(()=>{try{return m.realpathSync(n)}catch{return n}})();if(!I(r))return r}return null}i(ie,"resolveLocalPrjctBin");var v={context7:{command:"npx",args:["-y","@upstash/context7-mcp@latest"],description:"Library documentation lookup"},prjct:se(),linear:{command:"npx",args:["-y",_,"https://mcp.linear.app/mcp"],description:"Linear MCP server (OAuth)"},jira:{command:"npx",args:["-y",_,"https://mcp.atlassian.com/v1/mcp"],description:"Atlassian MCP server for Jira (OAuth)"}};function j(){return process.env.PRJCT_TEST_MODE==="1"?u.join(M.tmpdir(),"prjct-context7-test","mcp.json"):u.join(M.homedir(),".claude","mcp.json")}i(j,"getClaudeMcpConfigPath");async function V(e=j()){try{let t=await re.readFile(e,"utf-8");return JSON.parse(t)}catch(t){let n=h(t).toLowerCase();if(n.includes("no such file")||n.includes("enoent"))return{};throw new Error(`Failed to read MCP config at ${e}: ${h(t)}`)}}i(V,"readMcpConfig");async function ce(e,t=j()){await S(t,e)}i(ce,"writeMcpConfig");async function Re(e,t,n=j()){let r=await V(n),o={...r.mcpServers||{}},s=o[e];o[e]=t,r.mcpServers=o;let c=JSON.stringify(s)!==JSON.stringify(t);return await ce(r,n),{path:n,changed:c}}i(Re,"upsertMcpServer");async function Oe(e,t=j()){return!!(await V(t)).mcpServers?.[e]}i(Oe,"hasMcpServer");var $="# prjct:mcp:start - managed by prjct, do not edit between markers",L="# prjct:mcp:end",F="# prjct:mcp:context7:start - managed by prjct, do not edit between markers",J="# prjct:mcp:context7:end",B=["model-with-reasoning","current-dir","git-branch","context-remaining","five-hour-limit","weekly-limit","task-progress"];function x(){return process.env.PRJCT_TEST_MODE==="1"?T.join(w(".prjct-tests"),"codex","config.toml"):w(".codex","config.toml")}i(x,"getCodexConfigTomlPath");function C(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}i(C,"tomlString");function X(e,t,n,r){let o=(t.args??[]).map(C).join(", "),s=[n,`[mcp_servers.${e}]`,`command = ${C(t.command)}`,`args = [${o}]`];if(t.env&&Object.keys(t.env).length>0){let c=Object.entries(t.env).map(([p,f])=>`${p} = ${C(f)}`).join(", ");s.push(`env = { ${c} }`)}return s.push(r,""),s.join(`
|
|
9
|
-
`)}i(X,"buildMcpTomlBlock");function ae(e=v.prjct){return X("prjct",e,$,L)}i(ae,"buildPrjctMcpTomlBlock");function ue(e=v.context7){return X("context7",e,F,J)}i(ue,"buildContext7McpTomlBlock");function H(e,t,n,r,o){let s=e.indexOf(n),c=e.indexOf(r);if(s!==-1&&c!==-1&&c>s){let p=e.slice(0,s),f=e.slice(c+r.length),P=f.startsWith(`
|
|
10
|
-
`)?f.slice(1):f;return{next:p+t+P}}return new RegExp(`^\\s*\\[mcp_servers\\.${o}\\]`,"m").test(e)?{next:e,skipped:"user-managed"}:e.trim().length>0?{next:`${e.trimEnd()}
|
|
11
|
-
|
|
12
|
-
${t}`}:{next:t}}i(H,"upsertMarkedBlock");function pe(){return["[tui]",`status_line = [${B.map(C).join(", ")}]`,""].join(`
|
|
13
|
-
`)}i(pe,"buildCodexStatusLineToml");function fe(e){return/^\s*(?:tui\.)?status_line\s*=/m.test(e)}i(fe,"hasCodexStatusLine");function le(e){if(fe(e))return{toml:e,changed:!1};let n=`status_line = [${B.map(C).join(", ")}]
|
|
14
|
-
`,r=/^\s*\[tui\]\s*$/m.exec(e);if(r){let s=r.index+r[0].length,c=e.slice(0,s),p=e.slice(s),f=p.startsWith(`
|
|
15
|
-
`)?p.slice(1):p;return{toml:`${c}
|
|
16
|
-
${n}${f}`,changed:!0}}let o=pe();return{toml:e.trim().length>0?`${e.trimEnd()}
|
|
17
|
-
|
|
18
|
-
${o}`:o,changed:!0}}i(le,"ensureCodexStatusLineToml");async function Le(e=x()){let t=await d.readFile(e,"utf-8").catch(()=>""),n=ae(),r=H(t,n,$,L,"prjct"),o=r.skipped,s=le(r.next),c=s.toml;return c===t?{path:e,changed:!1,skipped:o}:(await d.mkdir(T.dirname(e),{recursive:!0}),await d.writeFile(e,c,"utf-8"),{path:e,changed:!0,skipped:o,statusLineChanged:s.changed})}i(Le,"ensureCodexMcpServer");async function K(e=x()){let t=await d.readFile(e,"utf-8").catch(()=>""),n=ue(),{next:r,skipped:o}=H(t,n,F,J,"context7");return r===t?{path:e,changed:!1,skipped:o}:(await d.mkdir(T.dirname(e),{recursive:!0}),await d.writeFile(e,r,"utf-8"),{path:e,changed:!0,skipped:o})}i(K,"ensureCodexContext7Server");async function U(e=x()){try{let t=await d.readFile(e,"utf-8");return/^\s*\[mcp_servers\.context7\]/m.test(t)}catch{return!1}}i(U,"codexHasContext7Server");Z();A();function z(){return process.env.NODE_ENV==="test"?a.join(y.tmpdir(),"prjct-context7-test","verify-cache.json"):a.join(D(),"state","context7-verify.json")}i(z,"getVerifyCachePath");async function de(){try{let e=await g.readFile(z(),"utf-8"),t=JSON.parse(e);if(typeof t?.at=="number"&&t.status)return{...t,provider:t.provider??"claude"}}catch{}return null}i(de,"readPersistedVerify");async function ge(e,t,n){let r=z();try{await g.mkdir(a.dirname(r),{recursive:!0}),await g.writeFile(r,JSON.stringify({at:e,provider:t,status:n}),"utf-8")}catch{}}i(ge,"writePersistedVerify");var Q=v.context7,l={value:null},he=[a.dirname(process.execPath),"/opt/homebrew/bin","/usr/local/bin","/opt/local/bin","/usr/bin","/bin"],ve=[[".bun","bin"],[".local","bin"],[".volta","bin"],[".asdf","shims"],[".local","share","mise","shims"],[".rtx","shims"],[".npm-global","bin"]];async function W(e){try{return(await g.readdir(e,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name)}catch{return[]}}i(W,"listChildDirs");async function Ce(e){let t=[],n=process.env.NVM_DIR||a.join(e,".nvm"),r=a.join(n,"versions","node");for(let c of await W(r))t.push(a.join(r,c,"bin"));let o=process.env.FNM_DIR||a.join(e,".local","share","fnm"),s=a.join(o,"node-versions");for(let c of await W(s))t.push(a.join(s,c,"installation","bin"));return t}i(Ce,"discoverNodeManagerBinDirs");async function xe(e=process.env.PATH||"",t=y.homedir()){let n=new Set,r=[],o=ve.map(c=>a.join(t,...c)),s=[...he,...o,...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 Ce(t)];for(let c of[...e.split(a.delimiter),...s]){let p=c.trim();!p||n.has(p)||(n.add(p),r.push(p))}return r.join(a.delimiter)}i(xe,"buildContext7SmokePath");async function Pe(e,t){if(a.isAbsolute(e)||e.includes(a.sep))return e;let n=process.platform==="win32"?(process.env.PATHEXT||".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean):[""];for(let r of t.split(a.delimiter))if(r)for(let o of n){let s=a.join(r,e+o);try{return await g.access(s,me.X_OK),s}catch{}}return e}i(Pe,"resolveExecutable");function G(){return process.env.PRJCT_CONTEXT7_CONFIG?process.env.PRJCT_CONTEXT7_CONFIG:process.env.NODE_ENV==="test"?a.join(y.tmpdir(),"prjct-context7-test","mcp.json"):a.join(y.homedir(),".claude","mcp.json")}i(G,"getConfigPath");async function Y(e){try{let t=await g.readFile(e,"utf-8");return JSON.parse(t)}catch(t){if(O(t))return{};throw t}}i(Y,"readConfig");async function Se(){if(process.env.PRJCT_SKIP_CONTEXT7_SMOKE==="1"||process.env.NODE_ENV==="test")return;let e=Q,t=[...e.args||[],"--help"],n=await xe(),r=await Pe(e.command||"npx",n);await R(r,t,{timeout:15e3,env:{...process.env,PATH:n}})}i(Se,"runSmokeCheck");var b=class{static{i(this,"Context7Service")}async install(t="claude"){if(t==="codex")return this.installCodex();if(t!=="claude")return{installed:!1,verified:!1,configPath:"",message:`Context7 auto-config not supported for ${t}; skipping`};let n=G(),r=a.dirname(n);await g.mkdir(r,{recursive:!0});let o=await Y(n),s=o.mcpServers||{},c=Q,p=s.context7;return p&&JSON.stringify(p)===JSON.stringify(c)?{installed:!0,verified:!1,configPath:n,message:"Context7 MCP already configured"}:(s.context7=c,o.mcpServers=s,await S(n,o),l.value=null,{installed:!0,verified:!1,configPath:n,message:"Context7 MCP configured"})}async installCodex(){let t=await K();return t.changed&&(l.value=null),{installed:!0,verified:!1,configPath:t.path,message:t.skipped==="user-managed"?"Context7 MCP user-managed in config.toml":"Context7 MCP configured in config.toml"}}async resolveConfigured(t){if(t==="codex"){let c=x();return await U(c)?{ok:!0,configPath:c}:{ok:!1,configPath:c,message:"Context7 MCP not configured in ~/.codex/config.toml"}}if(t!=="claude")return{ok:!1,configPath:"",message:`Context7 not managed for ${t}`};let n=G(),s=((await Y(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(t="claude"){let n=Date.now();if(l.value&&l.value.provider===t&&n-l.value.at<3e5)return l.value.status;let r=await de();if(r?.status.verified&&r.provider===t&&n-r.at<3e5)return l.value=r,r.status;let o=await this.resolveConfigured(t);if(!o.ok)return{installed:!1,verified:!1,configPath:o.configPath,message:o.message};try{await Se();let s={installed:!0,verified:!0,configPath:o.configPath};return l.value={at:n,provider:t,status:s},await ge(n,t,s),s}catch(s){let c={installed:!0,verified:!1,configPath:o.configPath,message:`Context7 smoke check failed: ${h(s)}`};return l.value={at:n,provider:t,status:c},c}}async ensureReady(t="claude"){await this.install(t);let n=await this.verify(t);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}},je=new b,Ze=je;export{v as a,j as b,Re as c,Oe as d,Le as e,K as f,z as g,xe as h,Ze as i};
|
|
@@ -1,38 +0,0 @@
|
|
|
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 Ct}from"./chunk-FGQZ62ZP.mjs";import{a as gt,b as ht,c as yt,d as St,e as wt}from"./chunk-TXJT3G53.mjs";import{a as ut}from"./chunk-A5RNWWTH.mjs";import{a as Be}from"./chunk-HZIORCPO.mjs";import{a as Je}from"./chunk-WDGDFXSB.mjs";import{a as ne,b as qe}from"./chunk-NWY5M34K.mjs";import{a as Ke,b as xt}from"./chunk-2HTDCLZD.mjs";import{a as mt,b as pt}from"./chunk-CPHUFXD2.mjs";import{d as ft}from"./chunk-GELCZWKW.mjs";import{a as ct,b as lt}from"./chunk-QDQ7DTDV.mjs";import{a as kt,b as vt,c as bt,d as Pt}from"./chunk-ZTZTVBAZ.mjs";import{a as f}from"./chunk-DYHYDHCW.mjs";import{b as Y,c as tt,d as rt}from"./chunk-YJMWY4Y6.mjs";import{c as st,d as nt,e as oe,f as at,g as ot}from"./chunk-NJAMZSHM.mjs";import{a as it}from"./chunk-MQVVNX63.mjs";import{i as dt}from"./chunk-J6JZ4PQA.mjs";import{a as et}from"./chunk-2WPR5GFT.mjs";import{b as Qe,c as Xe,d as Ze}from"./chunk-4DDCWMI6.mjs";import{a as Ye}from"./chunk-DVBBB5BS.mjs";import{a as ae,b as R}from"./chunk-BISPGBNN.mjs";import{a as ze}from"./chunk-HJ4HEI45.mjs";import{c as Ve}from"./chunk-3LG3ACQV.mjs";import{c as We}from"./chunk-AOPJ4Z6O.mjs";import{b as T}from"./chunk-OLKNK2HB.mjs";import{d as P,e as I,g as K}from"./chunk-HDHVBB6Q.mjs";import{d as se}from"./chunk-CDCCAU22.mjs";import{b,e as re,m as He,o as Le,r as br,s as q,t as Ge}from"./chunk-AKIN5WSQ.mjs";import{b as Ne,f as vr}from"./chunk-HDSS6UB3.mjs";import{d as Te,e as $e,f as Oe,j as L,n as B}from"./chunk-SVZHJZ5T.mjs";import{a as _e,o as kr}from"./chunk-CTWZQ7YI.mjs";import{a as Ue}from"./chunk-ZNQXFWSI.mjs";import{d as w}from"./chunk-PKDYFXMI.mjs";import{a as M,d as Me,e as v,f as N}from"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";function Dt(r,e){let t=[];G("Languages",r.languages,e.languages,t),G("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)"}),G("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(u=>u.name),a=e.patterns.map(u=>u.name);G("Patterns",s,a,t);let o=r.antiPatterns.map(u=>u.issue),n=e.antiPatterns.map(u=>u.issue);G("Anti-patterns",o,n,t);let l=t.filter(u=>u.type==="added").length,c=t.filter(u=>u.type==="removed").length,d=t.filter(u=>u.type==="changed").length;return{hasChanges:t.length>0,items:t,summary:{added:l,removed:c,changed:d},beforeCommit:r.commitHash??null,afterCommit:e.commitHash??null}}i(Dt,"generateAnalysisDiff");function ps(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(ps,"formatAnalysisDiffMd");function fs(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(fs,"formatAnalysisDiffText");function G(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(G,"diffStringArray");N();B();vr();import ie from"node:fs/promises";import F from"node:path";import{z as p}from"zod";var Pr=p.enum(["draft","verified","sealed"]),Cr=p.object({name:p.string(),description:p.string(),location:p.string().optional(),severity:p.enum(["low","medium","high"]).optional(),language:p.string().optional(),framework:p.string().optional(),source:p.enum(["baseline","repo","context7","feedback"]).optional(),confidence:p.number().min(0).max(1).optional()}),xr=p.object({issue:p.string(),file:p.string(),suggestion:p.string(),severity:p.enum(["low","medium","high"]).optional(),language:p.string().optional(),framework:p.string().optional(),source:p.enum(["baseline","repo","context7","feedback"]).optional(),confidence:p.number().min(0).max(1).optional()}),ce=p.object({projectId:p.string(),languages:p.array(p.string()),frameworks:p.array(p.string()),packageManager:p.string().optional(),sourceDir:p.string().optional(),testDir:p.string().optional(),configFiles:p.array(p.string()),fileCount:p.number(),patterns:p.array(Cr),antiPatterns:p.array(xr),analyzedAt:p.string(),modelMetadata:Ne.optional(),status:Pr.default("draft"),commitHash:p.string().optional(),signature:p.string().optional(),sealedAt:p.string().optional(),verifiedAt:p.string().optional()});var Dr={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 Ar(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=F.join(e,"package.json"),a=await ie.readFile(s,"utf-8"),o=JSON.parse(a),n={...o.dependencies,...o.devDependencies},l=[],c=[];for(let d of r.frameworks){let u=d.toLowerCase();Object.keys(n).some(y=>y.toLowerCase().includes(u))?c.push(d):l.push(d)}return l.length===0?{name:"Framework verification",passed:!0,output:`${c.length} framework(s) verified in dependencies`,durationMs:Date.now()-t}:{name:"Framework verification",passed:!1,error:`Frameworks not found in dependencies: ${l.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(Ar,"verifyFrameworks");async function jr(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 Fr(e),a=new Set(s),o=[],n=[];for(let l of r.languages){let c=Dr[l];if(!c)continue;c.some(u=>a.has(u))?o.push(l):n.push(l)}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(jr,"verifyLanguages");async function Ir(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 l=n.location,c=F.join(e,l);await L(c)?o.push(l):a.push(`${n.name} (${l})`)}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(Ir,"verifyPatternLocations");async function Er(r,e){let t=Date.now();try{let s=await _r(e),a=r.fileCount,o=.1,n=Math.abs(s-a),l=a*o;return n<=l?{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(Er,"verifyFileCount");async function Rr(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=F.join(e,o.file);await L(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(Rr,"verifyAntiPatternFiles");async function At(r,e){let t=Date.now(),s=await Promise.all([Ar(r,e),jr(r,e),Ir(r,e),Er(r,e),Rr(r,e)]),a=s.filter(n=>!n.passed).length,o=s.filter(n=>n.passed).length;return{passed:a===0,checks:s,totalMs:Date.now()-t,failedCount:a,passedCount:o}}i(At,"semanticVerify");async function Fr(r){let e=new Set,t=[/node_modules/,/\.git/,/dist/,/build/,/\.next/,/\.turbo/,/coverage/];async function s(a){try{let o=await ie.readdir(a,{withFileTypes:!0});for(let n of o){let l=F.join(a,n.name),c=F.relative(r,l);if(!t.some(d=>d.test(c))){if(n.isDirectory())await s(l);else if(n.isFile()){let d=F.extname(n.name);d&&e.add(d)}}}}catch{}}return i(s,"scanDir"),await s(r),Array.from(e)}i(Fr,"getProjectExtensions");async function _r(r){let e=[/node_modules/,/\.git/,/dist/,/build/,/\.next/,/\.turbo/,/coverage/];async function t(s){try{let a=await ie.readdir(s,{withFileTypes:!0});return(await Promise.all(a.map(async n=>{let l=F.join(s,n.name),c=F.relative(r,l);return e.some(d=>d.test(c))?0:n.isDirectory()?t(l):n.isFile()?1:0}))).reduce((n,l)=>n+l,0)}catch{return 0}}return i(t,"scanDir"),t(r)}i(_r,"countProjectFiles");re();var le=class extends ze{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"};ce.parse(s),await this.update(e,a=>({...a,draft:s,lastUpdated:b()})),this.publishAnalysis(e,s)}publishAnalysis(e,t){We({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=b(),o={...t.draft,status:"sealed",signature:s,sealedAt:a};return ce.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=b();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:Dt(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 At(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 ct(JSON.stringify(t))}},Q=new le;import ds from"node:fs/promises";import ee from"node:path";br();Ge();B();import de from"node:fs/promises";import jt from"node:path";import{gunzipSync as Mr,gzipSync as Tr}from"node:zlib";Ge();K();var $r="code-graph.json.gz";function It(r){return jt.join(q.getGlobalProjectPath(r),$r)}i(It,"artifactPath");async function Or(r){if(!oe(r))return null;let e=ot(r),t=(()=>{try{return I.query(r,"SELECT src, dst, edge_type, confidence FROM code_symbol_edges").map(c=>({src:c.src,dst:c.dst,edgeType:c.edge_type,confidence:c.confidence}))}catch{return[]}})(),s=at(r)??{symbolCount:e.length,edgeCount:t.length,fileCount:new Set(e.map(c=>c.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=Tr(o,{level:6}),l=It(r);return await de.mkdir(jt.dirname(l),{recursive:!0}),await de.writeFile(l,n),{path:l,bytes:n.length,symbols:e.length,edges:t.length}}i(Or,"exportCodeGraphArtifact");async function Nr(r){let e=It(r),t=await de.readFile(e).catch(()=>null);if(!t)return{imported:!1,symbols:0,edges:0,reason:"no per-project artifact"};let s=(()=>{try{let o=Mr(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})`}:(I.transaction(r,o=>{o.prepare("DELETE FROM code_symbols").run(),o.prepare("DELETE FROM code_symbol_edges").run();let n=o.prepare(`INSERT INTO code_symbols (id, file, kind, name, qname, start_line, end_line, exported)
|
|
13
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`),l=o.prepare(`INSERT OR IGNORE INTO code_symbol_edges (src, dst, edge_type, confidence)
|
|
14
|
-
VALUES (?, ?, ?, ?)`);for(let c of a.symbols)n.run(c.id,c.file,c.kind,c.name,c.qname,c.startLine,c.endLine,c.exported?1:0);for(let c of a.edges)l.run(c.src,c.dst,c.edgeType,c.confidence)}),I.setDoc(r,"symbol-graph",{...a.meta,builtAt:a.meta.builtAt??a.exportedAt}),{imported:!0,symbols:a.symbols.length,edges:a.edges.length})}i(Nr,"importCodeGraphArtifact");async function Et(r){if(oe(r))return{bootstrapped:!1,detail:"local index already present"};let e=await Nr(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(Et,"bootstrapCodeGraphFromArtifact");function Rt(r){return r?.cloud?.enabled===!0&&r.cloud.paused!==!0}i(Rt,"shouldAutoUploadCodeGraph");async function Ft(r,e){try{await Or(r)}catch{}if(e.uploadToCloud)try{await Hr(r,e.uploadDependencies)}catch{}}i(Ft,"maybeExportAfterIndex");async function Hr(r,e={}){let t=await import("./code-graph-cloud-65GCWNII.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,l)=>{let{default:c}=await import("./sync-client-DJWOG2ZQ.mjs");return c.uploadCodeGraph(n,l)}))(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(Hr,"maybeUploadCodeGraphToCloud");import $ from"node:fs/promises";import Lr from"node:os";import D from"node:path";var ue=[{name:"prjct",description:gt,allowedTools:[...ht],body:i(()=>St(),"body"),reference:i(()=>wt(),"reference"),referenceFile:yt}];function Gr(r){let e=r.userInvocable!==!1;return`---
|
|
15
|
-
description: "${r.description}"
|
|
16
|
-
allowed-tools: [${r.allowedTools.map(t=>`"${t}"`).join(", ")}]
|
|
17
|
-
user-invocable: ${e}
|
|
18
|
-
---`}i(Gr,"buildFrontmatter");function Ur(r){return`${Gr(r)}
|
|
19
|
-
|
|
20
|
-
${r.body()}`}i(Ur,"buildSkillContent");function _t(){return process.env.HOME||Lr.homedir()}i(_t,"homeDir");function Wr(){return D.join(_t(),".claude","skills")}i(Wr,"claudeSkillsRoot");function Vr(){let r=_t();return[D.join(r,".codex","skills"),D.join(r,".gemini","skills"),D.join(r,".gemini","antigravity","global_skills")]}i(Vr,"compactSkillRoots");function zr(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(zr,"skillBodyHasProjectStamp");var me=class{static{i(this,"SkillGenerator")}async generateAndInstall(){let e={generated:[],skipped:[]},t=Wr();for(let o of ue)try{let n=Ur(o);if(zr(n))throw new Error("refusing to install project-stamped skill body (isolation guard)");let l=D.join(t,o.name),c=D.join(l,"SKILL.md");await $.mkdir(l,{recursive:!0}),await $.writeFile(c,n,"utf-8"),o.reference&&o.referenceFile&&await $.writeFile(D.join(l,o.referenceFile),o.reference(),"utf-8"),e.generated.push({name:o.name,path:c})}catch(n){f.debug(`Failed to generate skill ${o.name}`,{error:w(n)}),e.skipped.push({name:o.name,reason:w(n)})}let s=Ue();for(let o of Vr())try{let n=D.join(o,"prjct"),l=D.join(n,"SKILL.md");await $.mkdir(n,{recursive:!0}),await $.writeFile(l,s,"utf-8"),e.generated.push({name:"prjct-compact",path:l})}catch(n){f.debug("Compact skill install skipped",{root:o,error:w(n)})}let a=new Set(ue.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(D.join(t,n.name),{recursive:!0,force:!0}).catch(()=>{})}catch{}return e.generated.length>0&&f.info("Generated portable multi-host skills",{count:e.generated.length,skills:e.generated.map(o=>o.name)}),e}getDefinitions(){return ue}},Mt=new me;function pe(){return{branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0}}i(pe,"emptyGitData");function fe(){return{fileCount:0,version:"0.0.0",name:"unknown",ecosystem:"unknown",projectType:"simple",languages:[],frameworks:[]}}i(fe,"emptyStats");function ge(){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(ge,"emptyCommands");function he(){return{hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]}}i(he,"emptyStack");function Tt(r,e){let t=[...r.added,...r.modified],s=new Set(t),a=new Set,o=Y(e);if(o)for(let c of t){let d=o.reverse[c];if(d)for(let u of d)s.has(u)||a.add(u)}let n=Array.from(a),l=[...t,...n];return{directlyChanged:t,affectedByImports:n,deleted:r.deleted,allAffected:l}}i(Tt,"propagateChanges");function $t(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($t,"affectedDomains");K();B();import Ot from"node:fs/promises";import Jr from"node:path";function Br(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(Br,"hashContent");async function qr(r,e={}){let t=await Te(r,{skipDotfiles:!0,dotfileAllowlist:[".env.example"]}),s=new Map,a=e.changedFilesHint?.length?new Set(e.changedFilesHint):null,o=await $e(t,100,async n=>{try{let l=Jr.join(r,n),c=await Ot.stat(l),d=c.mtime.toISOString(),u=e.storedHashes?.get(n),h=a?.has(n)??!1;if(u&&!h&&u.size===c.size&&u.mtime===d&&u.hash)return{path:n,hash:u.hash,size:c.size,mtime:d};let y=await Ot.readFile(l,"utf-8");return{path:n,hash:Br(y),size:c.size,mtime:d}}catch{return null}});for(let n of o)s.set(n.path,n);return s}i(qr,"computeHashes");function Kr(r,e){let t=[],s=[],a=[];for(let[n,l]of r){let c=e.get(n);c?c.hash!==l.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(Kr,"diffHashes");function ye(r,e){let t=I.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)})(),I.setDoc(r,"file-hashes-meta",{fileCount:e.size,builtAt:new Date().toISOString()})}i(ye,"saveHashes");function Yr(r){let e=new Map;try{let t=I.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(Yr,"loadHashes");async function Se(r,e,t){let s=Yr(e),a=await qr(r,{storedHashes:s,changedFilesHint:t});return{diff:Kr(a,s),currentHashes:a}}i(Se,"detectChanges");function Nt(r){return I.hasDoc(r,"file-hashes-meta")}i(Nt,"hasHashRegistry");N();var Qr=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]);async function Ht(r){let{projectId:e,projectPath:t,isFullSync:s,changedFilesHint:a}=r,o={shouldRebuildIndexes:!0,changedDomains:new Set,incrementalInfo:void 0,changedSourceFiles:[],deletedSourceFiles:[]};if(!s&&Nt(e)){try{let{diff:n,currentHashes:l}=await Se(t,e,a),c=n.added.length+n.modified.length+n.deleted.length,d=(()=>{if(c===0&&!a?.length)return{shouldRebuildIndexes:!1,changedDomains:new Set,incrementalInfo:{isIncremental:!0,filesChanged:0,filesUnchanged:n.unchanged.length,indexesRebuilt:!1,affectedDomains:[]},changedSourceFiles:[],deletedSourceFiles:[]};let u=Tt(n,e),h=$t(u.allAffected),y=u.allAffected.some(we);return{shouldRebuildIndexes:y,changedDomains:h,incrementalInfo:{isIncremental:!0,filesChanged:c,filesUnchanged:n.unchanged.length,indexesRebuilt:y,affectedDomains:Array.from(h)},changedSourceFiles:[...n.added,...n.modified].filter(we),deletedSourceFiles:n.deleted.filter(we)}})();return ye(e,l),d}catch(n){f.debug("Incremental detection failed, falling back to full sync",{error:v(n)})}return o}try{let{currentHashes:n}=await Se(t,e,a);ye(e,n)}catch(n){f.debug("Hash computation failed (non-critical)",{error:v(n)})}return o}i(Ht,"detectIncrementalChanges");function we(r){let e=r.substring(r.lastIndexOf("."));return Qr.has(e)}i(we,"isSourceFile");import{z as A}from"zod";var gn=A.object({date:A.string(),tokensSaved:A.number(),syncs:A.number(),avgCompressionRate:A.number(),totalDuration:A.number()}),hn=A.object({agentName:A.string(),usageCount:A.number(),tokensSaved:A.number()}),Lt={"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 Gt(r,e="default"){let t=Lt[e]||Lt.default;return r/1e3*t}i(Gt,"estimateCostSaved");function yn(r){return r<.01?`$${(r*100).toFixed(2)}\xA2`:`$${r.toFixed(2)}`}i(yn,"formatCost");K();var Xr=i(r=>({date:r.date,tokensSaved:r.tokens_saved,syncs:r.syncs,avgCompressionRate:r.avg_compression_rate,totalDuration:r.total_duration}),"rowToDaily"),X=i(r=>{let e=new Date;return e.setDate(e.getDate()-r),e.toISOString().split("T")[0]},"dayCutoff"),ke=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(P.run(e,`INSERT INTO metrics_daily (date, tokens_saved, syncs, avg_compression_rate, total_duration)
|
|
21
|
-
VALUES (?, ?, 1, ?, ?)
|
|
22
|
-
ON CONFLICT(date) DO UPDATE SET
|
|
23
|
-
tokens_saved = metrics_daily.tokens_saved + excluded.tokens_saved,
|
|
24
|
-
avg_compression_rate =
|
|
25
|
-
(metrics_daily.avg_compression_rate * metrics_daily.syncs + excluded.avg_compression_rate)
|
|
26
|
-
/ (metrics_daily.syncs + 1),
|
|
27
|
-
syncs = metrics_daily.syncs + 1,
|
|
28
|
-
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 l of t.agents)P.run(e,`INSERT INTO metrics_agent_usage (agent_name, usage_count, tokens_saved)
|
|
29
|
-
VALUES (?, 1, ?)
|
|
30
|
-
ON CONFLICT(agent_name) DO UPDATE SET
|
|
31
|
-
usage_count = metrics_agent_usage.usage_count + 1,
|
|
32
|
-
tokens_saved = metrics_agent_usage.tokens_saved + excluded.tokens_saved`,l,n)}}async getSummary(e){let t=P.get(e,`SELECT COALESCE(SUM(tokens_saved), 0) AS tokens,
|
|
33
|
-
COALESCE(SUM(syncs), 0) AS syncs,
|
|
34
|
-
COALESCE(SUM(total_duration), 0) AS duration,
|
|
35
|
-
COALESCE(SUM(avg_compression_rate * syncs), 0) AS weighted_rate
|
|
36
|
-
FROM metrics_daily`),s=t?.syncs??0,a=t?.tokens??0,o=i((u,h)=>P.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?[u,h]:[u])?.t??0,"rangeTokens"),n=o(X(30)),l=o(X(60),X(30)),c=l>0?(n-l)/l*100:0,d=P.query(e,"SELECT * FROM metrics_agent_usage ORDER BY usage_count DESC LIMIT 5").map(u=>({agentName:u.agent_name,usageCount:u.usage_count,tokensSaved:u.tokens_saved}));return{totalTokensSaved:a,estimatedCostSaved:Gt(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:c}}async getDailyStats(e,t=30){return P.query(e,"SELECT * FROM metrics_daily WHERE date >= ? ORDER BY date ASC",X(t)).map(Xr)}async getFirstSyncDate(e){return P.get(e,"SELECT MIN(date) AS d FROM metrics_daily")?.d??""}},Ut=new ke;N();re();import Zr from"node:path";function es(r){return lt(Zr.resolve(r))}i(es,"repoHash");function U(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"")}i(U,"normalizeKey");function ts(r){return ne(r,e=>`${U(e.name)}::${U(e.source)}`)}i(ts,"dedupePatterns");function rs(r){return ne(r,e=>`${U(e.issue)}::${U(e.file)}::${U(e.source)}`)}i(rs,"dedupeAntiPatterns");var ve=class{static{i(this,"PatternExtractor")}async extract(e){let t=es(e.projectPath),s=[];if(e.context7Verified)for(let c of e.frameworks)s.push({name:`${c} API validation via Context7`,description:`Validate ${c} APIs against current documentation through Context7 before implementation.`,framework:c,source:"context7",confidence:.7});let a=(e.feedback?.patternsDiscovered||[]).map(c=>({name:c,description:`Confirmed during completed tasks: ${c}`,source:"feedback",confidence:.75})),o=(e.feedback?.knownGotchas||[]).map(c=>({issue:c,file:"multiple",suggestion:`Recurring gotcha. Prevent this pattern during implementation: ${c}`,source:"feedback",severity:"medium",confidence:.7})),n=ts([...s,...a]),l=rs([...o]);return{patterns:n,antiPatterns:l,repoPathHash:t}}},ss=new ve,Wt=ss;var Vt=200;async function zt(r,e,t){let{bm25Index:s,originalSize:a}=(()=>{try{let d=Qe(r),u=d?Object.values(d.documents).reduce((h,y)=>h+y.length,0):0;return{bm25Index:d,originalSize:u||e.fileCount*Vt}}catch(d){return f.debug("Could not load BM25 index for metrics",{error:v(d)}),{bm25Index:null,originalSize:e.fileCount*Vt}}})(),o=0,n=a>0?Math.max(0,(a-o)/a):0;try{await Ut.recordSync(r,{originalSize:a,filteredSize:o,duration:t,isWatch:!1})}catch(d){f.debug("Failed to record sync metrics",{error:v(d)})}try{let{velocityStorage:d}=await import("./velocity-storage-UPW6TLK6.mjs");await d.recompute(r)}catch(d){f.debug("Failed to recompute velocity",{error:v(d)})}let l=await import("./developer-evolution-R5BXQH6G.mjs").then(({captureDeveloperSnapshot:d})=>d(r)).catch(d=>(f.debug("Failed to capture dev snapshot",{error:v(d)}),!1)),c={};try{let d=s;d&&(c.bm25Files=d.totalDocs,c.bm25AvgTokens=Math.round(d.avgDocLength),c.bm25VocabSize=Object.keys(d.invertedIndex).length);let u=Y(r);u&&(c.importEdges=u.edgeCount,c.importFiles=u.fileCount);let h=mt(r);h&&(c.cochangeCommits=h.commitsAnalyzed,c.cochangeFiles=h.filesAnalyzed)}catch(d){f.debug("Could not load index stats",{error:v(d)})}return{duration:t,originalSize:a,filteredSize:o,compressionRate:n,indexes:c,developerSnapshotCaptured:l}}i(zt,"recordSyncMetrics");async function Jt(r,e,t,s,a,o){try{let n=t.recentCommits[0]?.hash||null,l=await R.getAggregatedFeedback(r).catch(()=>{});try{let{refreshSkillIndex:d}=await import("./skill-index-OOVAXHYJ.mjs");await d(r,e)}catch{}let c=await Wt.extract({projectId:r,projectPath:e,languages:s.languages,frameworks:Array.from(new Set([...s.frameworks,...a.frameworks])),feedback:l,context7Verified:o});await Q.saveDraft(r,{projectId:r,languages:s.languages,frameworks:s.frameworks,configFiles:[],fileCount:s.fileCount,patterns:c.patterns,antiPatterns:c.antiPatterns,analyzedAt:b(),status:"draft",commitHash:n??void 0})}catch(n){f.debug("Failed to save draft analysis (non-critical)",{error:v(n)})}}i(Jt,"saveDraftAnalysis");async function Bt(r){try{let[e,t,s,a,o]=await Promise.all([Je.archiveOldShipped(r).catch(()=>0),Be.markDormantIdeas(r).catch(()=>0),qe.removeStaleCompleted(r).catch(()=>0),R.archiveStalePausedTasks(r).catch(()=>[]),Ye.capEntries(r).catch(()=>0)]),n=e+t+s+a.length+o;if(n>0){f.info("Archived stale data",{shipped:e,dormant:t,staleQueue:s,stalePaused:a.length,memoryCapped:o,total:n});let l=Ve.getStats(r);f.debug("Archive stats",l)}}catch(e){f.debug("Archival failed (non-critical)",{error:v(e)})}}i(Bt,"archiveStaleData");var as=6e4,be=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 os(){return Number(process.env.PRJCT_SYNC_PHASE_TIMEOUT_MS)||as}i(os,"syncPhaseTimeoutMs");function qt(r,e){let t=os(),s=(()=>{let a=Promise.withResolvers(),o=setTimeout(()=>a.reject(new be(e,t)),t);return{promise:a.promise,cancel:i(()=>clearTimeout(o),"cancel")}})();return Promise.race([r,s.promise]).finally(s.cancel)}i(qt,"withPhaseTimeout");async function k(r,e){let t=Date.now();f.debug("sync phase start",{phase:r});try{let s=await e();return f.debug("sync phase done",{phase:r,ms:Date.now()-t}),s}catch(s){throw f.debug("sync phase failed",{phase:r,ms:Date.now()-t,error:w(s)}),s}}i(k,"runSyncPhase");function Kt(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(Kt,"startPostIndexWork");K();import is from"node:fs/promises";import cs from"node:path";N();re();N();B();import Pe from"node:fs/promises";import Z from"node:path";var Ce=".prjct/.prjct-state.md",xe=class{static{i(this,"LocalStateGenerator")}async generate(e,t){let s=Z.join(e,Ce);await Pe.mkdir(Z.dirname(s),{recursive:!0});let a=this.toMarkdown(t);await Pe.writeFile(s,a,"utf-8")}async remove(e){try{await Pe.unlink(Z.join(e,Ce))}catch(t){if(!M(t))throw t}}async exists(e){let t=Z.join(e,Ce);return L(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((l,c)=>{let d=l.status==="completed"?"\u2705":l.status==="in_progress"?"\u25B6\uFE0F":"\u23F3",u=c===s.currentSubtaskIndex?" \u2190 **Active**":"";t.push(`${c+1}. ${d} ${l.description}${u}`)}),t.push("");let a=s.subtasks.filter(l=>l.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(`
|
|
37
|
-
`)}},Yt=new xe;var ls=["storage","context","memory","analysis","config","sync"];async function Qt(r){try{await Promise.all(ls.map(e=>is.mkdir(cs.join(r,e),{recursive:!0})))}catch(e){throw new Error(Me(e,r,"project directories"))}}i(Qt,"ensureProjectDirectories");async function Xt(r){let{projectId:e,projectPath:t,cliVersion:s,git:a,stats:o}=r,n=P.getDoc(e,"project")||{},l={...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||b(),lastSync:b(),lastSyncCommit:a.recentCommits[0]?.hash||null,lastSyncBranch:a.branch};P.setDoc(e,"project",l)}i(Xt,"updateProjectDoc");async function Zt(r){let{projectId:e,projectPath:t,stats:s,stack:a}=r,n={...await R.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=b(),n.lastUpdated=b(),n.context={...n.context||{},lastSession:b(),lastAction:"Synced project",nextAction:'Run `p. work "intent"` to start a work cycle'},await R.write(e,n);try{await Yt.remove(t)}catch(l){f.debug("Legacy local state cleanup failed (optional)",{error:v(l)})}}i(Zt,"updateStateDoc");function er(r,e,t){P.appendEvent(r,"sync",{branch:e.branch,uncommitted:e.hasChanges,fileCount:t.fileCount,commitCount:e.commits})}i(er,"logSyncEvent");import tr from"node:fs/promises";import De from"node:path";N();kr();var rr={async jsonFilesValid(r){let e=Date.now(),t=[],s=De.basename(r);try{await R.read(s)}catch(a){M(a)||t.push(`state: ${v(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=De.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 tr.readdir(t);for(let n of o){if(!n.endsWith(".md"))continue;let l=await tr.readFile(De.join(t,n),"utf-8");for(let c of s)if(c.test(l)){a.push(`${n}: potential sensitive data detected`);break}}}catch(o){if(!M(o))return{name:"No sensitive data",passed:!1,error:`Could not scan: ${v(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}}},Ae=class{static{i(this,"SyncVerifier")}async verify(e,t,s){let a=Date.now(),o=[],n=s?.failFast??!1,l=[],c=[rr.jsonFilesValid(t),rr.noSensitiveData(t)];for(let y of c){let C=await y;if(o.push(C),!C.passed&&n){l.push(...s?.checks?.filter(_=>_.enabled!==!1).map(_=>_.name)??[]);break}}if((!n||o.every(y=>y.passed))&&s?.checks)for(let y of s.checks){if(y.enabled===!1){l.push(y.name);continue}let C=await this.runCustomCheck(y,e);if(o.push(C),!C.passed&&n){let _=s.checks.slice(s.checks.indexOf(y)+1);l.push(..._.filter(W=>W.enabled!==!1).map(W=>W.name));break}}let u=o.filter(y=>!y.passed).length,h=o.filter(y=>y.passed).length;return{passed:u===0,checks:o,totalMs:Date.now()-a,failedCount:u,passedCount:h,skippedCount:l.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 _e(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}}}},sr=new Ae;var je=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={installed:!1,verified:!1,configPath:"",message:""},o=[];try{if(this.projectId=await T.getProjectId(e),!this.projectId)return{success:!1,projectId:"",cliVersion:"",git:pe(),stats:fe(),commands:ge(),stack:he(),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 ds.rm(ee.join(this.globalPath,"agents"),{recursive:!0,force:!0}).catch(()=>{}),(await Le()).installed){let m=await ft({autoRepair:!0});m.verified||f.warn(`Codex p. router not ready: ${m.message||"verification failed"}`)}await k("mcp-defaults",()=>ut({silent:!0,verifyContext7:!1}));let c=(await He().catch(()=>null))?.name??"claude";try{Object.assign(a,await k("context7",()=>dt.ensureReady(c)))}catch(m){let g=w(m);f.warn(`Context7 MCP not ready (continuing sync): ${g}`),Object.assign(a,{verified:!1,message:g})}await Qt(this.globalPath),process.env.PRJCT_SKIP_CREW_SWEEP!=="1"&&await k("legacy-crew-sweep",async()=>{try{let{legacyCrewSweep:m}=await import("./legacy-crew-sweep-2MLYPNQR.mjs"),g=await m(this.projectPath,this.projectId);(g.checkpointsMigrated||g.teamMigrated||g.checkpointsHandEditWarned||g.teamHandEditWarned||g.ghostDirsPurged.length>0||g.agentFilesRepaired.length>0||g.clientPrjctJunkPurged.length>0||g.errors.length>0)&&f.info("Legacy crew sweep ran",{checkpointsMigrated:g.checkpointsMigrated,teamMigrated:g.teamMigrated,checkpointsHandEditWarned:g.checkpointsHandEditWarned,teamHandEditWarned:g.teamHandEditWarned,ghostDirsPurged:g.ghostDirsPurged,agentFilesRepaired:g.agentFilesRepaired,ghostFilesIngested:g.ghostFilesIngested,clientPrjctJunkPurged:g.clientPrjctJunkPurged,errors:g.errors.length})}catch(m){f.debug("Legacy crew sweep failed (non-critical)",{error:w(m)})}});let[u,h,y,C]=await k("gather",()=>qt(Promise.all([kt(this.projectPath),vt(this.projectPath),bt(this.projectPath),Pt(this.projectPath)]),"gather")),{shouldRebuildIndexes:_,changedDomains:W,incrementalInfo:Re,changedSourceFiles:V,deletedSourceFiles:z}=await k("incremental",()=>Ht({projectId:this.projectId,projectPath:this.projectPath,isFullSync:t.full===!0,changedFilesHint:t.changedFiles}));try{let{refreshFileInventory:m}=await import("./project-file-inventory-ZAPKPKY6.mjs");await m(this.projectId,this.projectPath)}catch{}try{await Et(this.projectId)}catch{}_&&await k("index",async()=>{try{let m=Re?.isIncremental&&(V.length>0||z.length>0);await Promise.all([m?Ze(this.projectPath,this.projectId,V,z):Xe(this.projectPath,this.projectId),m?rt(this.projectPath,this.projectId,V,z):tt(this.projectPath,this.projectId),m?nt(this.projectPath,this.projectId,V,z):st(this.projectPath,this.projectId),pt(this.projectPath,this.projectId)]);let g=this.projectId,S=this.projectPath,H=await T.readConfig(S).catch(()=>null),E=Rt(H);o.push(Kt(()=>Ft(g,{uploadToCloud:E}),{onComplete:i(({totalMs:x,error:J})=>{f.debug("sync post-index work settled",{projectId:g,uploadToCloud:E,totalMs:x,...J===void 0?{}:{error:w(J)}})},"onComplete")}))}catch(m){f.debug("File ranking index build failed (non-critical)",{error:w(m)})}});let or=Date.now();f.debug("sync phase start",{phase:"skills"});let ir=await Mt.generateAndInstall().catch(m=>{f.debug("Native skill generation failed (non-critical)",{error:w(m)})});f.debug("sync phase done",{phase:"skills",ms:Date.now()-or}),await k("update-files",()=>Promise.all([Xt({projectId:this.projectId,projectPath:this.projectPath,cliVersion:this.cliVersion,git:u,stats:h}),Zt({projectId:this.projectId,projectPath:this.projectPath,stats:h,stack:C}),Promise.resolve(er(this.projectId,u,h)),Jt(this.projectId,this.projectPath,u,h,C,a.verified)]));let te=await Q.getActive(this.projectId),cr={patterns:te?.patterns?.length||0,antiPatterns:te?.antiPatterns?.length||0,criticalAntiPatterns:te?.antiPatterns?.filter(m=>m.severity==="high").length||0},lr=Date.now()-s,Fe=await k("metrics",()=>zt(this.projectId,h,lr)),dr=Fe.developerSnapshotCaptured===!0,ur=await(async()=>{try{let{recomputeProjectStyle:m,formatProjectStyleForSync:g}=await import("./project-style-evolution-T27I5N65.mjs"),S=await k("project-style",()=>m({projectId:this.projectId,projectPath:this.projectPath,stats:h,stack:C,commands:y,commitHash:u.recentCommits[0]?.hash??null,source:"sync-mechanical"})),H=g(S),E=S.snapshot.payload.metrics.styleCoverage;return{summary:S.snapshot.summary,evolutionMd:H.evolutionMd,patternCount:S.snapshot.patternCount,antiPatternCount:S.snapshot.antiPatternCount,conventionCount:S.snapshot.conventionCount,styleCoverage:typeof E=="number"?E:Number(E)||0,isFirst:S.isFirst,hasChanges:S.delta.hasChanges}}catch(m){f.debug("Project style recompute failed (non-critical)",{error:w(m)});return}})(),mr=await k("work-cost",()=>Ct(this.projectId));await k("archive",()=>Bt(this.projectId));let pr=await k("context-quality",()=>et(this.projectPath,this.projectId)),fr=await k("retention",async()=>{try{let m=await T.readConfig(this.projectPath).catch(()=>null),g=m?.retention?.mode??"apply";if(g==="off")return;let S=g==="dry-run",{applyRetention:H,triageInbox:E}=await import("./retention-E7WGFL47.mjs"),x=H(this.projectId,{dryRun:S,maxArchive:m?.retention?.maxArchive,maxDelete:m?.retention?.maxDelete}),{inboxMerged:J,inboxArchived:hr}=S?{inboxMerged:0,inboxArchived:0}:(()=>{let j=E(this.projectId);return{inboxMerged:j.merged,inboxArchived:j.archived}})(),{runVaultPurge:yr,vaultHealth:Sr}=await import("./purge-QQ6XILZD.mjs"),O=await yr(this.projectId,{projectPath:this.projectPath,dryRun:S,softDeletedPurgeDays:m?.retention?.softDeletedPurgeDays,archivePruneDays:m?.retention?.archivePruneDays,autoSourceMaxLive:m?.retention?.autoSourceMaxLive}),wr=Sr(this.projectId);return{evaluated:x.evaluated,active:x.active,archive:x.wouldArchive,delete:x.wouldDelete,archived:x.archived,deleted:x.deleted,inboxMerged:J,inboxArchived:hr,dryRun:S,samples:x.samples.map(j=>({id:j.id,type:j.type,verdict:j.verdict,score:j.score,reasons:j.reasons,excess:j.excess})),referenceSize:x.referenceSize,vault:{...wr,softDeletedPurged:O.softDeletedPurged,orphanEventsPurged:O.orphanEventsPurged,archivesPruned:O.archivesPruned,autoSourceTrimmed:O.autoSourceTrimmed,distilledDiscarded:O.distilledDiscarded,digestsWritten:O.digestsWritten}}}catch(m){f.debug("retention phase failed",{error:w(m)});return}});await k("install-global",async()=>{await se.installGlobalConfig(),await se.syncCommands()}),await k("install-agent-surfaces",async()=>{let{detectInstalledAgents:m}=await import("./detection-MEYHME4X.mjs"),g=await m(this.projectPath).catch(()=>[]);await it(this.projectPath,{refreshIfAdopted:!0,agents:g})});let gr=await k("verify",async()=>{try{let m=await T.readConfig(this.projectPath);return await sr.verify(this.projectPath,this.globalPath,m?.verification)}catch(m){f.debug("Verification failed (non-critical)",{error:w(m)});return}});if(process.env.PRJCT_WORLD_MODEL_REFRESH==="1"||process.env.PRJCT_DRIFT_REFRESH==="1")try{let m=await import("node:os"),{markDriftRefreshApplied:g}=await import("./drift-refresh-TD3PYPJN.mjs"),S=process.env.PRJCT_CLI_HOME?ee.resolve(process.env.PRJCT_CLI_HOME):ee.join(m.homedir(),".prjct-cli");g(S)}catch{}return await Promise.all(o.map(m=>m.settle())),{success:!0,projectId:this.projectId,cliVersion:this.cliVersion,git:u,stats:h,commands:y,stack:C,context7:{installed:a.installed,verified:a.verified,message:a.message},analysisSummary:cr,contextQuality:pr,retentionDryRun:fr,syncMetrics:Fe,workCost:mr,verification:gr,incremental:Re,projectStyle:ur,developerSnapshotCaptured:dr,generatedSkills:ir}}catch(n){return{success:!1,projectId:this.projectId||"",cliVersion:this.cliVersion,git:pe(),stats:fe(),commands:ge(),stack:he(),context7:{installed:a.installed,verified:a.verified,message:a.message},error:w(n)}}}async getCliVersion(){try{let e=ee.join(__dirname,"..","..","package.json");return(await Oe(e))?.version||"0.0.0"}catch(e){return f.debug("Failed to read CLI version",{error:w(e)}),"0.0.0"}}},Ka=new je;import Ie from"chalk";var nr={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"},us={task:"work"};function Ee(r){return us[r]??r}i(Ee,"publicCommand");var ar={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 eo(r,e={}){if(e.quiet)return;let t=ar[r]||"idle",s=ae.getValidCommands(t);if(s.length===0)return;let a=s.map(o=>({cmd:`p. ${Ee(o)}`,desc:nr[o]||o}));console.log(Ie.dim(`
|
|
38
|
-
Next:`));for(let o of a){let n=Ie.cyan(o.cmd.padEnd(12));console.log(Ie.dim(` ${n} \u2192 ${o.desc}`))}}i(eo,"showNextSteps");function to(r,e=!1){let t=ar[r]||"idle";return ae.getValidCommands(t).map(a=>({cmd:e?`prjct ${Ee(a)} --md`:`p. ${Ee(a)}`,desc:nr[a]||a}))}i(to,"getNextSteps");async function ms(r,e={}){let t=await T.getProjectId(r);return t?{ok:!0,value:t}:(e.md?console.log("> No project ID found. Run `prjct init` first."):Ke.failWithHint("NO_PROJECT_ID"),{ok:!1,result:{success:!1,error:"No project ID found"}})}i(ms,"requireProjectId");async function fo(r,e={}){let t=await xt.ensureInit(r);return t.success?ms(r,e):{ok:!1,result:t}}i(fo,"requireProject");export{ps as a,fs as b,Q as c,yn as d,Ut as e,Ka as f,eo as g,to as h,fo as i};
|
|
@@ -1,13 +0,0 @@
|
|
|
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 f}from"./chunk-GAOQHD5S.mjs";import{a as i}from"./chunk-E66B27AL.mjs";import{readSync as k}from"node:fs";import{isatty as y}from"node:tty";var O=new Set(["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse"]);function c(e,t){return{hookSpecificOutput:{hookEventName:e,permissionDecision:"deny",permissionDecisionReason:m(t)}}}i(c,"buildDenyOutput");function S(){let e=(process.env.PRJCT_HOOK_HOST??"claude").toLowerCase();return e==="gemini"||e==="codex"||e==="cursor"?e:"claude"}i(S,"currentHookHost");function a(e,t=S()){return t==="claude"||t==="codex"||!e||Object.keys(e).length===0?e:t==="gemini"?w(e):t==="cursor"?b(e):e}i(a,"adaptHookOutputForHost");function w(e){let t=e;if(t.hookSpecificOutput?.permissionDecision==="deny")return{decision:"deny",reason:t.hookSpecificOutput.permissionDecisionReason??"blocked by prjct"};let o=e,n=o.hookSpecificOutput;return n?.additionalContext?{hookSpecificOutput:{hookEventName:x(n.hookEventName),additionalContext:n.additionalContext}}:o.systemMessage?{systemMessage:o.systemMessage}:e}i(w,"adaptForGemini");function b(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 o=e,n=o.hookSpecificOutput;return n?.additionalContext?{hookSpecificOutput:{hookEventName:D(n.hookEventName),additionalContext:n.additionalContext,additional_context:n.additionalContext},additional_context:n.additionalContext}:o.systemMessage?{systemMessage:o.systemMessage}:e}i(b,"adaptForCursor");function x(e){switch(e){case"UserPromptSubmit":return"BeforeAgent";case"PreToolUse":return"BeforeTool";case"PostToolUse":return"AfterTool";case"Stop":return"AfterAgent";default:return e}}i(x,"mapClaudeEventToGemini");function D(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)}}i(D,"mapClaudeEventToCursor");function p(){if(y(0))return{};try{process.stdin.fd}catch{}let e=Date.now()+200,t=new Int32Array(new SharedArrayBuffer(4)),o=Buffer.alloc(65536),n=[];for(;;)try{let r=k(0,o,0,o.length,null);if(r===0)break;n.push(Buffer.from(o.subarray(0,r)))}catch(r){if(r.code==="EAGAIN"&&Date.now()<e){Atomics.wait(t,0,0,1);continue}break}try{let r=Buffer.concat(n).toString("utf-8").trim();return r?JSON.parse(r):{}}catch{return{}}}i(p,"readStdinSafe");function u(e){let t=a(e);process.stdout.write(`${JSON.stringify(t)}
|
|
9
|
-
`)}i(u,"emit");function E(){u({})}i(E,"emitEmpty");async function l(e){try{await e()}catch{E()}}i(l,"safeRun");var v=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 P(e,t=8){let o=f(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2")).toLowerCase(),n=new Set,r=[];for(let s of o.split(/[^\p{L}\p{N}]+/u))if(!(s.length<3)&&!v.has(s)&&!n.has(s)&&(n.add(s),r.push(s),r.length>=t))break;return r}i(P,"extractKeywords");function m(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD")}i(m,"stripLoneSurrogates");function C(e,t,o=`
|
|
10
|
-
\u2026 [truncated]`){if(e.length<=t)return e;let n=Math.max(0,t-o.length),r=e.charCodeAt(n-1),s=r>=55296&&r<=56319?n-1:n;return e.slice(0,Math.max(0,s))+o}i(C,"safeTruncate");function d(e,t){if(!t)return{};let o=m(t);return O.has(e)?{hookSpecificOutput:{hookEventName:e,additionalContext:o}}:{systemMessage:o}}i(d,"buildHookOutput");async function I(e,t){let o=e.projectPath??process.cwd();if(t){try{let n=t.input;if(t.afterEmitOnly){e.afterEmit&&t.detachAfterEmit(()=>e.afterEmit(n,o));return}let r=e.decide?await e.decide(n,o):null;if(r){let h=a(c(e.event,r.deny));t.sink(`${JSON.stringify(h)}
|
|
11
|
-
`);return}let s=e.build?await e.build(n,o):null,g=a(d(e.event,s));t.sink(`${JSON.stringify(g)}
|
|
12
|
-
`),e.afterEmit&&t.detachAfterEmit(()=>e.afterEmit(n,o))}catch{t.sink(`{}
|
|
13
|
-
`)}return}await l(async()=>{let n=p(),r=e.decide?await e.decide(n,o):null;if(r){u(c(e.event,r.deny));return}let s=e.build?await e.build(n,o):null;u(d(e.event,s)),e.afterEmit&&await e.afterEmit(n,o)})}i(I,"runHook");export{P as a,C as b,I as c};
|
|
@@ -1,8 +0,0 @@
|
|
|
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 o,f as c}from"./chunk-HDSS6UB3.mjs";c();import{z as e}from"zod";var u=e.enum(["low","medium","high","critical"]),t=e.enum(["feature","bug","improvement","chore"]),l=e.enum(["active","backlog","previously_active"]),m=e.enum(["H0","H1","H2","H3"]),d=e.enum(["bug","feature","refactor","docs","chore","security","research","unknown"]),g=e.enum(["low","medium","high"]),k=e.enum(["regression-test","focused-tests","docs-if-public-behavior","config-preservation","spec-or-design","edge-cases","scope-check"]),y=e.enum(["verify-before-done","scope-check","review-before-ship","spec-before-implementation"]),b=e.enum(["pending","in_progress","completed","blocked","paused","failed","skipped"]),n=e.object({title:e.string(),description:e.string(),filesChanged:e.array(e.object({path:e.string(),action:e.enum(["created","modified","deleted"])})),whatWasDone:e.array(e.string()).min(1),outputForNextAgent:e.string().min(1),notes:e.string().optional()}),I=e.object({output:e.string().min(1,"Subtask output is required"),summary:n}),r=e.object({id:e.string(),description:e.string(),domain:e.string(),agent:e.string(),status:b,dependsOn:e.array(e.string()),startedAt:e.string().optional(),completedAt:e.string().optional(),output:e.string().optional(),summary:n.optional(),skipReason:e.string().optional(),blockReason:e.string().optional(),estimatedPoints:e.number().optional(),estimatedMinutes:e.number().optional()}),i=e.object({completed:e.number(),total:e.number(),percentage:e.number()}),a=e.object({level:m,kind:d,risk:g,expectedEvidence:e.array(k),scopeHints:e.array(e.string()),gates:e.array(y),rationale:e.string(),createdAt:e.string()}),p=e.object({id:e.string(),description:e.string(),type:t.optional(),startedAt:e.string(),sessionId:e.string(),featureId:e.string().optional(),subtasks:e.array(r).optional(),currentSubtaskIndex:e.number().optional(),subtaskProgress:i.optional(),linearId:e.string().optional(),linearUuid:e.string().optional(),linkedSpecId:e.string().optional(),estimatedPoints:e.number().optional(),estimatedMinutes:e.number().optional(),modelMetadata:o.optional(),tokensIn:e.number().optional(),tokensOut:e.number().optional(),parentDescription:e.string().optional(),branch:e.string().optional(),prUrl:e.string().optional(),harness:a.optional(),turnCount:e.number().optional(),turnLimitAcknowledgedAt:e.string().optional(),ownerAgent:e.string().optional(),ownerIdentity:e.string().optional(),ownerSessionId:e.string().optional(),yieldStatus:e.enum(["active","yielded"]).optional(),pendingHandoffId:e.string().optional()}),s=e.object({id:e.string(),description:e.string(),status:e.literal("paused"),startedAt:e.string(),pausedAt:e.string(),pauseReason:e.string().optional(),type:t.optional(),sessionId:e.string().optional(),featureId:e.string().optional(),subtasks:e.array(r).optional(),currentSubtaskIndex:e.number().optional(),subtaskProgress:i.optional(),linearId:e.string().optional(),linearUuid:e.string().optional(),estimatedPoints:e.number().optional(),estimatedMinutes:e.number().optional(),modelMetadata:o.optional(),tokensIn:e.number().optional(),tokensOut:e.number().optional(),harness:a.optional()}),S=e.object({stackConfirmed:e.array(e.string()).optional(),patternsDiscovered:e.array(e.string()).optional(),agentAccuracy:e.array(e.object({agent:e.string(),rating:e.enum(["helpful","neutral","inaccurate"]),note:e.string().optional()})).optional(),issuesEncountered:e.array(e.string()).optional()}),f=e.object({taskId:e.string(),title:e.string(),classification:t,startedAt:e.string(),completedAt:e.string(),subtaskCount:e.number(),subtaskSummaries:e.array(n),outcome:e.string(),branchName:e.string(),linearId:e.string().optional(),linearUuid:e.string().optional(),prUrl:e.string().optional(),feedback:S.optional(),harness:a.optional(),tokensIn:e.number().optional(),tokensOut:e.number().optional()}),h=p.extend({workspaceId:e.string(),worktreePath:e.string().optional(),agentSessionId:e.string().optional(),jiraId:e.string().optional(),jiraUuid:e.string().optional(),dispatchedFrom:e.string().optional()}),z=e.object({currentTask:p.nullable(),previousTask:s.nullable().optional(),pausedTasks:e.array(s).optional(),taskHistory:e.array(f).optional(),activeTasks:e.array(h).optional(),lastUpdated:e.string()}),x=e.object({id:e.string(),description:e.string(),body:e.string().optional(),priority:u,type:t,featureId:e.string().optional(),originFeature:e.string().optional(),completed:e.boolean(),completedAt:e.string().optional(),createdAt:e.string(),section:l,agent:e.string().optional(),groupName:e.string().optional(),groupId:e.string().optional()}),j=e.object({tasks:e.array(x),lastUpdated:e.string()});export{I as a,z as b,j as c};
|