@buddysh/buddy 0.11.15 → 0.11.17
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 +29 -0
- package/dist/bin/cli.js +19 -19
- package/dist/{chunk-mg67hhgj.js → chunk-0kce7e60.js} +1 -1
- package/dist/chunk-0n03s02h.js +2 -0
- package/dist/{chunk-s82adeq9.js → chunk-16aeend1.js} +1 -1
- package/dist/{chunk-qcvtp2mt.js → chunk-1a14rx5n.js} +1 -1
- package/dist/{chunk-sztjfky1.js → chunk-1g43mpqn.js} +1 -1
- package/dist/{chunk-eccac8h7.js → chunk-1jgh0ff1.js} +1 -1
- package/dist/chunk-1k4p8wyx.js +2 -0
- package/dist/{chunk-m00hfvnp.js → chunk-1mkwhnsf.js} +1 -1
- package/dist/{chunk-6prz7chv.js → chunk-1pdvjg0x.js} +1 -1
- package/dist/chunk-2309x9r7.js +2 -0
- package/dist/{chunk-jkn2sdm0.js → chunk-26yejy1v.js} +1 -1
- package/dist/{chunk-dkhherd0.js → chunk-2f7j0dmw.js} +1 -1
- package/dist/{chunk-drmk6r1m.js → chunk-2z9mh5y4.js} +1 -1
- package/dist/chunk-3jm67wxm.js +2 -0
- package/dist/chunk-3mnpvfg3.js +2 -0
- package/dist/chunk-485kgdtb.js +2 -0
- package/dist/{chunk-nn5rzwty.js → chunk-4chtv4nh.js} +1 -1
- package/dist/{chunk-7b156stw.js → chunk-4dz5x4xw.js} +1 -1
- package/dist/{chunk-01d81hn0.js → chunk-4r03rh93.js} +1 -1
- package/dist/{chunk-3a63hke8.js → chunk-4wv5s3vr.js} +1 -1
- package/dist/{chunk-a6hv92fx.js → chunk-51m5tgwp.js} +1 -1
- package/dist/chunk-5t07s3dv.js +2 -0
- package/dist/{chunk-ymh0kwm4.js → chunk-67bjaw56.js} +2 -2
- package/dist/{chunk-9kscva05.js → chunk-6b0fmw0d.js} +1 -1
- package/dist/chunk-6bqs7rtc.js +2 -0
- package/dist/{chunk-ebnc6980.js → chunk-6gvx1g6h.js} +1 -1
- package/dist/{chunk-c4cj24qm.js → chunk-6kd81nf9.js} +2 -2
- package/dist/{chunk-j6geg3qt.js → chunk-6w0n6c07.js} +1 -1
- package/dist/{chunk-y1d6e0ye.js → chunk-743mhx0e.js} +1 -1
- package/dist/{chunk-eh71jv8w.js → chunk-7hm46cej.js} +1 -1
- package/dist/{chunk-t879n4ab.js → chunk-7p1b809h.js} +1 -1
- package/dist/chunk-8b7cwedf.js +2 -0
- package/dist/{chunk-dg2q6egm.js → chunk-8r2819xn.js} +1 -1
- package/dist/{chunk-4qv88x27.js → chunk-8wrbxhs3.js} +1 -1
- package/dist/{chunk-s5czyzje.js → chunk-9chq5m4p.js} +3 -3
- package/dist/chunk-9fagkyrp.js +2 -0
- package/dist/{chunk-kjhqe26r.js → chunk-9gabxm8n.js} +1 -1
- package/dist/{chunk-c9266b5x.js → chunk-a8wcn3mh.js} +1 -1
- package/dist/{chunk-zjp519wm.js → chunk-bafzw99p.js} +1 -1
- package/dist/{chunk-gcwg4b2w.js → chunk-bgb44971.js} +1 -1
- package/dist/{chunk-4fh7w98z.js → chunk-bw43q8k7.js} +1 -1
- package/dist/{chunk-v808b36p.js → chunk-byqzhgzs.js} +1 -1
- package/dist/chunk-bz5yx7g6.js +2 -0
- package/dist/{chunk-zy49dwqk.js → chunk-c63e4ssc.js} +2 -2
- package/dist/{chunk-xn2960z7.js → chunk-cb25v2mp.js} +1 -1
- package/dist/{chunk-ma01xp3y.js → chunk-d09qj570.js} +1 -1
- package/dist/chunk-dttp44vs.js +2 -0
- package/dist/{chunk-1znpbjrv.js → chunk-dxd0eg4r.js} +1 -1
- package/dist/{chunk-6np84pfr.js → chunk-ewhvahnb.js} +1 -1
- package/dist/{chunk-2z85fqdp.js → chunk-fsghqtgf.js} +2 -2
- package/dist/chunk-fzs7vpps.js +2 -0
- package/dist/{chunk-zpgm9yzy.js → chunk-g09atq0m.js} +1 -1
- package/dist/{chunk-k907b533.js → chunk-gg1ddvnf.js} +1 -1
- package/dist/chunk-gkb0gja4.js +2 -0
- package/dist/{chunk-rwz433q2.js → chunk-gq9gkyah.js} +2 -2
- package/dist/{chunk-92gh2n65.js → chunk-gvpsbmeg.js} +1 -1
- package/dist/{chunk-wf1jcxtr.js → chunk-h2f92qwd.js} +1 -1
- package/dist/{chunk-66nntsnf.js → chunk-hd74jxm2.js} +1 -1
- package/dist/{chunk-p16pnhj3.js → chunk-her5azyp.js} +1 -1
- package/dist/{chunk-4kyxrwxn.js → chunk-hk4d7rky.js} +1 -1
- package/dist/chunk-hxkxset4.js +2 -0
- package/dist/{chunk-9n1kth4b.js → chunk-j57716xw.js} +1 -1
- package/dist/chunk-jgq5d6s2.js +2 -0
- package/dist/chunk-k8sd78td.js +2 -0
- package/dist/{chunk-awjm9n45.js → chunk-km4aszfp.js} +1 -1
- package/dist/chunk-kthwzc4p.js +2 -0
- package/dist/{chunk-028354j6.js → chunk-m3rftash.js} +7 -7
- package/dist/{chunk-bstgsak0.js → chunk-m9qtb4xj.js} +1 -1
- package/dist/{chunk-2b07w74s.js → chunk-mr2d1zp0.js} +1 -1
- package/dist/{chunk-xyzcgskb.js → chunk-mthd2c8m.js} +1 -1
- package/dist/{chunk-w2ccdet4.js → chunk-mtn4angk.js} +1 -1
- package/dist/{chunk-37zd94a7.js → chunk-nk8wxxy7.js} +2 -2
- package/dist/{chunk-cx89kty3.js → chunk-nznpzbq4.js} +1 -1
- package/dist/{chunk-hc2pdv4j.js → chunk-p9xksx9p.js} +1 -1
- package/dist/{chunk-ym9475ry.js → chunk-pag93kz1.js} +1 -1
- package/dist/{chunk-bgw39afd.js → chunk-psjrcpgb.js} +1 -1
- package/dist/{chunk-q99xd3m5.js → chunk-pxfrq43h.js} +1 -1
- package/dist/chunk-q4j2f72t.js +2 -0
- package/dist/{chunk-fgec04jx.js → chunk-qbep9dk4.js} +1 -1
- package/dist/{chunk-j7qktvpg.js → chunk-qngnmrpw.js} +1 -1
- package/dist/chunk-r1jvyhhd.js +4 -0
- package/dist/{chunk-p2h2z6d3.js → chunk-r7qa2ykf.js} +2 -2
- package/dist/chunk-rqj1vrfs.js +2 -0
- package/dist/{chunk-34vracy4.js → chunk-s0ps33ft.js} +1 -1
- package/dist/{chunk-qjzpzd7j.js → chunk-s3b3vrsj.js} +1 -1
- package/dist/chunk-s4fccg73.js +2 -0
- package/dist/{chunk-zrec546r.js → chunk-sddaassq.js} +1 -1
- package/dist/{chunk-6qw89f68.js → chunk-sj7n6xa1.js} +1 -1
- package/dist/{chunk-t5hq4ke1.js → chunk-t1r2ycn7.js} +1 -1
- package/dist/{chunk-1tdkpeva.js → chunk-tjj6ttj1.js} +1 -1
- package/dist/{chunk-dq681xgx.js → chunk-tsd9jw07.js} +1 -1
- package/dist/{chunk-s609kp6h.js → chunk-ttkjzy0m.js} +1 -1
- package/dist/chunk-txe5z472.js +2 -0
- package/dist/chunk-vffz69jj.js +2 -0
- package/dist/{chunk-sn0qr6q7.js → chunk-vs61069x.js} +1 -1
- package/dist/{chunk-3a5gcj3y.js → chunk-wc2z7krw.js} +1 -1
- package/dist/{chunk-jn3t9v6d.js → chunk-wfg3bp85.js} +1 -1
- package/dist/{chunk-5sh69bkj.js → chunk-wfwrm4k3.js} +1 -1
- package/dist/{chunk-3nn2j810.js → chunk-whtdmv3p.js} +1 -1
- package/dist/{chunk-gjhxc6ma.js → chunk-wk175yyw.js} +1 -1
- package/dist/chunk-wn9vr9ct.js +2 -0
- package/dist/{chunk-zwtx6vn3.js → chunk-wzncz6j5.js} +1 -1
- package/dist/{chunk-m8brd9b5.js → chunk-y2ntnpdb.js} +1 -1
- package/dist/{chunk-xhn5331s.js → chunk-y5fdq7cd.js} +1 -1
- package/dist/{chunk-7t8s2mcf.js → chunk-yh13j2af.js} +1 -1
- package/dist/chunk-yr6qyeab.js +2 -0
- package/dist/{chunk-q9mxgp0n.js → chunk-z2gcfvze.js} +11 -11
- package/dist/chunk-zj2pt1bx.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/registry/registry-client.d.ts +1 -0
- package/dist/src/setup.js +1 -1
- package/dist/src/utils/dependency-file-parser.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunk-18en5afz.js +0 -2
- package/dist/chunk-2bp1j0w0.js +0 -2
- package/dist/chunk-3578axtf.js +0 -2
- package/dist/chunk-3r0jb90q.js +0 -2
- package/dist/chunk-4x1mv7qj.js +0 -2
- package/dist/chunk-5qberaya.js +0 -2
- package/dist/chunk-86xv8x00.js +0 -2
- package/dist/chunk-87k997bm.js +0 -2
- package/dist/chunk-8jvmqdvc.js +0 -2
- package/dist/chunk-94tnmc7j.js +0 -4
- package/dist/chunk-c8xfj0m5.js +0 -2
- package/dist/chunk-cj5fkyxv.js +0 -2
- package/dist/chunk-d3m5kcpp.js +0 -2
- package/dist/chunk-dg1c0fyk.js +0 -2
- package/dist/chunk-fzfgvt8s.js +0 -2
- package/dist/chunk-j21m6rf6.js +0 -2
- package/dist/chunk-jjwxbcfz.js +0 -2
- package/dist/chunk-n5mz7csc.js +0 -2
- package/dist/chunk-nd780ymh.js +0 -2
- package/dist/chunk-tmzd2p2n.js +0 -2
- package/dist/chunk-tqsrr90t.js +0 -2
- package/dist/chunk-v9avf6sc.js +0 -2
- package/dist/chunk-w2vsf1q0.js +0 -2
- package/dist/chunk-xjrb50hz.js +0 -2
- package/dist/chunk-y0rng1vc.js +0 -2
- package/dist/chunk-z0rsmhe4.js +0 -2
- package/dist/chunk-zcsahxe6.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ch as R,Dh as S,zh as G}from"./chunk-yh13j2af.js";import{Lh as x}from"./chunk-s0ps33ft.js";import{Rh as K}from"./chunk-wzncz6j5.js";var{semver:H}=globalThis.Bun;import F from"process";class P{userAgent="Buddy/1.0.0 (https://github.com/stacksjs/buddy)";logger;constructor(B){this.logger=B??K()}githubHeaders(){let B={"User-Agent":this.userAgent,Accept:"application/vnd.github.v3+json"},J=F.env.BUDDY_TOKEN||F.env.GITHUB_TOKEN||F.env.GH_TOKEN;if(J)B.Authorization=`Bearer ${J}`;return B}async fetchPackageInfo(B,J,Y){if(F.env.APP_ENV==="test"){let X={stripe:{owner:"stripe",repo:"stripe-node"},typescript:{owner:"microsoft",repo:"TypeScript"},react:{owner:"facebook",repo:"react"}}[B]||{owner:"example",repo:B};return{packageInfo:{name:B,description:`Package ${B} description`,repository:{type:"git",url:`https://github.com/${X.owner}/${X.repo}`}},releaseNotes:[],changelog:[],compareUrl:this.generateCompareUrl(X.owner,X.repo,J,Y)}}try{let q=await this.fetchNpmPackageInfo(B),X=[],Z=[],Q;if(q.repository?.url){let O=this.parseGitHubUrl(q.repository.url);if(O)X=await this.fetchGitHubReleases(O.owner,O.repo,J,Y),Q=this.generateCompareUrl(O.owner,O.repo,J,Y),Z=await this.fetchChangelog(O.owner,O.repo)}return{packageInfo:q,releaseNotes:X,changelog:Z,compareUrl:Q}}catch(q){return this.logger.error(`\u274C Failed to fetch package info for ${B}:`,q),{packageInfo:{name:B,description:`Package ${B} - see npm for details`,repository:{type:"git",url:`https://github.com/search?q=${encodeURIComponent(B)}&type=repositories`}},releaseNotes:[],changelog:[]}}}async fetchNpmPackageInfo(B){try{let J=R(B),Y=await x(`${J}/${encodeURIComponent(B).replace("%40","@")}`,{headers:{"User-Agent":this.userAgent}});if(!Y.ok)throw Error(`NPM registry responded with ${Y.status}`);let q=await Y.json(),X=q["dist-tags"]?.latest,Z;try{let L=await x(`https://api.npmjs.org/downloads/point/last-week/${encodeURIComponent(B)}`,{headers:{"User-Agent":this.userAgent}});if(L.ok)Z=(await L.json()).downloads}catch{}let Q=typeof q.repository==="string"?{type:"git",url:q.repository}:q.repository?.url?{type:q.repository.type??"git",url:q.repository.url}:void 0,O=q.author,_=typeof O==="string"?O:O&&typeof O==="object"&&("name"in O)&&typeof O.name==="string"?O:void 0,$=Array.isArray(q.maintainers)?q.maintainers.filter((L)=>!!L&&typeof L==="object"&&("name"in L)&&typeof L.name==="string"):void 0;return{name:B,description:q.description,homepage:q.homepage,repository:Q,license:q.license,author:_,keywords:q.keywords,weeklyDownloads:Z,lastPublish:X?q.time?.[X]:void 0,maintainers:$}}catch(J){return this.logger.warn(`\u26A0\uFE0F Failed to fetch npm info for ${B}:`,J),{name:B,description:`NPM package ${B}`,homepage:`https://www.npmjs.com/package/${encodeURIComponent(B)}`}}}async fetchSpanReleases(B,J,Y,q=5){let X=await this.fetchNpmPackageInfo(B).catch(()=>null),Z=X?.repository?.url?this.parseGitHubUrl(X.repository.url):null;if(!Z)return this.logger.debug(`No GitHub repository for ${B}; no span notes available`),[];let Q=[];for(let O=1;O<=q;O++){let _=await x(`${G()}/repos/${Z.owner}/${Z.repo}/releases?per_page=100&page=${O}`,{headers:this.githubHeaders()}).catch(()=>null);if(!_?.ok)break;let $=await _.json().catch(()=>null);if(!Array.isArray($)||$.length===0)break;for(let j of $)Q.push({version:j.tag_name,date:j.published_at,title:j.name??j.tag_name,body:j.body??"",htmlUrl:j.html_url,isPrerelease:j.prerelease});if($.some((j)=>this.isVersionBetween(j.tag_name.replace(/^v/,""),"0.0.0",J))||$.length<100)break}return Q.filter((O)=>this.isVersionBetween(O.version.replace(/^v/,""),J,Y))}parseGitHubUrl(B){try{let J=B.replace(/^git\+/,"").replace(/\.git$/,"").replace(/^git:\/\//,"https://").replace(/^ssh:\/\/git@/,"https://").replace(/^git@github\.com:/,"https://github.com/"),Y=new URL(J);if(Y.hostname!=="github.com")return null;let q=Y.pathname.split("/").filter(Boolean);if(q.length>=2)return{owner:q[0],repo:q[1]};return null}catch{return null}}async fetchGitHubReleases(B,J,Y,q){try{let X=await x(`${G()}/repos/${B}/${J}/releases?per_page=50`,{headers:this.githubHeaders()});if(!X.ok)return[];return(await X.json()).filter((Q)=>{let O=Q.tag_name.replace(/^v/,"");return this.isVersionBetween(O,Y,q)}).map((Q)=>({version:Q.tag_name,date:Q.published_at,title:Q.name??Q.tag_name,body:Q.body??"",htmlUrl:Q.html_url,compareUrl:this.generateCompareUrl(B,J,Y,Q.tag_name),author:Q.author?.login,isPrerelease:Q.prerelease,assets:Q.assets?.map((O)=>({name:O.name,downloadUrl:O.browser_download_url,size:O.size,contentType:O.content_type}))??[]}))}catch(X){return this.logger.warn(`Failed to fetch GitHub releases for ${B}/${J}:`,X),[]}}async fetchChangelog(B,J){let Y=["CHANGELOG.md","CHANGELOG.rst","HISTORY.md","RELEASES.md"];for(let q of Y)try{let X=await x(`${G()}/repos/${B}/${J}/contents/${q}`,{headers:this.githubHeaders()});if(X.ok){let Z=await X.json();if(Z.content){let Q=atob(Z.content);return this.parseChangelog(Q)}}}catch{}return[]}parseChangelog(B){let J=[],Y=B.split(`
|
|
3
3
|
`),q=null,X=null;for(let Z of Y){let Q=Z.match(/^##\s*\[?([^\]]+)\]?\s*-?\s*(.*)/);if(Q){if(q)J.push(q);q={version:Q[1],date:Q[2].trim(),changes:{}},X=null;continue}let O=Z.match(/^###\s*(.+)/);if(O&&q){X=O[1].toLowerCase();continue}let _=Z.match(/^[-*]\s*(.+)/);if(_&&q&&X){if(!q.changes)q.changes={};let $=X;if(!q.changes[$])q.changes[$]=[];q.changes[$].push(_[1])}}if(q)J.push(q);return J.slice(0,10)}generateCompareUrl(B,J,Y,q){let X=this.getComparableVersion(Y),Z=this.getComparableVersion(q);if(!X||!Z)return;return`https://github.com/${B}/${J}/compare/${encodeURIComponent(`v${X}`)}...${encodeURIComponent(`v${Z}`)}`}isVersionBetween(B,J,Y){let q=this.getComparableVersion(B),X=this.getComparableVersion(J),Z=this.getComparableVersion(Y);if(!q||!X||!Z)return!1;try{return H.order(q,X)>0&&H.order(q,Z)<=0}catch{return q>X&&q<=Z}}getComparableVersion(B){let J=B.split("||").flatMap((Y)=>{let q=Y.trim();if(q.startsWith("<"))return[];let X=q.match(/^(?:[~^]|>=?|=)?\s*v?(\d+(?:\.\d+){0,2}(?:-[0-9A-Z.-]+)?)/i);if(!X)return[];let[Z,Q]=X[1].split("-",2),O=Z.split(".");while(O.length<3)O.push("0");return[`${O.join(".")}${Q?`-${Q}`:""}`]});if(J.length===0)return null;return J.reduce((Y,q)=>{try{return H.order(q,Y)>0?q:Y}catch{return q>Y?q:Y}})}generatePackageBadges(B,J,Y){let q=encodeURIComponent(B.name),X=this.normalizeVersionForBadges(J),Z=this.normalizeVersionForBadges(Y),Q=encodeURIComponent(X),O=encodeURIComponent(Z);return{age:`[](https://docs.renovatebot.com/merge-confidence/)`,adoption:`[](https://docs.renovatebot.com/merge-confidence/)`,passing:`[](https://docs.renovatebot.com/merge-confidence/)`,confidence:`[](https://docs.renovatebot.com/merge-confidence/)`}}async fetchComposerPackageInfo(B){if(F.env.APP_ENV==="test")return{name:B,description:`PHP package ${B} description`,homepage:`https://packagist.org/packages/${B}`,repository:{type:"git",url:`https://github.com/example/${B}`},license:"MIT"};try{let J=await x(`${S()}/packages/${encodeURIComponent(B)}.json`,{headers:{"User-Agent":this.userAgent}});if(!J.ok)throw Error(`Packagist responded with ${J.status}`);let q=(await J.json()).package;if(!q?.versions)return{name:B};let X=Object.keys(q.versions),Z=X.find((L)=>!L.includes("dev")&&!L.includes("alpha")&&!L.includes("beta"))??X[0],Q=(Z?q.versions[Z]:void 0)??{},O=Array.isArray(Q.license)?Q.license[0]:Q.license,_=Q.authors?.[0],$=_&&typeof _==="object"&&"name"in _&&typeof _.name==="string"?_:void 0;return{name:q.name??B,description:Q.description,homepage:Q.homepage,repository:Q.source?.url?{type:"git",url:Q.source.url}:void 0,license:O,author:$,keywords:Q.keywords,lastPublish:Q.time}}catch(J){return this.logger.warn(`Failed to fetch Packagist info for ${B}:`,J),{name:B}}}generateComposerBadges(B,J,Y){let q=encodeURIComponent(B.name),X=this.normalizeVersionForBadges(J),Z=this.normalizeVersionForBadges(Y),Q=encodeURIComponent(X),O=encodeURIComponent(Z);return{age:`[](https://docs.renovatebot.com/merge-confidence/)`,adoption:`[](https://docs.renovatebot.com/merge-confidence/)`,passing:`[](https://docs.renovatebot.com/merge-confidence/)`,confidence:`[](https://docs.renovatebot.com/merge-confidence/)`}}normalizeVersionForBadges(B){let J=B.replace(/^v/,"");if(J.split(".").length===2)J=`${J}.0`;return J}}
|
|
4
4
|
export{P as We};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-16aeend1.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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{We as c}from"./chunk-
|
|
2
|
+
import{We as c}from"./chunk-gvpsbmeg.js";import{bg as l,kg as A}from"./chunk-c63e4ssc.js";import{sg as y}from"./chunk-x9vpk4kk.js";import{Ah as k}from"./chunk-yh13j2af.js";import{Rh as i}from"./chunk-wzncz6j5.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 h(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 c;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((D)=>D.file==="package.json"||D.file.endsWith("/package.json")||D.file.endsWith("\\package.json")).length,R=W.updates.filter((D)=>D.file.endsWith("composer.json")||D.file.endsWith("composer.lock")).length,K=W.updates.filter((D)=>D.file.endsWith("build.zig.zon")).length,H=W.updates.filter((D)=>(D.file.includes(".yaml")||D.file.includes(".yml"))&&!D.file.includes(".github/workflows/")).length,Z=W.updates.filter((D)=>D.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 D=W.updates[0];$.push(D.name)}if(W.updates.length>=5)$.push("bulk-update");return $}generateTitle(W){let $=this.config?.pullRequest?.titleFormat;if($)return h($,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+=l(W.updates);let D=W.updates.length>1;if(D){if(Z+=`## Package Updates Summary
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fc as F}from"./chunk-
|
|
2
|
+
import{fc as F}from"./chunk-wfwrm4k3.js";import{Cf as c}from"./chunk-1pecmenc.js";import{Of as E,Rf as A}from"./chunk-hk4d7rky.js";import{Rh as m}from"./chunk-wzncz6j5.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,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vf as F,Xf as O,Yf as U}from"./chunk-z18bksyr.js";import{$f as w}from"./chunk-cj4d5ad7.js";import{
|
|
2
|
+
import{Vf as F,Xf as O,Yf as U}from"./chunk-z18bksyr.js";import{$f as w}from"./chunk-cj4d5ad7.js";import{Rh as S}from"./chunk-wzncz6j5.js";import{readdir as g,stat as _}from"fs/promises";import{join as x,relative as E,resolve as C}from"path";var D=1e5;function M(G,q){let J=w(G),Q=C(q),K=C(Q,J),$=E(Q,K);if($.startsWith("..")||C(Q,$)!==K)throw Error(`Refusing to access a path outside the workspace: ${G}`);return K}var h={name:"read_file",tier:"read",description:"Read a UTF-8 text file from the repository. Paths are relative to the repository root.",parameters:{type:"object",properties:{path:{type:"string",description:"Repository-relative path, e.g. src/index.ts"}},required:["path"]},async run(G,q){let J=String(G.path??""),Q=M(J,q.workspace),K=Bun.file(Q);if(!await K.exists())return{content:`File not found: ${J}`,isError:!0};let $=await K.text();if($.length>D)return{content:`${$.slice(0,D)}
|
|
3
3
|
|
|
4
4
|
[truncated at ${D} characters]`};return{content:$}}},T={name:"write_file",tier:"write",description:"Write a UTF-8 text file in the repository, creating or replacing it.",parameters:{type:"object",properties:{path:{type:"string",description:"Repository-relative path"},content:{type:"string",description:"Full file content to write"}},required:["path","content"]},async run(G,q){let J=String(G.path??""),Q=M(J,q.workspace);return await Bun.write(Q,String(G.content??"")),q.log(`wrote ${J}`),{content:`Wrote ${J}`}}},m={name:"list_dir",tier:"read",description:"List the entries of a directory in the repository.",parameters:{type:"object",properties:{path:{type:"string",description:"Repository-relative directory, defaults to the root"}}},async run(G,q){let J=G.path?String(G.path):".",Q=J==="."?C(q.workspace):M(J,q.workspace);try{let K=await g(Q);return{content:(await Promise.all(K.map(async(z)=>{return(await _(x(Q,z)).catch(()=>null))?.isDirectory()?`${z}/`:z}))).sort().join(`
|
|
5
5
|
`)||"(empty)"}}catch(K){return{content:`Could not list ${J}: ${K}`,isError:!0}}}},L=[h,T,m];import u from"process";var d=120000,v=30000,c=["PATH","HOME","LANG","LC_ALL","TZ","TMPDIR","SHELL","USER","PWD","NODE_ENV","CI","BUN_INSTALL","XDG_CACHE_HOME"],p=/_(?:TOKEN|KEY|SECRET|PASSWORD|CREDENTIAL|CREDENTIALS)$|^(?:GITHUB_TOKEN|ANTHROPIC_API_KEY|OPENAI_API_KEY|NPM_TOKEN)$/i;function l(G=u.env,q=[]){let J=new Set([...c,...q]),Q={};for(let[K,$]of Object.entries(G)){if($===void 0)continue;if(!J.has(K))continue;if(p.test(K))continue;Q[K]=$}return Q}var y={name:"run_command",tier:"shell",description:"Run a shell command in the repository. The environment is stripped of credentials, so commands cannot authenticate to external services.",parameters:{type:"object",properties:{command:{type:"string",description:"Command to run, e.g. bun test"},timeoutMs:{type:"number",description:"Optional timeout in milliseconds"}},required:["command"]},async run(G,q){let J=String(G.command??"").trim();if(!J)return{content:"No command supplied",isError:!0};let Q=Number(G.timeoutMs)>0?Number(G.timeoutMs):d;q.log(`running: ${J}`);try{let K=Bun.spawn(["sh","-c",J],{cwd:q.workspace,env:l(),stdout:"pipe",stderr:"pipe"}),$=setTimeout(()=>K.kill(),Q),[z,V,I]=await Promise.all([new Response(K.stdout).text(),new Response(K.stderr).text(),K.exited]);clearTimeout($);let H=[z,V].filter(Boolean).join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{W as a,X as b}from"./chunk-bafzw99p.js";import"./chunk-wfwrm4k3.js";import"./chunk-4r03rh93.js";import"./chunk-0f1xye20.js";import"./chunk-s3b3vrsj.js";import"./chunk-6gvx1g6h.js";import"./chunk-mr2d1zp0.js";import"./chunk-142zh7e5.js";import"./chunk-743mhx0e.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{b as renderDoctorReport,a as diagnose};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{dg as Y}from"./chunk-
|
|
2
|
+
import{dg as Y}from"./chunk-c63e4ssc.js";import{Rh as V}from"./chunk-wzncz6j5.js";import{gl as R}from"./chunk-16aeend1.js";import{spawn as T}from"child_process";import{existsSync as W}from"fs";import $ from"process";function S(){return["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml","composer.lock","pantry.lock"]}function _(z){switch(z){case"bun":return{command:"bun",args:["install"]};case"npm":return{command:"npm",args:["install"]};case"yarn":return{command:"yarn",args:["install"]};case"pnpm":return{command:"pnpm",args:["install"]};case"composer":return{command:"composer",args:["update","--lock"]};case"pantry":return{command:"pantry",args:["install","--ignore-scripts","--quiet"]}}}async function y(z,G,B=300000){let{command:K,args:Q}=_(z);return V().info(`\uD83D\uDD04 Regenerating lock file with ${z} (${K} ${Q.join(" ")})...`),new Promise((J)=>{let O=T(K,Q,{cwd:G,stdio:"pipe",env:{...$.env,CI:"true"}}),H="",X="",Z=!1,q=setTimeout(()=>{Z=!0,V().warn(`\u26A0\uFE0F ${z} install timed out after ${B/1000}s, sending SIGTERM...`),O.kill("SIGTERM"),setTimeout(()=>{if(!O.killed)V().warn(`\u26A0\uFE0F ${z} install did not exit after SIGTERM, sending SIGKILL...`),O.kill("SIGKILL")},1e4)},B);O.stdout?.on("data",(U)=>{H+=U.toString()}),O.stderr?.on("data",(U)=>{X+=U.toString()}),O.on("close",(U)=>{if(clearTimeout(q),Z){J({success:!1,packageManager:z,message:`Lock file regeneration timed out after ${B/1000}s`});return}if(U===0)V().info(`\u2705 Lock file regenerated successfully with ${z}`),J({success:!0,packageManager:z,message:"Lock file regenerated successfully"});else{if(V().warn(`\u26A0\uFE0F ${z} install exited with code ${U}`),X)V().warn(` stderr: ${X.slice(0,500)}`);J({success:!1,packageManager:z,message:`Install exited with code ${U}: ${X.slice(0,200)}`})}}),O.on("error",(U)=>{clearTimeout(q),V().warn(`\u26A0\uFE0F Failed to run ${K}: ${U.message}`),J({success:!1,packageManager:z,message:`Failed to run ${K}: ${U.message}`})})})}var C=new Set(["deps.yaml","deps.yml","pantry.jsonc","pantry.json","pantry.toml"]);function I(z,G=$.cwd()){let B=new Set,K=!1;for(let Q of z){let J=Q.split("/").pop()||"";if(J==="package.json")B.add(Y(G)),K=!0;if(J==="composer.json")B.add("composer");if(C.has(J))K=!0}if(K&&A("pantry",G))B.add("pantry");return Array.from(B)}function E(z,G=$.cwd()){let B=new Map;for(let K of z){let Q=K.replace(/^\.\//,"");if(!Q.endsWith("package.json")||!Q.includes("/"))continue;let J=Q.slice(0,Q.lastIndexOf("/"));if(B.has(J))continue;let O=`${G}/${J}`,H=["bun","pnpm","yarn","npm"].find((Z)=>A(Z,O));if(!H)continue;let X=b(H,O);if(X)B.set(J,{dir:J,manager:H,lockFile:`${J}/${X}`})}return[...B.values()]}function b(z,G){return{bun:["bun.lock","bun.lockb"],npm:["package-lock.json"],yarn:["yarn.lock"],pnpm:["pnpm-lock.yaml"],composer:["composer.lock"],pantry:["pantry.lock"]}[z].find((K)=>W(`${G}/${K}`))??null}function L(z,G=$.cwd()){let B=new Set(z.map((H)=>H.replace(/^\.\//,""))),K=new Set(E(z,G).map((H)=>H.dir)),Q=z.filter((H)=>!K.has(H.replace(/^\.\//,"").replace(/\/package\.json$/,""))),J=I(Q,G).map((H)=>b(H,G)),O=E(z,G).map((H)=>H.lockFile);return[...J,...O].filter((H)=>H!==null&&!B.has(H))}function A(z,G){let B=R("path");switch(z){case"bun":return W(B.join(G,"bun.lock"))||W(B.join(G,"bun.lockb"));case"npm":return W(B.join(G,"package-lock.json"));case"yarn":return W(B.join(G,"yarn.lock"));case"pnpm":return W(B.join(G,"pnpm-lock.yaml"));case"composer":return W(B.join(G,"composer.lock"));case"pantry":return W(B.join(G,"pantry.lock"))}}
|
|
3
3
|
export{S as Nc,y as Oc,I as Pc,E as Qc,b as Rc,L as Sc,A as Tc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pf as a,qf as b,rf as c}from"./chunk-7hm46cej.js";import"./chunk-wc2z7krw.js";import"./chunk-1pecmenc.js";import"./chunk-hk4d7rky.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-cj4d5ad7.js";import"./chunk-c63e4ssc.js";import"./chunk-x9vpk4kk.js";import"./chunk-r1jvyhhd.js";import"./chunk-2z9mh5y4.js";import"./chunk-yh13j2af.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{a as matchesGlobs,c as appendUpgradeReport,b as analyzeGroupMajors};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ib as w}from"./chunk-vckhctmr.js";import"./chunk-16aeend1.js";import{readdir as $}from"fs/promises";import{join as X}from"path";var G=["dependencies","peerDependencies","optionalDependencies"];async function x(V,W,Q,U){let M=await K(Q,U);if(M.length===0)return[];let J=new Map,D=(q,z,H)=>{let Y=J.get(q),Z={by:z,range:H};if(Y)Y.push(Z);else J.set(q,[Z])};for(let q of V)for(let z of q.dependencies)D(z.name,w,z.currentVersion);for(let q of M)for(let[z,H]of Object.entries(q.ranges))D(z,q.name,H);let E=[];for(let q of M){let z=J.get(q.name);if(!z||z.length===0)continue;try{let H=await W.getReleaseVersions(q.name);if(H.length===0)continue;E.push({name:q.name,installed:q.version,available:H,declared:z})}catch(H){U.debug(`Skipping drift analysis for ${q.name}: ${H}`)}}return E}async function K(V,W){let Q=X(V,"node_modules"),U=[],M;try{M=await $(Q)}catch{return W.debug("No node_modules directory, skipping resolution drift analysis"),[]}let J=[];for(let D of M){if(D.startsWith("."))continue;if(D.startsWith("@")){try{let E=await $(X(Q,D));J.push(...E.map((q)=>`${D}/${q}`))}catch{continue}continue}J.push(D)}return await Promise.all(J.map(async(D)=>{try{let E=await Bun.file(X(Q,D,"package.json")).json();if(!E.name||!E.version)return;let q={};for(let z of G)Object.assign(q,E[z]??{});U.push({name:E.name,version:E.version,ranges:q})}catch{}})),U}export{x as collectDriftInputs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qe as a,Re as b,Se as c,Te as d,Ue as e,Ve as f}from"./chunk-
|
|
2
|
+
import{Qe as a,Re as b,Se as c,Te as d,Ue as e,Ve as f}from"./chunk-4wv5s3vr.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{e as updateDockerfile,d as resolveDockerDigest,b as parseDockerfile,a as isDockerfile,f as generateDockerfileUpdates,c as fetchLatestDockerImageVersion};
|