@buddysh/buddy 0.11.7 → 0.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +47 -47
- package/dist/chunk-00vbhh0z.js +2 -0
- package/dist/{chunk-wcjf072v.js → chunk-04qvf24t.js} +1 -1
- package/dist/{chunk-njfbmhm4.js → chunk-0apd8zqn.js} +7 -7
- package/dist/chunk-0y706m2d.js +2 -0
- package/dist/chunk-1aee33aa.js +2 -0
- package/dist/{chunk-1z4nhstx.js → chunk-1eh199jk.js} +1 -1
- package/dist/{chunk-fvhnza91.js → chunk-1m5wprvm.js} +1 -1
- package/dist/{chunk-2egzc1fp.js → chunk-1tg7dfq5.js} +1 -1
- package/dist/{chunk-5zs6jrpt.js → chunk-1vhqtq6m.js} +1 -1
- package/dist/{chunk-ysp81zyt.js → chunk-2145m12g.js} +1 -1
- package/dist/{chunk-w16pwfh3.js → chunk-2m0134q8.js} +1 -1
- package/dist/chunk-3ggd7z2f.js +2 -0
- package/dist/chunk-3w79fw62.js +2 -0
- package/dist/{chunk-675c6ddc.js → chunk-3waqfh3y.js} +1 -1
- package/dist/chunk-3xbx315d.js +2 -0
- package/dist/{chunk-3z759ya5.js → chunk-4akhxmfk.js} +1 -1
- package/dist/{chunk-q0tve4cm.js → chunk-4c3dws2k.js} +1 -1
- package/dist/{chunk-03j2dx5h.js → chunk-4hd1mryc.js} +1 -1
- package/dist/chunk-4k9f9vn2.js +2 -0
- package/dist/chunk-4s12xebp.js +2 -0
- package/dist/{chunk-3wy8fypy.js → chunk-4wbbbcs2.js} +1 -1
- package/dist/{chunk-tgh61e5e.js → chunk-5dscgksz.js} +1 -1
- package/dist/chunk-5dw0q5ng.js +2 -0
- package/dist/chunk-5qtdc2mb.js +2 -0
- package/dist/{chunk-xe2xdg6z.js → chunk-61gfjcqt.js} +1 -1
- package/dist/chunk-6gttmvww.js +2 -0
- package/dist/{chunk-97cvp0t3.js → chunk-6wxwewbh.js} +1 -1
- package/dist/chunk-6xzzs109.js +3 -0
- package/dist/{chunk-4ycesykg.js → chunk-7bctsv0x.js} +1 -1
- package/dist/{chunk-0ewzxzt3.js → chunk-7crh00m7.js} +1 -1
- package/dist/{chunk-na0b9r57.js → chunk-7ds5q6j3.js} +1 -1
- package/dist/chunk-7f6mpphq.js +2 -0
- package/dist/{chunk-9b4z1bpx.js → chunk-7gd1et2j.js} +1 -1
- package/dist/{chunk-1q6s6a5e.js → chunk-7mmdxbcm.js} +1 -1
- package/dist/{chunk-p8azbpq6.js → chunk-7rjrea9g.js} +1 -1
- package/dist/chunk-7ze1qrmt.js +2 -0
- package/dist/{chunk-55znd3yn.js → chunk-88xaexj1.js} +1 -1
- package/dist/{chunk-f0z6kyqt.js → chunk-8dj94fsy.js} +1 -1
- package/dist/{chunk-yke7v3gh.js → chunk-8tsw3cjk.js} +1 -1
- package/dist/{chunk-q5pxt13t.js → chunk-90q6r1j7.js} +1 -1
- package/dist/{chunk-4wh0wryv.js → chunk-9m0epv44.js} +1 -1
- package/dist/{chunk-ddmvjp0y.js → chunk-a3bnhq58.js} +1 -1
- package/dist/{chunk-d2d5m2kx.js → chunk-amj037yy.js} +2 -2
- package/dist/chunk-b8t39c5t.js +2 -0
- package/dist/{chunk-j0bsva07.js → chunk-be059ncv.js} +1 -1
- package/dist/{chunk-m17kvr7m.js → chunk-bjymeq7e.js} +1 -1
- package/dist/{chunk-39ne6m3w.js → chunk-c8g8z15b.js} +1 -1
- package/dist/chunk-d7jpbw1z.js +9 -0
- package/dist/{chunk-zkv7e2q2.js → chunk-drkzf2gz.js} +1 -1
- package/dist/chunk-ea6rtyvy.js +2 -0
- package/dist/{chunk-eftyxrxw.js → chunk-er0ntw4q.js} +1 -1
- package/dist/{chunk-2pv5zwbm.js → chunk-f0gag8vx.js} +6 -6
- package/dist/{chunk-t3a1703q.js → chunk-fystbk81.js} +1 -1
- package/dist/{chunk-3d3rwmmj.js → chunk-ggzjv4s0.js} +1 -1
- package/dist/{chunk-sf4p2t84.js → chunk-gs5b2ssa.js} +1 -1
- package/dist/chunk-gw69sjx2.js +2 -0
- package/dist/{chunk-4rvgatmm.js → chunk-gyf7psxg.js} +1 -1
- package/dist/{chunk-wr1q4k9e.js → chunk-h8e796qs.js} +1 -1
- package/dist/{chunk-xzhzvdcv.js → chunk-hdqmcp3n.js} +1 -1
- package/dist/{chunk-x4ea69ek.js → chunk-hyp0wfta.js} +1 -1
- package/dist/{chunk-06k6abjj.js → chunk-j0fcqty9.js} +1 -1
- package/dist/{chunk-3zk2ye6r.js → chunk-jj1gjkb7.js} +1 -1
- package/dist/{chunk-4mwgk0jh.js → chunk-k3x0mabj.js} +2 -2
- package/dist/{chunk-p96zq2zc.js → chunk-k7x9af5r.js} +1 -1
- package/dist/{chunk-7wk4px2k.js → chunk-kh6v93yb.js} +1 -1
- package/dist/{chunk-efqnnrwq.js → chunk-khn11t39.js} +1 -1
- package/dist/{chunk-z456ptfw.js → chunk-kpdz73mc.js} +1 -1
- package/dist/{chunk-v8746363.js → chunk-mcn3508w.js} +3 -3
- package/dist/{chunk-a1fkxmxq.js → chunk-mdbf728w.js} +1 -1
- package/dist/{chunk-he97rsmj.js → chunk-mg3em5qj.js} +1 -1
- package/dist/chunk-mzb7cg8a.js +2 -0
- package/dist/chunk-n0mvh9p4.js +2 -0
- package/dist/chunk-nvz9jajn.js +2 -0
- package/dist/{chunk-v6dephze.js → chunk-nwrr6jas.js} +1 -1
- package/dist/{chunk-srznv36n.js → chunk-p5yaf72b.js} +1 -1
- package/dist/{chunk-sczx20gw.js → chunk-p9z0hzej.js} +1 -1
- package/dist/{chunk-52jcty4n.js → chunk-pjq0qxst.js} +1 -1
- package/dist/{chunk-cbqg29zr.js → chunk-pmszvhja.js} +1 -1
- package/dist/chunk-pxdrwhxx.js +3 -0
- package/dist/{chunk-1z9a3hpe.js → chunk-q90s02qc.js} +1 -1
- package/dist/chunk-qdmr84mc.js +5 -0
- package/dist/{chunk-qv1nvaha.js → chunk-qtyr3kqj.js} +1 -1
- package/dist/{chunk-qczzpthf.js → chunk-rg996jqw.js} +1 -1
- package/dist/{chunk-c87s8txp.js → chunk-rrnvxj90.js} +1 -1
- package/dist/{chunk-6sm15trq.js → chunk-s3ksf6s5.js} +1 -1
- package/dist/{chunk-qz5nqeza.js → chunk-se4g70q2.js} +1 -1
- package/dist/{chunk-305184z3.js → chunk-srz5kgyg.js} +1 -1
- package/dist/chunk-tf9nqr0p.js +2 -0
- package/dist/chunk-tm8eg4sk.js +2 -0
- package/dist/{chunk-f298fv6p.js → chunk-tq1w2wwa.js} +1 -1
- package/dist/chunk-w93akf6h.js +2 -0
- package/dist/chunk-wd8w0vjs.js +2 -0
- package/dist/{chunk-4b0p7kgk.js → chunk-wjmp2hsj.js} +1 -1
- package/dist/{chunk-f001yg2a.js → chunk-wreexgkb.js} +2 -2
- package/dist/{chunk-qk43d3vv.js → chunk-wtt17gzv.js} +1 -1
- package/dist/chunk-xvae9y99.js +2 -0
- package/dist/{chunk-4gx2f1k6.js → chunk-y7z0br2x.js} +1 -1
- package/dist/{chunk-wts1sqw7.js → chunk-y9senfb6.js} +1 -1
- package/dist/{chunk-sjk83y3d.js → chunk-ydt2sn0j.js} +1 -1
- package/dist/{chunk-5gybfx14.js → chunk-ysgex7h7.js} +1 -1
- package/dist/chunk-z0qbkvyz.js +2 -0
- package/dist/{chunk-nhe8axrf.js → chunk-z21tw4fz.js} +2 -2
- package/dist/chunk-z24p5t3p.js +106 -0
- package/dist/chunk-zefqbamj.js +2 -0
- package/dist/{chunk-ztw515ew.js → chunk-zrg5ss0x.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/dist/src/utils/branches.d.ts +13 -0
- package/package.json +1 -1
- package/dist/chunk-19n3wnxq.js +0 -106
- package/dist/chunk-1n42ghef.js +0 -3
- package/dist/chunk-23c6tfbw.js +0 -2
- package/dist/chunk-2ppt1rrx.js +0 -2
- package/dist/chunk-3d5pjrz7.js +0 -5
- package/dist/chunk-3jw9d546.js +0 -2
- package/dist/chunk-4d13qb9f.js +0 -2
- package/dist/chunk-5ct11b1j.js +0 -2
- package/dist/chunk-6t1rb4tz.js +0 -2
- package/dist/chunk-9b2yfhzj.js +0 -9
- package/dist/chunk-a4m6bqpq.js +0 -2
- package/dist/chunk-djdf848n.js +0 -2
- package/dist/chunk-dsep28r5.js +0 -2
- package/dist/chunk-e6sg7jg4.js +0 -2
- package/dist/chunk-eme4fny7.js +0 -2
- package/dist/chunk-fjp4k18r.js +0 -2
- package/dist/chunk-gw3t78fw.js +0 -2
- package/dist/chunk-h4084ykd.js +0 -2
- package/dist/chunk-jczf4z85.js +0 -2
- package/dist/chunk-m2qq154g.js +0 -2
- package/dist/chunk-m8kqe55k.js +0 -2
- package/dist/chunk-n42c80f3.js +0 -2
- package/dist/chunk-nfcyqj66.js +0 -2
- package/dist/chunk-pvfavmy3.js +0 -2
- package/dist/chunk-rfgacg5h.js +0 -2
- package/dist/chunk-t0kvt1pm.js +0 -2
- package/dist/chunk-wfn702a2.js +0 -2
- package/dist/chunk-xpsetmcw.js +0 -2
- package/dist/chunk-yd834q68.js +0 -2
- package/dist/chunk-ymwjjyke.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ve as l}from"./chunk-
|
|
2
|
+
import{Ve as l}from"./chunk-kh6v93yb.js";import{ag as c,jg as A}from"./chunk-wreexgkb.js";import{rg as y}from"./chunk-gvnsr72j.js";import{xh as k}from"./chunk-6k6dgwmy.js";import{Oh as i}from"./chunk-8dj94fsy.js";import u from"process";var d=/\{([a-z_]+)\}/gi,b={title:"title",message:"message",group:"group",count:"count",strategy:"strategy",update_type:"updateType",updateType:"updateType",packages:"packages",updates_table:"updatesTable",release_notes:"releaseNotes",footer:"footer",package_count:"packageCount"};function C(W,$){return W.replace(d,(Y,R)=>{let K=b[R]??b[R.toLowerCase()];if(!K)return Y;let H=$[K];return H===void 0?Y:String(H)})}function f(W,$={},Y){return{...$,group:W.name,count:W.updates.length,packageCount:W.updates.length,updateType:W.updateType,packages:W.updates.map((R)=>R.name).join(", "),...Y?{strategy:Y}:{}}}class p{config;releaseNotesFetcher=new l;verbose=!1;logger;constructor(W,$){this.config=W;this.verbose=W?.verbose||u.env.BUDDY_VERBOSE==="true",this.logger=$??i()}get releaseNotesSettings(){let W=this.config?.releaseNotes;return{enabled:W?.enabled??!0,maxReleases:W?.maxReleases??3,maxBodyLength:W?.maxBodyLength??1000,includeCompareLinks:W?.includeCompareLinks??!0}}repositoryFileUrl(W){let $=k(this.config),{owner:Y,name:R,baseBranch:K}=this.config?.repository??{};return`${$}/${Y}/${R}/blob/${K||"main"}/${W}`}log(W,$){if(this.verbose){let Y=new Date().toISOString();if(this.logger.info(`[${Y}] PR-GEN: ${W}`),$)this.logger.info(JSON.stringify($,null,2))}}async generatePullRequests(W){let $=[];for(let Y of W){let R=this.generateTitle(Y),K=await this.generateBody(Y),H={number:0,title:R,body:K,head:`buddy/update-${Y.name.toLowerCase().replace(/\s+/g,"-")}`,base:"main",state:"open",url:"",createdAt:new Date,updatedAt:new Date,author:"github-actions[bot]",reviewers:[],assignees:[],labels:this.generateLabels(Y),draft:!1};$.push(H)}return $}generateLabels(W){let $=["dependencies"];if(W.updateType==="major")$.push("major");else if(W.updateType==="minor")$.push("minor");else if(W.updateType==="patch")$.push("patch");let Y=W.updates.filter((B)=>B.file==="package.json"||B.file.endsWith("/package.json")||B.file.endsWith("\\package.json")).length,R=W.updates.filter((B)=>B.file.endsWith("composer.json")||B.file.endsWith("composer.lock")).length,K=W.updates.filter((B)=>B.file.endsWith("build.zig.zon")).length,H=W.updates.filter((B)=>(B.file.includes(".yaml")||B.file.includes(".yml"))&&!B.file.includes(".github/workflows/")).length,Z=W.updates.filter((B)=>B.file.includes(".github/workflows/")).length;if(Y>0)$.push("npm");if(R>0)$.push("composer");if(K>0)$.push("zig");if(H>0)$.push("system");if(Z>0)$.push("github-actions");if(W.updates.length===1){let B=W.updates[0];$.push(B.name)}if(W.updates.length>=5)$.push("bulk-update");return $}generateTitle(W){let $=this.config?.pullRequest?.titleFormat;if($)return C($,f(W,{title:this.defaultTitle(W)},this.config?.packages?.strategy));return this.defaultTitle(W)}defaultTitle(W){if(W.updates.length===1){let R=W.updates[0];return`chore(deps): update dependency ${R.name} to v${R.newVersion}`}let $=W.updates.filter((R)=>R.updateType==="major").length,Y=W.updates.filter((R)=>R.updateType==="minor").length;if($>0)return`chore(deps): update ${W.updates.length} dependencies (major)`;else if(Y>0)return`chore(deps): update ${W.updates.length} dependencies (minor)`;else return`chore(deps): update ${W.updates.length} dependencies (patch)`}async generateBody(W){if(this.log("\uD83D\uDE80 Starting PR body generation",{groupName:W.name,totalUpdates:W.updates.length,updates:W.updates.map((Q)=>({name:Q.name,file:Q.file,dependencyType:Q.dependencyType,currentVersion:Q.currentVersion,newVersion:Q.newVersion,updateType:Q.updateType}))}),W.updates.length===0)this.log("\u26A0\uFE0F WARNING: No updates in group - this will result in sparse PR body",{groupName:W.name,groupTitle:W.title});let $=W.updates.filter((Q)=>Q.file==="package.json"||Q.file.endsWith("/package.json")||Q.file.endsWith("\\package.json")).length,Y=W.updates.filter((Q)=>(Q.file.includes(".yaml")||Q.file.includes(".yml"))&&!Q.file.includes(".github/workflows/")).length,R=W.updates.filter((Q)=>Q.file.includes(".github/workflows/")).length,K=W.updates.filter((Q)=>Q.file.endsWith("composer.json")||Q.file.endsWith("composer.lock")).length,H=W.updates.filter((Q)=>Q.file.endsWith("build.zig.zon")).length;if(this.log("\uD83D\uDCCA Package type counts",{packageJsonCount:$,dependencyFileCount:Y,githubActionsCount:R,composerCount:K,total:W.updates.length}),W.updates.length>0)this.log("\uD83D\uDD0D File path analysis",{files:W.updates.map((Q)=>({name:Q.name,file:Q.file,isExactMatch:Q.file==="package.json",endsWithSlash:Q.file.endsWith("/package.json"),endsWithBackslash:Q.file.endsWith("\\package.json"),matchesAny:Q.file==="package.json"||Q.file.endsWith("/package.json")||Q.file.endsWith("\\package.json")}))});let Z=`This PR contains the following updates:
|
|
3
3
|
|
|
4
4
|
`;Z+=c(W.updates);let B=W.updates.length>1;if(B){if(Z+=`## Package Updates Summary
|
|
5
5
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ah as E,zh as B}from"./chunk-6k6dgwmy.js";import{
|
|
2
|
+
import{Ah as E,zh as B}from"./chunk-6k6dgwmy.js";import{Ih as z}from"./chunk-a3bnhq58.js";import{Oh as A}from"./chunk-8dj94fsy.js";class H{logger;constructor(b){this.logger=b??A()}async checkDeprecatedDependencies(b){let j=[];for(let q of b){let w=await this.checkFileForDeprecatedDependencies(q);j.push(...w)}return j}async checkFileForDeprecatedDependencies(b){let j=[];for(let q of b.dependencies){let w=await this.checkDependencyDeprecation(q,b.type);if(w.deprecated)j.push({name:q.name,currentVersion:q.currentVersion,datasource:this.getDatasourceFromFileType(b.type),file:b.path,type:q.type,replacementAvailable:!1,deprecationMessage:w.message,suggestedReplacement:w.suggestedReplacement})}return j}async checkDependencyDeprecation(b,j){try{if(j==="package.json"||j.includes("lock"))return await this.checkNpmDeprecation(b);else if(j==="composer.json"||j==="composer.lock")return await this.checkComposerDeprecation(b);else if(j==="deps.yaml"||j==="deps.yml"||j.includes("deps"))return await this.checkBunDeprecation(b);return{deprecated:!1}}catch(q){return this.logger.warn(`Failed to check deprecation for ${b.name}:`,q),{deprecated:!1}}}async checkNpmDeprecation(b){try{let j=B(b.name),q=await z(`${j}/${encodeURIComponent(b.name).replace("%40","@")}`,{headers:{"User-Agent":"buddy"}});if(!q.ok)return{deprecated:!1};let w=await q.json();if(w.deprecated)return{deprecated:!0,message:w.deprecated,suggestedReplacement:this.extractSuggestedReplacement(w.deprecated)};let x=w.versions?.[b.currentVersion];if(x?.deprecated)return{deprecated:!0,message:x.deprecated,suggestedReplacement:this.extractSuggestedReplacement(x.deprecated)};return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check npm deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkComposerDeprecation(b){try{let j=await z(`${E()}/packages/${b.name}.json`,{headers:{"User-Agent":"buddy"}});if(!j.ok)return{deprecated:!1};let q=await j.json();if(q.package?.abandoned){let w=typeof q.package.abandoned==="string"?q.package.abandoned:null;return{deprecated:!0,message:`Package is abandoned${w?`, use ${w} instead`:""}`,suggestedReplacement:w||void 0}}return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check Composer deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkBunDeprecation(b){return await this.checkNpmDeprecation(b)}extractSuggestedReplacement(b){let j=[/use\s+([a-z0-9@/-]+)\s+instead/i,/replaced\s+by\s+([a-z0-9@/-]+)/i,/migrate\s+to\s+([a-z0-9@/-]+)/i,/switch\s+to\s+([a-z0-9@/-]+)/i];for(let q of j){let w=b.match(q);if(w)return w[1]}return}getDatasourceFromFileType(b){if(b==="package.json"||b.includes("lock"))return"npm";else if(b==="composer.json"||b==="composer.lock")return"composer";else if(b==="deps.yaml"||b==="deps.yml"||b.includes("deps"))return"bun";else if(b==="github-actions")return"github-actions";return"unknown"}}
|
|
3
3
|
export{H as ed};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dd as a,Ed as b,Fd as c,Gd as d,Hd as e,Id as f,Jd as g,Kd as h,Ld as i,Md as j}from"./chunk-bggpgbdx.js";import"./chunk-
|
|
2
|
+
import{Dd as a,Ed as b,Fd as c,Gd as d,Hd as e,Id as f,Jd as g,Kd as h,Ld as i,Md as j}from"./chunk-bggpgbdx.js";import"./chunk-s3ksf6s5.js";export{j as shouldFail,h as formatReview,d as formatPretty,e as formatGithub,f as formatAgent,b as diffArgsFor,g as countBySeverity,c as collectLocalDiff,i as applySuggestion,a as REVIEW_FORMATS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fc as F}from"./chunk-
|
|
2
|
+
import{fc as F}from"./chunk-ggzjv4s0.js";import{Bf as c}from"./chunk-jpdd59fh.js";import{Nf as E,Qf as A}from"./chunk-7rjrea9g.js";import{Oh as m}from"./chunk-8dj94fsy.js";function S(T,f,r){let O=r?"pull request":"issue";return{name:"read_issue",tier:"read",description:`Read the ${O} this task is about: its title and description.`,parameters:{type:"object",properties:{}},async run(M,x){try{let e=r?(await T.getPullRequests("all")).find((h)=>h.number===f):(await T.getIssues("all")).find((h)=>h.number===f);if(!e)return{content:`Could not find ${O} #${f}.`,isError:!0};let k=(e.body??"").slice(0,20000);return x.log(`read ${O} #${f}`),{content:`# ${e.title}
|
|
3
3
|
|
|
4
4
|
${k||"(no description)"}`,untrusted:!0}}catch(e){return{content:`Could not read ${O} #${f}: ${e instanceof Error?e.message:String(e)}`,isError:!0}}}}}async function C(T){let f=T.logger??m(),r=F(T.config,f);if(!r)return"I need an AI provider configured to write a plan. See https://buddy.sh/ai/providers";let M=[`Write an implementation plan for ${T.isPullRequest?"pull request":"issue"} #${T.number} in this repository.`,"","Call `read_issue` first to see what is being asked for, then read enough of","the repository to be concrete about it.",...T.request?["","The person asking added this direction, which comes from them rather than","from the repository:",` ${T.request.replace(/\n/g," ")}`]:[],"","Produce: the files that would change and why, the order of the work, the","risks, and how the result would be verified. Prefer naming real paths you","have read over describing the change in the abstract.","","If the request is too vague to plan, say what you would need to know","instead of inventing a plan around the gap."].join(`
|
|
5
5
|
`),x=await A(r,{mode:c,task:M,tools:[...E,S(T.provider,T.number,T.isPullRequest)],context:{workspace:T.workspace??process.cwd(),baseBranch:T.config.repository?.baseBranch??"main"},logger:f});if(!x.output)return x.stopReason==="completed"?"I finished researching but produced no plan. That is a bug \u2014 please open an issue.":`I could not finish the plan (${x.stopReason}). The issue may need narrowing.`;return x.output}export{S as Va,C as Wa};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{La as a,Ma as b,Na as c,Oa as d,Pa as e,Qa as f,Ra as g,Sa as h,Ta as i,Ua as j}from"./chunk-
|
|
2
|
+
import{La as a,Ma as b,Na as c,Oa as d,Pa as e,Qa as f,Ra as g,Sa as h,Ta as i,Ua as j}from"./chunk-k3x0mabj.js";import"./chunk-y7z0br2x.js";import"./chunk-ggzjv4s0.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-a3bnhq58.js";import"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.js";export{c as stripNonCommandContext,d as parseCommand,f as mentionsBot,e as isReadOnlyCommand,i as dispatchCommand,j as createHandlers,h as checkPermission,b as READ_ONLY_COMMANDS,g as HELP_TEXT,a as COMMAND_ALIASES};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Dh as V}from"./chunk-pxdrwhxx.js";import{Ih as P}from"./chunk-a3bnhq58.js";import{Lh as M,Oh as Q}from"./chunk-8dj94fsy.js";function X(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function Y(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Z{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
|
|
3
|
+
`)).join(`
|
|
4
|
+
`)}async getPullRequestHeadSha(z){return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}`)).sha??""}async createComment(z,A){try{await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/notes`,{body:A})}catch(F){if(!String(F).includes("404"))throw F;await this.request("POST",`/projects/${this.projectId}/issues/${z}/notes`,{body:A})}}async createIssue(z){let A=await this.request("POST",`/projects/${this.projectId}/issues`,{title:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{}});return this.toIssue(A)}async getIssues(z="open"){let A=z==="all"?"state=all":`state=${z==="open"?"opened":"closed"}`;return(await this.request("GET",`/projects/${this.projectId}/issues?${A}&per_page=100`)).map((G)=>this.toIssue(G))}async updateIssue(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/issues/${z}`,{...A.title!==void 0?{title:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toIssue(F)}async closeIssue(z){await this.request("PUT",`/projects/${this.projectId}/issues/${z}`,{state_event:"close"})}async unpinIssue(z){return!1}async enableAutoMerge(z,A="squash"){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{merge_when_pipeline_succeeds:!0,squash:A==="squash",should_remove_source_branch:!0}),!0}catch(F){return this.logger.debug(`Could not queue !${z} for auto-merge: ${M(F)}`),!1}}async getPullRequestChecksState(z){let F=(await this.optional("GET",`/projects/${this.projectId}/merge_requests/${z}/pipelines`))?.[0]?.status;if(!F)return"none";if(F==="success")return"success";if(["failed","canceled"].includes(F))return"failure";if(["running","pending","created","waiting_for_resource","preparing","scheduled"].includes(F))return"pending";return"none"}async createReview(z,A){if(await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/notes`,{body:A.body}),!A.comments?.length)return{posted:!0,inlineComments:0};let G=(await this.optional("GET",`/projects/${this.projectId}/merge_requests/${z}/versions`))?.[0];if(!G)return this.logger.warn("\u26A0\uFE0F Could not resolve diff positions; inline comments were not posted"),{posted:!0,inlineComments:0};let H=0;for(let J of A.comments)try{await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/discussions`,{body:J.body,position:{position_type:"text",base_sha:G.base_commit_sha,start_sha:G.start_commit_sha,head_sha:G.head_commit_sha,new_path:J.path,old_path:J.path,...J.side==="RIGHT"?{new_line:J.line}:{old_line:J.line}}}),H++}catch(K){this.logger.debug(`Could not place a comment on ${J.path}:${J.line}: ${M(K)}`)}return{posted:!0,inlineComments:H}}async createCheckRun(z,A,F){try{await this.request("POST",`/projects/${this.projectId}/statuses/${A}`,{state:F.conclusion==="failure"?"failed":"success",name:z,description:F.title.slice(0,140)})}catch(G){this.logger.warn(`\u26A0\uFE0F Could not report status ${z}: ${M(G)}`)}}async reactToComment(z,A){let F={eyes:"eyes","+1":"thumbsup","-1":"thumbsdown",rocket:"rocket",confused:"confused"};try{await this.request("POST",`/projects/${this.projectId}/notes/${z}/award_emoji`,{name:F[A]??"eyes"})}catch(G){this.logger.debug(`Could not react to note ${z}: ${M(G)}`)}}async hasWriteAccess(z){return(await this.optional("GET",`/projects/${this.projectId}/members/all?query=${encodeURIComponent(z)}`)??[]).some((F)=>F.username===z&&F.access_level>=30)}async getWorkflowRunLogs(z){return this.optional("GET",`/projects/${this.projectId}/jobs/${z}/trace`,{raw:!0}).catch((A)=>{return this.logger.debug(`Could not read the trace for job ${z}: ${M(A)}`),null})}async listWorkflowRuns(z,A={}){let F=A.limit??20;try{return(await this.request("GET",`/projects/${this.projectId}/jobs?per_page=${Math.min(F*5,100)}`)??[]).filter((H)=>H.ref===z).map((H)=>({id:H.id,name:H.name??"",headSha:H.commit?.id??"",headBranch:H.ref??z,status:X(H.status),conclusion:Y(H.status),createdAt:new Date(H.created_at??new Date().toISOString())})).filter((H)=>!A.status||H.status===A.status).slice(0,F)}catch(G){return this.logger.debug(`Could not list CI jobs for ${z}: ${M(G)}`),[]}}async rerunWorkflowRun(z){try{return await this.request("POST",`/projects/${this.projectId}/jobs/${z}/retry`),!0}catch(A){return this.logger.warn(`Could not retry job ${z}: ${M(A)}`),!1}}async listReviewThreads(z){try{return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/discussions?per_page=100`)??[]).filter((F)=>(F.notes??[]).some((G)=>G.resolvable)).map((F)=>({id:F.id,isResolved:(F.notes??[]).every((G)=>!G.resolvable||G.resolved),...F.notes?.[0]?.position?.new_path?{path:F.notes[0].position.new_path}:{},authorLogins:(F.notes??[]).map((G)=>G.author?.username).filter((G)=>typeof G==="string")}))}catch(A){return this.logger.debug(`Could not read discussions on !${z}: ${M(A)}`),[]}}async resolveReviewThread(z,A){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/discussions/${encodeURIComponent(A)}`,{resolved:!0}),!0}catch(F){return this.logger.warn(`Could not resolve discussion ${A}: ${M(F)}`),!1}}async getBuddyBranches(){return(await this.request("GET",`/projects/${this.projectId}/repository/branches?search=buddy&per_page=100`)).filter((A)=>V(A.name)).map((A)=>({name:A.name,sha:A.commit?.id??"",lastCommitDate:A.commit?.committed_date?new Date(A.commit.committed_date):new Date(0)}))}async getOrphanedBuddyBranches(){let[z,A]=await Promise.all([this.getBuddyBranches(),this.getPullRequests("open")]),F=new Set(A.map((G)=>G.head));return z.filter((G)=>!F.has(G.name))}async cleanupStaleBranches(z=7,A=!1){let F=new Date(Date.now()-z*24*60*60*1000),G=(await this.getOrphanedBuddyBranches()).filter((K)=>K.lastCommitDate<F);if(A)return{deleted:G.map((K)=>K.name),failed:[]};let H=[],J=[];for(let K of G)try{await this.deleteBranch(K.name),H.push(K.name)}catch{J.push(K.name)}return{deleted:H,failed:J}}toPullRequest(z){let A=Boolean(z.draft??z.work_in_progress)||/^(?:draft|wip):/i.test(z.title);return{number:z.iid,title:z.title.replace(/^(?:draft|wip):\s*/i,""),body:z.description??"",head:z.source_branch,base:z.target_branch,state:z.state==="merged"?"merged":z.state==="opened"?"open":"closed",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.merged_at?{mergedAt:new Date(z.merged_at)}:{},author:z.author?.username??"",reviewers:(z.reviewers??[]).map((F)=>F.username),assignees:(z.assignees??[]).map((F)=>F.username),labels:z.labels??[],draft:A}}toIssue(z){return{number:z.iid,title:z.title,body:z.description??"",state:z.state==="closed"?"closed":"open",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.closed_at?{closedAt:new Date(z.closed_at)}:{},author:z.author?.username??"",assignees:(z.assignees??[]).map((A)=>A.username),labels:z.labels??[]}}}
|
|
5
|
+
export{Z as Bh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ec as Z}from"./chunk-
|
|
2
|
+
import{ec as Z}from"./chunk-ggzjv4s0.js";import{Xc as X}from"./chunk-er0ntw4q.js";import{Sd as x,de as V}from"./chunk-be059ncv.js";import{me as U,ne as Y}from"./chunk-1eh199jk.js";import H from"process";var K=[["actionlint","actionlint"],["shellcheck","shellcheck"],["hadolint","hadolint"],["markdownlint","markdownlint"]];async function T(j,J={}){let W=J.env??H.env,Q=J.cwd??H.cwd(),F=J.hasCommand??x,G=[];G.push({name:"bun",status:"ok",detail:`Bun ${Bun.version}`});let C=await Bun.file(`${Q}/.git/HEAD`).exists();G.push(C?{name:"git repository",status:"ok",detail:Q}:{name:"git repository",status:"fail",detail:`${Q} is not a git repository`,remediation:"Run buddy from inside a repository, or run `git init`."});let $=X(j);G.push($.length===0?{name:"configuration",status:"ok",detail:"valid"}:{name:"configuration",status:"fail",detail:`${$.length} problem(s): ${$.slice(0,3).map((q)=>`${q.path} ${q.message}`).join("; ")}`,remediation:"Fix the paths reported above in buddy.config.ts."});let P=Boolean(j.repository?.owner&&j.repository.name);G.push(P?{name:"repository config",status:"ok",detail:`${j.repository.owner}/${j.repository.name}`}:{name:"repository config",status:"warn",detail:"owner and name are not set",remediation:"Set repository.owner and repository.name, or run in Actions where GITHUB_REPOSITORY is available. Local review works without them."});let B=j.repository?.provider??"github",D=j.repository?.token?{token:j.repository.token,source:"repository.token"}:Y(B,W);G.push(D?{name:"git token",status:"ok",detail:`found in ${D.source}`}:{name:"git token",status:"warn",detail:"no token found",remediation:`Set one of ${(U[B]??[]).join(", ")}. Local review does not need one.`});let b=Z(j,W);G.push(b?{name:"ai provider",status:"ok",detail:`${b.provider} via ${b.apiKeyEnv}`}:{name:"ai provider",status:"warn",detail:"no API key found",remediation:"Set ANTHROPIC_API_KEY (or OPENAI_API_KEY / GOOGLE_API_KEY). Dependency updates and static analysis work without one."});for(let[q,M]of K){let I=await F(M);G.push(I?{name:`analyzer: ${q}`,status:"ok",detail:`${M} found`}:{name:`analyzer: ${q}`,status:"warn",detail:`${M} not installed`,remediation:`Install ${M} to enable the ${q} analyzer. Reviews run without it and report it as skipped.`})}let w=V.filter((q)=>!K.some(([M])=>M===q.name)).map((q)=>q.name);return G.push({name:"native analyzers",status:"ok",detail:`${w.join(", ")} \u2014 always available`}),{checks:G,healthy:!G.some((q)=>q.status==="fail")}}var S={ok:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function E(j){let J=["","Buddy environment",""];for(let F of j.checks)if(J.push(`${S[F.status]} ${F.name}: ${F.detail}`),F.remediation)J.push(` \u2192 ${F.remediation}`);let W=j.checks.filter((F)=>F.status==="fail").length,Q=j.checks.filter((F)=>F.status==="warn").length;return J.push(""),J.push(j.healthy?`Ready. ${Q} optional capability/capabilities unavailable.`:`${W} problem(s) must be fixed before buddy can run.`),`${J.join(`
|
|
3
3
|
`)}
|
|
4
4
|
`}
|
|
5
5
|
export{T as W,E as X};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Oh as V}from"./chunk-8dj94fsy.js";import{join as R}from"path";var K=/^catalog:(.*)$/;function N(X){let J;try{J=Bun.YAML.parse(X)}catch{return{entries:[],hasCatalogs:!1}}if(typeof J!=="object"||J===null)return{entries:[],hasCatalogs:!1};let B=J,z=[],$=!1,H=(M,j)=>{if(typeof M!=="object"||M===null||Array.isArray(M))return;$=!0;for(let[U,q]of Object.entries(M))if(typeof q==="string"&&q.trim())z.push({name:U,version:q.trim(),catalog:j})};if(H(B.catalog,"default"),typeof B.catalogs==="object"&&B.catalogs!==null)for(let[M,j]of Object.entries(B.catalogs))H(j,M);return{entries:z,hasCatalogs:$}}function k(X,J,B){let z=K.exec(X.trim());if(!z)return null;let $=z[1].trim()||"default";return J.find((H)=>H.name===B&&H.catalog===$)?.version??null}function w(X){return K.test(X.trim())}function S(X,J,B){let z=X.split(`
|
|
3
3
|
`),$=/^(\s*)(["']?)([^"':]+)\2(\s*:\s*)(["']?)(.+?)\5(\s*(?:#.*)?)$/,H=null,M=!1,j=0;for(let U=0;U<z.length;U++){let q=z[U],Y=q.length-q.trimStart().length,Z=q.trim();if(/^catalog\s*:\s*$/.test(Z)){H="default",M=!1;continue}if(/^catalogs\s*:\s*$/.test(Z)){M=!0,j=Y,H=null;continue}if(M&&Y>j&&/^[\w@./-]+\s*:\s*$/.test(Z)){H=Z.replace(/\s*:\s*$/,"");continue}if(M&&Z&&Y<=j)M=!1,H=null;if(H!==J.catalog)continue;let D=$.exec(q);if(!D||D[3].trim()!==J.name||D[6].trim()!==J.version)continue;let[,x,F,E,P,G,,Q]=D;return z[U]=`${x}${F}${E}${F}${P}${G}${B}${G}${Q}`,z.join(`
|
|
4
4
|
`)}return X}var W="pnpm-workspace.yaml",I="pnpm-workspace.yml";async function h(X,J,B={}){let z=B.logger??V(),$=new Set(B.ignore??[]);for(let H of[W,I]){let M=Bun.file(R(X,H));if(!await M.exists())continue;let{entries:j,hasCatalogs:U}=N(await M.text());if(!U)return{updates:[],entries:[],file:H};return z.debug(`\uD83D\uDCE6 ${H}: ${j.length} catalog entr(ies)`),{updates:(await Promise.all(j.map(async(Y)=>{if($.has(Y.name))return null;try{let Z=await J(Y.name);if(!Z)return null;let D=Y.version.replace(/^[\^~>=<\s]+/,"").trim();if(!D||D===Z)return null;return{name:Y.name,currentVersion:Y.version,newVersion:_(Y.version,Z),updateType:A(D,Z),dependencyType:"catalog",file:H,resolved:{catalog:Y.catalog}}}catch(Z){return z.debug(`Could not resolve catalog entry ${Y.name}: ${Z}`),null}}))).filter((Y)=>Y!==null),entries:j,file:H}}return{updates:[],entries:[]}}function _(X,J){return`${/^([\^~]|>=|<=|>|<)?/.exec(X.trim())?.[1]??""}${J}`}function A(X,J){let B=(H)=>H.split(".").map((M)=>Number.parseInt(M,10)||0),z=B(X),$=B(J);if((z[0]??0)!==($[0]??0))return"major";if((z[1]??0)!==($[1]??0))return"minor";return"patch"}function v(X,J){let B=X;for(let z of J){if(z.dependencyType!=="catalog")continue;B=S(B,{name:z.name,version:z.currentVersion,catalog:z.resolved?.catalog??"default"},z.newVersion)}return B}
|
|
5
5
|
export{N as gc,k as hc,w as ic,S as jc,W as kc,I as lc,h as mc,v as nc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Oh as z}from"./chunk-8dj94fsy.js";function Y(q,F,M=""){if(typeof F!=="object"||F===null)return[];let C=F,Q=M||"(root)",N=[];if(typeof C.type==="string"){let K=D(q);if(!(C.type==="integer"?Number.isInteger(q):K===C.type||C.type==="number"&&K==="integer"))return N.push({path:Q,message:`expected ${C.type}, got ${K}`}),N}if(Array.isArray(C.enum)&&!C.enum.includes(q))N.push({path:Q,message:`expected one of ${C.enum.map((K)=>JSON.stringify(K)).join(", ")}`});if(Array.isArray(C.required)&&typeof q==="object"&&q!==null){for(let K of C.required)if(!(String(K)in q))N.push({path:M?`${M}.${K}`:String(K),message:"is required but missing"})}if(typeof C.properties==="object"&&C.properties!==null&&typeof q==="object"&&q!==null)for(let[K,V]of Object.entries(C.properties)){let X=q[K];if(X!==void 0)N.push(...Y(X,V,M?`${M}.${K}`:K))}if(C.items!==void 0&&Array.isArray(q))q.forEach((K,V)=>{N.push(...Y(K,C.items,`${M}[${V}]`))});return N}function D(q){if(q===null)return"null";if(Array.isArray(q))return"array";if(Number.isInteger(q))return"integer";return typeof q}async function B(q){let F=q.logger??z(),M=q.maxRetries??2,C=q.system??"You are running as a pipeline step. Answer the request directly and completely. There is no interactive user to ask follow-up questions of.",Q="";for(let N=1;N<=M+1;N++){let K=N===1?q.prompt:`${q.prompt}
|
|
3
3
|
|
|
4
4
|
Your previous answer did not satisfy the required schema:
|
|
5
5
|
${Q}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,q=(a,b,d)=>{var f=a!=null&&typeof a==="object";if(f){var g=b?o??=new WeakMap:p??=new WeakMap,h=g.get(a);if(h)return h}d=a!=null?j(k(a)):{};let c=b||!a||!a.__esModule?i(d,"default",{value:a,enumerable:!0}):d;for(let e of l(a))if(!m.call(c,e))i(c,e,{get:n.bind(a,e),enumerable:!0});if(f)g.set(a,c);return c};var r=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var s=import.meta.require;
|
|
3
|
-
export{q as
|
|
3
|
+
export{q as bl,r as cl,s as dl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$e as f,We as a,Xe as b,Ye as c,Ze as d,_e as e,af as g,bf as h}from"./chunk-88j356ng.js";import"./chunk-
|
|
2
|
+
import{$e as f,We as a,Xe as b,Ye as c,Ze as d,_e as e,af as g,bf as h}from"./chunk-88j356ng.js";import"./chunk-s3ksf6s5.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};
|
|
@@ -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-2m0134q8.js";import"./chunk-a3bnhq58.js";import"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ag as c,Bg as d,yg as a,zg as b}from"./chunk-1m5wprvm.js";import"./chunk-ktmgq0ja.js";import"./chunk-8dj94fsy.js";import"./chunk-0apd8zqn.js";import"./chunk-s3ksf6s5.js";export{c as updateDependencyFile,b as parseDependencyFile,a as isDependencyFile,d as generateDependencyFileUpdates};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{sd as a}from"./chunk-p5yaf72b.js";import"./chunk-kh6v93yb.js";import"./chunk-wreexgkb.js";import"./chunk-gvnsr72j.js";import"./chunk-1m5wprvm.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-a3bnhq58.js";import"./chunk-8dj94fsy.js";import"./chunk-0apd8zqn.js";import"./chunk-s3ksf6s5.js";export{a as PullRequestGenerator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{og as a,pg as b,qg as c,rg as d,sg as e,tg as f,ug as g,vg as h,wg as i,xg as j}from"./chunk-gvnsr72j.js";import"./chunk-
|
|
2
|
+
import{og as a,pg as b,qg as c,rg as d,sg as e,tg as f,ug as g,vg as h,wg as i,xg as j}from"./chunk-gvnsr72j.js";import"./chunk-s3ksf6s5.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{I as a,J as b,K as c,L as d,M as e,N as f,O as g,P as h,Q as i,R as j,S as k,T as l,U as m,V as n}from"./chunk-d7jpbw1z.js";import"./chunk-pxdrwhxx.js";import"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.js";export{m as withNarrative,n as shouldPublishReport,l as renderReport,c as parseHistory,f as loadHistory,e as findPrevious,i as computeMetrics,j as computeDeltas,d as appendHistory,g as REPORT_PERIODS,k as REPORT_MARKER,h as PERIOD_DAYS,a as HISTORY_PATH,b as HISTORY_LIMIT};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hb as a,Ib as b,Jb as c,Kb as d}from"./chunk-vckhctmr.js";import"./chunk-
|
|
2
|
+
import{Hb as a,Ib as b,Jb as c,Kb as d}from"./chunk-vckhctmr.js";import"./chunk-s3ksf6s5.js";export{c as findDrift,a as driftFor,d as describeDrift,b as ROOT};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sg as T,xg as B}from"./chunk-gvnsr72j.js";import{yg as S,zg as w}from"./chunk-
|
|
2
|
+
import{sg as T,xg as B}from"./chunk-gvnsr72j.js";import{yg as S,zg as w}from"./chunk-1m5wprvm.js";import{wh as M}from"./chunk-6k6dgwmy.js";import{Ih as V}from"./chunk-a3bnhq58.js";import{dl as W}from"./chunk-s3ksf6s5.js";var v={critical:"\uD83D\uDD34 Critical",high:"\uD83D\uDFE0 High",moderate:"\uD83D\uDFE1 Moderate",low:"\u26AA Low"};function A(O){let Q=O.filter((X)=>(X.securityAdvisories?.length??0)>0);if(Q.length===0)return"";let J=Q.reduce((X,$)=>X+($.securityAdvisories?.length??0),0),Z=`## \uD83D\uDD12 Security Advisories
|
|
3
3
|
|
|
4
4
|
`;Z+=`This PR resolves ${J} known ${J===1?"vulnerability":"vulnerabilities"} `,Z+=`across ${Q.length} ${Q.length===1?"package":"packages"}.
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import{sg as T,xg as B}from"./chunk-gvnsr72j.js";import{yg as S,zg as w}from"./c
|
|
|
7
7
|
`,Z+=`|---|---|---|---|---|
|
|
8
8
|
`;for(let X of Q)for(let $ of X.securityAdvisories??[]){let L=v[$.severity]??$.severity,_=$.url?`[${$.id}](${$.url})`:$.id,K=$.aliases.length>0?` (${$.aliases.join(", ")})`:"",G=$.summary.replace(/\|/g,"\\|").replace(/\s*\n\s*/g," ").trim();Z+=`| \`${X.name}\` | ${L} | ${_}${K} | \`${$.fixedVersion??"n/a"}\` | ${G} |
|
|
9
9
|
`}return`${Z}
|
|
10
|
-
`}async function g(O,Q){try{let J=Q.split("/").pop()||"";if(J==="package.json"){let Z=JSON.parse(O),X=[];return z(Z.dependencies,"dependencies",Q,X),z(Z.devDependencies,"devDependencies",Q,X),z(Z.peerDependencies,"peerDependencies",Q,X),z(Z.optionalDependencies,"optionalDependencies",Q,X),{path:Q,type:"package.json",content:O,dependencies:X}}if(S(Q))return await w(Q,O);if(J==="composer.json"||J==="composer.lock"){let{parseComposerFile:Z}=await import("./chunk-
|
|
10
|
+
`}async function g(O,Q){try{let J=Q.split("/").pop()||"";if(J==="package.json"){let Z=JSON.parse(O),X=[];return z(Z.dependencies,"dependencies",Q,X),z(Z.devDependencies,"devDependencies",Q,X),z(Z.peerDependencies,"peerDependencies",Q,X),z(Z.optionalDependencies,"optionalDependencies",Q,X),{path:Q,type:"package.json",content:O,dependencies:X}}if(S(Q))return await w(Q,O);if(J==="composer.json"||J==="composer.lock"){let{parseComposerFile:Z}=await import("./chunk-kpdz73mc.js");return await Z(Q,O)}return null}catch{return null}}function z(O,Q,J,Z){if(!O)return;for(let[X,$]of Object.entries(O))Z.push({name:X,currentVersion:$,type:Q,file:J})}function l(O){let{existsSync:Q}=W("fs"),{join:J}=W("path");if(Q(J(O,"bun.lockb"))||Q(J(O,"bun.lock")))return"bun";if(Q(J(O,"pnpm-lock.yaml")))return"pnpm";if(Q(J(O,"yarn.lock")))return"yarn";if(Q(J(O,"package-lock.json")))return"npm";return"bun"}function c(O,Q){if(Q)return Q;if(O.length===1){let $=O[0];return`chore(deps): update dependency ${$.name} to ${$.newVersion}`}let J=O.filter(($)=>$.updateType==="major"),Z=O.filter(($)=>$.updateType==="minor"),X=O.filter(($)=>$.updateType==="patch");if(J.length>0)return`chore(deps): update ${J.length} major dependencies`;else if(Z.length>0)return`chore(deps): update ${Z.length} minor dependencies`;else return`chore(deps): update ${X.length} patch dependencies`}function u(O,Q){if(Q)return Q;if(O.length===1){let Z=O[0];return`chore(deps): update dependency ${Z.name} to v${Z.newVersion}`}let J=O.filter((Z)=>Z.updateType==="major");if(J.length>0)return`chore(deps): update ${J.length} major dependencies`;else return"chore(deps): update all non-major dependencies"}function I(O,Q){if(Q)return Q;let J=`This PR contains the following updates:
|
|
11
11
|
|
|
12
12
|
`;J+=A(O),J+=`| Package | Change | Age | Adoption | Passing | Confidence |
|
|
13
13
|
`,J+=`|---|---|---|---|---|---|
|
|
@@ -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-y7z0br2x.js";import{fc as s}from"./chunk-ggzjv4s0.js";import{ee as i}from"./chunk-be059ncv.js";import{re as S}from"./chunk-1eh199jk.js";import{Rf as b,Sf as m}from"./chunk-emygmh7r.js";import{Oh as Y}from"./chunk-8dj94fsy.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{W as a,X as b}from"./chunk-qtyr3kqj.js";import"./chunk-ggzjv4s0.js";import"./chunk-er0ntw4q.js";import"./chunk-ja3rvd6y.js";import"./chunk-mg3em5qj.js";import"./chunk-7crh00m7.js";import"./chunk-be059ncv.js";import"./chunk-xny4kgcc.js";import"./chunk-1eh199jk.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-a3bnhq58.js";import"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.js";export{b as renderDoctorReport,a as diagnose};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rf as D}from"./chunk-emygmh7r.js";import{
|
|
2
|
+
import{Rf as D}from"./chunk-emygmh7r.js";import{Oh as C}from"./chunk-8dj94fsy.js";var O=".buddy/learnings.jsonl",R=20;function T(P){if(!P)return[];let E=[];for(let v of P.split(`
|
|
3
3
|
`)){let L=v.trim();if(!L||L.startsWith("#"))continue;try{let A=JSON.parse(L);if(typeof A.text!=="string"||!A.text.trim())continue;E.push({id:typeof A.id==="string"?A.id:_(A.text),text:A.text.trim(),...Array.isArray(A.paths)?{paths:A.paths.filter((o)=>typeof o==="string")}:{},...typeof A.kind==="string"?{kind:A.kind}:{},...A.source&&typeof A.source==="object"?{source:A.source}:{},createdAt:typeof A.createdAt==="string"?A.createdAt:new Date(0).toISOString()})}catch{continue}}return E}function M(P){return`${P.map((E)=>JSON.stringify(E)).join(`
|
|
4
4
|
`)}
|
|
5
5
|
`}function N(P,E={}){return{id:_(P),text:P.trim(),...E.paths?.length?{paths:E.paths}:{},...E.kind?{kind:E.kind}:{},...E.source?{source:E.source}:{},createdAt:new Date().toISOString()}}function Y(P,E){return[...P.filter((v)=>v.id!==E.id),E]}function q(P,E,v=R){let L=P.map((A)=>{if(!A.paths?.length)return{learning:A,score:1};let o=D(A.paths),I=E.some((V)=>o.matches(V));return{learning:A,score:I?2:0}}).filter((A)=>A.score>0);return L.sort((A,o)=>{if(A.score!==o.score)return o.score-A.score;return o.learning.createdAt.localeCompare(A.learning.createdAt)}),L.slice(0,v).map((A)=>A.learning)}function B(P){if(P.length===0)return"";return`Things this repository has told you before:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ai as
|
|
2
|
+
import{Ai as e,Bi as s,Ci as t,Di as c,Ei as r,Fi as P,Gi as n,Hi as o,Ii as g,Ji as l,Ki as p,Li as d,Mi as k,zi as a}from"./chunk-0apd8zqn.js";import"./chunk-s3ksf6s5.js";export{o as startPeriodicCleanup,n as setupCleanupHandlers,p as scanPantryPackages,t as saveToCacheAndOutput,a as savePackageAsTypeScript,d as readPantryPackageInfo,s as getValidCachedPackage,r as fetchPkgxProjects,k as fetchPantryPackageWithMetadata,P as fetchPantryPackage,l as fetchAndSavePackage,g as fetchAndSaveAllPackages,c as cleanupBrowserResources,e as cleanStaleOutputFiles};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fe as a,ge as b}from"./chunk-xny4kgcc.js";import"./chunk-
|
|
2
|
+
import{fe as a,ge as b}from"./chunk-xny4kgcc.js";import"./chunk-s3ksf6s5.js";export{b as auditParsed,a as audit};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ih as X}from"./chunk-a3bnhq58.js";import{Oh as Z}from"./chunk-8dj94fsy.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};
|