prjct-cli 3.88.0 → 3.91.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 +15 -0
- package/dist/bin/hook-chunks/agent-identity-45BYQBU2.mjs +8 -0
- package/dist/bin/hook-chunks/agent-switch-IQ5KSRKD.mjs +22 -0
- package/dist/bin/hook-chunks/analysis-LBYZSJKT.mjs +42 -0
- package/dist/bin/hook-chunks/auth-config-WNUARXTJ.mjs +8 -0
- package/dist/bin/hook-chunks/auto-flush-GW3FP763.mjs +8 -0
- package/dist/bin/hook-chunks/auto-updater-EHRRMCYY.mjs +9 -0
- package/dist/bin/hook-chunks/capture-gate-BQCNMHUC.mjs +8 -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-3JUE6MNF.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-3LG3ACQV.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-3WKDMAS7.mjs +16 -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-5TBQNW2G.mjs +17 -0
- package/dist/bin/hook-chunks/chunk-5WAONIPX.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-6AFM6WRB.mjs +13 -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-A5MUSARI.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-A5RNWWTH.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-AEYONUUY.mjs +31 -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-B7GMU46T.mjs +71 -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-D4S3IRD3.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-D6KT763C.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-D7TRY3CO.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-DGQYQSUK.mjs +19 -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-EHBEHLYN.mjs +15 -0
- package/dist/bin/hook-chunks/chunk-EM6ZDJAK.mjs +45 -0
- package/dist/bin/hook-chunks/chunk-FEH4IPIC.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-GVNMXVVA.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-HBLR7BVG.mjs +11 -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-HJ4HEI45.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-HZIORCPO.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-IKUGYUAI.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-KEJ5RMAI.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +13 -0
- package/dist/bin/hook-chunks/chunk-LGJUQEAU.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-LJLUP4FF.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-LLQUB6YR.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-LPB3HUJ2.mjs +19 -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-M3ZOJVPA.mjs +13 -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-NWY5M34K.mjs +12 -0
- package/dist/bin/hook-chunks/chunk-ODWWIFSN.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-OIEZAHLC.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-PKDYFXMI.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-PSP56GGF.mjs +13 -0
- package/dist/bin/hook-chunks/chunk-PSSR7LSW.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-PXJKXBTM.mjs +53 -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-QZSJSXJV.mjs +10 -0
- package/dist/bin/hook-chunks/chunk-RAHFKGM6.mjs +19 -0
- package/dist/bin/hook-chunks/chunk-RJ2BRRMH.mjs +38 -0
- package/dist/bin/hook-chunks/chunk-RRWPDRYR.mjs +43 -0
- package/dist/bin/hook-chunks/chunk-SJ75V4WG.mjs +9 -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-TFGJVT6F.mjs +8 -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-UHW35BPE.mjs +18 -0
- package/dist/bin/hook-chunks/chunk-UQVJQME2.mjs +8 -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-W5OWBOLH.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-XEFIIDHM.mjs +11 -0
- package/dist/bin/hook-chunks/chunk-Y5NQV46G.mjs +9 -0
- package/dist/bin/hook-chunks/chunk-YG7KBQYJ.mjs +16 -0
- package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +8 -0
- package/dist/bin/hook-chunks/chunk-YKMJI6TF.mjs +14 -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-7IURPY6B.mjs +8 -0
- package/dist/bin/hook-chunks/command-installer-BVHQUSL4.mjs +8 -0
- package/dist/bin/hook-chunks/config-manager-KYC7WUOS.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-56X7BNS6.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-6C6YIFOE.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-6ZZNKAJZ.mjs +8 -0
- package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +8 -0
- package/dist/bin/hook-chunks/format-YOYMJSLY.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-2U7D6HS4.mjs +8 -0
- package/dist/bin/hook-chunks/land-cue-SS23JBAX.mjs +9 -0
- package/dist/bin/hook-chunks/land-synthesis-OATL5BNP.mjs +8 -0
- package/dist/bin/hook-chunks/legacy-crew-sweep-NH5EWEXF.mjs +24 -0
- package/dist/bin/hook-chunks/memory-index-677MUBCZ.mjs +10 -0
- package/dist/bin/hook-chunks/notification-S2IJJ6JW.mjs +8 -0
- package/dist/bin/hook-chunks/nyquist-lite-GE7OAFLC.mjs +10 -0
- package/dist/bin/hook-chunks/pack-integrity-L3BL7CGO.mjs +10 -0
- package/dist/bin/hook-chunks/pack-manager-SU53HCKK.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-ZYFCFU7N.mjs +9 -0
- package/dist/bin/hook-chunks/post-edit-JD7YFEBZ.mjs +8 -0
- package/dist/bin/hook-chunks/pr-convention-7UGI7TFA.mjs +8 -0
- package/dist/bin/hook-chunks/pre-bash-VIABNO5E.mjs +11 -0
- package/dist/bin/hook-chunks/pre-commit-NVQVXHZQ.mjs +8 -0
- package/dist/bin/hook-chunks/pre-edit-V4RD45C4.mjs +11 -0
- package/dist/bin/hook-chunks/pre-package-KFJZXI5T.mjs +8 -0
- package/dist/bin/hook-chunks/pre-search-7KRU5D2O.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-FMCPUMQT.mjs +8 -0
- package/dist/bin/hook-chunks/project-agent-surfaces-TD7BHI25.mjs +8 -0
- package/dist/bin/hook-chunks/project-file-inventory-ZAPKPKY6.mjs +8 -0
- package/dist/bin/hook-chunks/project-memory-ZVZSLPB5.mjs +8 -0
- package/dist/bin/hook-chunks/project-style-evolution-7JS75AUP.mjs +8 -0
- package/dist/bin/hook-chunks/prompt-S4MMIXH5.mjs +22 -0
- package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +8 -0
- package/dist/bin/hook-chunks/purge-BDREPWEE.mjs +8 -0
- package/dist/bin/hook-chunks/retention-D2MVQLOF.mjs +8 -0
- package/dist/bin/hook-chunks/sdd-ZO4DP23G.mjs +10 -0
- package/dist/bin/hook-chunks/session-continuity-FNNUMOXB.mjs +11 -0
- package/dist/bin/hook-chunks/session-start-HA7IRBFX.mjs +8 -0
- package/dist/bin/hook-chunks/settings-installer-QDM3GB6J.mjs +9 -0
- package/dist/bin/hook-chunks/setup-7L3NXNRH.mjs +142 -0
- package/dist/bin/hook-chunks/shipping-GX4HFYJ3.mjs +13 -0
- package/dist/bin/hook-chunks/skill-index-OOVAXHYJ.mjs +12 -0
- package/dist/bin/hook-chunks/spec-context-inference-KER2R3F3.mjs +15 -0
- package/dist/bin/hook-chunks/spec-service-G3RLCJ2G.mjs +11 -0
- package/dist/bin/hook-chunks/spec-task-breakdown-YPJ76OWR.mjs +8 -0
- package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +8 -0
- package/dist/bin/hook-chunks/stop-HPZCLDPM.mjs +17 -0
- package/dist/bin/hook-chunks/subagent-start-7KZUTKV5.mjs +8 -0
- package/dist/bin/hook-chunks/subagent-stop-7C72RWGO.mjs +8 -0
- package/dist/bin/hook-chunks/surface-attribution-PDYR6DVA.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-RRFG5P7N.mjs +8 -0
- package/dist/bin/hook-chunks/tdd-XQUU4C23.mjs +10 -0
- package/dist/bin/hook-chunks/template-loader-4QMIMOBY.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-M6D23IIM.mjs +8 -0
- package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +49 -0
- package/dist/bin/hook-chunks/work-scope-6FG6PSAV.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-darwin-arm64 +0 -0
- package/dist/bin/hook-fast-darwin-x64 +0 -0
- package/dist/bin/hook-fast-linux-x64 +0 -0
- package/dist/bin/prjct-core.mjs +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
|
@@ -0,0 +1,10 @@
|
|
|
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 o}from"./chunk-E66B27AL.mjs";var k=/^(current work|wip|todo|misc|n\/a|none|latest|unreleased|changelog|ok|yes|no|test|asdf|xxx|foo|bar|baz|null|undefined)$/i,w=/^(todo_write|todo_read|judgment status|judgment next|mem get|memory get|spec_get|analysis-get|prjct (work|ship|sync|land|prime|status|help)|p\.\s*\w+)$/i,y=/^(mem[_-]?\d+|mem get mem[_-]?\d+)$/i,R=new Set(["inbox","todo","idea","question"]);function _(r,e){let t=r.trim().replace(/\s+/g," ");if(t.length===0)return{junk:!0,reason:"empty content"};if(k.test(t))return{junk:!0,reason:"noise phrase"};if(w.test(t))return{junk:!0,reason:"tool/command dump"};if(y.test(t))return{junk:!0,reason:"bare mem id dump"};let n=!e||R.has(e);if(n&&t.length<=12)return{junk:!0,reason:"too short (\u226412 chars)"};if(!/[\s.:;,—–\-/?!]/.test(t)&&t.length<40){if(t.includes("_")&&/^[a-z][a-z0-9_]*$/i.test(t))return{junk:!0,reason:"single-token dump / tool name"};if(n&&/^[a-z][a-z0-9_]*$/i.test(t)&&t.length<=24)return{junk:!0,reason:"single-token dump / tool name"}}if(n){let a=t.split(" ");if(a.length<=3&&t.length<=32&&/^[a-z0-9_ -]+$/i.test(t)){let s=a[0]?.toLowerCase()??"";if(["todo","judgment","insights","workflow","spec","analysis","harness","memory","prjct"].includes(s))return{junk:!0,reason:"short command-like dump"}}}return{junk:!1,reason:"ok"}}o(_,"isJunkCaptureContent");var C=new Set(["inbox","todo","idea","question"]),g=/^(?:get\s+)?[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$|^[0-9a-f]{16,64}$|^[a-z]*[_-]?[0-9a-f]{8,}$/i,d=/\b(add|build|create|fix|implement|migrate|refactor|remove|replace|ship|support|enable|disable|update|upgrade|design|audit|verify|ensure|prevent|allow|block|wire|integrate|document|test|measure|reduce|increase|hacer|agregar|crear|arreglar|implementar|migrar|eliminar|actualizar|soportar|permitir|bloquear|integrar|documentar|verificar|evitar)\b/i,c=/\b(was|were|wasn't|weren't|had been|used to|era|eran|fue|fueron|estaba|estaban|fixed|fix:|resolved|root cause|because|caused|broke|broken|failed|failure|don't|do not|never|always|must not|must never|sin\s+eso|no era|no fue|no es rls|wasn't|instead|rather than|anti-pattern|gotcha:|trap:)\b/i,x=/^(reviso|revisando|voy a|estoy|vamos a|i('ll| will)|i am |i'm |checking|looking at|let me |need to |tengo que |hay que |todo:|wip:)/i,E=/\b(no era necesario|no era necesaria|no fue necesario|wasn't hard|was not hard|wasn't easy|was not easy|wasn't difficult|no fue difícil|wasn't necessary|was not necessary)\b/i,S=/\b(no era rls|no fue rls|no es rls|not the cause|red herring|false lead|not an? rls\b|not a(?:n)? rls\b|is not (?:an? )?rls(?:\s+bug)?|was not (?:an? )?rls(?:\s+bug)?|this is not (?:an? )?(?:rls|auth)|is not the bottleneck|not the bottleneck)\b/i,j=/\b(?:no era|no fue)\s+(?!necesario|necesaria|difícil|facil|fácil)([a-z][\w-]{1,40})\b/i,v=/\b(?:wasn't|was not|weren't|were not)\s+(?!hard|easy|difficult|necessary|needed)((?:an?\s+)?[a-z][\w-]{1,40})\b/i,T=/\b(causa real|root cause|fix:|real cause|was correct|were correct|estaban (?:perfectas|correctas|bien)|already (?:wraps|wrapped)|declare|volatile|instead|en realidad|coincidencia|misleading|actually|policies (?:were|estaban)|can_access_company)\b/i;function m(r){return r.trim().replace(/\s+/g," ").toLowerCase()}o(m,"normalize");function h(r){return r.replace(/^goal:\s*/i,"").trim()}o(h,"stripGoalPrefix");function p(r){let e=r.trim().match(/^([\s\S]*?)\n\nGoal:\s*([\s\S]+)$/i);return e?{title:e[1].trim(),goal:e[2].trim()}:null}o(p,"parseSpecMirrorContent");function u(r,e){let t=m(r),n=m(h(e));return!!(!t||!n||t===n||t.replace(/^get\s+/i,"")===n.replace(/^get\s+/i,"")&&g.test(n.replace(/^get\s+/i,"")))}o(u,"isEmptySpecMirror");function l(r){let e=m(h(r));if(!e||g.test(e))return!0;if(/^(get|show|open|fetch|load|ver|obtener)\s+\S+$/i.test(e)&&!d.test(e)){let t=e.replace(/^(get|show|open|fetch|load|ver|obtener)\s+/i,"");if(g.test(t)||/^[a-z0-9_-]{8,}$/i.test(t))return!0}return!1}o(l,"isBareIdBody");function $(r){let e=r.trim();if(!e)return!0;let t=e.replace(/\s+/g," ");return!!(/:\s*$/.test(t)&&!c.test(t)||x.test(t)&&!c.test(t)||!c.test(t)&&t.length<80&&/^(reviso|checking|looking)\b/i.test(t))}o($,"isOpenGotchaNarration");function N(r){let e=r.trim().replace(/\s+/g," ");return!e||E.test(e)||/\bno es\s+[\w-]+-related\b/i.test(e)&&!/\b(causa real|root cause|fix:|was correct|were correct|policies)\b/i.test(e)||!(S.test(e)||j.test(e)||v.test(e)&&!/\bwasn't hard\b/i.test(e))?!1:/\b(no era rls|no fue rls|not the cause|red herring|false lead|not an? rls\b|is not (?:an? )?rls(?:\s+bug)?|this is not (?:an? )?rls)\b/i.test(e)?!0:T.test(e)||c.test(e)}o(N,"looksLikeRedHerring");function O(r){let e=r.trim().replace(/\s+/g," ");if(e.length<12)return!0;let t=e.split(" ").filter(s=>s.length>1);if(t.length<2)return!0;let n=new Set(["the","a","an","to","for","and","or","of","in","on","it","this","that","el","la","de","en","y","o","un","una","por","para"]);return t.filter(s=>!n.has(s.toLowerCase())).length<2}o(O,"lacksInboxSubstance");function P(r,e,t={}){let n=(r??"").trim();if(!n)return{action:"refuse",reasonCode:"empty_content",reason:"empty content"};if(t.force)return{action:"accept",reasonCode:"forced",reason:"force override"};let a=_(n,e);if(a.junk)return{action:"refuse",reasonCode:"junk",reason:`junk capture: ${a.reason}`};if(e==="spec"){let s=t.title??p(n)?.title??"",f=t.goal??p(n)?.goal??n;if(s&&f&&u(s,f))return{action:"refuse",reasonCode:"empty_spec_mirror",reason:"empty spec: goal identical to title (lookup, not a goal)"};let i=p(n);if(i&&u(i.title,i.goal))return{action:"refuse",reasonCode:"empty_spec_mirror",reason:"empty spec: goal identical to title (lookup, not a goal)"};let b=i?.goal??f??n;if(l(b)&&!d.test(b))return{action:"refuse",reasonCode:"bare_id_body",reason:"empty spec: body is an id/lookup without an action verb"}}if(t.title!==void 0&&t.goal,e==="gotcha"){if($(n))return{action:"demote",reasonCode:"gotcha_open_narration",reason:"open narration is not a gotcha \u2014 demote to context",demoteTo:"context"};if(N(n))return{action:"demote",reasonCode:"gotcha_is_red_herring",reason:"negative knowledge (not-the-cause) \u2014 store as red-herring",demoteTo:"red-herring"}}return e&&C.has(e)&&O(n)?{action:"refuse",reasonCode:"inbox_no_substance",reason:"sub-substance low-stakes capture \u2014 keep out of brief"}:{action:"accept",reasonCode:"ok",reason:"ok"}}o(P,"classifyCapturePrecision");function D(r,e){let t=r.trim(),n=e.trim();return!t||!n?{action:"refuse",reasonCode:"empty_content",reason:"empty title or goal"}:l(n)&&!d.test(n)?{action:"refuse",reasonCode:"bare_id_body",reason:"empty spec: goal is an id/lookup without an action verb"}:u(t,n)&&l(t)?{action:"refuse",reasonCode:"empty_spec_mirror",reason:"empty spec: goal identical to title (lookup, not a goal)"}:{action:"accept",reasonCode:"ok",reason:"ok"}}o(D,"classifySpecCreate");function H(r,e){return u(r,e)||l(e)&&!d.test(e)?!1:P(`${r}
|
|
9
|
+
|
|
10
|
+
Goal: ${e}`,"spec",{title:r,goal:e}).action==="accept"}o(H,"shouldMirrorSpecToMemory");function G(r){return r&&r.replace(/^Context synthesis:\s*/i,"").replace(/(\s*[·|]\s*)Context synthesis:\s*/gi,"$1").replace(/^\s*[·|]\s*/,"").trim()}o(G,"stripPipelineLabelsForHuman");export{_ as a,p as b,u as c,l as d,$ as e,N as f,O as g,P as h,D as i,H as j,G as k};
|
|
@@ -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 r}from"./chunk-E66B27AL.mjs";var n={error:0,warn:1,info:2,debug:3},u=new Set(["1","true","*"]);function a(){let e=process.env.PRJCT_DEBUG||process.env.DEBUG||"";if(!e)return{level:-1,name:"disabled"};if(u.has(e)||e.includes("prjct"))return{level:n.debug,name:"debug"};let o=n[e]??-1,t=o>=0?e:"disabled";return{level:o,name:t}}r(a,"getLogLevel");var{level:g,name:s}=a(),L=r(()=>{},"noop");function l(e,o,t){return g>=e?(...c)=>console[t](o,...c):L}r(l,"createLogMethod");var v={error:l(n.error,"[prjct:error]","error"),warn:l(n.warn,"[prjct:warn]","warn"),info:l(n.info,"[prjct:info]","log"),debug:l(n.debug,"[prjct:debug]","log"),isEnabled:r(()=>g>=0,"isEnabled"),level:r(()=>s,"level")},d=v;export{d as a};
|
|
@@ -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
|
+
var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var k=(a,b)=>f(a,"name",{value:b,configurable:!0}),l=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var m=(a,b,c)=>()=>{if(c)throw c[0];try{return a&&(b=a(a=0)),b}catch(d){throw c=[d],d}};var n=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0})},j=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of h(b))!i.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=g(b,e))||d.enumerable});return a};var o=a=>j(f({},"__esModule",{value:!0}),a);export{k as a,l as b,m as c,n as d,o as e};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{a as y,b as N}from"./chunk-KEJ5RMAI.mjs";import{b as u}from"./chunk-W5OWBOLH.mjs";import{f as d,h as l,j as m,n as j}from"./chunk-SVZHJZ5T.mjs";import{b as f,c as g,d as p,e as k}from"./chunk-SYHDEUVU.mjs";import{a}from"./chunk-E66B27AL.mjs";j();import c from"node:path";var P=[{scriptName:"typecheck",kind:"typecheck"},{scriptName:"lint",kind:"lint"},{scriptName:"test",kind:"test"},{scriptName:"build",kind:"build"},{scriptName:"dev",kind:"dev"},{scriptName:"format",kind:"format"}],A=[{file:"bun.lock",manager:"bun"},{file:"bun.lockb",manager:"bun"},{file:"pnpm-lock.yaml",manager:"pnpm"},{file:"yarn.lock",manager:"yarn"},{file:"package-lock.json",manager:"npm"}];async function R(t){for(let{file:n,manager:e}of A)if(await m(c.join(t,n)))return e;return null}a(R,"detectPackageManager");async function w(t){let n=c.join(t,"package.json");if(!await m(n))return[];let r=(await d(n,null))?.scripts??{};return P.filter(({scriptName:i})=>!!r[i]).map(({scriptName:i,kind:o})=>{let s=r[i];return{scriptName:i,command:s,kind:o,mutating:S(s)}})}a(w,"detectNodeCommands");async function M(t){return await m(c.join(t,"Cargo.toml"))?[{scriptName:"test",command:"cargo test",kind:"test",mutating:!1},{scriptName:"build",command:"cargo build",kind:"build",mutating:!1},{scriptName:"lint",command:"cargo clippy",kind:"lint",mutating:!1},{scriptName:"format",command:"cargo fmt",kind:"format",mutating:!0}]:[]}a(M,"detectCargoCommands");async function _(t){return await m(c.join(t,"go.mod"))?[{scriptName:"test",command:"go test ./...",kind:"test",mutating:!1},{scriptName:"build",command:"go build ./...",kind:"build",mutating:!1},{scriptName:"format",command:"gofmt -l .",kind:"format",mutating:!1}]:[]}a(_,"detectGoCommands");var h=[{marker:/\[tool\.pytest\b/,scriptName:"test",command:"pytest",kind:"test",mutating:!1},{marker:/\[tool\.ruff\b/,scriptName:"lint",command:"ruff check .",kind:"lint",mutating:!1},{marker:/\[tool\.black\b/,scriptName:"format",command:"black .",kind:"format",mutating:!0},{marker:/\[tool\.mypy\b/,scriptName:"typecheck",command:"mypy .",kind:"typecheck",mutating:!1}];async function V(t){let n=c.join(t,"pyproject.toml");if(!await m(n))return[];let e=await l(n,"");return h.filter(({marker:r})=>r.test(e)).map(({marker:r,...i})=>i)}a(V,"detectPythonCommands");async function C(t){let[n,e,r,i,o]=await Promise.all([w(t),M(t),_(t),V(t),R(t)]);return{packageManager:o,commands:[...n,...e,...r,...i]}}a(C,"detectVerifiedCommands");var T=/^(?:--fix|--write|--update|-w|--fix-type)$/,E=new Set(["migrate","push","publish","deploy","release","commit"]);function S(t){for(let n of y(t)){let e=N(n);if(e.some(r=>T.test(r))||e.some(r=>E.has(r.toLowerCase())))return!0}return!1}a(S,"classifyCommandMutation");var x=6,O=3,I=80;function G(t){let n=new Set;return t.filter(e=>n.has(e.kind)?!1:(n.add(e.kind),!0))}a(G,"dedupeByKind");function K(t,n){let e=t.replace(/\s+/g," ").trim();return e.length>n?`${e.slice(0,n-1)}\u2026`:e}a(K,"truncate");async function L(t){try{let n=await u.getProjectId(t),{getActiveProjectStyle:e}=await import("./project-style-evolution-7JS75AUP.mjs"),r=e(n);if(!r)return null;let i=r.payload.stack,o=[i.ecosystem&&i.ecosystem!=="unknown"?i.ecosystem:null,i.languages.slice(0,O).join(", ")||null,i.frameworks.slice(0,x).join(", ")||null].filter(s=>!!s);return o.length>0?o.join(" \xB7 "):null}catch{return null}}a(L,"buildStackLine");async function b(t){let[n,e]=await Promise.all([L(t),C(t)]),r=G(e.commands);if(!n&&r.length===0)return null;let i=[];n&&i.push(`- stack: ${n}`);for(let o of r){let s=o.mutating?"mutating":"read-only";i.push(`- ${o.kind}: \`${K(o.command,I)}\` (${s})`)}return i.push("- deeper: `prjct context --md` \xB7 `prjct_analysis` MCP \xB7 `prjct_relevant_files` MCP"),i.join(`
|
|
9
|
+
`)}a(b,"buildProjectFactsSection");async function $(t){let n=await b(t),e=[p];return n&&e.push("","## This project",n),e.join(`
|
|
10
|
+
`)}a($,"buildPrjctMdBody");async function J(t){let n=await $(t),e=`${f}
|
|
11
|
+
${n}
|
|
12
|
+
${g}
|
|
13
|
+
`;return k(t,"PRJCT.md",e)}a(J,"writeProjectPrjctMd");async function Y(t){let n=await b(t);return n?["# Project facts","",n].join(`
|
|
14
|
+
`):["# Project facts","","No verified facts yet \u2014 run `prjct sync` for the stack line, and make sure a recognized manifest exists (package.json / Cargo.toml / go.mod / pyproject.toml) for verified commands."].join(`
|
|
15
|
+
`)}a(Y,"formatProjectFactsMd");export{b as a,$ as b,J as c,Y as d};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 o,g as y}from"./chunk-HDHVBB6Q.mjs";import{a as m}from"./chunk-E66B27AL.mjs";import{createHash as f}from"node:crypto";import{z as u}from"zod";var d=u.string().trim().min(1).max(200),v=u.string().trim().min(1).max(2e3),T=u.enum(["open","resolved","false_positive"]),g=u.object({source:d,runtime:d,model:d,sessionId:d.nullish(),taskId:d.nullish(),category:d,expectedBehavior:v,observedBehavior:v,relatedRuleId:d.nullish(),occurredAt:u.string().datetime().optional()}).strict(),N=g.omit({occurredAt:!0}).extend({id:u.string().min(1),projectId:u.string().min(1),dedupKey:u.string().length(64),disposition:T,occurredAt:u.string().datetime(),createdAt:u.string().datetime()}).strict();y();var b="instruction.guidance.activated",D=90,A=m(t=>t.normalize("NFKC").trim().replace(/\s+/g," ").toLocaleLowerCase("en-US"),"normalizedBehavior"),C=m(t=>f("sha256").update(JSON.stringify([t.source,t.sessionId??"",t.category,A(t.expectedBehavior),A(t.observedBehavior),t.relatedRuleId??""])).digest("hex"),"dedupKeyFor"),S=m(t=>N.parse({id:t.id,projectId:t.project_id,dedupKey:t.dedup_key,source:t.source,runtime:t.runtime,model:t.model,sessionId:t.session_id,taskId:t.task_id,category:t.category,expectedBehavior:t.expected_behavior,observedBehavior:t.observed_behavior,relatedRuleId:t.related_rule_id,disposition:t.disposition,occurredAt:t.occurred_at,createdAt:t.created_at}),"rowToFailure"),I=class{static{m(this,"InstructionFailureStorage")}record(i,n){let e=g.parse(n),c=C(e),a=`if_${c.slice(0,24)}`,E=new Date().toISOString(),_=e.occurredAt??E,l=o.query(i,`INSERT OR IGNORE INTO instruction_failures
|
|
9
|
+
(id, project_id, dedup_key, source, runtime, model, session_id, task_id, category,
|
|
10
|
+
expected_behavior, observed_behavior, related_rule_id, disposition, occurred_at, created_at)
|
|
11
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'open', ?, ?)
|
|
12
|
+
RETURNING *`,a,i,c,e.source,e.runtime,e.model,e.sessionId??null,e.taskId??null,e.category,e.expectedBehavior,e.observedBehavior,e.relatedRuleId??null,_,E);if(l[0])return{inserted:!0,failure:S(l[0])};let s=o.get(i,"SELECT * FROM instruction_failures WHERE dedup_key = ?",c);if(!s)throw new Error("Instruction failure insert did not produce a readable row");let p=s.runtime==="unknown"&&e.runtime!=="unknown",r=s.model==="unknown"&&e.model!=="unknown",R=p||r?o.query(i,"UPDATE instruction_failures SET runtime = ?, model = ? WHERE id = ? RETURNING *",p?e.runtime:s.runtime,r?e.model:s.model,s.id)[0]??s:s;return{inserted:!1,failure:S(R)}}getById(i,n){let e=o.get(i,"SELECT * FROM instruction_failures WHERE id = ?",n);return e?S(e):null}setDisposition(i,n,e){return o.run(i,"UPDATE instruction_failures SET disposition = ? WHERE id = ?",e,n).changes===1}recordGuidanceActivation(i,n){return o.appendEvent(i,b,{sessionId:n.sessionId??null,ruleId:n.ruleId??null},n.taskId??void 0)}getWindowStats(i,n){let e=n.toISOString(),c=n.getTime(),a=o.get(i,`SELECT COUNT(*) AS total,
|
|
13
|
+
COALESCE(SUM(CASE WHEN runtime <> 'unknown' AND model <> 'unknown' THEN 1 ELSE 0 END), 0) AS attributed,
|
|
14
|
+
COALESCE(SUM(CASE WHEN disposition = 'open' THEN 1 ELSE 0 END), 0) AS open_count,
|
|
15
|
+
COALESCE(SUM(CASE WHEN disposition = 'resolved' THEN 1 ELSE 0 END), 0) AS resolved_count,
|
|
16
|
+
COALESCE(SUM(CASE WHEN disposition = 'false_positive' THEN 1 ELSE 0 END), 0) AS false_positive_count
|
|
17
|
+
FROM instruction_failures
|
|
18
|
+
WHERE project_id = ? AND occurred_at >= ?`,i,e),E=o.query(i,`SELECT runtime, model, category, COUNT(*) AS total,
|
|
19
|
+
SUM(CASE WHEN disposition = 'open' THEN 1 ELSE 0 END) AS open_count,
|
|
20
|
+
SUM(CASE WHEN disposition = 'resolved' THEN 1 ELSE 0 END) AS resolved_count,
|
|
21
|
+
SUM(CASE WHEN disposition = 'false_positive' THEN 1 ELSE 0 END) AS false_positive_count
|
|
22
|
+
FROM instruction_failures
|
|
23
|
+
WHERE project_id = ? AND occurred_at >= ?
|
|
24
|
+
GROUP BY runtime, model, category
|
|
25
|
+
ORDER BY total DESC, runtime ASC, model ASC, category ASC`,i,e).map(r=>({runtime:r.runtime,model:r.model,category:r.category,total:r.total,open:r.open_count,resolved:r.resolved_count,falsePositive:r.false_positive_count})),_=o.query(i,`SELECT * FROM instruction_failures
|
|
26
|
+
WHERE project_id = ? AND disposition = 'open' AND occurred_at >= ?
|
|
27
|
+
ORDER BY occurred_at DESC, id ASC LIMIT 20`,i,e).map(r=>({id:r.id,runtime:r.runtime,model:r.model,category:r.category,observedBehavior:r.observed_behavior,relatedRuleId:r.related_rule_id,occurredAt:r.occurred_at})),l=o.get(i,`SELECT COUNT(*) AS total,
|
|
28
|
+
COALESCE(SUM(CASE WHEN runtime <> 'unknown' AND model <> 'unknown' THEN 1 ELSE 0 END), 0) AS attributed
|
|
29
|
+
FROM agent_sessions WHERE project_id = ? AND started_at >= ?`,i,e)??{total:0,attributed:0},s=o.get(i,`SELECT COUNT(DISTINCT me.id) AS value
|
|
30
|
+
FROM memory_entries me
|
|
31
|
+
INNER JOIN memory_entry_tags met ON met.entry_id = me.id
|
|
32
|
+
WHERE me.project_id = ? AND me.type = 'improvement-signal'
|
|
33
|
+
AND me.deleted_at IS NULL AND me.created_at >= ?
|
|
34
|
+
AND met.key = 'source'
|
|
35
|
+
AND met.value IN ('friction-detector', 'skill-miss-detector')
|
|
36
|
+
AND (NOT EXISTS (
|
|
37
|
+
SELECT 1 FROM memory_entry_tags attribution
|
|
38
|
+
WHERE attribution.entry_id = me.id
|
|
39
|
+
AND attribution.key = 'runtime'
|
|
40
|
+
) OR NOT EXISTS (
|
|
41
|
+
SELECT 1 FROM memory_entry_tags attribution
|
|
42
|
+
WHERE attribution.entry_id = me.id
|
|
43
|
+
AND attribution.key = 'model'
|
|
44
|
+
))`,i,c)?.value??0,p=o.get(i,"SELECT COUNT(*) AS value FROM events WHERE type = ? AND timestamp >= ?",b,e)?.value??0;return{total:a?.total??0,attributed:a?.attributed??0,open:a?.open_count??0,resolved:a?.resolved_count??0,falsePositive:a?.false_positive_count??0,observedSessions:l.total,attributedSessions:l.attributed,legacyUnattributedInputs:s,guidanceActivations:p,groups:E,unresolved:_}}pruneRetained(i,n=new Date){let e=new Date(n.getTime()-D*864e5);return o.run(i,`DELETE FROM instruction_failures
|
|
45
|
+
WHERE project_id = ? AND disposition IN ('resolved', 'false_positive') AND occurred_at < ?`,i,e.toISOString()).changes}},U=new I;export{U as a};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 j}from"./chunk-EHBEHLYN.mjs";import{k as w}from"./chunk-AKIN5WSQ.mjs";import{c as C}from"./chunk-JQE2F2RK.mjs";import{j as r,n as u}from"./chunk-SVZHJZ5T.mjs";import{c as A}from"./chunk-OIEZAHLC.mjs";import{b as l,c,d as h,e as d}from"./chunk-SYHDEUVU.mjs";import{c as R,e as G}from"./chunk-D4S3IRD3.mjs";import{a as s}from"./chunk-E66B27AL.mjs";u();import a from"node:path";var b=`${h}
|
|
9
|
+
- project facts (stack/commands): see \`PRJCT.md\``,P=`${l}
|
|
10
|
+
${b}
|
|
11
|
+
${c}
|
|
12
|
+
`;async function T(e){return d(e,"AGENTS.md",P)}s(T,"writeProjectAgentsMd");var D="@PRJCT.md",I=`${l}
|
|
13
|
+
${D}
|
|
14
|
+
${c}
|
|
15
|
+
`;async function N(e){return d(e,"CLAUDE.md",I)}s(N,"writeProjectClaudeMd");import g from"node:fs/promises";import p from"node:path";u();w();C();import m from"node:path";var F=[{id:"agents-md",displayName:"AGENTS.md-compatible agents",kind:"standard",status:"stable",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Universal project instruction surface shared by current and future coding agents."},{id:"mcp",displayName:"Model Context Protocol clients",kind:"standard",status:"stable",contextFiles:[],supports:{agentsMd:!1,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Universal tool surface for prjct memory, workflow, files, and code intelligence."},{id:"acp",displayName:"Agent Client Protocol clients",kind:"standard",status:"emerging",contextFiles:[],supports:{agentsMd:!1,mcp:!1,skills:!1,hooks:!1,acp:!0,projectRules:!1},notes:"Editor/agent transport for clients such as Zed and other ACP-compatible tools."},{id:"claude",displayName:"Claude Code",kind:"cli",status:"stable",detectsBy:{homeDirs:[".claude"],commands:["claude"]},contextFiles:["CLAUDE.md","AGENTS.md"],mcpTargets:[{format:"claude-json",pathHint:"~/.claude/mcp.json",writable:!0}],supports:{agentsMd:!1,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!0},notes:"Benchmark-tier CLI (2026-07): Claude Code + Opus frontier. CLAUDE.md, skills, hooks, MCP JSON."},{id:"codex",displayName:"OpenAI Codex",kind:"cli",status:"stable",detectsBy:{homeDirs:[".codex"],commands:["codex"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"codex-toml",pathHint:"~/.codex/config.toml",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!1},notes:"Benchmark-tier CLI (2026-07): Codex + GPT-5.x (TB leader). AGENTS.md, config.toml MCP (native), hooks opt-in (planned installer)."},{id:"gemini",displayName:"Gemini CLI",kind:"cli",status:"stable",detectsBy:{homeDirs:[".gemini"],commands:["gemini"]},contextFiles:["GEMINI.md","AGENTS.md"],mcpTargets:[{format:"claude-json",pathHint:"~/.gemini/settings.json mcpServers",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!0},notes:"Benchmark-tier CLI (2026-07): Gemini CLI + Pro/Flash. GEMINI.md; prjct install writes MCP+hooks to ~/.gemini/settings.json."},{id:"antigravity",displayName:"Google Antigravity",kind:"ide",status:"emerging",detectsBy:{homeDirs:[m.join(".gemini","antigravity")]},contextFiles:["ANTIGRAVITY.md","AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!1,acp:!1,projectRules:!0},notes:"Uses Antigravity skills under the Gemini config tree."},{id:"opencode",displayName:"OpenCode",kind:"cli",status:"stable",detectsBy:{homeDirs:[".config/opencode"],projectDirs:[".opencode"],commands:["opencode"]},contextFiles:["AGENTS.md","opencode.json","opencode.jsonc"],mcpTargets:[{format:"opencode-json",pathHint:"~/.config/opencode/opencode.json mcp.prjct",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!1,acp:!1,projectRules:!0},notes:"Benchmark-tier open-source CLI (2026-07): most-starred multi-provider agent. AGENTS.md + prjct install writes mcp.prjct; Claude skill/CLAUDE.md compat."},{id:"pi",displayName:"Pi",kind:"cli",status:"stable",detectsBy:{homeDirs:[".pi",m.join(".pi","agent")],projectDirs:[".pi"],commands:["pi"]},contextFiles:["AGENTS.md","CLAUDE.md","SYSTEM.md","APPEND_SYSTEM.md"],supports:{agentsMd:!0,mcp:!1,skills:!0,hooks:!1,acp:!1,projectRules:!1},notes:"Benchmark-tier minimal harness (2026-07): AGENTS.md + prjct skill at ~/.pi/agent/skills/prjct. MCP only via optional extensions \u2014 do not require it."},{id:"qwen-code",displayName:"Qwen Code",kind:"model-runtime",status:"emerging",detectsBy:{homeDirs:[".qwen"],projectDirs:[".qwen"],commands:["qwen"]},contextFiles:["AGENTS.md","GEMINI.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"Qwen-family coding runtime; treat model/provider choice as separate from runtime setup."},{id:"kimi-cli",displayName:"Kimi CLI",kind:"model-runtime",status:"emerging",detectsBy:{homeDirs:[".kimi"],projectDirs:[".kimi"],commands:["kimi"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"claude-json",pathHint:"~/.kimi/mcp.json",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Kimi-family coding runtime; AGENTS.md and MCP/CLI markdown output are the portable contract."},{id:"grok",displayName:"xAI Grok Build",kind:"cli",status:"stable",detectsBy:{homeDirs:[".grok"],commands:["grok"]},contextFiles:["AGENTS.md","CLAUDE.md"],mcpTargets:[{format:"codex-toml",pathHint:"~/.grok/config.toml",writable:!0},{format:"claude-json",pathHint:"~/.claude/mcp.json (Grok Claude-compat fallback)",writable:!0}],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!1,projectRules:!1},notes:"Benchmark-tier CLI (2026-07): Grok Build. Native MCP + skill via prjct install (~/.grok/config.toml + ~/.grok/skills/prjct). Hooks still Claude-compat. See harness-surfaces."},{id:"goose",displayName:"Goose",kind:"cli",status:"stable",detectsBy:{homeDirs:[".config/goose"],projectDirs:[".goose"],commands:["goose"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"generic",pathHint:"Goose extensions",writable:!1}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Open-source coding agent with extension/MCP-style tool configuration."},{id:"aider",displayName:"Aider",kind:"cli",status:"stable",detectsBy:{projectFiles:[".aider.conf.yml",".aider.conf.yaml"],commands:["aider"]},contextFiles:["AGENTS.md","CONVENTIONS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"CLI pair-programming agent; AGENTS.md provides durable repo instructions."},{id:"cursor",displayName:"Cursor",kind:"ide",status:"stable",detectsBy:{projectDirs:[".cursor"],projectFiles:[".cursorrules"]},contextFiles:["AGENTS.md",".cursor/rules/prjct.mdc"],projectRuleTargets:[{relativePath:".cursor/rules/prjct.mdc",templateKey:"global/CURSOR.mdc",detectPath:".cursor"}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!0,acp:!1,projectRules:!0},notes:"Benchmark-tier AI IDE (2026-07): agent mode + CLI. Rules under .cursor/rules; prjct install writes ~/.cursor/hooks.json."},{id:"cline",displayName:"Cline",kind:"ide",status:"stable",detectsBy:{projectDirs:[".cline",".clinerules"],projectFiles:[".clinerules"]},contextFiles:["AGENTS.md",".clinerules/"],supports:{agentsMd:!0,mcp:!0,skills:!0,hooks:!0,acp:!0,projectRules:!0},notes:"Benchmark-tier open agent (2026-07): VS Code + multi-model. AGENTS.md, rules, skills, hooks, MCP, ACP."},{id:"roo-code",displayName:"Roo Code",kind:"ide",status:"stable",detectsBy:{projectDirs:[".roo"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"VS Code agent with MCP and project rule surfaces."},{id:"continue",displayName:"Continue",kind:"ide",status:"stable",detectsBy:{projectDirs:[".continue"]},contextFiles:["AGENTS.md"],mcpTargets:[{format:"continue-yaml",pathHint:".continue/mcpServers/",writable:!1}],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"IDE assistant with dedicated MCP server config directory."},{id:"kiro",displayName:"Kiro",kind:"ide",status:"stable",detectsBy:{homeDirs:[".kiro"],projectDirs:[".kiro"]},contextFiles:["AGENTS.md",".kiro/steering/"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!0,acp:!1,projectRules:!0},notes:"Agentic IDE with steering docs and MCP."},{id:"copilot",displayName:"GitHub Copilot coding agent",kind:"hosted",status:"hosted",detectsBy:{projectFiles:[m.join(".github","copilot-instructions.md")]},contextFiles:["AGENTS.md",".github/copilot-instructions.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"GitHub Copilot coding agent / Copilot CLI (2026-07 benchmark field). Repo AGENTS.md + .github instructions + MCP."},{id:"devin",displayName:"Devin",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; repo-level AGENTS.md is the safest portable surface."},{id:"jules",displayName:"Google Jules",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; AGENTS.md carries repo-level prjct instructions."},{id:"zed",displayName:"Zed Agent Panel",kind:"ide",status:"stable",detectsBy:{projectDirs:[".zed"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!0,projectRules:!0},notes:"Editor agent surface with ACP support; AGENTS.md remains the repo contract."},{id:"warp",displayName:"Warp",kind:"ide",status:"stable",detectsBy:{homeDirs:[".warp"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Terminal agent surface; AGENTS.md plus MCP covers portable prjct usage."},{id:"amp",displayName:"Amp",kind:"cli",status:"stable",detectsBy:{homeDirs:[".config/amp"],commands:["amp"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Coding agent runtime; AGENTS.md and MCP are the portable contract."},{id:"factory",displayName:"Factory",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted/agentic development platform; repo instructions are the stable surface."},{id:"augment",displayName:"Augment",kind:"ide",status:"stable",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"IDE agent; universal project instructions avoid model-specific coupling."},{id:"kilo-code",displayName:"Kilo Code",kind:"ide",status:"stable",detectsBy:{projectDirs:[".kilocode"]},contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!0,skills:!1,hooks:!1,acp:!1,projectRules:!0},notes:"Agent runtime in the Cline/Roo family; AGENTS.md and MCP keep it compatible."},{id:"phoenix",displayName:"Phoenix",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; AGENTS.md is the repo-level bridge."},{id:"ona",displayName:"Ona",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Hosted coding agent; AGENTS.md is the repo-level bridge."},{id:"semgrep",displayName:"Semgrep assistant",kind:"hosted",status:"hosted",contextFiles:["AGENTS.md"],supports:{agentsMd:!0,mcp:!1,skills:!1,hooks:!1,acp:!1,projectRules:!1},notes:"Security/review agent surface; AGENTS.md carries project workflow guidance."}];function y(){return F.flatMap(e=>e.projectRuleTargets??[])}s(y,"listProjectRuleTargets");u();G();async function B(e){let t=A(e);return t||g.readFile(p.join(R,"templates",e),"utf-8")}s(B,"loadTemplate");async function v(e,t,n){let o=p.join(e,t);await g.mkdir(p.dirname(o),{recursive:!0}),await g.writeFile(o,await B(n),"utf-8")}s(v,"writeRule");async function E(e,t={}){let n=new Set(t.agents??[]),o=[];for(let i of y())(n.has(i.relativePath.split("/")[0].replace(/^\./,""))||i.detectPath&&await r(p.join(e,i.detectPath)))&&(await v(e,i.relativePath,i.templateKey),o.push(i.relativePath));return{written:o}}s(E,"writeProjectIdeRules");async function L(e){let[t,n,o]=await Promise.all([r(a.join(e,"PRJCT.md")),r(a.join(e,"AGENTS.md")),r(a.join(e,"CLAUDE.md"))]);return t||n||o}s(L,"hasAdoptedSurfaces");async function ge(e,t={}){if(!(t.explicit||t.refreshIfAdopted&&await L(e)))return{prjctMd:{action:"unchanged",path:a.join(e,"PRJCT.md")},agentsMd:{action:"unchanged",path:a.join(e,"AGENTS.md")},ideRules:[]};let o=new Set(t.agents??[]),i=await r(a.join(e,"CLAUDE.md")),f=o.has("claude")||i,[M,S,k,x]=await Promise.all([j(e),T(e),f?N(e):void 0,E(e,t)]);return{prjctMd:M,agentsMd:S,...k?{claudeMd:k}:{},ideRules:x.written}}s(ge,"writeProjectAgentSurfaces");export{ge as a};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{b as H}from"./chunk-AOPJ4Z6O.mjs";import{e as k,g as G}from"./chunk-HDHVBB6Q.mjs";import{a as c}from"./chunk-E66B27AL.mjs";G();var X="memory.task_tokens",_=1e7;function ae(e,n,t,r,s){if(!n||t+r<=0)return;let i=5e7;if(t>i||r>i)return;let a=t>_||r>_,u=Math.min(Math.round(t),_),d=Math.min(Math.round(r),_);a&&(s={...s,isEstimated:!0});try{k.appendEvent(e,X,{taskId:n,tokensIn:u,tokensOut:d,...s?.description?{description:s.description}:{},...s?.agent?{agent:s.agent}:{},...s?.model?{model:s.model}:{},...s?.runtime?{runtime:s.runtime}:{},...s?.isEstimated!==void 0?{isEstimated:s.isEstimated}:{},...s?.source?{source:s.source}:{}},n)}catch{}if(u>=0&&u<=_&&d>=0&&d<=_)try{k.run(e,"UPDATE tasks SET tokens_in = ?, tokens_out = ? WHERE id = ?",u,d,n)}catch{}try{let E=s?.source??"cli",T=`${n}:${E}`,S=Date.now();k.run(e,`INSERT INTO token_usage
|
|
9
|
+
(id, work_cycle_id, event_key, source, is_estimated, input_tokens, output_tokens, model_id, description, measured_at, created_at)
|
|
10
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
11
|
+
ON CONFLICT(event_key) DO UPDATE SET
|
|
12
|
+
input_tokens = excluded.input_tokens,
|
|
13
|
+
output_tokens = excluded.output_tokens,
|
|
14
|
+
is_estimated = excluded.is_estimated,
|
|
15
|
+
model_id = excluded.model_id,
|
|
16
|
+
description = COALESCE(excluded.description, token_usage.description),
|
|
17
|
+
measured_at = excluded.measured_at`,T,n,T,E,s?.isEstimated?1:0,u,d,s?.model??null,s?.description??null,S,S)}catch{}}c(ae,"recordTaskTokenUsage");function B(e,n){let t=Date.parse(n),r=y(e,`SELECT work_cycle_id, input_tokens, output_tokens, is_estimated, description
|
|
18
|
+
FROM token_usage
|
|
19
|
+
WHERE measured_at >= ?
|
|
20
|
+
ORDER BY measured_at DESC`,Number.isFinite(t)?t:0),s=new Map;for(let i of r){let a=i.work_cycle_id;if(!a||s.has(a))continue;let u=b(i.input_tokens)??0,d=b(i.output_tokens)??0;u+d<=0||s.set(a,{id:a,description:i.description??a,status:i.is_estimated?"estimated":"measured",tokensIn:u,tokensOut:d,tokensTotal:u+d,minutes:null})}return s}c(B,"measuredCyclesFromTokenUsage");function Z(e,n){let t=se(n),r=new Date().toISOString(),s=y(e,`SELECT id, description, status, started_at, completed_at, shipped_at, tokens_in, tokens_out
|
|
21
|
+
FROM tasks
|
|
22
|
+
WHERE COALESCE(completed_at, shipped_at, started_at) >= ?
|
|
23
|
+
ORDER BY COALESCE(completed_at, shipped_at, started_at) DESC`,t),i=new Map;for(let o of s.map(j))o&&i.set(o.id,o);for(let[o,m]of B(e,t)){let h=i.get(o);i.set(o,{...m,description:h?.description??m.description,minutes:h?.minutes??m.minutes})}let a=[...i.values()].sort((o,m)=>m.tokensTotal-o.tokensTotal),u=g(e,"memory.task_started",t),d=g(e,"memory.status.changed",t),R=g(e,"memory.feature_shipped",t),E=g(e,"sync",t),T=l(e,"SELECT COUNT(*) AS value FROM events WHERE type >= ? AND type < ? AND timestamp >= ?","memory.","memory/",t),S=g(e,"memory.post_edit",t),q=l(e,"SELECT COUNT(*) AS value FROM agent_sessions WHERE started_at >= ?",t),I=(()=>{try{return l(e,"SELECT COUNT(*) AS value FROM cli_sessions WHERE created_at >= ?",t)}catch{return 0}})(),A=q+I,w=l(e,"SELECT COUNT(DISTINCT memory_id) AS value FROM memory_surface_log WHERE created_at >= ?",t),K=l(e,`SELECT COUNT(DISTINCT s.memory_id) AS value
|
|
24
|
+
FROM memory_surface_log s
|
|
25
|
+
INNER JOIN memory_usefulness u ON u.memory_id = s.memory_id
|
|
26
|
+
WHERE s.created_at >= ?
|
|
27
|
+
AND u.score > 0`,t),Y=(()=>{try{return l(e,`SELECT COUNT(DISTINCT t.id) AS value
|
|
28
|
+
FROM tasks t
|
|
29
|
+
INNER JOIN agent_sessions a ON a.task_id = t.id
|
|
30
|
+
WHERE (t.completed_at IS NOT NULL OR t.shipped_at IS NOT NULL)
|
|
31
|
+
AND COALESCE(t.completed_at, t.shipped_at, t.started_at) >= ?`,t)}catch{return 0}})(),$=l(e,"SELECT COUNT(*) AS value FROM context_zone_events WHERE timestamp >= ?",t),z=l(e,"SELECT COUNT(*) AS value FROM context_compactions WHERE timestamp >= ?",t),D=P(e,"command_duration",t),x=P(e,"startup_time",t),N=ee(e,t),W=a.reduce((o,m)=>o+m.tokensIn,0),L=a.reduce((o,m)=>o+m.tokensOut,0),C=Math.max(s.length,u,R),f=s.filter(o=>o.completed_at||o.shipped_at),O=new Set(B(e,t).keys()),J=(()=>{try{return new Set(k.query(e,`SELECT DISTINCT task_id AS task_id FROM agent_sessions
|
|
32
|
+
WHERE task_id IS NOT NULL AND started_at >= ?`,t).map(o=>o.task_id).filter(Boolean))}catch{return new Set}})(),M=f.filter(o=>{let m=Number(o.tokens_in??0),h=Number(o.tokens_out??0);return m+h>0||O.has(o.id)}).length,U=f.filter(o=>Number(o.tokens_in??0)+Number(o.tokens_out??0)>0||O.has(o.id)||J.has(o.id)).length,v=U>0?U:f.length>0?f.length:s.length>0?s.length:C,F=Math.max(M,a.length),p=[];C===0?p.push("No work cycles were found in tasks or historical events for this window."):s.length===0&&p.push("Work history was rescued from events, but normalized task rows are missing."),v>0&&M===0&&F===0&&p.push("Work cycles exist, but none have exact token totals. Capture exact or estimated usage at task close."),A===0&&p.push("No agent sessions were recorded. Session-level model/runtime/cost cannot be attributed yet."),w===0&&p.push("No surfaced context was logged in this window, so reuse and re-exploration waste cannot be proven.");let V=(()=>{try{return k.query(e,`SELECT COALESCE(model_id, 'unknown') AS model,
|
|
33
|
+
SUM(input_tokens) AS t_in, SUM(output_tokens) AS t_out
|
|
34
|
+
FROM token_usage
|
|
35
|
+
WHERE model_id IS NOT NULL AND measured_at >= ?
|
|
36
|
+
GROUP BY COALESCE(model_id, 'unknown')
|
|
37
|
+
ORDER BY t_in + t_out DESC`,Date.parse(t)).map(o=>({model:o.model,tokensIn:o.t_in,tokensOut:o.t_out}))}catch{return[]}})();return{id:`work-cost-${n}d`,windowDays:n,generatedAt:r,workCycles:s.length>0?s.length:C,knownTokenCycles:F,tokensIn:W,tokensOut:L,tokensTotal:W+L,tokenCoveragePercent:v===0?0:Math.min(100,Math.round(Math.max(M,a.filter(o=>O.has(o.id)||o.tokensTotal>0).length)/v*100)),measuredSessions:Math.max(A,Y),surfacedContext:w,usefulContext:K,contextZoneEvents:$,compactions:z,commandSamples:D.samples,commandMs:Math.round(D.total??0),avgStartupMs:x.average===null?null:Math.round(x.average),mostExpensive:a.slice(0,8),byModel:V,historicalRescue:{inferredWorkCycles:C,taskTableCycles:s.length,eventWorkStarts:u,eventStatusChanges:d,eventShips:R,syncRuns:E,memoryEvents:T,postEditEvents:S,declaredTokenMentions:N.length,declaredTokensTotal:N.reduce((o,m)=>o+m.tokens,0),topDeclaredTokenMentions:N.slice(0,5)},gaps:p}}c(Z,"buildWorkCostSnapshot");async function ue(e,n=[7,30,90]){let t=n.map(r=>Z(e,r));for(let r of t)await H({projectId:e,entityType:"work_cost_snapshots",entityId:r.id,eventType:"upsert",data:Q(r)});return t}c(ue,"publishWorkCostSnapshots");function Q(e){return{...e,mostExpensive:e.mostExpensive.map(n=>({...n,description:"[redacted]"})),historicalRescue:{...e.historicalRescue,topDeclaredTokenMentions:e.historicalRescue.topDeclaredTokenMentions.map(n=>({tokens:n.tokens,sourceType:n.sourceType,occurredAt:n.occurredAt,summary:"[redacted]"}))}}}c(Q,"redactSnapshotForCloud");function j(e){let n=b(e.tokens_in)??0,t=b(e.tokens_out)??0,r=n+t;return r<=0?null:{id:e.id,description:e.description,status:e.status,tokensIn:n,tokensOut:t,tokensTotal:r,minutes:oe(e.started_at,e.completed_at??e.shipped_at)}}c(j,"toCostTask");function ee(e,n){let t=y(e,`SELECT type, data, timestamp
|
|
38
|
+
FROM events
|
|
39
|
+
WHERE timestamp >= ?
|
|
40
|
+
AND type >= ?
|
|
41
|
+
AND type < ?
|
|
42
|
+
AND json_valid(data)
|
|
43
|
+
AND json_extract(data, '$.content') LIKE '%token%'
|
|
44
|
+
ORDER BY timestamp DESC
|
|
45
|
+
LIMIT 200`,n,"memory.remember.","memory.remember/"),r=[];for(let s of t){let i=(()=>{try{let u=JSON.parse(s.data);return typeof u.content=="string"?u.content:""}catch{return""}})();if(!i)continue;let a=te(i);for(let u of a)r.push({tokens:u,sourceType:s.type,occurredAt:s.timestamp,summary:ne(i)})}return r.sort((s,i)=>i.tokens-s.tokens)}c(ee,"declaredTokenMentions");function te(e){let n=[],t=/\b(\d+(?:\.\d+)?)\s*([kKmM])?\s*(?:tokens?|tok)\b/g;for(let r of e.matchAll(t)){let s=Number.parseFloat(r[1]??"0"),i=r[2]?.toLowerCase();if(!Number.isFinite(s)||s<=0)continue;let a=i==="m"?1e6:i==="k"?1e3:1;n.push(Math.round(s*a))}return n}c(te,"extractTokenCounts");function ne(e){let n=e.replace(/\s+/g," ").trim();return n.length<=140?n:`${n.slice(0,137)}...`}c(ne,"summarize");function g(e,n,t){return l(e,"SELECT COUNT(*) AS value FROM events WHERE type = ? AND timestamp >= ?",n,t)}c(g,"eventCount");function P(e,n,t){return y(e,`SELECT COUNT(*) AS samples, COALESCE(SUM(value), 0) AS total, AVG(value) AS average
|
|
46
|
+
FROM perf_samples
|
|
47
|
+
WHERE metric = ? AND timestamp >= ?`,n,t)[0]??{samples:0,total:0,average:null}}c(P,"aggregatePerf");function l(e,n,...t){try{return Number(k.get(e,n,...t)?.value??0)}catch{return 0}}c(l,"count");function y(e,n,...t){try{return k.query(e,n,...t)}catch{return[]}}c(y,"query");function se(e){let n=new Date;return n.setDate(n.getDate()-e),n.toISOString()}c(se,"sinceIso");function b(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:null}c(b,"nullableNumber");function oe(e,n){if(!e||!n)return null;let t=Date.parse(e),r=Date.parse(n);return!Number.isFinite(t)||!Number.isFinite(r)||r<t?null:Math.round((r-t)/6e4)}c(oe,"durationMinutes");export{ae as a,ue as b};
|
|
@@ -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 r}from"./chunk-E66B27AL.mjs";function n(e){return e.normalize("NFD").replace(/[̀-ͯ]/g,"")}r(n,"deburr");export{n as a};
|
|
@@ -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 o}from"./chunk-E66B27AL.mjs";var a=["identity","voice","glossary","framework"],d=["fact","decision","learning","gotcha","red-herring","pattern","anti-pattern","shipped","example",...a,"context","inbox","todo","idea","insight","question","source","person","spec"];function g(e){return!(e.type==="improvement-signal"||e.tags?.pattern==="hot-file")}o(g,"isModelMemory");function c(e,t){try{return JSON.parse(e)}catch{return t}}o(c,"safeJson");function u(e){let t=e.data?c(e.data,{}):{},r=t.tags??{};return e.type&&(r.type=e.type),{id:`ship_${e.id}`,type:"shipped",content:e.name,tags:r,rememberedAt:e.shipped_at,source:t.taskId,provenance:"extracted"}}o(u,"shippedRowToEntry");function y(e,t){let r=t.toLowerCase();if(e.content.toLowerCase().includes(r))return!0;for(let n of Object.values(e.tags))if(n.toLowerCase().includes(r))return!0;return!1}o(y,"matchesTopic");function f(e,t){for(let[r,n]of Object.entries(t))if(e.tags[r]!==n)return!1;return!0}o(f,"matchesTags");function m(e){let t=new Set,r=[];for(let n of e){let s=n.tags.key;if(!s){r.push(n);continue}let i=`${n.type}::${s}`;t.has(i)||(t.add(i),r.push(n))}return r}o(m,"dedupeLatestByKey");var p=/\bmem[_-](\d+)\b/g;function l(e){let t=new Set;for(let r of e){r.tags["superseded-by"]&&t.add(r.id);for(let n of["supersedes","duplicates"]){let s=r.tags[n];if(s)for(let i of String(s).matchAll(p))t.add(`mem_${i[1]}`)}}return t}o(l,"collectSupersededIds");export{a,g as b,u as c,y as d,f as e,m as f,l as g};
|
|
@@ -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 r}from"./chunk-E66B27AL.mjs";var t=[{name:"instruction-override",re:/\b(ignore|disregard|override|forget)\b[^.]{0,40}\b(previous|prior|above|system|prompt|instructions?|rules?|constraints?)\b/i},{name:"role-play-injection",re:/\b(you\s+are\s+now|act\s+as|pretend\s+to\s+be|roleplay\s+as|assume\s+the\s+role)\b[^.]{0,40}\b(system|admin|root|developer|operator|jailbreak)\b/i},{name:"jailbreak-phrase",re:/\b(DAN\s+mode|do\s+anything\s+now|without\s+restrictions?|bypass\s+(?:safety|filters?|guidelines?)|jailbreak\s+mode)\b/i},{name:"fake-system-tag",re:/<\s*(?:system|assistant|tool[_-]?call|function[_-]?call)\s*>/i}],a=t.map(e=>e.name);function i(e){let s=[];for(let{name:n,re:o}of t)o.test(e)&&s.push(n);return s}r(i,"scanForPromptInjection");function l(e){return e.replace(/[`*_[\](){}<>\\]/g,s=>`\\${s}`)}r(l,"escapeMarkdownInline");export{i as a,l as b};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __pathDirname } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __pathDirname(__filename);
|
|
8
|
+
import{m as j,q as L,r as M}from"./chunk-AKIN5WSQ.mjs";import{a as E,b as a,c as S}from"./chunk-JQE2F2RK.mjs";import{j as C,n as I}from"./chunk-SVZHJZ5T.mjs";import{c as x}from"./chunk-OIEZAHLC.mjs";import{a as O}from"./chunk-SYHDEUVU.mjs";import{d as N,e as G}from"./chunk-D4S3IRD3.mjs";import{a as R,e as l,f as k}from"./chunk-BUDZL4DW.mjs";import{a as c,e as b}from"./chunk-E66B27AL.mjs";k();I();M();import i from"node:fs/promises";import n from"node:path";import u from"node:fs/promises";import A from"node:path";k();var y='<!-- prjct:start - DO NOT REMOVE THIS MARKER -->\n# p/ \u2014 Project knowledge layer\n\nprjct stores project memory (decisions, learnings, gotchas, patterns, ships, analyses) per project in SQLite and serves it to you through tools. **Query it \u2014 don\'t re-read source from scratch.**\n\nprjct remembers and shows the path; it does not own execution. Treat prjct output as durable signals (task state, memories, specs, workflows, risks, recent learnings). Claude, GPT, and other agents decide the concrete HOW with their own native tools and judgment, then persist meaningful outcomes back to prjct.\n\nYou are in a prjct project when `.prjct/` is in cwd OR `~/.prjct-cli/projects/` has an entry for the current path.\n\n## Lookup FIRST, source LAST\n\nBefore reading source code or running broad searches for ANY question about the project (architecture, conventions, decisions, recent ships, bugs, patterns, tech debt, past analyses), QUERY prjct first \u2014 bounded, ranked answers from SQLite, no markdown trees to wade through:\n\n- `prjct context memory <topic>` / `prjct search "<q>"` \u2014 captured decisions, gotchas, learnings, facts\n- `prjct context --md` \u2014 current state: active cycle, ships, recent learnings\n- architecture / conventions / patterns / anti-patterns / tech-debt / insights \u2192 MCP `prjct_analysis` (add `mode:archive` for history)\n- developer preferences \u2192 MCP `prjct_developer`; machine signals \u2192 MCP `prjct_signals`\n- specs \u2192 MCP `prjct_spec_list` / `prjct_spec_get`; per-file traps before editing \u2192 `prjct guard <file>`\n\nOnly fall through to source/repo reading when prjct does not contain the answer.\n\n**Skill \u2260 project identity.** The prjct skill is a portable multi-LLM contract (L0). Live name/stack/branch come from SessionStart + `prjct context --md` for **this cwd**. If skill text and the tree disagree, trust the cwd and the tree.\n\n## Capture analyses BACK to prjct\n\nWhen you complete substantive work \u2014 analysis, decision, learning, gotcha \u2014 persist it: `prjct remember <decision|learning|gotcha|fact> "..."` or `prjct capture "<text>" --tags k:v`. **Author every entry in ENGLISH**, whatever language the user speaks. **Default to capturing \u2014 under-capture is the failure mode that makes prjct useless.** The full verb map and task workflow live in the `prjct` skill.\n\n## Where things live\n\n- Source of truth: SQLite at `~/.prjct-cli/projects/<id>/` (don\'t read directly \u2014 use `prjct` CLI / MCP tools)\n- Project config: `.prjct/prjct.config.json` in repo root\n\n**Auto-managed by prjct-cli** | https://prjct.app\n<!-- prjct:end - DO NOT REMOVE THIS MARKER -->\n';async function P(){let m=(M(),b(L)),t=await m.getActiveProvider(),e=t.name;if(!(await m.detectProvider(e)).installed&&!t.configDir)return{success:!1,error:`${t.displayName} not detected`,action:"skipped"};try{await u.mkdir(t.configDir,{recursive:!0});let s=A.join(t.configDir,t.contextFile),p=await(async()=>{if(e==="claude")return y;let o=x(`global/${t.contextFile}`);if(o)return o;let{PACKAGE_ROOT:g}=(G(),b(N)),T=A.join(g,"templates","global",t.contextFile);return u.readFile(T,"utf-8").catch(()=>e==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await u.readFile(s,"utf-8").then(o=>({content:o,exists:!0})).catch(o=>{if(R(o))return{content:"",exists:!1};throw o}),h="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",D=(()=>{if(!r.content.includes(h)||!r.content.includes(f))return r.content;let o=r.content.substring(0,r.content.indexOf(h)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(o+g).replace(/\n{3,}/g,`
|
|
9
|
+
|
|
10
|
+
`).trim()}
|
|
11
|
+
`})(),w=O(r.exists?D:"",p,"<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");return await u.writeFile(s,w.content,"utf-8"),{success:!0,action:w.action,path:s}}catch(s){return{success:!1,error:l(s),action:"failed"}}}c(P,"installGlobalConfig");S();async function et(){return P()}c(et,"installGlobalConfig");var v=class{static{c(this,"CommandInstaller")}commandsPath="";configPath="";_initialized=!1;async ensureInit(){if(this._initialized)return;let t=await j();this.configPath=t.configDir??"",this.commandsPath=this.configPath?n.join(this.configPath,"commands"):"",this._initialized=!0}async detectActiveProvider(){return await this.ensureInit(),C(this.configPath)}async installCommands(){let t=await this.detectActiveProvider(),e=await j();return t?(await this.cleanupRouter(),{success:!0,installed:[],path:this.commandsPath}):{success:!1,error:`${e.displayName} not detected. Please install it first.`}}async uninstallCommands(){try{let t=[];await this.ensureInit();for(let e of["p.md","p.toml"]){let d=n.join(this.commandsPath,e);try{await i.unlink(d),t.push(e)}catch(s){if(s.code!=="ENOENT")return{success:!1,error:l(s)}}}return{success:!0,uninstalled:t}}catch(t){return{success:!1,error:l(t)}}}async checkInstallation(){return await this.detectActiveProvider()?{installed:!0,providerDetected:!0,commands:[],path:this.commandsPath}:{installed:!1,providerDetected:!1}}async getInstallPath(){return await this.ensureInit(),this.commandsPath}async syncCommands(){if(!await this.detectActiveProvider())return{success:!1,error:"AI agent not detected",added:0,updated:0,removed:0};try{return{success:!0,added:0,updated:0,removed:await this.cleanupRouter()?1:0}}catch(e){return{success:!1,error:l(e),added:0,updated:0,removed:0}}}async cleanupRouter(){return await this.ensureInit(),(await Promise.all(["p.md","p.toml"].map(async e=>{try{return await i.unlink(n.join(this.commandsPath,e)),!0}catch{return!1}}))).some(Boolean)}async cleanupLegacyCommands(){await this.ensureInit();let t=n.join(this.commandsPath,"p");try{if((await i.stat(t).catch(()=>null))?.isDirectory())return await i.rm(t,{recursive:!0,force:!0}),!0}catch{}return!1}async installGlobalConfig(){return P()}async cleanupAllLegacy(){let t=E(),e=[],d=[n.join(t,".claude","commands","p.md"),n.join(t,".claude","commands","p.toml"),n.join(t,".gemini","commands","p.md"),n.join(t,".gemini","commands","p.toml")];for(let r of d)try{await i.unlink(r),e.push(r)}catch{}let s=[n.join(t,".claude","commands","p"),n.join(t,".gemini","commands","p")];for(let r of s)try{(await i.stat(r).catch(()=>null))?.isDirectory()&&(await i.rm(r,{recursive:!0,force:!0}),e.push(r))}catch{}let p=[n.join(t,".prjct-cli","config","homebrew-migrated")];for(let r of p)try{await i.unlink(r),e.push(r)}catch{}return{cleaned:e}}};function rt(){return{claude:{commands:a(".claude","commands"),config:a(".claude"),router:a(".claude","commands","p.md")},gemini:{commands:a(".gemini","commands"),config:a(".gemini"),router:a(".gemini","commands","p.toml")}}}c(rt,"getProviderPaths");var _=new v,nt=_;export{et as a,v as b,rt as c,nt as d};
|