@buddysh/buddy 0.11.17 → 0.11.19
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 +37 -0
- package/README.md +12 -0
- package/bin/cli.ts +92 -72
- package/dist/bin/cli.js +73 -107
- package/dist/bin/entry.d.ts +1 -0
- package/dist/bin/entry.js +3 -0
- package/dist/bin/stacks.d.ts +1 -0
- package/dist/bin/stacks.js +3 -0
- package/dist/chunk-05nyhkdp.js +2 -0
- package/dist/{chunk-hd74jxm2.js → chunk-065sjjzg.js} +2 -2
- package/dist/chunk-0796xk82.js +2 -0
- package/dist/{chunk-bnp0r4eh.js → chunk-0pf9vk80.js} +1 -1
- package/dist/chunk-11599831.js +2 -0
- package/dist/chunk-1et7ppg7.js +2 -0
- package/dist/chunk-20sxtyt7.js +3 -0
- package/dist/chunk-23cjwxjk.js +2 -0
- package/dist/{chunk-cj4d5ad7.js → chunk-2g8r8khw.js} +1 -1
- package/dist/{chunk-cb25v2mp.js → chunk-2v4b940m.js} +1 -1
- package/dist/{chunk-nk8wxxy7.js → chunk-33ymc651.js} +2 -2
- package/dist/{chunk-0kce7e60.js → chunk-3pg9420w.js} +1 -1
- package/dist/{chunk-1a14rx5n.js → chunk-47k0qdd5.js} +2 -2
- package/dist/chunk-4gf3a9pm.js +2 -0
- package/dist/chunk-4we8d2ys.js +2 -0
- package/dist/{chunk-1g43mpqn.js → chunk-539wp217.js} +1 -1
- package/dist/{chunk-j57716xw.js → chunk-58et72hc.js} +1 -1
- package/dist/{chunk-743mhx0e.js → chunk-5feeegzy.js} +2 -2
- package/dist/{chunk-1pecmenc.js → chunk-5nn5mms4.js} +1 -1
- package/dist/{chunk-j46f90n8.js → chunk-5q5tm30a.js} +1 -1
- package/dist/{chunk-t1r2ycn7.js → chunk-5qxs04gf.js} +1 -1
- package/dist/{chunk-9chq5m4p.js → chunk-5ytyahtm.js} +4 -4
- package/dist/chunk-6477cdgj.js +2 -0
- package/dist/{chunk-s3b3vrsj.js → chunk-6bdrm4ab.js} +2 -2
- package/dist/{chunk-psjrcpgb.js → chunk-6kmaj5br.js} +2 -2
- package/dist/chunk-6m03hqbw.js +3 -0
- package/dist/{chunk-whtdmv3p.js → chunk-73a090ce.js} +2 -2
- package/dist/chunk-78pxywjv.js +2 -0
- package/dist/{chunk-nznpzbq4.js → chunk-7bqy4enq.js} +1 -1
- package/dist/chunk-843907bh.js +2 -0
- package/dist/{chunk-dxd0eg4r.js → chunk-88jx1n4t.js} +1 -1
- package/dist/{chunk-gq9gkyah.js → chunk-89spjk6r.js} +2 -2
- package/dist/chunk-8fm0z13m.js +2 -0
- package/dist/{chunk-sj7n6xa1.js → chunk-8hstj0s3.js} +1 -1
- package/dist/{chunk-6w0n6c07.js → chunk-8y4szfd2.js} +1 -1
- package/dist/{chunk-2f7j0dmw.js → chunk-91q9x0df.js} +1 -1
- package/dist/chunk-9pt7kwmm.js +2 -0
- package/dist/{chunk-mthd2c8m.js → chunk-a5hevn6e.js} +2 -2
- package/dist/{chunk-sddaassq.js → chunk-agdvymzh.js} +1 -1
- package/dist/{chunk-8r2819xn.js → chunk-ar8skamr.js} +1 -1
- package/dist/chunk-b8n7zh62.js +2 -0
- package/dist/chunk-by2hfewp.js +2 -0
- package/dist/{chunk-4chtv4nh.js → chunk-c7ja1xmh.js} +1 -1
- package/dist/chunk-cfj98vmf.js +2 -0
- package/dist/{chunk-wk175yyw.js → chunk-cp3g2srn.js} +2 -2
- package/dist/chunk-cxbrnbcp.js +2 -0
- package/dist/{chunk-wfwrm4k3.js → chunk-dev3g0n3.js} +1 -1
- package/dist/{chunk-mr2d1zp0.js → chunk-dgcct70c.js} +2 -2
- package/dist/{chunk-16aeend1.js → chunk-dh8yykbg.js} +1 -1
- package/dist/{chunk-m3rftash.js → chunk-dkgz8hsd.js} +7 -7
- package/dist/{chunk-byqzhgzs.js → chunk-dmaxdw65.js} +1 -1
- package/dist/chunk-e0d1n3yn.js +2 -0
- package/dist/{chunk-1pdvjg0x.js → chunk-ebb90mp9.js} +1 -1
- package/dist/chunk-ece98jde.js +2 -0
- package/dist/{chunk-gg1ddvnf.js → chunk-ednwgr1b.js} +2 -2
- package/dist/{chunk-69qyr9ef.js → chunk-ejfyc7r8.js} +1 -1
- package/dist/{chunk-wfg3bp85.js → chunk-en525sf9.js} +1 -1
- package/dist/{chunk-d09qj570.js → chunk-eq5xb8k1.js} +2 -2
- package/dist/{chunk-h2f92qwd.js → chunk-ewnhhpak.js} +1 -1
- package/dist/{chunk-1jgh0ff1.js → chunk-f3fmewqb.js} +2 -2
- package/dist/chunk-f694pp35.js +2 -0
- package/dist/{chunk-r1jvyhhd.js → chunk-fcax5a60.js} +2 -2
- package/dist/{chunk-pxfrq43h.js → chunk-ffjp134d.js} +1 -1
- package/dist/{chunk-vs61069x.js → chunk-g763t4rr.js} +1 -1
- package/dist/chunk-h65g7hd0.js +2 -0
- package/dist/{chunk-c63e4ssc.js → chunk-h9deve0y.js} +3 -3
- package/dist/chunk-hfq56cgn.js +2 -0
- package/dist/chunk-hwpv7jhw.js +1043 -0
- package/dist/chunk-j9pe2np4.js +5 -0
- package/dist/chunk-jq846den.js +2 -0
- package/dist/{chunk-26yejy1v.js → chunk-jxmpwday.js} +1 -1
- package/dist/{chunk-wc2z7krw.js → chunk-jy1kbr1k.js} +2 -2
- package/dist/{chunk-6gvx1g6h.js → chunk-m6qym0ya.js} +2 -2
- package/dist/chunk-nezqdnp3.js +2 -0
- package/dist/{chunk-7m3pzkcj.js → chunk-ng9zksy3.js} +1 -1
- package/dist/{chunk-7p1b809h.js → chunk-nmrf0ydg.js} +1 -1
- package/dist/{chunk-0f1xye20.js → chunk-pxv58dh1.js} +1 -1
- package/dist/{chunk-2z9mh5y4.js → chunk-q3dg57xx.js} +1 -1
- package/dist/chunk-q9x936wq.js +2 -0
- package/dist/{chunk-jqh7vx2n.js → chunk-qbqk1jax.js} +2 -2
- package/dist/{chunk-ewhvahnb.js → chunk-qfm0eh6y.js} +2 -2
- package/dist/{chunk-g09atq0m.js → chunk-qn1g860m.js} +1 -1
- package/dist/{chunk-yh13j2af.js → chunk-r0jmwzr3.js} +1 -1
- package/dist/chunk-rmv4ajb2.js +2 -0
- package/dist/{chunk-wzncz6j5.js → chunk-rrm4x81p.js} +1 -1
- package/dist/chunk-rsvtnsmt.js +2 -0
- package/dist/{chunk-24xvskkf.js → chunk-rwzt9xvk.js} +1 -1
- package/dist/{chunk-qngnmrpw.js → chunk-ry21xmre.js} +1 -1
- package/dist/{chunk-67bjaw56.js → chunk-s6w47z4a.js} +3 -3
- package/dist/chunk-sek2e857.js +2 -0
- package/dist/{chunk-s0ps33ft.js → chunk-sg7bhtb7.js} +1 -1
- package/dist/{chunk-r7qa2ykf.js → chunk-snya72ah.js} +2 -2
- package/dist/{chunk-a8wcn3mh.js → chunk-t7grk0az.js} +2 -2
- package/dist/chunk-tes3e84x.js +2 -0
- package/dist/chunk-tgm4vbaq.js +2 -0
- package/dist/{chunk-142zh7e5.js → chunk-tqwek43e.js} +1 -1
- package/dist/{chunk-mtn4angk.js → chunk-tztc0r76.js} +1 -1
- package/dist/chunk-v0895nt9.js +2 -0
- package/dist/chunk-v6rrvfh4.js +2 -0
- package/dist/{chunk-k8sd78td.js → chunk-vn4c8fxq.js} +1 -1
- package/dist/{chunk-4r03rh93.js → chunk-vpz26asn.js} +2 -2
- package/dist/{chunk-x9vpk4kk.js → chunk-vxt1h0c4.js} +1 -1
- package/dist/chunk-vyckmje5.js +2 -0
- package/dist/{chunk-4dz5x4xw.js → chunk-wca85ahg.js} +1 -1
- package/dist/chunk-we1n57ze.js +2 -0
- package/dist/{chunk-5yfaptmp.js → chunk-wm6g7y1r.js} +1 -1
- package/dist/chunk-wnqqprmy.js +2 -0
- package/dist/chunk-wt8b3ywq.js +2 -0
- package/dist/{chunk-bw43q8k7.js → chunk-wx4qd9e9.js} +1 -1
- package/dist/chunk-x0mq8nn2.js +2 -0
- package/dist/{chunk-her5azyp.js → chunk-x9spxa46.js} +2 -2
- package/dist/chunk-xfk9a8az.js +2 -0
- package/dist/{chunk-gvpsbmeg.js → chunk-xmk24pz9.js} +2 -2
- package/dist/{chunk-6b0fmw0d.js → chunk-xn2xv07k.js} +2 -2
- package/dist/chunk-xntpzagn.js +3 -0
- package/dist/{chunk-bafzw99p.js → chunk-xqcmw7d0.js} +2 -2
- package/dist/chunk-xvq8w2jm.js +2 -0
- package/dist/{chunk-4wv5s3vr.js → chunk-xyry3bma.js} +2 -2
- package/dist/{chunk-hk4d7rky.js → chunk-y6292gbf.js} +2 -2
- package/dist/chunk-ye3aym4p.js +2 -0
- package/dist/{chunk-7hm46cej.js → chunk-yx9v94q5.js} +2 -2
- package/dist/chunk-yxt8294f.js +2 -0
- package/dist/{chunk-vckhctmr.js → chunk-yy8vb4yk.js} +1 -1
- package/dist/{chunk-fsghqtgf.js → chunk-z0avay86.js} +2 -2
- package/dist/{chunk-z2gcfvze.js → chunk-z906zp4k.js} +5 -5
- package/dist/chunk-zy6azdxt.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/dist/src/stacks-cli.d.ts +7 -0
- package/package.json +5 -5
- package/dist/chunk-0n03s02h.js +0 -2
- package/dist/chunk-1k4p8wyx.js +0 -2
- package/dist/chunk-1mkwhnsf.js +0 -2
- package/dist/chunk-2309x9r7.js +0 -2
- package/dist/chunk-3jm67wxm.js +0 -2
- package/dist/chunk-3mnpvfg3.js +0 -2
- package/dist/chunk-485kgdtb.js +0 -2
- package/dist/chunk-51m5tgwp.js +0 -2
- package/dist/chunk-5t07s3dv.js +0 -2
- package/dist/chunk-6bqs7rtc.js +0 -2
- package/dist/chunk-6kd81nf9.js +0 -1070
- package/dist/chunk-8b7cwedf.js +0 -2
- package/dist/chunk-8wrbxhs3.js +0 -2
- package/dist/chunk-9fagkyrp.js +0 -2
- package/dist/chunk-9gabxm8n.js +0 -2
- package/dist/chunk-bgb44971.js +0 -2
- package/dist/chunk-bz5yx7g6.js +0 -2
- package/dist/chunk-dttp44vs.js +0 -2
- package/dist/chunk-fzs7vpps.js +0 -2
- package/dist/chunk-gkb0gja4.js +0 -2
- package/dist/chunk-hxkxset4.js +0 -2
- package/dist/chunk-jgq5d6s2.js +0 -2
- package/dist/chunk-km4aszfp.js +0 -2
- package/dist/chunk-kthwzc4p.js +0 -2
- package/dist/chunk-m9qtb4xj.js +0 -2
- package/dist/chunk-p9xksx9p.js +0 -2
- package/dist/chunk-pag93kz1.js +0 -2
- package/dist/chunk-q4j2f72t.js +0 -2
- package/dist/chunk-qbep9dk4.js +0 -2
- package/dist/chunk-rqj1vrfs.js +0 -2
- package/dist/chunk-s4fccg73.js +0 -2
- package/dist/chunk-tjj6ttj1.js +0 -2
- package/dist/chunk-tsd9jw07.js +0 -2
- package/dist/chunk-ttkjzy0m.js +0 -2
- package/dist/chunk-txe5z472.js +0 -2
- package/dist/chunk-vffz69jj.js +0 -2
- package/dist/chunk-wn9vr9ct.js +0 -2
- package/dist/chunk-y2ntnpdb.js +0 -2
- package/dist/chunk-y5fdq7cd.js +0 -2
- package/dist/chunk-yr6qyeab.js +0 -2
- package/dist/chunk-z18bksyr.js +0 -3
- package/dist/chunk-zj2pt1bx.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{se as p}from"./chunk-5feeegzy.js";import{Wh as E}from"./chunk-rrm4x81p.js";var x=["github-actions[bot]","buddy","buddy[bot]"];function w(f,r){let e=f.authorLogins[0];if(!e)return!1;return r?e===r:x.includes(e)}async function F(f){let r=f.logger??E(),{provider:e,prNumber:t}=f;if(!p(e,"reviewThreads","listReviewThreads"))return"This provider cannot resolve review threads.";let n=await e.listReviewThreads(t),i=n.filter((R)=>!R.isResolved&&w(R,f.author));if(i.length===0)return n.length===0?"There are no review threads on this pull request.":"None of the open threads here are mine to close.";if(!p(e,"reviewThreads","resolveReviewThread"))return"This provider cannot resolve review threads.";let o=0;for(let R of i)if(await e.resolveReviewThread(t,R.id))o++;else r.warn(`Could not resolve thread ${R.id} on #${t}`);if(o===0)return`I could not close any of the ${i.length} thread(s) I opened.`;let m=o<i.length?` (${i.length-o} refused)`:"";return`Closed ${o} thread(s) I opened${m}.`}export{F as Wa};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Wh as X}from"./chunk-rrm4x81p.js";import"./chunk-dh8yykbg.js";import{readFileSync as _}from"fs";function L(q){let z=q.split("/").pop()||"";return z==="composer.json"||z==="composer.lock"}async function R(q,z){try{let j=JSON.parse(z),A=[];if(j.require)J(j.require,"require",q,A);if(j["require-dev"])J(j["require-dev"],"require-dev",q,A);return{path:q,type:"composer.json",content:z,dependencies:A}}catch(j){return X().warn(`Failed to parse composer.json file ${q}:`,j),null}}async function S(q,z){try{let j=JSON.parse(z),A=[];if(j.packages){for(let b of j.packages)if(b.name&&b.version)A.push({name:b.name,currentVersion:b.version,type:"require",file:q})}if(j["packages-dev"]){for(let b of j["packages-dev"])if(b.name&&b.version)A.push({name:b.name,currentVersion:b.version,type:"require-dev",file:q})}return{path:q,type:"composer.lock",content:z,dependencies:A}}catch(j){return X().warn(`Failed to parse composer.lock file ${q}:`,j),null}}async function v(q,z){let j=q.split("/").pop()||"";if(j==="composer.json")return R(q,z);if(j==="composer.lock")return S(q,z);return null}function J(q,z,j,A){for(let[b,Z]of Object.entries(q)){if(b==="php"||b.startsWith("ext-"))continue;if(b.includes("/"))A.push({name:b,currentVersion:Z,type:z,file:j})}}async function U(q){let z=[],j=q.filter((b)=>b.file.endsWith("composer.json"));if(j.length===0)return z;let A=new Map;for(let b of j){if(!A.has(b.file))A.set(b.file,[]);A.get(b.file).push({name:b.name,newVersion:b.newVersion})}for(let[b,Z]of A)try{let K=_(b,"utf-8"),T=JSON.parse(K);for(let E of Z){let Y=!1;if(T.require&&T.require[E.name]){let H=T.require[E.name],O;if(H.includes(",")){let G=H.match(/\d+\.\d+(?:\.\d+)?/),Q=G?G[0]:null;O=H.replace(/\d+\.\d+(?:\.\d+)?/g,(W)=>{return Q!==null&&W===Q?E.newVersion:W})}else{let G=H.match(/^(\D*)/);O=`${G?G[1]:""}${E.newVersion}`}let $=new RegExp(`("${E.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"\\s*:\\s*")([^"]+)(")`,"g");K=K.replace($,`$1${O}$3`),Y=!0}if(!Y&&T["require-dev"]&&T["require-dev"][E.name]){let H=T["require-dev"][E.name],O;if(H.includes(",")){let G=H.match(/\d+\.\d+(?:\.\d+)?/),Q=G?G[0]:null;O=H.replace(/\d+\.\d+(?:\.\d+)?/g,(W)=>{return Q!==null&&W===Q?E.newVersion:W})}else{let G=H.match(/^(\D*)/);O=`${G?G[1]:""}${E.newVersion}`}let $=new RegExp(`("${E.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"\\s*:\\s*")([^"]+)(")`,"g");K=K.replace($,`$1${O}$3`),Y=!0}if(!Y)X().warn(`Package ${E.name} not found in ${b}`)}z.push({path:b,content:K,type:"update"})}catch(K){X().error(`Failed to update ${b}:`,K)}return z}export{S as parseComposerLock,R as parseComposerJson,v as parseComposerFile,L as isComposerFile,U as generateComposerUpdates};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Sf as Z}from"./chunk-y6292gbf.js";import{Wh as Y}from"./chunk-rrm4x81p.js";import W from"process";var $=[["bun","test"],["npm","test","--silent"]];async function E(G,H){let I=H?[H]:await L(G);for(let z of I){let j=Bun.spawn(z,{cwd:G,stdout:"pipe",stderr:"pipe",env:{PATH:W.env.PATH??"",HOME:W.env.HOME??"",CI:"1"}}),[J,K,Q]=await Promise.all([new Response(j.stdout).text(),new Response(j.stderr).text(),j.exited]);return{ran:!0,passed:Q===0,output:`${J}
|
|
3
3
|
${K}`.trim().slice(-4000)}}return{ran:!1,passed:!1,output:""}}async function L(G){let H=Bun.file(`${G}/package.json`);if(!await H.exists())return[];try{return(await H.json()).scripts?.test?$:[]}catch{return[]}}function O(G,H){return`${G.head}/buddy-${H}`}async function N(G){let H=G.logger??Y(),{provider:I,pullRequest:z,touch:j}=G;H.info(`\u2728 Running finishing touch '${j.name}' on PR #${z.number}`);let J=await Z(G.ai,{mode:j.mode,task:j.buildTask({summary:z.title,files:G.files??[]}),context:{workspace:G.workspace,baseBranch:z.base,branch:z.head},logger:H}),K=await _(G.workspace);if(K.length===0)return{mode:"none",changedFiles:[],verified:!1,comment:J.stopReason==="completed"?`**${j.description}** \u2014 nothing to change.`:`**${j.description}** \u2014 stopped before finishing (${J.stopReason}), and left nothing behind.`};let Q=J.stopReason==="completed",P=await E(G.workspace,G.testCommand);if(!(Q&&j.defaultOutput!=="suggestion"&&(P.passed||!P.ran)))return{mode:"suggestions",changedFiles:K,verified:P.passed,comment:X(j,K,P,J.stopReason)};let V=O(z,j.name);try{await I.createBranch(V,z.head),await I.commitChanges(V,`chore: ${j.description.toLowerCase()} for #${z.number}`,await x(G.workspace,K),z.head);let U=await I.createPullRequest({title:`${j.description} for #${z.number}`,body:y(j,z,K,P),head:V,base:z.head,labels:["buddy","finishing-touch"]});return{mode:"stacked-pr",pullRequest:U,changedFiles:K,verified:P.passed,comment:`**${j.description}** \u2014 opened [#${U.number}](${U.url}) targeting this branch.`+(P.ran?"":" No test script was found, so this is unverified.")}}catch(U){return H.warn(`\u26A0\uFE0F Could not open a stacked pull request: ${U}`),{mode:"suggestions",changedFiles:K,verified:P.passed,comment:X(j,K,P,J.stopReason)}}}async function _(G){let H=Bun.spawn(["git","status","--porcelain"],{cwd:G,stdout:"pipe",stderr:"ignore"}),[I,z]=await Promise.all([new Response(H.stdout).text(),H.exited]);if(z!==0)return[];let j=[];for(let J of I.split(`
|
|
4
4
|
`)){if(!J.trim())continue;let K=J.slice(0,2),Q=J.slice(3).trim();if(K.includes("D"))continue;j.push(Q.includes(" -> ")?Q.split(" -> ")[1]:Q)}return j}async function x(G,H){let I=[];for(let z of H){let j=Bun.file(`${G}/${z}`);if(await j.exists())I.push({path:z,content:await j.text(),type:"update"})}return I}function y(G,H,I,z){return[`${G.description}, requested on #${H.number}.`,"",`This targets \`${H.head}\` rather than \`${H.base}\`, so merging it`,"adds these changes to that pull request.","",z.ran?z.passed?"\u2705 The repository's tests pass with these changes.":"\u26A0\uFE0F The repository's tests do **not** pass with these changes.":"\u2139\uFE0F No test script was found, so these changes are unverified.","","### Files changed","",...I.map((j)=>`- \`${j}\``)].join(`
|
|
5
5
|
`)}function X(G,H,I,z){let j=[`**${G.description}**`,""];if(z&&z!=="completed")j.push(`The agent stopped before finishing (${z}), so what follows is`,"partial work rather than a complete change.","");if(I.ran&&!I.passed)j.push("The repository's tests do not pass with these changes, so no branch was","opened. Treat what follows as a starting point rather than a result.","");if(j.push("Files that would change:","",...H.map((J)=>`- \`${J}\``)),I.output)j.push("","<details><summary>Test output</summary>","","```",I.output,"```","","</details>");return j.join(`
|
|
6
6
|
`)}
|
|
7
|
-
export{$ as
|
|
7
|
+
export{$ as Ra,E as Sa,O as Ta,N as Ua,_ as Va};
|
|
@@ -5,4 +5,4 @@ function J(L,q){if(!L.trim())return[];let D=L.toLowerCase(),Q=[];for(let B of q)
|
|
|
5
5
|
|---|---|---|---|
|
|
6
6
|
`;for(let Q of q){let B=[];if(Q.vulnerable)B.push("\u26A0\uFE0F known advisory");if(Q.deprecated)B.push("\uD83D\uDEAB deprecated");if(Q.openPRs?.length)B.push(`open PR ${Q.openPRs.map((F)=>`#${F}`).join(", ")}`);D+=`| \`${Q.name}\` | ${Q.declaredVersion??"\u2014"} | ${Q.latestVersion??"\u2014"} | ${B.join(", ")||"\u2014"} |
|
|
7
7
|
`}return D}function Z(L,q){let D=new Map(q.map((F)=>[F.toLowerCase(),F])),Q=[],B=[];for(let F of L){let G=D.get(F.trim().toLowerCase());if(G&&!Q.includes(G))Q.push(G);else if(!G)B.push(F)}return{apply:Q,rejected:B}}function X(L,q){let D=V(L),Q=V(q);if(D.size===0||Q.size===0)return 0;let B=0;for(let F of D)if(Q.has(F))B++;return B/Math.min(D.size,Q.size)}function $(L,q,D=0.6){return q.map((Q)=>({number:Q.number,score:X(L,Q.text)})).filter((Q)=>Q.score>=D).sort((Q,B)=>B.score-Q.score)}var A=new Set(["the","a","an","is","are","was","were","to","of","in","on","for","and","or","but","with","this","that","it","be","has","have","not","when","then","i","we","you","my","our"]);function V(L){return new Set(L.toLowerCase().split(/[^\w.-]+/).filter((q)=>q.length>2&&!A.has(q)))}function H(L){return L.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Y="<!-- buddy:quick-links -->",S=[{id:"plan",label:"Make a plan",description:"Read the issue and the relevant code, then post an implementation plan. Changes nothing."},{id:"build",label:"Build this",description:"Open a draft pull request implementing the issue."}],U=/- \[x\]\s*<!--\s*quick-action=([\w-]+)\s*-->/gi;function j(L){if(!L)return{actions:[]};let q=[];for(let D of L.matchAll(U)){let Q=D[1].trim();if(S.some((B)=>B.id===Q)&&!q.includes(Q))q.push(Q)}return{actions:q}}function v(L){return L.replace(/- \[x\](\s*<!--\s*quick-action=[\w-]+\s*-->)/gi,"- [ ]$1")}function w(L={}){let q=[Y,"","### Buddy","","Tick a box to have Buddy pick this up:",""];for(let Q of S)q.push(`- [ ] <!-- quick-action=${Q.id} -->**${Q.label}** \u2014 ${Q.description}`);let D=L.packages?.length&&L.body?J(L.body,L.packages.map((Q)=>Q.name)):[];if(D.length>0){let Q=L.packages.filter((B)=>D.includes(B.name));q.push("",M(Q))}return q.join(`
|
|
8
|
-
`)}export{J as
|
|
8
|
+
`)}export{J as ga,M as ha,Z as ia,X as ja,$ as ka,Y as la,S as ma,j as na,v as oa,w as pa};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Eb as a,Fb as b,Gb as c}from"./chunk-q2tjkhez.js";import"./chunk-
|
|
2
|
+
import{Eb as a,Fb as b,Gb as c}from"./chunk-q2tjkhez.js";import"./chunk-dh8yykbg.js";export{b as renderDiffForReview,a as parseUnifiedDiff,c as collectGitDiff};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{F as
|
|
2
|
+
import{Wh as K}from"./chunk-rrm4x81p.js";import{ll as N}from"./chunk-dh8yykbg.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 ue,S as ve,w as we,U as xe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-dh8yykbg.js";function f(i){return JSON.stringify({ok:!i.failed,summary:{workflows:i.workflows.length,findings:i.findings.length,errors:i.findings.filter((n)=>n.severity==="error").length,warnings:i.findings.filter((n)=>n.severity==="warning").length,info:i.findings.filter((n)=>n.severity==="info").length},findings:i.findings},null,2)}export{f as formatJson};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{L as
|
|
2
|
+
import{pd as Z}from"./chunk-z906zp4k.js";import{Uh as _}from"./chunk-rrm4x81p.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
|
+
export{L as Xa};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{db as a,eb as b,fb as c,gb as d,hb as e,ib as f,jb as g,kb as h,lb as i,mb as j}from"./chunk-z0avay86.js";import"./chunk-g763t4rr.js";import"./chunk-dev3g0n3.js";import"./chunk-rwzt9xvk.js";import"./chunk-xntpzagn.js";import"./chunk-20sxtyt7.js";import"./chunk-sg7bhtb7.js";import"./chunk-rrm4x81p.js";import"./chunk-dh8yykbg.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Wh as O}from"./chunk-rrm4x81p.js";import{Lj as A}from"./chunk-dkgz8hsd.js";import{ll as x}from"./chunk-dh8yykbg.js";function T(z){let G=z.split("/").pop()||"";if(["deps.yaml","dependencies.yaml","pkgx.yaml",".deps.yaml"].includes(G))return!0;let j=G.replace(/\.(yaml|yml)$/,"");return["deps","dependencies","pkgx",".deps"].includes(j)}async function V(z,G){try{if(!T(z))return null;let J=[];try{let H=await A(z);if(H&&typeof H==="object"){if(H.allDependencies&&Array.isArray(H.allDependencies)){for(let K of H.allDependencies)if(K.name&&K.constraint)J.push({name:K.name,currentVersion:K.constraint,type:"dependencies",file:z})}}}catch(H){O().warn(`ts-pantry failed to parse ${z}, attempting fallback YAML parsing:`,H)}if(J.length===0)try{J=await B(G,z)}catch(H){O().warn(`Fallback YAML parsing failed for ${z}:`,H),J=[]}let j=z.split("/").pop()||"";return{path:z,type:j,content:G,dependencies:J}}catch(J){return O().warn(`Failed to parse dependency file ${z}:`,J),null}}async function B(z,G){let J=[],j=z.split(`
|
|
3
3
|
`),H=!1;for(let K of j){let Q=K.trim();if(Q==="dependencies:"){H=!0;continue}if(H){if(Q&&!K.startsWith(" ")&&!K.startsWith("\t")){H=!1;continue}let X=Q.match(/^([\w@/-]+):\s*(.+)$/);if(X){let[,Z,$]=X;J.push({name:Z.trim(),currentVersion:$.trim(),type:"dependencies",file:G})}}}return J}function b(z){try{return Bun.YAML.parse(z),!0}catch{return!1}}async function S(z,G,J){try{if(!T(z))return O().info(`\u26A0\uFE0F updateDependencyFile: ${z} is not a dependency file, returning original content`),G;if(G.trim().startsWith("{")&&G.includes('"require"'))return O().info(`\u26A0\uFE0F updateDependencyFile: Content appears to be JSON (composer.json), but file is ${z}`),O().info(`Content preview: ${G.substring(0,200)}`),G;let j=G;for(let H of J){let K=H.name.replace(/\s*\(dev\)$/,"").replace(/\s*\(peer\)$/,"").replace(/\s*\(optional\)$/,""),Q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`^([ \\t]*)("${Q}"|'${Q}'|${Q})([ \\t]*:[ \\t]*)(["']?)([^\\s#"']+)\\4([ \\t]*#[^\\r\\n]*)?`,"gm");j=j.replace(X,(Z,$,w,E,W,_,R)=>{if(["latest","*","main","master","develop","dev"].includes(_.toLowerCase().trim()))return O().info(`\u26A0\uFE0F Skipping update for ${K} - version "${_}" should be respected`),Z;if(U(_))return Z;let Y=_.match(/^(\D*)/)?.[1]??"",q=/^[\^~>=<]/.test(H.newVersion)?H.newVersion:`${Y}${H.newVersion}`;return`${$}${w}${E}${W}${q}${W}${R??""}`})}if(j!==G&&b(G)&&!b(j))return O().warn(`\u26A0\uFE0F Skipping updates for ${z}: the rewrite no longer parses as YAML, so the file is left unchanged`),G;return j}catch(j){return O().warn(`Failed to update dependency file ${z}:`,j),G}}async function v(z){let G=[],J=new Map;for(let j of z)if(T(j.file)){if(!J.has(j.file))J.set(j.file,[]);J.get(j.file).push(j)}for(let[j,H]of J)try{let K=await import("fs");if(K.existsSync(j)){let Q=K.readFileSync(j,"utf-8"),X=await S(j,Q,H);if(X!==Q)G.push({path:j,content:X,type:"update"}),O().info(`\u2705 Generated update for ${j} with ${H.length} package changes`);else O().info(`\u2139\uFE0F No changes needed for ${j} - versions already up to date`)}else O().warn(`\u26A0\uFE0F Dependency file ${j} does not exist`)}catch(K){O().warn(`Failed to generate updates for dependency file ${j}:`,K)}return G}function U(z){return/^(?:workspace|file|link|portal|git|github|gitlab|bitbucket|https?|git\+[a-z]+):/i.test(z.trim())}
|
|
4
|
-
export{T as
|
|
4
|
+
export{T as Bg,V as Cg,S as Dg,v as Eg,U as Fg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Aa as k,Ba as l,Ca as m,qa as a,ra as b,sa as c,ta as d,ua as e,va as f,wa as g,xa as h,ya as i,za as j}from"./chunk-6kmaj5br.js";import"./chunk-rrm4x81p.js";import"./chunk-dh8yykbg.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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Tf as D}from"./chunk-rwzt9xvk.js";import{Wh as C}from"./chunk-rrm4x81p.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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ug as C,zg as B}from"./chunk-vxt1h0c4.js";import{Bg as v,Cg as x}from"./chunk-fcax5a60.js";import{Ch as w}from"./chunk-r0jmwzr3.js";import{Qh as S}from"./chunk-sg7bhtb7.js";import{ll as T}from"./chunk-dh8yykbg.js";var R={critical:"\uD83D\uDD34 Critical",high:"\uD83D\uDFE0 High",moderate:"\uD83D\uDFE1 Moderate",low:"\u26AA Low"};function F(J){let Q=J.filter((O)=>(O.securityAdvisories?.length??0)>0);if(Q.length===0)return"";let q=Q.reduce((O,Z)=>O+(Z.securityAdvisories?.length??0),0),X=`## \uD83D\uDD12 Security Advisories
|
|
3
3
|
|
|
4
4
|
`;X+=`This PR resolves ${q} known ${q===1?"vulnerability":"vulnerabilities"} `,X+=`across ${Q.length} ${Q.length===1?"package":"packages"}.
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import{tg as C,yg as B}from"./chunk-x9vpk4kk.js";import{Ag as v,Bg as x}from"./c
|
|
|
7
7
|
`,X+=`|---|---|---|---|---|
|
|
8
8
|
`;for(let O of Q)for(let Z of O.securityAdvisories??[]){let L=R[Z.severity]??Z.severity,_=Z.url?`[${Z.id}](${Z.url})`:Z.id,$=Z.aliases.length>0?` (${Z.aliases.join(", ")})`:"",G=Z.summary.replace(/\|/g,"\\|").replace(/\s*\n\s*/g," ").trim();X+=`| \`${O.name}\` | ${L} | ${_}${$} | \`${Z.fixedVersion??"n/a"}\` | ${G} |
|
|
9
9
|
`}return`${X}
|
|
10
|
-
`}async function u(J,Q){try{let q=Q.split("/").pop()||"";if(q==="package.json"){let X=JSON.parse(J),O=[];return W(X.dependencies,"dependencies",Q,O),W(X.devDependencies,"devDependencies",Q,O),W(X.peerDependencies,"peerDependencies",Q,O),W(X.optionalDependencies,"optionalDependencies",Q,O),{path:Q,type:"package.json",content:J,dependencies:O}}if(v(Q))return await x(Q,J);if(q==="composer.json"||q==="composer.lock"){let{parseComposerFile:X}=await import("./chunk-
|
|
10
|
+
`}async function u(J,Q){try{let q=Q.split("/").pop()||"";if(q==="package.json"){let X=JSON.parse(J),O=[];return W(X.dependencies,"dependencies",Q,O),W(X.devDependencies,"devDependencies",Q,O),W(X.peerDependencies,"peerDependencies",Q,O),W(X.optionalDependencies,"optionalDependencies",Q,O),{path:Q,type:"package.json",content:J,dependencies:O}}if(v(Q))return await x(Q,J);if(q==="composer.json"||q==="composer.lock"){let{parseComposerFile:X}=await import("./chunk-ebb90mp9.js");return await X(Q,J)}return null}catch{return null}}function W(J,Q,q,X){if(!J)return;for(let[O,Z]of Object.entries(J))X.push({name:O,currentVersion:Z,type:Q,file:q})}function n(J){let{existsSync:Q}=T("fs"),{join:q}=T("path");if(Q(q(J,"bun.lockb"))||Q(q(J,"bun.lock")))return"bun";if(Q(q(J,"pnpm-lock.yaml")))return"pnpm";if(Q(q(J,"yarn.lock")))return"yarn";if(Q(q(J,"package-lock.json")))return"npm";return"bun"}function d(J,Q){if(Q)return Q;if(J.length===1){let Z=J[0];return`chore(deps): update dependency ${Z.name} to ${Z.newVersion}`}let q=J.filter((Z)=>Z.updateType==="major"),X=J.filter((Z)=>Z.updateType==="minor"),O=J.filter((Z)=>Z.updateType==="patch");if(q.length>0)return`chore(deps): update ${q.length} major dependencies`;else if(X.length>0)return`chore(deps): update ${X.length} minor dependencies`;else return`chore(deps): update ${O.length} patch dependencies`}function o(J,Q){if(Q)return Q;if(J.length===1){let X=J[0];return`chore(deps): update dependency ${X.name} to v${X.newVersion}`}let q=J.filter((X)=>X.updateType==="major");if(q.length>0)return`chore(deps): update ${q.length} major dependencies`;else return"chore(deps): update all non-major dependencies"}function z(J,Q){if(Q)return Q;let q=`This PR contains the following updates:
|
|
11
11
|
|
|
12
12
|
`;q+=F(J),q+=`| Package | Change | Age | Adoption | Passing | Confidence |
|
|
13
13
|
`,q+=`|---|---|---|---|---|---|
|
|
@@ -41,4 +41,4 @@ import{tg as C,yg as B}from"./chunk-x9vpk4kk.js";import{Ag as v,Bg as x}from"./c
|
|
|
41
41
|
`,q+=`---
|
|
42
42
|
|
|
43
43
|
`,q+="This PR was generated by [Buddy](https://github.com/stacksjs/buddy).",q}function i(J,Q="buddy"){if(J.length===1){let X=J[0],O=X.name.replace(/[^a-z0-9-]/gi,"-");return`${Q}/update-${O}-to-${X.newVersion}`}if(J.filter((X)=>X.updateType==="major").length>0)return`${Q}/update-major-dependencies`;return`${Q}/update-dependencies`}function j(J){let Q=new Map;for(let X of J){let O=`${X.name}:${X.currentVersion}:${X.newVersion}`;Q.set(O,[...Q.get(O)??[],X])}let q=[];for(let X of Q.values()){let O=X.filter((L)=>k(L.file));if(O.length>0){let L=new Set;for(let _ of O)if(!L.has(_.file))L.add(_.file),q.push(_);continue}let Z=X[0];for(let L of X.slice(1))if(N(L.file)>N(Z.file))Z=L;q.push(Z)}return q}function k(J){let Q=J.split("/").pop()??"";return Q==="package.json"||Q==="composer.json"}function N(J){if(J==="package.json")return 3;if(J.endsWith("composer.json"))return 2;if(J.includes(".github/workflows/"))return 1;return 0}function s(J,Q={}){let{prioritizeSecurity:q=!0}=Q,X=[],O=j(J),Z=q?O.filter((Y)=>(Y.securityAdvisories?.length??0)>0):[],L=q?O.filter((Y)=>(Y.securityAdvisories?.length??0)===0):O;if(Z.length>0)X.push({name:"Security Updates",updates:Z,updateType:D(Z),title:"fix(deps): update vulnerable dependencies",body:z(Z)});let _=L.filter((Y)=>Y.dependencyType==="github-actions"),$=L.filter((Y)=>Y.dependencyType==="docker-image"),G=L.filter((Y)=>Y.dependencyType!=="github-actions"&&Y.dependencyType!=="docker-image");if(_.length>0)X.push({name:"GitHub Actions",updates:_,updateType:D(_),title:"chore(deps): update github actions",body:z(_)});if($.length>0)X.push({name:"Docker Images",updates:$,updateType:D($),title:"chore(deps): update docker images",body:z($)});let H=G.filter((Y)=>Y.updateType==="major"),K=G.filter((Y)=>Y.updateType==="minor"),I=G.filter((Y)=>Y.updateType==="patch");if(K.length>0||I.length>0){let Y=[...K,...I];X.push({name:"Non-Major Updates",updates:Y,updateType:K.length>0?"minor":"patch",title:"chore(deps): update all non-major dependencies",body:z(Y)})}let A=new Map;for(let Y of H){let E=`${Y.name}@${Y.newVersion}`;A.set(E,[...A.get(E)??[],Y])}for(let Y of A.values()){let E=Y[0];X.push({name:`Major Update - ${E.name}`,updates:Y,updateType:"major",title:`chore(deps): update dependency ${E.name} to ${E.newVersion}`,body:z(Y)})}return X}function D(J){if(J.some((Q)=>Q.updateType==="major"))return"major";if(J.some((Q)=>Q.updateType==="minor"))return"minor";return"patch"}var U={critical:4,high:3,moderate:2,low:1};function V(J){let Q=0;for(let q of J.securityAdvisories??[])Q=Math.max(Q,U[q.severity]??0);return Q}function r(J,Q={}){let{prioritizeSecurity:q=!0}=Q,X={major:3,minor:2,patch:1};return J.sort((O,Z)=>{let L=q?V(O):0,_=q?V(Z):0;if(L!==_)return _-L;let $=X[O.updateType],G=X[Z.updateType];if($!==G)return G-$;return O.name.localeCompare(Z.name)})}function p(J,Q){let q=M(J.replace(/^[v^~>=<@]+/,"")),X=M(Q.replace(/^[v^~>=<@]+/,""));try{if(Bun.semver.order(X,q)<=0)return"patch"}catch{return"patch"}let O=q.split(".").map((H)=>Number.parseInt(H,10)),Z=X.split(".").map((H)=>Number.parseInt(H,10));while(O.length<3)O.push(0);while(Z.length<3)Z.push(0);let[L,_]=O,[$,G]=Z;if($>L)return"major";if($===L&&G>_)return"minor";return"patch"}function M(J){let Q=J.split(".");if(Q.length>=3||!Q.every((q)=>/^\d+$/.test(q)))return J;while(Q.length<3)Q.push("0");return Q.join(".")}function a(J,Q){try{return Bun.semver.satisfies(J,Q)}catch{return!1}}async function t(J,Q,q){if(!J)throw Error("GitHub token is required");try{let X=await S(`${w()}/repos/${Q}/${q}/pulls?state=open`,{headers:{Authorization:`Bearer ${J}`,Accept:"application/vnd.github+json","User-Agent":"buddy"}});if(!X.ok)throw Error(`GitHub API error: ${X.status} ${X.statusText}`);return(await X.json()).filter((L)=>{if(!L.body)return!1;return/\s*-\s*\[x\]\s*<!--\s*rebase-check\s*-->.*(?:rebase|update)\/retry/i.test(L.body)}).map((L)=>({number:L.number,branchName:L.head.ref}))}catch(X){throw Error(`Failed to check for rebase requests: ${X}`)}}function e(J){let Q=C(J);if(Q)return[...new Set(Q.updates.map((O)=>O.name))];let q=[],X=J.match(/\|[^|]*\|[^|]*\|[^|]*\|[^|]*\|/g);if(X)for(let O of X){let Z=O.match(/\[([^\]]+)\]\([^)]*\)/);if(Z)q.push(Z[1])}return q}async function qq(J,Q,q){if(await b(J,Q,q))return!0;if(await m(J,Q,q))return!0;return!1}async function b(J,Q,q){if(!(Q.packages?.respectLatest??!0))return q.debug(`\uD83D\uDD0D PR #${J.number}: respectLatest is false, skipping auto-close`),!1;let O=["latest","*","main","master","develop","dev"],Z=C(J.body);if(Z){let H=Z.updates.filter((K)=>O.includes(K.current.toLowerCase().trim()));for(let K of H)q.debug(`\uD83D\uDD0D PR #${J.number}: Package ${K.name} has dynamic version "${K.current}"`);return q.debug(`\uD83D\uDD0D PR #${J.number}: Should auto-close: ${H.length>0}`),H.length>0}let L=/\|\s*\[([^\]]+)\][^|]*\|\s*\[?`?[v^~>=]*([^`|\s]+)`?\s*(?:->|\u2192)\s*`?[v^~>=]*([^`|\s]+)`?\]?/g,_,$=[];while((_=L.exec(J.body))!==null){let[,H,K]=_,I=K.toLowerCase().trim();if(O.includes(I))$.push(H),q.debug(`\uD83D\uDD0D PR #${J.number}: Package ${H} has dynamic version "${I}"`)}let G=$.length>0;return q.debug(`\uD83D\uDD0D PR #${J.number}: Packages with dynamic versions: ${$.join(", ")}`),q.debug(`\uD83D\uDD0D PR #${J.number}: Should auto-close: ${G}`),G}async function m(J,Q,q){let X=Q.packages?.ignorePaths;if(!X||X.length===0)return q.debug(`\uD83D\uDD0D PR #${J.number}: No ignorePaths configured, skipping auto-close`),!1;let O=P(J.body);if(O.length===0)return q.debug(`\uD83D\uDD0D PR #${J.number}: No file paths found in PR body`),!1;q.debug(`\uD83D\uDD0D PR #${J.number}: Found file paths: ${O.join(", ")}`);let{Glob:Z}=globalThis.Bun,L=O.filter((_)=>{let $=_.replace(/^\.\//,"");return X.some((G)=>{try{return new Z(G).match($)}catch(H){return q.debug(`Failed to match path ${$} against pattern ${G}: ${H}`),!1}})});if(L.length>0)return q.debug(`\uD83D\uDD0D PR #${J.number}: Contains files now in ignorePaths: ${L.join(", ")}`),!0;return q.debug(`\uD83D\uDD0D PR #${J.number}: No files match ignorePaths patterns`),!1}function P(J){let Q=C(J);if(Q)return B(Q);let q=[],X=/\|\s*\[[^\]]+\]\([^)]*\)\s*\|[^|]*\|\s*\*\*([^*]+)\*\*\s*\|/g,O;while((O=X.exec(J))!==null){let $=O[1].trim();if($&&!q.includes($))q.push($)}let Z=/\*\*([^*]+\.(?:json|yaml|yml|lock))\*\*/g;while((O=Z.exec(J))!==null){let $=O[1].trim();if($&&!q.includes($))q.push($)}let L=/\|[^|]+\|[^|]+\|([^|]+)\|[^|]*\|/g;while((O=L.exec(J))!==null){let $=O[1].trim();if($&&($.includes("/")||/\.(?:json|yaml|yml|lock)$/.test($))&&!q.includes($))q.push($)}let _=/(?:^|\s)([\w-]+(?:\/[\w.-]+)*\/[\w.-]+\.(?:json|yaml|yml|lock))(?:\s|$)/gm;while((O=_.exec(J))!==null){let $=O[1].trim();if($&&!q.includes($))q.push($)}return q}
|
|
44
|
-
export{F as
|
|
44
|
+
export{F as cg,u as dg,n as eg,d as fg,o as gg,z as hg,i as ig,s as jg,r as kg,p as lg,a as mg,t as ng,e as og,qq as pg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$ as n,O as a,P as b,Q as c,R as d,S as e,T as f,U as g,V as h,W as i,X as j,Y as k,Z as l,_ as m}from"./chunk-qfm0eh6y.js";import"./chunk-8y4szfd2.js";import"./chunk-rrm4x81p.js";import"./chunk-dh8yykbg.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};
|