@buddysh/buddy 0.11.4 → 0.11.6
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 +33 -0
- package/dist/bin/cli.js +19 -19
- package/dist/chunk-042211k4.js +2 -0
- package/dist/chunk-04sy4xt9.js +2 -0
- package/dist/chunk-0j7rmr49.js +2 -0
- package/dist/{chunk-yp1tgdh3.js → chunk-0t8q4880.js} +1 -1
- package/dist/{chunk-hsa07n7c.js → chunk-0xxqw1h6.js} +1 -1
- package/dist/{chunk-zgkrhymn.js → chunk-1p9hgr6z.js} +1 -1
- package/dist/{chunk-8hjvthz4.js → chunk-1zv0s60b.js} +2 -2
- package/dist/{chunk-ngh4jbgp.js → chunk-1zz8bd1c.js} +2 -2
- package/dist/chunk-217bhn06.js +2 -0
- package/dist/{chunk-428c5652.js → chunk-27jza51d.js} +1 -1
- package/dist/chunk-2k4gkkc6.js +2 -0
- package/dist/chunk-2kkwhrfz.js +2 -0
- package/dist/{chunk-f53y8ans.js → chunk-2r5s586j.js} +2 -2
- package/dist/{chunk-yr8eta7p.js → chunk-2vmaeyh3.js} +8 -8
- package/dist/{chunk-hd5j9e3c.js → chunk-3f34dgnn.js} +1 -1
- package/dist/{chunk-jnb80k2x.js → chunk-3k62kevg.js} +1 -1
- package/dist/{chunk-5av2vnvv.js → chunk-3nygvd78.js} +2 -2
- package/dist/{chunk-96ht6hwd.js → chunk-43p5vzvb.js} +2 -2
- package/dist/{chunk-p6qbqsyp.js → chunk-47ancrn1.js} +2 -2
- package/dist/{chunk-bmnx3s41.js → chunk-4m1vgh1w.js} +9 -9
- package/dist/{chunk-q4t568hv.js → chunk-4sqwtry6.js} +1 -1
- package/dist/{chunk-qd2s51gc.js → chunk-56q8k98m.js} +1 -1
- package/dist/{chunk-rayxmbcx.js → chunk-5bedx7s3.js} +1 -1
- package/dist/{chunk-pkr6905p.js → chunk-5qssa20j.js} +1 -1
- package/dist/{chunk-kprtsn8c.js → chunk-6qb96bg0.js} +1 -1
- package/dist/{chunk-ds4stft2.js → chunk-7g13yp3v.js} +1 -1
- package/dist/{chunk-c3es7pgf.js → chunk-86kymmen.js} +1 -1
- package/dist/{chunk-5044y9en.js → chunk-88k998tw.js} +2 -2
- package/dist/{chunk-11hdrnf6.js → chunk-8dq3gews.js} +2 -2
- package/dist/{chunk-phfmnnne.js → chunk-8mrbvnae.js} +2 -2
- package/dist/chunk-90x7e4ra.js +106 -0
- package/dist/{chunk-61xecp1z.js → chunk-95je030a.js} +1 -1
- package/dist/{chunk-05me15qw.js → chunk-9cnq8y3d.js} +1 -1
- package/dist/chunk-9ychha5r.js +2 -0
- package/dist/{chunk-3901s7h9.js → chunk-abfyz98y.js} +1 -1
- package/dist/{chunk-jtxcr5yw.js → chunk-ak9s0vnr.js} +2 -2
- package/dist/chunk-az2vad31.js +2 -0
- package/dist/{chunk-e68nf7cm.js → chunk-b4a5gw9c.js} +1 -1
- package/dist/chunk-ba1t70ph.js +2 -0
- package/dist/{chunk-sw2538r0.js → chunk-bjg4gxs4.js} +2 -2
- package/dist/{chunk-hfjywbbc.js → chunk-bprmzg0p.js} +1 -1
- package/dist/{chunk-rc2mk5x6.js → chunk-bxdbf2kj.js} +1 -1
- package/dist/{chunk-mkzmjg3f.js → chunk-c64qrkpz.js} +2 -2
- package/dist/{chunk-yngahb11.js → chunk-d1yhv10h.js} +2 -2
- package/dist/{chunk-0hc97k0t.js → chunk-d73ympxb.js} +3 -3
- package/dist/{chunk-g30dr44w.js → chunk-d7e6tqmr.js} +2 -2
- package/dist/{chunk-aa277p5r.js → chunk-d84k4mek.js} +1 -1
- package/dist/chunk-dbawp9kg.js +2 -0
- package/dist/{chunk-m4p7cnvk.js → chunk-df75rm51.js} +1 -1
- package/dist/chunk-dh9dw57m.js +2 -0
- package/dist/chunk-dkhvqxrk.js +2 -0
- package/dist/{chunk-cwfkm7h9.js → chunk-e1cvrjf0.js} +2 -2
- package/dist/{chunk-2et8yavs.js → chunk-e3wax332.js} +1 -1
- package/dist/{chunk-vqa6vte3.js → chunk-e4bcngja.js} +1 -1
- package/dist/{chunk-tjc2vgwn.js → chunk-e6wny1pp.js} +1 -1
- package/dist/chunk-ecs7b2kg.js +2 -0
- package/dist/chunk-edgg7wxb.js +2 -0
- package/dist/{chunk-cs066zt9.js → chunk-ej7gpg23.js} +2 -2
- package/dist/{chunk-patms7t8.js → chunk-erbqszzp.js} +1 -1
- package/dist/{chunk-cgvt98pd.js → chunk-f7aw9cr3.js} +1 -1
- package/dist/{chunk-08x5b93v.js → chunk-ffb50kwa.js} +1 -1
- package/dist/{chunk-r763e19p.js → chunk-ffp0mgf5.js} +3 -3
- package/dist/{chunk-b1w41hfs.js → chunk-ge2r1zmq.js} +1 -1
- package/dist/chunk-h82t0mnh.js +2 -0
- package/dist/{chunk-g24hav8e.js → chunk-j3bzf5m0.js} +7 -7
- package/dist/{chunk-be629jhq.js → chunk-j8era2yj.js} +2 -2
- package/dist/{chunk-25sz1y7j.js → chunk-jaewrjw3.js} +1 -1
- package/dist/{chunk-vbeeyhhe.js → chunk-jhfkzveb.js} +2 -2
- package/dist/chunk-k10hm62v.js +2 -0
- package/dist/{chunk-nrr8z2z7.js → chunk-k53ndvfv.js} +2 -2
- package/dist/{chunk-k26wnmzk.js → chunk-k8pnnyq1.js} +1 -1
- package/dist/{chunk-0w695m54.js → chunk-kbkvw42w.js} +1 -1
- package/dist/{chunk-b9escac0.js → chunk-kqam9qmd.js} +2 -2
- package/dist/{chunk-c8rzx3a1.js → chunk-kypdeb29.js} +1 -1
- package/dist/{chunk-wn6pbyzn.js → chunk-kzgyhhtz.js} +1 -1
- package/dist/{chunk-3pqra420.js → chunk-m1zp48mr.js} +1 -1
- package/dist/{chunk-0scz1dv5.js → chunk-mfhwcnxr.js} +1 -1
- package/dist/chunk-mmc8tvbb.js +2 -0
- package/dist/{chunk-txtrpypt.js → chunk-mtp0aygy.js} +2 -2
- package/dist/{chunk-xs12dtf1.js → chunk-myswpb7z.js} +1 -1
- package/dist/{chunk-jz5zs812.js → chunk-nf9dfx4t.js} +1 -1
- package/dist/{chunk-fjp3a7hp.js → chunk-nj38e2km.js} +1 -1
- package/dist/{chunk-68fw3ma0.js → chunk-nr1c0dny.js} +1 -1
- package/dist/chunk-nz0ns7ah.js +3 -0
- package/dist/chunk-p3qck29r.js +2 -0
- package/dist/{chunk-hptfq3rg.js → chunk-pkcvytq6.js} +1 -1
- package/dist/{chunk-hmskwy76.js → chunk-pqbzatbq.js} +1 -1
- package/dist/{chunk-40znfg3x.js → chunk-pwa2tt2e.js} +1 -1
- package/dist/chunk-qe63pqwy.js +2 -0
- package/dist/{chunk-4jyw358y.js → chunk-qmhd1bgx.js} +1 -1
- package/dist/chunk-qxc77b08.js +2 -0
- package/dist/{chunk-bffxf4xy.js → chunk-qzens4rg.js} +1 -1
- package/dist/chunk-r9k5vnrw.js +2 -0
- package/dist/{chunk-v1wfa758.js → chunk-rfvn4j6n.js} +1 -1
- package/dist/chunk-rnv477z3.js +2 -0
- package/dist/{chunk-3cvng2nz.js → chunk-rp3ytb19.js} +1 -1
- package/dist/{chunk-pskqrv5r.js → chunk-rpkwbqr8.js} +1 -1
- package/dist/chunk-s7da3h7c.js +2 -0
- package/dist/chunk-swphrsyr.js +2 -0
- package/dist/chunk-sx8pyc83.js +2 -0
- package/dist/chunk-sy3h7j1x.js +2 -0
- package/dist/{chunk-eseshkd0.js → chunk-t3340cv5.js} +1 -1
- package/dist/{chunk-1qgr52wx.js → chunk-te6etc5c.js} +1 -1
- package/dist/chunk-ttx1jk5b.js +2 -0
- package/dist/{chunk-tw047td6.js → chunk-tvrz1xp5.js} +1 -1
- package/dist/chunk-v5qn8kjd.js +2 -0
- package/dist/chunk-vj9stet1.js +2 -0
- package/dist/chunk-w6bd9r6p.js +2 -0
- package/dist/{chunk-193abzy6.js → chunk-wkq57ssc.js} +1 -1
- package/dist/{chunk-s4zb0fcj.js → chunk-wsxy4w86.js} +1 -1
- package/dist/chunk-x59yras6.js +2 -0
- package/dist/chunk-xfmzts7d.js +2 -0
- package/dist/chunk-xj99g66b.js +4 -0
- package/dist/{chunk-6p4qz8qv.js → chunk-y1hppm93.js} +1 -1
- package/dist/{chunk-1cpdz49v.js → chunk-yj6xx2b8.js} +1 -1
- package/dist/{chunk-3fzbvs2p.js → chunk-zc7g037n.js} +1 -1
- package/dist/{chunk-s6z3gm2s.js → chunk-zhfrmseh.js} +1 -1
- package/dist/{chunk-vgtmrd4c.js → chunk-zpxg12ep.js} +1 -1
- package/dist/src/git/github-provider.d.ts +12 -0
- package/dist/src/git/provider.d.ts +1 -0
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/utils/github-actions-parser.d.ts +10 -0
- package/dist/src/utils/lock-file.d.ts +26 -2
- package/package.json +1 -1
- package/dist/chunk-0paakbpj.js +0 -2
- package/dist/chunk-19zyq15p.js +0 -2
- package/dist/chunk-24c2ab29.js +0 -2
- package/dist/chunk-28y7eayr.js +0 -2
- package/dist/chunk-2wj5xtdn.js +0 -2
- package/dist/chunk-49znmbh8.js +0 -2
- package/dist/chunk-86x1vsjw.js +0 -2
- package/dist/chunk-8fw0v7bv.js +0 -3
- package/dist/chunk-90zmqn5k.js +0 -2
- package/dist/chunk-97qf7mdt.js +0 -2
- package/dist/chunk-a4hzzn28.js +0 -2
- package/dist/chunk-b357cgb0.js +0 -2
- package/dist/chunk-brfyymhf.js +0 -2
- package/dist/chunk-dgfb8k0h.js +0 -2
- package/dist/chunk-e0gweha1.js +0 -2
- package/dist/chunk-e2t5jq26.js +0 -106
- package/dist/chunk-emb5v4wv.js +0 -2
- package/dist/chunk-emyvrx5t.js +0 -2
- package/dist/chunk-fpnjpgrb.js +0 -2
- package/dist/chunk-fr5c326k.js +0 -2
- package/dist/chunk-gkpd5nw2.js +0 -2
- package/dist/chunk-hns85dqw.js +0 -2
- package/dist/chunk-mcwxpdg9.js +0 -2
- package/dist/chunk-ng7px8gx.js +0 -2
- package/dist/chunk-ppmabn5h.js +0 -2
- package/dist/chunk-rwggcfgn.js +0 -2
- package/dist/chunk-s25rb4t2.js +0 -2
- package/dist/chunk-sc7emb71.js +0 -2
- package/dist/chunk-vdd1cghr.js +0 -2
- package/dist/chunk-vj1sdxpp.js +0 -2
- package/dist/chunk-xznnmhyt.js +0 -2
- package/dist/chunk-yk183r6z.js +0 -2
- package/dist/chunk-ys1qqcpp.js +0 -2
- package/dist/chunk-ytmxd5fk.js +0 -4
- package/dist/chunk-zxgkp71x.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{m as
|
|
2
|
+
import{kd as J}from"./chunk-5qssa20j.js";import{ld as Y}from"./chunk-t3340cv5.js";import{se as _}from"./chunk-mtp0aygy.js";import{ve as x,we as w}from"./chunk-xj99g66b.js";import{Oe as z,Pe as M}from"./chunk-kqam9qmd.js";import{We as N}from"./chunk-e3wax332.js";import{xg as L,yg as S}from"./chunk-ak9s0vnr.js";import{Mh as G}from"./chunk-bprmzg0p.js";import{bl as j}from"./chunk-4sqwtry6.js";var{Glob:D}=globalThis.Bun;import{readdir as A,readFile as U,stat as Z}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{let O=R(this.projectPath,".github","workflows");if((await Z(O).catch(()=>null))?.isDirectory()){let Q=await this.findFilesByPatternInDir("*.yaml",O),W=await this.findFilesByPatternInDir("*.yml",O);for(let B of[...Q,...W])if(x(B))q.push(B)}}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-e4bcngja.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
|
+
export{m as jd};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A as V0,B as z0,C as EQ,a as N,b as X,c as R,r as dQ,s as $0,t as HQ,x as F,y as U,z as AQ}from"./chunk-
|
|
2
|
+
import{A as V0,B as z0,C as EQ,a as N,b as X,c as R,r as dQ,s as $0,t as HQ,x as F,y as U,z as AQ}from"./chunk-bjg4gxs4.js";import"./chunk-4sqwtry6.js";import*as O from"fs/promises";import*as XQ from"fs";import*as T from"path";import*as FQ from"child_process";import*as M0 from"crypto";import*as A0 from"readline";function S(V){if(V.inputSchema.type!=="object")throw Error(`JSON schema for tool "${V.name}" must be an object, but got ${V.inputSchema.type}`);return{type:"custom",name:V.name,input_schema:V.inputSchema,description:V.description,run:V.run,parse:(Q)=>Q,...V.close?{close:V.close}:{}}}import*as b from"fs/promises";import*as C from"path";import{randomUUID as L0}from"crypto";var e=493,T0=420;function YQ(V,Q){let $=C.relative(V,Q);return $===""||!$.startsWith(".."+C.sep)&&$!==".."&&!C.isAbsolute($)}async function OQ(V,Q){for(let $ of V)if(YQ(await r(C.resolve($)),Q))return $;return}var y0=40;function QQ(V){let Q=V?.code;return typeof Q==="string"?Q:void 0}async function r(V){let Q=[],$=V,z=0;for(;;){let K;try{K=await b.realpath($)}catch(Z){let q;try{q=(await b.lstat($)).isSymbolicLink()}catch(Y){let W=QQ(Y);if(W!=="ENOENT"&&W!=="ENOTDIR")throw Y;let J=C.dirname($);if(J===$)throw Y;Q.push(C.basename($)),$=J;continue}if(!q)throw Z;if(++z>y0)throw Object.assign(Error("too many levels of symbolic links"),{code:"ELOOP"});$=C.resolve(C.dirname($),await b.readlink($));continue}return Q.length?C.join(K,...Q.reverse()):K}}async function fQ(V,Q,$){let z=$?.allowedRoots??[],K=await r(C.resolve(V)),Z;try{Z=await r(C.resolve(K,Q))}catch(Y){throw new U(n(Y,`path ${JSON.stringify(Q)}`))}if(YQ(K,Z)||await OQ(z,Z)!==void 0)return Z;let q=z.length?"the session's working directory and its other permitted directories":"the session's working directory";throw new U(`path ${JSON.stringify(Q)} is outside ${q}`)}async function RQ(V,Q){let $=C.dirname(V),z=C.join($,`.tmp-${process.pid}-${L0()}`),K;try{K=await b.open(z,"wx",T0),await K.writeFile(Q,"utf-8"),await K.sync(),await K.close(),K=void 0,await b.rename(z,V)}catch(Z){if(K)await K.close().catch(()=>{});throw await b.unlink(z).catch(()=>{}),Z}}function n(V,Q){let $=QQ(V);switch($){case"ENOENT":return`${Q}: no such file or directory`;case"EACCES":case"EPERM":return`${Q}: permission denied`;case"ENOTDIR":return`${Q}: not a directory`;case"EISDIR":return`${Q}: is a directory`;case"ELOOP":return`${Q}: too many levels of symbolic links`;case"ENAMETOOLONG":return`${Q}: file name too long`;case"ENOSPC":return`${Q}: no space left on device`;case"EMFILE":case"ENFILE":return`${Q}: too many open files`;default:return`${Q}: ${$!==void 0?`i/o error (${$})`:"i/o error"}`}}import*as G from"fs/promises";import*as uQ from"fs";import*as w from"path";import{execFile as b0}from"child_process";import{promisify as x0}from"util";import{Readable as v0}from"stream";import{pipeline as P0}from"stream/promises";var E0=x0(b0);async function F0(V){let{client:Q,sessionId:$}=V;if(!Q)return async()=>{};let z=HQ(Q),K=V.session;if(!K){if($===void 0)return async()=>{};z.warn("AgentToolContext.sessionId is deprecated and costs an extra session fetch; fetch the session once and set `session` instead",{component:"agent-tool-context"}),K=await Q.beta.sessions.retrieve($)}let Z=w.resolve(V.workdir,"skills"),q=[];for(let Y of K.agent.skills)try{let W=await Q.beta.skills.versions.retrieve(Y.version,{skill_id:Y.skill_id}),J=w.basename(W.name.trim());if(J===""||J==="."||J==="..")J=Y.skill_id;let H=w.resolve(Z,J);if(H!==Z&&!H.startsWith(Z+w.sep)){z.warn("skill name escapes the skills dir; skipping",{component:"agent-tool-context",name:W.name});continue}let M=await Q.beta.skills.versions.download(W.id,{skill_id:Y.skill_id});await G.rm(H,{recursive:!0,force:!0}),await G.mkdir(H,{recursive:!0,mode:e}),q.push(H),await mQ(M,H),z.info("downloaded skill",{component:"agent-tool-context",skill_id:Y.skill_id,version:W.id,dest:H})}catch(W){z.warn("failed to download skill",{component:"agent-tool-context",skill_id:Y.skill_id,error:String(W)})}return async()=>{for(let Y of q)await G.rm(Y,{recursive:!0,force:!0}).catch((W)=>{z.warn("failed to clean up skill",{component:"agent-tool-context",dest:Y,error:String(W)})})}}function f0(V){for(let Q of V){let $=Q.trim();if(!$)continue;if(w.isAbsolute($)||$.split(/[\\/]/).includes(".."))throw new R(`refusing to extract unsafe archive member: ${$}`)}}var LQ="skill archive listing is inconsistent; refusing to extract",g0={unzip:new Set(["-","d","?"]),tar:new Set(["-","d","C"])};function gQ(V){let Q=V.split(`
|
|
3
3
|
`);if(Q[Q.length-1]==="")Q.pop();return Q}function u0(V,Q){return/^[\x20-\x7E]+$/.test(Q)&&!/[\\^#]/.test(Q)&&!(V==="unzip"&&Q.startsWith("-"))}function S0(V,Q,$){let z=gQ(Q),K=gQ($);if(z.length!==K.length)throw new R(LQ);let Z=[],q=[];return z.forEach((Y,W)=>{if(g0[V].has(K[W].charAt(0))){Z.push(Y);return}if(!u0(V,Y))throw new R(`refusing to extract archive: cannot safely exclude member ${JSON.stringify(Y)}`);q.push(Y)}),{plain:Z,special:q}}async function SQ(V){for(let Q of await G.readdir(V,{withFileTypes:!0}))if(Q.isDirectory())await SQ(w.join(V,Q.name));else if(!Q.isFile())throw new R(LQ)}async function jQ(V,Q){try{let{stdout:$}=await E0(V,Q);return $}catch($){if(QQ($)==="ENOENT")throw new R(`skill extraction requires the \`${V}\` command, but it was not found on PATH`);throw $}}function m0(V){let Q,$=!1;for(let z of V){let K=z.trim().split("/").filter((q)=>q!==""&&q!==".");if(K.length===0)continue;let Z=K[0];if(Q===void 0)Q=Z;else if(Z!==Q)return"";if(K.length>1)$=!0}return Q!==void 0&&$?Q:""}async function mQ(V,Q){let $=w.join(Q,`.skill-archive-${process.pid}-${Date.now()}`);if(!V.body)throw new R("skill download response had no body");await P0(v0.fromWeb(V.body),uQ.createWriteStream($));let z=w.join(w.dirname(Q),`.skill-stage-${process.pid}-${Date.now()}`),K=w.join(w.dirname(Q),`.skill-exclude-${process.pid}-${Date.now()}`);try{let Z=await _0($,4),q=Z.length>=4&&Z[0]===80&&Z[1]===75&&Z[2]===3&&Z[3]===4,Y=q?"unzip":"tar",W=await jQ(Y,q?["-Z1",$]:["-tf",$]),J=await jQ(Y,q?["-Z","--h","--t",$]:["-tvf",$]),{plain:H,special:M}=S0(Y,W,J);f0([...H,...M]);let j=m0(H);if(await G.mkdir(z,{recursive:!0,mode:e}),H.length>0)await jQ(Y,await p0(Y,$,z,M,K));await SQ(z);let v=j?w.join(z,j):z,P=await G.readdir(v).catch((E)=>{throw QQ(E)==="ENOENT"?new R(LQ):E});for(let E of P)await G.rename(w.join(v,E),w.join(Q,E))}finally{await G.rm($,{force:!0}),await G.rm(K,{force:!0}),await G.rm(z,{recursive:!0,force:!0})}}async function p0(V,Q,$,z,K){let Z=z.map((q)=>q.replace(/[*?[\\]/g,"\\$&"));if(V==="unzip")return["-oq",Q,"-d",$,...Z.length>0?["-x",...Z]:[]];if(Z.length===0)return["-xf",Q,"-C",$];return await G.writeFile(K,Z.join(`
|
|
4
4
|
`)+`
|
|
5
5
|
`,{flag:"wx",mode:384}),["-xf",Q,"-C",$,"-X",K]}async function _0(V,Q){let $=await G.open(V,"r");try{let z=Buffer.alloc(Q),{bytesRead:K}=await $.read(z,0,Q,0);return z.subarray(0,K)}finally{await $.close()}}import*as q0 from"path";import{createHash as V1}from"crypto";import*as A from"fs/promises";import*as k from"path";import{constants as i}from"fs";import{createHash as h0,randomBytes as d0}from"crypto";var cQ=448,c0=384,n0=448,TQ=i.O_NOFOLLOW??0,i0=i.O_NONBLOCK??0;class D extends Error{constructor(V,Q){super(`path ${JSON.stringify(Q)} ${V}`);this.name="FileStoreError",this.reason=V,this.relPath=Q}}D.ESCAPES_ROOT="escapes the store root";D.IS_A_SYMLINK="is a symlink";D.NOT_A_FILE="is not a regular file";D.NOT_A_DIRECTORY="is not a directory";D.NOT_UTF8="is not valid utf-8";D.MOVE_DESTINATION_EXISTS="already exists";function yQ(V){return V.startsWith("/")&&!V.split("/").includes("..")}class l{constructor(V,Q,$=!1){this.hashes=new Map,this.rootPath=V,this.removedOnDispose=Q,this.decoder=$?new TextDecoder("utf-8",{fatal:!0}):void 0}static async open(V,Q){if(!l0())throw Error("FileStore requires O_NOFOLLOW support on this platform");let $=!1;try{await A.lstat(V)}catch(z){if(z.code!=="ENOENT")throw z;$=!0}return new l(k.resolve(V),$,Q?.utf8??!1)}async createRoot(){await a0(this.rootPath)}root(){return{path:this.rootPath,removedOnDispose:this.removedOnDispose}}async dispose(){if(!this.removedOnDispose)return;await A.rm(this.rootPath,{recursive:!0,force:!0})}async put(V,Q,$){let z=V.replace(/\\/g,"/");if(z.endsWith("/")||z.endsWith("/.")||z===""||z===".")throw new D(D.NOT_A_FILE,V);let K=this.resolveUnderRoot(V),Z=typeof Q==="string"?dQ(Q):Q;this.requireUtf8(V,Z),await pQ(this.rootPath,k.dirname(K)),await o0(K,Z,$?.executable??!1)}async get(V){let Q=this.resolveUnderRoot(V),$;try{$=await nQ(V,Q)}catch(K){if(K.code==="ENOENT")return null;throw K}let z;try{let K=await $.readFile();z=new Uint8Array(K.buffer,K.byteOffset,K.byteLength)}finally{await $.close()}return this.requireUtf8(V,z),z}async ls(V="/"){let Q=this.resolveUnderRoot(V);return new Set((await _Q(this.rootPath,V,Q)).map(([$])=>$))}async findSymlinks(V="/"){let Q=this.resolveUnderRoot(V);return t0(this.rootPath,V,Q)}async hashtree(V="/"){let Q=this.resolveUnderRoot(V),$=JQ.nowNs(),z=Object.create(null);for(let[K,Z]of await _Q(this.rootPath,V,Q)){let q=await this.hashViaCache(K,Z,$);if(q!==null)z[K]=q}return z}async hashFile(V){let Q=this.resolveUnderRoot(V),$;try{$=await A.lstat(Q,{bigint:!0})}catch(K){if(K.code==="ENOENT")return null;throw K}if($.isSymbolicLink())throw new D(D.IS_A_SYMLINK,V);if(!$.isFile())throw new D(D.NOT_A_FILE,V);let z=k.relative(this.rootPath,Q).split(k.sep).join("/");return this.hashViaCache(z,Q,JQ.nowNs())}async move(V,Q){let $=this.resolveUnderRoot(V),z=this.resolveUnderRoot(Q);if($===this.rootPath||z===this.rootPath)return;if(await A.stat(z).then(()=>!0,()=>!1))throw new D(D.MOVE_DESTINATION_EXISTS,Q);await pQ(this.rootPath,k.dirname(z)),await A.rename($,z)}async remove(V){let Q=this.resolveUnderRoot(V);if(Q===this.rootPath)return;let $;try{$=await A.lstat(Q,{bigint:!0})}catch(z){if(z.code==="ENOENT")return;throw z}if($.isDirectory())await A.rm(Q,{recursive:!0,force:!0});else try{await A.unlink(Q)}catch(z){if(z.code!=="ENOENT")throw z}}resolveUnderRoot(V){let Q=V.replace(/\\/g,"/").replace(/^\/+/,""),$=Q.split("/").filter((z)=>z!==""&&z!==".");if(k.posix.isAbsolute(Q)||$.includes(".."))throw new D(D.ESCAPES_ROOT,V);return $.length===0?this.rootPath:k.join(this.rootPath,...$)}requireUtf8(V,Q){if(!this.decoder)return;try{this.decoder.decode(Q)}catch{throw new D(D.NOT_UTF8,V)}}async hashViaCache(V,Q,$){let z;try{z=await A.lstat(Q,{bigint:!0})}catch(q){if(q.code==="ENOENT")return null;throw q}if(!z.isFile())return null;let K=this.hashes.get(V),Z;if(K!==void 0&&e0(K,z))Z=K.sha;else try{Z=await JQ.hashFile(Q)}catch(q){let Y=q.code;if(Y==="ENOENT"||q instanceof D)return null;if(Y==="ELOOP"||Y==="EMLINK")return null;throw q}if(Q1(z,$))this.hashes.set(V,{mtimeNs:z.mtimeNs,ctimeNs:z.ctimeNs,size:z.size,sha:Z});return Z}}l.isPathLegal=yQ;function l0(){return TQ!==0}async function a0(V){let Q=[],$=V;for(;;){try{await A.stat($);break}catch(K){let Z=K.code;if(Z!=="ENOENT"&&Z!=="ENOTDIR"&&Z!=="ELOOP")throw K}Q.push($);let z=k.dirname($);if(z===$)break;$=z}for(let z of Q.reverse())try{await A.mkdir(z,{mode:cQ})}catch(K){if(K.code!=="EEXIST")throw K}}async function pQ(V,Q){let $=k.relative(V,Q);if($==="")return;let z=V;for(let K of $.split(k.sep)){z=k.join(z,K);try{await A.mkdir(z,{mode:cQ})}catch(Z){if(Z.code!=="EEXIST")throw Z}}}async function o0(V,Q,$){let z=$?n0:c0,K=k.join(k.dirname(V),`.fs-${d0(8).toString("hex")}.tmp`),Z;try{Z=await A.open(K,i.O_WRONLY|i.O_CREAT|i.O_EXCL|TQ,z),await Z.writeFile(Q),await Z.close(),Z=void 0,await A.rename(K,V)}catch(q){if(Z)await Z.close().catch(()=>{});throw await A.unlink(K).catch(()=>{}),q}}async function nQ(V,Q){let $;try{$=await A.open(Q,i.O_RDONLY|TQ|i0)}catch(z){let K=z.code;if(K==="ELOOP"||K==="EMLINK")throw new D(D.IS_A_SYMLINK,V);throw z}try{if(!(await $.stat()).isFile())throw new D(D.NOT_A_FILE,V)}catch(z){throw await $.close().catch(()=>{}),z}return $}async function s0(V){let Q=h0("sha256"),$=await nQ(k.basename(V),V),z=new Uint8Array(1048576);try{for(;;){let{bytesRead:K}=await $.read(z,0,z.length);if(K===0)break;Q.update(z.subarray(0,K))}}finally{await $.close()}return Q.digest("hex")}async function _Q(V,Q,$){if(!await r0(Q,$))return[];let z=[];return await iQ($,(K,Z)=>{if(Z.isFile())z.push([k.relative(V,K).split(k.sep).join("/"),K])}),z.sort(),z}async function t0(V,Q,$){let z=(q)=>k.relative(V,q).split(k.sep).join("/"),K;try{K=await A.lstat($,{bigint:!0})}catch(q){let Y=q.code;if(Y==="ENOENT"||Y==="ENOTDIR")return new Set;throw q}if(K.isSymbolicLink())return new Set([z($)]);if(!K.isDirectory())throw new D(D.NOT_A_DIRECTORY,Q);let Z=new Set;return await iQ($,(q,Y)=>{if(Y.isSymbolicLink())Z.add(z(q))}),Z}async function r0(V,Q){let $;try{$=await A.lstat(Q,{bigint:!0})}catch(z){let K=z.code;if(K==="ENOENT"||K==="ENOTDIR")return!1;throw z}if(!$.isDirectory())throw new D(D.NOT_A_DIRECTORY,V);return!0}async function iQ(V,Q){let $=[V];while($.length){let z=$.pop(),K;try{K=await A.readdir(z,{withFileTypes:!0})}catch(Z){if(Z.code==="ENOENT")continue;throw Z}for(let Z of K){let q=k.join(z,Z.name);if(Q(q,Z),Z.isDirectory()&&!Z.isSymbolicLink())$.push(q)}}}function e0(V,Q){return Q.mtimeNs===V.mtimeNs&&Q.ctimeNs===V.ctimeNs&&Q.size===V.size}function Q1(V,Q){return(V.mtimeNs>V.ctimeNs?V.mtimeNs:V.ctimeNs)<Q-JQ.timestampTrustMarginNs}var $1=2000000000n,JQ={hashFile:s0,timestampTrustMarginNs:$1,nowNs:()=>BigInt(Date.now())*1000000n},lQ=l,hQ=Symbol.asyncDispose;if(hQ)Object.defineProperty(l.prototype,hQ,{value:l.prototype.dispose,configurable:!0,writable:!0});var I,g,BQ,$Q,MQ,B,a,DQ,f,K0,NQ,Z0,X0,bQ,vQ,aQ,oQ,xQ,sQ,tQ,WQ,UQ,rQ,eQ,z1=30000,o=".anthropic-memory-store",Y0=1;function Q0(V){return V1("sha256").update(`version ${Y0}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{uh as L$}from"./chunk-k8pnnyq1.js";import{vh as P$}from"./chunk-wkq57ssc.js";import{Gh as Z1}from"./chunk-b4a5gw9c.js";import{Mh as H}from"./chunk-bprmzg0p.js";import{$k as u7,al as B,bl as O1}from"./chunk-4sqwtry6.js";var N=B((Kz,R0)=>{var{FORCE_COLOR:x$,NODE_DISABLE_COLORS:h$,TERM:d$}=process.env,G={enabled:!h$&&d$!=="dumb"&&x$!=="0",reset:F(0,0),bold:F(1,22),dim:F(2,22),italic:F(3,23),underline:F(4,24),inverse:F(7,27),hidden:F(8,28),strikethrough:F(9,29),black:F(30,39),red:F(31,39),green:F(32,39),yellow:F(33,39),blue:F(34,39),magenta:F(35,39),cyan:F(36,39),white:F(37,39),gray:F(90,39),grey:F(90,39),bgBlack:F(40,49),bgRed:F(41,49),bgGreen:F(42,49),bgYellow:F(43,49),bgBlue:F(44,49),bgMagenta:F(45,49),bgCyan:F(46,49),bgWhite:F(47,49)};function U0($,Y){let Z=0,z,X="",Q="";for(;Z<$.length;Z++)if(z=$[Z],X+=z.open,Q+=z.close,Y.includes(z.close))Y=Y.replace(z.rgx,z.close+z.open);return X+Y+Q}function v$($,Y){let Z={has:$,keys:Y};return Z.reset=G.reset.bind(Z),Z.bold=G.bold.bind(Z),Z.dim=G.dim.bind(Z),Z.italic=G.italic.bind(Z),Z.underline=G.underline.bind(Z),Z.inverse=G.inverse.bind(Z),Z.hidden=G.hidden.bind(Z),Z.strikethrough=G.strikethrough.bind(Z),Z.black=G.black.bind(Z),Z.red=G.red.bind(Z),Z.green=G.green.bind(Z),Z.yellow=G.yellow.bind(Z),Z.blue=G.blue.bind(Z),Z.magenta=G.magenta.bind(Z),Z.cyan=G.cyan.bind(Z),Z.white=G.white.bind(Z),Z.gray=G.gray.bind(Z),Z.grey=G.grey.bind(Z),Z.bgBlack=G.bgBlack.bind(Z),Z.bgRed=G.bgRed.bind(Z),Z.bgGreen=G.bgGreen.bind(Z),Z.bgYellow=G.bgYellow.bind(Z),Z.bgBlue=G.bgBlue.bind(Z),Z.bgMagenta=G.bgMagenta.bind(Z),Z.bgCyan=G.bgCyan.bind(Z),Z.bgWhite=G.bgWhite.bind(Z),Z}function F($,Y){let Z={open:`\x1B[${$}m`,close:`\x1B[${Y}m`,rgx:new RegExp(`\\x1b\\[${Y}m`,"g")};return function(z){if(this!==void 0&&this.has!==void 0)return this.has.includes($)||(this.has.push($),this.keys.push(Z)),z===void 0?this:G.enabled?U0(this.keys,z+""):z+"";return z===void 0?v$([$],[Z]):G.enabled?U0([Z],z+""):z+""}}R0.exports=G});var F0=B((Qz,G0)=>{G0.exports=($,Y)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Y){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var V1=B((Hz,N0)=>{N0.exports=($)=>{let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),Z=new RegExp(Y,"g");return typeof $==="string"?$.replace(Z,""):$}});var W=B((Jz,W0)=>{var y1={to($,Y){if(!Y)return`\x1B[${$+1}G`;return`\x1B[${Y+1};${$+1}H`},move($,Y){let Z="";if($<0)Z+=`\x1B[${-$}D`;else if($>0)Z+=`\x1B[${$}C`;if(Y<0)Z+=`\x1B[${-Y}A`;else if(Y>0)Z+=`\x1B[${Y}B`;return Z},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},y$={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},f$={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Y="";for(let Z=0;Z<$;Z++)Y+=this.line+(Z<$-1?y1.up():"");if($)Y+=y1.left;return Y}};W0.exports={cursor:y1,scroll:y$,erase:f$,beep:"\x07"}});var A0=B((Mz,E0)=>{function g$($,Y){var Z=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!Z){if(Array.isArray($)||(Z=m$($))||Y&&$&&typeof $.length==="number"){if(Z)$=Z;var z=0,X=function(){};return{s:X,n:function(){if(z>=$.length)return{done:!0};return{done:!1,value:$[z++]}},e:function(U){throw U},f:X}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Q=!0,K=!1,J;return{s:function(){Z=Z.call($)},n:function(){var U=Z.next();return Q=U.done,U},e:function(U){K=!0,J=U},f:function(){try{if(!Q&&Z.return!=null)Z.return()}finally{if(K)throw J}}}}function m$($,Y){if(!$)return;if(typeof $==="string")return V0($,Y);var Z=Object.prototype.toString.call($).slice(8,-1);if(Z==="Object"&&$.constructor)Z=$.constructor.name;if(Z==="Map"||Z==="Set")return Array.from($);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return V0($,Y)}function V0($,Y){if(Y==null||Y>$.length)Y=$.length;for(var Z=0,z=Array(Y);Z<Y;Z++)z[Z]=$[Z];return z}var u$=V1(),C0=W(),O0=C0.erase,c$=C0.cursor,n$=($)=>[...u$($)].length;E0.exports=function($,Y){if(!Y)return O0.line+c$.to(0);let Z=0,z=$.split(/\r?\n/);var X=g$(z),Q;try{for(X.s();!(Q=X.n()).done;){let K=Q.value;Z+=1+Math.floor(Math.max(n$(K)-1,0)/Y)}}catch(K){X.e(K)}finally{X.f()}return O0.lines(Z)}});var f1=B((Bz,I0)=>{var K1={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},i$={arrowUp:K1.arrowUp,arrowDown:K1.arrowDown,arrowLeft:K1.arrowLeft,arrowRight:K1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},l$=process.platform==="win32"?i$:K1;I0.exports=l$});var S0=B((Uz,q0)=>{var r=N(),s=f1(),g1=Object.freeze({password:{scale:1,render:($)=>"*".repeat($.length)},emoji:{scale:2,render:($)=>"\uD83D\uDE03".repeat($.length)},invisible:{scale:0,render:($)=>""},default:{scale:1,render:($)=>`${$}`}}),p$=($)=>g1[$]||g1.default,Q1=Object.freeze({aborted:r.red(s.cross),done:r.green(s.tick),exited:r.yellow(s.cross),default:r.cyan("?")}),a$=($,Y,Z)=>Y?Q1.aborted:Z?Q1.exited:$?Q1.done:Q1.default,s$=($)=>r.gray($?s.ellipsis:s.pointerSmall),o$=($,Y)=>r.gray($?Y?s.pointerSmall:"+":s.line);q0.exports={styles:g1,render:p$,symbols:Q1,symbol:a$,delimiter:s$,item:o$}});var D0=B((Rz,j0)=>{var t$=V1();j0.exports=function($,Y){let Z=String(t$($)||"").split(/\r?\n/);if(!Y)return Z.length;return Z.map((z)=>Math.ceil(z.length/Y)).reduce((z,X)=>z+X)}});var P0=B((Gz,T0)=>{T0.exports=($,Y={})=>{let Z=Number.isSafeInteger(parseInt(Y.margin))?Array(parseInt(Y.margin)).fill(" ").join(""):Y.margin||"",z=Y.width;return($||"").split(/\r?\n/g).map((X)=>X.split(/\s+/g).reduce((Q,K)=>{if(K.length+Z.length>=z||Q[Q.length-1].length+K.length+1<z)Q[Q.length-1]+=` ${K}`;else Q.push(`${Z}${K}`);return Q},[Z]).join(`
|
|
4
4
|
`)).join(`
|
|
5
5
|
`)}});var w0=B((Fz,L0)=>{L0.exports=($,Y,Z)=>{Z=Z||Y;let z=Math.min(Y-Z,$-Math.floor(Z/2));if(z<0)z=0;let X=Math.min(z+Z,Y);return{startIndex:z,endIndex:X}}});var P=B((Nz,_0)=>{_0.exports={action:F0(),clear:A0(),style:S0(),strip:V1(),figures:f1(),lines:D0(),wrap:P0(),entriesToDisplay:w0()}});var d=B((Wz,h0)=>{var b0=O1("readline"),r$=P(),e$=r$.action,$Y=O1("events"),k0=W(),YY=k0.beep,ZY=k0.cursor,zY=N();class x0 extends $Y{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Y=b0.createInterface({input:this.in,escapeCodeTimeout:50});if(b0.emitKeypressEvents(this.in,Y),this.in.isTTY)this.in.setRawMode(!0);let Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,z=(X,Q)=>{let K=e$(Q,Z);if(K===!1)this._&&this._(X,Q);else if(typeof this[K]==="function")this[K](Q);else this.bell()};this.close=()=>{if(this.out.write(ZY.show),this.in.removeListener("keypress",z),this.in.isTTY)this.in.setRawMode(!1);Y.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",z)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(YY)}render(){if(this.onRender(zY),this.firstRender)this.firstRender=!1}}h0.exports=x0});var m0=B((Vz,g0)=>{function d0($,Y,Z,z,X,Q,K){try{var J=$[Q](K),M=J.value}catch(U){Z(U);return}if(J.done)Y(M);else Promise.resolve(M).then(z,X)}function v0($){return function(){var Y=this,Z=arguments;return new Promise(function(z,X){var Q=$.apply(Y,Z);function K(M){d0(Q,z,X,K,J,"next",M)}function J(M){d0(Q,z,X,K,J,"throw",M)}K(void 0)})}}var C1=N(),XY=d(),y0=W(),KY=y0.erase,H1=y0.cursor,E1=P(),m1=E1.style,u1=E1.clear,QY=E1.lines,HY=E1.figures;class f0 extends XY{constructor($={}){super($);this.transform=m1.render($.style),this.scale=this.transform.scale,this.msg=$.message,this.initial=$.initial||"",this.validator=$.validate||(()=>!0),this.value="",this.errorMsg=$.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=u1("",this.out.columns),this.render()}set value($){if(!$&&this.initial)this.placeholder=!0,this.rendered=C1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render($);this._value=$,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
@@ -1067,4 +1067,4 @@ ${Y}:`),$.errors.length>0)H().info("\u274C Errors:"),$.errors.forEach((Z)=>H().i
|
|
|
1067
1067
|
2. \u26A0\uFE0F Using default GITHUB_TOKEN (limited functionality):`),H().info(" \u2022 Dependency updates: \u2705 Will work"),H().info(" \u2022 Dashboard creation: \u2705 Will work"),H().info(" \u2022 Workflow file updates: \u274C Won't work"),H().info(" \uD83D\uDCA1 Consider setting up a Personal Access Token later for full functionality");H().info(`
|
|
1068
1068
|
3. \uD83D\uDD27 Configure repository permissions:`),H().info(` - Go to: https://github.com/${$.owner}/${$.name}/settings/actions`),H().info(' - Under "Workflow permissions":'),H().info(' \u2705 Select "Read and write permissions"'),H().info(' \u2705 Check "Allow GitHub Actions to create and approve pull requests"'),H().info(' - Click "Save"'),H().info(`
|
|
1069
1069
|
\uD83C\uDF89 Setup Complete!`),H().info("\uD83D\uDCA1 Your workflows will now run automatically on schedule!"),H().info("\uD83D\uDCCA First dashboard update will appear within 24 hours"),H().info("\uD83D\uDD17 Learn more: https://docs.github.com/en/actions")}
|
|
1070
|
-
export{j$ as
|
|
1070
|
+
export{j$ as Vg,g7 as Wg,m7 as Xg,D$ as Yg,I$ as Zg,i7 as _g,a7 as $g,_5 as ah,b5 as bh,k5 as ch,x5 as dh,h5 as eh,s7 as fh,d5 as gh,v5 as hh,y5 as ih,f5 as jh,g5 as kh,w$ as lh,zz as mh,m5 as nh,_$ as oh,u5 as ph,c5 as qh,n5 as rh,i5 as sh,l5 as th};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ee as N}from"./chunk-myswpb7z.js";import{Qf as E}from"./chunk-yj6xx2b8.js";import{Mh as v}from"./chunk-bprmzg0p.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]===`
|
|
@@ -10,4 +10,4 @@ ${Q}`.split(`
|
|
|
10
10
|
`)W++;continue}if(V==="/"&&q[W+1]==="*"){W+=2;while(W<q.length&&!(q[W]==="*"&&q[W+1]==="/")){if(q[W]===`
|
|
11
11
|
`)$+=`
|
|
12
12
|
`;W++}W+=2;continue}$+=V,W++}return $}var qq=[L,O,T,k,I,w,_,A];async function vq(q){let K=q.logger??v(),$=q.analyzers??qq,G=[],Q=[],W=[];for(let V of $){if(q.enabled?.[V.name]===!1)continue;let X=E(V.filePatterns),Z=q.files.filter((Y)=>X.matches(Y));if(Z.length===0)continue;if(!await V.available(q.root)){W.push({name:V.name,reason:"tool not available on this runner"}),K.debug(`\u23ED\uFE0F Skipping ${V.name}: not available`);continue}try{let Y=await V.run(Z,q.root);G.push(...Y),Q.push({name:V.name,findings:Y.length}),K.debug(`\uD83D\uDD0E ${V.name}: ${Y.length} finding(s) over ${Z.length} file(s)`)}catch(Y){W.push({name:V.name,reason:Y instanceof Error?Y.message:String(Y)}),K.warn(`\u26A0\uFE0F ${V.name} failed: ${Y}`)}}return{findings:G,ran:Q,skipped:W}}
|
|
13
|
-
export{x as
|
|
13
|
+
export{x as Md,D as Nd,F as Od,j as Pd,H as Qd,B as Rd,I as Sd,O as Td,_ as Ud,f as Vd,P as Wd,R as Xd,k as Yd,A as Zd,a as _d,L as $d,w as ae,T as be,qq as ce,vq as de};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Mh as K}from"./chunk-bprmzg0p.js";var R=".buddy/reports.jsonl",X=52;function Z(M){if(!M?.trim())return[];let E=[];for(let j of M.split(`
|
|
3
3
|
`)){if(!j.trim())continue;try{let N=JSON.parse(j);if(N?.period&&N.generatedAt&&N.health&&N.activity)E.push(N)}catch{continue}}return E}function W(M,E){return`${[...M,E].slice(-X).map((N)=>JSON.stringify(N)).join(`
|
|
4
4
|
`)}
|
|
5
5
|
`}function _(M,E){for(let j=M.length-1;j>=0;j--)if(M[j].period===E)return M[j];return null}async function k(M,E,j=K()){try{return Z(await M.getFileContent(R,E))}catch(N){return j.debug(`No report history at ${R}: ${N}`),[]}}var x=["7d","30d","90d"],O={"7d":7,"30d":30,"90d":90};function A(M){let E=new Date(M.now.getTime()-O[M.period]*24*60*60*1000),j=M.branchPrefix??"buddy/",N=M.pullRequests.filter((q)=>q.head.startsWith(j)),C=N.filter((q)=>q.createdAt>=E),z=N.filter((q)=>q.mergedAt!==void 0&&q.mergedAt>=E),F=N.filter((q)=>q.state==="closed"&&q.mergedAt===void 0&&q.updatedAt>=E),J=z.map((q)=>(q.mergedAt.getTime()-q.createdAt.getTime())/3600000).sort((q,Q)=>q-Q),G=Object.values(M.dependenciesByEcosystem).reduce((q,Q)=>q+Q,0),U=M.updates.length;return{period:M.period,generatedAt:M.now.toISOString(),health:{byEcosystem:{...M.dependenciesByEcosystem},total:G,outdated:U,outdatedPercent:G>0?Math.round(U/G*100):0,majorBehind:M.updates.filter((q)=>q.updateType==="major").length,vulnerable:M.updates.filter((q)=>(q.securityAdvisories?.length??0)>0).length,deprecated:M.deprecated??0,drifted:M.drifted??0},activity:{opened:C.length,merged:z.length,closed:F.length,open:N.filter((q)=>q.state==="open").length,medianHoursToMerge:B(J),mergeRate:C.length>0?Math.round(z.length/C.length*100):0}}}function B(M){if(M.length===0)return null;let E=Math.floor(M.length/2),j=M.length%2===0?(M[E-1]+M[E])/2:M[E];return Math.round(j*10)/10}function L(M,E){if(!E)return{};let j=new Set(["merged","mergeRate"]),N=[["outdated",M.health.outdated,E.health.outdated],["majorBehind",M.health.majorBehind,E.health.majorBehind],["vulnerable",M.health.vulnerable,E.health.vulnerable],["deprecated",M.health.deprecated,E.health.deprecated],["opened",M.activity.opened,E.activity.opened],["merged",M.activity.merged,E.activity.merged],["mergeRate",M.activity.mergeRate,E.activity.mergeRate]],C={};for(let[z,F,J]of N){let G=F-J;C[z]={current:F,previous:J,change:G,improved:j.has(z)?G>=0:G<=0}}return C}var $="<!-- buddy:report -->";function H(M){if(!M||M.change===0)return"\u2014";let E=M.change>0?"\u25B2":"\u25BC",j=M.change>0?"+":"";return`${E} ${j}${M.change}${M.improved?"":" \u26A0\uFE0F"}`}function S(M,E={}){let j=O[M.period],N=[$,"",`## Dependency report \u2014 last ${j} days`,"",`Generated ${M.generatedAt.slice(0,10)}.`,"","### Dependency health","","| Metric | Value | Change |","| --- | --- | --- |",`| Total dependencies | ${M.health.total} | |`,`| Outdated | ${M.health.outdated} (${M.health.outdatedPercent}%) | ${H(E.outdated)} |`,`| A major behind | ${M.health.majorBehind} | ${H(E.majorBehind)} |`,`| With known advisories | ${M.health.vulnerable} | ${H(E.vulnerable)} |`,`| Deprecated | ${M.health.deprecated} | ${H(E.deprecated)} |`];if(M.health.drifted>0)N.push(`| Held back by a dependant | ${M.health.drifted} | |`);N.push("","### By ecosystem","");let C=Object.entries(M.health.byEcosystem).filter(([,z])=>z>0).sort(([,z],[,F])=>F-z);if(C.length===0)N.push("No dependencies detected.");else{N.push("| Ecosystem | Dependencies |","| --- | --- |");for(let[z,F]of C)N.push(`| ${z} | ${F} |`)}if(N.push("","### Bot activity","","| Metric | Value | Change |","| --- | --- | --- |",`| Pull requests opened | ${M.activity.opened} | ${H(E.opened)} |`,`| Merged | ${M.activity.merged} | ${H(E.merged)} |`,`| Closed without merging | ${M.activity.closed} | |`,`| Currently open | ${M.activity.open} | |`),M.activity.medianHoursToMerge!==null)N.push(`| Median time to merge | ${Y(M.activity.medianHoursToMerge)} | |`);if(N.push(`| Merged vs opened | ${M.activity.mergeRate}% | ${H(E.mergeRate)} |`),N.push("",`_"Merged vs opened" compares both counts within the same ${j}-day window, so`,"recently opened pull requests depress it by definition._"),Object.keys(E).length===0)N.push("","_No previous report to compare against; this is the baseline._");return N.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Gh as O}from"./chunk-b4a5gw9c.js";import{Mh as q}from"./chunk-bprmzg0p.js";import{bl as p}from"./chunk-4sqwtry6.js";var T=/(?:^|[-_.])(?:rc|alpha|beta|pre|dev|nightly|canary|snapshot|edge|next)\d*(?:$|[-_.])/i;function B(j){let z=/^v?(\d+(?:\.\d+)*)(.*)$/.exec(j.trim());if(!z)return null;let[,G,Q]=z,J=T.test(Q),Y=Q.replace(T,(Z)=>{return Z.endsWith("-")||Z.endsWith("_")||Z.endsWith(".")?"-":""}).replace(/^[-_.]/,"").toLowerCase();return{raw:j,version:G.split(".").map(Number),suffix:Y,prerelease:J}}function x(j,z){for(let G=0;G<Math.max(j.length,z.length);G++){let Q=(j[G]??0)-(z[G]??0);if(Q!==0)return Q}return j.length-z.length}function k(j,z){let G=(Q)=>/^[a-z]+/.exec(Q)?.[0]??Q;return G(j)===G(z)}function b(j,z,G={}){let Q=B(j);if(!Q)return null;let J=z.map(B).filter((Y)=>Y!==null).filter((Y)=>G.includePrerelease?!0:!Y.prerelease).filter((Y)=>k(Y.suffix,Q.suffix)).filter((Y)=>Y.version.length===Q.version.length).filter((Y)=>x(Y.version,Q.version)>0);if(J.length===0)return null;return J.sort((Y,Z)=>x(Z.version,Y.version)),J[0].raw}function l(j,z){let G=B(j),Q=B(z);if(!G||!Q)return"patch";if((Q.version[0]??0)!==(G.version[0]??0))return"major";if((Q.version[1]??0)!==(G.version[1]??0))return"minor";return"patch"}import P from"process";var v="registry-1.docker.io";function U(j){let z=j.trim(),G,Q=z.indexOf("@");if(Q!==-1)G=z.slice(Q+1),z=z.slice(0,Q);let J=z.indexOf("/"),Y=J===-1?"":z.slice(0,J),Z=Y==="localhost"||Y.includes(".")||Y.includes(":"),X=Z?Y:"docker.io",$=Z?z.slice(J+1):z,K="latest",S=$.lastIndexOf("/"),W=$.indexOf(":",S+1);if(W!==-1)K=$.slice(W+1),$=$.slice(0,W);let M=X==="docker.io"&&!$.includes("/")?`library/${$}`:$;return{registry:X,repository:M,tag:K,...G?{digest:G}:{}}}function i(j){let z=j.registry==="docker.io"?j.repository.replace(/^library\//,""):`${j.registry}/${j.repository}`;return j.digest?`${z}:${j.tag}@${j.digest}`:`${z}:${j.tag}`}function C(j){return j==="docker.io"?v:j}function y(j,z,G=P.env){let Q=z?.[j];if(Q?.tokenEnv){let J=G[Q.tokenEnv]?.trim();if(J)return{token:J}}if(Q?.username&&Q.passwordEnv){let J=G[Q.passwordEnv]?.trim();if(J)return{username:Q.username,password:J}}if(j==="ghcr.io"){let J=G.GITHUB_TOKEN?.trim()||G.BUDDY_TOKEN?.trim();if(J)return{username:"buddy",password:J}}if(j==="docker.io"){let J=G.DOCKERHUB_TOKEN?.trim()||G.DOCKER_TOKEN?.trim();if(J)return{username:G.DOCKERHUB_USERNAME?.trim()||"buddy",password:J}}return null}function R(j){if(!j?.toLowerCase().startsWith("bearer "))return null;let z={};for(let G of j.slice(7).matchAll(/(\w+)="([^"]*)"/g))z[G[1]]=G[2];return z.realm?{realm:z.realm,...z.service?{service:z.service}:{},...z.scope?{scope:z.scope}:{}}:null}function u(j,z){let G=new URL(j.realm);if(j.service)G.searchParams.set("service",j.service);return G.searchParams.set("scope",j.scope??`repository:${z}:pull`),G.toString()}class H{options;logger;tokens=new Map;constructor(j={}){this.options=j;this.logger=j.logger??q()}async listTags(j){let z=C(j.registry),G=this.options.maxPages??10,Q=[],J=`https://${z}/v2/${j.repository}/tags/list?n=100`;for(let Y=0;Y<G&&J;Y++){let Z=await this.authorizedFetch(J,j);if(!Z?.ok){if(Y===0)this.logger.debug(`Could not list tags for ${j.repository} on ${j.registry}: ${Z?.status??"no response"}`);break}let X=await Z.json().catch(()=>null);if(Array.isArray(X?.tags))Q.push(...X.tags);J=h(Z.headers.get("link"),z)}return Q}async resolveDigest(j){let G=`https://${C(j.registry)}/v2/${j.repository}/manifests/${j.tag}`,Q=await this.authorizedFetch(G,j,{method:"HEAD",headers:{Accept:["application/vnd.oci.image.index.v1+json","application/vnd.oci.image.manifest.v1+json","application/vnd.docker.distribution.manifest.list.v2+json","application/vnd.docker.distribution.manifest.v2+json"].join(", ")}});return Q?.ok?Q.headers.get("docker-content-digest"):null}async authorizedFetch(j,z,G={}){let Q={"User-Agent":"buddy",...G.headers},J=this.tokens.get(I(z));if(J)Q.Authorization=`Bearer ${J}`;let Y=()=>O(j,{...G,headers:Q}).catch(()=>null),Z=await Y();if(Z?.status!==401||J!==void 0)return Z;let X=R(Z.headers.get("www-authenticate"));if(!X)return Z;let $=await this.fetchToken(X,z);if(!$)return Z;return this.tokens.set(I(z),$),Q.Authorization=`Bearer ${$}`,Z=await Y(),Z}async fetchToken(j,z){let G=y(z.registry,this.options.registries,this.options.env);if(G&&"token"in G)return G.token;let Q={"User-Agent":"buddy"};if(G){let Z=Buffer.from(`${G.username}:${G.password}`).toString("base64");Q.Authorization=`Basic ${Z}`}let J=await O(u(j,z.repository),{headers:Q}).catch(()=>null);if(!J?.ok)return this.logger.debug(`Token exchange failed for ${z.registry}/${z.repository}: ${J?.status??"no response"}`),null;let Y=await J.json().catch(()=>null);return Y?.token??Y?.access_token??null}}function I(j){return`${j.registry}/${j.repository}`}function h(j,z){if(!j)return null;let G=/<([^>]+)>\s*;\s*rel="?next"?/i.exec(j);if(!G)return null;let Q=G[1];return Q.startsWith("http")?Q:`https://${z}${Q}`}var m=[".md",".txt",".log",".bak",".orig",".example",".sample",".tmpl",".template"];function F(j){let z=(j.split("/").pop()||"").toLowerCase();if(!z)return!1;if(m.some((G)=>z.endsWith(G)))return!1;if(z==="containerfile"||z.startsWith("containerfile."))return!0;if(z==="dockerfile"||z.startsWith("dockerfile."))return!0;return z.endsWith(".dockerfile")||z.endsWith(".containerfile")}async function jj(j,z){try{if(!F(j))return null;let G=[],Q=z.split(`
|
|
3
3
|
`);for(let J=0;J<Q.length;J++){let Y=Q[J].trim();if(!Y||Y.startsWith("#"))continue;let Z=Y.match(/^FROM\s+(\S+)(?:\s+as\s+\w+)?$/i);if(Z){let X=Z[1];if(X==="scratch"||X.startsWith("$"))continue;let $=c(X);if($)G.push({name:$.name,currentVersion:$.version,type:"docker-image",file:j})}}return{path:j,type:"Dockerfile",content:z,dependencies:G}}catch(G){return q().warn(`Failed to parse Dockerfile ${j}:`,G),null}}function c(j){try{let z,G,Q=j.indexOf("@"),J=Q===-1?void 0:j.slice(Q+1);if(Q!==-1)j=j.slice(0,Q);if(J&&!j.includes(":"))return null;if(j.includes(":")){let Y=j.lastIndexOf(":"),Z=j.substring(0,Y),X=j.substring(Y+1);if(/^\d+\//.test(X))z=j,G="latest";else z=Z,G=X}else z=j,G="latest";if(G.includes("$")||G.startsWith("sha256:"))return null;return{name:z,version:G,...J?{digest:J}:{}}}catch(z){return q().warn(`Failed to parse image reference ${j}:`,z),null}}async function zj(j,z,G={}){try{let Q=j.replace(/\s*\(.*\)$/,""),J=U(z?`${Q}:${z}`:Q),Z=await new H({...G.registries?{registries:G.registries}:{},logger:q()}).listTags(J);if(Z.length===0)return null;return b(J.tag,Z,{includePrerelease:G.includePrerelease??!1})}catch(Q){return q().warn(`Failed to fetch latest version for Docker image ${j}:`,Q),null}}async function d(j,z,G){let Q=U(`${j.replace(/\s*\(.*\)$/,"")}:${z}`);return new H({...G?{registries:G}:{},logger:q()}).resolveDigest(Q)}async function f(j,z,G,Q){try{if(!F(j))return q().info(`\u26A0\uFE0F updateDockerfile: ${j} is not a Dockerfile, returning original content`),z;let J=z;for(let Y of G){if(Y.dependencyType!=="docker-image")continue;let Z=Y.name.replace(/\s*\(.*\)$/,""),X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),$=new RegExp(`(FROM\\s+${X})(:)([^\\s@]+)(@sha256:[a-f0-9]+)?([ \\t].*)?$`,"gim"),K=(W)=>{let M=["latest","main","master","develop","dev","stable"],w=W.toLowerCase().trim();return M.includes(w)},S=J.matchAll($);for(let W of S){let M=W[0],w=W[1],L=W[2],_=W[3],V=W[4]||"",D=W[5]||"";if(K(_)){q().info(`\u26A0\uFE0F Skipping update for ${Z} - version "${_}" should be respected`);continue}let A=V;if(V){let E=await d(Z,Y.newVersion,Q);if(!E){q().warn(`\u26A0\uFE0F Leaving ${Z} pinned at ${_}: could not resolve the digest for ${Y.newVersion}`);continue}A=`@${E}`}let N=`${w}${L}${Y.newVersion}${A}${D}`;J=J.replace(M,N),q().info(`\uD83D\uDCDD Updated ${Z}: ${_} \u2192 ${Y.newVersion}${A?" (digest re-resolved)":""}`)}}return J}catch(J){return q().warn(`Failed to update Dockerfile ${j}:`,J),z}}async function Gj(j,z){let G=[],Q=new Map;for(let J of j)if(J.dependencyType==="docker-image"&&F(J.file)){if(!Q.has(J.file))Q.set(J.file,[]);Q.get(J.file).push(J)}for(let[J,Y]of Q)try{let Z=await import("fs");if(Z.existsSync(J)){let X=Z.readFileSync(J,"utf-8"),$=await f(J,X,Y,z);if($!==X)G.push({path:J,content:$,type:"update"}),q().info(`\u2705 Generated update for ${J} with ${Y.length} image changes`);else q().info(`\u2139\uFE0F No changes needed for ${J} - versions already up to date`)}else q().warn(`\u26A0\uFE0F Dockerfile ${J} does not exist`)}catch(Z){q().warn(`Failed to generate updates for Dockerfile ${J}:`,Z)}return G}
|
|
4
|
-
export{B as
|
|
4
|
+
export{B as De,x as Ee,k as Fe,b as Ge,l as He,U as Ie,i as Je,C as Ke,y as Le,R as Me,H as Ne,F as Oe,jj as Pe,zj as Qe,d as Re,f as Se,Gj as Te};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{posix as G}from"path";class v extends Error{constructor(q){super(q);this.name="FileChangeValidationError"}}function H(q){let j=G.normalize(q.replaceAll("\\","/").replace(/^\.\/+/,""));if(!j||j==="."||j===".."||j.startsWith("../")||G.isAbsolute(j))throw new v(`Refusing unsafe repository path: ${JSON.stringify(q)}`);return j}async function J(q,j){for(let B of q){let D=H(B.path);if(B.type==="update"&&!await j(D))throw new v(`Refusing to create missing update target: ${D}. Use change type "create" for intentional new files.`)}}
|
|
3
|
-
export{v as
|
|
3
|
+
export{v as Yf,H as Zf,J as _f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ac as m,Bc as n,Cc as o,Dc as p,Ec as q,Fc as r,Gc as s,Hc as t,Ic as u,oc as a,pc as b,qc as c,rc as d,sc as e,tc as f,uc as g,vc as h,wc as i,xc as j,yc as k,zc as l}from"./chunk-
|
|
2
|
+
import{Ac as m,Bc as n,Cc as o,Dc as p,Ec as q,Fc as r,Gc as s,Hc as t,Ic as u,oc as a,pc as b,qc as c,rc as d,sc as e,tc as f,uc as g,vc as h,wc as i,xc as j,yc as k,zc as l}from"./chunk-y1hppm93.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";export{t as stripOperators,l as splitConstraint,s as scanEcosystems,o as rustAdapter,n as rubyAdapter,c as regenerateWith,u as regenerateLockfiles,m as pythonAdapter,k as pep440UpdateType,h as parsePep440,f as numericUpdateType,j as isPep440Prerelease,g as goAdapter,a as escapeRegex,b as detectFiles,i as comparePep440,e as compareNumeric,d as commandAvailable,r as adapterNamed,q as adapterFor,p as BUILTIN_ADAPTERS};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ii as a,ji as e,ki as o,li as s,mi as t,ni as i,oi as c,pi as r,qi as n,ri as g,si as m,ti as u,ui as P,vi as l,wi as h}from"./chunk-j3bzf5m0.js";import"./chunk-4sqwtry6.js";export{n as toPropertyKey,e as shouldProceedWithGitHubRequest,a as saveRateLimitInfo,s as saveGitHubPackageCache,u as resolvePackageDomain,i as logPkgxProjects,l as isKnownAlias,m as guessOriginalDomain,P as getPackageAliases,o as getGitHubPackageCache,h as getCanonicalDomain,c as formatObjectWithoutQuotedKeys,t as fetchPackageListFromGitHub,r as convertDomainToVarName,g as convertDomainToFileName};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-4sqwtry6.js";var $={error:"\x1B[31m",warning:"\x1B[33m",info:"\x1B[34m"},R={error:"error",warning:"warn ",info:"info "};function a(i,g={}){let l=g.color??!0,r=(n,t)=>l?`${n}${t}\x1B[0m`:t;if(i.workflows.length===0)return r("\x1B[90m","buddy security: no workflows found under .github/workflows.");if(i.findings.length===0)return r("\x1B[32m",`buddy security: ${i.workflows.length} workflow${i.workflows.length===1?"":"s"} clean.`);let e=new Map;for(let n of i.findings){if(!e.has(n.file))e.set(n.file,[]);e.get(n.file).push(n)}let s=[];for(let[n,t]of e){s.push(r("\x1B[1m",n));for(let o of t){let u=r($[o.severity],R[o.severity]),w=o.line!==void 0?r("\x1B[90m",`:${o.line}`):"",E=r("\x1B[90m",`(${o.ruleId})`);if(s.push(` ${u}${w} ${o.message} ${E}`),o.detail)s.push(r("\x1B[2m",` ${o.detail}`));if(o.fix)s.push(r("\x1B[2m",` fix: ${o.fix}`))}s.push("")}let f=i.findings.filter((n)=>n.severity==="error").length,c=i.findings.filter((n)=>n.severity==="warning").length,d=`${f} error${f===1?"":"s"}, ${c} warning${c===1?"":"s"} across ${e.size} workflow${e.size===1?"":"s"}`;return s.push(r(i.failed?"\x1B[31m":"\x1B[33m",d)),s.join(`
|
|
3
3
|
`)}export{a as formatPretty};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{F as
|
|
2
|
+
import{Mh as K}from"./chunk-bprmzg0p.js";import{bl as N}from"./chunk-4sqwtry6.js";function F(q){return(q.split(/[/\\]/).pop()||"")==="build.zig.zon"}async function S(q,z){try{if(!F(q))return null;let J=[],j=z.match(/\.dependencies\s*=\s*\.?\{/);if(j){let Q=j.index+j[0].length,A=1,T=Q;while(T<z.length&&A>0){if(z[T]==="{")A++;else if(z[T]==="}")A--;T++}let G=z.slice(Q,T-1),O=/\.(\w+)\s*=\s*\.?\{/g,W=O.exec(G);while(W!==null){let b=W[1],X=W.index+W[0].length,Y=1,V=X;while(V<G.length&&Y>0){if(G[V]==="{")Y++;else if(G[V]==="}")Y--;V++}let _=G.slice(X,V-1),$=_.match(/\.url\s*=\s*"([^"]+)"/),R=_.match(/\.hash\s*=\s*"([^"]+)"/);if($){let H=$[1],v=H.match(/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i),E=v?v[1]:"unknown",Z={url:H};if(R)Z.hash=R[1];J.push({name:b,currentVersion:E,type:"zig-dependencies",file:q,metadata:Z})}W=O.exec(G)}}return{path:q,type:"build.zig.zon",content:z,dependencies:J}}catch(J){return K().warn(`Failed to parse Zig manifest ${q}:`,J),null}}async function w(q,z,J){try{if(!F(q))return K().info(`\u26A0\uFE0F updateZigManifest: ${q} is not a Zig manifest file, returning original content`),z;let j=z;for(let Q of J){let A=Q.name.trim(),T=new RegExp(`(\\.${A}\\s*=\\s*\\.?\\{[^}]*\\.url\\s*=\\s*")([^"]+)("[^}]*\\})`,"s"),G=j.match(T);if(G){let[O,W,b,X]=G,Y=/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i,V=b.replace(Y,(H)=>{return H.startsWith("/v")?`/v${Q.newVersion}`:`/${Q.newVersion}`}),_=Q.resolved?.hash,$=X;if(_)$=X.replace(/(\.hash\s*=\s*")([^"]+)(")/,`$1${_}$3`);else if(/\.hash\s*=/.test(X)){K().warn(`\u26A0\uFE0F No hash available for ${A}; leaving ${q} unchanged to avoid a hash mismatch`);continue}let R=`${W}${V}${$}`;j=j.replace(O,R),K().info(`\u2705 Updated ${A} from ${G[2]} to ${V}`)}else K().warn(`\u26A0\uFE0F Could not find dependency block for ${A} in ${q}`)}return j}catch(j){return K().warn(`Failed to update Zig manifest ${q}:`,j),z}}async function U(q){let z=[],J=new Map;for(let j of q)if(F(j.file)){if(!J.has(j.file))J.set(j.file,[]);J.get(j.file).push(j)}for(let[j,Q]of J)try{let A=await import("fs");if(A.existsSync(j)){let T=A.readFileSync(j,"utf-8"),G=await w(j,T,Q);if(G!==T)z.push({path:j,content:G,type:"update"}),K().info(`\u2705 Generated update for ${j} with ${Q.length} package changes`);else K().info(`\u2139\uFE0F No changes needed for ${j} - versions already up to date`)}else K().warn(`\u26A0\uFE0F Zig manifest file ${j} does not exist`)}catch(A){K().warn(`Failed to generate updates for Zig manifest ${j}:`,A)}return z}
|
|
3
|
+
export{F as re,S as se,w as te,U as ue};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{existsSync as O,readdirSync as R,statSync as A}from"fs";import{join as U,relative as L}from"path";function T(z,K){try{let V=Bun.YAML.parse(K);if(!V||typeof V!=="object")return null;return{file:z,raw:K,data:V}}catch{return null}}function B(z,K){if(!K)return;let V=z.indexOf(K);if(V<0)return;let M=1;for(let Y=0;Y<V;Y++)if(z.charCodeAt(Y)===10)M++;return M}async function W(z){let K=U(z,".github","workflows");if(!O(K))return[];let V=R(K),M=[];for(let Y of V){if(!Y.endsWith(".yml")&&!Y.endsWith(".yaml"))continue;let Q=U(K,Y);if(!A(Q).isFile())continue;let Z=await Bun.file(Q).text(),N=T(L(z,Q),Z);if(N)M.push(N)}return M}function*X(z){let K=z.data.jobs;if(!K||typeof K!=="object")return;for(let[V,M]of Object.entries(K)){if(!M||typeof M!=="object")continue;let Y=M.steps;if(!Array.isArray(Y))continue;for(let Q=0;Q<Y.length;Q++){let Z=Y[Q];if(!Z||typeof Z!=="object")continue;yield{jobId:V,job:M,stepIndex:Q,step:Z}}}}function*$(z){let K=z.data.jobs;if(!K||typeof K!=="object")return;for(let[V,M]of Object.entries(K)){if(!M||typeof M!=="object")continue;yield{jobId:V,job:M}}}var F={id:"bash-injection",defaultSeverity:"error",description:"Avoid `${{ }}` interpolation of untrusted input inside `run:` blocks.",check(z){let K=[];for(let{jobId:V,step:M,stepIndex:Y}of X(z)){let Q=typeof M.run==="string"?M.run:null;if(!Q)continue;let Z=[...Q.matchAll(/\$\{\{\s*([^}]+?)\s*\}\}/g)];for(let N of Z){let C=N[1].trim();if(I(C))continue;K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Job \`${V}\`, step ${Y+1}: \`${C}\` is interpolated into a shell.`,detail:"GitHub evaluates `${{ ... }}` before the shell runs, so attacker-controlled values become part of the command line. Move the value into `env:` and reference it as a shell variable.",file:z.file,line:B(z.raw,N[0]),fix:'Put the value in `env:` and reference it with `"$NAME"` instead.'})}}return K}},_=["secrets.","vars.","runner.","env.","inputs.","matrix.","strategy.","job.","steps.","needs."],S=new Set(["github.repository","github.repository_owner","github.workflow","github.run_id","github.run_number","github.run_attempt","github.event_name","github.sha","github.ref_name","github.token","github.actor","github.actor_id","github.api_url","github.server_url","github.graphql_url","github.workspace","github.action","github.action_path","github.action_ref","github.action_repository","github.action_status","github.job","github.job_workflow_sha"]);function I(z){if(S.has(z))return!0;return _.some((K)=>z.startsWith(K))}var J={id:"dangerous-pull-request-target",defaultSeverity:"error",description:"Avoid checking out PR-author code from a `pull_request_target` workflow.",check(z){if(!x(z.data.on,"pull_request_target"))return[];let K=[];for(let{jobId:V,step:M}of X(z)){if(!(typeof M.uses==="string"?M.uses:"").startsWith("actions/checkout@"))continue;let Q=typeof M.with?.ref==="string"?M.with.ref:null;if(!Q)continue;if(Q.includes("pull_request")||Q.includes("head.sha")||Q.includes("head.ref")||Q.includes("github.head_ref"))K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Job \`${V}\` checks out PR-author code under \`pull_request_target\`.`,detail:"This grants attacker-controlled code access to repository secrets and write tokens. Move the build to `pull_request` or run untrusted code in a sandboxed second workflow without secrets.",file:z.file,line:B(z.raw,Q),fix:"Either switch the trigger to `pull_request`, or split into two workflows: one privileged (no checkout of head) and one unprivileged (checkout of head, no secrets)."})}return K}};function x(z,K){if(typeof z==="string")return z===K;if(Array.isArray(z))return z.includes(K);if(z&&typeof z==="object")return K in z;return!1}var q={id:"excessive-permissions",defaultSeverity:"warning",description:"Workflows and jobs should declare a least-privilege `permissions:` block.",check(z){let K=[],V=z.data.permissions;if(V===void 0)K.push({ruleId:this.id,severity:this.defaultSeverity,message:"Workflow does not declare top-level `permissions:`.",detail:"Without an explicit `permissions:` block, jobs inherit the repository default \u2014 historically `write-all`. Add a least-privilege block at the workflow root.",file:z.file,line:1,fix:"Add `permissions:\\n contents: read` at the top of the workflow, then narrow per-job as needed."});else if(V==="write-all")K.push({ruleId:this.id,severity:"error",message:"Workflow grants `permissions: write-all`.",file:z.file,line:B(z.raw,"write-all"),fix:"Replace with explicit per-scope grants (e.g. `contents: read`, `pull-requests: write`)."});else if(V!=="read-all"&&typeof V==="object")K.push(...P(this.id,z.file,z.raw,V,"workflow"));for(let{jobId:M,job:Y}of $(z)){let Q=Y.permissions;if(Q===void 0)continue;if(Q==="write-all")K.push({ruleId:this.id,severity:"error",message:`Job \`${M}\` grants \`permissions: write-all\`.`,file:z.file,line:B(z.raw,"write-all"),fix:"Replace with explicit per-scope grants."});else if(Q!=="read-all"&&typeof Q==="object")K.push(...P(this.id,z.file,z.raw,Q,`job \`${M}\``))}return K}};function P(z,K,V,M,Y){let Q=[];if(typeof M!=="object"||M===null)return Q;for(let[Z,N]of Object.entries(M))if(N==="write"&&(Z==="actions"||Z==="id-token"))Q.push({ruleId:z,severity:"warning",message:`${Y} grants \`${Z}: write\` \u2014 verify this is required.`,detail:Z==="id-token"?"`id-token: write` is needed for OIDC federation but should never be combined with running untrusted code.":"`actions: write` allows the workflow to dispatch other workflows, increasing blast radius if compromised.",file:K,line:B(V,`${Z}: write`)});return Q}var D={id:"missing-timeout",defaultSeverity:"warning",description:"Jobs should declare an explicit `timeout-minutes` to bound runaway execution.",check(z){let K=[];for(let{jobId:V,job:M}of $(z)){let Y=M["timeout-minutes"];if(typeof Y==="number"&&Y>0)continue;K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Job \`${V}\` has no \`timeout-minutes\`.`,file:z.file,line:B(z.raw,`${V}:`),fix:"Add `timeout-minutes: <n>` (15\u201360 is a reasonable default for most CI jobs)."})}return K}};var G={id:"self-hosted-exposure",defaultSeverity:"warning",description:"Self-hosted runners should be scoped with additional labels, not used bare.",check(z){let K=[];for(let{jobId:V,job:M}of $(z)){let Y=M["runs-on"];if(!Y)continue;if(typeof Y==="string"){if(Y==="self-hosted")K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Job \`${V}\` uses bare \`runs-on: self-hosted\`.`,file:z.file,line:B(z.raw,"runs-on: self-hosted"),fix:"Add at least one scoping label, e.g. `runs-on: [self-hosted, my-project]`, and disable persistence on the runner."});continue}if(Array.isArray(Y)){let Q=Y.filter((Z)=>typeof Z==="string");if(Q.includes("self-hosted")&&Q.length===1)K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Job \`${V}\` uses \`runs-on: [self-hosted]\` with no additional labels.`,file:z.file,line:B(z.raw,"self-hosted"),fix:"Add at least one scoping label (project name, environment) so the pool is explicit."})}}return K}};var v=/^[0-9a-f]{40}$/i,E={id:"unpinned-action",defaultSeverity:"warning",description:"Third-party actions should be pinned to a full commit SHA, not a tag or branch.",check(z){let K=[];for(let{step:V}of X(z)){let M=typeof V.uses==="string"?V.uses:null;if(!M)continue;if(M.startsWith("./")||M.startsWith("docker://"))continue;let Y=M.lastIndexOf("@");if(Y<0){K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Action \`${M}\` is missing a version reference.`,file:z.file,line:B(z.raw,M),fix:`Pin to a commit SHA: \`${M}@<full-sha> # vX.Y.Z\``});continue}let Q=M.slice(0,M.indexOf("/")),Z=M.slice(Y+1);if(Q==="actions"||Q==="github")continue;if(v.test(Z))continue;K.push({ruleId:this.id,severity:this.defaultSeverity,message:`Action \`${M}\` is pinned to a mutable ref (\`${Z}\`).`,file:z.file,line:B(z.raw,M),fix:`Replace with a SHA-pinned reference: \`${M.slice(0,Y)}@<full-sha> # ${Z}\``})}return K}};var H=[E,q,J,F,D,G];async function Tz(z,K={}){let V=await W(z);return y(V,K)}function y(z,K={}){let V=(K.rules??H).filter((Q)=>{return!K.ignore?.includes(Q.id)}),M=[];for(let Q of z)for(let Z of V){let N=Z.check(Q);for(let C of N)M.push(C)}let Y=M.some((Q)=>Q.severity==="error");return{workflows:z,findings:M,failed:Y}}
|
|
3
|
-
export{Tz as
|
|
3
|
+
export{Tz as ee,y as fe};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{cd as Z}from"./chunk-90x7e4ra.js";import{Kh as _}from"./chunk-bprmzg0p.js";import Y from"process";class L{jobs=new Map;timers=new Map;logger;isRunning=!1;constructor(q=!1){this.logger=q?_.verbose():_.quiet()}addJob(q){this.jobs.set(q.id,q),this.scheduleJob(q),this.logger.info(`Scheduled job '${q.name}' with cron: ${q.schedule.cron}`)}removeJob(q){let C=this.timers.get(q);if(C)clearTimeout(C),this.timers.delete(q);this.jobs.delete(q),this.logger.info(`Removed scheduled job: ${q}`)}start(){if(this.isRunning){this.logger.warn("Scheduler is already running");return}this.isRunning=!0,this.logger.info("\uD83D\uDD52 Buddy Scheduler started");for(let q of this.jobs.values())if(this.scheduleJob(q),q.schedule.runOnStartup)this.logger.info(`Running startup job: ${q.name}`),setImmediate(()=>this.runJob(q));Y.on("SIGINT",()=>this.stop()),Y.on("SIGTERM",()=>this.stop())}stop(){if(!this.isRunning)return;this.isRunning=!1,this.logger.info("\uD83D\uDED1 Stopping Buddy Scheduler...");for(let q of this.timers.values())clearTimeout(q);this.timers.clear(),this.logger.success("\u2705 Buddy Scheduler stopped"),Y.exit(0)}getJobStatus(q){return this.jobs.get(q)}getAllJobs(){return Array.from(this.jobs.values())}scheduleJob(q){let C=this.timers.get(q.id);if(C)clearTimeout(C);let D=this.getNextRunTime(q.schedule.cron,q.schedule.timezone);if(q.nextRun=D||void 0,D){let G=D.getTime()-Date.now(),F=setTimeout(()=>{this.runJob(q),this.scheduleJob(q)},G);this.timers.set(q.id,F),this.logger.debug(`Job '${q.name}' scheduled for ${D.toISOString()}`)}}async runJob(q){if(q.status==="running"){this.logger.warn(`Job '${q.name}' is already running, skipping`);return}q.status="running",q.lastRun=new Date,this.logger.info(`\uD83D\uDE80 Running scheduled job: ${q.name}`);let C=Date.now(),D=q.schedule.maxRuntime||1800000;try{let G=new Promise((Q,U)=>{setTimeout(()=>U(Error("Job timeout")),D)}),F=this.executeJob(q);await Promise.race([F,G]);let J=Date.now()-C;q.status="idle",this.logger.success(`\u2705 Job '${q.name}' completed in ${J}ms`)}catch(G){q.status="error",this.logger.error(`\u274C Job '${q.name}' failed:`,G)}}async executeJob(q){let C=new Z(q.config),D=await C.scanForUpdates();if(D.updates.length===0){this.logger.info("No dependency updates found");return}if(this.logger.info(`Found ${D.updates.length} dependency updates`),q.config.repository&&q.config.pullRequest)await C.createPullRequests(D),this.logger.success(`Created pull requests for ${D.groups.length} update groups`);else this.logger.info("Repository not configured, skipping PR creation")}getNextRunTime(q,C){try{return this.parseCronExpression(q,C)}catch(D){return this.logger.error(`Invalid cron expression '${q}':`,D),null}}parseCronExpression(q,C){let D=q.trim().split(/\s+/);if(D.length!==5)throw Error("Cron expression must have 5 parts: minute hour day month dayOfWeek");let[G,F,J,Q,U]=D,K=new Date,V=C?this.timezoneOffsetMinutes(K,C):0;if(C)this.logger.debug(`Using timezone: ${C} (offset ${V} minutes)`);let X=new Date(K.getTime()+V*60*1000);X.setSeconds(0,0);let $=this.parseCronField(F,0,23),B=this.parseCronField(G,0,59);if($.length>0&&B.length>0){if(X.setHours($[0],B[0],0,0),X.getTime()-V*60*1000<=K.getTime())X.setDate(X.getDate()+1);return new Date(X.getTime()-V*60*1000)}return new Date(K.getTime()+3600000)}timezoneOffsetMinutes(q,C){try{let D=new Date(q.toLocaleString("en-US",{timeZone:C})),G=new Date(q.toLocaleString("en-US"));return Math.round((D.getTime()-G.getTime())/60000)}catch{return this.logger.warn(`\u26A0\uFE0F Unknown timezone "${C}", scheduling in host time instead`),0}}parseCronField(q,C,D){if(q==="*")return Array.from({length:D-C+1},(F,J)=>C+J);if(q.includes(","))return q.split(",").map(Number).filter((F)=>Number.isFinite(F)&&F>=C&&F<=D);if(q.includes("-")){let F=q.split("-").map(Number),J=F[0],Q=F[1];if(F.length!==2||!Number.isFinite(J)||!Number.isFinite(Q)||Q<J)return[];return Array.from({length:Q-J+1},(U,K)=>J+K).filter((U)=>U>=C&&U<=D)}if(q.includes("/")){let[F,J]=q.split("/"),Q=Number(J);if(!Number.isFinite(Q)||Q<=0)return[];if(F==="*")return Array.from({length:D-C+1},(K,V)=>C+V).filter((K,V)=>V%Q===0);let U=Number(F);return Number.isFinite(U)?[U].filter((K)=>K>=C&&K<=D):[]}let G=Number(q);return Number.isFinite(G)&&G>=C&&G<=D?[G]:[]}static createJobFromConfig(q,C="default"){let D={cron:q.schedule?.cron||"0 2 * * 1",timezone:q.schedule?.timezone,runOnStartup:!1,maxRuntime:1800000};return{id:C,name:`Buddy Dependency Updates (${C})`,schedule:D,status:"idle",config:q}}static PRESETS={DAILY:"0 2 * * *",WEEKLY:"0 2 * * 1",WEEKDAYS:"0 2 * * 1-5",TWICE_WEEKLY:"0 2 * * 1,4",MONTHLY:"0 2 1 * *",HOURLY:"0 * * * *",CUSTOM:(q,C,D="*")=>`${q} ${C} * * ${D}`}}
|
|
3
3
|
export{L as Da};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Mh as F}from"./chunk-bprmzg0p.js";var R=/^(?:build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(?:\([^)]+\))?!?: .+/;function Y(M,G){let P=R.test(M.trim());return{name:"title-format",mode:G,passed:P,summary:P?"Title follows conventional commit format":"Title does not follow conventional commit format",...P?{}:{detail:"Expected something like `feat(scope): add the thing` or `fix: correct the off-by-one`."}}}function B(M,G){let P=M.trim();if(P.length<20)return{name:"description",mode:G.mode,passed:!1,summary:"Description is missing or too short",detail:"Explain what changed and why, so a reviewer does not have to reconstruct it from the diff."};let z=(G.requireSections??[]).filter((j)=>!new RegExp(`^#{1,6}\\s*${w(j)}\\b`,"im").test(P));return{name:"description",mode:G.mode,passed:z.length===0,summary:z.length===0?"Description is complete":`Description is missing ${z.length} required section(s)`,...z.length>0?{detail:`Missing: ${z.map((j)=>`\`${j}\``).join(", ")}`}:{}}}function C(M,G){let P=[];for(let z of M??[]){if(G.blockVulnerable!==!1&&z.vulnerable)P.push(`\`${z.name}@${z.version}\` has a known vulnerability`);if(G.blockDeprecated!==!1&&z.deprecated)P.push(`\`${z.name}\` is deprecated`);if(G.blockEol!==!1&&z.eol)P.push(z.eol);if(G.licenseAllowlist?.length&&z.license){if(!G.licenseAllowlist.includes(z.license))P.push(`\`${z.name}\` is licensed \`${z.license}\`, which is not on the allowlist`)}}return{name:"dependency-gate",mode:G.mode,passed:P.length===0,summary:P.length===0?"Dependencies satisfy the configured policy":`${P.length} dependency policy violation(s)`,...P.length>0?{detail:P.map((z)=>`- ${z}`).join(`
|
|
3
3
|
`)}:{}}}function q(M,G){let P=[];if(G.titleFormat&&G.titleFormat!=="off")P.push(Y(M.title,G.titleFormat));if(G.description&&G.description.mode!=="off")P.push(B(M.body,G.description));if(G.dependencyGate&&G.dependencyGate.mode!=="off")P.push(C(M.dependencies,G.dependencyGate));return P}function S(M){if(M.length===0)return{conclusion:"neutral",title:"No checks configured",summary:"No pre-merge checks are enabled."};let G=M.filter((x)=>!x.passed&&x.mode==="error"),P=M.filter((x)=>!x.passed&&x.mode==="warning"),z=M.filter((x)=>x.neutral),j=M.map((x)=>{return`${H(x)} **${x.name}** \u2014 ${x.summary}${x.detail?`
|
|
4
4
|
|
|
5
5
|
${x.detail}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$a as e,Xa as a,Ya as b,Za as c,_a as d,ab as f,bb as g,cb as h,db as i,eb as j,fb as k,gb as l}from"./chunk-
|
|
2
|
+
import{$a as e,Xa as a,Ya as b,Za as c,_a as d,ab as f,bb as g,cb as h,db as i,eb as j,fb as k,gb as l}from"./chunk-wsxy4w86.js";import"./chunk-ffb50kwa.js";import"./chunk-4sqwtry6.js";export{k as withTouchOffer,b as unitTestsTouch,d as simplifyTouch,i as renderTouchOffer,e as planTouch,l as parseTouchSelections,j as hasTouchOffer,g as getFinishingTouch,a as docstringsTouch,c as autofixTouch,h as TOUCH_OFFER_MARKER,f as FINISHING_TOUCHES};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bg as Z}from"./chunk-d73ympxb.js";import{Mh as J}from"./chunk-bprmzg0p.js";import{bl as q}from"./chunk-4sqwtry6.js";import{spawn as E}from"child_process";import{existsSync as K}from"fs";import V from"process";function v(){return["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml","composer.lock","pantry.lock"]}function Y(b){switch(b){case"bun":return{command:"bun",args:["install"]};case"npm":return{command:"npm",args:["install"]};case"yarn":return{command:"yarn",args:["install"]};case"pnpm":return{command:"pnpm",args:["install"]};case"composer":return{command:"composer",args:["update","--lock"]};case"pantry":return{command:"pantry",args:["install","--ignore-scripts","--quiet"]}}}async function x(b,z,j=300000){let{command:B,args:Q}=Y(b);return J().info(`\uD83D\uDD04 Regenerating lock file with ${b} (${B} ${Q.join(" ")})...`),new Promise((H)=>{let O=E(B,Q,{cwd:z,stdio:"pipe",env:{...V.env,CI:"true"}}),$="",U="",W=!1,X=setTimeout(()=>{W=!0,J().warn(`\u26A0\uFE0F ${b} install timed out after ${j/1000}s, sending SIGTERM...`),O.kill("SIGTERM"),setTimeout(()=>{if(!O.killed)J().warn(`\u26A0\uFE0F ${b} install did not exit after SIGTERM, sending SIGKILL...`),O.kill("SIGKILL")},1e4)},j);O.stdout?.on("data",(G)=>{$+=G.toString()}),O.stderr?.on("data",(G)=>{U+=G.toString()}),O.on("close",(G)=>{if(clearTimeout(X),W){H({success:!1,packageManager:b,message:`Lock file regeneration timed out after ${j/1000}s`});return}if(G===0)J().info(`\u2705 Lock file regenerated successfully with ${b}`),H({success:!0,packageManager:b,message:"Lock file regenerated successfully"});else{if(J().warn(`\u26A0\uFE0F ${b} install exited with code ${G}`),U)J().warn(` stderr: ${U.slice(0,500)}`);H({success:!1,packageManager:b,message:`Install exited with code ${G}: ${U.slice(0,200)}`})}}),O.on("error",(G)=>{clearTimeout(X),J().warn(`\u26A0\uFE0F Failed to run ${B}: ${G.message}`),H({success:!1,packageManager:b,message:`Failed to run ${B}: ${G.message}`})})})}var A=new Set(["deps.yaml","deps.yml","pantry.jsonc","pantry.json","pantry.toml"]);function R(b,z=V.cwd()){let j=new Set,B=!1;for(let Q of b){let H=Q.split("/").pop()||"";if(H==="package.json")j.add(Z(z)),B=!0;if(H==="composer.json")j.add("composer");if(A.has(H))B=!0}if(B&&_("pantry",z))j.add("pantry");return Array.from(j)}function T(b,z){return{bun:["bun.lock","bun.lockb"],npm:["package-lock.json"],yarn:["yarn.lock"],pnpm:["pnpm-lock.yaml"],composer:["composer.lock"],pantry:["pantry.lock"]}[b].find((B)=>K(`${z}/${B}`))??null}function F(b,z=V.cwd()){let j=new Set(b.map((B)=>B.replace(/^\.\//,"")));return R(b,z).map((B)=>T(B,z)).filter((B)=>B!==null&&!j.has(B))}function _(b,z){let j=q("path");switch(b){case"bun":return K(j.join(z,"bun.lock"))||K(j.join(z,"bun.lockb"));case"npm":return K(j.join(z,"package-lock.json"));case"yarn":return K(j.join(z,"yarn.lock"));case"pnpm":return K(j.join(z,"pnpm-lock.yaml"));case"composer":return K(j.join(z,"composer.lock"));case"pantry":return K(j.join(z,"pantry.lock"))}}
|
|
3
|
+
export{v as Mc,x as Nc,R as Oc,T as Pc,F as Qc,_ as Rc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-rb1fh9vd.js";import{$d as p,Md as a,Nd as b,Od as c,Pd as d,Qd as e,Rd as f,Sd as g,Td as h,Ud as i,Vd as j,Wd as k,Xd as l,Yd as m,Zd as n,_d as o,ae as q,be as r,ce as s,de as t}from"./chunk-k53ndvfv.js";import"./chunk-myswpb7z.js";import"./chunk-yj6xx2b8.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";export{r as syntaxAnalyzer,q as shellcheckAnalyzer,p as secretsAnalyzer,b as runTool,t as runAnalyzers,e as relativize,d as parseToolJson,j as offsetToLine,n as markdownlintAnalyzer,c as mapSeverity,m as linterAnalyzer,i as hadolintAnalyzer,h as githubActionsAnalyzer,l as detectLinter,f as commandExists,g as actionlintAnalyzer,a as TOOL_TIMEOUT_MS,o as SECRET_RULES,k as LINTER_SPECS,s as BUILTIN_ANALYZERS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-4sqwtry6.js";var z={error:"error",warning:"warning",info:"notice"};function E(j){let q=[];for(let h of j.findings){let x=[`file=${h.file}`,`title=${h.ruleId}`];if(h.line!==void 0)x.push(`line=${h.line}`);let y=B(`${h.message}${h.fix?` \u2014 ${h.fix}`:""}`);q.push(`::${z[h.severity]} ${x.join(",")}::${y}`)}return q.join(`
|
|
3
3
|
`)}function B(j){return j.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
4
4
|
`,"%0A")}export{E as formatGitHub};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ka as a,la as b,ma as c,na as d,oa as e,pa as f,qa as g,ra as h,sa as i,ta as j,ua as k,va as l,wa as m}from"./chunk-
|
|
2
|
+
import{ka as a,la as b,ma as c,na as d,oa as e,pa as f,qa as g,ra as h,sa as i,ta as j,ua as k,va as l,wa as m}from"./chunk-nj38e2km.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";export{e as summarizeGates,l as runPostMerge,d as runGates,i as runAiGates,m as isMergeEvent,f as gateIcon,j as findLinkedIssues,a as checkTitleFormat,g as checkLinkedIssue,b as checkDescription,c as checkDependencies,h as checkCustomAssertions,k as appendChangelogEntry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{D as s,E as t,F as u,G as v,H as w,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,u as p,v as q,w as r}from"./chunk-
|
|
2
|
+
import{D as s,E as t,F as u,G as v,H as w,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,u as p,v as q,w as r}from"./chunk-bjg4gxs4.js";import"./chunk-4sqwtry6.js";export{r as toFile,v as default,w as betaRefusalFallbackMiddleware,l as UnprocessableEntityError,f as RetryableError,m as RateLimitError,i as PermissionDeniedError,q as PagePromise,j as NotFoundError,n as InternalServerError,s as HUMAN_PROMPT,k as ConflictError,o as BetaFallbackState,u as BaseAnthropic,g as BadRequestError,h as AuthenticationError,a as AnthropicError,v as Anthropic,c as APIUserAbortError,p as APIPromise,b as APIError,e as APIConnectionTimeoutError,d as APIConnectionError,t as AI_PROMPT};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Eb as _,Fb as y}from"./chunk-q2tjkhez.js";import{Mb as g,Nb as r,Ob as e,Pb as jj}from"./chunk-5yfaptmp.js";import{Wb as n,Xb as o,Yb as t}from"./chunk-
|
|
2
|
+
import{Eb as _,Fb as y}from"./chunk-q2tjkhez.js";import{Mb as g,Nb as r,Ob as e,Pb as jj}from"./chunk-5yfaptmp.js";import{Wb as n,Xb as o,Yb as t}from"./chunk-bxdbf2kj.js";import{fc as s}from"./chunk-e6wny1pp.js";import{de as i}from"./chunk-k53ndvfv.js";import{qe as S}from"./chunk-3nygvd78.js";import{Qf as b,Rf as m}from"./chunk-yj6xx2b8.js";import{Mh as Y}from"./chunk-bprmzg0p.js";var C=["critical","major","minor","nit"],w={type:"object",properties:{summary:{type:"string",description:"One paragraph on what this change does"},effort:{type:"integer",description:"Reviewer effort, 1 (trivial) to 5 (demanding)"},walkthrough:{type:"array",items:{type:"object",properties:{path:{type:"string"},description:{type:"string"}},required:["path","description"],additionalProperties:!1}},findings:{type:"array",items:{type:"object",properties:{path:{type:"string",description:"Repository-relative path"},line:{type:"integer",description:"Line number on the new side of the diff"},severity:{type:"string",enum:C},category:{type:"string",description:"Short slug, e.g. correctness or security"},message:{type:"string",description:"What is wrong and why it matters"},suggestion:{type:"string",description:"Replacement code, only when the fix is mechanical"}},required:["path","line","severity","category","message"],additionalProperties:!1}}},required:["summary","effort","walkthrough","findings"],additionalProperties:!1};function I(J){let j=J.message.toLowerCase().replace(/\s+/g," ").trim().slice(0,120);return`${J.path}:${J.category}:${j}`}function N(J,j){let Q=[],Z=[];for(let $ of J)if(j.get($.path)?.has($.line))Q.push($);else Z.push($);return Q.sort(($,X)=>C.indexOf($.severity)-C.indexOf(X.severity)),{valid:Q,dropped:Z}}function v(J,j){let Q=[],Z=new Set;for(let $ of J){let X=I($);if(j.has(X)||Z.has(X))continue;Z.add(X),Q.push($)}return Q}var Jj=[/(?:^|\/)(?:bun\.lockb?|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|composer\.lock|pantry\.lock)$/,/(?:^|\/)(?:dist|build|out|coverage|node_modules|vendor)\//,/\.min\.(?:js|css)$/,/(?:^|\/)(?:.*\.snap)$/],Qj=`You are reviewing a pull request diff.
|
|
3
3
|
|
|
4
4
|
Report only defects you can point at in the diff. A review that invents
|
|
5
5
|
findings to look thorough is worse than one that reports nothing, so say
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{rd as a}from"./chunk-8dq3gews.js";import"./chunk-d7e6tqmr.js";import"./chunk-d73ympxb.js";import"./chunk-abfyz98y.js";import"./chunk-ak9s0vnr.js";import"./chunk-56q8k98m.js";import"./chunk-wkq57ssc.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-j3bzf5m0.js";import"./chunk-4sqwtry6.js";export{a as PullRequestGenerator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lb as a,Mb as b,Nb as c,Ob as d,Pb as e}from"./chunk-5yfaptmp.js";import"./chunk-
|
|
2
|
+
import{Lb as a,Mb as b,Nb as c,Ob as d,Pb as e}from"./chunk-5yfaptmp.js";import"./chunk-4sqwtry6.js";export{d as upsertReviewState,b as serializeReviewState,c as parseReviewState,e as needsReview,a as REVIEW_STATE_VERSION};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as a,ba as b,ca as c,da as d,ea as e,fa as f,ga as g,ha as h,ia as i,ja as j}from"./chunk-69qyr9ef.js";import"./chunk-
|
|
2
|
+
import{aa as a,ba as b,ca as c,da as d,ea as e,fa as f,ga as g,ha as h,ia as i,ja as j}from"./chunk-69qyr9ef.js";import"./chunk-4sqwtry6.js";export{d as similarity,j as renderQuickLinks,b as renderPackageContext,h as parseQuickSelection,a as findMentionedPackages,e as findDuplicates,c as constrainLabels,i as clearQuickSelection,f as QUICK_LINKS_MARKER,g as QUICK_ACTIONS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ng as a,og as b,pg as c,qg as d,rg as e,sg as f,tg as g,ug as h,vg as i,wg as j}from"./chunk-abfyz98y.js";import"./chunk-4sqwtry6.js";export{h as withManifest,g as stripManifest,c as serializeManifest,d as serializeGroupManifest,e as parseManifest,i as manifestUpdates,j as manifestFiles,f as hasManifest,a as MANIFEST_SCHEMA_VERSION,b as MANIFEST_MAX_LENGTH};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Gh as X}from"./chunk-b4a5gw9c.js";import{Mh as Z}from"./chunk-bprmzg0p.js";var V={node:"nodejs","library/node":"nodejs",python:"python","library/python":"python",debian:"debian","library/debian":"debian",ubuntu:"ubuntu","library/ubuntu":"ubuntu",alpine:"alpine","library/alpine":"alpine",php:"php","library/php":"php",ruby:"ruby","library/ruby":"ruby",golang:"go","library/golang":"go",postgres:"postgresql","library/postgres":"postgresql",mysql:"mysql","library/mysql":"mysql",redis:"redis","library/redis":"redis",nginx:"nginx","library/nginx":"nginx"};function q(j){let x=j.replace(/^(?:docker\.io|registry-1\.docker\.io)\//,"");return V[x]??V[x.split("/").pop()??""]??null}function G(j,x){let z=/^v?(\d+(?:\.\d+)*)/.exec(j.trim());if(!z)return null;let H=z[1].split(".");for(let k=H.length;k>=1;k--){let K=H.slice(0,k).join("."),B=x.find((J)=>J.cycle===K);if(B)return B}return null}async function F(j,x,z={}){let H=z.logger??Z(),k=q(j);if(!k)return null;let K=z.baseUrl??"https://endoflife.date",B=await X(`${K}/api/${k}.json`,{headers:{"User-Agent":"buddy",Accept:"application/json"}}).catch(()=>null);if(!B?.ok)return H.debug(`Could not read the support window for ${k}`),null;let J=await B.json().catch(()=>null);if(!Array.isArray(J))return null;let v=G(x,J);if(!v)return null;if(v.eol===!1)return{product:k,cycle:v.cycle,eol:!1};if(v.eol===!0)return{product:k,cycle:v.cycle,eol:!0};let M=new Date(v.eol);if(Number.isNaN(M.getTime()))return{product:k,cycle:v.cycle,eol:!1};let $=z.now??new Date,Q=Math.round((M.getTime()-$.getTime())/86400000);return{product:k,cycle:v.cycle,eol:Q<0,date:v.eol,daysRemaining:Q}}var I=90;function N(j){if(!j)return"";if(j.eol)return j.date?`\`${j.product} ${j.cycle}\` reached end of life on ${j.date} and no longer receives security fixes.`:`\`${j.product} ${j.cycle}\` has reached end of life and no longer receives security fixes.`;if(j.daysRemaining!==void 0&&j.daysRemaining<=I)return`\`${j.product} ${j.cycle}\` reaches end of life in ${j.daysRemaining} day(s), on ${j.date}.`;return""}
|
|
3
3
|
export{V as xa,q as ya,G as za,F as Aa,I as Ba,N as Ca};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$e as g,Ve as a,We as b,Xe as c,Ye as d,Ze as e,_e as f,af as h}from"./chunk-e3wax332.js";import"./chunk-4sqwtry6.js";export{e as resolveEngineVersion,d as pinBlocksUpdate,b as extractEngines,g as engineUpdateType,c as collectResolutionPins,f as bumpEngineConstraint,h as applyEngineUpdates,a as KNOWN_ENGINES};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ae as f,Be as g,Ce as h,ve as a,we as b,xe as c,ye as d,ze as e}from"./chunk-xj99g66b.js";import"./chunk-wkq57ssc.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";export{e as updateGitHubActionsFile,d as sameActionVersion,b as parseGitHubActionsFile,a as isGitHubActionsFile,c as isCommitSha,f as generateGitHubActionsUpdates,h as fetchLatestActionVersion,g as fetchActionTagCommit};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oe as a,Pe as b,Qe as c,Re as d,Se as e,Te as f}from"./chunk-kqam9qmd.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";export{e as updateDockerfile,d as resolveDockerDigest,b as parseDockerfile,a as isDockerfile,f as generateDockerfileUpdates,c as fetchLatestDockerImageVersion};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class c extends Error{code;details;constructor(b,j,x){super(b);this.code=j;this.details=x;this.name="BuddyError"}}class k extends c{packageName;constructor(b,j){super(b,"REGISTRY_ERROR");this.packageName=j;this.name="PackageRegistryError"}}class q extends c{operation;constructor(b,j){super(b,"GIT_PROVIDER_ERROR");this.operation=j;this.name="GitProviderError"}}class w extends c{configKey;constructor(b,j){super(b,"CONFIG_ERROR");this.configKey=j;this.name="ConfigurationError"}}
|
|
3
|
-
export{c as
|
|
3
|
+
export{c as ld,k as md,q as nd,w as od};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{vh as M}from"./chunk-wkq57ssc.js";import{Gh as K}from"./chunk-b4a5gw9c.js";import{Mh as J}from"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";function Q(j){let q=j.match(/github\.com\/([^/]+)\/([^/]+)\/(?:archive|releases\/download)\/(?:refs\/tags\/)?v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i);if(!q)return null;return{owner:q[1],repo:q[2].replace(/\.git$/,""),version:q[3],hasVPrefix:/\/v\d/.test(j)}}async function S(j,q){let y=J();try{let B={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"};if(q)B.Authorization=`Bearer ${q}`;let E=await K(`${M()}/repos/${j.owner}/${j.repo}/releases/latest`,{headers:B});if(!E.ok)return y.debug(`No latest release for ${j.owner}/${j.repo}: ${E.status}`),null;let F=await E.json();if(!F.tag_name)return null;let I=F.tag_name.replace(/^v/,"");return/^\d+\.\d+\.\d+/.test(I)?I:null}catch(B){return y.debug(`Failed to fetch latest Zig version for ${j.owner}/${j.repo}: ${B}`),null}}function X(j,q){return j.replace(/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i,(y)=>y.startsWith("/v")?`/v${q}`:`/${q}`)}async function Y(){try{return await Bun.spawn(["zig","version"],{stdout:"pipe",stderr:"pipe"}).exited===0}catch{return!1}}async function _(j){let q=J();try{let y=Bun.spawn(["zig","fetch",j],{stdout:"pipe",stderr:"pipe"}),[B,E]=await Promise.all([new Response(y.stdout).text(),y.exited]);if(E!==0){let I=await new Response(y.stderr).text();return q.warn(`\u26A0\uFE0F zig fetch failed for ${j}: ${I.trim()}`),null}let F=B.trim();return F.length>0?F:null}catch(y){return q.warn(`\u26A0\uFE0F Could not run zig fetch for ${j}: ${y}`),null}}export{X as zigUrlForVersion,Q as parseZigSource,Y as isZigAvailable,_ as fetchZigHash,S as fetchLatestZigVersion};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hb as a,ib as b,jb as c,kb as d,lb as e}from"./chunk-tvrz1xp5.js";import"./chunk-47ancrn1.js";import"./chunk-f7aw9cr3.js";import"./chunk-kypdeb29.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";export{b as verifyChanges,c as stackedBranchName,d as runStackedTouch,e as detectChangedFiles,a as TEST_COMMANDS};
|