@buddysh/buddy 0.11.15 → 0.11.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/bin/cli.js +19 -19
- package/dist/{chunk-mg67hhgj.js → chunk-0kce7e60.js} +1 -1
- package/dist/chunk-0n03s02h.js +2 -0
- package/dist/{chunk-s82adeq9.js → chunk-16aeend1.js} +1 -1
- package/dist/{chunk-qcvtp2mt.js → chunk-1a14rx5n.js} +1 -1
- package/dist/{chunk-sztjfky1.js → chunk-1g43mpqn.js} +1 -1
- package/dist/chunk-1k4p8wyx.js +2 -0
- package/dist/{chunk-m00hfvnp.js → chunk-1mkwhnsf.js} +1 -1
- package/dist/{chunk-6prz7chv.js → chunk-1pdvjg0x.js} +1 -1
- package/dist/{chunk-9kscva05.js → chunk-20ex3fxc.js} +1 -1
- package/dist/chunk-2309x9r7.js +2 -0
- package/dist/{chunk-jkn2sdm0.js → chunk-26yejy1v.js} +1 -1
- package/dist/{chunk-dkhherd0.js → chunk-2f7j0dmw.js} +1 -1
- package/dist/{chunk-drmk6r1m.js → chunk-2z9mh5y4.js} +1 -1
- package/dist/chunk-3jm67wxm.js +2 -0
- package/dist/chunk-3mnpvfg3.js +2 -0
- package/dist/chunk-485kgdtb.js +2 -0
- package/dist/{chunk-nn5rzwty.js → chunk-4chtv4nh.js} +1 -1
- package/dist/{chunk-7b156stw.js → chunk-4dz5x4xw.js} +1 -1
- package/dist/chunk-4jgf7sfa.js +2 -0
- package/dist/{chunk-01d81hn0.js → chunk-4r03rh93.js} +1 -1
- package/dist/{chunk-3a63hke8.js → chunk-4wv5s3vr.js} +1 -1
- package/dist/{chunk-a6hv92fx.js → chunk-51m5tgwp.js} +1 -1
- package/dist/chunk-5t07s3dv.js +2 -0
- package/dist/{chunk-ebnc6980.js → chunk-6gvx1g6h.js} +1 -1
- package/dist/{chunk-c4cj24qm.js → chunk-6kd81nf9.js} +2 -2
- package/dist/{chunk-j6geg3qt.js → chunk-6w0n6c07.js} +1 -1
- package/dist/{chunk-y1d6e0ye.js → chunk-743mhx0e.js} +1 -1
- package/dist/{chunk-eh71jv8w.js → chunk-7hm46cej.js} +1 -1
- package/dist/{chunk-t879n4ab.js → chunk-7p1b809h.js} +1 -1
- package/dist/chunk-8b7cwedf.js +2 -0
- package/dist/{chunk-dg2q6egm.js → chunk-8r2819xn.js} +1 -1
- package/dist/{chunk-4qv88x27.js → chunk-8wrbxhs3.js} +1 -1
- package/dist/{chunk-s5czyzje.js → chunk-9chq5m4p.js} +3 -3
- package/dist/chunk-9fagkyrp.js +2 -0
- package/dist/{chunk-kjhqe26r.js → chunk-9gabxm8n.js} +1 -1
- package/dist/{chunk-c9266b5x.js → chunk-a8wcn3mh.js} +1 -1
- package/dist/chunk-aann4nkc.js +2 -0
- package/dist/{chunk-zjp519wm.js → chunk-bafzw99p.js} +1 -1
- package/dist/{chunk-gcwg4b2w.js → chunk-bgb44971.js} +1 -1
- package/dist/{chunk-4fh7w98z.js → chunk-bw43q8k7.js} +1 -1
- package/dist/{chunk-v808b36p.js → chunk-byqzhgzs.js} +1 -1
- package/dist/{chunk-zy49dwqk.js → chunk-c63e4ssc.js} +2 -2
- package/dist/{chunk-xn2960z7.js → chunk-cb25v2mp.js} +1 -1
- package/dist/{chunk-ma01xp3y.js → chunk-d09qj570.js} +1 -1
- package/dist/chunk-dttp44vs.js +2 -0
- package/dist/{chunk-1znpbjrv.js → chunk-dxd0eg4r.js} +1 -1
- package/dist/{chunk-6np84pfr.js → chunk-ewhvahnb.js} +1 -1
- package/dist/{chunk-2z85fqdp.js → chunk-fsghqtgf.js} +2 -2
- package/dist/chunk-fzs7vpps.js +2 -0
- package/dist/{chunk-zpgm9yzy.js → chunk-g09atq0m.js} +1 -1
- package/dist/{chunk-k907b533.js → chunk-gg1ddvnf.js} +1 -1
- package/dist/chunk-gkb0gja4.js +2 -0
- package/dist/{chunk-rwz433q2.js → chunk-gq9gkyah.js} +2 -2
- package/dist/{chunk-92gh2n65.js → chunk-gvpsbmeg.js} +1 -1
- package/dist/{chunk-wf1jcxtr.js → chunk-h2f92qwd.js} +1 -1
- package/dist/{chunk-66nntsnf.js → chunk-hd74jxm2.js} +1 -1
- package/dist/{chunk-p16pnhj3.js → chunk-her5azyp.js} +1 -1
- package/dist/{chunk-4kyxrwxn.js → chunk-hk4d7rky.js} +1 -1
- package/dist/chunk-hxkxset4.js +2 -0
- package/dist/{chunk-9n1kth4b.js → chunk-j57716xw.js} +1 -1
- package/dist/chunk-jgq5d6s2.js +2 -0
- package/dist/{chunk-awjm9n45.js → chunk-km4aszfp.js} +1 -1
- package/dist/{chunk-ymh0kwm4.js → chunk-knhvdm94.js} +2 -2
- package/dist/{chunk-q9mxgp0n.js → chunk-kpsvwjac.js} +11 -11
- package/dist/chunk-kthwzc4p.js +2 -0
- package/dist/{chunk-028354j6.js → chunk-m3rftash.js} +7 -7
- package/dist/{chunk-bstgsak0.js → chunk-m9qtb4xj.js} +1 -1
- package/dist/{chunk-2b07w74s.js → chunk-mr2d1zp0.js} +1 -1
- package/dist/{chunk-xyzcgskb.js → chunk-mthd2c8m.js} +1 -1
- package/dist/{chunk-w2ccdet4.js → chunk-mtn4angk.js} +1 -1
- package/dist/chunk-n960rjcr.js +2 -0
- package/dist/{chunk-37zd94a7.js → chunk-nk8wxxy7.js} +2 -2
- package/dist/{chunk-eccac8h7.js → chunk-nzk13c4q.js} +1 -1
- package/dist/{chunk-cx89kty3.js → chunk-nznpzbq4.js} +1 -1
- package/dist/{chunk-hc2pdv4j.js → chunk-p9xksx9p.js} +1 -1
- package/dist/{chunk-n5mz7csc.js → chunk-pa7pav6h.js} +1 -1
- package/dist/{chunk-ym9475ry.js → chunk-pag93kz1.js} +1 -1
- package/dist/{chunk-bgw39afd.js → chunk-psjrcpgb.js} +1 -1
- package/dist/{chunk-q99xd3m5.js → chunk-pxfrq43h.js} +1 -1
- package/dist/chunk-q4j2f72t.js +2 -0
- package/dist/{chunk-fgec04jx.js → chunk-qbep9dk4.js} +1 -1
- package/dist/{chunk-j7qktvpg.js → chunk-qngnmrpw.js} +1 -1
- package/dist/chunk-r1jvyhhd.js +4 -0
- package/dist/{chunk-p2h2z6d3.js → chunk-r7qa2ykf.js} +2 -2
- package/dist/chunk-rqj1vrfs.js +2 -0
- package/dist/{chunk-34vracy4.js → chunk-s0ps33ft.js} +1 -1
- package/dist/{chunk-qjzpzd7j.js → chunk-s3b3vrsj.js} +1 -1
- package/dist/chunk-s4fccg73.js +2 -0
- package/dist/{chunk-zrec546r.js → chunk-sddaassq.js} +1 -1
- package/dist/{chunk-6qw89f68.js → chunk-sj7n6xa1.js} +1 -1
- package/dist/{chunk-t5hq4ke1.js → chunk-t1r2ycn7.js} +1 -1
- package/dist/{chunk-1tdkpeva.js → chunk-tjj6ttj1.js} +1 -1
- package/dist/{chunk-dq681xgx.js → chunk-tsd9jw07.js} +1 -1
- package/dist/{chunk-s609kp6h.js → chunk-ttkjzy0m.js} +1 -1
- package/dist/chunk-txe5z472.js +2 -0
- package/dist/chunk-vffz69jj.js +2 -0
- package/dist/{chunk-sn0qr6q7.js → chunk-vs61069x.js} +1 -1
- package/dist/{chunk-3a5gcj3y.js → chunk-wc2z7krw.js} +1 -1
- package/dist/{chunk-jn3t9v6d.js → chunk-wfg3bp85.js} +1 -1
- package/dist/{chunk-5sh69bkj.js → chunk-wfwrm4k3.js} +1 -1
- package/dist/{chunk-3nn2j810.js → chunk-whtdmv3p.js} +1 -1
- package/dist/{chunk-gjhxc6ma.js → chunk-wk175yyw.js} +1 -1
- package/dist/chunk-wn9vr9ct.js +2 -0
- package/dist/{chunk-zwtx6vn3.js → chunk-wzncz6j5.js} +1 -1
- package/dist/{chunk-m8brd9b5.js → chunk-y2ntnpdb.js} +1 -1
- package/dist/{chunk-xhn5331s.js → chunk-y5fdq7cd.js} +1 -1
- package/dist/{chunk-7t8s2mcf.js → chunk-yh13j2af.js} +1 -1
- package/dist/chunk-yr6qyeab.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/dist/src/utils/dependency-file-parser.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunk-18en5afz.js +0 -2
- package/dist/chunk-2bp1j0w0.js +0 -2
- package/dist/chunk-3578axtf.js +0 -2
- package/dist/chunk-3r0jb90q.js +0 -2
- package/dist/chunk-4x1mv7qj.js +0 -2
- package/dist/chunk-5qberaya.js +0 -2
- package/dist/chunk-86xv8x00.js +0 -2
- package/dist/chunk-87k997bm.js +0 -2
- package/dist/chunk-8jvmqdvc.js +0 -2
- package/dist/chunk-94tnmc7j.js +0 -4
- package/dist/chunk-c8xfj0m5.js +0 -2
- package/dist/chunk-cj5fkyxv.js +0 -2
- package/dist/chunk-d3m5kcpp.js +0 -2
- package/dist/chunk-dg1c0fyk.js +0 -2
- package/dist/chunk-fzfgvt8s.js +0 -2
- package/dist/chunk-j21m6rf6.js +0 -2
- package/dist/chunk-jjwxbcfz.js +0 -2
- package/dist/chunk-nd780ymh.js +0 -2
- package/dist/chunk-tmzd2p2n.js +0 -2
- package/dist/chunk-tqsrr90t.js +0 -2
- package/dist/chunk-v9avf6sc.js +0 -2
- package/dist/chunk-w2vsf1q0.js +0 -2
- package/dist/chunk-xjrb50hz.js +0 -2
- package/dist/chunk-y0rng1vc.js +0 -2
- package/dist/chunk-z0rsmhe4.js +0 -2
- package/dist/chunk-zcsahxe6.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ed as a,Fd as b,Gd as c,Hd as d,Id as e,Jd as f,Kd as g,Ld as h,Md as i,Nd as j}from"./chunk-7m3pzkcj.js";import"./chunk-
|
|
2
|
+
import{Ed as a,Fd as b,Gd as c,Hd as d,Id as e,Jd as f,Kd as g,Ld as h,Md as i,Nd as j}from"./chunk-7m3pzkcj.js";import"./chunk-16aeend1.js";export{j as shouldFail,h as formatReview,d as formatPretty,e as formatGithub,f as formatAgent,b as diffArgsFor,g as countBySeverity,c as collectLocalDiff,i as applySuggestion,a as REVIEW_FORMATS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ge as N}from"./chunk-142zh7e5.js";import{Sf as E}from"./chunk-24xvskkf.js";import{
|
|
2
|
+
import{ge as N}from"./chunk-142zh7e5.js";import{Sf as E}from"./chunk-24xvskkf.js";import{Rh as v}from"./chunk-wzncz6j5.js";import U from"process";var x=60000;async function D(q,K,$){let G=Bun.spawn([q,...K],{cwd:$,stdout:"pipe",stderr:"pipe",env:{PATH:U.env.PATH??"",HOME:U.env.HOME??"",LANG:"C"}}),Q=setTimeout(()=>G.kill(),x);try{let[W,V,X]=await Promise.all([new Response(G.stdout).text(),new Response(G.stderr).text(),G.exited]);return{stdout:W,stderr:V,exitCode:X}}finally{clearTimeout(Q)}}function F(q){switch(String(q??"").toLowerCase()){case"error":case"fatal":case"2":return"major";case"warning":case"warn":case"1":return"minor";default:return"nit"}}function j(q){let K=q.search(/[[{]/);if(K===-1)return null;try{return JSON.parse(q.slice(K))}catch{return null}}function H(q,K){let $=K.endsWith("/")?K:`${K}/`;return q.startsWith($)?q.slice($.length):q.replace(/^\.\//,"")}async function B(q){try{return await Bun.spawn(["which",q],{stdout:"ignore",stderr:"ignore",env:{PATH:U.env.PATH??""}}).exited===0}catch{return!1}}var y=/^(.+?):(\d+):(\d+):\s*(.*?)\s*\[([\w-]+)\]$/,I={name:"actionlint",filePatterns:[".github/workflows/*.yml",".github/workflows/*.yaml"],async available(){return B("actionlint")},async run(q,K){let{stdout:$}=await D("actionlint",["-oneline","-no-color",...q],K),G=[];for(let Q of $.split(`
|
|
3
3
|
`)){let W=y.exec(Q.trim());if(!W)continue;let[,V,X,,Z,Y]=W;G.push({path:H(V,K),line:Number(X),severity:"major",category:"workflow",message:`${Z} (${Y})`,tool:"actionlint"})}return G}};function u(q){switch(q){case"error":return"major";case"warning":return"minor";default:return"nit"}}var O={name:"workflow-audit",filePatterns:[".github/workflows/*.yml",".github/workflows/*.yaml"],async available(){return!0},async run(q,K){if(q.length===0)return[];let $=await N(K),G=new Set(q);return $.findings.filter((Q)=>G.has(Q.file)).map((Q)=>({path:Q.file,line:Q.line??1,severity:u(Q.severity),category:Q.ruleId,message:Q.fix?`${Q.message}
|
|
4
4
|
|
|
5
5
|
${Q.fix}`:Q.message,tool:"workflow-audit"}))}};var _={name:"hadolint",filePatterns:["**/Dockerfile","**/Dockerfile.*","**/*.dockerfile","**/Containerfile"],async available(){return B("hadolint")},async run(q,K){let{stdout:$}=await D("hadolint",["--format","json","--no-fail",...q],K),G=j($);if(!Array.isArray(G))return[];return G.filter((Q)=>Q.level==="error"||Q.level==="warning").map((Q)=>({path:H(Q.file,K),line:Math.max(1,Q.line),severity:F(Q.level),category:"docker",message:`${Q.message} (${Q.code})`,tool:"hadolint"}))}};import{join as b}from"path";import h from"process";async function J(q,K){let $=j(q);if(!Array.isArray($))return[];let G=[];for(let Q of $)for(let W of Q.messages??[]){if(!W.line)continue;G.push({path:H(Q.filePath,K),line:W.line,severity:F(W.severity),category:"lint",message:W.ruleId?`${W.message} (${W.ruleId})`:W.message})}return G}function f(q,K){if(K<0||K>q.length)return null;let $=1;for(let G=0;G<K;G++)if(q[G]===`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{md as J}from"./chunk-bnp0r4eh.js";import{nd as Y}from"./chunk-0f1xye20.js";import{ue as _}from"./chunk-
|
|
2
|
+
import{md as J}from"./chunk-bnp0r4eh.js";import{nd as Y}from"./chunk-0f1xye20.js";import{ue as _}from"./chunk-d09qj570.js";import{xe as x,ye as w}from"./chunk-wk175yyw.js";import{Qe as z,Re as M}from"./chunk-4wv5s3vr.js";import{Ye as N}from"./chunk-j46f90n8.js";import{Ag as L,Bg as S}from"./chunk-r1jvyhhd.js";import{Rh as G}from"./chunk-wzncz6j5.js";import{gl as j}from"./chunk-16aeend1.js";var{Glob:D}=globalThis.Bun;import{lstat as Z,readdir as A,readFile as U}from"fs/promises";import{join as R,relative as E,sep as H}from"path";async function I(q,K){try{let O=JSON.parse(K),V=[];if(O.packages){for(let Q of Object.values(O.packages))if(Q.name&&Q.version)V.push({name:Q.name,currentVersion:Q.version,type:"dependencies",file:q})}return{path:q,type:"pantry.lock",content:K,dependencies:V}}catch(O){return G().warn(`Failed to parse pantry.lock file ${q}:`,O),null}}class m{projectPath;logger;ignoreGlobs=[];constructor(q,K,O){this.projectPath=q;this.logger=K;if(O&&O.length>0)this.ignoreGlobs=O.map((V)=>new D(V)),this.logger.info(`Initialized ${this.ignoreGlobs.length} ignore patterns: ${O.join(", ")}`)}async scanProject(){this.logger.info("Scanning project for package files...");let q=Date.now(),K=[];try{let O=await this.findFiles("package.json");for(let X of O){if(this.shouldIgnorePath(X))continue;let $=await this.parsePackageJsonFile(X);if($)K.push($)}let V=await this.findDependencyFiles();for(let X of V){if(this.shouldIgnorePath(X))continue;let $=await this.parseDependencyFile(X);if($)K.push($)}let Q=await this.findLockFiles();for(let X of Q){if(this.shouldIgnorePath(X))continue;let $=await this.parseLockFile(X);if($)K.push($)}let W=await this.findComposerFiles();for(let X of W){if(this.shouldIgnorePath(X))continue;let $=await this.parseComposerFile(X);if($)K.push($)}let B=await this.findGitHubActionsFiles();for(let X of B){if(this.shouldIgnorePath(X))continue;let $=await this.parseGitHubActionsFile(X);if($)K.push($)}let C=await this.findDockerfiles();this.logger.info(`\uD83D\uDD0D Found ${C.length} Dockerfile(s): ${C.join(", ")}`);for(let X of C){if(this.shouldIgnorePath(X))continue;let $=await this.parseDockerfile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed Dockerfile: ${X} with ${$.dependencies.length} dependencies`)}let T=await this.findZigManifests();this.logger.info(`\uD83D\uDD0D Found ${T.length} Zig manifest(s): ${T.join(", ")}`);for(let X of T){if(this.shouldIgnorePath(X))continue;let $=await this.parseZigManifestFile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed Zig manifest: ${X} with ${$.dependencies.length} dependencies`)}let b=await this.findFiles("pantry.lock");for(let X of b){if(this.shouldIgnorePath(X))continue;let $=await this.parsePantryLockFile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed pantry.lock: ${X} with ${$.dependencies.length} dependencies`)}let v=Date.now()-q;return this.logger.success(`Found ${K.length} package files in ${v}ms`),K}catch(O){throw this.logger.error("Failed to scan project:",O),new Y(`Failed to scan project: ${O instanceof Error?O.message:"Unknown error"}`)}}async parsePackageJsonFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),V=JSON.parse(O),Q=[];return this.extractDependencies(V.dependencies,"dependencies",q,Q),this.extractDependencies(V.devDependencies,"devDependencies",q,Q),this.extractDependencies(V.peerDependencies,"peerDependencies",q,Q),this.extractDependencies(V.optionalDependencies,"optionalDependencies",q,Q),Q.push(...N(V.engines,q)),{path:q,type:"package.json",content:O,dependencies:Q}}catch(K){return this.logger.warn(`Failed to parse package.json file ${q}:`,K),null}}async parseLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),V=q.split("/").pop()||"",Q;if(V==="bun.lockb")Q="bun.lockb";else if(V==="package-lock.json")Q="package-lock.json";else if(V==="yarn.lock")Q="yarn.lock";else if(V==="pnpm-lock.yaml")Q="pnpm-lock.yaml";else return null;let W=await this.extractLockFileDependencies(O,Q,q);return{path:q,type:Q,content:O,dependencies:W}}catch(K){return this.logger.warn(`Failed to parse lock file ${q}:`,K),null}}async parseDependencyFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await S(q,O)}catch(K){return this.logger.warn(`Failed to parse dependency file ${q}:`,K),null}}async findDependencyFiles(){let q=[],K=["deps.yaml","deps.yml","dependencies.yaml","dependencies.yml","pkgx.yaml","pkgx.yml",".deps.yaml",".deps.yml"];for(let Q of K){let W=await this.findFiles(Q);q.push(...W)}let O=await this.findFilesByPattern("*.yaml"),V=await this.findFilesByPattern("*.yml");for(let Q of[...O,...V])if(L(Q)&&!q.includes(Q))q.push(Q);return q}async findGitHubActionsFiles(){let q=[];try{if(!(await Z(R(this.projectPath,".github")).catch(()=>null))?.isDirectory())return q;let V=R(this.projectPath,".github","workflows");if((await Z(V).catch(()=>null))?.isDirectory()){let W=await this.findFilesByPatternInDir("*.yaml",V),B=await this.findFilesByPatternInDir("*.yml",V);for(let C of[...W,...B])if(x(C))q.push(C)}}catch{}return q}async findDockerfiles(){return this.findFilesMatching(z)}async findFilesMatching(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isFile()){if(q(Q))O.push(E(this.projectPath,W).split(H).join("/"))}else if(B.isDirectory()&&!J(Q))O.push(...await this.findFilesMatching(q,W))}catch{continue}}}catch{}return O}async parseGitHubActionsFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await w(q,O)}catch(K){return this.logger.warn(`Failed to parse GitHub Actions file ${q}:`,K),null}}async parseDockerfile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await M(q,O)}catch(K){return this.logger.warn(`Failed to parse Dockerfile ${q}:`,K),null}}async findZigManifests(){let q=[];try{let K=await this.findFiles("build.zig.zon");q.push(...K)}catch{}return q}async parseZigManifestFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await _(q,O)}catch(K){return this.logger.warn(`Failed to parse Zig manifest ${q}:`,K),null}}async findComposerFiles(){let q=[];try{let K=await this.findFiles("composer.json");q.push(...K);let O=await this.findFiles("composer.lock");q.push(...O)}catch{}return q}async parseComposerFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),{parseComposerFile:V}=await import("./chunk-1pdvjg0x.js");return await V(q,O)}catch(K){return this.logger.warn(`Failed to parse Composer file ${q}:`,K),null}}async parsePantryLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await I(q,O)}catch(K){return this.logger.warn(`Failed to parse pantry.lock file ${q}:`,K),null}}extractDependencies(q,K,O,V){if(!q)return;for(let[Q,W]of Object.entries(q))V.push({name:Q,currentVersion:W,type:K,file:this.getRelativePath(O)})}async extractLockFileDependencies(q,K,O){let V=[];if(K==="package-lock.json")try{let Q=JSON.parse(q);if(Q.packages){for(let[W,B]of Object.entries(Q.packages))if(W&&W!==""&&B&&typeof B==="object"){let C=B;if(C.version){let T=W.startsWith("node_modules/")?W.replace("node_modules/",""):W;V.push({name:T,currentVersion:C.version,type:C.dev?"devDependencies":"dependencies",file:this.getRelativePath(O)})}}}}catch(Q){this.logger.warn("Failed to parse package-lock.json:",Q)}return V}async findFiles(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isDirectory()){if(!J(Q)){let C=await this.findFiles(q,W);O.push(...C)}}else if(B.isFile()&&Q===q){let C=E(this.projectPath,W);O.push(C.split(H).join("/"))}}catch{continue}}}catch{}return O}async findLockFiles(){let q=["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml"],K=[];for(let O of q){let V=await this.findFiles(O);K.push(...V)}return K}async findFilesByPattern(q){let K=[],O=q.replace("*.","");try{let V=await A(this.projectPath);for(let Q of V){let W=R(this.projectPath,Q),B=await Z(W);if(B.isFile()&&Q.endsWith(`.${O}`)){let C=E(this.projectPath,W);K.push(C.split(H).join("/"))}else if(B.isDirectory()&&!J(Q)){let C=await this.findFilesByPatternInDir(q,W);K.push(...C)}}}catch{}return K}async findFilesByPatternInDir(q,K){let O=[],V=q.replace("*.","");try{let Q=await A(K);for(let W of Q){let B=R(K,W),C=await Z(B);if(C.isFile()&&W.endsWith(`.${V}`)){let T=E(this.projectPath,B);O.push(T.split(H).join("/"))}else if(C.isDirectory()&&!J(W)){let T=await this.findFilesByPatternInDir(q,B);O.push(...T)}}}catch{}return O}shouldIgnorePath(q){if(this.ignoreGlobs.length===0)return!1;let K=q;if(q.startsWith("/")||q.includes(":"))K=this.getRelativePath(q);for(let O of this.ignoreGlobs)if(O.match(K))return this.logger.debug(`Ignoring path: ${K} (matched pattern)`),!0;return!1}getRelativePath(q){return E(this.projectPath,q).split(H).join("/")}async getDependencyCount(){return(await this.scanProject()).reduce((K,O)=>K+O.dependencies.length,0)}async getUniqueDependencies(){return(await this.scanProject()).flatMap((V)=>V.dependencies).filter((V,Q,W)=>Q===W.findIndex((B)=>B.name===V.name))}}
|
|
3
3
|
export{m as ld};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Lh as U}from"./chunk-s0ps33ft.js";import{Rh as f}from"./chunk-wzncz6j5.js";var{Glob:u}=globalThis.Bun;import{readdir as m}from"fs/promises";import{join as P,relative as l}from"path";import O from"process";var c=new Set(["node_modules","vendor","target",".git",".venv","venv","dist","build","__pycache__",".next",".cache"]);function W(z){return z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function L(z,H,$=4){let X=H.map((K)=>new u(K)),Z=[];async function J(K,G){if(G>$)return;let V=await m(K,{withFileTypes:!0}).catch(()=>[]);for(let Q of V){let j=P(K,Q.name);if(Q.isDirectory()){if(!c.has(Q.name)&&!Q.name.startsWith("."))await J(j,G+1);continue}if(!Q.isFile())continue;let q=l(z,j);if(X.some((Y)=>Y.match(Q.name)||Y.match(q)))Z.push(q)}}return await J(z,0),Z.sort()}async function M(z,H){let $=[],X=[];for(let Z of H){if(!await Bun.file(P(z,Z.lockfile)).exists())continue;let[J]=Z.command;if(!await E(J)){X.push(`${Z.lockfile} (needs \`${Z.command.join(" ")}\`)`);continue}if(await Bun.spawn(Z.command,{cwd:z,stdout:"ignore",stderr:"ignore",env:{PATH:O.env.PATH??"",HOME:O.env.HOME??""}}).exited===0)$.push(Z.lockfile);else X.push(`${Z.lockfile} (\`${Z.command.join(" ")}\` failed)`)}return{regenerated:$,...X.length>0?{note:`These lockfiles were not regenerated and need updating locally: ${X.join(", ")}.`}:{}}}async function E(z){try{return await Bun.spawn(["which",z],{stdout:"ignore",stderr:"ignore",env:{PATH:O.env.PATH??""}}).exited===0}catch{return!1}}function B(z,H){let $=(J)=>J.replace(/^[^\d]*/,"").split(/[.-]/).map((K)=>Number.parseInt(K,10)||0),X=$(z),Z=$(H);for(let J=0;J<Math.max(X.length,Z.length);J++){let K=(X[J]??0)-(Z[J]??0);if(K!==0)return K}return 0}function C(z,H){let $=(J)=>J.replace(/^[^\d]*/,"").split(/[.-]/).map((K)=>Number.parseInt(K,10)||0),X=$(z),Z=$(H);if((X[0]??0)!==(Z[0]??0))return"major";if((X[1]??0)!==(Z[1]??0))return"minor";return"patch"}var p=/^\s*(?:require\s+)?([\w.~-]+(?:\.[\w.~-]+)*\/[^\s]+)\s+(v[\w.+-]+)\s*(\/\/.*)?$/,R=/^v\d+\.\d+\.\d+-\d{14}-[a-f0-9]{12}$/,I={name:"go",manifestPatterns:["go.mod"],async detect(z){return L(z,this.manifestPatterns)},async parse(z,H){let $=[],X=!1;for(let Z of H.split(`
|
|
3
3
|
`)){let J=Z.trim();if(/^require\s*\($/.test(J)){X=!0;continue}if(X&&J===")"){X=!1;continue}if(!X&&!J.startsWith("require "))continue;let K=p.exec(Z);if(!K)continue;let[,G,V,Q]=K;if(Q?.includes("indirect"))continue;if(R.test(V))continue;$.push({name:G,currentVersion:V,section:"require",file:z})}return $},async latest(z,H={}){let $=H.registryUrl??"https://proxy.golang.org",X=z.name.replace(/[A-Z]/g,(K)=>`!${K.toLowerCase()}`),Z=await U(`${$}/${X}/@latest`,{headers:{"User-Agent":"buddy",Accept:"application/json"}}).catch(()=>null);if(!Z?.ok)return null;let J=await Z.json().catch(()=>null);if(!J?.Version)return null;if(R.test(J.Version))return null;return{latest:J.Version,...J.Time?{publishedAt:new Date(J.Time)}:{},releaseNotesUrl:`https://pkg.go.dev/${z.name}@${J.Version}`,homepage:`https://pkg.go.dev/${z.name}`}},applyUpdate(z,H){let $=W(H.name),X=W(H.currentVersion);return z.replace(new RegExp(`^(\\s*(?:require\\s+)?${$}\\s+)${X}(\\s|$)`,"gm"),`$1${H.newVersion}$2`)},async postWrite(z){return M(z,[{lockfile:"go.sum",command:["go","mod","tidy"]}])},osvEcosystem:"Go",compareVersions:B,updateType:C};var s=/^\s*v?(?:(\d+)!)?(\d+(?:\.\d+)*)((?:[-_.]?(?:a|b|c|rc|alpha|beta|pre|preview)[-_.]?\d*)?)((?:[-_.]?(?:post|rev|r)[-_.]?\d*|-\d+)?)((?:[-_.]?dev[-_.]?\d*)?)(?:\+([a-z0-9]+(?:[-_.][a-z0-9]+)*))?\s*$/i,i={a:"a",alpha:"a",b:"b",beta:"b",c:"rc",rc:"rc",pre:"rc",preview:"rc"},v={a:0,b:1,rc:2};function S(z){let H=s.exec(z);if(!H)return null;let[,$,X,Z,J,K,G]=H,V={epoch:$?Number($):0,release:X.split(".").map(Number)};if(Z){let Q=/([a-z]+)[-_.]?(\d*)/i.exec(Z);if(Q){let j=i[Q[1].toLowerCase()];if(j)V.pre=[j,Q[2]?Number(Q[2]):0]}}if(J){let Q=/(\d+)/.exec(J);V.post=Q?Number(Q[1]):0}if(K){let Q=/(\d+)/.exec(K);V.dev=Q?Number(Q[1]):0}if(G)V.local=G.toLowerCase();return V}function d(z,H){for(let $=0;$<Math.max(z.length,H.length);$++){let X=(z[$]??0)-(H[$]??0);if(X!==0)return X}return 0}function A(z,H){let $=S(z),X=S(H);if(!$||!X)return z===H?0:z<H?-1:1;if($.epoch!==X.epoch)return $.epoch-X.epoch;let Z=d($.release,X.release);if(Z!==0)return Z;let J=(Q)=>{if(Q.dev!==void 0&&Q.pre===void 0&&Q.post===void 0)return 0;if(Q.pre!==void 0)return 1;if(Q.post!==void 0)return 3;return 2},K=J($)-J(X);if(K!==0)return K;if($.pre&&X.pre){let Q=v[$.pre[0]]-v[X.pre[0]];if(Q!==0)return Q;if($.pre[1]!==X.pre[1])return $.pre[1]-X.pre[1]}if(($.post??0)!==(X.post??0))return($.post??0)-(X.post??0);let G=$.dev??Number.POSITIVE_INFINITY,V=X.dev??Number.POSITIVE_INFINITY;if(G!==V)return G<V?-1:1;return 0}function g(z){let H=S(z);return Boolean(H&&(H.pre!==void 0||H.dev!==void 0))}function D(z,H){let $=S(z),X=S(H);if(!$||!X)return"patch";if($.epoch!==X.epoch||($.release[0]??0)!==(X.release[0]??0))return"major";if(($.release[1]??0)!==(X.release[1]??0))return"minor";return"patch"}function N(z){let H=/^\s*(~=|===|==|!=|<=|>=|<|>|\^)?\s*(.*)$/.exec(z.trim());if(!H)return{operator:"",version:z.trim()};return{operator:H[1]??"",version:H[2].trim()}}var b=/^\s*([A-Z0-9][\w.-]*)\s*(\[[^\]]*\])?\s*([<>=!~^].*?)?\s*(?:;.*)?$/i,o=/^\s*(?:-|#|$)/;function r(z,H){let $=[];return H.split(`
|
|
4
4
|
`).forEach((X)=>{let Z=X.split("#")[0];if(o.test(Z))return;let J=b.exec(Z);if(!J?.[1]||!J[3])return;$.push({name:J[1],currentVersion:J[3].trim(),section:"dependencies",file:z,...J[2]?{metadata:{extras:J[2]}}:{}})}),$}var a=[[/^\s*dependencies\s*=\s*\[/m,"dependencies"],[/^\s*(?:dev-dependencies|dev)\s*=\s*\[/m,"devDependencies"]];function n(z,H){let $=[],X=new Set,Z=(K,G,V)=>{let Q=`${V}:${K}`;if(!G.trim()||G.trim()==="*"||X.has(Q))return;X.add(Q),$.push({name:K,currentVersion:G.trim(),section:V,file:z})};for(let[K,G]of a){let V=K.exec(H);if(!V)continue;let Q=V.index+V[0].length,j=H.indexOf("]",Q);if(j===-1)continue;for(let q of H.slice(Q,j).matchAll(/["']([^"']+)["']/g)){let Y=b.exec(q[1]);if(Y?.[1]&&Y[3])Z(Y[1],Y[3],G)}}let J=H.matchAll(/\[tool\.poetry\.(?:group\.[\w-]+\.)?(dependencies|dev-dependencies)\]([\s\S]*?)(?=\n\[|$)/g);for(let K of J){let G=K[1]==="dependencies"?"dependencies":"devDependencies";for(let V of K[2].matchAll(/^\s*([A-Z0-9][\w.-]*)\s*=\s*(.+)$/gim)){let Q=V[1];if(Q.toLowerCase()==="python")continue;let j=V[2].trim(),q=/version\s*=\s*["']([^"']+)["']/.exec(j),Y=/^["']([^"']+)["']/.exec(j),F=q?.[1]??Y?.[1];if(F)Z(Q,F,G)}}return $}var w={name:"python",manifestPatterns:["pyproject.toml","requirements.txt","requirements-*.txt","requirements/*.txt"],async detect(z){return L(z,this.manifestPatterns)},async parse(z,H){return z.endsWith(".toml")?n(z,H):r(z,H)},async latest(z,H={}){let $=H.registryUrl??"https://pypi.org",X=await U(`${$}/pypi/${encodeURIComponent(z.name)}/json`,{headers:{"User-Agent":"buddy",Accept:"application/json"}}).catch(()=>null);if(!X?.ok)return null;let Z=await X.json().catch(()=>null);if(!Z?.info?.version)return null;let J=Z.info.version;if(H.includePrerelease&&Z.releases){let V=Object.keys(Z.releases).filter((Q)=>!Z.releases[Q]?.every((j)=>j.yanked)).sort(A);J=V[V.length-1]??J}let G=Z.releases?.[J]?.find((V)=>V.upload_time_iso_8601)?.upload_time_iso_8601;return{latest:J,...G?{publishedAt:new Date(G)}:{},...Z.info.yanked?{deprecated:!0}:{},...Z.info.project_urls?.Changelog?{releaseNotesUrl:Z.info.project_urls.Changelog}:{},...Z.info.home_page?{homepage:Z.info.home_page}:{}}},applyUpdate(z,H){let{operator:$}=N(H.currentVersion),X=W(H.name),Z=W(H.currentVersion),J=N(H.newVersion).version,K=$?`${$}${J}`:J;return z.replace(new RegExp(`(^|["'\\s])(${X})(\\[[^\\]]*\\])?\\s*${Z}`,"gim"),(G,V,Q,j)=>`${V}${Q}${j??""}${K}`).replace(new RegExp(`^(\\s*${X}\\s*=\\s*["'])${Z}(["'])`,"gim"),`$1${K}$2`).replace(new RegExp(`^(\\s*${X}\\s*=\\s*\\{[^}]*version\\s*=\\s*["'])${Z}(["'])`,"gim"),`$1${K}$2`)},async postWrite(z){return M(z,[{lockfile:"uv.lock",command:["uv","lock"]},{lockfile:"poetry.lock",command:["poetry","lock","--no-update"]}])},osvEcosystem:"PyPI",compareVersions:A,updateType:D};var t=/^\s*gem\s+["']([\w-]+)["']\s*(?:,\s*["']([^"']+)["'])?/,e=/^\s*group\s+(.+?)\s+do\s*$/,zz=/^\s*end\s*$/,x={name:"ruby",manifestPatterns:["Gemfile","*.gemspec"],async detect(z){return L(z,this.manifestPatterns)},async parse(z,H){let $=[],X=[];for(let Z of H.split(`
|
|
5
5
|
`)){let J=Z.replace(/#.*$/,""),K=e.exec(J);if(K){X.push(K[1].replace(/[:'",\s]/g,"")||"default");continue}if(zz.test(J)){X.pop();continue}let G=t.exec(J);if(!G?.[1])continue;if(!G[2])continue;if(/\b(?:path|git|github|branch):/.test(J))continue;$.push({name:G[1],currentVersion:G[2],section:X.length>0?X[X.length-1]:"dependencies",file:z})}return $},async latest(z,H={}){let $=H.registryUrl??"https://rubygems.org",X=await U(`${$}/api/v1/versions/${encodeURIComponent(z.name)}.json`,{headers:{"User-Agent":"buddy",Accept:"application/json"}}).catch(()=>null);if(!X?.ok)return null;let Z=await X.json().catch(()=>null);if(!Array.isArray(Z)||Z.length===0)return null;let J=Z.filter((G)=>G.number&&!G.yanked).filter((G)=>H.includePrerelease?!0:!G.prerelease).sort((G,V)=>B(G.number,V.number)),K=J[J.length-1];if(!K?.number)return null;return{latest:K.number,...K.created_at?{publishedAt:new Date(K.created_at)}:{},homepage:`${$}/gems/${z.name}`}},applyUpdate(z,H){let $=W(H.name),X=W(H.currentVersion),Z=/^\s*(~>|>=|<=|>|<|=)?\s*/.exec(H.currentVersion)?.[1]??"",J=Z?`${Z} ${H.newVersion}`:H.newVersion;return z.replace(new RegExp(`^(\\s*gem\\s+["']${$}["']\\s*,\\s*["'])${X}(["'])`,"gm"),`$1${J}$2`)},async postWrite(z){return M(z,[{lockfile:"Gemfile.lock",command:["bundle","lock","--update"]}])},osvEcosystem:"RubyGems",compareVersions:B,updateType:C};var Hz=[[/^\[dependencies\]/m,"dependencies"],[/^\[dev-dependencies\]/m,"devDependencies"],[/^\[build-dependencies\]/m,"buildDependencies"],[/^\[workspace\.dependencies\]/m,"workspaceDependencies"]],T={name:"rust",manifestPatterns:["Cargo.toml"],async detect(z){return L(z,this.manifestPatterns)},async parse(z,H){let $=[];for(let[X,Z]of Hz){let J=X.exec(H);if(!J)continue;let K=J.index+J[0].length,G=H.slice(K).search(/\n\[/),V=G===-1?H.slice(K):H.slice(K,K+G);for(let Q of V.matchAll(/^\s*([\w-]+)\s*=\s*(.+)$/gm)){let j=Q[1],q=Q[2].trim(),Y=/version\s*=\s*["']([^"']+)["']/.exec(q),F=/^["']([^"']+)["']/.exec(q),_=Y?.[1]??F?.[1];if(!_||/\b(?:path|git)\s*=/.test(q))continue;$.push({name:j,currentVersion:_,section:Z,file:z})}}return $},async latest(z,H={}){let $=H.registryUrl??"https://crates.io",X=await U(`${$}/api/v1/crates/${encodeURIComponent(z.name)}`,{headers:{"User-Agent":"buddy (https://buddy.sh)",Accept:"application/json"}}).catch(()=>null);if(!X?.ok)return null;let Z=await X.json().catch(()=>null);if(!Z?.crate)return null;let J=H.includePrerelease?Z.crate.newest_version??Z.crate.max_stable_version:Z.crate.max_stable_version??Z.crate.newest_version;if(!J)return null;let K=Z.versions?.find((G)=>G.num===J);if(K?.yanked)return null;return{latest:J,...K?.created_at?{publishedAt:new Date(K.created_at)}:{},...Z.crate.repository?{releaseNotesUrl:`${Z.crate.repository}/releases`}:{},...Z.crate.homepage?{homepage:Z.crate.homepage}:{}}},applyUpdate(z,H){let $=W(H.name),X=W(H.currentVersion);return z.replace(new RegExp(`^(\\s*${$}\\s*=\\s*["'])${X}(["'])`,"gm"),`$1${H.newVersion}$2`).replace(new RegExp(`^(\\s*${$}\\s*=\\s*\\{[^}]*?version\\s*=\\s*["'])${X}(["'])`,"gm"),`$1${H.newVersion}$2`)},async postWrite(z){return M(z,[{lockfile:"Cargo.lock",command:["cargo","update","--workspace"]}])},osvEcosystem:"crates.io",compareVersions:B,updateType:C};import{join as Xz}from"path";async function Zz(z){let H=z.logger??f(),$=z.adapters??k,X=new Set(z.ignore??[]),Z=[],J={},K=[];return await Promise.all($.map(async(G)=>{let V;try{V=await G.detect(z.dir)}catch(Q){H.warn(`\u26A0\uFE0F ${G.name}: could not look for manifests: ${Q}`);return}if(V.length===0)return;K.push({ecosystem:G.name,files:V}),H.debug(`\uD83D\uDCE6 ${G.name}: ${V.length} manifest(s)`);for(let Q of V){let j;try{j=await G.parse(Q,await Bun.file(Xz(z.dir,Q)).text())}catch(Y){H.warn(`\u26A0\uFE0F ${G.name}: could not parse ${Q}: ${Y}`);continue}J[G.name]=(J[G.name]??0)+j.length;let q=await Promise.all(j.map(async(Y)=>{if(X.has(Y.name))return null;try{let F=await G.latest(Y,{...z.includePrerelease!==void 0?{includePrerelease:z.includePrerelease}:{},logger:H});if(!F)return null;let _=y(Y.currentVersion);if(G.compareVersions(F.latest,_)<=0)return null;return{name:Y.name,currentVersion:Y.currentVersion,newVersion:F.latest,updateType:G.updateType(_,F.latest),dependencyType:G.name,file:Q,...F.releaseNotesUrl?{releaseNotesUrl:F.releaseNotesUrl}:{},...F.homepage?{homepage:F.homepage}:{}}}catch(F){return H.debug(`${G.name}: could not resolve ${Y.name}: ${F}`),null}}));Z.push(...q.filter((Y)=>Y!==null))}})),{updates:Z,dependenciesByEcosystem:J,manifests:K}}function y(z){let H=/(\d[\w.!+-]*)/.exec(z);return H?H[1]:z.trim()}async function $z(z,H,$=k){let X=[],Z=[];for(let J of $){if(!H.includes(J.name)||!J.postWrite)continue;let K=await J.postWrite(z).catch(()=>({regenerated:[],note:void 0}));if(X.push(...K.regenerated),K.note)Z.push(K.note)}return{regenerated:X,notes:Z}}var k=[w,T,I,x];function Ez(z,H=k){let $=z.split("/").pop()??z;for(let X of H)if(X.manifestPatterns.some((Z)=>h($,Z)||h(z,Z)))return X;return null}function h(z,H){if(!H.includes("*"))return z===H;let $=H.split("*").map((X)=>X.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("[^/]*");return new RegExp(`^${$}$`).test(z)}function Rz(z,H=k){return H.find(($)=>$.name===z)??null}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Da as a}from"./chunk-nzk13c4q.js";import"./chunk-kpsvwjac.js";import"./chunk-a8wcn3mh.js";import"./chunk-knhvdm94.js";import"./chunk-mthd2c8m.js";import"./chunk-bnp0r4eh.js";import"./chunk-0f1xye20.js";import"./chunk-hd74jxm2.js";import"./chunk-6gvx1g6h.js";import"./chunk-743mhx0e.js";import"./chunk-d09qj570.js";import"./chunk-wk175yyw.js";import"./chunk-4wv5s3vr.js";import"./chunk-gvpsbmeg.js";import"./chunk-j46f90n8.js";import"./chunk-7hm46cej.js";import"./chunk-wc2z7krw.js";import"./chunk-1pecmenc.js";import"./chunk-hk4d7rky.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-cj4d5ad7.js";import"./chunk-c63e4ssc.js";import"./chunk-x9vpk4kk.js";import"./chunk-r1jvyhhd.js";import"./chunk-2z9mh5y4.js";import"./chunk-yh13j2af.js";import"./chunk-6w0n6c07.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{a as Scheduler};
|