prjct-cli 3.89.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/bin/hook-chunks/{agent-switch-FBQDHWAO.mjs → agent-switch-IQ5KSRKD.mjs} +1 -1
  3. package/dist/bin/hook-chunks/{analysis-NRRZYJ6G.mjs → analysis-LBYZSJKT.mjs} +2 -2
  4. package/dist/bin/hook-chunks/{auto-flush-D3X3U4CP.mjs → auto-flush-GW3FP763.mjs} +1 -1
  5. package/dist/bin/hook-chunks/{capture-gate-BFOABO2Y.mjs → capture-gate-BQCNMHUC.mjs} +1 -1
  6. package/dist/bin/hook-chunks/{chunk-5T5PZKHW.mjs → chunk-3WKDMAS7.mjs} +1 -1
  7. package/dist/bin/hook-chunks/{chunk-YGHIPTJN.mjs → chunk-6AFM6WRB.mjs} +2 -2
  8. package/dist/bin/hook-chunks/{chunk-JQLJM4BK.mjs → chunk-A5MUSARI.mjs} +1 -1
  9. package/dist/bin/hook-chunks/{chunk-GHBGBP2M.mjs → chunk-AEYONUUY.mjs} +1 -1
  10. package/dist/bin/hook-chunks/{chunk-H6KVNDQD.mjs → chunk-B7GMU46T.mjs} +3 -3
  11. package/dist/bin/hook-chunks/{chunk-HE5RSIHG.mjs → chunk-D4S3IRD3.mjs} +1 -1
  12. package/dist/bin/hook-chunks/{chunk-SN224ILI.mjs → chunk-D6KT763C.mjs} +1 -1
  13. package/dist/bin/hook-chunks/{chunk-3HDIQJ55.mjs → chunk-DGQYQSUK.mjs} +2 -2
  14. package/dist/bin/hook-chunks/{chunk-SNISJ7HR.mjs → chunk-EHBEHLYN.mjs} +1 -1
  15. package/dist/bin/hook-chunks/{chunk-F652GI4F.mjs → chunk-FEH4IPIC.mjs} +1 -1
  16. package/dist/bin/hook-chunks/{chunk-YORSHLFH.mjs → chunk-HBLR7BVG.mjs} +1 -1
  17. package/dist/bin/hook-chunks/{chunk-VAXQ5IDD.mjs → chunk-IKUGYUAI.mjs} +1 -1
  18. package/dist/bin/hook-chunks/{chunk-PTVXWPQH.mjs → chunk-LGJUQEAU.mjs} +1 -1
  19. package/dist/bin/hook-chunks/{chunk-NN65WGGN.mjs → chunk-LJLUP4FF.mjs} +1 -1
  20. package/dist/bin/hook-chunks/{chunk-GJFWVCTS.mjs → chunk-LPB3HUJ2.mjs} +1 -1
  21. package/dist/bin/hook-chunks/{chunk-OVR6RUUZ.mjs → chunk-M3ZOJVPA.mjs} +2 -2
  22. package/dist/bin/hook-chunks/{chunk-GSMDQ7VM.mjs → chunk-OIEZAHLC.mjs} +1 -1
  23. package/dist/bin/hook-chunks/{chunk-GVJZPOG2.mjs → chunk-PSP56GGF.mjs} +1 -1
  24. package/dist/bin/hook-chunks/{chunk-R77TXXPP.mjs → chunk-PXJKXBTM.mjs} +1 -1
  25. package/dist/bin/hook-chunks/{chunk-MECJJJ7R.mjs → chunk-QZSJSXJV.mjs} +1 -1
  26. package/dist/bin/hook-chunks/{chunk-A4OFZ2SK.mjs → chunk-RAHFKGM6.mjs} +1 -1
  27. package/dist/bin/hook-chunks/{chunk-2H57GV2T.mjs → chunk-RJ2BRRMH.mjs} +2 -2
  28. package/dist/bin/hook-chunks/{chunk-DAOC3T5G.mjs → chunk-RRWPDRYR.mjs} +2 -2
  29. package/dist/bin/hook-chunks/{chunk-XGYCAVB2.mjs → chunk-TFGJVT6F.mjs} +1 -1
  30. package/dist/bin/hook-chunks/{chunk-RNCLLUMK.mjs → chunk-UHW35BPE.mjs} +4 -4
  31. package/dist/bin/hook-chunks/{chunk-OFVLGJ76.mjs → chunk-UQVJQME2.mjs} +1 -1
  32. package/dist/bin/hook-chunks/{chunk-HZXDF2TQ.mjs → chunk-W5OWBOLH.mjs} +1 -1
  33. package/dist/bin/hook-chunks/{chunk-UDUUEZD3.mjs → chunk-XEFIIDHM.mjs} +1 -1
  34. package/dist/bin/hook-chunks/{chunk-CULYIJJZ.mjs → chunk-YG7KBQYJ.mjs} +1 -1
  35. package/dist/bin/hook-chunks/{chunk-P43HDWI5.mjs → chunk-YKMJI6TF.mjs} +2 -2
  36. package/dist/bin/hook-chunks/{codex-skill-MNY46575.mjs → codex-skill-7IURPY6B.mjs} +1 -1
  37. package/dist/bin/hook-chunks/{command-installer-ZOQQLRCI.mjs → command-installer-BVHQUSL4.mjs} +1 -1
  38. package/dist/bin/hook-chunks/{config-manager-KJCMN7PV.mjs → config-manager-KYC7WUOS.mjs} +1 -1
  39. package/dist/bin/hook-chunks/{cwd-changed-KXOCN55N.mjs → cwd-changed-56X7BNS6.mjs} +1 -1
  40. package/dist/bin/hook-chunks/{distill-R477XZE3.mjs → distill-6C6YIFOE.mjs} +1 -1
  41. package/dist/bin/hook-chunks/{enriched-recall-65X44HBM.mjs → enriched-recall-6ZZNKAJZ.mjs} +1 -1
  42. package/dist/bin/hook-chunks/{format-UF2TLTKX.mjs → format-YOYMJSLY.mjs} +1 -1
  43. package/dist/bin/hook-chunks/{judgment-receipt-NXL5Q4CE.mjs → judgment-receipt-2U7D6HS4.mjs} +1 -1
  44. package/dist/bin/hook-chunks/{land-cue-SRIIDHMN.mjs → land-cue-SS23JBAX.mjs} +1 -1
  45. package/dist/bin/hook-chunks/{land-synthesis-ANVOY7AM.mjs → land-synthesis-OATL5BNP.mjs} +1 -1
  46. package/dist/bin/hook-chunks/{legacy-crew-sweep-PSJCO5UP.mjs → legacy-crew-sweep-NH5EWEXF.mjs} +2 -2
  47. package/dist/bin/hook-chunks/{memory-index-7LM2BMWZ.mjs → memory-index-677MUBCZ.mjs} +1 -1
  48. package/dist/bin/hook-chunks/{notification-2TZO3WRM.mjs → notification-S2IJJ6JW.mjs} +1 -1
  49. package/dist/bin/hook-chunks/{pack-integrity-6VKUAISJ.mjs → pack-integrity-L3BL7CGO.mjs} +1 -1
  50. package/dist/bin/hook-chunks/{pack-manager-KQBNP6XR.mjs → pack-manager-SU53HCKK.mjs} +1 -1
  51. package/dist/bin/hook-chunks/{planning-ZQNNDOEL.mjs → planning-ZYFCFU7N.mjs} +2 -2
  52. package/dist/bin/hook-chunks/{post-edit-AEFFZFPO.mjs → post-edit-JD7YFEBZ.mjs} +1 -1
  53. package/dist/bin/hook-chunks/{pre-bash-3FACZOB5.mjs → pre-bash-VIABNO5E.mjs} +1 -1
  54. package/dist/bin/hook-chunks/{pre-commit-MDFDQ5QZ.mjs → pre-commit-NVQVXHZQ.mjs} +1 -1
  55. package/dist/bin/hook-chunks/{pre-edit-ORX656T5.mjs → pre-edit-V4RD45C4.mjs} +1 -1
  56. package/dist/bin/hook-chunks/{pre-package-ITHMLNGN.mjs → pre-package-KFJZXI5T.mjs} +1 -1
  57. package/dist/bin/hook-chunks/{pre-search-UFS2Z5VJ.mjs → pre-search-7KRU5D2O.mjs} +1 -1
  58. package/dist/bin/hook-chunks/{prjct-md-IKUVPUGT.mjs → prjct-md-FMCPUMQT.mjs} +1 -1
  59. package/dist/bin/hook-chunks/{project-agent-surfaces-VCOI4GHT.mjs → project-agent-surfaces-TD7BHI25.mjs} +1 -1
  60. package/dist/bin/hook-chunks/{project-memory-KRA3BH7A.mjs → project-memory-ZVZSLPB5.mjs} +1 -1
  61. package/dist/bin/hook-chunks/{project-style-evolution-363CLE32.mjs → project-style-evolution-7JS75AUP.mjs} +1 -1
  62. package/dist/bin/hook-chunks/{prompt-6L7B546V.mjs → prompt-S4MMIXH5.mjs} +2 -2
  63. package/dist/bin/hook-chunks/{purge-IPK4NJN6.mjs → purge-BDREPWEE.mjs} +1 -1
  64. package/dist/bin/hook-chunks/{retention-S2GGTVY2.mjs → retention-D2MVQLOF.mjs} +1 -1
  65. package/dist/bin/hook-chunks/{sdd-JIPV7QJP.mjs → sdd-ZO4DP23G.mjs} +1 -1
  66. package/dist/bin/hook-chunks/{session-continuity-DABISZYM.mjs → session-continuity-FNNUMOXB.mjs} +1 -1
  67. package/dist/bin/hook-chunks/{session-start-GJPAQ3GL.mjs → session-start-HA7IRBFX.mjs} +1 -1
  68. package/dist/bin/hook-chunks/{setup-TG5O5TKD.mjs → setup-7L3NXNRH.mjs} +2 -2
  69. package/dist/bin/hook-chunks/{shipping-VCLQS7GP.mjs → shipping-GX4HFYJ3.mjs} +4 -4
  70. package/dist/bin/hook-chunks/{spec-context-inference-MOOQL2VC.mjs → spec-context-inference-KER2R3F3.mjs} +1 -1
  71. package/dist/bin/hook-chunks/{spec-service-33UDKWXT.mjs → spec-service-G3RLCJ2G.mjs} +2 -2
  72. package/dist/bin/hook-chunks/{spec-task-breakdown-FES465AB.mjs → spec-task-breakdown-YPJ76OWR.mjs} +1 -1
  73. package/dist/bin/hook-chunks/{stop-IWI5SQG6.mjs → stop-HPZCLDPM.mjs} +2 -2
  74. package/dist/bin/hook-chunks/{subagent-start-NJZOWV2P.mjs → subagent-start-7KZUTKV5.mjs} +1 -1
  75. package/dist/bin/hook-chunks/{subagent-stop-R6HIIVWQ.mjs → subagent-stop-7C72RWGO.mjs} +1 -1
  76. package/dist/bin/hook-chunks/{surface-attribution-JYE6VDZR.mjs → surface-attribution-PDYR6DVA.mjs} +1 -1
  77. package/dist/bin/hook-chunks/{task-service-NSS5SVJE.mjs → task-service-RRFG5P7N.mjs} +1 -1
  78. package/dist/bin/hook-chunks/{tdd-AKXWUK2Y.mjs → tdd-XQUU4C23.mjs} +1 -1
  79. package/dist/bin/hook-chunks/{template-loader-KLKEG7XM.mjs → template-loader-4QMIMOBY.mjs} +1 -1
  80. package/dist/bin/hook-chunks/{weak-model-mode-JQ23PTXN.mjs → weak-model-mode-M6D23IIM.mjs} +1 -1
  81. package/dist/bin/hook-chunks/{work-scope-C7BJX6QE.mjs → work-scope-6FG6PSAV.mjs} +1 -1
  82. package/dist/bin/hook-fast-darwin-arm64 +0 -0
  83. package/dist/bin/hook-fast-darwin-x64 +0 -0
  84. package/dist/bin/prjct-core.mjs +2 -2
  85. package/dist/bin/prjct-hooks.mjs +1 -1
  86. package/dist/daemon/entry.mjs +1 -1
  87. package/dist/mcp/server.mjs +1 -1
  88. package/package.json +1 -1
@@ -5,10 +5,10 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{e as T,g as D,h as v,i as O,j as G}from"./chunk-2OU2MKNS.mjs";import{a as W,b as C}from"./chunk-YJMWY4Y6.mjs";import{e as H,i as z}from"./chunk-NJAMZSHM.mjs";import{a as A,e as B}from"./chunk-4DDCWMI6.mjs";import{a as I}from"./chunk-DAOC3T5G.mjs";import{e as w,g as oe}from"./chunk-HDHVBB6Q.mjs";import{a as L,o as re}from"./chunk-CTWZQ7YI.mjs";import{a as c}from"./chunk-E66B27AL.mjs";oe();re();async function ie(e,t=100){try{let{stdout:r}=await L(`git log --name-only --pretty=format:'---COMMIT---' -${t}`,{cwd:e,maxBuffer:10485760}),n=r.split(`
8
+ import{e as T,g as D,h as v,i as O,j as G}from"./chunk-2OU2MKNS.mjs";import{a as W,b as C}from"./chunk-YJMWY4Y6.mjs";import{e as H,i as z}from"./chunk-NJAMZSHM.mjs";import{a as A,e as B}from"./chunk-4DDCWMI6.mjs";import{a as I}from"./chunk-RRWPDRYR.mjs";import{e as w,g as oe}from"./chunk-HDHVBB6Q.mjs";import{a as L,o as re}from"./chunk-CTWZQ7YI.mjs";import{a as c}from"./chunk-E66B27AL.mjs";oe();re();async function ie(e,t=100){try{let{stdout:r}=await L(`git log --name-only --pretty=format:'---COMMIT---' -${t}`,{cwd:e,maxBuffer:10485760}),n=r.split(`
9
9
  `).reduce((o,i)=>{let m=i.trim();return m==="---COMMIT---"?(o.currentFiles&&o.currentFiles.size>0&&o.currentFiles.size<=30&&o.commits.push(o.currentFiles),o.currentFiles=new Set):m&&o.currentFiles&&ce(m)&&o.currentFiles.add(m),o},{commits:[],currentFiles:null});return n.currentFiles&&n.currentFiles.size>0&&n.currentFiles.size<=30&&n.commits.push(n.currentFiles),n.commits}catch{return[]}}c(ie,"parseGitLog");function ce(e){return/\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|java|cs|rb|php|vue|svelte)$/i.test(e)&&!e.includes("node_modules/")}c(ce,"isSourceFile");async function ae(e,t=100){let r=await ie(e,t),n=new Map,o=new Map;for(let m of r){let p=Array.from(m);for(let g of p)n.set(g,(n.get(g)||0)+1);for(let[g,f]of p.entries())for(let d of p.slice(g+1)){let h=le(f,d);o.set(h,(o.get(h)||0)+1)}}let i={};for(let[m,p]of o){let[g,f]=m.split("\0"),d=n.get(g)||0,h=n.get(f)||0;if(d<2||h<2)continue;let s=d+h-p,a=s>0?p/s:0;a<.1||(i[g]||(i[g]={}),i[f]||(i[f]={}),i[g][f]=a,i[f][g]=a)}return{matrix:i,commitsAnalyzed:r.length,filesAnalyzed:n.size,builtAt:new Date().toISOString()}}c(ae,"buildMatrix");function le(e,t){return e<t?`${e}\0${t}`:`${t}\0${e}`}c(le,"pairKey");function _(e,t){let r=new Set(e),n=new Map;for(let o of e){let i=t.matrix[o];if(i)for(let[m,p]of Object.entries(i)){if(r.has(m))continue;let g=n.get(m)||0;p>g&&n.set(m,p)}}return Array.from(n.entries()).map(([o,i])=>({path:o,score:i})).sort((o,i)=>i.score-o.score)}c(_,"scoreFromSeeds");var N="cochange-index",R=new Map;function me(e,t){w.setDoc(e,N,t),R.delete(e)}c(me,"saveMatrix");function F(e){let t=w.get(e,"SELECT updated_at FROM kv_store WHERE key = ?",N);if(!t)return R.delete(e),null;let r=R.get(e);if(r&&r.updatedAt===t.updated_at)return r.matrix;let n=w.getDoc(e,N);return n&&R.set(e,{matrix:n,updatedAt:t.updated_at}),n}c(F,"loadMatrix");async function ge(e,t){try{let{stdout:r}=await L(`git rev-list --max-count=${t} HEAD`,{cwd:e,maxBuffer:1048576}),n=r.split(`
10
10
  `).map(o=>o.trim()).filter(Boolean);return n.length>0?n.join(`
11
- `):null}catch{return null}}c(ge,"recentHistoryFingerprint");async function xe(e,t,r=100){let n=await ge(e,r),o=n?F(t):null;if(o?.historyFingerprint===n)return o;let i=await ae(e,r);return n&&(i.historyFingerprint=n),me(t,i),i}c(xe,"indexCoChanges");function E(e){if(e.length===0)return[];let t=e[0]?.score||1;return e.map(r=>({path:r.path,score:r.score/t}))}c(E,"normalize");var M=[{name:"bm25",kind:"query",defaultWeight:.45,hasIndex:c(e=>A(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(B(e,t,r)),"scoreFromQuery")},{name:"symbols",kind:"query",defaultWeight:.2,hasIndex:c(e=>H(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(z(e,t,r)),"scoreFromQuery")},{name:"imports",kind:"seed",defaultWeight:.2,hasIndex:c(e=>C(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t,r)=>{let n=C(e);return n?E(W(t,n,r.importDepth)):[]},"scoreFromSeeds")},{name:"cochange",kind:"seed",defaultWeight:.15,hasIndex:c(e=>F(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t)=>{let r=F(e);return r?E(_(t,r)):[]},"scoreFromSeeds")}];var pe={bm25Weight:.45,importWeight:.2,cochangeWeight:.15,symbolsWeight:.2,topN:15,importDepth:2},P=10;function Q(e,t,r={}){let n={...pe,...r},o={bm25:n.bm25Weight,symbols:n.symbolsWeight,imports:n.importWeight,cochange:n.cochangeWeight},i=M.filter(s=>s.kind==="query"),m=M.filter(s=>s.kind==="seed"),p=new Map,g=new Map;for(let s of i){let a=s.scoreFromQuery(e,t,n.topN*3);if(a.length!==0){p.set(s.name,new Map(a.map(u=>[u.path,u.score])));for(let u of a.slice(0,P))g.set(u.path,Math.max(g.get(u.path)??0,u.score))}}if(p.size===0)return[];let f=[...g.entries()].sort((s,a)=>a[1]-s[1]).slice(0,P).map(([s])=>s);for(let s of m){let a=s.scoreFromSeeds(e,f,{importDepth:n.importDepth});a.length!==0&&p.set(s.name,new Map(a.map(u=>[u.path,u.score])))}let d=new Set;for(let s of p.values())for(let a of s.keys())d.add(a);let h=[];for(let s of d){let a=[...p].reduce((u,[l,y])=>{let b=y.get(s)??0,k=o[l]??M.find(S=>S.name===l)?.defaultWeight??0;return u+b*k},0);h.push({path:s,finalScore:a,signals:{bm25:p.get("bm25")?.get(s)??0,imports:p.get("imports")?.get(s)??0,cochange:p.get("cochange")?.get(s)??0,symbols:p.get("symbols")?.get(s)??0}})}return h.sort((s,a)=>a.finalScore-s.finalScore),h.slice(0,n.topN)}c(Q,"rankFiles");function U(e){let t={};for(let r of M)t[r.name]=r.hasIndex(e);return{bm25:t.bm25??!1,imports:t.imports??!1,cochange:t.cochange??!1,symbols:t.symbols??!1}}c(U,"hasIndexes");function K(e,t,r=8){let n=t.map(s=>s.trim()).filter(Boolean),o=!!C(e),i=!!F(e),m=new Map;if(n.length>0&&o)try{for(let s of W(n,C(e),2)){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("imports"),m.set(s.path,a)}}catch{}if(n.length>0&&i)try{for(let s of _(n,F(e))){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("cochange"),m.set(s.path,a)}}catch{}let p=[...m.entries()].map(([s,a])=>({path:s,score:a.score,via:a.via.size>1?"both":[...a.via][0]??"imports"})).sort((s,a)=>a.score-s.score).slice(0,r),g=[];for(let s of n.slice(0,5))try{let a=I.recallForFile(e,s,2,{preventiveOnly:!0});for(let u of a)g.push({id:u.id,type:u.type,title:u.content.replace(/\s+/g," ").trim().slice(0,100),file:s})}catch{}let f=p.length>0?`related=${p.slice(0,3).map(s=>s.path.split("/").pop()).join(",")}`:o||i?"related=none-strong":"indexes=cold",d=g.length>0?`traps=${g.length}`:"traps=0",h=n.length===0?"World model: no seed files":`World model impact: seeds=${n.length} \xB7 ${f} \xB7 ${d}`;return{seeds:n,neighbors:p,traps:g.slice(0,r),line:h,hasIndexes:{imports:o,cochange:i}}}c(K,"breakImpact");var Y=8,X=/(?:^|[\s`"'(])((?:@?[\w.-]+\/)+[\w.-]+\.[\w.-]+)(?:$|[\s`"'),;:])/g;function Te(e,t,r=Y){let n=t.trim();if(!n)return ne();let o=V(e,n);return J(e,n,o,r)}c(Te,"resolveWorkScopeSync");async function De(e,t,r,n=Y){let o=r.trim();if(!o)return ne();let i=new Set(V(t,o));try{let{enrichedRecall:m}=await import("./enriched-recall-65X44HBM.mjs"),p=await m(e,t,{topic:o,types:["context","decision","gotcha","anti-pattern","learning"],limit:12});for(let g of Z(p,t))i.add(g)}catch{}return J(t,o,i,n)}c(De,"resolveWorkScope");function J(e,t,r,n){let o=U(e),i=new Map,m=T(e),p=D(e),g=c((l,y,b,k)=>{if(!v(e,l))return;let S=y*O(e,l),x=i.get(l);if(!x){i.set(l,{path:l,score:S,signals:[b],reason:k});return}x.score+=S,x.signals.includes(b)||x.signals.push(b),S>=.4&&(x.reason=k)},"bump");for(let l of r)g(l,ue(l,p),"memory","linked from project judgment memory (decision/gotcha/context)");let f=(()=>{if(!(o.bm25||o.symbols))return[];try{return Q(e,t,{topN:Math.max(n*2,12)})}catch{return[]}})();for(let l of f){let y=l.signals.symbols??0,b=[l.signals.bm25>0?"bm25":null,y>0?"symbols":null,l.signals.imports>0?"imports":null,l.signals.cochange>0?"cochange":null].filter(x=>x!==null),k=Math.max(l.signals.bm25,y,l.signals.imports,l.signals.cochange),S=y>=k&&y>0?"matches function/class/route symbols in code graph":l.signals.bm25>=l.signals.imports&&l.signals.bm25>=l.signals.cochange?"matches task terms in code index (BM25)":l.signals.imports>=l.signals.cochange?"import-graph neighbor of matched files":"historically co-changes with matched files";g(l.path,l.finalScore,b[0]??"bm25",S);for(let x of b.slice(1)){let $=i.get(l.path);$&&!$.signals.includes(x)&&$.signals.push(x)}}let d=f.length,h=[...i.keys()].slice(0,5);h.length===0&&r.size>0&&h.push(...[...r].slice(0,5));let s=(()=>{if(h.length===0)return null;try{return K(e,h,n)}catch{return null}})();if(s)for(let l of s.neighbors)g(l.path,.35*Math.min(1,l.score+.1),l.via==="both"?"imports":l.via,l.via==="cochange"?"historically co-changes with seed files":"import-graph neighbor of seed files");let a=s?.neighbors.length??0,u=[...i.values()].sort((l,y)=>y.score-l.score).slice(0,n);return{files:u,indexesReady:o.bm25||o.imports||o.cochange||o.symbols,sources:{memorySeeds:r.size,indexHits:d,graphNeighbors:a},agentBlock:fe(u,{indexesReady:o.bm25||o.imports||o.cochange||o.symbols,memorySeeds:r.size,inventoryLine:G(m)})}}c(J,"mergeScope");function V(e,t){let r=new Set;try{let n=t.split(/\s+/).filter(m=>m.length>2).slice(0,12),o=n.length>0?(()=>{try{return I.searchFts(e,n,15)}catch{return[]}})():[],i=o.length>0?o:I.recall(e,{types:["gotcha","decision","anti-pattern","context"],limit:20});for(let m of Z(i,e))r.add(m)}catch{}return r}c(V,"memoryFileSeedsSync");function Z(e,t){let r=new Set,n=c(o=>{let i=ee(o);i&&(t?v(t,i)&&r.add(i):te(i)&&r.add(i))},"accept");for(let o of e){let i=o.tags?.file?.trim();i&&n(i);let m=o.tags?.files?.trim();if(m)for(let g of m.split(",")){let f=g.trim();f&&n(f)}let p=o.content??"";X.lastIndex=0;for(let g of p.matchAll(X))n(g[1])}return[...r]}c(Z,"extractFilePathsFromEntries");function ee(e){return e.replace(/^\.\//,"").replace(/\\/g,"/")}c(ee,"normalizePath");function te(e){let t=ee(e).trim();return!t||t.length<3?!1:t.includes("/")&&t.includes(".")}c(te,"looksLikeRepoPath");function ue(e,t){let r=(e.split("/").pop()??e).toLowerCase(),n=r.includes(".")?`.${r.split(".").pop()}`:"";return r==="package.json"||r==="cargo.toml"||r==="go.mod"?.4:t.size>0&&n&&t.has(n)?e.includes("/")?.9:.75:e.includes("/")&&r.includes(".")?.7:.5}c(ue,"memorySeedWeight");function ne(){return{files:[],indexesReady:!1,sources:{memorySeeds:0,indexHits:0,graphNeighbors:0},agentBlock:""}}c(ne,"emptyResult");function fe(e,t){if(e.length===0)return t?.indexesReady===!1?["**Work scope (prjct):** indexes cold \u2014 run `prjct sync` once, then re-resolve scope.",t.inventoryLine?`_${t.inventoryLine}_`:"","Until then: prefer `prjct search` / `prjct context memory <topic>` over raw Grep/Glob walks."].filter(Boolean).join(`
11
+ `):null}catch{return null}}c(ge,"recentHistoryFingerprint");async function xe(e,t,r=100){let n=await ge(e,r),o=n?F(t):null;if(o?.historyFingerprint===n)return o;let i=await ae(e,r);return n&&(i.historyFingerprint=n),me(t,i),i}c(xe,"indexCoChanges");function E(e){if(e.length===0)return[];let t=e[0]?.score||1;return e.map(r=>({path:r.path,score:r.score/t}))}c(E,"normalize");var M=[{name:"bm25",kind:"query",defaultWeight:.45,hasIndex:c(e=>A(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(B(e,t,r)),"scoreFromQuery")},{name:"symbols",kind:"query",defaultWeight:.2,hasIndex:c(e=>H(e),"hasIndex"),scoreFromQuery:c((e,t,r)=>E(z(e,t,r)),"scoreFromQuery")},{name:"imports",kind:"seed",defaultWeight:.2,hasIndex:c(e=>C(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t,r)=>{let n=C(e);return n?E(W(t,n,r.importDepth)):[]},"scoreFromSeeds")},{name:"cochange",kind:"seed",defaultWeight:.15,hasIndex:c(e=>F(e)!==null,"hasIndex"),scoreFromSeeds:c((e,t)=>{let r=F(e);return r?E(_(t,r)):[]},"scoreFromSeeds")}];var pe={bm25Weight:.45,importWeight:.2,cochangeWeight:.15,symbolsWeight:.2,topN:15,importDepth:2},P=10;function Q(e,t,r={}){let n={...pe,...r},o={bm25:n.bm25Weight,symbols:n.symbolsWeight,imports:n.importWeight,cochange:n.cochangeWeight},i=M.filter(s=>s.kind==="query"),m=M.filter(s=>s.kind==="seed"),p=new Map,g=new Map;for(let s of i){let a=s.scoreFromQuery(e,t,n.topN*3);if(a.length!==0){p.set(s.name,new Map(a.map(u=>[u.path,u.score])));for(let u of a.slice(0,P))g.set(u.path,Math.max(g.get(u.path)??0,u.score))}}if(p.size===0)return[];let f=[...g.entries()].sort((s,a)=>a[1]-s[1]).slice(0,P).map(([s])=>s);for(let s of m){let a=s.scoreFromSeeds(e,f,{importDepth:n.importDepth});a.length!==0&&p.set(s.name,new Map(a.map(u=>[u.path,u.score])))}let d=new Set;for(let s of p.values())for(let a of s.keys())d.add(a);let h=[];for(let s of d){let a=[...p].reduce((u,[l,y])=>{let b=y.get(s)??0,k=o[l]??M.find(S=>S.name===l)?.defaultWeight??0;return u+b*k},0);h.push({path:s,finalScore:a,signals:{bm25:p.get("bm25")?.get(s)??0,imports:p.get("imports")?.get(s)??0,cochange:p.get("cochange")?.get(s)??0,symbols:p.get("symbols")?.get(s)??0}})}return h.sort((s,a)=>a.finalScore-s.finalScore),h.slice(0,n.topN)}c(Q,"rankFiles");function U(e){let t={};for(let r of M)t[r.name]=r.hasIndex(e);return{bm25:t.bm25??!1,imports:t.imports??!1,cochange:t.cochange??!1,symbols:t.symbols??!1}}c(U,"hasIndexes");function K(e,t,r=8){let n=t.map(s=>s.trim()).filter(Boolean),o=!!C(e),i=!!F(e),m=new Map;if(n.length>0&&o)try{for(let s of W(n,C(e),2)){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("imports"),m.set(s.path,a)}}catch{}if(n.length>0&&i)try{for(let s of _(n,F(e))){if(n.some(u=>u.endsWith(s.path)||s.path.endsWith(u)))continue;let a=m.get(s.path)??{score:0,via:new Set};a.score+=s.score,a.via.add("cochange"),m.set(s.path,a)}}catch{}let p=[...m.entries()].map(([s,a])=>({path:s,score:a.score,via:a.via.size>1?"both":[...a.via][0]??"imports"})).sort((s,a)=>a.score-s.score).slice(0,r),g=[];for(let s of n.slice(0,5))try{let a=I.recallForFile(e,s,2,{preventiveOnly:!0});for(let u of a)g.push({id:u.id,type:u.type,title:u.content.replace(/\s+/g," ").trim().slice(0,100),file:s})}catch{}let f=p.length>0?`related=${p.slice(0,3).map(s=>s.path.split("/").pop()).join(",")}`:o||i?"related=none-strong":"indexes=cold",d=g.length>0?`traps=${g.length}`:"traps=0",h=n.length===0?"World model: no seed files":`World model impact: seeds=${n.length} \xB7 ${f} \xB7 ${d}`;return{seeds:n,neighbors:p,traps:g.slice(0,r),line:h,hasIndexes:{imports:o,cochange:i}}}c(K,"breakImpact");var Y=8,X=/(?:^|[\s`"'(])((?:@?[\w.-]+\/)+[\w.-]+\.[\w.-]+)(?:$|[\s`"'),;:])/g;function Te(e,t,r=Y){let n=t.trim();if(!n)return ne();let o=V(e,n);return J(e,n,o,r)}c(Te,"resolveWorkScopeSync");async function De(e,t,r,n=Y){let o=r.trim();if(!o)return ne();let i=new Set(V(t,o));try{let{enrichedRecall:m}=await import("./enriched-recall-6ZZNKAJZ.mjs"),p=await m(e,t,{topic:o,types:["context","decision","gotcha","anti-pattern","learning"],limit:12});for(let g of Z(p,t))i.add(g)}catch{}return J(t,o,i,n)}c(De,"resolveWorkScope");function J(e,t,r,n){let o=U(e),i=new Map,m=T(e),p=D(e),g=c((l,y,b,k)=>{if(!v(e,l))return;let S=y*O(e,l),x=i.get(l);if(!x){i.set(l,{path:l,score:S,signals:[b],reason:k});return}x.score+=S,x.signals.includes(b)||x.signals.push(b),S>=.4&&(x.reason=k)},"bump");for(let l of r)g(l,ue(l,p),"memory","linked from project judgment memory (decision/gotcha/context)");let f=(()=>{if(!(o.bm25||o.symbols))return[];try{return Q(e,t,{topN:Math.max(n*2,12)})}catch{return[]}})();for(let l of f){let y=l.signals.symbols??0,b=[l.signals.bm25>0?"bm25":null,y>0?"symbols":null,l.signals.imports>0?"imports":null,l.signals.cochange>0?"cochange":null].filter(x=>x!==null),k=Math.max(l.signals.bm25,y,l.signals.imports,l.signals.cochange),S=y>=k&&y>0?"matches function/class/route symbols in code graph":l.signals.bm25>=l.signals.imports&&l.signals.bm25>=l.signals.cochange?"matches task terms in code index (BM25)":l.signals.imports>=l.signals.cochange?"import-graph neighbor of matched files":"historically co-changes with matched files";g(l.path,l.finalScore,b[0]??"bm25",S);for(let x of b.slice(1)){let $=i.get(l.path);$&&!$.signals.includes(x)&&$.signals.push(x)}}let d=f.length,h=[...i.keys()].slice(0,5);h.length===0&&r.size>0&&h.push(...[...r].slice(0,5));let s=(()=>{if(h.length===0)return null;try{return K(e,h,n)}catch{return null}})();if(s)for(let l of s.neighbors)g(l.path,.35*Math.min(1,l.score+.1),l.via==="both"?"imports":l.via,l.via==="cochange"?"historically co-changes with seed files":"import-graph neighbor of seed files");let a=s?.neighbors.length??0,u=[...i.values()].sort((l,y)=>y.score-l.score).slice(0,n);return{files:u,indexesReady:o.bm25||o.imports||o.cochange||o.symbols,sources:{memorySeeds:r.size,indexHits:d,graphNeighbors:a},agentBlock:fe(u,{indexesReady:o.bm25||o.imports||o.cochange||o.symbols,memorySeeds:r.size,inventoryLine:G(m)})}}c(J,"mergeScope");function V(e,t){let r=new Set;try{let n=t.split(/\s+/).filter(m=>m.length>2).slice(0,12),o=n.length>0?(()=>{try{return I.searchFts(e,n,15)}catch{return[]}})():[],i=o.length>0?o:I.recall(e,{types:["gotcha","decision","anti-pattern","context"],limit:20});for(let m of Z(i,e))r.add(m)}catch{}return r}c(V,"memoryFileSeedsSync");function Z(e,t){let r=new Set,n=c(o=>{let i=ee(o);i&&(t?v(t,i)&&r.add(i):te(i)&&r.add(i))},"accept");for(let o of e){let i=o.tags?.file?.trim();i&&n(i);let m=o.tags?.files?.trim();if(m)for(let g of m.split(",")){let f=g.trim();f&&n(f)}let p=o.content??"";X.lastIndex=0;for(let g of p.matchAll(X))n(g[1])}return[...r]}c(Z,"extractFilePathsFromEntries");function ee(e){return e.replace(/^\.\//,"").replace(/\\/g,"/")}c(ee,"normalizePath");function te(e){let t=ee(e).trim();return!t||t.length<3?!1:t.includes("/")&&t.includes(".")}c(te,"looksLikeRepoPath");function ue(e,t){let r=(e.split("/").pop()??e).toLowerCase(),n=r.includes(".")?`.${r.split(".").pop()}`:"";return r==="package.json"||r==="cargo.toml"||r==="go.mod"?.4:t.size>0&&n&&t.has(n)?e.includes("/")?.9:.75:e.includes("/")&&r.includes(".")?.7:.5}c(ue,"memorySeedWeight");function ne(){return{files:[],indexesReady:!1,sources:{memorySeeds:0,indexHits:0,graphNeighbors:0},agentBlock:""}}c(ne,"emptyResult");function fe(e,t){if(e.length===0)return t?.indexesReady===!1?["**Work scope (prjct):** indexes cold \u2014 run `prjct sync` once, then re-resolve scope.",t.inventoryLine?`_${t.inventoryLine}_`:"","Until then: prefer `prjct search` / `prjct context memory <topic>` over raw Grep/Glob walks."].filter(Boolean).join(`
12
12
  `):["**Work scope (prjct):** no high-confidence file hits for this query.",t?.inventoryLine?`_${t.inventoryLine}_`:"","MUST still try `prjct context memory <topic>` + `prjct search` before a broad Grep/Glob walk."].filter(Boolean).join(`
13
13
  `);let r=["**Work scope \u2014 prjct (MUST read before Grep/Glob):**","> Do NOT walk the tree. Open these first. Expand only via `prjct guard <file>` (graph neighbors + traps) or MCP `prjct_relevant_files` / `prjct_impact_analysis`.",...e.map(n=>{let o=n.signals.length>0?` (${n.signals.join("+")})`:"";return`- \`${n.path}\` \u2014 ${n.reason}${o}`})];return t?.memorySeeds&&t.memorySeeds>0&&r.push(`_Seeded from ${t.memorySeeds} memory path hit(s) + code index + graph._`),t?.inventoryLine&&r.push(`_${t.inventoryLine}_`),r.join(`
14
14
  `)}c(fe,"formatWorkScopeBlock");function Oe(e){return e.map(({path:t,signals:r,reason:n})=>({path:t,signals:r,reason:n}))}c(Oe,"toLikelyFileHits");function Ge(e,t){return t?v(t,e):te(e)}c(Ge,"isUsefulScopePath");export{F as a,xe as b,Te as c,De as d,Z as e,fe as f,Oe as g,Ge as h};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d}from"./chunk-UDUUEZD3.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-DYHYDHCW.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-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as CODEX_SKILL_MAX_BYTES,b as buildCodexSkillContent,c as installCodexSkill,d as verifyCodexPRouterReady};
8
+ import{a,b,c,d}from"./chunk-XEFIIDHM.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-DYHYDHCW.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-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as CODEX_SKILL_MAX_BYTES,b as buildCodexSkillContent,c as installCodexSkill,d as verifyCodexPRouterReady};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d}from"./chunk-YORSHLFH.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-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as CommandInstaller,d as default,c as getProviderPaths,a as installGlobalConfig};
8
+ import{a,b,c,d}from"./chunk-HBLR7BVG.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-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as CommandInstaller,d as default,c as getProviderPaths,a as installGlobalConfig};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as a}from"./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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as default};
8
+ import{b as a}from"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as default};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as t}from"./chunk-RNCLLUMK.mjs";import"./chunk-45I2C2UB.mjs";import{c as n}from"./chunk-L4COZ7ZH.mjs";import"./chunk-4KY2EHXS.mjs";import"./chunk-GJFWVCTS.mjs";import"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-ZZ65CN5F.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-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.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{a as o}from"./chunk-E66B27AL.mjs";function p(r=process.cwd(),e){return n({event:"CwdChanged",projectPath:r,build:o(async(d,i)=>{let c=d.cwd||i;return t(c)},"build")},e)}o(p,"runCwdChangedHook");export{p as runCwdChangedHook};
8
+ import{a as t}from"./chunk-UHW35BPE.mjs";import"./chunk-45I2C2UB.mjs";import{c as n}from"./chunk-L4COZ7ZH.mjs";import"./chunk-4KY2EHXS.mjs";import"./chunk-LPB3HUJ2.mjs";import"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-ZZ65CN5F.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function p(r=process.cwd(),e){return n({event:"CwdChanged",projectPath:r,build:o(async(d,i)=>{let c=d.cwd||i;return t(c)},"build")},e)}o(p,"runCwdChangedHook");export{p as runCwdChangedHook};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d,e}from"./chunk-GVJZPOG2.mjs";import"./chunk-JQLJM4BK.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-GVNMXVVA.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{b as buildDistillContent,d as distillAndDiscardAllAutoSources,c as distillAndDiscardAutoSource,e as eliminateSoftDeletedNoValue,a as hardDeleteEntries};
8
+ import{a,b,c,d,e}from"./chunk-PSP56GGF.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DGQYQSUK.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as buildDistillContent,d as distillAndDiscardAllAutoSources,c as distillAndDiscardAutoSource,e as eliminateSoftDeletedNoValue,a as hardDeleteEntries};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{c as y}from"./chunk-ZZ65CN5F.mjs";import{c as T}from"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import{a as g}from"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import{b as A}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{b}from"./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{b as _,e as M}from"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as x}from"./chunk-E66B27AL.mjs";var R=new Set(["decision","gotcha","learning","fact","feedback","spec"]);async function q(C,r,p={}){let{topic:c,types:i,tags:a}=p,l=p.limit??30,w=c?(()=>{let e=c.split(/\s+/).filter(Boolean);try{return g.searchFts(r,e,l).filter(t=>(!i||i.includes(t.type))&&(!a||M(t,a)))}catch{return[]}})():[],m=w.length>0?w:g.recall(r,{topic:c,types:i,tags:a,limit:l}).slice(0,l),d=(c?await(async()=>{try{let e=await b.readConfig(C);if(e&&T.isEnabled(e)){let n=await T.semanticSearch(r,c,e,10);if(n.length>0){let t=new Set(m.map(o=>o.id));return[...n.filter(o=>!t.has(o.id)&&(!i||i.includes(o.type))&&(!a||M(o,a))),...m].slice(0,l)}}return m}catch{return m}})():m).filter(e=>_(e)||(i?.includes(e.type)??!1)),h=i?.includes("improvement-signal")?d:await(async()=>{try{let{isAutoSource:e}=await import("./purge-IPK4NJN6.mjs"),n=45*864e5,t=Date.now(),u=d.filter(s=>{if(!e(s.tags?.source)||R.has(s.type)&&!e(s.tags?.source))return!0;let S=Date.parse(s.rememberedAt);return Number.isFinite(S)?t-S<n:!0}),o=u.filter(s=>!e(s.tags?.source)),O=u.filter(s=>e(s.tags?.source));return[...o,...O].slice(0,Math.max(l,u.length))}catch{return d}})(),f=h.length>1?y.rerank(r,h):h,k=p.expandLinks!==!1&&f.length>0?g.expandWithLinks(r,f,5):[],E=k.length>0?f.concat(k):f;try{let e=await A.getCurrentTask(r),n=new Date().toISOString();e?.id&&y.recordSurfaced(r,E.map(t=>t.id),e.id,n,{queryText:c,surface:"context-memory"});for(let t of E)y.recordFetch(r,t.id,n)}catch{}return E}x(q,"enrichedRecall");export{q as enrichedRecall};
8
+ import{c as y}from"./chunk-ZZ65CN5F.mjs";import{c as T}from"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import{a as g}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import{b as A}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{b}from"./chunk-W5OWBOLH.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{b as _,e as M}from"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as x}from"./chunk-E66B27AL.mjs";var R=new Set(["decision","gotcha","learning","fact","feedback","spec"]);async function q(C,r,p={}){let{topic:c,types:i,tags:a}=p,l=p.limit??30,w=c?(()=>{let e=c.split(/\s+/).filter(Boolean);try{return g.searchFts(r,e,l).filter(t=>(!i||i.includes(t.type))&&(!a||M(t,a)))}catch{return[]}})():[],m=w.length>0?w:g.recall(r,{topic:c,types:i,tags:a,limit:l}).slice(0,l),d=(c?await(async()=>{try{let e=await b.readConfig(C);if(e&&T.isEnabled(e)){let n=await T.semanticSearch(r,c,e,10);if(n.length>0){let t=new Set(m.map(o=>o.id));return[...n.filter(o=>!t.has(o.id)&&(!i||i.includes(o.type))&&(!a||M(o,a))),...m].slice(0,l)}}return m}catch{return m}})():m).filter(e=>_(e)||(i?.includes(e.type)??!1)),h=i?.includes("improvement-signal")?d:await(async()=>{try{let{isAutoSource:e}=await import("./purge-BDREPWEE.mjs"),n=45*864e5,t=Date.now(),u=d.filter(s=>{if(!e(s.tags?.source)||R.has(s.type)&&!e(s.tags?.source))return!0;let S=Date.parse(s.rememberedAt);return Number.isFinite(S)?t-S<n:!0}),o=u.filter(s=>!e(s.tags?.source)),O=u.filter(s=>e(s.tags?.source));return[...o,...O].slice(0,Math.max(l,u.length))}catch{return d}})(),f=h.length>1?y.rerank(r,h):h,k=p.expandLinks!==!1&&f.length>0?g.expandWithLinks(r,f,5):[],E=k.length>0?f.concat(k):f;try{let e=await A.getCurrentTask(r),n=new Date().toISOString();e?.id&&y.recordSurfaced(r,E.map(t=>t.id),e.id,n,{queryText:c,surface:"context-memory"});for(let t of E)y.recordFetch(r,t.id,n)}catch{}return E}x(q,"enrichedRecall");export{q as enrichedRecall};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d,e,f}from"./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-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.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 MACHINE_TAG_KEYS,d as deriveTitle,c as flatDetail,f as formatMemoryMd,e as linkifyMemRefs,b as preventiveLabel};
8
+ import{a,b,c,d,e,f}from"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as MACHINE_TAG_KEYS,d as deriveTitle,c as flatDetail,f as formatMemoryMd,e as linkifyMemRefs,b as preventiveLabel};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d,e,f,g,h,i}from"./chunk-GHBGBP2M.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{c as RECEIPT_CAPTURE,a as RECEIPT_SOURCE,b as RECEIPT_TOPIC,d as buildJudgmentReceipt,i as countReceiptsWritten,h as latestJudgmentReceipt24h,f as persistJudgmentReceipt,e as summarizeJudgmentReceipt,g as synthesizeJudgmentReceipt};
8
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-AEYONUUY.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{c as RECEIPT_CAPTURE,a as RECEIPT_SOURCE,b as RECEIPT_TOPIC,d as buildJudgmentReceipt,i as countReceiptsWritten,h as latestJudgmentReceipt24h,f as persistJudgmentReceipt,e as summarizeJudgmentReceipt,g as synthesizeJudgmentReceipt};
@@ -5,5 +5,5 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as d}from"./chunk-5TBQNW2G.mjs";import{h as f}from"./chunk-GHBGBP2M.mjs";import{a as p}from"./chunk-ZX2KFQV5.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.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-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{a as c}from"./chunk-E66B27AL.mjs";function j(n){return n?.land?.mode??"advisory"}c(j,"effectiveLandMode");async function L(n,m,u){let l=j(u);if(l==="off")return null;let t=await p(n,m).catch(()=>null),r=f(n);if(!t?.current&&!r)return null;let e=[];if(t?.current){let i=t.current.description.slice(0,60),s=t.current.isCurrent?await import("./state-storage-KNGP2CQV.mjs").then(({stateStorage:g})=>g.getCurrentTask(n)).catch(()=>null):null,o=d(u,{description:t.current.description,turnCount:s?.turnCount,tokensIn:s?.tokensIn,tokensOut:s?.tokensOut}),a=l==="strict"||o.level==="critical"||o.level==="warn",h=a?"# prjct: LAND REQUIRED before context dies":"# prjct: land the plane";e.push(h,`Open cycle: "${i}${t.current.description.length>60?"\u2026":""}"`,a?'Before ending the session: `prjct status done` or `prjct log "\u2026"`, then `prjct land` (auto-synthesizes the Session close hand-off \u2014 no manual remember). Next window: `prjct prime`.':"Before ending the session: `prjct land` (auto hand-off + judgment receipt) \xB7 optional `prjct memory export` for the team."),o.cue&&e.push("",o.cue)}if(r){e.length>0&&e.push("");let i=r.trapCount>0?`${r.trapCount} trap(s) re-surfaced last session`:"judgment continuity landed last session";e.push("# prjct: prior judgment receipt (24h)",`${i} \xB7 \`${r.id}\` \u2014 closed-loop proof, not bulk memory. \`prjct search "judgment-receipt"\` if you need the full receipt.`)}return e.length>0?e.join(`
8
+ import{a as d}from"./chunk-5TBQNW2G.mjs";import{h as f}from"./chunk-AEYONUUY.mjs";import{a as p}from"./chunk-ZX2KFQV5.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.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-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";function j(n){return n?.land?.mode??"advisory"}c(j,"effectiveLandMode");async function L(n,m,u){let l=j(u);if(l==="off")return null;let t=await p(n,m).catch(()=>null),r=f(n);if(!t?.current&&!r)return null;let e=[];if(t?.current){let i=t.current.description.slice(0,60),s=t.current.isCurrent?await import("./state-storage-KNGP2CQV.mjs").then(({stateStorage:g})=>g.getCurrentTask(n)).catch(()=>null):null,o=d(u,{description:t.current.description,turnCount:s?.turnCount,tokensIn:s?.tokensIn,tokensOut:s?.tokensOut}),a=l==="strict"||o.level==="critical"||o.level==="warn",h=a?"# prjct: LAND REQUIRED before context dies":"# prjct: land the plane";e.push(h,`Open cycle: "${i}${t.current.description.length>60?"\u2026":""}"`,a?'Before ending the session: `prjct status done` or `prjct log "\u2026"`, then `prjct land` (auto-synthesizes the Session close hand-off \u2014 no manual remember). Next window: `prjct prime`.':"Before ending the session: `prjct land` (auto hand-off + judgment receipt) \xB7 optional `prjct memory export` for the team."),o.cue&&e.push("",o.cue)}if(r){e.length>0&&e.push("");let i=r.trapCount>0?`${r.trapCount} trap(s) re-surfaced last session`:"judgment continuity landed last session";e.push("# prjct: prior judgment receipt (24h)",`${i} \xB7 \`${r.id}\` \u2014 closed-loop proof, not bulk memory. \`prjct search "judgment-receipt"\` if you need the full receipt.`)}return e.length>0?e.join(`
9
9
  `):null}c(L,"buildLandCue");export{L as buildLandCue,j as effectiveLandMode};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b}from"./chunk-CULYIJJZ.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{b as buildLandHandoffContent,a as synthesizeLandHandoff};
8
+ import{a,b}from"./chunk-YG7KBQYJ.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as buildLandHandoffContent,a as synthesizeLandHandoff};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as N}from"./chunk-7SI6X3Z7.mjs";import{a as A}from"./chunk-DYHYDHCW.mjs";import{e as f,g as x}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b,e as te}from"./chunk-AKIN5WSQ.mjs";import{a as z,f as ne}from"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import{c as R}from"./chunk-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";import m from"node:fs/promises";import u from"node:path";ne();import{z as _}from"zod";te();x();var D="crew:checkpoints",Q="crew/CHECKPOINTS.md",re=_.object({content:_.string(),source:_.enum(["default","user","migrated"]),updated_at:_.string().min(1)});function se(){let t=R(Q);if(!t)throw new Error(`Missing bundled crew checkpoints template: ${Q}`);return t}l(se,"getBundledDefault");var F=class{static{l(this,"CheckpointsStorage")}get(n){let e=f.getDoc(n,D);return e===null?{content:se(),source:"default",updated_at:b()}:re.parse(e)}hasCustomization(n){return f.hasDoc(n,D)}set(n,e,r="user"){let o={content:e,source:r,updated_at:b()};return f.setDoc(n,D,o),o}reset(n){f.deleteDoc(n,D)}},ie=new F,E=ie;x();x();import{z as S}from"zod";var M="team:enrollment",q=S.object({required:S.boolean(),minVersion:S.string().min(1),enrolledAt:S.string().min(1),enrolledBy:S.string().nullable().default(null)}),I=class{static{l(this,"TeamEnrollmentStorage")}get(n){let e=f.getDoc(n,M);return e===null?null:q.parse(e)}set(n,e){let r=q.parse(e);f.setDoc(n,M,r)}clear(n){f.deleteDoc(n,M)}};var oe=new I,C=oe;var P=".prjct/CHECKPOINTS.md",L=".prjct/team.json",$="migration:v2.19.8:last-flagged-checkpoints",H="migration:v2.19.8:last-flagged-team",O="migration:v3.77:last-ghost-purge-warn",Y="migration:v3.77:last-agent-repair-warn",ae=["sessions","audits","deploy"],ce=[/\.prjct\/sessions\/<task/i,/\.prjct\/sessions\/\$\{/i,/->\s*`?\.prjct\/sessions\//i,/write(?:s|n)?\s+(?:a\s+)?(?:plan|report|results?|verdict|findings?)[^\n]{0,120}\.prjct\/sessions\//i,/write(?:s|n)?\s+its\s+results[^\n]{0,80}\.prjct\/sessions\//i,/Session artifacts at `?\.prjct\/sessions\//i,/Implementer report at `?\.prjct\/sessions\//i,/Reviewer verdict at `?\.prjct\/sessions\//i,/\.prjct\/audits\//i,/\.prjct\/deploy\//i,/SESSION_ROOT\s*=/i,/Write under `?SESSION_ROOT/i,/~\/\.prjct-cli\/projects\/[^\s`]+\/sessions\//i,/sessions\/<task-slug>\/\{?plan/i],He=[".prjct/sessions/<task",".prjct/audits/",".prjct/deploy/"],le=N.map(t=>({destRelative:`.claude/agents/${t.name}.md`,templateKey:`crew/roles/${t.name}.md`})),v="CLAUDE.md",W="CREW.md",ge="crew/leader-mode.md",K="<!-- prjct:crew:start - DO NOT REMOVE THIS MARKER -->",U="<!-- prjct:crew:end - DO NOT REMOVE THIS MARKER -->",G="<!-- prjct:crew:end -->",X="<!-- prjct:checkpoints:start - DO NOT EDIT (managed by `prjct crew checkpoints set|reset`) -->",de="<!-- prjct:checkpoints:end -->",pe=["prjct.config.json","memory-export"];async function ee(t){try{return(await m.stat(t)).mtimeMs}catch{return null}}l(ee,"statMtimeMs");async function k(t){try{return await m.readFile(t,"utf-8")}catch{return null}}l(k,"tryReadFile");async function J(t){try{return await m.access(t),!0}catch{return!1}}l(J,"pathExists");function j(t,n){return f.getDoc(t,n)}l(j,"readFlag");function w(t,n,e){f.setDoc(t,n,{mtime_ms:e,migrated_at:new Date().toISOString()})}l(w,"writeFlag");async function y(t,n,e){try{let{projectMemory:r}=await import("./project-memory-KRA3BH7A.mjs");await r.remember(t,{type:"inbox",content:n,tags:e,provenance:"declared"})}catch(r){A.debug("Legacy sweep inbox capture failed (non-critical)",{error:r instanceof Error?r.message:String(r)})}}l(y,"captureInboxWarning");function T(t){return ce.some(n=>n.test(t))}l(T,"containsForbiddenWriteInstruction");function me(t,n){let e=N.find(o=>`.claude/agents/${o.name}.md`===n)?.role;if(!e)return t;let{model:r}=z(e);return t.replace(/^model:[ \t].*$/m,`model: ${r}`)}l(me,"stampCrewModelPolicy");function ue(t,n){let e=t.indexOf(X),r=t.indexOf(de);if(e<0||r<0||r<e)return t;let o=t.slice(0,e+X.length),c=t.slice(r);return`${o}
8
+ import{a as N}from"./chunk-7SI6X3Z7.mjs";import{a as A}from"./chunk-DYHYDHCW.mjs";import{e as f,g as x}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b,e as te}from"./chunk-AKIN5WSQ.mjs";import{a as z,f as ne}from"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import{c as R}from"./chunk-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";import m from"node:fs/promises";import u from"node:path";ne();import{z as _}from"zod";te();x();var D="crew:checkpoints",Q="crew/CHECKPOINTS.md",re=_.object({content:_.string(),source:_.enum(["default","user","migrated"]),updated_at:_.string().min(1)});function se(){let t=R(Q);if(!t)throw new Error(`Missing bundled crew checkpoints template: ${Q}`);return t}l(se,"getBundledDefault");var F=class{static{l(this,"CheckpointsStorage")}get(n){let e=f.getDoc(n,D);return e===null?{content:se(),source:"default",updated_at:b()}:re.parse(e)}hasCustomization(n){return f.hasDoc(n,D)}set(n,e,r="user"){let o={content:e,source:r,updated_at:b()};return f.setDoc(n,D,o),o}reset(n){f.deleteDoc(n,D)}},ie=new F,E=ie;x();x();import{z as S}from"zod";var M="team:enrollment",q=S.object({required:S.boolean(),minVersion:S.string().min(1),enrolledAt:S.string().min(1),enrolledBy:S.string().nullable().default(null)}),I=class{static{l(this,"TeamEnrollmentStorage")}get(n){let e=f.getDoc(n,M);return e===null?null:q.parse(e)}set(n,e){let r=q.parse(e);f.setDoc(n,M,r)}clear(n){f.deleteDoc(n,M)}};var oe=new I,C=oe;var P=".prjct/CHECKPOINTS.md",L=".prjct/team.json",$="migration:v2.19.8:last-flagged-checkpoints",H="migration:v2.19.8:last-flagged-team",O="migration:v3.77:last-ghost-purge-warn",Y="migration:v3.77:last-agent-repair-warn",ae=["sessions","audits","deploy"],ce=[/\.prjct\/sessions\/<task/i,/\.prjct\/sessions\/\$\{/i,/->\s*`?\.prjct\/sessions\//i,/write(?:s|n)?\s+(?:a\s+)?(?:plan|report|results?|verdict|findings?)[^\n]{0,120}\.prjct\/sessions\//i,/write(?:s|n)?\s+its\s+results[^\n]{0,80}\.prjct\/sessions\//i,/Session artifacts at `?\.prjct\/sessions\//i,/Implementer report at `?\.prjct\/sessions\//i,/Reviewer verdict at `?\.prjct\/sessions\//i,/\.prjct\/audits\//i,/\.prjct\/deploy\//i,/SESSION_ROOT\s*=/i,/Write under `?SESSION_ROOT/i,/~\/\.prjct-cli\/projects\/[^\s`]+\/sessions\//i,/sessions\/<task-slug>\/\{?plan/i],He=[".prjct/sessions/<task",".prjct/audits/",".prjct/deploy/"],le=N.map(t=>({destRelative:`.claude/agents/${t.name}.md`,templateKey:`crew/roles/${t.name}.md`})),v="CLAUDE.md",W="CREW.md",ge="crew/leader-mode.md",K="<!-- prjct:crew:start - DO NOT REMOVE THIS MARKER -->",U="<!-- prjct:crew:end - DO NOT REMOVE THIS MARKER -->",G="<!-- prjct:crew:end -->",X="<!-- prjct:checkpoints:start - DO NOT EDIT (managed by `prjct crew checkpoints set|reset`) -->",de="<!-- prjct:checkpoints:end -->",pe=["prjct.config.json","memory-export"];async function ee(t){try{return(await m.stat(t)).mtimeMs}catch{return null}}l(ee,"statMtimeMs");async function k(t){try{return await m.readFile(t,"utf-8")}catch{return null}}l(k,"tryReadFile");async function J(t){try{return await m.access(t),!0}catch{return!1}}l(J,"pathExists");function j(t,n){return f.getDoc(t,n)}l(j,"readFlag");function w(t,n,e){f.setDoc(t,n,{mtime_ms:e,migrated_at:new Date().toISOString()})}l(w,"writeFlag");async function y(t,n,e){try{let{projectMemory:r}=await import("./project-memory-ZVZSLPB5.mjs");await r.remember(t,{type:"inbox",content:n,tags:e,provenance:"declared"})}catch(r){A.debug("Legacy sweep inbox capture failed (non-critical)",{error:r instanceof Error?r.message:String(r)})}}l(y,"captureInboxWarning");function T(t){return ce.some(n=>n.test(t))}l(T,"containsForbiddenWriteInstruction");function me(t,n){let e=N.find(o=>`.claude/agents/${o.name}.md`===n)?.role;if(!e)return t;let{model:r}=z(e);return t.replace(/^model:[ \t].*$/m,`model: ${r}`)}l(me,"stampCrewModelPolicy");function ue(t,n){let e=t.indexOf(X),r=t.indexOf(de);if(e<0||r<0||r<e)return t;let o=t.slice(0,e+X.length),c=t.slice(r);return`${o}
9
9
  ${n.trimEnd()}
10
10
  ${c}`}l(ue,"spliceCheckpoints");function fe(t,n){let e=l(c=>{let i=c.indexOf(K);if(i<0)return c;let a=c.slice(i+K.length),s=a.indexOf(U),d=a.indexOf(G),g=s>=0&&(d<0||s<=d)?{relative:s,length:U.length}:d>=0?{relative:d,length:G.length}:null;if(!g)return c.slice(0,i);let p=i+K.length+g.relative;return e(`${c.slice(0,i)}${c.slice(p+g.length)}`)},"stripMarkerBlocks"),r=e(t).replace(/\n{3,}/g,`
11
11
 
@@ -20,5 +20,5 @@ ${c}`}l(ue,"spliceCheckpoints");function fe(t,n){let e=l(c=>{let i=c.indexOf(K);
20
20
  `:t}l(Z,"sanitizeCheckpointsContent");async function we(t,n,e){let r=u.join(t,P),o=await ee(r);if(o===null)return;let c=j(n,$),i=await k(r);if(i!==null)try{c===null?(E.set(n,i,"migrated"),w(n,$,o),e.checkpointsMigrated=!0,await y(t,"Legacy .prjct/CHECKPOINTS.md migrated into kv_store crew:checkpoints and DELETED from the client worktree. Manage with 'prjct crew checkpoints show|set|reset|export'. Product law: nothing but prjct.config.json under client .prjct/.",{"migration:v3.79":"1",topic:"crew-checkpoints"})):o>c.mtime_ms&&(E.set(n,i,"migrated"),w(n,$,o),e.checkpointsHandEditWarned=!0,await y(t,"Legacy .prjct/CHECKPOINTS.md hand-edited after migration \u2014 content re-adopted into kv_store and file DELETED. Prefer 'prjct crew checkpoints set' going forward.",{"migration:v3.79":"1",topic:"crew-checkpoints",state:"re-adopted"}))}catch(a){e.errors.push({file:P,reason:a instanceof Error?a.message:String(a)})}try{await m.rm(r,{force:!0}),e.clientPrjctJunkPurged.push("CHECKPOINTS.md")}catch(a){e.errors.push({file:P,reason:a instanceof Error?a.message:String(a)})}}l(we,"sweepCheckpoints");async function he(t,n,e){let r=u.join(t,L),o=await ee(r);if(o===null)return;let c=j(n,H),i=C.get(n),a=await k(r);if(a!==null)try{if(c===null||i===null){if(i===null){let s=JSON.parse(a),d={required:s.required===!0,minVersion:typeof s.minVersion=="string"?s.minVersion:"0.0.0",enrolledAt:typeof s.enrolledAt=="string"?s.enrolledAt:new Date().toISOString(),enrolledBy:typeof s.enrolledBy=="string"?s.enrolledBy:null};C.set(n,d),e.teamMigrated=!0,await y(t,"Legacy .prjct/team.json adopted into kv_store team:enrollment and DELETED from the client worktree. Team state is SQL-only; manage with 'prjct team'.",{"migration:v3.79":"1",topic:"team-enrollment"})}w(n,H,o)}else if(o>c.mtime_ms){try{let s=JSON.parse(a),d={required:s.required===!0,minVersion:typeof s.minVersion=="string"?s.minVersion:"0.0.0",enrolledAt:typeof s.enrolledAt=="string"?s.enrolledAt:new Date().toISOString(),enrolledBy:typeof s.enrolledBy=="string"?s.enrolledBy:null};C.set(n,d)}catch{}w(n,H,o),e.teamHandEditWarned=!0}}catch(s){e.errors.push({file:L,reason:s instanceof Error?s.message:String(s)})}try{await m.rm(r,{force:!0}),e.clientPrjctJunkPurged.push("team.json")}catch(s){e.errors.push({file:L,reason:s instanceof Error?s.message:String(s)})}}l(he,"sweepTeamJson");async function V(t){let n=[],e=await m.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let r of e){let o=u.join(t,r.name);r.isDirectory()?n.push(...await V(o)):r.isFile()&&n.push(o)}return n}l(V,"listFilesRecursive");async function B(t,n,e,r){let o=new Set([".md",".txt",".json",".yml",".yaml",".toml",".csv",".log"]),c=u.extname(e).toLowerCase();if(!o.has(c)&&c!=="")return!1;let i=await m.readFile(e).then(g=>{if(g.byteLength>2e5)return null;let p=g.toString("utf-8");return p.includes("\0")?null:p}).catch(()=>null);if(i===null||!i.trim())return!1;let a=12e3,s=i.length>a?`${i.slice(0,a)}
21
21
 
22
22
  \u2026[truncated ${i.length-a} chars]`:i,d=["Rescued worktree ghost (physical files are not traceable \u2014 ingested to SQLite, disk deleted).",`source: ${r}`,"",s].join(`
23
- `);try{let{projectMemory:g}=await import("./project-memory-KRA3BH7A.mjs");return await g.remember(t,{type:"context",content:d,tags:{topic:"worktree-ghost-ingest",source_path:r,"migration:v3.77":"1"},provenance:"declared",projectId:n,force:!0}),!0}catch(g){return A.debug("Ghost file SQL ingest failed (non-critical)",{file:r,error:g instanceof Error?g.message:String(g)}),!1}}l(B,"ingestGhostFileToSql");async function Ee(t,n,e){let r=u.join(t,".prjct");if(!await J(r))return;for(let c of ae){let i=u.join(r,c);if(await J(i))try{let a=await V(i);for(let s of a){let d=u.relative(t,s);await B(t,n,s,d)&&(e.ghostFilesIngested+=1)}await m.rm(i,{recursive:!0,force:!0}),e.ghostDirsPurged.push(c)}catch(a){e.errors.push({file:`.prjct/${c}/`,reason:a instanceof Error?a.message:String(a)})}}if(e.ghostDirsPurged.length===0)return;if(j(n,O)===null){let c=e.ghostFilesIngested>0?` ${e.ghostFilesIngested} text file(s) ingested into SQLite (topic:worktree-ghost-ingest) for traceability.`:"";await y(t,`Purged forbidden prjct ghost dir(s) from the customer worktree: ${e.ghostDirsPurged.map(i=>`.prjct/${i}/`).join(", ")}.${c} Product law: plans and work data live ONLY in project SQLite (prjct plan / prjct spec / prjct remember / prjct crew record-run) \u2014 never as physical files in the repo or under ~/.prjct-cli. The only hand-editable file under .prjct/ is prjct.config.json.`,{"migration:v3.77":"1",topic:"worktree-ghost-purge"}),w(n,O,Date.now())}}l(Ee,"purgeWorktreeGhostDirs");async function ye(t,n,e){try{let s=E.get(n),d=Z(s.content);if(d!==s.content){let g=s.source==="user"?"user":"migrated";E.set(n,d,g),e.agentFilesRepaired.push("kv_store[crew:checkpoints]")}}catch(s){e.errors.push({file:"kv_store[crew:checkpoints]",reason:s instanceof Error?s.message:String(s)})}for(let s of le){let d=u.join(t,s.destRelative),g=await k(d);if(g===null||!T(g))continue;let p=R(s.templateKey);if(!p){e.errors.push({file:s.destRelative,reason:"template missing"});continue}try{let h=me(s.destRelative===".claude/agents/reviewer.md"?ue(p,Z(E.get(n).content)):p,s.destRelative);await m.mkdir(u.dirname(d),{recursive:!0}),await m.writeFile(d,h,"utf-8"),e.agentFilesRepaired.push(s.destRelative)}catch(h){e.errors.push({file:s.destRelative,reason:h instanceof Error?h.message:String(h)})}}let r=u.join(t,v),o=await k(r);if(o!==null){let s=(o.match(/prjct:crew:start/g)??[]).length;if(T(o)||s>1||o.includes(G)){let g=R(ge)?.trim();if(!g)e.errors.push({file:v,reason:"leader-mode template missing"});else try{let p=fe(o,g);await m.writeFile(r,p,"utf-8"),e.agentFilesRepaired.push(v)}catch(p){e.errors.push({file:v,reason:p instanceof Error?p.message:String(p)})}}}let c=u.join(t,W),i=await k(c);if(i!==null&&T(i))try{let s=["# CREW.md \u2014 reinstall required","","This file previously instructed agents to write plans/reports under","`.prjct/sessions/` (or other worktree paths). That is forbidden.","","Run `prjct crew install` to regenerate the emulated crew protocol.","Durable state goes through `prjct` CLI verbs only (SQLite).",""].join(`
23
+ `);try{let{projectMemory:g}=await import("./project-memory-ZVZSLPB5.mjs");return await g.remember(t,{type:"context",content:d,tags:{topic:"worktree-ghost-ingest",source_path:r,"migration:v3.77":"1"},provenance:"declared",projectId:n,force:!0}),!0}catch(g){return A.debug("Ghost file SQL ingest failed (non-critical)",{file:r,error:g instanceof Error?g.message:String(g)}),!1}}l(B,"ingestGhostFileToSql");async function Ee(t,n,e){let r=u.join(t,".prjct");if(!await J(r))return;for(let c of ae){let i=u.join(r,c);if(await J(i))try{let a=await V(i);for(let s of a){let d=u.relative(t,s);await B(t,n,s,d)&&(e.ghostFilesIngested+=1)}await m.rm(i,{recursive:!0,force:!0}),e.ghostDirsPurged.push(c)}catch(a){e.errors.push({file:`.prjct/${c}/`,reason:a instanceof Error?a.message:String(a)})}}if(e.ghostDirsPurged.length===0)return;if(j(n,O)===null){let c=e.ghostFilesIngested>0?` ${e.ghostFilesIngested} text file(s) ingested into SQLite (topic:worktree-ghost-ingest) for traceability.`:"";await y(t,`Purged forbidden prjct ghost dir(s) from the customer worktree: ${e.ghostDirsPurged.map(i=>`.prjct/${i}/`).join(", ")}.${c} Product law: plans and work data live ONLY in project SQLite (prjct plan / prjct spec / prjct remember / prjct crew record-run) \u2014 never as physical files in the repo or under ~/.prjct-cli. The only hand-editable file under .prjct/ is prjct.config.json.`,{"migration:v3.77":"1",topic:"worktree-ghost-purge"}),w(n,O,Date.now())}}l(Ee,"purgeWorktreeGhostDirs");async function ye(t,n,e){try{let s=E.get(n),d=Z(s.content);if(d!==s.content){let g=s.source==="user"?"user":"migrated";E.set(n,d,g),e.agentFilesRepaired.push("kv_store[crew:checkpoints]")}}catch(s){e.errors.push({file:"kv_store[crew:checkpoints]",reason:s instanceof Error?s.message:String(s)})}for(let s of le){let d=u.join(t,s.destRelative),g=await k(d);if(g===null||!T(g))continue;let p=R(s.templateKey);if(!p){e.errors.push({file:s.destRelative,reason:"template missing"});continue}try{let h=me(s.destRelative===".claude/agents/reviewer.md"?ue(p,Z(E.get(n).content)):p,s.destRelative);await m.mkdir(u.dirname(d),{recursive:!0}),await m.writeFile(d,h,"utf-8"),e.agentFilesRepaired.push(s.destRelative)}catch(h){e.errors.push({file:s.destRelative,reason:h instanceof Error?h.message:String(h)})}}let r=u.join(t,v),o=await k(r);if(o!==null){let s=(o.match(/prjct:crew:start/g)??[]).length;if(T(o)||s>1||o.includes(G)){let g=R(ge)?.trim();if(!g)e.errors.push({file:v,reason:"leader-mode template missing"});else try{let p=fe(o,g);await m.writeFile(r,p,"utf-8"),e.agentFilesRepaired.push(v)}catch(p){e.errors.push({file:v,reason:p instanceof Error?p.message:String(p)})}}}let c=u.join(t,W),i=await k(c);if(i!==null&&T(i))try{let s=["# CREW.md \u2014 reinstall required","","This file previously instructed agents to write plans/reports under","`.prjct/sessions/` (or other worktree paths). That is forbidden.","","Run `prjct crew install` to regenerate the emulated crew protocol.","Durable state goes through `prjct` CLI verbs only (SQLite).",""].join(`
24
24
  `);await m.writeFile(c,s,"utf-8"),e.agentFilesRepaired.push(W)}catch(s){e.errors.push({file:W,reason:s instanceof Error?s.message:String(s)})}if(e.agentFilesRepaired.length===0)return;j(n,Y)===null&&(await y(t,`Repaired crew instruction files that still told agents to write plans/reports to disk (${e.agentFilesRepaired.join(", ")}). Refreshed from current prjct templates. Product law: plans + work data ONLY in project SQLite via prjct plan / prjct spec / prjct remember / prjct crew record-run \u2014 physical files are not traceable.`,{"migration:v3.77":"1",topic:"crew-disk-write-repair"}),w(n,Y,Date.now()))}l(ye,"repairCrewDiskWriteInstructions");async function Re(t,n,e){let r=u.join(t,".prjct");if(!await J(r))return;let o=await m.readdir(r).catch(()=>[]);for(let i of o){if(pe.includes(i))continue;let a=u.join(r,i);try{let s=await m.stat(a);if(s.isDirectory()){let d=await V(a);for(let g of d){let p=u.relative(t,g);await B(t,n,g,p)&&(e.ghostFilesIngested+=1)}}else if(s.isFile()){let d=u.relative(t,a);i!=="CHECKPOINTS.md"&&i!=="team.json"&&await B(t,n,a,d)&&(e.ghostFilesIngested+=1)}await m.rm(a,{recursive:!0,force:!0}),e.clientPrjctJunkPurged.includes(i)||e.clientPrjctJunkPurged.push(i)}catch(s){e.errors.push({file:`.prjct/${i}`,reason:s instanceof Error?s.message:String(s)})}}if(e.clientPrjctJunkPurged.length===0)return;j(n,O)===null&&e.ghostDirsPurged.length===0&&(await y(t,`Client .prjct/ cleaned to config-only. Removed: ${e.clientPrjctJunkPurged.join(", ")}. Durable state is SQLite only (prjct crew checkpoints / prjct team / prjct remember).`,{"migration:v3.79":"1",topic:"client-prjct-config-only"}),w(n,O,Date.now()))}l(Re,"enforcePrjctConfigOnly");async function We(t,n){let e={checkpointsMigrated:!1,checkpointsHandEditWarned:!1,teamMigrated:!1,teamHandEditWarned:!1,ghostDirsPurged:[],agentFilesRepaired:[],ghostFilesIngested:0,clientPrjctJunkPurged:[],errors:[]};return await we(t,n,e).catch(r=>{e.errors.push({file:P,reason:r instanceof Error?r.message:String(r)})}),await he(t,n,e).catch(r=>{e.errors.push({file:L,reason:r instanceof Error?r.message:String(r)})}),await Ee(t,n,e).catch(r=>{e.errors.push({file:".prjct/*/",reason:r instanceof Error?r.message:String(r)})}),await Re(t,n,e).catch(r=>{e.errors.push({file:".prjct/",reason:r instanceof Error?r.message:String(r)})}),await ye(t,n,e).catch(r=>{e.errors.push({file:".claude/agents/*",reason:r instanceof Error?r.message:String(r)})}),e}l(We,"legacyCrewSweep");export{pe as CLIENT_PRJCT_ALLOWLIST,He as FORBIDDEN_WORKTREE_WRITE_NEEDLES,ce as FORBIDDEN_WORKTREE_WRITE_PATTERNS,ae as WORKTREE_GHOST_DIRS,T as containsForbiddenWriteInstruction,We as legacyCrewSweep};
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as L}from"./chunk-4KY2EHXS.mjs";import"./chunk-54LH63LM.mjs";import{c as v}from"./chunk-ZZ65CN5F.mjs";import{d as b}from"./chunk-JQLJM4BK.mjs";import"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a}from"./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-GVNMXVVA.mjs";import"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import{d as g,g as D}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as M,e as k}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{b as h}from"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";D();k();var E="memory:l0-index",$=4e3,R=1440*60*1e3,j=3,A=4,T=2,S=["decision","gotcha","anti-pattern","learning","fact","feedback"];function F(t){try{let r=C(t);return r?(g.setDoc(t.projectId,E,r),r):null}catch{return null}}l(F,"buildAndStoreMemoryL0Index");function C(t){let r=a.allEntriesForIndex(t.projectId).filter(e=>h(e)||e.type==="inbox"||e.type==="improvement-signal");if(r.length===0)return null;let n={};for(let e of r)n[e.type]=(n[e.type]??0)+1;if(r.filter(e=>e.type!=="improvement-signal"&&h(e)).length===0&&(n.inbox??0)===0)return null;let o=["## What this project already knows","","> Carried across sessions and model updates \u2014 this survived even if your conversation context did not. Apply these; do not re-derive from source.","",`_L0 index \xB7 live=${r.length} \xB7 pull L2: \`prjct search\` / \`prjct context memory <topic>\` / \`prjct guard <file>\`_`,""],m=new Set;try{let e=a.recall(t.projectId,{types:["feedback","improvement-signal"],limit:40,dedupeByKey:!1}),d=L(e,A);if(d.length>0){o.push("**How this developer works (act as them):**");for(let u of d){let w=u.rule.length>140?`${u.rule.slice(0,139)}\u2026`:u.rule;o.push(`- ${w} \`${u.sourceId}\``)}o.push("")}}catch{}let f=[{title:"Traps to avoid",types:["gotcha","anti-pattern"],suppressMiss:!0},{title:"Decisions in force",types:["decision"],suppressMiss:!0},{title:"Learnings",types:["learning"]},{title:"Facts",types:["fact"]}];for(let e of f){let d=v.rerank(t.projectId,a.recall(t.projectId,{types:e.types,limit:j*4})).slice(0,j);if(d.length!==0){o.push(`**${e.title}:**`);for(let u of d)o.push(`- ${I(u)}`),e.suppressMiss&&m.add(u.id);o.push("")}}let p=P(t.projectId,m);p&&o.push("**Keeps being missed:**",`- ${I(p.entry)} \u2014 flagged relevant-but-unused ${p.count}\xD7. Apply it or supersede it.`,"");let c=r.filter(e=>e.type==="inbox").slice(0,3),i=n.inbox??0;if(i>0){o.push(`**Inbox (${i}):**`);for(let e of c)o.push(`- ${I(e)}`);i>c.length&&o.push(`- \u2026 +${i-c.length} more`),o.push("",'> Close resolved: `prjct close <id> --reason "\u2026"`. Forget noise: `prjct forget <id>`.',"")}let x=S.filter(e=>(n[e]??0)>0).map(e=>`${e}=${n[e]}`).concat(Object.keys(n).filter(e=>!S.includes(e)&&(n[e]??0)>0).sort().slice(0,8).map(e=>`${e}=${n[e]}`));x.length>0&&o.push(`_Counts: ${x.join(" \xB7 ")}_`,""),o.push("> Resolve any `mem_id` with `prjct search <id>`. Full developer model: MCP `prjct_developer`. Consolidate: `prjct dream`. Never stuff L2 into L0.");let y=o.join(`
8
+ import{a as L}from"./chunk-4KY2EHXS.mjs";import"./chunk-54LH63LM.mjs";import{c as v}from"./chunk-ZZ65CN5F.mjs";import{d as b}from"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{d as g,g as D}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as M,e as k}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{b as h}from"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";D();k();var E="memory:l0-index",$=4e3,R=1440*60*1e3,j=3,A=4,T=2,S=["decision","gotcha","anti-pattern","learning","fact","feedback"];function F(t){try{let r=C(t);return r?(g.setDoc(t.projectId,E,r),r):null}catch{return null}}l(F,"buildAndStoreMemoryL0Index");function C(t){let r=a.allEntriesForIndex(t.projectId).filter(e=>h(e)||e.type==="inbox"||e.type==="improvement-signal");if(r.length===0)return null;let n={};for(let e of r)n[e.type]=(n[e.type]??0)+1;if(r.filter(e=>e.type!=="improvement-signal"&&h(e)).length===0&&(n.inbox??0)===0)return null;let o=["## What this project already knows","","> Carried across sessions and model updates \u2014 this survived even if your conversation context did not. Apply these; do not re-derive from source.","",`_L0 index \xB7 live=${r.length} \xB7 pull L2: \`prjct search\` / \`prjct context memory <topic>\` / \`prjct guard <file>\`_`,""],m=new Set;try{let e=a.recall(t.projectId,{types:["feedback","improvement-signal"],limit:40,dedupeByKey:!1}),d=L(e,A);if(d.length>0){o.push("**How this developer works (act as them):**");for(let u of d){let w=u.rule.length>140?`${u.rule.slice(0,139)}\u2026`:u.rule;o.push(`- ${w} \`${u.sourceId}\``)}o.push("")}}catch{}let f=[{title:"Traps to avoid",types:["gotcha","anti-pattern"],suppressMiss:!0},{title:"Decisions in force",types:["decision"],suppressMiss:!0},{title:"Learnings",types:["learning"]},{title:"Facts",types:["fact"]}];for(let e of f){let d=v.rerank(t.projectId,a.recall(t.projectId,{types:e.types,limit:j*4})).slice(0,j);if(d.length!==0){o.push(`**${e.title}:**`);for(let u of d)o.push(`- ${I(u)}`),e.suppressMiss&&m.add(u.id);o.push("")}}let p=P(t.projectId,m);p&&o.push("**Keeps being missed:**",`- ${I(p.entry)} \u2014 flagged relevant-but-unused ${p.count}\xD7. Apply it or supersede it.`,"");let c=r.filter(e=>e.type==="inbox").slice(0,3),i=n.inbox??0;if(i>0){o.push(`**Inbox (${i}):**`);for(let e of c)o.push(`- ${I(e)}`);i>c.length&&o.push(`- \u2026 +${i-c.length} more`),o.push("",'> Close resolved: `prjct close <id> --reason "\u2026"`. Forget noise: `prjct forget <id>`.',"")}let x=S.filter(e=>(n[e]??0)>0).map(e=>`${e}=${n[e]}`).concat(Object.keys(n).filter(e=>!S.includes(e)&&(n[e]??0)>0).sort().slice(0,8).map(e=>`${e}=${n[e]}`));x.length>0&&o.push(`_Counts: ${x.join(" \xB7 ")}_`,""),o.push("> Resolve any `mem_id` with `prjct search <id>`. Full developer model: MCP `prjct_developer`. Consolidate: `prjct dream`. Never stuff L2 into L0.");let y=o.join(`
9
9
  `),_=y.length>$?`${y.slice(0,$-20).trimEnd()}
10
10
  \u2026(truncated)`:y;return{version:1,builtAt:M(),projectId:t.projectId,live:r.length,byType:n,markdown:_,source:t.source??"manual"}}l(C,"buildMemoryL0Index");function N(t){try{let r=g.getDoc(t,E);return!r||r.version!==1||!r.markdown?null:r}catch{return null}}l(N,"loadMemoryL0Index");function B(t,r=Date.now()){if(!t?.builtAt)return!1;let n=Date.parse(t.builtAt);return Number.isFinite(n)?r-n<=R:!1}l(B,"isMemoryL0IndexFresh");function W(t,r={}){try{let n=N(t),s=(!n||!B(n))&&r.rebuildIfStale!==!1?F({projectId:t,source:"session-start"}):n;return s?.markdown?.trim()?s.markdown.trim():null}catch{return null}}l(W,"memoryL0IndexForSession");function I(t){let r=b(t),n=(t.content??"").replace(/\s+/g," ").trim();if(n.length<=r.length+8)return`${r} \`${t.id}\``;let s=n.slice(r.length).replace(/^[\s.:;—-]+/,"").trim();if(s.length<20)return`${r} \`${t.id}\``;let o=s.length>80?`${s.slice(0,79)}\u2026`:s;return`${r} \u2014 ${o} \`${t.id}\``}l(I,"indexLine");function P(t,r){try{let n=a.recall(t,{types:["improvement-signal"],tags:{kind:"skill-miss"},limit:50,dedupeByKey:!1}),s=new Map;for(let c of n){let i=c.tags?.relates;i&&s.set(i,(s.get(i)??0)+1)}let o=[...s].sort((c,i)=>i[1]-c[1])[0];if(!o||o[1]<T||r.has(o[0]))return null;let[m,f]=o,p=a.getById(t,m);return p?{entry:p,count:f}:null}catch{return null}}l(P,"findRepeatMissedEntry");export{R as L0_INDEX_FRESH_MS,$ as L0_INDEX_MAX_CHARS,E as MEMORY_L0_INDEX_KEY,F as buildAndStoreMemoryL0Index,C as buildMemoryL0Index,B as isMemoryL0IndexFresh,N as loadMemoryL0Index,W as memoryL0IndexForSession};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b as f}from"./chunk-X5RDLFPM.mjs";import{c}from"./chunk-L4COZ7ZH.mjs";import{a as e}from"./chunk-ZX2KFQV5.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-GAOQHD5S.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{b as n}from"./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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as t}from"./chunk-E66B27AL.mjs";function l(u=process.cwd(),p){return c({event:"Notification",projectPath:u,afterEmit:t(async(d,i)=>{let o=await n.readConfig(i).catch(()=>null);if(!o?.projectId||a(o)==="off")return;let s=await e(o.projectId,i).then(r=>r.current?`Waiting \u2014 active: ${r.current.description}`:"Waiting for your input").catch(()=>"Waiting for your input");await f("prjct \u2014 Claude needs you",s)},"afterEmit")},p)}t(l,"runNotificationHook");export{l as runNotificationHook};
8
+ import{a,b as f}from"./chunk-X5RDLFPM.mjs";import{c}from"./chunk-L4COZ7ZH.mjs";import{a as e}from"./chunk-ZX2KFQV5.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-GAOQHD5S.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{b as n}from"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as t}from"./chunk-E66B27AL.mjs";function l(u=process.cwd(),p){return c({event:"Notification",projectPath:u,afterEmit:t(async(d,i)=>{let o=await n.readConfig(i).catch(()=>null);if(!o?.projectId||a(o)==="off")return;let s=await e(o.projectId,i).then(r=>r.current?`Waiting \u2014 active: ${r.current.description}`:"Waiting for your input").catch(()=>"Waiting for your input");await f("prjct \u2014 Claude needs you",s)},"afterEmit")},p)}t(l,"runNotificationHook");export{l as runNotificationHook};
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as k,b as d,c as v}from"./chunk-N5WOHG36.mjs";import{b as y}from"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import{d as g,g as $}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as m,e as T}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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import{createHash as b}from"node:crypto";$();T();var h="packs:installs";function P(t){let n={name:t.name,version:t.version,description:t.description,memoryTypes:[...t.memoryTypes].sort(),workflowSlots:j(t.workflowSlots),hookSignals:t.hookSignals,suggestedTags:t.suggestedTags?Object.fromEntries(Object.entries(t.suggestedTags).sort(([e],[s])=>e.localeCompare(s)).map(([e,s])=>[e,[...s].sort()])):void 0,suggestedPersona:t.suggestedPersona,configDefaults:t.configDefaults};return b("sha256").update(JSON.stringify(n)).digest("hex").slice(0,16)}c(P,"packIntegrityHash");function j(t){let n={};for(let e of Object.keys(t).sort())n[e]=t[e];return n}c(j,"sortKeys");function u(t){try{let n=g.getDoc(t,h);return!n||typeof n!="object"?{}:n}catch{return{}}}c(u,"loadPackInstalls");function w(t,n){g.setDoc(t,h,n)}c(w,"savePackInstalls");function M(t,n,e=m()){let s=u(t),r=[];for(let o of n){let i=v(o);if(!i)continue;let a={name:i.name,version:i.version,integrity:P(i),activatedAt:e};s[o]=a,r.push(a)}return w(t,s),r}c(M,"stampPackInstalls");function O(t,n){let e=u(t),s=[];for(let r of n)e[r]&&(delete e[r],s.push(r));s.length>0&&w(t,e)}c(O,"clearPackInstalls");async function x(t){let n=await y.readConfig(t),e=new Set(n?.persona?.packs??[]),s=n?.projectId,r=s?u(s):{},o=[];for(let i of d){let a=k[i],f=P(a),p=e.has(i),l=r[i],I=p&&l&&(l.integrity!==f||l.version!==a.version)?"stale":p?"active":"available";o.push({name:a.name,version:a.version,description:a.description,integrity:f,active:p,status:I,memoryTypes:a.memoryTypes,slots:Object.keys(a.workflowSlots),receipt:l})}for(let i of e){if(k[i])continue;let a=r[i];o.push({name:i,version:a?.version??"?",description:"Unknown pack (not in built-in catalog)",integrity:a?.integrity??"\u2014",active:!0,status:"unknown",memoryTypes:[],slots:[],receipt:a})}return o.sort((i,a)=>i.name.localeCompare(a.name))}c(x,"buildPackCatalog");async function D(t){let e=(await x(t)).filter(o=>o.active),s=e.filter(o=>o.status==="stale").map(o=>o.name),r=e.filter(o=>o.status==="unknown").map(o=>o.name);return{ok:s.length===0&&r.length===0,active:e.length,stale:s,unknown:r,entries:e}}c(D,"verifyActivePacks");function K(t){let n=["# prjct pack catalog (marketplace-lite)","","Local built-in packs with version + integrity. Activate with `prjct seed add <name>`.","Not a third-party MCP marketplace \u2014 packs = persona + memory types + workflow slots.","","| Pack | Ver | Active | Status | Integrity | Description |","|---|---|---|---|---|---|"];for(let e of t){let s=e.active?"yes":"\u2014";n.push(`| \`${e.name}\` | ${e.version} | ${s} | ${e.status} | \`${e.integrity}\` | ${e.description.replace(/\|/g,"\\|")} |`)}return n.push(""),n.push("## Integrity"),n.push(""),n.push("- On `seed add`, prjct stamps `version@integrity` into project SoT (`packs:installs`)."),n.push("- `prjct seed verify` flags **stale** (CLI pack upgraded since activate) or **unknown**."),n.push("- Re-activate with `prjct seed add <name>` to refresh the receipt after upgrade."),n.push(""),n.join(`
8
+ import{a as k,b as d,c as v}from"./chunk-N5WOHG36.mjs";import{b as y}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{d as g,g as $}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as m,e as T}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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import{createHash as b}from"node:crypto";$();T();var h="packs:installs";function P(t){let n={name:t.name,version:t.version,description:t.description,memoryTypes:[...t.memoryTypes].sort(),workflowSlots:j(t.workflowSlots),hookSignals:t.hookSignals,suggestedTags:t.suggestedTags?Object.fromEntries(Object.entries(t.suggestedTags).sort(([e],[s])=>e.localeCompare(s)).map(([e,s])=>[e,[...s].sort()])):void 0,suggestedPersona:t.suggestedPersona,configDefaults:t.configDefaults};return b("sha256").update(JSON.stringify(n)).digest("hex").slice(0,16)}c(P,"packIntegrityHash");function j(t){let n={};for(let e of Object.keys(t).sort())n[e]=t[e];return n}c(j,"sortKeys");function u(t){try{let n=g.getDoc(t,h);return!n||typeof n!="object"?{}:n}catch{return{}}}c(u,"loadPackInstalls");function w(t,n){g.setDoc(t,h,n)}c(w,"savePackInstalls");function M(t,n,e=m()){let s=u(t),r=[];for(let o of n){let i=v(o);if(!i)continue;let a={name:i.name,version:i.version,integrity:P(i),activatedAt:e};s[o]=a,r.push(a)}return w(t,s),r}c(M,"stampPackInstalls");function O(t,n){let e=u(t),s=[];for(let r of n)e[r]&&(delete e[r],s.push(r));s.length>0&&w(t,e)}c(O,"clearPackInstalls");async function x(t){let n=await y.readConfig(t),e=new Set(n?.persona?.packs??[]),s=n?.projectId,r=s?u(s):{},o=[];for(let i of d){let a=k[i],f=P(a),p=e.has(i),l=r[i],I=p&&l&&(l.integrity!==f||l.version!==a.version)?"stale":p?"active":"available";o.push({name:a.name,version:a.version,description:a.description,integrity:f,active:p,status:I,memoryTypes:a.memoryTypes,slots:Object.keys(a.workflowSlots),receipt:l})}for(let i of e){if(k[i])continue;let a=r[i];o.push({name:i,version:a?.version??"?",description:"Unknown pack (not in built-in catalog)",integrity:a?.integrity??"\u2014",active:!0,status:"unknown",memoryTypes:[],slots:[],receipt:a})}return o.sort((i,a)=>i.name.localeCompare(a.name))}c(x,"buildPackCatalog");async function D(t){let e=(await x(t)).filter(o=>o.active),s=e.filter(o=>o.status==="stale").map(o=>o.name),r=e.filter(o=>o.status==="unknown").map(o=>o.name);return{ok:s.length===0&&r.length===0,active:e.length,stale:s,unknown:r,entries:e}}c(D,"verifyActivePacks");function K(t){let n=["# prjct pack catalog (marketplace-lite)","","Local built-in packs with version + integrity. Activate with `prjct seed add <name>`.","Not a third-party MCP marketplace \u2014 packs = persona + memory types + workflow slots.","","| Pack | Ver | Active | Status | Integrity | Description |","|---|---|---|---|---|---|"];for(let e of t){let s=e.active?"yes":"\u2014";n.push(`| \`${e.name}\` | ${e.version} | ${s} | ${e.status} | \`${e.integrity}\` | ${e.description.replace(/\|/g,"\\|")} |`)}return n.push(""),n.push("## Integrity"),n.push(""),n.push("- On `seed add`, prjct stamps `version@integrity` into project SoT (`packs:installs`)."),n.push("- `prjct seed verify` flags **stale** (CLI pack upgraded since activate) or **unknown**."),n.push("- Re-activate with `prjct seed add <name>` to refresh the receipt after upgrade."),n.push(""),n.join(`
9
9
  `)}c(K,"formatPackCatalogMd");function V(t){let n=["# prjct pack verify","",t.ok?`**OK** \u2014 ${t.active} active pack(s), integrity clean.`:`**Attention** \u2014 ${t.stale.length} stale, ${t.unknown.length} unknown.`,""];if(t.stale.length&&n.push(`- Stale (re-add to refresh): ${t.stale.map(e=>`\`${e}\``).join(", ")}`),t.unknown.length&&n.push(`- Unknown (remove or restore): ${t.unknown.map(e=>`\`${e}\``).join(", ")}`),t.entries.length){n.push("","| Pack | Ver | Status | Integrity |","|---|---|---|---|");for(let e of t.entries)n.push(`| \`${e.name}\` | ${e.version} | ${e.status} | \`${e.integrity}\` |`)}return n.push(""),n.join(`
10
10
  `)}c(V,"formatPackVerifyMd");export{h as PACK_INSTALLS_KEY,x as buildPackCatalog,O as clearPackInstalls,K as formatPackCatalogMd,V as formatPackVerifyMd,u as loadPackInstalls,P as packIntegrityHash,w as savePackInstalls,M as stampPackInstalls,D as verifyActivePacks};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as u,c as m}from"./chunk-N5WOHG36.mjs";import{b as f}from"./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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as d}from"./chunk-E66B27AL.mjs";async function P(t){let i=await import("node:fs/promises"),n=await import("node:path"),s=new Set(["daily"]),o=["package.json","go.mod","Cargo.toml","pyproject.toml","Gemfile","pom.xml","build.gradle"];for(let e of o)try{await i.stat(n.join(t,e)),s.add("code");break}catch{}return[...s]}d(P,"detectSuggestedPacks");async function C(t){let i=await f.readConfig(t);if(!i)return{healed:!1,activated:[],reason:"no-config"};if(i.judgment?.conflictMode==="off")return{healed:!1,activated:[],reason:"conflictMode-off"};let n=i.persona?.packs??[];if(n.includes("code")||n.includes("code-strict"))return!i.judgment?.conflictMode&&n.includes("code")?(await f.writeConfig(t,{...i,judgment:{...i.judgment,conflictMode:"advisory"}}),{healed:!0,activated:[],reason:"conflictMode-healed"}):{healed:!1,activated:[],reason:"already-coding-pack"};if(!(await P(t)).includes("code"))return{healed:!1,activated:[],reason:"not-code-repo"};let e=await y(t,["code"],{suggestPersona:!0});return e.activated.includes("code")?{healed:!0,activated:e.activated,reason:"activated-code"}:{healed:!1,activated:[],reason:"noop"}}d(C,"ensureCodingAnticipationDefaults");async function y(t,i,n={}){let s=[],o=[],e=await f.readConfig(t);if(!e)throw new Error("No prjct project here \u2014 run `prjct init` first.");let a=e.persona??{role:"DEV"},r=new Set(a.packs??[]);for(let g of i){if(!u[g]){o.push(g);continue}r.has(g)||(r.add(g),s.push(g))}let l=[...r],c={...a,packs:l};n.suggestPersona&&s.length>0&&k(c,s);let p={...e,persona:c,...v(e,s)};if(await f.writeConfig(t,p),s.length>0&&e.projectId)try{let{stampPackInstalls:g}=await import("./pack-integrity-6VKUAISJ.mjs");g(e.projectId,s)}catch{}return{activated:s,skipped:o}}d(y,"activatePacks");function v(t,i){let n={};for(let s of i){let o=u[s]?.configDefaults;o&&(o.sdd&&!t.sdd&&(n.sdd={mode:o.sdd}),o.tdd&&!t.tdd&&(n.tdd={mode:o.tdd}),o.maxTurnsPerCycle!=null&&t.maxTurnsPerCycle==null&&n.maxTurnsPerCycle==null&&(n.maxTurnsPerCycle=o.maxTurnsPerCycle),o.deliveryGeometry&&!t.deliveryGeometry&&(n.deliveryGeometry={mode:o.deliveryGeometry}),o.land&&!t.land&&(n.land={mode:o.land}),o.conflictMode&&!t.judgment?.conflictMode&&(n.judgment={...t.judgment,...n.judgment,conflictMode:o.conflictMode}))}return n}d(v,"packConfigDefaults");async function j(t,i){let n=await f.readConfig(t);if(!n)throw new Error("No prjct project here \u2014 run `prjct init` first.");let s=n.persona??{role:"DEV"},o=new Set(s.packs??[]),e=[],a=[];for(let c of i)o.delete(c)?e.push(c):a.push(c);let r={...s,packs:[...o]},l={...n,persona:r};if(await f.writeConfig(t,l),e.length>0&&n.projectId)try{let{clearPackInstalls:c}=await import("./pack-integrity-6VKUAISJ.mjs");c(n.projectId,e)}catch{}return{deactivated:e,notActive:a}}d(j,"deactivatePacks");async function M(t){let n=(await f.readConfig(t))?.persona?.packs??[],s=await import("./pack-integrity-6VKUAISJ.mjs").then(({buildPackCatalog:a})=>a(t)).catch(()=>[]),o=Object.fromEntries(s.filter(a=>a.active).map(a=>[a.name,{version:a.version,integrity:a.integrity,status:a.status}])),e=[];for(let a of n){let r=u[a];if(!r){let c=o[a];e.push({name:a,description:"Unknown pack (not in built-in catalog)",memoryTypes:[],slots:[],version:c?.version,integrity:c?.integrity,status:c?.status??"unknown"});continue}let l=o[a];e.push({name:r.name,description:r.description,memoryTypes:r.memoryTypes,slots:Object.keys(r.workflowSlots),version:l?.version??r.version,integrity:l?.integrity,status:l?.status??"active"})}return e}d(M,"listActivePacks");function k(t,i){let n=t.role&&t.role!=="DEV",s=t.mcps&&t.mcps.length>0;for(let o of i){let e=m(o);if(e?.suggestedPersona&&(!n&&e.suggestedPersona.role&&(t.role=e.suggestedPersona.role),!t.focus&&e.suggestedPersona.focus&&(t.focus=e.suggestedPersona.focus),!s&&e.suggestedPersona.mcps&&(t.mcps=[...e.suggestedPersona.mcps]),t.role&&t.role!=="DEV"))break}}d(k,"applyPersonaSuggestion");export{y as activatePacks,j as deactivatePacks,P as detectSuggestedPacks,C as ensureCodingAnticipationDefaults,M as listActivePacks};
8
+ import{a as u,c as m}from"./chunk-N5WOHG36.mjs";import{b as f}from"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as d}from"./chunk-E66B27AL.mjs";async function P(t){let i=await import("node:fs/promises"),n=await import("node:path"),s=new Set(["daily"]),o=["package.json","go.mod","Cargo.toml","pyproject.toml","Gemfile","pom.xml","build.gradle"];for(let e of o)try{await i.stat(n.join(t,e)),s.add("code");break}catch{}return[...s]}d(P,"detectSuggestedPacks");async function C(t){let i=await f.readConfig(t);if(!i)return{healed:!1,activated:[],reason:"no-config"};if(i.judgment?.conflictMode==="off")return{healed:!1,activated:[],reason:"conflictMode-off"};let n=i.persona?.packs??[];if(n.includes("code")||n.includes("code-strict"))return!i.judgment?.conflictMode&&n.includes("code")?(await f.writeConfig(t,{...i,judgment:{...i.judgment,conflictMode:"advisory"}}),{healed:!0,activated:[],reason:"conflictMode-healed"}):{healed:!1,activated:[],reason:"already-coding-pack"};if(!(await P(t)).includes("code"))return{healed:!1,activated:[],reason:"not-code-repo"};let e=await y(t,["code"],{suggestPersona:!0});return e.activated.includes("code")?{healed:!0,activated:e.activated,reason:"activated-code"}:{healed:!1,activated:[],reason:"noop"}}d(C,"ensureCodingAnticipationDefaults");async function y(t,i,n={}){let s=[],o=[],e=await f.readConfig(t);if(!e)throw new Error("No prjct project here \u2014 run `prjct init` first.");let a=e.persona??{role:"DEV"},r=new Set(a.packs??[]);for(let g of i){if(!u[g]){o.push(g);continue}r.has(g)||(r.add(g),s.push(g))}let l=[...r],c={...a,packs:l};n.suggestPersona&&s.length>0&&k(c,s);let p={...e,persona:c,...v(e,s)};if(await f.writeConfig(t,p),s.length>0&&e.projectId)try{let{stampPackInstalls:g}=await import("./pack-integrity-L3BL7CGO.mjs");g(e.projectId,s)}catch{}return{activated:s,skipped:o}}d(y,"activatePacks");function v(t,i){let n={};for(let s of i){let o=u[s]?.configDefaults;o&&(o.sdd&&!t.sdd&&(n.sdd={mode:o.sdd}),o.tdd&&!t.tdd&&(n.tdd={mode:o.tdd}),o.maxTurnsPerCycle!=null&&t.maxTurnsPerCycle==null&&n.maxTurnsPerCycle==null&&(n.maxTurnsPerCycle=o.maxTurnsPerCycle),o.deliveryGeometry&&!t.deliveryGeometry&&(n.deliveryGeometry={mode:o.deliveryGeometry}),o.land&&!t.land&&(n.land={mode:o.land}),o.conflictMode&&!t.judgment?.conflictMode&&(n.judgment={...t.judgment,...n.judgment,conflictMode:o.conflictMode}))}return n}d(v,"packConfigDefaults");async function j(t,i){let n=await f.readConfig(t);if(!n)throw new Error("No prjct project here \u2014 run `prjct init` first.");let s=n.persona??{role:"DEV"},o=new Set(s.packs??[]),e=[],a=[];for(let c of i)o.delete(c)?e.push(c):a.push(c);let r={...s,packs:[...o]},l={...n,persona:r};if(await f.writeConfig(t,l),e.length>0&&n.projectId)try{let{clearPackInstalls:c}=await import("./pack-integrity-L3BL7CGO.mjs");c(n.projectId,e)}catch{}return{deactivated:e,notActive:a}}d(j,"deactivatePacks");async function M(t){let n=(await f.readConfig(t))?.persona?.packs??[],s=await import("./pack-integrity-L3BL7CGO.mjs").then(({buildPackCatalog:a})=>a(t)).catch(()=>[]),o=Object.fromEntries(s.filter(a=>a.active).map(a=>[a.name,{version:a.version,integrity:a.integrity,status:a.status}])),e=[];for(let a of n){let r=u[a];if(!r){let c=o[a];e.push({name:a,description:"Unknown pack (not in built-in catalog)",memoryTypes:[],slots:[],version:c?.version,integrity:c?.integrity,status:c?.status??"unknown"});continue}let l=o[a];e.push({name:r.name,description:r.description,memoryTypes:r.memoryTypes,slots:Object.keys(r.workflowSlots),version:l?.version??r.version,integrity:l?.integrity,status:l?.status??"active"})}return e}d(M,"listActivePacks");function k(t,i){let n=t.role&&t.role!=="DEV",s=t.mcps&&t.mcps.length>0;for(let o of i){let e=m(o);if(e?.suggestedPersona&&(!n&&e.suggestedPersona.role&&(t.role=e.suggestedPersona.role),!t.focus&&e.suggestedPersona.focus&&(t.focus=e.suggestedPersona.focus),!s&&e.suggestedPersona.mcps&&(t.mcps=[...e.suggestedPersona.mcps]),t.role&&t.role!=="DEV"))break}}d(k,"applyPersonaSuggestion");export{y as activatePacks,j as deactivatePacks,P as detectSuggestedPacks,C as ensureCodingAnticipationDefaults,M as listActivePacks};
@@ -5,5 +5,5 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as f}from"./chunk-Q5I2UPD6.mjs";import{c as $,d as E}from"./chunk-R77TXXPP.mjs";import{a as M}from"./chunk-PSSR7LSW.mjs";import{a as r}from"./chunk-YGHIPTJN.mjs";import{a as g}from"./chunk-F652GI4F.mjs";import"./chunk-SNISJ7HR.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-6EWGHM32.mjs";import{a as h,b as C,c as T,d as P,e as I}from"./chunk-2NMSEZTQ.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{a as W,b as A}from"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{d as S}from"./chunk-YORSHLFH.mjs";import{s as O,t as Y}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-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import{e as z,f as G}from"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";Y();G();import*as n from"@clack/prompts";import p from"chalk";var y=class{static{o(this,"OnboardingWizard")}projectPath;aborted=!1;detectedType="unknown";confirmedType="unknown";selectedAgents=[];detectedStack={language:"Unknown",technologies:[]};confirmedStack={language:"Unknown",technologies:[]};preferences={verbosity:"normal",autoSync:!0,telemetry:!1};constructor(t=process.cwd()){this.projectPath=t}async run(){n.intro(p.cyan.bold("\u26A1 prjct-cli setup"));let t=[{id:"project-type",title:"Project Type",run:o(()=>this.stepProjectType(),"run")},{id:"ai-agents",title:"AI Agents",run:o(()=>this.stepAIAgents(),"run")},{id:"stack",title:"Stack Confirmation",run:o(()=>this.stepStack(),"run")},{id:"preferences",title:"Preferences",run:o(()=>this.stepPreferences(),"run")},{id:"summary",title:"Summary",run:o(()=>this.stepSummary(),"run")}];for(let e of t)if(!await e.run()||this.aborted)return this.buildResult(!0);return n.outro(p.green("Setup complete!")),this.buildResult(!1)}async runNonInteractive(){r.spin("Auto-detecting project configuration..."),this.detectedType=await T(this.projectPath),this.confirmedType=this.detectedType;let t=await P(this.projectPath);return this.selectedAgents=t,this.detectedStack=await I(this.projectPath),this.confirmedStack=this.detectedStack,r.done("Configuration detected"),this.buildResult(!1)}async stepProjectType(){this.detectedType=await T(this.projectPath);let t=h.findIndex(i=>i.value===this.detectedType),e=await n.select({message:this.detectedType!=="unknown"?`Detected: ${this.getProjectTypeLabel(this.detectedType)}. Is this correct?`:"What type of project is this?",options:h.map(i=>({label:i.title,hint:i.description,value:i.value})),initialValue:t>=0?h[t].value:void 0});return n.isCancel(e)?(this.handleCancel(),!1):(this.confirmedType=e||this.detectedType,!0)}async stepAIAgents(){let t=await P(this.projectPath),e=C.map(a=>({label:a.title,hint:a.description,value:a.value})),i=await n.multiselect({message:"Which AI agents do you use?",options:e,initialValues:t,required:!0});return n.isCancel(i)?(this.handleCancel(),!1):(this.selectedAgents=i,!0)}async stepStack(){this.detectedStack=await I(this.projectPath);let t=this.formatStackDisplay(this.detectedStack);n.note(t,"Detected stack");let e=await n.confirm({message:"Is this stack correct?",initialValue:!0});if(n.isCancel(e))return this.handleCancel(),!1;if(e)this.confirmedStack=this.detectedStack;else{let i=await n.group({language:o(()=>n.text({message:"Primary language:",defaultValue:this.detectedStack.language}),"language"),framework:o(()=>n.text({message:"Framework (optional):",defaultValue:this.detectedStack.framework||""}),"framework")},{onCancel:o(()=>this.handleCancel(),"onCancel")});if(this.aborted)return!1;this.confirmedStack={...this.detectedStack,language:i.language||this.detectedStack.language,framework:i.framework||void 0}}return!0}async stepPreferences(){let t=await n.group({verbosity:o(()=>n.select({message:"Output verbosity:",options:[{label:"Minimal",hint:"Essential output only",value:"minimal"},{label:"Normal (Recommended)",hint:"Balanced information",value:"normal"},{label:"Verbose",hint:"Detailed logging",value:"verbose"}],initialValue:"normal"}),"verbosity"),autoSync:o(()=>n.confirm({message:"Auto-sync context on file changes?",initialValue:!0}),"autoSync")},{onCancel:o(()=>this.handleCancel(),"onCancel")});return this.aborted?!1:(this.preferences={verbosity:t.verbosity||"normal",autoSync:t.autoSync??!0,telemetry:!1},!0)}async stepSummary(){let t=[`${p.cyan("Project Type:")} ${this.getProjectTypeLabel(this.confirmedType)}`,`${p.cyan("AI Agents:")} ${this.selectedAgents.map(i=>this.getAgentLabel(i)).join(", ")}`,`${p.cyan("Stack:")} ${this.formatStackDisplay(this.confirmedStack)}`,`${p.cyan("Verbosity:")} ${this.preferences.verbosity}`,`${p.cyan("Auto-sync:")} ${this.preferences.autoSync?"Yes":"No"}`].join(`
9
- `);n.note(t,"Configuration Summary");let e=await n.confirm({message:"Generate configuration with these settings?",initialValue:!0});return n.isCancel(e)||!e?(n.isCancel(e)&&this.handleCancel(),!1):!0}handleCancel(){this.aborted=!0,n.cancel("Setup cancelled. Run again anytime.")}getProjectTypeLabel(t){return h.find(e=>e.value===t)?.title||"Unknown"}getAgentLabel(t){return C.find(e=>e.value===t)?.title||t}formatStackDisplay(t){let e=[t.language];return t.framework&&e.push(t.framework),t.runtime&&t.runtime!=="Node.js"&&e.push(t.runtime),t.technologies.length>0&&e.push(`+ ${t.technologies.slice(0,3).join(", ")}`),e.join(" / ")}buildResult(t){return{projectType:this.confirmedType,agents:this.selectedAgents,stack:this.confirmedStack,preferences:this.preferences,skipped:t}}getSelectedAgents(){return this.selectedAgents}getConfirmedStack(){return this.confirmedStack}getPreferences(){return this.preferences}};var j={current:null};async function L(){if(!j.current){let{AnalysisCommands:k}=await import("./analysis-NRRZYJ6G.mjs");j.current=new k}return j.current}o(L,"getAnalysisCommands");var N=class extends E{static{o(this,"PlanningCommands")}async _hintCommittedMemoryExport(t){try{let e=await import("node:fs/promises"),a=(await import("node:path")).join(t,".prjct","memory-export","manifest.json"),c=JSON.parse(await e.readFile(a,"utf-8"));c?.entries&&c.entries>0&&r.info(`\u{1F4E6} This repo ships ${c.entries} team memories (.prjct/memory-export/). Load them: prjct memory import`)}catch{}}async init(t={},e=process.cwd()){try{let i=typeof t=="string"||t===null?{idea:t}:t;if(await this.initializeAgent(),await A.isConfigured(e))return r.warn("already initialized"),{success:!1,message:"Already initialized"};let c=process.stdout.isTTY&&process.stdin.isTTY,s=i.yes||!c||process.env.CI==="true"?c&&i.yes?await new y(e).runNonInteractive():null:await new y(e).run();if(s?.skipped)return{success:!1,message:"Setup cancelled"};r.step(1,4,"Detecting author...");let u=await W(),R={name:u.name||void 0,email:u.email||void 0,github:u.github||void 0},d=(await A.createConfig(e,R)).projectId;await this._applyInitialPacksAndPersona(e,i),r.step(2,4,"Creating structure..."),await O.ensureProjectStructure(d),await this._seedShipWorkflow(d,e);let m=await this._detectEmptyDirectory(e),D=await this._detectExistingCode(e);if(D||!m){r.step(3,4,"Analyzing project...");let w=await L();if((await w.analyze({},e)).success){r.step(4,4,"Generating agents..."),await w.sync(e);let b=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("initialized"),await this._hintCommittedMemoryExport(e),this._printNextSteps(s,b??void 0),{success:!0,mode:"existing",projectId:d,wizard:s}}}let v=i.idea;if(m&&!D){if(!v){await S.installGlobalConfig();let b=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("blank project - provide idea for architect mode"),this._printNextSteps(s,b??void 0),{success:!0,mode:"blank_no_idea",projectId:d,wizard:s}}r.spin("architect mode...");let{projectMemory:w}=await import("./project-memory-KRA3BH7A.mjs");await w.remember(e,{type:"idea",content:v,tags:{source:"architect-init",status:"awaiting-stack-recommendation"},source:"architect-init"}),await S.installGlobalConfig();let _=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("architect mode ready"),this._printNextSteps(s,_??void 0),{success:!0,mode:"architect",projectId:d,idea:v,wizard:s}}await S.installGlobalConfig();let V=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("initialized"),this._printNextSteps(s,V??void 0),{success:!0,projectId:d,wizard:s}}catch(i){return r.fail(z(i)),$(i)}}async quickstart(t={},e=process.cwd()){let i=t.pack??"code,daily",a=await this.init({...t,yes:!0,pack:i},e);return!a.success&&a.message!=="Already initialized"?a:(console.log(""),console.log(" \u2500\u2500 quickstart ready \u2500\u2500"),console.log(" 1. Open your coding agent in this repo (Claude / Codex / Cursor / Grok)."),console.log(" 2. Say what to build \u2014 the agent runs `prjct work` for you."),console.log(" 3. Team brain without cloud: `prjct memory export` \u2192 commit \u2192 clone \u2192 import."),console.log(""),{...a,success:!0})}_printNextSteps(t,e){console.log(""),console.log(" \u2713 global prjct router refreshed where supported"),e?.claudeMd&&e.claudeMd.action!=="unchanged"&&console.log(" \u2713 project CLAUDE.md updated with routing block"),e?.agentsMd&&e.agentsMd.action!=="unchanged"&&console.log(" \u2713 project AGENTS.md updated with universal routing block"),(e?.ideRules.length??0)>0&&console.log(` \u2713 project IDE rules updated: ${e?.ideRules.join(", ")}`),console.log(""),console.log(" You don't run prjct commands. Your AI coding agent does."),console.log(""),console.log(" Just describe what you're doing \u2014 the agent reads the intent and"),console.log(" runs the right verb. Routine captures (decision, learning,"),console.log(" gotcha, idea) save automatically; ship and other destructive"),console.log(" verbs surface a one-line plan and wait for your OK."),console.log(""),console.log(" If you want to drive manually:"),console.log(" prjct sync Refresh context + skill body"),console.log(" prjct work Start a work cycle"),console.log(" prjct land Session-close checklist"),console.log(" prjct memory export Git-share team memory"),console.log(""),t&&t.agents.length>0&&(console.log(` Detected agents: ${t.agents.join(", ")}`),console.log("")),console.log(" Docs: https://prjct.app/docs"),console.log("")}async _agentSelections(t,e){if(t)return t.agents;try{let{detectInstalledAgents:i}=await import("./detection-MEYHME4X.mjs");return i(e)}catch{return[]}}async _applyInitialPacksAndPersona(t,e){let{activatePacks:i,detectSuggestedPacks:a}=await import("./pack-manager-KQBNP6XR.mjs"),c=e.pack?e.pack.split(",").map(l=>l.trim()).filter(Boolean):e.persona?[]:await a(t);if(c.length>0&&await i(t,c,{suggestPersona:!0}),e.persona){let l=(await import("./config-manager-KJCMN7PV.mjs")).default,s=await l.readConfig(t);if(s){let u=s.persona??{role:e.persona};u.role=e.persona,await l.writeConfig(t,{...s,persona:u})}}}async _resolveInitialPrConvention(t,e){let{detectPrConventionSignal:i,defaultPrConventionFor:a}=await import("./pr-convention-7UGI7TFA.mjs"),{customWorkflowStorage:c}=await import("./custom-workflow-storage-M77INP6Z.mjs"),l=await i(e),s=a(l),u=!!(process.stdout.isTTY&&process.stdin.isTTY),x=(l.kind==="github-ambiguous"&&u?await(async()=>{let d=await import("@clack/prompts"),m=await d.confirm({message:"This project ships to GitHub with no PR template. Should ship open/update the PR automatically?",initialValue:!0});return d.isCancel(m)?null:m?"auto":"manual"})():null)??s;c.updateWorkflow(t,"ship",{metadata:{prConvention:x}})}async _seedShipWorkflow(t,e){let i=await M(e);await this._resolveInitialPrConvention(t,e);let{seedCodeShipRules:a}=await import("./shipping-VCLQS7GP.mjs");await a(t,e);let c=f.getRulesForCommand(t,"ship").reduce((l,s)=>Math.max(l,s.sortOrder??0),0)+1;f.addRule(t,{type:"gate",command:"ship",position:"before",action:'git branch --show-current | grep -vE "^(main|master)$"',description:"Prevent shipping from main branch",enabled:!0,timeoutMs:5e3,sortOrder:c,createdAt:new Date().toISOString()}),i.lint&&f.addRule(t,{type:"step",command:"ship",position:"before",action:`${i.lint.command} || true`,description:"Lint code",enabled:!0,timeoutMs:12e4,sortOrder:c+1,createdAt:new Date().toISOString()}),i.test&&f.addRule(t,{type:"step",command:"ship",position:"before",action:`${i.test.command} || true`,description:"Run tests",enabled:!0,timeoutMs:3e5,sortOrder:c+(i.lint?2:1),createdAt:new Date().toISOString()})}};export{N as PlanningCommands};
8
+ import{a as f}from"./chunk-Q5I2UPD6.mjs";import{c as $,d as E}from"./chunk-PXJKXBTM.mjs";import{a as M}from"./chunk-PSSR7LSW.mjs";import{a as r}from"./chunk-6AFM6WRB.mjs";import{a as g}from"./chunk-FEH4IPIC.mjs";import"./chunk-EHBEHLYN.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-6EWGHM32.mjs";import{a as h,b as C,c as T,d as P,e as I}from"./chunk-2NMSEZTQ.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{a as W,b as A}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{d as S}from"./chunk-HBLR7BVG.mjs";import{s as O,t as Y}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-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import{e as z,f as G}from"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";Y();G();import*as n from"@clack/prompts";import p from"chalk";var y=class{static{o(this,"OnboardingWizard")}projectPath;aborted=!1;detectedType="unknown";confirmedType="unknown";selectedAgents=[];detectedStack={language:"Unknown",technologies:[]};confirmedStack={language:"Unknown",technologies:[]};preferences={verbosity:"normal",autoSync:!0,telemetry:!1};constructor(t=process.cwd()){this.projectPath=t}async run(){n.intro(p.cyan.bold("\u26A1 prjct-cli setup"));let t=[{id:"project-type",title:"Project Type",run:o(()=>this.stepProjectType(),"run")},{id:"ai-agents",title:"AI Agents",run:o(()=>this.stepAIAgents(),"run")},{id:"stack",title:"Stack Confirmation",run:o(()=>this.stepStack(),"run")},{id:"preferences",title:"Preferences",run:o(()=>this.stepPreferences(),"run")},{id:"summary",title:"Summary",run:o(()=>this.stepSummary(),"run")}];for(let e of t)if(!await e.run()||this.aborted)return this.buildResult(!0);return n.outro(p.green("Setup complete!")),this.buildResult(!1)}async runNonInteractive(){r.spin("Auto-detecting project configuration..."),this.detectedType=await T(this.projectPath),this.confirmedType=this.detectedType;let t=await P(this.projectPath);return this.selectedAgents=t,this.detectedStack=await I(this.projectPath),this.confirmedStack=this.detectedStack,r.done("Configuration detected"),this.buildResult(!1)}async stepProjectType(){this.detectedType=await T(this.projectPath);let t=h.findIndex(i=>i.value===this.detectedType),e=await n.select({message:this.detectedType!=="unknown"?`Detected: ${this.getProjectTypeLabel(this.detectedType)}. Is this correct?`:"What type of project is this?",options:h.map(i=>({label:i.title,hint:i.description,value:i.value})),initialValue:t>=0?h[t].value:void 0});return n.isCancel(e)?(this.handleCancel(),!1):(this.confirmedType=e||this.detectedType,!0)}async stepAIAgents(){let t=await P(this.projectPath),e=C.map(a=>({label:a.title,hint:a.description,value:a.value})),i=await n.multiselect({message:"Which AI agents do you use?",options:e,initialValues:t,required:!0});return n.isCancel(i)?(this.handleCancel(),!1):(this.selectedAgents=i,!0)}async stepStack(){this.detectedStack=await I(this.projectPath);let t=this.formatStackDisplay(this.detectedStack);n.note(t,"Detected stack");let e=await n.confirm({message:"Is this stack correct?",initialValue:!0});if(n.isCancel(e))return this.handleCancel(),!1;if(e)this.confirmedStack=this.detectedStack;else{let i=await n.group({language:o(()=>n.text({message:"Primary language:",defaultValue:this.detectedStack.language}),"language"),framework:o(()=>n.text({message:"Framework (optional):",defaultValue:this.detectedStack.framework||""}),"framework")},{onCancel:o(()=>this.handleCancel(),"onCancel")});if(this.aborted)return!1;this.confirmedStack={...this.detectedStack,language:i.language||this.detectedStack.language,framework:i.framework||void 0}}return!0}async stepPreferences(){let t=await n.group({verbosity:o(()=>n.select({message:"Output verbosity:",options:[{label:"Minimal",hint:"Essential output only",value:"minimal"},{label:"Normal (Recommended)",hint:"Balanced information",value:"normal"},{label:"Verbose",hint:"Detailed logging",value:"verbose"}],initialValue:"normal"}),"verbosity"),autoSync:o(()=>n.confirm({message:"Auto-sync context on file changes?",initialValue:!0}),"autoSync")},{onCancel:o(()=>this.handleCancel(),"onCancel")});return this.aborted?!1:(this.preferences={verbosity:t.verbosity||"normal",autoSync:t.autoSync??!0,telemetry:!1},!0)}async stepSummary(){let t=[`${p.cyan("Project Type:")} ${this.getProjectTypeLabel(this.confirmedType)}`,`${p.cyan("AI Agents:")} ${this.selectedAgents.map(i=>this.getAgentLabel(i)).join(", ")}`,`${p.cyan("Stack:")} ${this.formatStackDisplay(this.confirmedStack)}`,`${p.cyan("Verbosity:")} ${this.preferences.verbosity}`,`${p.cyan("Auto-sync:")} ${this.preferences.autoSync?"Yes":"No"}`].join(`
9
+ `);n.note(t,"Configuration Summary");let e=await n.confirm({message:"Generate configuration with these settings?",initialValue:!0});return n.isCancel(e)||!e?(n.isCancel(e)&&this.handleCancel(),!1):!0}handleCancel(){this.aborted=!0,n.cancel("Setup cancelled. Run again anytime.")}getProjectTypeLabel(t){return h.find(e=>e.value===t)?.title||"Unknown"}getAgentLabel(t){return C.find(e=>e.value===t)?.title||t}formatStackDisplay(t){let e=[t.language];return t.framework&&e.push(t.framework),t.runtime&&t.runtime!=="Node.js"&&e.push(t.runtime),t.technologies.length>0&&e.push(`+ ${t.technologies.slice(0,3).join(", ")}`),e.join(" / ")}buildResult(t){return{projectType:this.confirmedType,agents:this.selectedAgents,stack:this.confirmedStack,preferences:this.preferences,skipped:t}}getSelectedAgents(){return this.selectedAgents}getConfirmedStack(){return this.confirmedStack}getPreferences(){return this.preferences}};var j={current:null};async function L(){if(!j.current){let{AnalysisCommands:k}=await import("./analysis-LBYZSJKT.mjs");j.current=new k}return j.current}o(L,"getAnalysisCommands");var N=class extends E{static{o(this,"PlanningCommands")}async _hintCommittedMemoryExport(t){try{let e=await import("node:fs/promises"),a=(await import("node:path")).join(t,".prjct","memory-export","manifest.json"),c=JSON.parse(await e.readFile(a,"utf-8"));c?.entries&&c.entries>0&&r.info(`\u{1F4E6} This repo ships ${c.entries} team memories (.prjct/memory-export/). Load them: prjct memory import`)}catch{}}async init(t={},e=process.cwd()){try{let i=typeof t=="string"||t===null?{idea:t}:t;if(await this.initializeAgent(),await A.isConfigured(e))return r.warn("already initialized"),{success:!1,message:"Already initialized"};let c=process.stdout.isTTY&&process.stdin.isTTY,s=i.yes||!c||process.env.CI==="true"?c&&i.yes?await new y(e).runNonInteractive():null:await new y(e).run();if(s?.skipped)return{success:!1,message:"Setup cancelled"};r.step(1,4,"Detecting author...");let u=await W(),R={name:u.name||void 0,email:u.email||void 0,github:u.github||void 0},d=(await A.createConfig(e,R)).projectId;await this._applyInitialPacksAndPersona(e,i),r.step(2,4,"Creating structure..."),await O.ensureProjectStructure(d),await this._seedShipWorkflow(d,e);let m=await this._detectEmptyDirectory(e),D=await this._detectExistingCode(e);if(D||!m){r.step(3,4,"Analyzing project...");let w=await L();if((await w.analyze({},e)).success){r.step(4,4,"Generating agents..."),await w.sync(e);let b=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("initialized"),await this._hintCommittedMemoryExport(e),this._printNextSteps(s,b??void 0),{success:!0,mode:"existing",projectId:d,wizard:s}}}let v=i.idea;if(m&&!D){if(!v){await S.installGlobalConfig();let b=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("blank project - provide idea for architect mode"),this._printNextSteps(s,b??void 0),{success:!0,mode:"blank_no_idea",projectId:d,wizard:s}}r.spin("architect mode...");let{projectMemory:w}=await import("./project-memory-ZVZSLPB5.mjs");await w.remember(e,{type:"idea",content:v,tags:{source:"architect-init",status:"awaiting-stack-recommendation"},source:"architect-init"}),await S.installGlobalConfig();let _=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("architect mode ready"),this._printNextSteps(s,_??void 0),{success:!0,mode:"architect",projectId:d,idea:v,wizard:s}}await S.installGlobalConfig();let V=await g(e,{agents:await this._agentSelections(s,e),explicit:!0}).catch(()=>null);return r.done("initialized"),this._printNextSteps(s,V??void 0),{success:!0,projectId:d,wizard:s}}catch(i){return r.fail(z(i)),$(i)}}async quickstart(t={},e=process.cwd()){let i=t.pack??"code,daily",a=await this.init({...t,yes:!0,pack:i},e);return!a.success&&a.message!=="Already initialized"?a:(console.log(""),console.log(" \u2500\u2500 quickstart ready \u2500\u2500"),console.log(" 1. Open your coding agent in this repo (Claude / Codex / Cursor / Grok)."),console.log(" 2. Say what to build \u2014 the agent runs `prjct work` for you."),console.log(" 3. Team brain without cloud: `prjct memory export` \u2192 commit \u2192 clone \u2192 import."),console.log(""),{...a,success:!0})}_printNextSteps(t,e){console.log(""),console.log(" \u2713 global prjct router refreshed where supported"),e?.claudeMd&&e.claudeMd.action!=="unchanged"&&console.log(" \u2713 project CLAUDE.md updated with routing block"),e?.agentsMd&&e.agentsMd.action!=="unchanged"&&console.log(" \u2713 project AGENTS.md updated with universal routing block"),(e?.ideRules.length??0)>0&&console.log(` \u2713 project IDE rules updated: ${e?.ideRules.join(", ")}`),console.log(""),console.log(" You don't run prjct commands. Your AI coding agent does."),console.log(""),console.log(" Just describe what you're doing \u2014 the agent reads the intent and"),console.log(" runs the right verb. Routine captures (decision, learning,"),console.log(" gotcha, idea) save automatically; ship and other destructive"),console.log(" verbs surface a one-line plan and wait for your OK."),console.log(""),console.log(" If you want to drive manually:"),console.log(" prjct sync Refresh context + skill body"),console.log(" prjct work Start a work cycle"),console.log(" prjct land Session-close checklist"),console.log(" prjct memory export Git-share team memory"),console.log(""),t&&t.agents.length>0&&(console.log(` Detected agents: ${t.agents.join(", ")}`),console.log("")),console.log(" Docs: https://prjct.app/docs"),console.log("")}async _agentSelections(t,e){if(t)return t.agents;try{let{detectInstalledAgents:i}=await import("./detection-MEYHME4X.mjs");return i(e)}catch{return[]}}async _applyInitialPacksAndPersona(t,e){let{activatePacks:i,detectSuggestedPacks:a}=await import("./pack-manager-SU53HCKK.mjs"),c=e.pack?e.pack.split(",").map(l=>l.trim()).filter(Boolean):e.persona?[]:await a(t);if(c.length>0&&await i(t,c,{suggestPersona:!0}),e.persona){let l=(await import("./config-manager-KYC7WUOS.mjs")).default,s=await l.readConfig(t);if(s){let u=s.persona??{role:e.persona};u.role=e.persona,await l.writeConfig(t,{...s,persona:u})}}}async _resolveInitialPrConvention(t,e){let{detectPrConventionSignal:i,defaultPrConventionFor:a}=await import("./pr-convention-7UGI7TFA.mjs"),{customWorkflowStorage:c}=await import("./custom-workflow-storage-M77INP6Z.mjs"),l=await i(e),s=a(l),u=!!(process.stdout.isTTY&&process.stdin.isTTY),x=(l.kind==="github-ambiguous"&&u?await(async()=>{let d=await import("@clack/prompts"),m=await d.confirm({message:"This project ships to GitHub with no PR template. Should ship open/update the PR automatically?",initialValue:!0});return d.isCancel(m)?null:m?"auto":"manual"})():null)??s;c.updateWorkflow(t,"ship",{metadata:{prConvention:x}})}async _seedShipWorkflow(t,e){let i=await M(e);await this._resolveInitialPrConvention(t,e);let{seedCodeShipRules:a}=await import("./shipping-GX4HFYJ3.mjs");await a(t,e);let c=f.getRulesForCommand(t,"ship").reduce((l,s)=>Math.max(l,s.sortOrder??0),0)+1;f.addRule(t,{type:"gate",command:"ship",position:"before",action:'git branch --show-current | grep -vE "^(main|master)$"',description:"Prevent shipping from main branch",enabled:!0,timeoutMs:5e3,sortOrder:c,createdAt:new Date().toISOString()}),i.lint&&f.addRule(t,{type:"step",command:"ship",position:"before",action:`${i.lint.command} || true`,description:"Lint code",enabled:!0,timeoutMs:12e4,sortOrder:c+1,createdAt:new Date().toISOString()}),i.test&&f.addRule(t,{type:"step",command:"ship",position:"before",action:`${i.test.command} || true`,description:"Run tests",enabled:!0,timeoutMs:3e5,sortOrder:c+(i.lint?2:1),createdAt:new Date().toISOString()})}};export{N as PlanningCommands};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{c as a}from"./chunk-L4COZ7ZH.mjs";import"./chunk-GAOQHD5S.mjs";import{a as e}from"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as n}from"./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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function u(f=process.cwd(),c){return a({event:"PostToolUse",projectPath:f,afterEmit:o(async(t,r)=>{let i=t.tool_input?.file_path;if(!(!i||!(await n.readConfig(r))?.projectId))try{await e.log(r,"post_edit",{file:i,tool:t.tool_name??"unknown"})}catch{}},"afterEmit")},c)}o(u,"runPostEditHook");export{u as runPostEditHook};
8
+ import{c as a}from"./chunk-L4COZ7ZH.mjs";import"./chunk-GAOQHD5S.mjs";import{a as e}from"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as n}from"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function u(f=process.cwd(),c){return a({event:"PostToolUse",projectPath:f,afterEmit:o(async(t,r)=>{let i=t.tool_input?.file_path;if(!(!i||!(await n.readConfig(r))?.projectId))try{await e.log(r,"post_edit",{file:i,tool:t.tool_name??"unknown"})}catch{}},"afterEmit")},c)}o(u,"runPostEditHook");export{u as runPostEditHook};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as d}from"./chunk-SN224ILI.mjs";import{a as k}from"./chunk-4WHS7CO7.mjs";import{c as l}from"./chunk-MXHX44WF.mjs";import{a as m,c as p}from"./chunk-MECJJJ7R.mjs";import{c as u}from"./chunk-L4COZ7ZH.mjs";import"./chunk-KEJ5RMAI.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-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-SOPRYWUY.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-V37VTXDW.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{a as r}from"./chunk-E66B27AL.mjs";var s=new WeakMap;function f(e){let o=e.tool_input??e.toolInput;return o&&typeof o.command=="string"?o.command:typeof e.command=="string"?e.command:o&&typeof o.command_line=="string"?o.command_line:""}r(f,"extractCommand");function y(e){let o=f(e),t=o?l(o):null;return t?{deny:t}:null}r(y,"decideBroadProcessTermination");function g(e,o){let t=o,n=s.get(t);if(n)return n;let a=d(e,o);return s.set(t,a),a}r(g,"evaluatePackageOnce");function x(e=process.cwd(),o){return u({event:"PreToolUse",projectPath:e,decide:r(async(t,n)=>{try{let a=k(t);if(a)return a;let c=y(t);if(c)return c;let i=await g(n,t);return i?.strict?{deny:i.message}:null}catch{return null}},"decide"),build:r(async(t,n)=>{try{let[a,c]=await Promise.all([p(t)?m(n):null,g(n,t)]),i=c&&!c.strict?`# prjct: package legitimacy (advisory)
8
+ import{a as d}from"./chunk-D6KT763C.mjs";import{a as k}from"./chunk-4WHS7CO7.mjs";import{c as l}from"./chunk-MXHX44WF.mjs";import{a as m,c as p}from"./chunk-QZSJSXJV.mjs";import{c as u}from"./chunk-L4COZ7ZH.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-SOPRYWUY.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-V37VTXDW.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as r}from"./chunk-E66B27AL.mjs";var s=new WeakMap;function f(e){let o=e.tool_input??e.toolInput;return o&&typeof o.command=="string"?o.command:typeof e.command=="string"?e.command:o&&typeof o.command_line=="string"?o.command_line:""}r(f,"extractCommand");function y(e){let o=f(e),t=o?l(o):null;return t?{deny:t}:null}r(y,"decideBroadProcessTermination");function g(e,o){let t=o,n=s.get(t);if(n)return n;let a=d(e,o);return s.set(t,a),a}r(g,"evaluatePackageOnce");function x(e=process.cwd(),o){return u({event:"PreToolUse",projectPath:e,decide:r(async(t,n)=>{try{let a=k(t);if(a)return a;let c=y(t);if(c)return c;let i=await g(n,t);return i?.strict?{deny:i.message}:null}catch{return null}},"decide"),build:r(async(t,n)=>{try{let[a,c]=await Promise.all([p(t)?m(n):null,g(n,t)]),i=c&&!c.strict?`# prjct: package legitimacy (advisory)
9
9
  ${c.message}`:null;return[a,i].filter(Boolean).join(`
10
10
 
11
11
  `)||null}catch{return null}finally{s.delete(t)}},"build")},o)}r(x,"runPreBashHook");export{y as decideBroadProcessTermination,x as runPreBashHook};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c}from"./chunk-MECJJJ7R.mjs";import"./chunk-L4COZ7ZH.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-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.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 buildPreCommitContext,c as isCommitInput,b as runPreCommitHook};
8
+ import{a,b,c}from"./chunk-QZSJSXJV.mjs";import"./chunk-L4COZ7ZH.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as buildPreCommitContext,c as isCommitInput,b as runPreCommitHook};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as R}from"./chunk-4WHS7CO7.mjs";import{a as E}from"./chunk-5WAONIPX.mjs";import{b as m,c as A}from"./chunk-L4COZ7ZH.mjs";import{a as x}from"./chunk-XGYCAVB2.mjs";import{a as b,b as M,c as T,d as C,e as g,f as k,g as p,i as w}from"./chunk-A4OFZ2SK.mjs";import"./chunk-ZZ65CN5F.mjs";import{b as I,c as S,d as $}from"./chunk-JQLJM4BK.mjs";import"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a as L}from"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import{b as v}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-SOPRYWUY.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-V37VTXDW.mjs";import{b as h}from"./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{a as i}from"./chunk-E66B27AL.mjs";var O=new Set(["decision","gotcha","fact","spec","identity","voice","glossary"]);function N(r){return O.has(r)}i(N,"isSotBindType");function V(r,o){let n=new Set(o??[]);return r.filter(e=>N(e.type)&&e.confidence==="high"&&e.id&&!n.has(e.id))}i(V,"filterSotCandidates");function H(r){let o=V(r.candidates,r.overriddenIds);if(o.length===0)return{action:"none",reason:"no-sot",memoryIds:[],message:""};let n=r.harnessLevel??null,e=r.fileLabel?` on \`${r.fileLabel}\``:"",t=o[0],a=o.map(s=>s.id),l='To supersede: `prjct remember decision "\u2026why\u2026" --tags supersedes:'+t.id+'`. To lift for this memory: `prjct remember feedback "override conflict '+t.id+': <why>" --tags conflict:override,memory:'+t.id+"`.";if(n==="H2"||n==="H3"){let s=`SoT hard-bind (${n})${e}: must not contradict [${t.type}] ${B(t.content,80)} (\`${t.id}\`)`;return{action:"deny",reason:"h2-sot-deny",memoryIds:a,message:[`\u26D4 prjct SoT bind: ${s}`,`Memories: ${a.join(", ")}`,l,"H2+ work is bound to living Source-of-Truth. Supersede or override before Edit|Write."].join(" ")}}return n==="H1"?{action:"warn",reason:"h1-sot-warn",memoryIds:a,message:["# prjct: SoT soft-bind (H1)","",`High-confidence SoT on this file${e}:`,...o.slice(0,3).map(s=>`- **[${s.type}]** ${B(s.content,100)} \`${s.id}\``),"",l,"","> H2+ would hard-block. On H1 this is advisory \u2014 supersede if intentional."].join(`
8
+ import{a as R}from"./chunk-4WHS7CO7.mjs";import{a as E}from"./chunk-5WAONIPX.mjs";import{b as m,c as A}from"./chunk-L4COZ7ZH.mjs";import{a as x}from"./chunk-TFGJVT6F.mjs";import{a as b,b as M,c as T,d as C,e as g,f as k,g as p,i as w}from"./chunk-RAHFKGM6.mjs";import"./chunk-ZZ65CN5F.mjs";import{b as I,c as S,d as $}from"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a as L}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import{b as v}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-SOPRYWUY.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-V37VTXDW.mjs";import{b as h}from"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";var O=new Set(["decision","gotcha","fact","spec","identity","voice","glossary"]);function N(r){return O.has(r)}i(N,"isSotBindType");function V(r,o){let n=new Set(o??[]);return r.filter(e=>N(e.type)&&e.confidence==="high"&&e.id&&!n.has(e.id))}i(V,"filterSotCandidates");function H(r){let o=V(r.candidates,r.overriddenIds);if(o.length===0)return{action:"none",reason:"no-sot",memoryIds:[],message:""};let n=r.harnessLevel??null,e=r.fileLabel?` on \`${r.fileLabel}\``:"",t=o[0],a=o.map(s=>s.id),l='To supersede: `prjct remember decision "\u2026why\u2026" --tags supersedes:'+t.id+'`. To lift for this memory: `prjct remember feedback "override conflict '+t.id+': <why>" --tags conflict:override,memory:'+t.id+"`.";if(n==="H2"||n==="H3"){let s=`SoT hard-bind (${n})${e}: must not contradict [${t.type}] ${B(t.content,80)} (\`${t.id}\`)`;return{action:"deny",reason:"h2-sot-deny",memoryIds:a,message:[`\u26D4 prjct SoT bind: ${s}`,`Memories: ${a.join(", ")}`,l,"H2+ work is bound to living Source-of-Truth. Supersede or override before Edit|Write."].join(" ")}}return n==="H1"?{action:"warn",reason:"h1-sot-warn",memoryIds:a,message:["# prjct: SoT soft-bind (H1)","",`High-confidence SoT on this file${e}:`,...o.slice(0,3).map(s=>`- **[${s.type}]** ${B(s.content,100)} \`${s.id}\``),"",l,"","> H2+ would hard-block. On H1 this is advisory \u2014 supersede if intentional."].join(`
9
9
  `)}:{action:"none",reason:"none",memoryIds:a,message:""}}i(H,"sotBindVerdict");function B(r,o){let n=r.replace(/\s+/g," ").trim();return n.length>o?`${n.slice(0,o-1)}\u2026`:n}i(B,"truncate");function F(r,o){if(o.length===0)return null;let n=[`# prjct: heads-up before editing \`${r}\``,"",`${o.length} preventive trap(s) recorded against this file:`,""];for(let e of o)n.push(`- **[${e.type}]** ${e.title} \`${e.id}\``);return n.push(""),n.push("> Dynasty trap-before-edit: surface is mandatory. Apply if it still holds; supersede if not."),n.join(`
10
10
  `)}i(F,"formatTrapSurfaceMessage");var y=1200,_=new Map;function D(r,o){let n=`${r}\0${o}`,e=_.get(n);if(e)return e;let t=(()=>{try{return L.recallForFile(r,o,M,{preventiveOnly:!0})}catch{return[]}})();return _.set(n,t),t}i(D,"recallPreventiveOnce");function P(){_.clear()}i(P,"clearPreventiveCache");function U(r,o){let n=F(o,r.map(t=>({id:t.id,type:I(t),title:`${$(t)} \u2014 ${S(t.content)}`})));if(n)return m(n,y);let e=[`# prjct: heads-up before editing \`${o}\``,""];e.push(`${r.length} preventive memory entr${r.length===1?"y":"ies"} recorded against this file:`),e.push("");for(let t of r)e.push(`- **[${I(t)}] ${$(t)}** \u2014 ${S(t.content)} \`${t.id}\``);return e.push(""),e.push("> Nudge, not block. Apply if it still holds; proceed if not."),m(e.join(`
11
11
  `),y)}i(U,"headsUpMessage");async function W(r,o){let n=Date.now(),e=await h.readConfig(r);if(!e?.projectId)return null;let t=D(e.projectId,o);if(p(n)||t.length===0)return null;x(e.projectId,r,t.map(f=>f.id));let a=w(e),l=C(e.projectId),s=k(t),u=o.split("/").pop()??o,d=T({mode:a,candidates:s,overriddenIds:l,fileLabel:u});if(p(n))return null;try{let f=await v.getCurrentTask(e.projectId),c=H({harnessLevel:f?.harness?.level??null,candidates:s,overriddenIds:l,fileLabel:u});if(c.action==="warn"&&c.message)return m(c.message,y)}catch{}return d.action==="warn"&&d.message?(g(r,e.projectId,"warn",d.memoryIds,d.reason),m(d.message,y)):a==="off"||d.action==="none"||t.length>0?U(t,u):null}i(W,"buildPreEditContext");async function G(r,o){let n=Date.now();try{let e=await h.readConfig(r);if(!e?.projectId)return null;let t=await v.getCurrentTask(e.projectId);if(e.maxTurnsPerCycle){let j=E(e,t);if(j.stopped)return{deny:j.message}}if(!o||p(n,b))return null;let a=D(e.projectId,o);if(a.length===0||p(n,b))return null;let l=C(e.projectId),s=o.split("/").pop()??o,u=k(a),d=H({harnessLevel:t?.harness?.level??null,candidates:u,overriddenIds:l,fileLabel:s});if(d.action==="deny"&&d.message)return g(r,e.projectId,"deny",d.memoryIds,d.reason),{deny:d.message};let f=w(e);if(f!=="strict")return null;let c=T({mode:f,candidates:u,overriddenIds:l,fileLabel:s});return c.action==="deny"&&c.message?(g(r,e.projectId,"deny",c.memoryIds,c.reason),{deny:c.message}):null}catch{return null}}i(G,"decideHardStop");function ce(r=process.cwd(),o){return A({event:"PreToolUse",projectPath:r,decide:i(async(n,e)=>{P();let t=R(n);return t||G(e,n.tool_input?.file_path?.trim())},"decide"),build:i(async(n,e)=>{try{let t=n.tool_input?.file_path?.trim();return t?W(e,t):null}finally{P()}},"build")},o)}i(ce,"runPreEditHook");export{ce as runPreEditHook};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b}from"./chunk-SN224ILI.mjs";import"./chunk-L4COZ7ZH.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-SOPRYWUY.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-V37VTXDW.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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as evaluatePrePackageInput,b as runPrePackageHook};
8
+ import{a,b}from"./chunk-D6KT763C.mjs";import"./chunk-L4COZ7ZH.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-SOPRYWUY.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-V37VTXDW.mjs";import"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as evaluatePrePackageInput,b as runPrePackageHook};
@@ -5,5 +5,5 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as g,c as d}from"./chunk-L4COZ7ZH.mjs";import{e as f,h as p}from"./chunk-NJAMZSHM.mjs";import"./chunk-GAOQHD5S.mjs";import{b as u}from"./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-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";var _=900,h=80,b=8;function m(e){let o=e.tool_input?.pattern??e.tool_input?.query??e.tool_input?.glob??"";if(!o||typeof o!="string")return null;let t=o.match(/[A-Za-z_][A-Za-z0-9_]{2,}/g);if(!t||t.length===0)return null;t.sort((n,s)=>s.length-n.length);let r=new Set(["the","and","for","from","import","export","function","class","const","type","interface","return","async","await","true","false","null","undefined","test","describe","src","core","node","modules"]);for(let n of t)if(!r.has(n.toLowerCase()))return n;return t[0]??null}l(m,"extractToken");async function k(e,o){let t=Date.now();try{let r=(o.tool_name??"").toLowerCase();if(r&&!/grep|glob|search/i.test(r))return null;let n=m(o);if(!n)return null;let s=await u.readConfig(e);if(!s?.projectId||!f(s.projectId)||Date.now()-t>h)return null;let a=p(s.projectId,n,{limit:b});if(a.length===0||Date.now()-t>h)return null;let c=["# prjct code graph (non-blocking)","",`Grep/Glob token \`${n}\` matches indexed symbols \u2014 prefer these before more tree walks:`,""];for(let i of a)c.push(`- **${i.name}** (${i.kind}${i.exported?", exported":""}) \u2014 \`${i.file}:${i.startLine}\``);return c.push(""),c.push(`> Expand: \`prjct code trace ${n}\` or MCP \`prjct_trace_path\`. This inject never blocks the tool.`),g(c.join(`
8
+ import{b as g,c as d}from"./chunk-L4COZ7ZH.mjs";import{e as f,h as p}from"./chunk-NJAMZSHM.mjs";import"./chunk-GAOQHD5S.mjs";import{b as u}from"./chunk-W5OWBOLH.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-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";var _=900,h=80,b=8;function m(e){let o=e.tool_input?.pattern??e.tool_input?.query??e.tool_input?.glob??"";if(!o||typeof o!="string")return null;let t=o.match(/[A-Za-z_][A-Za-z0-9_]{2,}/g);if(!t||t.length===0)return null;t.sort((n,s)=>s.length-n.length);let r=new Set(["the","and","for","from","import","export","function","class","const","type","interface","return","async","await","true","false","null","undefined","test","describe","src","core","node","modules"]);for(let n of t)if(!r.has(n.toLowerCase()))return n;return t[0]??null}l(m,"extractToken");async function k(e,o){let t=Date.now();try{let r=(o.tool_name??"").toLowerCase();if(r&&!/grep|glob|search/i.test(r))return null;let n=m(o);if(!n)return null;let s=await u.readConfig(e);if(!s?.projectId||!f(s.projectId)||Date.now()-t>h)return null;let a=p(s.projectId,n,{limit:b});if(a.length===0||Date.now()-t>h)return null;let c=["# prjct code graph (non-blocking)","",`Grep/Glob token \`${n}\` matches indexed symbols \u2014 prefer these before more tree walks:`,""];for(let i of a)c.push(`- **${i.name}** (${i.kind}${i.exported?", exported":""}) \u2014 \`${i.file}:${i.startLine}\``);return c.push(""),c.push(`> Expand: \`prjct code trace ${n}\` or MCP \`prjct_trace_path\`. This inject never blocks the tool.`),g(c.join(`
9
9
  `),_)}catch{return null}}l(k,"buildSearchAugment");async function x(e,o){await d({event:"PreToolUse",projectPath:e,build:l((t,r)=>k(r,t),"build")},o)}l(x,"runPreSearchHook");var j={extractToken:m,buildSearchAugment:k};export{j as _internal,x as runPreSearchHook};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d}from"./chunk-SNISJ7HR.mjs";import"./chunk-KEJ5RMAI.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-SYHDEUVU.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as buildPrjctMdBody,a as buildProjectFactsSection,d as formatProjectFactsMd,c as writeProjectPrjctMd};
8
+ import{a,b,c,d}from"./chunk-EHBEHLYN.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-W5OWBOLH.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-SYHDEUVU.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as buildPrjctMdBody,a as buildProjectFactsSection,d as formatProjectFactsMd,c as writeProjectPrjctMd};