prjct-cli 3.88.0 → 3.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/bin/hook-chunks/agent-identity-45BYQBU2.mjs +8 -0
- package/dist/bin/hook-chunks/agent-switch-FBQDHWAO.mjs +22 -0
- package/dist/bin/hook-chunks/analysis-NRRZYJ6G.mjs +42 -0
- package/dist/bin/hook-chunks/auth-config-WNUARXTJ.mjs +8 -0
- package/dist/bin/hook-chunks/auto-flush-D3X3U4CP.mjs +8 -0
- package/dist/bin/hook-chunks/auto-updater-EHRRMCYY.mjs +9 -0
- package/dist/bin/hook-chunks/capture-gate-BFOABO2Y.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-2H57GV2T.mjs +38 -0
- package/dist/bin/hook-chunks/chunk-2NMSEZTQ.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-2OU2MKNS.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-2UC4DTDO.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-3FBCOCPD.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-3HDIQJ55.mjs +19 -0
- package/dist/bin/hook-chunks/chunk-3JUE6MNF.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-3LG3ACQV.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-45I2C2UB.mjs +25 -0
- package/dist/bin/hook-chunks/chunk-4DDCWMI6.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-4KY2EHXS.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-4WHS7CO7.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-54LH63LM.mjs +7 -0
- package/dist/bin/hook-chunks/chunk-5T5PZKHW.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-5TBQNW2G.mjs +17 -0
- package/dist/bin/hook-chunks/chunk-5WAONIPX.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-6EWGHM32.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-6IKHMK2U.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-75UJIVMO.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-7OZDWT6C.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-7SI6X3Z7.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-A4OFZ2SK.mjs +19 -0
- package/dist/bin/hook-chunks/chunk-A5RNWWTH.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-AKIN5WSQ.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-AOPJ4Z6O.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-AUUWQH3S.mjs +14 -0
- package/dist/bin/hook-chunks/chunk-AW25AWN5.mjs +31 -0
- package/dist/bin/hook-chunks/chunk-BISPGBNN.mjs +35 -0
- package/dist/bin/hook-chunks/chunk-BUDZL4DW.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-CE4RCNC7.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-CQHPIYNM.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-CREPUNOS.mjs +24 -0
- package/dist/bin/hook-chunks/chunk-CTWZQ7YI.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-CULYIJJZ.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-D7TRY3CO.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-DAOC3T5G.mjs +43 -0
- package/dist/bin/hook-chunks/chunk-DMXFGLZE.mjs +21 -0
- package/dist/bin/hook-chunks/chunk-DXQMKW2B.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-DYHYDHCW.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-E66B27AL.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-EM6ZDJAK.mjs +45 -0
- package/dist/bin/hook-chunks/chunk-F652GI4F.mjs +15 -0
- package/dist/bin/hook-chunks/chunk-FGQZ62ZP.mjs +47 -0
- package/dist/bin/hook-chunks/chunk-GAOQHD5S.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-GCKILEXJ.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-GHBGBP2M.mjs +31 -0
- package/dist/bin/hook-chunks/chunk-GJFWVCTS.mjs +19 -0
- package/dist/bin/hook-chunks/chunk-GSMDQ7VM.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-GVJZPOG2.mjs +13 -0
- package/dist/bin/hook-chunks/chunk-GVNMXVVA.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-H6KVNDQD.mjs +71 -0
- package/dist/bin/hook-chunks/chunk-HDHVBB6Q.mjs +1260 -0
- package/dist/bin/hook-chunks/chunk-HDSS6UB3.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-HE5RSIHG.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-HJ4HEI45.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-HZIORCPO.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-HZXDF2TQ.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-J6JZ4PQA.mjs +18 -0
- package/dist/bin/hook-chunks/chunk-JQE2F2RK.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-JQLJM4BK.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-KEJ5RMAI.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +13 -0
- package/dist/bin/hook-chunks/chunk-LLQUB6YR.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-LT5WSSQO.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-LWCHQIJ7.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-MECJJJ7R.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-MEQS4VPO.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-MXHX44WF.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-N5WOHG36.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-NJAMZSHM.mjs +26 -0
- package/dist/bin/hook-chunks/chunk-NLG2EW6M.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-NN65WGGN.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-NWY5M34K.mjs +12 -0
- package/dist/bin/hook-chunks/chunk-ODWWIFSN.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-OFVLGJ76.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-OVR6RUUZ.mjs +13 -0
- package/dist/bin/hook-chunks/chunk-P43HDWI5.mjs +14 -0
- package/dist/bin/hook-chunks/chunk-PKDYFXMI.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-PSSR7LSW.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-PTVXWPQH.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-Q5I2UPD6.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-QDQ7DTDV.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-QSAA6LZF.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-R77TXXPP.mjs +53 -0
- package/dist/bin/hook-chunks/chunk-RNCLLUMK.mjs +18 -0
- package/dist/bin/hook-chunks/chunk-SJ75V4WG.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-SN224ILI.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-SNISJ7HR.mjs +15 -0
- package/dist/bin/hook-chunks/chunk-SOPRYWUY.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-SVZHJZ5T.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-SYHDEUVU.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-TPESWBA7.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-TRMBRDKH.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-TXJT3G53.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-UDUUEZD3.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-UUULLTQV.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-V37VTXDW.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-VAXQ5IDD.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-WDGDFXSB.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-WUHGODSQ.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-X5RDLFPM.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-XGYCAVB2.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-Y5NQV46G.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-YGHIPTJN.mjs +13 -0
- package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-YORSHLFH.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-YUOTOCKK.mjs +103 -0
- package/dist/bin/hook-chunks/chunk-ZTZTVBAZ.mjs +12 -0
- package/dist/bin/hook-chunks/chunk-ZX2KFQV5.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-ZZ65CN5F.mjs +20 -0
- package/dist/bin/hook-chunks/client-SKFMAUI5.mjs +10 -0
- package/dist/bin/hook-chunks/code-graph-cloud-65GCWNII.mjs +8 -0
- package/dist/bin/hook-chunks/codex-skill-MNY46575.mjs +8 -0
- package/dist/bin/hook-chunks/command-installer-ZOQQLRCI.mjs +8 -0
- package/dist/bin/hook-chunks/config-manager-KJCMN7PV.mjs +8 -0
- package/dist/bin/hook-chunks/content-bound-stamp-72EQVZLP.mjs +10 -0
- package/dist/bin/hook-chunks/context-pressure-OUN5PFMN.mjs +8 -0
- package/dist/bin/hook-chunks/context7-service-4C6VNJUS.mjs +8 -0
- package/dist/bin/hook-chunks/custom-workflow-storage-M77INP6Z.mjs +8 -0
- package/dist/bin/hook-chunks/cwd-changed-KXOCN55N.mjs +8 -0
- package/dist/bin/hook-chunks/cycle-budget-card-O5WAGNGC.mjs +9 -0
- package/dist/bin/hook-chunks/database-SLDTQXWG.mjs +8 -0
- package/dist/bin/hook-chunks/delivery-geometry-VHCURJ7E.mjs +8 -0
- package/dist/bin/hook-chunks/detect-changes-6N4DCWXQ.mjs +17 -0
- package/dist/bin/hook-chunks/detection-MEYHME4X.mjs +8 -0
- package/dist/bin/hook-chunks/developer-evolution-R5BXQH6G.mjs +12 -0
- package/dist/bin/hook-chunks/discuss-lock-55GER2LR.mjs +8 -0
- package/dist/bin/hook-chunks/distill-R477XZE3.mjs +8 -0
- package/dist/bin/hook-chunks/drift-refresh-TD3PYPJN.mjs +8 -0
- package/dist/bin/hook-chunks/editors-config-3N6VREZR.mjs +8 -0
- package/dist/bin/hook-chunks/enriched-recall-65X44HBM.mjs +8 -0
- package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +8 -0
- package/dist/bin/hook-chunks/format-UF2TLTKX.mjs +8 -0
- package/dist/bin/hook-chunks/git-helpers-6JLP2OJZ.mjs +8 -0
- package/dist/bin/hook-chunks/infer-memory-file-PIAZ542H.mjs +8 -0
- package/dist/bin/hook-chunks/judgment-ledger-storage-UKROWRVA.mjs +8 -0
- package/dist/bin/hook-chunks/judgment-orchestrator-UFGNBTEK.mjs +8 -0
- package/dist/bin/hook-chunks/judgment-receipt-NXL5Q4CE.mjs +8 -0
- package/dist/bin/hook-chunks/land-cue-SRIIDHMN.mjs +9 -0
- package/dist/bin/hook-chunks/land-synthesis-ANVOY7AM.mjs +8 -0
- package/dist/bin/hook-chunks/legacy-crew-sweep-PSJCO5UP.mjs +24 -0
- package/dist/bin/hook-chunks/memory-index-7LM2BMWZ.mjs +10 -0
- package/dist/bin/hook-chunks/notification-2TZO3WRM.mjs +8 -0
- package/dist/bin/hook-chunks/nyquist-lite-GE7OAFLC.mjs +10 -0
- package/dist/bin/hook-chunks/pack-integrity-6VKUAISJ.mjs +10 -0
- package/dist/bin/hook-chunks/pack-manager-KQBNP6XR.mjs +8 -0
- package/dist/bin/hook-chunks/package-legitimacy-HXC4L73B.mjs +8 -0
- package/dist/bin/hook-chunks/path-manager-F2HE2GGK.mjs +8 -0
- package/dist/bin/hook-chunks/planning-ZQNNDOEL.mjs +9 -0
- package/dist/bin/hook-chunks/post-edit-AEFFZFPO.mjs +8 -0
- package/dist/bin/hook-chunks/pr-convention-7UGI7TFA.mjs +8 -0
- package/dist/bin/hook-chunks/pre-bash-3FACZOB5.mjs +11 -0
- package/dist/bin/hook-chunks/pre-commit-MDFDQ5QZ.mjs +8 -0
- package/dist/bin/hook-chunks/pre-edit-ORX656T5.mjs +11 -0
- package/dist/bin/hook-chunks/pre-package-ITHMLNGN.mjs +8 -0
- package/dist/bin/hook-chunks/pre-search-UFS2Z5VJ.mjs +9 -0
- package/dist/bin/hook-chunks/pre-secrets-IE5NX5X5.mjs +8 -0
- package/dist/bin/hook-chunks/precision-classifier-IVVAXE26.mjs +8 -0
- package/dist/bin/hook-chunks/precision-judgment-WPTCNTGV.mjs +8 -0
- package/dist/bin/hook-chunks/prjct-md-IKUVPUGT.mjs +8 -0
- package/dist/bin/hook-chunks/project-agent-surfaces-VCOI4GHT.mjs +8 -0
- package/dist/bin/hook-chunks/project-file-inventory-ZAPKPKY6.mjs +8 -0
- package/dist/bin/hook-chunks/project-memory-KRA3BH7A.mjs +8 -0
- package/dist/bin/hook-chunks/project-style-evolution-363CLE32.mjs +8 -0
- package/dist/bin/hook-chunks/prompt-6L7B546V.mjs +22 -0
- package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +8 -0
- package/dist/bin/hook-chunks/purge-IPK4NJN6.mjs +8 -0
- package/dist/bin/hook-chunks/retention-S2GGTVY2.mjs +8 -0
- package/dist/bin/hook-chunks/sdd-JIPV7QJP.mjs +10 -0
- package/dist/bin/hook-chunks/session-continuity-DABISZYM.mjs +11 -0
- package/dist/bin/hook-chunks/session-start-GJPAQ3GL.mjs +8 -0
- package/dist/bin/hook-chunks/settings-installer-QDM3GB6J.mjs +9 -0
- package/dist/bin/hook-chunks/setup-TG5O5TKD.mjs +142 -0
- package/dist/bin/hook-chunks/shipping-VCLQS7GP.mjs +13 -0
- package/dist/bin/hook-chunks/skill-index-OOVAXHYJ.mjs +12 -0
- package/dist/bin/hook-chunks/spec-context-inference-MOOQL2VC.mjs +15 -0
- package/dist/bin/hook-chunks/spec-service-33UDKWXT.mjs +11 -0
- package/dist/bin/hook-chunks/spec-task-breakdown-FES465AB.mjs +8 -0
- package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +8 -0
- package/dist/bin/hook-chunks/stop-IWI5SQG6.mjs +17 -0
- package/dist/bin/hook-chunks/subagent-start-NJZOWV2P.mjs +8 -0
- package/dist/bin/hook-chunks/subagent-stop-R6HIIVWQ.mjs +8 -0
- package/dist/bin/hook-chunks/surface-attribution-JYE6VDZR.mjs +8 -0
- package/dist/bin/hook-chunks/symbol-graph-LZM4RZXZ.mjs +8 -0
- package/dist/bin/hook-chunks/sync-analyzer-FKC57RTV.mjs +8 -0
- package/dist/bin/hook-chunks/sync-client-DJWOG2ZQ.mjs +8 -0
- package/dist/bin/hook-chunks/sync-cursor-storage-2VKG757H.mjs +19 -0
- package/dist/bin/hook-chunks/task-orchestration-MLOCR7GA.mjs +8 -0
- package/dist/bin/hook-chunks/task-overview-6ZQKJGSH.mjs +8 -0
- package/dist/bin/hook-chunks/task-service-NSS5SVJE.mjs +8 -0
- package/dist/bin/hook-chunks/tdd-AKXWUK2Y.mjs +10 -0
- package/dist/bin/hook-chunks/template-loader-KLKEG7XM.mjs +8 -0
- package/dist/bin/hook-chunks/transcript-jsonl-6X4DDD6R.mjs +8 -0
- package/dist/bin/hook-chunks/trust-boundary-ERMDF2C5.mjs +8 -0
- package/dist/bin/hook-chunks/usefulness-253CZLNY.mjs +8 -0
- package/dist/bin/hook-chunks/vault-retire-notice-GRT3QRLZ.mjs +9 -0
- package/dist/bin/hook-chunks/velocity-storage-UPW6TLK6.mjs +8 -0
- package/dist/bin/hook-chunks/weak-model-mode-JQ23PTXN.mjs +8 -0
- package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +49 -0
- package/dist/bin/hook-chunks/work-scope-C7BJX6QE.mjs +8 -0
- package/dist/bin/hook-chunks/workspace-occupancy-UVIRHY5Z.mjs +8 -0
- package/dist/bin/hook-chunks/worktree-service-XGRN5TTE.mjs +12 -0
- package/dist/bin/hook-fast-linux-x64 +0 -0
- package/dist/bin/prjct-core.mjs +625 -624
- package/dist/bin/prjct-hooks.mjs +3 -2282
- package/dist/bin/prjct.mjs +17 -2
- package/dist/daemon/entry.mjs +545 -544
- package/dist/mcp/server.mjs +196 -195
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [3.89.0] - 2026-08-15
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- cut hook latency 55-68%: native hook-fast binary with staged fallback, per-project daemon request lanes, SQLite read dedup, real stdin deadlines on hook paths
|
|
9
|
+
|
|
5
10
|
## [3.88.0] - 2026-08-14
|
|
6
11
|
|
|
7
12
|
### Added
|
|
@@ -0,0 +1,8 @@
|
|
|
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,b,c,d,e}from"./chunk-TRMBRDKH.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-E66B27AL.mjs";export{a as KNOWN_AGENTS,b as detectRuntimeAgent,d as normalizeAgentName,c as resolveCallerIdentity,e as sameOwner};
|
|
@@ -0,0 +1,22 @@
|
|
|
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 E,b as I}from"./chunk-X5RDLFPM.mjs";import{a as P}from"./chunk-CULYIJJZ.mjs";import{a as O}from"./chunk-5WAONIPX.mjs";import{a as C}from"./chunk-5TBQNW2G.mjs";import{b as N,c as H,d as L}from"./chunk-TRMBRDKH.mjs";import{h as _}from"./chunk-H6KVNDQD.mjs";import"./chunk-NN65WGGN.mjs";import"./chunk-Q5I2UPD6.mjs";import"./chunk-PSSR7LSW.mjs";import"./chunk-YGHIPTJN.mjs";import{c as D,d as A}from"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-P43HDWI5.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-JQLJM4BK.mjs";import"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import{b as y}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import{a as x}from"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import{b as h}from"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import{d as f,g as v}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as m,e as V,i as S,k as Y,l as R,r as q}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a}from"./chunk-E66B27AL.mjs";q();import{spawn as X}from"node:child_process";v();V();v();function G(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}a(G,"parseEvidence");function $(t){return{id:t.id,projectId:t.project_id,taskId:t.task_id,taskDescription:t.task_description,fromAgent:t.from_agent,fromIdentity:t.from_identity,toAgent:t.to_agent,reason:t.reason,evidence:G(t.evidence),status:t.status,workspaceId:t.workspace_id,worktreePath:t.worktree_path,branch:t.branch,createdAt:t.created_at,acceptedAt:t.accepted_at,acceptedBy:t.accepted_by,expiresAt:t.expires_at}}a($,"toHandoff");function M(t){let e=new Date;return e.setTime(e.getTime()+Math.max(1,t)*36e5),e.toISOString()}a(M,"expiresAtIso");function W(t){let e=`hand_${x()}`,o=m(),n=t.ttlHours??24,r=t.evidence?JSON.stringify(t.evidence):null;return f.run(t.projectId,`INSERT INTO task_handoffs (
|
|
9
|
+
id, project_id, task_id, task_description, from_agent, from_identity,
|
|
10
|
+
to_agent, reason, evidence, status, workspace_id, worktree_path, branch,
|
|
11
|
+
created_at, accepted_at, accepted_by, expires_at
|
|
12
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?, ?, NULL, NULL, ?)`,e,t.projectId,t.taskId,t.taskDescription,t.fromAgent,t.fromIdentity??null,t.toAgent,t.reason,r,t.workspaceId??null,t.worktreePath??null,t.branch??null,o,M(n)),{id:e,projectId:t.projectId,taskId:t.taskId,taskDescription:t.taskDescription,fromAgent:t.fromAgent,fromIdentity:t.fromIdentity??null,toAgent:t.toAgent,reason:t.reason,evidence:t.evidence??null,status:"pending",workspaceId:t.workspaceId??null,worktreePath:t.worktreePath??null,branch:t.branch??null,createdAt:o,acceptedAt:null,acceptedBy:null,expiresAt:M(n)}}a(W,"createHandoff");function U(t,e){let o=f.get(t,"SELECT * FROM task_handoffs WHERE id = ? OR id LIKE ?",e,`${e}%`);return o?$(o):null}a(U,"getHandoff");var j=new Map,Q=60*1e3;function B(t){let e=Date.now(),o=j.get(t)??0;if(e-o<Q)return 0;j.set(t,e);try{f.run(t,`UPDATE task_handoffs SET status = 'expired'
|
|
13
|
+
WHERE status = 'pending' AND expires_at IS NOT NULL AND expires_at < ?`,m())}catch{return 0}return 0}a(B,"expireStaleHandoffs");function w(t,e={}){B(t);let o=e.limit??20,n=[],r=[];e.status&&(n.push("status = ?"),r.push(e.status),e.status==="pending"&&(n.push("(expires_at IS NULL OR expires_at >= ?)"),r.push(m()))),e.toAgent&&(n.push("to_agent = ?"),r.push(e.toAgent));let s=n.length>0?`WHERE ${n.join(" AND ")}`:"";return f.query(t,`SELECT * FROM task_handoffs ${s} ORDER BY created_at DESC LIMIT ?`,...r,o).map($)}a(w,"listHandoffs");function T(t,e){return w(t,{status:"pending",toAgent:e,limit:10})}a(T,"listPendingForAgent");function F(t,e,o){B(t);let n=m();f.run(t,`UPDATE task_handoffs
|
|
14
|
+
SET status = 'accepted', accepted_at = ?, accepted_by = ?
|
|
15
|
+
WHERE (id = ? OR id LIKE ?) AND status = 'pending'
|
|
16
|
+
AND (expires_at IS NULL OR expires_at >= ?)`,n,o,e,`${e}%`,n);let r=f.get(t,"SELECT * FROM task_handoffs WHERE (id = ? OR id LIKE ?) AND status = ? AND accepted_by = ?",e,`${e}%`,"accepted",o);return r?$(r):null}a(F,"acceptHandoff");Y();async function Z(t,e,o,n){let r=await h.readConfig(e).catch(()=>null),s=await _(t,e).catch(()=>null),l=s?.turnCount??0,c=O(r,s),d=C(r,s),i=(()=>{try{return n?f.query(t,`SELECT DISTINCT json_extract(data, '$.file') AS file
|
|
17
|
+
FROM events
|
|
18
|
+
WHERE type = 'memory.post_edit' AND timestamp >= ?
|
|
19
|
+
LIMIT 20`,n).map(g=>g.file).filter(Boolean):[]}catch{return[]}})(),u=(()=>{try{return f.query(t,"SELECT content FROM task_log WHERE task_id = ? ORDER BY id DESC LIMIT 5",o).map(g=>g.content).filter(Boolean)}catch{return[]}})();return{turns:l,files:i,pressure:d.level!=="ok"?d.level:void 0,loopStopped:c.stopped||void 0,journal:u.length>0?u:void 0}}a(Z,"buildEvidence");function tt(t,e,o){let n=t?.trim();if(n)return n.slice(0,500);let r=[`Yielded cycle "${o.slice(0,80)}"`];return e.turns&&e.turns>0&&r.push(`after ${e.turns} turns`),e.loopStopped&&r.push("loop-guard stopped"),e.pressure&&r.push(`context pressure ${e.pressure}`),e.files&&e.files.length>0&&r.push(`files: ${e.files.slice(0,5).join(", ")}`),r.push("\u2014 continue from current branch state; do not restart from zero"),r.join(" ").slice(0,500)}a(tt,"composeReason");function et(t){let e=[t.fromAgent,t.fromIdentity].filter(Boolean).join("/");return[`# prjct handoff \u2192 ${t.toAgent}`,"",`Task: \`${t.taskId}\` \u2014 ${t.taskDescription}`,`From: ${e} \xB7 handoff \`${t.id}\``,`Reason: ${t.reason}`,t.branch?`Branch: \`${t.branch}\``:null,t.worktreePath?`Path: \`${t.worktreePath}\``:null,"","## Accept (target agent)","","```bash",`cd ${t.worktreePath??"."}`,`prjct accept ${t.id} --md`,"```","","Then continue the cycle \u2014 do not start a new `prjct work` for the same intent."].filter(o=>o!==null).join(`
|
|
20
|
+
`)}a(et,"formatResumeCard");function nt(t,e){let o=[t.fromAgent,t.fromIdentity].filter(Boolean).join("/"),n=t.evidence,r=[`# Handoff accepted \u2014 ${t.taskDescription}`,"",`- Task id: \`${t.taskId}\``,`- Handoff: \`${t.id}\``,`- Started by: ${o}`,`- Accepted by: ${e.agent}/${e.identity}`,`- Why yielded: ${t.reason}`];return n?.turns&&r.push(`- Turns spent: ${n.turns}`),n?.pressure&&r.push(`- Context pressure: ${n.pressure}`),n?.files&&n.files.length>0&&r.push(`- Hot files: ${n.files.slice(0,8).map(s=>`\`${s}\``).join(", ")}`),n?.journal&&n.journal.length>0&&r.push("","## Prior journal",...n.journal.map(s=>`- ${s.slice(0,120)}`)),r.push("","## Next","","1. `prjct work --md` \u2014 same cycle is still active (now yours)","2. Read hot files + `prjct guard <file>` before editing","3. Continue implementation \u2014 do **not** restart from zero"),r.join(`
|
|
21
|
+
`)}a(nt,"formatAcceptBrief");async function K(t,e,o){let n=await A(e);if(n.gitError)throw new Error(`git ${n.gitError}: workspace identity unknown \u2014 refusing to update task fields on the main fallback.`);let r=o;n.isMain?await y.updateCurrentTask(t,r):await y.updateWorkspaceTask(t,n.workspaceId,r)}a(K,"rebindTaskOwner");async function It(t,e,o,n={}){let r=L(o);if(!r)return{ok:!1,error:'Usage: prjct switch <agent> [--reason "\u2026"] [--launch]'};let s=await _(t,e);if(!s)return{ok:!1,error:'No active work cycle in this workspace. Start one with `prjct work "<intent>"` first.'};let l=H(s.description),c=s.ownerAgent||l.agent,d=s.ownerIdentity||l.identity,i=await A(e);if(i.gitError)return{ok:!1,error:`git ${i.gitError}: workspace identity unknown \u2014 refusing to switch agents on the main fallback. Re-run when git is healthy.`};let u=await h.readConfig(e).catch(()=>null),k=await Z(t,e,s.id,s.startedAt),g=tt(n.reason,k,s.description),z=u?.multiAgent?.handoffTtlHours??24,p=W({projectId:t,taskId:s.id,taskDescription:s.description,fromAgent:c,fromIdentity:d,toAgent:r,reason:g,evidence:k,workspaceId:i.isMain?D:i.workspaceId,worktreePath:i.worktreePath,branch:i.branch??s.branch,ttlHours:z});await K(t,e,{yieldStatus:"yielded",pendingHandoffId:p.id});try{await P({projectId:t,projectPath:e,cycleDescription:s.description,cycleId:s.id,author:d})}catch{}try{f.appendEvent(t,"task.handoff.yielded",{handoffId:p.id,taskId:s.id,fromAgent:c,toAgent:r,reason:g})}catch{}E(u)==="on"&&await I(`prjct \u2192 ${r}`,`Handoff: ${s.description.slice(0,80)} \u2014 prjct accept ${p.id.slice(0,16)}`);let J=et(p),b=n.launch===!0||u?.multiAgent?.switchLaunch===!0?await rt(r,p,i.worktreePath):{ok:!1,error:void 0};return{ok:!0,handoff:p,resumeCard:J,launched:b.ok,launchError:b.error}}a(It,"switchAgent");async function $t(t,e,o){let n=H(e),r=o?.trim()?[]:T(t,n.agent),s=r.length>0?r:w(t,{status:"pending",limit:5}),l=o?.trim()||s[0]?.id||"";if(!l)return{ok:!1,error:"No pending handoff for this agent. List with `prjct handoffs`."};let c=U(t,l);if(!c)return{ok:!1,error:`Handoff not found: ${l}`};if(c.status!=="pending")return{ok:!1,error:`Handoff ${c.id.slice(0,16)} is already ${c.status}`};let d=`${n.agent}/${n.identity}`,i=F(t,c.id,d);if(!i)return{ok:!1,error:`Claim lost \u2014 ${c.id.slice(0,16)} was taken or expired`};await K(t,e,{ownerAgent:n.agent,ownerIdentity:n.identity,ownerSessionId:n.sessionId,yieldStatus:"active",pendingHandoffId:null});try{f.appendEvent(t,"task.handoff.accepted",{handoffId:i.id,taskId:i.taskId,acceptedBy:d,fromAgent:i.fromAgent})}catch{}return E(await h.readConfig(e).catch(()=>null))==="on"&&await I("prjct handoff accepted",`${d} took over: ${i.taskDescription.slice(0,80)}`),{ok:!0,handoff:i,brief:nt(i,n)}}a($t,"acceptAgentHandoff");function Tt(t,e){let o=e??N(),n=T(t,o),r=n.length>0?n:o==="unknown"?w(t,{status:"pending",limit:2}):[];return r.length===0?null:r.map(s=>`\u2194 Handoff pending for ${s.toAgent}: \`${s.taskId.slice(0,8)}\` \u2014 "${s.reason.slice(0,80)}" \xB7 accept: \`prjct accept ${s.id}\``).join(`
|
|
22
|
+
`)}a(Tt,"formatPendingHandoffCue");async function rt(t,e,o){let s=R[t]?.cliCommand;if(!s)return{ok:!1,error:`No CLI for ${t} \u2014 paste the resume card into that terminal instead.`};if(!await S(s))return{ok:!1,error:`${s} not on PATH`};let c=[`You are accepting a prjct handoff from ${e.fromAgent}.`,`Run: prjct accept ${e.id} --md`,`Then continue task ${e.taskId}: ${e.taskDescription}.`,`Reason yielded: ${e.reason}`,"Do not restart from zero. Work from the current branch state."].join(" ");try{return X(s,[c],{cwd:o,detached:!0,stdio:"ignore",env:{...process.env,PRJCT_AGENT_RUNTIME:t}}).unref(),{ok:!0}}catch(d){return{ok:!1,error:d instanceof Error?d.message:"spawn failed"}}}a(rt,"launchTargetAgent");export{$t as acceptAgentHandoff,Tt as formatPendingHandoffCue,rt as launchTargetAgent,It as switchAgent};
|
|
@@ -0,0 +1,42 @@
|
|
|
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,b as ye,c as b,d as U,e as q,f as H,g as we,h as ke,i as w}from"./chunk-2H57GV2T.mjs";import"./chunk-FGQZ62ZP.mjs";import"./chunk-TXJT3G53.mjs";import"./chunk-A5RNWWTH.mjs";import"./chunk-HZIORCPO.mjs";import"./chunk-WDGDFXSB.mjs";import"./chunk-NWY5M34K.mjs";import"./chunk-H6KVNDQD.mjs";import"./chunk-NN65WGGN.mjs";import"./chunk-Q5I2UPD6.mjs";import{a as y,b as L,c as N,d as ve,e as E,f as R,g as z}from"./chunk-5T5PZKHW.mjs";import{b as me,c as A,d as $e}from"./chunk-R77TXXPP.mjs";import"./chunk-PSSR7LSW.mjs";import{a as g}from"./chunk-YGHIPTJN.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-P43HDWI5.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-UDUUEZD3.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-ZTZTVBAZ.mjs";import{a as Se}from"./chunk-DYHYDHCW.mjs";import"./chunk-2OU2MKNS.mjs";import{a as D,b as he,c as K}from"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-F652GI4F.mjs";import"./chunk-SNISJ7HR.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-J6JZ4PQA.mjs";import"./chunk-PTVXWPQH.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-SJ75V4WG.mjs";import{e as de}from"./chunk-4DDCWMI6.mjs";import{d as pe}from"./chunk-JQLJM4BK.mjs";import"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a as fe}from"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import{a as ge}from"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import{b as ue}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import{d as _,g as ce}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{d as le}from"./chunk-YORSHLFH.mjs";import{b as I,d as oe,e as X,s as ie,t as Qe}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{j as ae,n as Be}from"./chunk-SVZHJZ5T.mjs";import{a as M,b as ne,o as re}from"./chunk-CTWZQ7YI.mjs";import"./chunk-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import{a as k,e as $,f as J}from"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";J();re();Be();import j from"node:fs/promises";import C from"node:path";var Y=class{static{m(this,"CodebaseAnalyzer")}projectPath=null;init(e=process.cwd()){this.projectPath=e}async readPackageJson(){try{let e=C.join(this.projectPath,"package.json"),t=await j.readFile(e,"utf-8");return JSON.parse(t)}catch(e){if(k(e)||e instanceof SyntaxError)return null;throw e}}async readCargoToml(){try{let e=C.join(this.projectPath,"Cargo.toml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readRequirements(){try{let e=C.join(this.projectPath,"requirements.txt");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readGoMod(){try{let e=C.join(this.projectPath,"go.mod");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readGemfile(){try{let e=C.join(this.projectPath,"Gemfile");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readMixExs(){try{let e=C.join(this.projectPath,"mix.exs");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readPomXml(){try{let e=C.join(this.projectPath,"pom.xml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readComposerJson(){try{let e=C.join(this.projectPath,"composer.json"),t=await j.readFile(e,"utf-8");return JSON.parse(t)}catch(e){if(k(e)||e instanceof SyntaxError)return null;throw e}}async readPyprojectToml(){try{let e=C.join(this.projectPath,"pyproject.toml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async getFileExtensions(){try{let{stdout:e}=await M('find . -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" ! -path "*/.next/*" | sed "s/.*\\./\\./" | sort | uniq -c | sort -rn',{cwd:this.projectPath}),t={};return e.trim().split(`
|
|
9
|
+
`).filter(Boolean).forEach(o=>{let s=o.trim().match(/^\s*(\d+)\s+(\.\w+)$/);s&&(t[s[2]]=parseInt(s[1],10))}),t}catch{return{}}}async listConfigFiles(){try{let e=await j.readdir(this.projectPath),t=[/^package\.json$/,/^Cargo\.toml$/,/^go\.mod$/,/^requirements\.txt$/,/^Gemfile$/,/^mix\.exs$/,/^pom\.xml$/,/^composer\.json$/,/^pyproject\.toml$/,/^tsconfig.*\.json$/,/^\..*rc(\.json|\.js|\.cjs)?$/,/^Dockerfile$/,/^docker-compose.*\.ya?ml$/,/^\.env.*$/];return e.filter(o=>t.some(s=>s.test(o)))}catch(e){if(k(e))return[];throw e}}async listDirectories(){try{return(await j.readdir(this.projectPath,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).filter(t=>!t.startsWith(".")&&t!=="node_modules")}catch(e){if(k(e))return[];throw e}}async getGitLog(e=50){try{let{stdout:t}=await M(`git log -n ${e} --pretty=format:"%h|%an|%ar|%s"`,{cwd:this.projectPath});return t}catch{return""}}async getGitStats(){try{let{stdout:e}=await M("git rev-list --count HEAD",{cwd:this.projectPath}),{stdout:t}=await M('git log --format="%an" | sort -u | wc -l',{cwd:this.projectPath}),{stdout:o}=await M('git log --reverse --pretty=format:"%ar" | head -1',{cwd:this.projectPath});return{totalCommits:parseInt(e.trim(),10)||0,contributors:parseInt(t.trim(),10)||0,age:o.trim()||"unknown"}}catch{return{totalCommits:0,contributors:0,age:"unknown"}}}async countFiles(){try{let{stdout:e}=await M('find . -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" | wc -l',{cwd:this.projectPath});return parseInt(e.trim(),10)||0}catch{return 0}}async fileExists(e){return ae(C.join(this.projectPath,e))}async readFile(e){try{let t=C.join(this.projectPath,e);return await j.readFile(t,"utf-8")}catch(t){if(k(t))return null;throw t}}async findFiles(e){try{let{stdout:t}=await M(`find . -type f -name "${e}" ! -path "*/node_modules/*" ! -path "*/.git/*"`,{cwd:this.projectPath});return t.trim().split(`
|
|
10
|
+
`).filter(Boolean)}catch{return[]}}},We=new Y,S=We;Qe();import je from"node:fs/promises";import Pe from"node:path";var V=800,Z=6,Xe=8,Ke=5;async function ee(r,e,t,o){let[s,i,n,a]=await Promise.all([Ye(r,e,o),Ze(r),et(r),tt(r)]);return{project:{name:o.name,ecosystem:o.ecosystem,languages:o.languages,frameworks:o.frameworks,fileCount:o.fileCount,projectType:o.projectType},git:{branch:t.branch,recentCommits:t.recentCommits.slice(0,Xe).map(u=>({message:u.message,date:u.date})),hasChanges:t.hasChanges,weeklyCommits:t.weeklyCommits},codeSamples:s,existingPatterns:i,taskHistory:n,previousAnalysis:a??void 0}}m(ee,"buildAnalysisPayload");async function Ye(r,e,t){let o=[],s=[...t.frameworks.map(a=>a.toLowerCase()),"config","router","middleware","service","model","schema","database","api","auth"].join(" "),i=de(r,s,Z*2);for(let a of i){if(o.length>=Z)break;try{let u=Pe.join(e,a.path),l=await je.readFile(u,"utf-8");l.length>V*3?o.push({path:a.path,content:`${l.slice(0,V)}
|
|
11
|
+
// ... truncated`,reason:`BM25 score: ${a.score.toFixed(2)} (truncated, ${l.length} chars)`}):o.push({path:a.path,content:l.slice(0,V),reason:`BM25 score: ${a.score.toFixed(2)}`})}catch{}}let n=["package.json","tsconfig.json","src/index.ts","src/main.ts","app.ts"];for(let a of n){if(o.length>=Z)break;if(!o.some(u=>u.path===a))try{let u=Pe.join(e,a),l=await je.readFile(u,"utf-8");o.push({path:a,content:l.slice(0,V),reason:"entry point"})}catch{}}return o}m(Ye,"selectCodeSamples");async function Ze(r){try{let e=await b.getActive(r);return e?{patterns:(e.patterns??[]).map(t=>({name:t.name,description:t.description})),antiPatterns:(e.antiPatterns??[]).map(t=>({issue:t.issue,file:t.file,suggestion:t.suggestion}))}:{patterns:[],antiPatterns:[]}}catch{return{patterns:[],antiPatterns:[]}}}m(Ze,"getExistingPatterns");async function et(r){try{return(await ue.getTaskHistory(r)).slice(0,Ke).map(t=>({description:t.title,status:t.classification,branch:t.branchName}))}catch{return[]}}m(et,"getTaskHistory");function tt(r){try{let e=D.getActiveSummary(r);return Promise.resolve(e)}catch(e){return Se.debug("Failed to get previous LLM analysis summary",{error:e}),Promise.resolve(null)}}m(tt,"getPreviousAnalysisSummary");J();X();ce();J();async function be(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.seal(o);return e.json?(console.log(JSON.stringify({success:s.success,signature:s.signature,error:s.error})),{success:s.success,error:s.error}):s.success?(g.done("Analysis sealed"),console.log(` Signature: ${s.signature?.substring(0,16)}...`),console.log(""),{success:!0,data:{signature:s.signature}}):(g.fail(s.error||"Seal failed"),{success:!1,error:s.error})}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):g.fail(o),{success:!1,error:o}}}m(be,"seal");async function Ce(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.rollback(o);return e.json?(console.log(JSON.stringify({success:s.success,restoredSignature:s.restoredSignature,error:s.error})),{success:s.success,error:s.error}):e.md?s.success?(console.log(y(R("Analysis Rolled Back"),E({"Restored signature":`${s.restoredSignature?.substring(0,16)}...`,Note:"Previous sealed version is now active. Current version moved to draft."}))),{success:!0,data:{restoredSignature:s.restoredSignature}}):(console.log(y("## Rollback Failed",`> ${s.error}`)),{success:!1,error:s.error}):s.success?(g.done("Analysis rolled back to previous sealed version"),console.log(` Restored signature: ${s.restoredSignature?.substring(0,16)}...`),console.log(" Previous sealed version demoted to draft"),console.log(""),{success:!0,data:{restoredSignature:s.restoredSignature}}):(g.fail(s.error||"Rollback failed"),{success:!1,error:s.error})}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):e.md?console.log(y("## Rollback Failed",`> ${o}`)):g.fail(o),{success:!1,error:o}}}m(Ce,"rollback");async function xe(r=process.cwd(),e={}){if(e.semantic)return te(r,e);try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=await b.verify(o);return e.json?(console.log(JSON.stringify(s)),{success:s.valid}):(s.valid?g.done(s.message):g.fail(s.message),console.log(""),{success:s.valid,data:s})}catch(t){let o=$(t);return me(o)}}m(xe,"verify");async function te(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json?console.log(JSON.stringify({success:!1,error:"No project ID found"})):g.fail("No project ID found"),t.result;let o=t.value,s=(()=>{try{return _.getDoc(o,"project")?.repoPath||r}catch{return r}})(),i=await b.semanticVerify(o,s);if(e.json)return console.log(JSON.stringify(i)),{success:i.passed,data:i};console.log(""),i.passed?(g.done("Semantic verification passed"),console.log(` ${i.passedCount}/${i.checks.length} checks passed (${i.totalMs}ms)`)):(g.fail("Semantic verification failed"),console.log(` ${i.failedCount}/${i.checks.length} checks failed`)),console.log(""),console.log("Check Results:");for(let n of i.checks){let a=n.passed?"\u2713":"\u2717",u=n.passed?`${n.output} (${n.durationMs}ms)`:n.error||"Failed";console.log(` ${a} ${n.name}: ${u}`)}return console.log(""),{success:i.passed,data:i}}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):g.fail(o),{success:!1,error:o}}}m(te,"semanticVerifyCommand");import De from"node:fs/promises";import Re from"node:path";import{z as c}from"zod";var st=c.object({style:c.string(),insights:c.array(c.string()),domains:c.array(c.string())}),nt=c.object({name:c.string(),description:c.string(),locations:c.array(c.string()),confidence:c.number().min(0).max(1),category:c.string()}),rt=c.object({issue:c.string(),reasoning:c.string(),files:c.array(c.string()),suggestion:c.string(),severity:c.enum(["low","medium","high"]),confidence:c.number().min(0).max(1)}),ot=c.object({description:c.string(),area:c.string(),effort:c.enum(["small","medium","large"]),impact:c.string(),priority:c.enum(["low","medium","high"])}),at=c.object({path:c.string(),reason:c.string(),risk:c.string(),severity:c.enum(["low","medium","high"])}),it=c.object({description:c.string(),files:c.array(c.string()),benefit:c.string(),effort:c.enum(["small","medium","large"])}),ct=c.object({category:c.string(),rule:c.string(),example:c.string().optional()}),lt=c.object({build:c.string().optional(),test:c.string().optional(),lint:c.string().optional(),dev:c.string().optional(),format:c.string().optional(),install:c.string().optional()}),ut=c.object({languages:c.array(c.string()),frameworks:c.array(c.string()),packageManager:c.string().optional()}),mt=c.object({version:c.literal(1),commitHash:c.string().nullable(),analyzedAt:c.string(),architecture:st,patterns:c.array(nt),antiPatterns:c.array(rt),techDebt:c.array(ot),riskAreas:c.array(at),refactorSuggestions:c.array(it),projectInsights:c.array(c.string()),conventions:c.array(ct),commands:lt.optional(),stack:ut.optional()});function Ae(r){let e=mt.safeParse(r);return e.success?{ok:!0,value:e.data}:{ok:!1,error:e.error.issues.map(o=>`${o.path.length>0?o.path.join("."):"<root>"}: ${o.message}`).join("; ")}}m(Ae,"parseLlmAnalysis");X();re();async function Le(r,e=process.cwd(),t={}){try{let o=await w(e);if(!o.ok)return o.result;let s=o.value,i=await dt(r,e),n=await pt(i.content,e),a=D.getActive(s),u=!!(a&&he(a)&&K(n)),l=u?gt(a,n):n;D.save(s,l);try{let{recomputeProjectStyle:f}=await import("./project-style-evolution-363CLE32.mjs"),{gatherStats:h,detectStack:x,detectCommands:B}=await import("./sync-analyzer-FKC57RTV.mjs"),[T,P,Q]=await Promise.all([h(e),x(e),B(e)]);await f({projectId:s,projectPath:e,stats:T,stack:P,commands:Q,commitHash:l.commitHash,source:"analysis-save"})}catch{}let p=K(l)&&!u;if(t.md){let h=[R(u?"LLM Analysis Notes Merged (house style preserved)":p?"LLM Analysis Notes Saved (thin \u2014 not house style)":"LLM Analysis Saved"),E({Input:i.source,Architecture:l.architecture.style,Patterns:l.patterns.length,"Anti-patterns":l.antiPatterns?.length||0,"Tech debt items":l.techDebt?.length||0,"Risk areas":l.riskAreas?.length||0,Conventions:l.conventions?.length||0,...u?{Merge:"thin notes \u2192 existing rich analysis"}:{},...p?{Kind:"thin markdown/notes"}:{}})];p&&h.push(z("Prefer schema v1 JSON (architecture/patterns/conventions) via `prjct analysis-save-llm <file> --md`. Markdown alone leaves patterns empty and burns a retry loop.")),console.log(y(...h))}else console.log(JSON.stringify({success:!0,message:u?"LLM analysis notes merged into existing rich analysis":p?"LLM analysis thin notes saved (prefer schema v1 JSON for house style)":"LLM analysis saved",input:i.source,mergedNotes:u,thin:p,stats:{patterns:l.patterns.length,antiPatterns:l.antiPatterns?.length||0,techDebt:l.techDebt?.length||0},...p?{tip:"Prefer schema v1 JSON (architecture/patterns/conventions). Markdown alone is thin notes."}:{}}));return{success:!0}}catch(o){return A(o)}}m(Le,"saveLlmAnalysis");function gt(r,e){let t=m((o,s,i)=>{let n=[],a=new Set;for(let u of[...o,...s]){let l=u.toLowerCase();if(!(a.has(l)||!u.trim())&&(a.add(l),n.push(u),n.length>=i))break}return n},"mergeUnique");return{...r,analyzedAt:e.analyzedAt,commitHash:e.commitHash??r.commitHash,projectInsights:t(r.projectInsights??[],e.projectInsights??[],60),architecture:{...r.architecture,insights:t(r.architecture.insights??[],e.architecture.insights??[],24)}}}m(gt,"mergeThinNotesIntoRich");async function dt(r,e){let t=r.trim();if(!t)throw new Error("analysis-save-llm requires analysis text, JSON, or a file path");let o=Re.isAbsolute(t)?t:Re.resolve(e,t);try{if((await De.stat(o)).isFile())return{content:await De.readFile(o,"utf-8"),source:"file"}}catch{}return{content:r,source:"inline"}}m(dt,"resolveAnalysisInput");async function pt(r,e){let t=r.trim();if(!t)throw new Error("analysis-save-llm received an empty analysis");let o=ft(t);if(o.ok){let s=Ae(o.value);return s.ok?s.value:Me(`Structured analysis did not match the legacy schema; preserved as LLM notes.
|
|
12
|
+
|
|
13
|
+
${JSON.stringify(o.value,null,2)}`,e)}return Me(t,e)}m(pt,"normalizeAnalysis");function ft(r){try{return{ok:!0,value:JSON.parse(r)}}catch{return{ok:!1}}}m(ft,"tryParseJson");async function Me(r,e){let t=ht(r);return{version:1,commitHash:await St(e),analyzedAt:I(),architecture:{style:"unknown",insights:t.slice(0,8),domains:[]},patterns:[],antiPatterns:[],techDebt:[],riskAreas:[],refactorSuggestions:[],projectInsights:t,conventions:[]}}m(Me,"analysisFromText");function ht(r){let e=r.split(/\r?\n/).map(s=>s.replace(/^\s{0,3}#{1,6}\s+/,"").replace(/^\s*[-*]\s+\[[ xX]\]\s+/,"").replace(/^\s*[-*]\s+/,"").replace(/^\s*\d+[.)]\s+/,"").trim()).filter(yt),t=[],o=new Set;for(let s of e){let i=s.toLowerCase();if(!o.has(i)&&(o.add(i),t.push(s),t.length>=40))break}return t.length>0?t:[r.slice(0,2e3)]}m(ht,"textToInsights");function yt(r){if(!r||!/[\p{L}\p{N}]/u.test(r))return!1;let e=r.toLowerCase().replace(/\s+/g," ").trim();return!(["current work","wip","misc","todo","n/a","none","latest","unreleased","changelog"].includes(e)||/^[-=_]{3,}$/.test(e)||/^(added|changed|fixed|removed)$/i.test(e)||/^v?\d+\.\d+\.\d+(?:-[\w.-]+)?$/i.test(e))}m(yt,"isUsefulInsight");async function St(r){try{let{stdout:e}=await ne("git",["rev-parse","HEAD"],{cwd:r});return e.trim()||null}catch{return null}}m(St,"resolveCurrentCommit");async function Ne(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=D.getActive(o);if(!s)return e.md?console.log(y("## No LLM Analysis","> Run `prjct sync` to generate.")):console.log(JSON.stringify({success:!1,message:"No LLM analysis found"})),{success:!1,message:"No LLM analysis found"};if(e.md){let i=[R(`LLM Analysis (${s.architecture.style})`),""];if(s.architecture.insights.length>0&&i.push(L("Architecture Insights",N(s.architecture.insights.slice(0,5)))),s.patterns.length>0){let n=s.patterns.slice(0,8);i.push(L(`Patterns (${s.patterns.length})`,N(n.map(a=>`**${a.name}** \u2014 ${a.description} (${a.category})`))))}if(s.antiPatterns.length>0){let n=s.antiPatterns.slice(0,5);i.push(L(`Anti-Patterns (${s.antiPatterns.length})`,N(n.map(a=>`[${a.severity}] ${a.issue} \u2014 ${a.suggestion}`))))}if(s.techDebt.length>0){let n=s.techDebt.slice(0,5);i.push(L(`Tech Debt (${s.techDebt.length})`,N(n.map(a=>`[${a.priority}/${a.effort}] ${a.description}`))))}s.conventions.length>0&&i.push(L("Conventions",N(s.conventions.slice(0,5).map(n=>`**${n.category}**: ${n.rule}`)))),console.log(y(...i))}else{let i={...s,patterns:s.patterns.slice(0,10),antiPatterns:s.antiPatterns.slice(0,6),techDebt:s.techDebt.slice(0,6),conventions:s.conventions.slice(0,6)};console.log(JSON.stringify({success:!0,analysis:i}))}return{success:!0,data:s}}catch(t){return A(t)}}m(Ne,"getLlmAnalysis");ce();J();import wt from"node:path";X();async function Te(r,e){let t=Date.now()-e;await le.installGlobalConfig(),g.done(`Synced ${r.stats.name||"project"} (${(t/1e3).toFixed(1)}s)`),console.log("");let o=r.stats.frameworks.length>0?` (${r.stats.frameworks[0]})`:"",s=r.syncMetrics?.indexes,i=[`${r.stats.fileCount} files indexed`,`Stack: ${r.stats.ecosystem}${o} | Branch: ${r.git.branch}`];if(s?.bm25Files){let a=s.bm25Files*(s.bm25AvgTokens||0);i.push(`Index: ${F(a)} tokens | ${s.bm25VocabSize||0} terms | ${s.importEdges||0} imports`)}g.box("Sync Summary",i.join(`
|
|
14
|
+
`));let n=[];if(r.generatedSkills?.generated&&r.generatedSkills.generated.length>0){let a=r.generatedSkills.generated.length,u=a===1?"skill":"skills";n.push(`${a} ${u} generated`)}if(r.context7&&n.push(`Context7: ${r.context7.verified?"verified":`not ready${r.context7.message?` (${r.context7.message})`:""}`}`),r.analysisSummary&&n.push(`Analysis: ${r.analysisSummary.patterns} patterns | ${r.analysisSummary.antiPatterns} anti-patterns (${r.analysisSummary.criticalAntiPatterns} critical)`),r.contextQuality){let a=r.contextQuality,u=a.irrelevantRemoved>0||a.repairEntriesCreated>0?`, repaired ${a.repairEntriesCreated}, removed ${a.irrelevantRemoved}`:"";n.push(`Context quality: ${a.score}/${a.threshold}${a.passed?"":" (needs review)"}${u}`)}if(g.section("Generated"),g.list(n,{bullet:"\u2713"}),console.log(""),r.git.hasChanges&&(g.warn("Uncommitted changes detected"),console.log("")),r.verification){let a=r.verification;if(a.passed){let u=a.checks.map(l=>`${l.name} (${l.durationMs}ms)`);g.section("Verified"),g.list(u,{bullet:"\u2713"})}else{g.section("Verification");let u=a.checks.map(l=>l.passed?`\u2713 ${l.name}`:`\u2717 ${l.name}${l.error?` \u2014 ${l.error}`:""}`);g.list(u),a.skippedCount>0&&g.warn(`${a.skippedCount} check(s) skipped (fail-fast)`)}console.log("")}return we("sync"),{success:!0,data:r,metrics:{elapsed:t,fileCount:r.stats.fileCount}}}m(Te,"showSyncResult");async function Ee(r){try{let e=await ge.getRecentEvents(r,100),t=new Date().toISOString().split("T")[0],o=e.filter(l=>(l.timestamp||l.ts)?.startsWith(t)),s=(()=>{if(o.length<2)return null;let l=o.map(f=>new Date(f.timestamp||f.ts).getTime()).filter(f=>!Number.isNaN(f)).sort((f,h)=>f-h);if(l.length<2)return null;let p=l[l.length-1]-l[0];return oe(p)})(),i=o.filter(l=>l.action==="task_completed").length,n=o.filter(l=>l.action==="feature_shipped").length,a=new Map;for(let l of o)if(l.action==="sync"&&Array.isArray(l.subagents))for(let p of l.subagents)a.set(p,(a.get(p)||0)+1);let u=Array.from(a.entries()).map(([l,p])=>({name:l,count:p})).sort((l,p)=>p.count-l.count);return{sessionDuration:s,tasksCompleted:i,featuresShipped:n,agentsUsed:u}}catch{return{sessionDuration:null,tasksCompleted:0,featuresShipped:0,agentsUsed:[]}}}m(Ee,"getSessionActivity");function F(r){return r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toLocaleString()}m(F,"formatTokens");function se(r){return r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(1)}s`}m(se,"formatDuration");function Fe(r){if(r.length===0)return"";let e="\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588",t=r.map(s=>s.tokensSaved),o=Math.max(...t,1);return t.map(s=>{let i=Math.min(Math.floor(s/o*(e.length-1)),e.length-1);return e[i]}).join("")}m(Fe,"generateSparkline");function Oe(r,e,t,o,s,i){let n=[];if(n.push(`# ${t} - Stats Dashboard`),n.push(""),n.push(`_Generated: ${new Date().toLocaleString()} | Tracking since: ${o}_`),n.push(""),s){if(n.push("## Today's Activity"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),s.sessionDuration&&n.push(`| Duration | ${s.sessionDuration} |`),n.push(`| Tasks completed | ${s.tasksCompleted} |`),n.push(`| Features shipped | ${s.featuresShipped} |`),s.agentsUsed.length>0){let a=s.agentsUsed.slice(0,3).map(u=>`${u.name} (${u.count}\xD7)`).join(", ");n.push(`| Agents used | ${a} |`)}n.push("")}if(i&&(i.decisions>0||i.preferences>0)&&(n.push("## Patterns Learned"),n.push(""),n.push("| Type | Count |"),n.push("|------|-------|"),n.push(`| Decisions | ${i.learnedDecisions} confirmed (${i.decisions} total) |`),n.push(`| Preferences | ${i.preferences} |`),n.push(`| Workflows | ${i.workflows} |`),n.push("")),n.push("## Context Efficiency"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),n.push(`| Tokens reduced | ${F(r.totalTokensSaved)} |`),n.push(`| Compression | ${(r.compressionRate*100).toFixed(0)}% |`),n.push(`| Est. cost saved | ${U(r.estimatedCostSaved)} |`),n.push(""),n.push("## Performance"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),n.push(`| Syncs | ${r.syncCount} |`),n.push(`| Avg time | ${se(r.avgSyncDuration)} |`),n.push(""),r.topAgents.length>0){n.push("## Agent Usage"),n.push(""),n.push("| Agent | Usage |"),n.push("|-------|-------|");let a=r.topAgents.reduce((u,l)=>u+l.usageCount,0);for(let u of r.topAgents){let l=a>0?(u.usageCount/a*100).toFixed(0):0;n.push(`| ${u.agentName} | ${l}% (${u.usageCount}) |`)}n.push("")}if(n.push("## 30-Day Trend"),n.push(""),n.push(`- Tokens saved: ${F(r.last30DaysTokens)}`),r.trend!==0){let a=r.trend>0?"+":"";n.push(`- Trend: ${a}${r.trend.toFixed(0)}% vs previous period`)}return n.push(""),n.push("---"),n.push(""),n.push("_Generated with [prjct-cli](https://prjct.app)_"),n.join(`
|
|
15
|
+
`)}m(Oe,"generateStatsMarkdown");function Ie(r,e){let t=[];t.push(`# Repository Analysis
|
|
16
|
+
`),t.push(`Generated: ${new Date().toLocaleString()}
|
|
17
|
+
`);let o=wt.basename(e);if(t.push(`## Project: ${o}
|
|
18
|
+
`),t.push(`## Stack Detected
|
|
19
|
+
`),r.packageJson){let n=r.packageJson;if(t.push(`### JavaScript/TypeScript
|
|
20
|
+
`),t.push("- **Package Manager**: npm/yarn/pnpm"),n.dependencies){let a=Object.keys(n.dependencies);a.length>0&&t.push(`- **Dependencies**: ${a.slice(0,10).join(", ")}${a.length>10?` (+${a.length-10} more)`:""}`)}r.hasNextConfig&&t.push("- **Framework**: Next.js detected"),r.hasViteConfig&&t.push("- **Build Tool**: Vite detected"),r.hasTsconfig&&t.push("- **Language**: TypeScript"),t.push("")}r.cargoToml&&(t.push(`### Rust
|
|
21
|
+
`),t.push("- **Package Manager**: Cargo"),t.push(`- **Language**: Rust
|
|
22
|
+
`)),r.goMod&&(t.push(`### Go
|
|
23
|
+
`),t.push("- **Package Manager**: Go modules"),t.push(`- **Language**: Go
|
|
24
|
+
`)),r.requirements&&(t.push(`### Python
|
|
25
|
+
`),t.push("- **Package Manager**: pip"),t.push(`- **Language**: Python
|
|
26
|
+
`));let s=r.directories;t.push(`## Structure
|
|
27
|
+
`),t.push(`- **Total Files**: ${r.fileCount}`),t.push(`- **Directories**: ${s?.slice(0,15).join(", ")||"none"}${(s?.length||0)>15?` (+${(s?.length||0)-15} more)`:""}`),r.hasDockerfile&&t.push("- **Docker**: Detected"),r.hasDockerCompose&&t.push("- **Docker Compose**: Detected"),r.hasReadme&&t.push("- **Documentation**: README.md found"),t.push("");let i=r.gitStats;return t.push(`## Git Statistics
|
|
28
|
+
`),t.push(`- **Total Commits**: ${i?.totalCommits||0}`),t.push(`- **Contributors**: ${i?.contributors||0}`),t.push(`- **Age**: ${i?.age||"unknown"}`),t.push(""),r.gitLog&&(t.push(`## Recent Activity
|
|
29
|
+
`),r.gitLog.split(`
|
|
30
|
+
`).slice(0,5).forEach(a=>{if(a.trim()){let[u,,l,p]=a.split("|");t.push(`- \`${u}\` ${p} (${l})`)}}),t.push("")),t.push(`## Recommendations
|
|
31
|
+
`),t.push("Based on detected stack, consider generating specialized agents using `p. sync`.\n"),t.push(`---
|
|
32
|
+
`),t.push("*This analysis was generated automatically. For updated information, run `p. analyze` again.*\n"),t.join(`
|
|
33
|
+
`)}m(Ie,"generateAnalysisSummary");async function Je(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=await q.getSummary(o),i=await q.getDailyStats(o,30),n=await Ee(o),a={decisions:0,preferences:0,workflows:0,learnedDecisions:0};if(e.json){let f={session:n,patterns:a,totalTokensSaved:s.totalTokensSaved,estimatedCostSaved:s.estimatedCostSaved,compressionRate:s.compressionRate,syncCount:s.syncCount,avgSyncDuration:s.avgSyncDuration,topAgents:s.topAgents.slice(0,5),last30DaysTokens:s.last30DaysTokens,trend:s.trend,dailyStats:i.slice(0,7)};return console.log(JSON.stringify(f)),{success:!0,data:f}}let u=(()=>{try{return _.getDoc(o,"project")?.name||"Unknown"}catch{return"Unknown"}})(),l=await q.getFirstSyncDate(o),p=l?new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"N/A";if(console.log(""),console.log("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),console.log("\u2502 \u{1F4CA} prjct-cli Stats Dashboard \u2502"),console.log(`\u2502 Project: ${u.padEnd(20).slice(0,20)} | Since: ${p.padEnd(12).slice(0,12)} \u2502`),console.log("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),console.log(""),console.log("\u{1F3AF} TODAY'S ACTIVITY"),n.sessionDuration&&console.log(` Duration: ${n.sessionDuration}`),console.log(` Tasks completed: ${n.tasksCompleted}`),console.log(` Features shipped: ${n.featuresShipped}`),n.agentsUsed.length>0){let f=n.agentsUsed.slice(0,3).map(h=>`${h.name} (${h.count}\xD7)`).join(", ");console.log(` Agents used: ${f}`)}if(console.log(""),(a.decisions>0||a.preferences>0)&&(console.log("\u{1F9E0} PATTERNS LEARNED"),console.log(` Decisions: ${a.learnedDecisions} confirmed (${a.decisions} total)`),console.log(` Preferences: ${a.preferences} saved`),console.log(` Workflows: ${a.workflows} tracked`),console.log("")),console.log("\u{1F4B0} TOKEN SAVINGS"),console.log(` Total saved: ${F(s.totalTokensSaved)} tokens`),console.log(` Compression: ${(s.compressionRate*100).toFixed(0)}% average reduction`),console.log(` Estimated cost: ${U(s.estimatedCostSaved)} saved`),console.log(""),console.log("\u26A1 PERFORMANCE"),console.log(` Syncs completed: ${s.syncCount.toLocaleString()}`),console.log(` Avg sync time: ${se(s.avgSyncDuration)}`),console.log(""),s.topAgents.length>0){console.log("\u{1F916} AGENT USAGE (all time)");let f=s.topAgents.reduce((h,x)=>h+x.usageCount,0);for(let h of s.topAgents){let x=f>0?(h.usageCount/f*100).toFixed(0):0;console.log(` ${h.agentName.padEnd(12)}: ${x}% (${h.usageCount} uses)`)}console.log("")}if(i.length>0){console.log("\u{1F4C8} TREND (last 30 days)");let f=Fe(i);if(console.log(` ${f} ${F(s.last30DaysTokens)} tokens saved`),s.trend!==0){let h=s.trend>0?"\u2191":"\u2193",x=s.trend>0?"+":"";console.log(` ${h} ${x}${s.trend.toFixed(0)}% vs previous 30 days`)}console.log("")}if(console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log("Export: prjct stats --export > stats.md"),console.log(""),e.export){let f=Oe(s,i,u,p,n,a);return console.log(f),{success:!0,data:{markdown:f}}}return{success:!0,data:{...s,session:n,patterns:a}}}catch(t){return console.error("\u274C Error:",$(t)),A(t)}}m(Je,"stats");async function _e(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.diff(o);if(!s){let i="Cannot compute diff: need both a sealed and a draft analysis. Run `p. sync` to create a draft.";return e.json?console.log(JSON.stringify({success:!1,error:i})):e.md?console.log(y("## Analysis Diff",`> ${i}`)):g.warn(i),{success:!1,error:i}}if(e.json)return console.log(JSON.stringify({success:!0,...s})),{success:!0,data:s};if(e.md)return console.log(y(G(s))),{success:!0,data:s};if(!s.hasChanges)g.done("No changes between draft and sealed analysis");else{g.section("Analysis Diff"),console.log(ye(s)),console.log("");let i=[];s.summary.added>0&&i.push(`${s.summary.added} added`),s.summary.removed>0&&i.push(`${s.summary.removed} removed`),s.summary.changed>0&&i.push(`${s.summary.changed} changed`),g.done(i.join(", "))}return console.log(""),{success:!0,data:s}}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):e.md?console.log(y("## Diff Failed",`> ${o}`)):g.fail(o),{success:!1,error:o}}}m(_e,"diff");var Ge=["> Review this project data and save durable notes for future AI agents (architecture, conventions, risks, gotchas).","> **Prefer schema v1 JSON** with: architecture{style,insights,domains}, patterns[], antiPatterns[], techDebt[], riskAreas[], refactorSuggestions[], projectInsights[], conventions[], optional stack/commands. See core/schemas/llm-analysis.ts.","> Markdown alone saves style=unknown and empty patterns (thin notes) \u2014 agents then retry and burn tokens. Use markdown only to append insight bullets when a rich analysis already exists.","> Save path: write the JSON file, then `prjct analysis-save-llm <file> --md`."].join(`
|
|
34
|
+
`),Ue=class extends $e{static{m(this,"AnalysisCommands")}async analyze(e={},t=process.cwd()){try{await this.initializeAgent(),console.log(`\u{1F50D} Analyzing repository...
|
|
35
|
+
`),S.init(t);let o={packageJson:await S.readPackageJson(),cargoToml:await S.readCargoToml(),goMod:await S.readGoMod(),requirements:await S.readRequirements(),directories:await S.listDirectories(),fileCount:await S.countFiles(),gitStats:await S.getGitStats(),gitLog:await S.getGitLog(20),hasDockerfile:await S.fileExists("Dockerfile"),hasDockerCompose:await S.fileExists("docker-compose.yml"),hasReadme:await S.fileExists("README.md"),hasTsconfig:await S.fileExists("tsconfig.json"),hasViteConfig:await S.fileExists("vite.config.ts")||await S.fileExists("vite.config.js"),hasNextConfig:await S.fileExists("next.config.js")||await S.fileExists("next.config.mjs")},s=Ie(o,t);return await this.logToMemory(t,"repository_analyzed",{timestamp:I(),fileCount:o.fileCount,gitCommits:o.gitStats.totalCommits}),console.log(`\u2705 Analysis complete!
|
|
36
|
+
`),console.log(s),console.log(`
|
|
37
|
+
Next steps:`),console.log("\u2022 p. sync \u2192 Generate agents based on stack"),console.log('\u2022 p. work "<intent>" \u2192 Start a work cycle'),{success:!0,summary:s,data:o}}catch(o){return console.error("\u274C Error:",$(o)),A(o)}}async sync(e=process.cwd(),t={}){try{let o=await w(e);if(!o.ok)return o.result;let s=o.value,i=Date.now();if(t.package){let a=await ie.detectMonorepo(e);if(!a.isMonorepo)return{success:!1,error:"Not a monorepo. --package flag only works in monorepos."};let u=a.packages.find(p=>p.name===t.package||p.relativePath===t.package);if(!u){let p=a.packages.map(f=>f.name).join(", ");return{success:!1,error:`Package "${t.package}" not found. Available: ${p}`}}let l=await H.sync(e,{packagePath:u.path,packageName:u.name});return t.json?console.log(JSON.stringify({success:l.success,package:u.name,path:u.relativePath})):t.md?console.log(y(R(`Synced package: ${u.name}`))):g.done(`Synced package: ${u.name}`),{success:l.success}}t.md||g.spin("Syncing project...");let n=await H.sync(e,{full:t.full});if(!n.success)return t.md?console.log(y("## Sync Failed",`> ${n.error||"Unknown error"}`)):g.fail(n.error||"Sync failed"),{success:!1,error:n.error};if(t.md||g.stop(),t.md){let a=Date.now()-i,u=n.generatedSkills?.generated?.length??0,l=await b.diff(s).then(d=>d?.hasChanges?G(d):null).catch(()=>null),p=n.git.recentCommits[0]?.hash??null,h=p&&D.isCurrent(s,p)?null:await ee(s,e,n.git,n.stats).then(d=>["## Analysis Payload",Ge,"### Data","```json",JSON.stringify(d),"```"].join(`
|
|
38
|
+
`)).catch(()=>"### Next: Run `prjct analysis-payload --md` to update project analysis"),x=ke("sync",!0),B=(()=>{try{let d=fe.recall(s,{types:["context"],limit:5}).map(O=>`- ${pe(O)} \`${O.id}\``);return d.length>0?["### Evaluate recent context","Task contexts captured recently \u2014 fold their decisions, patterns and","anti-patterns into the project analysis (and supersede anything now wrong):","",...d].join(`
|
|
39
|
+
`):null}catch{return null}})(),T=n.syncMetrics?.indexes,P={Duration:`${(a/1e3).toFixed(1)}s`,Skills:`${u} generated`,"Files indexed":n.stats.fileCount};if(T?.bm25Files){let d=T.bm25Files*(T.bm25AvgTokens||0);P["Tokens indexed"]=`${Math.round(d/1e3)}K`,P["Import edges"]=T.importEdges||0,P["Co-change commits"]=T.cochangeCommits||0}n.contextQuality&&(P["Context quality"]=`${n.contextQuality.score}/${n.contextQuality.threshold}`+(n.contextQuality.passed?"":" needs review"),P["Context removed"]=n.contextQuality.irrelevantRemoved,P["Context repairs"]=n.contextQuality.repairEntriesCreated);let Q=(()=>{if(!n.retentionDryRun)return null;let d=n.retentionDryRun,O=d.dryRun===!1?"applied":"dry-run",Ve=d.dryRun===!1?` \xB7 acted: ${d.archived??0} archived, ${d.deleted??0} deleted`+(d.inboxMerged||d.inboxArchived?`, inbox ${d.inboxMerged??0} merged/${d.inboxArchived??0} archived`:""):"";if(P[`Retention (${O})`]=`${d.active} active \xB7 ${d.archive} archive \xB7 ${d.delete} delete${Ve}`,d.vault){let v=d.vault,W=d.dryRun===!1?` \xB7 purged: hard\u0394${v.softDeletedPurged??0} distill\u0394${v.distilledDiscarded??0} digests+${v.digestsWritten??0} arch\u0394${v.archivesPruned??0}`:"";P.Vault=`${v.live} live \xB7 soft-del ${v.softDeleted} \xB7 archives ${v.archives} \xB7 auto ${v.autoSourceLive}${W}`}return d.samples.length>0?L(d.dryRun===!1?"Retention (Rho) \u2014 worst excess/score (actions applied)":"Retention (Rho) dry-run \u2014 worst excess/score (nothing removed)",N(d.samples.map(v=>{let W="excess"in v&&typeof v.excess=="number"?` excess=${v.excess.toFixed(2)}`:"";return`\`${v.id}\` [${v.type}] ${v.verdict} (${v.score}${W}) \u2014 ${v.reasons.join(", ")}`}))):null})(),qe=n.projectStyle?.evolutionMd?n.projectStyle.evolutionMd:n.projectStyle?.summary?["## Project style","",n.projectStyle.summary,"",`Coverage: ${n.projectStyle.styleCoverage}/100 \xB7 ${n.projectStyle.patternCount} patterns \xB7 ${n.projectStyle.conventionCount} conventions \xB7 ${n.projectStyle.antiPatternCount} anti-patterns`].join(`
|
|
40
|
+
`):null,He=n.developerSnapshotCaptured?await import("./developer-evolution-R5BXQH6G.mjs").then(({renderDeveloperEvolution:d})=>d(s,4)).catch(()=>`## Developer evolution
|
|
41
|
+
|
|
42
|
+
Weekly developer snapshot captured.`):null,ze=y(R("Sync Complete"),E(P),Q,l,qe,He,n.git.hasChanges?z("Uncommitted changes detected"):null,B,h,ve(x.map(d=>({label:d.desc,command:d.cmd}))));return console.log(ze),{success:!0,data:n,metrics:{elapsed:a,skillCount:u,fileCount:n.stats.fileCount}}}return Te(n,i)}catch(o){return t.md?console.log(y("## Sync Failed",`> ${$(o)}`)):g.fail($(o)),A(o)}}async analysisPayload(e=process.cwd(),t={}){try{let o=await w(e);if(!o.ok)return o.result;let s=o.value,i=await H.sync(e);if(!i.success)return{success:!1,error:i.error||"Failed to gather project data"};let n=i.git.recentCommits[0]?.hash??null;if(n&&D.isCurrent(s,n))return t.md?console.log(y(R("LLM analysis is current"),"> No re-analysis needed.")):console.log(JSON.stringify({success:!0,action:"skip",message:"Analysis is current"})),{success:!0,message:"Analysis is current"};let a=await ee(s,e,i.git,i.stats);return t.md?console.log(y("## Analysis Payload",Ge,"### Data","```json",JSON.stringify(a),"```")):console.log(JSON.stringify({success:!0,payload:a})),{success:!0,data:a}}catch(o){return A(o)}}async saveLlmAnalysis(...e){return Le(...e)}async getLlmAnalysis(...e){return Ne(...e)}async stats(...e){return Je(...e)}async diff(...e){return _e(...e)}async seal(...e){return be(...e)}async rollback(...e){return Ce(...e)}async verify(...e){return xe(...e)}async semanticVerify(...e){return te(...e)}};export{Ue as AnalysisCommands};
|
|
@@ -0,0 +1,8 @@
|
|
|
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,b,c}from"./chunk-YUOTOCKK.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as DEFAULT_API_URL,b as DEFAULT_WEB_URL,c as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 n}from"./chunk-AW25AWN5.mjs";import"./chunk-HZIORCPO.mjs";import"./chunk-WDGDFXSB.mjs";import"./chunk-NWY5M34K.mjs";import"./chunk-LWCHQIJ7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3JUE6MNF.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-YUOTOCKK.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as t}from"./chunk-E66B27AL.mjs";async function c(u,o){try{let e=o??await import("./config-manager-KJCMN7PV.mjs").then(({default:a})=>a.readConfig(u).catch(()=>null));if(!e?.projectId||!e.cloud?.enabled||e.cloud.paused)return{ran:!1};if(!await n.hasAuth())return{ran:!1};let r=await n.sync(e.projectId,{include:e.cloud.include??{}});return{ran:!0,pushed:r.pushed?.count??0,pulled:r.pulled?.count??0,error:r.success?void 0:r.error}}catch{return{ran:!1}}}t(c,"flushIfLinked");export{c as flushIfLinked};
|
|
@@ -0,0 +1,9 @@
|
|
|
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 l,b as g}from"./chunk-Y5NQV46G.mjs";import{e as c,f as d}from"./chunk-HDSS6UB3.mjs";import{a as s,b as m}from"./chunk-WUHGODSQ.mjs";import{b as u,o as v}from"./chunk-CTWZQ7YI.mjs";import{a as n}from"./chunk-E66B27AL.mjs";m();d();v();import{execFileSync as y,spawn as j}from"node:child_process";import a from"node:fs";import i from"node:path";m();d();var w="https://registry.npmjs.org/prjct-cli/latest",$=3600*1e3;async function p(){try{let e=new AbortController,t=setTimeout(()=>e.abort(),6e3),r=await fetch(w,{signal:e.signal});if(clearTimeout(t),!r.ok)return null;let f=await r.json();return typeof f.version=="string"?f.version:null}catch{return null}}n(p,"fetchLatestVersion");var S=n(()=>i.join(s(),"state"),"stateDir"),k=n(()=>i.join(S(),"auto-update.log"),"logPath"),h=3600*1e3;function H(e){if(!e||process.env.PRJCT_NO_AUTO_UPDATE==="1"||l("auto-update")!=="on")return;let t=l("auto-update-last-check");if(t&&Date.now()-Date.parse(t)<h)return;g("auto-update-last-check",new Date().toISOString()),j(process.execPath,[process.argv[1],"__internal-auto-update",e],{detached:!0,stdio:"ignore"}).unref()}n(H,"maybeAutoUpdate");async function L(e){try{let t=await p();if(!t)return;if(c(t,e)<=0){o(`current ${e} >= latest ${t}, no-op`);return}let r=b();o(`upgrade available: ${e} \u2192 ${t} (source: ${r})`),await x(r,t),o(`upgrade complete: ${e} \u2192 ${t}`)}catch(t){o(`auto-update failed: ${t.message}`)}}n(L,"runBackgroundCheck");function b(){let e=i.join(s(),"bin","prjct");if(a.existsSync(e))try{if(a.statSync(e).size>1024*1024)return"binary"}catch{}try{let t=y("npm",["root","-g"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t&&a.existsSync(i.join(t,"prjct-cli")))return"npm"}catch{}try{let t=y("bun",["pm","bin","-g"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t&&a.existsSync(i.join(t,"prjct")))return"bun"}catch{}return"unknown"}n(b,"detectInstallSource");async function x(e,t){if(e==="binary"){o(`binary install auto-update skipped for ${t}; run the installer manually to upgrade`);return}if(e==="bun"){await u("bun",["install","-g","prjct-cli@latest"],{timeout:12e4});return}if(e==="npm"||e==="unknown"){await u("npm",["install","-g","prjct-cli@latest"],{timeout:12e4});return}}n(x,"applyUpgrade");function o(e){try{a.mkdirSync(S(),{recursive:!0}),a.appendFileSync(k(),`${new Date().toISOString()} ${e}
|
|
9
|
+
`)}catch{}}n(o,"log");var N={fetchLatestVersion:p,detectInstallSource:b,compareSemver:c,THROTTLE_MS:h};export{N as _internal,H as maybeAutoUpdate,L as runBackgroundCheck};
|
|
@@ -0,0 +1,8 @@
|
|
|
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{i as a}from"./chunk-VAXQ5IDD.mjs";import"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-3HDIQJ55.mjs";import"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as captureGate};
|
|
@@ -0,0 +1,38 @@
|
|
|
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-YGHIPTJN.mjs";import{a as mt,b as pt}from"./chunk-P43HDWI5.mjs";import{d as ft}from"./chunk-UDUUEZD3.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-F652GI4F.mjs";import{i as dt}from"./chunk-J6JZ4PQA.mjs";import{a as et}from"./chunk-PTVXWPQH.mjs";import{b as Qe,c as Xe,d as Ze}from"./chunk-4DDCWMI6.mjs";import{a as Ye}from"./chunk-OFVLGJ76.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-HZXDF2TQ.mjs";import{d as P,e as I,g as K}from"./chunk-HDHVBB6Q.mjs";import{d as se}from"./chunk-YORSHLFH.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-GSMDQ7VM.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-PSJCO5UP.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-363CLE32.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-S2GGTVY2.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-IPK4NJN6.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};
|
|
@@ -0,0 +1,8 @@
|
|
|
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{j as c,k as r,n as d}from"./chunk-SVZHJZ5T.mjs";import{a as u}from"./chunk-E66B27AL.mjs";d();import p from"node:fs/promises";import l from"node:os";import n from"node:path";var k=[{value:"web-app",title:"Web Application",description:"React, Vue, Angular, Next.js, etc."},{value:"api-backend",title:"API / Backend Service",description:"Express, Hono, FastAPI, etc."},{value:"fullstack",title:"Full-Stack (Monorepo)",description:"Frontend + Backend in one repo"},{value:"cli-tool",title:"CLI Tool",description:"Command-line application"},{value:"library",title:"Library / Package",description:"Reusable npm/pip/cargo package"},{value:"monorepo",title:"Monorepo (Multiple Projects)",description:"Turborepo, Nx, Lerna, etc."}],h=[{value:"claude",title:"Claude Code",description:"Anthropic's Claude in VS Code/CLI"},{value:"cursor",title:"Cursor",description:"AI-first code editor"},{value:"copilot",title:"GitHub Copilot",description:"GitHub's AI pair programmer"},{value:"gemini",title:"Gemini CLI",description:"Google's Gemini in terminal"},{value:"codex",title:"OpenAI Codex",description:"OpenAI's coding agent in terminal"},{value:"opencode",title:"OpenCode",description:"Open-source terminal coding agent"},{value:"pi",title:"Pi",description:"Minimal terminal coding harness (skills + AGENTS.md)"},{value:"qwen-code",title:"Qwen Code",description:"Qwen-family coding runtime"},{value:"goose",title:"Goose",description:"Open-source coding agent with extensions"},{value:"aider",title:"Aider",description:"Terminal pair-programming agent"},{value:"cline",title:"Cline",description:"VS Code coding agent"},{value:"roo-code",title:"Roo Code",description:"VS Code coding agent with MCP"},{value:"continue",title:"Continue",description:"IDE assistant with MCP config"},{value:"kiro",title:"Kiro",description:"Agentic IDE with steering docs"},{value:"zed",title:"Zed",description:"Editor agent with ACP support"}];async function y(t){try{let e=await p.readdir(t);if(e.includes("turbo.json")||e.includes("lerna.json")||e.includes("nx.json"))return"monorepo";if(e.includes("package.json")){let a=n.join(t,"package.json"),s=JSON.parse(await p.readFile(a,"utf-8")),i={...s.dependencies,...s.devDependencies};if(s.bin)return"cli-tool";if(s.main&&!i.react&&!i.vue&&!i.angular&&!i.express&&!i.hono)return"library";if((i.react||i.vue)&&(i.express||i.hono||i.fastify))return"fullstack";if(i.react||i.vue||i["@angular/core"]||i.next||i.nuxt)return"web-app";if(i.express||i.hono||i.fastify||i.koa||i.nestjs)return"api-backend"}return e.includes("pyproject.toml")||e.includes("setup.py")?e.some(s=>["main.py","app.py","server.py"].includes(s))?"api-backend":"library":e.includes("go.mod")?e.includes("main.go")?"cli-tool":"library":e.includes("Cargo.toml")?"cli-tool":"unknown"}catch{return"unknown"}}u(y,"detectProjectType");async function v(t){let e=[];await r(n.join(l.homedir(),".claude"))&&e.push("claude"),await c(n.join(t,".cursorrules"))&&e.push("cursor"),await c(n.join(t,".github","copilot-instructions.md"))&&e.push("copilot"),await r(n.join(l.homedir(),".gemini"))&&e.push("gemini"),await r(n.join(l.homedir(),".gemini","antigravity"))&&e.push("antigravity"),await r(n.join(t,".opencode"))&&e.push("opencode"),(await r(n.join(t,".pi"))||await r(n.join(l.homedir(),".pi")))&&e.push("pi"),await r(n.join(t,".qwen"))&&e.push("qwen-code"),await r(n.join(t,".goose"))&&e.push("goose"),(await c(n.join(t,".aider.conf.yml"))||await c(n.join(t,".aider.conf.yaml")))&&e.push("aider"),(await r(n.join(t,".cline"))||await r(n.join(t,".clinerules"))||await c(n.join(t,".clinerules")))&&e.push("cline"),await r(n.join(t,".roo"))&&e.push("roo-code"),await r(n.join(t,".continue"))&&e.push("continue"),await r(n.join(t,".kiro"))&&e.push("kiro"),await r(n.join(t,".zed"))&&e.push("zed");try{let{execAsync:a}=await import("./exec-I7XE7NMD.mjs");await a("which codex"),e.push("codex")}catch{await r(n.join(l.homedir(),".codex"))&&e.push("codex")}return e}u(v,"detectInstalledAgents");async function x(t){let e={language:"Unknown",technologies:[]};try{let a=await p.readdir(t);if(a.includes("package.json")){let s=n.join(t,"package.json"),i=JSON.parse(await p.readFile(s,"utf-8")),o={...i.dependencies,...i.devDependencies};e.language=o.typescript?"TypeScript":"JavaScript",o.next?e.framework="Next.js":o.nuxt?e.framework="Nuxt":o.react?e.framework="React":o.vue?e.framework="Vue":o["@angular/core"]?e.framework="Angular":o.express?e.framework="Express":o.hono?e.framework="Hono":o.fastify?e.framework="Fastify":(o.nestjs||o["@nestjs/core"])&&(e.framework="NestJS"),o.bun||o["@types/bun"]||i.engines?.bun?e.runtime="Bun":e.runtime="Node.js",a.includes("bun.lockb")?e.packageManager="Bun":a.includes("pnpm-lock.yaml")?e.packageManager="pnpm":a.includes("yarn.lock")?e.packageManager="Yarn":a.includes("package-lock.json")&&(e.packageManager="npm"),(o.prisma||o["@prisma/client"])&&e.technologies.push("Prisma"),(o.drizzle||o["drizzle-orm"])&&e.technologies.push("Drizzle"),o.tailwindcss&&e.technologies.push("Tailwind CSS"),o.zod&&e.technologies.push("Zod"),(o.trpc||o["@trpc/server"])&&e.technologies.push("tRPC")}else a.includes("pyproject.toml")||a.includes("requirements.txt")?e.language="Python":a.includes("go.mod")?e.language="Go":a.includes("Cargo.toml")?e.language="Rust":(a.includes("pom.xml")||a.includes("build.gradle"))&&(e.language="Java");return e}catch{return e}}u(x,"detectStack");export{k as a,h as b,y as c,v as d,x as e};
|
|
@@ -0,0 +1,8 @@
|
|
|
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{d as p,g as b}from"./chunk-HDHVBB6Q.mjs";import{d as f,n as S}from"./chunk-SVZHJZ5T.mjs";import{a as o}from"./chunk-E66B27AL.mjs";b();S();import a from"node:path";var g="file-inventory",m=/^(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|composer\.lock|Cargo\.lock|poetry\.lock|CHANGELOG(\.md)?|LICENSE(\.md)?|\.DS_Store)$/i,x=/(^|\/)(node_modules|dist|build|\.git|coverage|\.next|target|vendor)(\/|$)/i,y=new Set([".png",".jpg",".jpeg",".gif",".webp",".ico",".woff",".woff2",".ttf",".eot",".mp4",".mp3",".zip",".gz",".tar",".wasm",".exe",".dll",".so",".dylib",".bin",".pdf",".ico"]),v={".ts":"TypeScript",".tsx":"TypeScript",".js":"JavaScript",".jsx":"JavaScript",".mjs":"JavaScript",".cjs":"JavaScript",".vue":"Vue",".svelte":"Svelte",".py":"Python",".go":"Go",".rs":"Rust",".java":"Java",".kt":"Kotlin",".kts":"Kotlin",".swift":"Swift",".rb":"Ruby",".php":"PHP",".cs":"C#",".fs":"F#",".cpp":"C++",".cc":"C++",".c":"C",".h":"C/C++",".hpp":"C++",".m":"Objective-C",".mm":"Objective-C++",".scala":"Scala",".clj":"Clojure",".ex":"Elixir",".exs":"Elixir",".erl":"Erlang",".hs":"Haskell",".lua":"Lua",".r":"R",".dart":"Dart",".sql":"SQL",".graphql":"GraphQL",".gql":"GraphQL",".proto":"Protobuf",".md":"Markdown",".mdx":"MDX",".json":"JSON",".yml":"YAML",".yaml":"YAML",".toml":"TOML",".css":"CSS",".scss":"SCSS",".sass":"Sass",".less":"Less",".html":"HTML",".htm":"HTML",".sh":"Shell",".bash":"Shell",".zsh":"Shell",".ps1":"PowerShell",".swiftui":"Swift"};async function h(e,n={}){let t=(await f(e,{skipDotfiles:!0,maxFiles:n.maxFiles??5e4})).filter(l=>{if(x.test(l))return!1;let u=a.basename(l);if(m.test(u))return!1;let c=a.extname(u).toLowerCase();return!!(c&&c!=="."&&!y.has(c))}),r=t.reduce((l,u)=>{let c=a.extname(a.basename(u)).toLowerCase();return l[c]=(l[c]??0)+1,l},Object.create(null)),i=j(r);return{extensions:r,languages:i,fileCount:t.length,builtAt:new Date().toISOString(),projectHint:a.basename(e)}}o(h,"buildFileInventory");function j(e){let n=new Set,s=Object.entries(e).sort((t,r)=>r[1]-t[1]);for(let[t]of s){let r=v[t];r&&n.add(r)}return[...n]}o(j,"languagesFromExtensions");function C(e,n){p.setDoc(e,g,n)}o(C,"saveFileInventory");function d(e){try{return p.getDoc(e,g)}catch{return null}}o(d,"loadFileInventory");async function L(e,n){let s=await h(n);return C(e,s),s}o(L,"refreshFileInventory");function E(e){let n=d(e);return n?.extensions?new Set(Object.keys(n.extensions).map(s=>s.toLowerCase())):new Set}o(E,"inventoryExtensions");function k(e,n,s={}){let t=n.replace(/^\.\//,"").replace(/\\/g,"/").trim();if(!t||x.test(t))return!1;let r=t.split("/").pop()??t;if(m.test(r))return!1;let i=a.extname(r).toLowerCase();return i?!y.has(i):t.includes("/")}o(k,"pathMatchesInventory");function O(e,n){let s=n.replace(/^\.\//,"").replace(/\\/g,"/").trim(),t=s.split("/").pop()??s,r=a.extname(t).toLowerCase();if(!r)return .7;let i=E(e);return i.size===0||i.has(r)?1:.45}o(O,"inventoryPathWeight");function P(e){if(!e||Object.keys(e.extensions).length===0)return"File inventory: empty \u2014 run `prjct sync` to discover languages/extensions.";let n=Object.entries(e.extensions).sort((t,r)=>r[1]-t[1]).slice(0,12).map(([t,r])=>`${t}\xD7${r}`).join(" "),s=e.languages.length>0?e.languages.join(", "):"unknown";return`File inventory: ${e.fileCount} files \xB7 langs: ${s} \xB7 ${n}`}o(P,"formatInventorySummary");export{g as a,h as b,j as c,C as d,d as e,L as f,E as g,k as h,O as i,P as j};
|
|
@@ -0,0 +1,9 @@
|
|
|
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 n,b as m}from"./chunk-WUHGODSQ.mjs";import{a as o}from"./chunk-E66B27AL.mjs";m();import c from"node:crypto";import t from"node:path";var i="\\\\.\\pipe\\";function p(e=n()){return t.join(e,"run")}o(p,"getDaemonRunDir");function a(e=process.platform,r=n()){if(e==="win32"){let u=c.createHash("sha1").update(t.resolve(r)).digest("hex").slice(0,16);return`${i}prjct-${u}-daemon`}return t.join(p(r),"daemon.sock")}o(a,"getDaemonSocketPath");function N(e=a()){return e.startsWith(i)}o(N,"isDaemonNamedPipe");var s={runDir:o(()=>p(),"runDir"),socket:o(()=>a(),"socket"),pid:o(()=>t.join(s.runDir(),"daemon.pid"),"pid"),log:o(()=>t.join(s.runDir(),"daemon.log"),"log")},O=480*60*1e3,x=1024*1024,_=3e4,f=600*1e3,D=new Set(["ship","sync","dream","update","upgrade","analyze","init","cloud"]),M=800;function E(e){return e==="hook"?M:D.has(e)?f:_}o(E,"commandRequestTimeoutMs");function R(e){return Buffer.from(`${JSON.stringify(e)}
|
|
9
|
+
`)}o(R,"encodeMessage");export{N as a,s as b,E as c,R as d};
|
|
@@ -0,0 +1,8 @@
|
|
|
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}from"./chunk-E66B27AL.mjs";var n={TOOL_CHECK:5e3,GIT_OPERATION:1e4,GIT_CLONE:6e4,API_REQUEST:3e4,NPM_INSTALL:12e4,WORKFLOW_HOOK:6e4};function o(_){let s=`PRJCT_TIMEOUT_${_}`,e=process.env[s];if(e){let T=Number.parseInt(e,10);if(!Number.isNaN(T)&&T>0)return T}return n[_]}t(o,"getTimeout");var E={SPINNER_MSG:45,DONE_MSG:50,FAIL_MSG:65,WARN_MSG:65,STEP_MSG:35,PROGRESS_TEXT:25,ISSUE_TITLE:50,FALLBACK_TRUNCATE:50,CLEAR_WIDTH:80};export{o as a,E as b};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 d}from"./chunk-DAOC3T5G.mjs";import{c as l}from"./chunk-3LG3ACQV.mjs";import{e as a,g as p}from"./chunk-HDHVBB6Q.mjs";import{a as m}from"./chunk-E66B27AL.mjs";p();var E=7,T=90,f=20,A=["pattern-detector","transcript-auto","skill-miss","friction","land-auto","sync-context-quality"];function h(e){return e?A.some(t=>e===t||e.startsWith(`${t}-`)||e.startsWith(t)):!1}m(h,"isAutoSource");function L(e,t=E,o=500){let u=Date.now()-t*864e5;try{let n=a.query(e,`SELECT id FROM memory_entries
|
|
9
|
+
WHERE deleted_at IS NOT NULL AND deleted_at < ?
|
|
10
|
+
ORDER BY deleted_at ASC
|
|
11
|
+
LIMIT ?`,u,o);return n.length===0?0:(a.transaction(e,s=>{let i=s.prepare("DELETE FROM memory_embeddings WHERE memory_id = ?"),r=s.prepare("DELETE FROM memory_entries WHERE id = ?");for(let c of n){try{i.run(c.id)}catch{}r.run(c.id)}}),n.length)}catch{return 0}}m(L,"purgeSoftDeleted");function O(e,t=E,o=500){let u=new Date(Date.now()-t*864e5).toISOString();try{let n=a.query(e,`SELECT e.id FROM events e
|
|
12
|
+
WHERE e.type LIKE 'memory.remember.%'
|
|
13
|
+
AND e.timestamp < ?
|
|
14
|
+
AND NOT EXISTS (
|
|
15
|
+
SELECT 1 FROM memory_entries m
|
|
16
|
+
WHERE m.id = 'mem_' || e.id AND m.deleted_at IS NULL
|
|
17
|
+
)
|
|
18
|
+
ORDER BY e.id ASC
|
|
19
|
+
LIMIT ?`,u,o);return n.length===0?0:(a.transaction(e,s=>{let i=s.prepare("DELETE FROM events WHERE id = ?");for(let r of n)i.run(r.id)}),n.length)}catch{return 0}}m(O,"purgeOrphanRememberEvents");function g(e,t=f){if(t<=0)return 0;let o=[];try{let u=d.allEntriesForIndex(e),n=new Map;for(let s of u){let i=s.tags?.source;if(!h(i))continue;let r=i,c=n.get(r)??[];c.push(s),n.set(r,c)}for(let[,s]of n){if(s.length<=t)continue;s.sort((r,c)=>r.rememberedAt.localeCompare(c.rememberedAt));let i=s.slice(0,s.length-t);for(let r of i){try{l.archive(e,{entityType:"memory_entry",entityId:r.id,entityData:{id:r.id,type:r.type,content:r.content,tags:r.tags,rememberedAt:r.rememberedAt},summary:r.content.slice(0,80),reason:`auto-source-cap (>${t})`})}catch{}d.forget(e,r.id)&&o.push(r)}}}catch{return o.length}return o.length}m(g,"trimAutoSourceCap");function F(e){let t=a.get(e,"SELECT COUNT(*) AS c FROM memory_entries WHERE deleted_at IS NULL")?.c??0,o=a.get(e,"SELECT COUNT(*) AS c FROM memory_entries WHERE deleted_at IS NOT NULL")?.c??0,u=a.get(e,"SELECT COUNT(*) AS c FROM archives")?.c??0,n=a.get(e,"SELECT COUNT(*) AS c FROM events WHERE type LIKE 'memory.remember.%'")?.c??0,s=(()=>{try{return d.allEntriesForIndex(e).filter(i=>h(i.tags?.source)).length}catch{return 0}})();return{live:t,softDeleted:o,archives:u,rememberEvents:n,autoSourceLive:s}}m(F,"vaultHealth");async function N(e,t={}){let o=t.softDeletedPurgeDays??E,u=t.archivePruneDays??T,n=t.autoSourceMaxLive??f;if(t.dryRun===!0)return{softDeletedPurged:0,orphanEventsPurged:0,archivesPruned:0,autoSourceTrimmed:0,distilledDiscarded:0,digestsWritten:0};let i=await(async()=>{if(t.projectPath)try{let{distillAndDiscardAllAutoSources:_}=await import("./distill-R477XZE3.mjs"),y=await _(t.projectPath,e,n);return{distilledDiscarded:y.discarded,digestsWritten:y.digests}}catch{return g(e,n),{distilledDiscarded:0,digestsWritten:0}}else return g(e,n),{distilledDiscarded:0,digestsWritten:0}})(),{distilledDiscarded:r,digestsWritten:c}=i,{eliminateSoftDeletedNoValue:D}=await import("./distill-R477XZE3.mjs"),b=D(e,o).purged||L(e,o),S=O(e,o),R=(()=>{try{return l.pruneOldArchives(e,u)}catch{return 0}})();return{softDeletedPurged:b,orphanEventsPurged:S,archivesPruned:R,autoSourceTrimmed:r,distilledDiscarded:r,digestsWritten:c}}m(N,"runVaultPurge");export{E as a,T as b,f as c,A as d,h as e,L as f,O as g,g as h,F as i,N as j};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 p}from"./chunk-3FBCOCPD.mjs";import{c as h}from"./chunk-YUOTOCKK.mjs";import{a as d}from"./chunk-E66B27AL.mjs";var k={memories:"memories",tasks:"tasks",subtasks:"subtasks",ideas:"ideas",queue_tasks:"queue_tasks",custom_workflows:"custom_workflows",workflow_rules:"workflow_rules",archives:"archives",shipped_items:"shipped_items",shipped_features:"shipped_features",metrics_daily:"metrics_daily",work_cost_snapshots:"work_cost_snapshots",velocity_sprints:"velocity_sprints",analysis:"analysis",specs:"specs",memory:"memories",memory_entry:"memories",task:"tasks",paused_task:"tasks",subtask:"subtasks",idea:"ideas",queue:"queue_tasks",queue_task:"queue_tasks",shipped:"shipped_items",feature:"roadmap_features",workflow:"custom_workflows",workflow_rule:"workflow_rules",metric:"metrics_daily",work_cost_snapshot:"work_cost_snapshots",velocity:"velocity_sprints",spec:"specs",project:"projects",session:"sessions",agent:"agents"};function y(c){if(c)return k[c]}d(y,"toCloudTable");var w={memories:"memories",tasks:"tasks",subtasks:"tasks",queue_tasks:"tasks",ideas:"ideas",shipped_items:"shipped",shipped_features:"shipped",custom_workflows:"workflows",workflow_rules:"workflows",metrics_daily:"metrics",work_cost_snapshots:"metrics",velocity_sprints:"metrics",archives:"archives",analysis:"analysis",specs:"specs"},f={memories:!0,tasks:!0,ideas:!0,shipped:!0,workflows:!0,metrics:!0,archives:!0,user_prompts:!1,agent_sessions:!1,analysis:!0,specs:!0};function T(c,e){let t=w[c];return t?{...f,...e??{}}[t]!==!1:!0}d(T,"isTableIncluded");var v=Object.keys(f);function _(c){return c.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}d(_,"camelToSnake");function E(c){let e={};for(let[t,s]of Object.entries(c))e[_(t)]=s;return e}d(E,"snakeCaseKeys");function R(c,e){let[t,s]=e.type.split("."),r=y(e.entityType)??y(t);if(!r)return null;let i=e.eventType==="delete"||s==="deleted"||s==="archived"||s==="removed"?"delete":"upsert",n=e.data||{},a=E(n),u=e.entityId||(typeof a.id=="string"?a.id:"")||(typeof n.id=="string"?n.id:"")||(typeof a.task_id=="string"?a.task_id:"")||(typeof n.taskId=="string"?n.taskId:"")||(typeof a.entity_id=="string"?a.entity_id:"")||"";u&&a.id==null&&(a.id=u);let l={event_type:i,entity_type:r,entity_id:u,data:{...a,project_id:c},project_id:c};return e.originDeviceId!==void 0&&(l.origin_device_id=e.originDeviceId),e.contentHash!==void 0&&(l.content_hash=e.contentHash),e.revisionCount!==void 0&&(l.revision_count=e.revisionCount),e.timestamp&&(l.ts=e.timestamp),l}d(R,"mapCliEventToWebFormat");function g(c,e){return e.map(t=>R(c,t)).filter(t=>t!==null)}d(g,"mapCliEventsToWebFormat");var m=class{static{d(this,"SyncClient")}retryConfig={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4};async pushEvents(e,t){let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)throw this.createError("AUTH_REQUIRED","No API key configured");let i=g(e,t),n=await this.fetchWithRetry(`${s}/sync/batch`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify({projectId:e,events:i})});if(!n.ok)throw await this.parseErrorResponse(n);return await n.json()}async pullEvents(e,t,s){let{apiUrl:r,apiKey:o,deviceId:i}=await this.getAuthHeaders();if(!o)throw this.createError("AUTH_REQUIRED","No API key configured");let n={projectId:e};typeof t=="number"&&t>0&&(n.sinceEventId=t);let a=await this.fetchWithRetry(`${r}/sync/pull`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(o,i)},body:JSON.stringify(n)});if(!a.ok)throw await this.parseErrorResponse(a);return await a.json()}async getStatus(e){let{apiUrl:t,apiKey:s,deviceId:r}=await this.getAuthHeaders();if(!s)throw this.createError("AUTH_REQUIRED","No API key configured");let o=await this.fetchWithRetry(`${t}/sync/status/${e}`,{method:"GET",headers:{...this.authHeaders(s,r)}});if(!o.ok)throw await this.parseErrorResponse(o);return await o.json()}async linkProject(e,t,s){let{apiUrl:r,apiKey:o,deviceId:i}=await this.getAuthHeaders();if(!o)throw this.createError("AUTH_REQUIRED","No API key configured");let n=await this.fetchWithRetry(`${r}/sync/link`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(o,i)},body:JSON.stringify({projectId:e,...t?{name:t}:{},...s?{meta:s}:{}})});if(!n.ok)throw await this.parseErrorResponse(n);return await n.json()}async setCloudLifecycle(e,t){try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();return r?(await this.fetchWithRetry(`${s}/sync/projects/${e}/${t}`,{method:"POST",headers:{...this.authHeaders(r,o)}})).ok:!1}catch{return!1}}async uploadCodeGraph(e,t){try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)return{ok:!1,reason:"unauthenticated"};let i=await this.fetchWithRetry(`${s}/sync/projects/${e}/code-graph`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify(t)});if(!i.ok)return{ok:!1,reason:await(async()=>{let u=`${i.status} ${i.statusText}`;try{let l=await i.json();return typeof l.detail=="string"?l.detail:l.detail!=null?JSON.stringify(l.detail).slice(0,300):u}catch{return u}})()};let n=await i.json();return{ok:n.ok!==!1,nodes:n.nodes,links:n.links}}catch(s){return{ok:!1,reason:s instanceof Error?s.message:String(s)}}}async publishBenchmark(e,t){let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)throw this.createError("AUTH_REQUIRED","No API key configured");let i=await this.fetchWithRetry(`${s}/benchmarks/evals`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders(r,o)},body:JSON.stringify({projectId:e,...t})});if(!i.ok)throw await this.parseErrorResponse(i);return await i.json()}async testConnection(){let e=new AbortController,t=setTimeout(()=>e.abort(),p("API_REQUEST"));try{let{apiUrl:s,apiKey:r,deviceId:o}=await this.getAuthHeaders();if(!r)return clearTimeout(t),!1;let i=await fetch(`${s}/auth/verify`,{method:"GET",headers:{...this.authHeaders(r,o)},signal:e.signal});return clearTimeout(t),i.status===401||i.status===403?(await h.clearAuth(),!1):i.ok}catch{return clearTimeout(t),!1}}async hasAuth(){return await h.hasAuth()}async getAuthHeaders(){let[e,t,s]=await Promise.all([h.getApiUrl(),h.getApiKey(),h.getDeviceId()]);return{apiUrl:e,apiKey:t,deviceId:s}}authHeaders(e,t){return{"X-Api-Key":e,"X-Device-Id":t}}async fetchWithRetry(e,t,s=0){let r=new AbortController,o=setTimeout(()=>r.abort(),p("API_REQUEST")),i=(t.method??"GET").toUpperCase(),n=i==="GET"||i==="HEAD";try{let a=await fetch(e,{...t,signal:r.signal});if(clearTimeout(o),n&&a.status>=500&&s<this.retryConfig.maxRetries){let u=Math.min(this.retryConfig.baseDelayMs*2**s,this.retryConfig.maxDelayMs);return await this.sleep(u),this.fetchWithRetry(e,t,s+1)}return a}catch(a){if(clearTimeout(o),a instanceof Error&&a.name==="AbortError")throw this.createError("NETWORK_ERROR",`Request timed out. Try increasing PRJCT_TIMEOUT_API_REQUEST (current: ${p("API_REQUEST")}ms)`);if(n&&s<this.retryConfig.maxRetries){let u=Math.min(this.retryConfig.baseDelayMs*2**s,this.retryConfig.maxDelayMs);return await this.sleep(u),this.fetchWithRetry(e,t,s+1)}throw this.createError("NETWORK_ERROR",a instanceof Error?a.message:"Network request failed")}}async parseErrorResponse(e){try{let t=await e.json(),s=t.detail||t.message||t.error||`HTTP ${e.status}`;return e.status===401||e.status===403?(await h.clearAuth(),this.createError("AUTH_REQUIRED",s,e.status)):e.status===402?this.createError("PAYMENT_REQUIRED",s,e.status):this.createError("API_ERROR",s,e.status)}catch{return e.status===401||e.status===403?(await h.clearAuth(),this.createError("AUTH_REQUIRED",`HTTP ${e.status}`,e.status)):this.createError("API_ERROR",`HTTP ${e.status}`,e.status)}}createError(e,t,s){return{code:e,message:t,status:s}}sleep(e){return new Promise(t=>setTimeout(t,e))}},b=new m,j=b;export{y as a,T as b,b as c,j as d};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 u}from"./chunk-AOPJ4Z6O.mjs";import{d as i,g as T}from"./chunk-HDHVBB6Q.mjs";import{b as y,e as _}from"./chunk-AKIN5WSQ.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import g from"node:crypto";function E(){return g.randomUUID()}o(E,"generateUUID");_();T();function v(d,t,e){return{id:d,entity_type:t.entityType,entity_id:t.entityId,entity_data:JSON.stringify(t.entityData),summary:t.summary??null,reason:t.reason,archived_at:e,created_at:e}}o(v,"archiveSyncPayload");var l={SHIPPED_RETENTION_DAYS:90,IDEA_DORMANT_DAYS:180,QUEUE_COMPLETED_DAYS:7,PAUSED_TASK_DAYS:30,MEMORY_MAX_ENTRIES:500},h=class{static{o(this,"ArchiveStorage")}archive(t,e){let r=E(),n=y();return i.run(t,"INSERT INTO archives (id, entity_type, entity_id, entity_data, summary, archived_at, reason) VALUES (?, ?, ?, ?, ?, ?, ?)",r,e.entityType,e.entityId,JSON.stringify(e.entityData),e.summary??null,n,e.reason),u({projectId:t,entityType:"archives",entityId:r,eventType:"upsert",data:v(r,e,n)}),r}archiveMany(t,e){if(e.length===0)return 0;let r=y(),n=[];i.transaction(t,a=>{let c=a.prepare("INSERT INTO archives (id, entity_type, entity_id, entity_data, summary, archived_at, reason) VALUES (?, ?, ?, ?, ?, ?, ?)");for(let s of e){let p=E();c.run(p,s.entityType,s.entityId,JSON.stringify(s.entityData),s.summary??null,r,s.reason),n.push({id:p,item:s})}});for(let{id:a,item:c}of n)u({projectId:t,entityType:"archives",entityId:a,eventType:"upsert",data:v(a,c,r)});return e.length}getArchived(t,e,r=50){return e?i.query(t,"SELECT * FROM archives WHERE entity_type = ? ORDER BY archived_at DESC LIMIT ?",e,r):i.query(t,"SELECT * FROM archives ORDER BY archived_at DESC LIMIT ?",r)}getStats(t){let e=i.query(t,"SELECT entity_type, COUNT(*) as count FROM archives GROUP BY entity_type"),r={shipped:0,idea:0,queue_task:0,paused_task:0,memory_entry:0,total:0};for(let n of e){let a=n.entity_type;a in r&&(r[a]=n.count),r.total+=n.count}return r}restore(t,e){let r=i.get(t,"SELECT * FROM archives WHERE id = ?",e);return r?(i.run(t,"DELETE FROM archives WHERE id = ?",e),JSON.parse(r.entity_data)):null}pruneOldArchives(t,e){let r=new Date(Date.now()-e*24*60*60*1e3).toISOString(),n=this.getTotalCount(t);i.run(t,"DELETE FROM archives WHERE archived_at < ?",r);let a=this.getTotalCount(t);return n-a}getTotalCount(t){return i.get(t,"SELECT COUNT(*) as count FROM archives")?.count??0}},I=new h;export{E as a,l as b,I as c};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 d,g as r}from"./chunk-HDHVBB6Q.mjs";import{a as o}from"./chunk-E66B27AL.mjs";r();function t(e,s=500){let n=e?.replace(/\s+/g," ").trim();return n?n.length<=s?n:`${n.slice(0,s-3)}...`:null}o(t,"cleanText");function i(e){let s=[];return e.agent&&s.push(`agent=${e.agent}`),(e.tokensIn??0)+(e.tokensOut??0)>0&&(s.push(`tokens_in=${Math.round(e.tokensIn??0)}`),s.push(`tokens_out=${Math.round(e.tokensOut??0)}`)),e.filesTouched&&e.filesTouched.length>0&&s.push(`files_touched=${e.filesTouched.length}`),s.length===0?null:s.join(" ")}o(i,"summary");function a(e){if(!e.sessionId)return;let s=new Date().toISOString();try{d.run(e.projectId,`INSERT INTO agent_sessions
|
|
9
|
+
(id, project_id, directory, task_id, goal, started_at, created_at)
|
|
10
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
11
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
12
|
+
directory = COALESCE(excluded.directory, agent_sessions.directory),
|
|
13
|
+
task_id = COALESCE(excluded.task_id, agent_sessions.task_id),
|
|
14
|
+
goal = COALESCE(excluded.goal, agent_sessions.goal)`,e.sessionId,e.projectId,t(e.directory),t(e.taskId),t(e.goal),s,s)}catch{}}o(a,"recordAgentSessionStart");function c(e){if(!e.sessionId)return;let s=new Date().toISOString(),n=e.filesTouched&&e.filesTouched.length>0?JSON.stringify(e.filesTouched.slice(0,100)):null;try{d.run(e.projectId,`INSERT INTO agent_sessions
|
|
15
|
+
(id, project_id, directory, task_id, goal, started_at, ended_at, summary, files_touched, runtime, model, created_at)
|
|
16
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
17
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
18
|
+
directory = COALESCE(excluded.directory, agent_sessions.directory),
|
|
19
|
+
task_id = COALESCE(excluded.task_id, agent_sessions.task_id),
|
|
20
|
+
goal = COALESCE(excluded.goal, agent_sessions.goal),
|
|
21
|
+
ended_at = excluded.ended_at,
|
|
22
|
+
summary = COALESCE(excluded.summary, agent_sessions.summary),
|
|
23
|
+
files_touched = COALESCE(excluded.files_touched, agent_sessions.files_touched),
|
|
24
|
+
runtime = excluded.runtime,
|
|
25
|
+
model = CASE WHEN excluded.model = 'unknown' THEN agent_sessions.model ELSE excluded.model END`,e.sessionId,e.projectId,t(e.directory),t(e.taskId),t(e.goal),s,s,i(e),n,t(e.agent,32)??"unknown",t(e.model,120)??"unknown",s)}catch{}}o(c,"recordAgentSessionEnd");export{a,c as b};
|