@buddysh/buddy 0.11.7 → 0.11.9
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 +28 -0
- package/bin/cli.ts +18 -5
- package/dist/bin/cli.js +70 -70
- 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-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-2fx0tbc0.js +2 -0
- package/dist/{chunk-w16pwfh3.js → chunk-2m0134q8.js} +1 -1
- package/dist/{chunk-1z4nhstx.js → chunk-34rmja4x.js} +1 -1
- package/dist/chunk-3ggd7z2f.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-3wy8fypy.js → chunk-4wbbbcs2.js} +1 -1
- package/dist/chunk-4zvjzesh.js +2 -0
- 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-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-9634xcvq.js +2 -0
- package/dist/{chunk-4wh0wryv.js → chunk-9m0epv44.js} +1 -1
- package/dist/{chunk-v8746363.js → chunk-a34szd4r.js} +3 -3
- package/dist/{chunk-ddmvjp0y.js → chunk-a3bnhq58.js} +1 -1
- package/dist/{chunk-d2d5m2kx.js → chunk-amj037yy.js} +2 -2
- package/dist/{chunk-j0bsva07.js → chunk-be059ncv.js} +1 -1
- package/dist/{chunk-m17kvr7m.js → chunk-bjymeq7e.js} +1 -1
- package/dist/{chunk-9b4z1bpx.js → chunk-d4wqe366.js} +1 -1
- package/dist/chunk-d7jpbw1z.js +9 -0
- package/dist/{chunk-qv1nvaha.js → chunk-db9rffcf.js} +1 -1
- package/dist/{chunk-zkv7e2q2.js → chunk-drkzf2gz.js} +1 -1
- package/dist/chunk-ea6rtyvy.js +2 -0
- package/dist/{chunk-t3a1703q.js → chunk-fpzgxg8a.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-39ne6m3w.js → chunk-jxd64dzs.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-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-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-pksrcdh6.js +2 -0
- 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-r7nh070r.js +106 -0
- 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-qk43d3vv.js → chunk-s3q7g2hy.js} +1 -1
- package/dist/chunk-sdhyhefy.js +2 -0
- package/dist/{chunk-qz5nqeza.js → chunk-se4g70q2.js} +1 -1
- package/dist/{chunk-305184z3.js → chunk-srz5kgyg.js} +1 -1
- package/dist/chunk-sxdfmskp.js +2 -0
- 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-eftyxrxw.js → chunk-tx9m7y1z.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-xffrrs85.js +38 -0
- package/dist/{chunk-tgh61e5e.js → chunk-xps8n8nj.js} +1 -1
- 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-zefqbamj.js +2 -0
- package/dist/{chunk-ztw515ew.js → chunk-zrg5ss0x.js} +1 -1
- package/dist/src/git/github-provider.d.ts +1 -0
- package/dist/src/git/provider.d.ts +1 -0
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/dist/src/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-2pv5zwbm.js +0 -38
- 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
package/dist/chunk-3d5pjrz7.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Hh as P}from"./chunk-ddmvjp0y.js";import{Kh as M,Nh as Q}from"./chunk-f0z6kyqt.js";function V(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function X(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 Y{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:V(H.status),conclusion:X(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)=>A.name.startsWith("buddy/")).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{Y as Bh};
|
package/dist/chunk-3jw9d546.js
DELETED
package/dist/chunk-4d13qb9f.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{rf as a,sf as b,tf as c,uf as d,vf as e,wf as f,xf as g}from"./chunk-p96zq2zc.js";import"./chunk-emygmh7r.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{f as strategyAllows,b as ruleMatches,c as resolveRuleEffects,e as mergeGroupEffects,g as groupsToRules,a as ecosystemOf,d as applyRules};
|
package/dist/chunk-5ct11b1j.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Da as a}from"./chunk-9b4z1bpx.js";import"./chunk-19n3wnxq.js";import"./chunk-sczx20gw.js";import"./chunk-d2d5m2kx.js";import"./chunk-3wy8fypy.js";import"./chunk-89s9f3mf.js";import"./chunk-ja3rvd6y.js";import"./chunk-srznv36n.js";import"./chunk-0ewzxzt3.js";import"./chunk-1z4nhstx.js";import"./chunk-x4ea69ek.js";import"./chunk-03j2dx5h.js";import"./chunk-v6dephze.js";import"./chunk-7wk4px2k.js";import"./chunk-88j356ng.js";import"./chunk-675c6ddc.js";import"./chunk-p96zq2zc.js";import"./chunk-jpdd59fh.js";import"./chunk-p8azbpq6.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as Scheduler};
|
package/dist/chunk-6t1rb4tz.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{kd as a}from"./chunk-3wy8fypy.js";import"./chunk-89s9f3mf.js";import"./chunk-ja3rvd6y.js";import"./chunk-x4ea69ek.js";import"./chunk-03j2dx5h.js";import"./chunk-v6dephze.js";import"./chunk-88j356ng.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as PackageScanner};
|
package/dist/chunk-9b2yfhzj.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Nh as K}from"./chunk-f0z6kyqt.js";var R=".buddy/reports.jsonl",X=52;function Z(M){if(!M?.trim())return[];let E=[];for(let j of M.split(`
|
|
3
|
-
`)){if(!j.trim())continue;try{let N=JSON.parse(j);if(N?.period&&N.generatedAt&&N.health&&N.activity)E.push(N)}catch{continue}}return E}function W(M,E){return`${[...M,E].slice(-X).map((N)=>JSON.stringify(N)).join(`
|
|
4
|
-
`)}
|
|
5
|
-
`}function _(M,E){for(let j=M.length-1;j>=0;j--)if(M[j].period===E)return M[j];return null}async function k(M,E,j=K()){try{return Z(await M.getFileContent(R,E))}catch(N){return j.debug(`No report history at ${R}: ${N}`),[]}}var x=["7d","30d","90d"],O={"7d":7,"30d":30,"90d":90};function A(M){let E=new Date(M.now.getTime()-O[M.period]*24*60*60*1000),j=M.branchPrefix??"buddy/",N=M.pullRequests.filter((q)=>q.head.startsWith(j)),C=N.filter((q)=>q.createdAt>=E),z=N.filter((q)=>q.mergedAt!==void 0&&q.mergedAt>=E),F=N.filter((q)=>q.state==="closed"&&q.mergedAt===void 0&&q.updatedAt>=E),J=z.map((q)=>(q.mergedAt.getTime()-q.createdAt.getTime())/3600000).sort((q,Q)=>q-Q),G=Object.values(M.dependenciesByEcosystem).reduce((q,Q)=>q+Q,0),U=M.updates.length;return{period:M.period,generatedAt:M.now.toISOString(),health:{byEcosystem:{...M.dependenciesByEcosystem},total:G,outdated:U,outdatedPercent:G>0?Math.round(U/G*100):0,majorBehind:M.updates.filter((q)=>q.updateType==="major").length,vulnerable:M.updates.filter((q)=>(q.securityAdvisories?.length??0)>0).length,deprecated:M.deprecated??0,drifted:M.drifted??0},activity:{opened:C.length,merged:z.length,closed:F.length,open:N.filter((q)=>q.state==="open").length,medianHoursToMerge:B(J),mergeRate:C.length>0?Math.round(z.length/C.length*100):0}}}function B(M){if(M.length===0)return null;let E=Math.floor(M.length/2),j=M.length%2===0?(M[E-1]+M[E])/2:M[E];return Math.round(j*10)/10}function L(M,E){if(!E)return{};let j=new Set(["merged","mergeRate"]),N=[["outdated",M.health.outdated,E.health.outdated],["majorBehind",M.health.majorBehind,E.health.majorBehind],["vulnerable",M.health.vulnerable,E.health.vulnerable],["deprecated",M.health.deprecated,E.health.deprecated],["opened",M.activity.opened,E.activity.opened],["merged",M.activity.merged,E.activity.merged],["mergeRate",M.activity.mergeRate,E.activity.mergeRate]],C={};for(let[z,F,J]of N){let G=F-J;C[z]={current:F,previous:J,change:G,improved:j.has(z)?G>=0:G<=0}}return C}var $="<!-- buddy:report -->";function H(M){if(!M||M.change===0)return"\u2014";let E=M.change>0?"\u25B2":"\u25BC",j=M.change>0?"+":"";return`${E} ${j}${M.change}${M.improved?"":" \u26A0\uFE0F"}`}function S(M,E={}){let j=O[M.period],N=[$,"",`## Dependency report \u2014 last ${j} days`,"",`Generated ${M.generatedAt.slice(0,10)}.`,"","### Dependency health","","| Metric | Value | Change |","| --- | --- | --- |",`| Total dependencies | ${M.health.total} | |`,`| Outdated | ${M.health.outdated} (${M.health.outdatedPercent}%) | ${H(E.outdated)} |`,`| A major behind | ${M.health.majorBehind} | ${H(E.majorBehind)} |`,`| With known advisories | ${M.health.vulnerable} | ${H(E.vulnerable)} |`,`| Deprecated | ${M.health.deprecated} | ${H(E.deprecated)} |`];if(M.health.drifted>0)N.push(`| Held back by a dependant | ${M.health.drifted} | |`);N.push("","### By ecosystem","");let C=Object.entries(M.health.byEcosystem).filter(([,z])=>z>0).sort(([,z],[,F])=>F-z);if(C.length===0)N.push("No dependencies detected.");else{N.push("| Ecosystem | Dependencies |","| --- | --- |");for(let[z,F]of C)N.push(`| ${z} | ${F} |`)}if(N.push("","### Bot activity","","| Metric | Value | Change |","| --- | --- | --- |",`| Pull requests opened | ${M.activity.opened} | ${H(E.opened)} |`,`| Merged | ${M.activity.merged} | ${H(E.merged)} |`,`| Closed without merging | ${M.activity.closed} | |`,`| Currently open | ${M.activity.open} | |`),M.activity.medianHoursToMerge!==null)N.push(`| Median time to merge | ${Y(M.activity.medianHoursToMerge)} | |`);if(N.push(`| Merged vs opened | ${M.activity.mergeRate}% | ${H(E.mergeRate)} |`),N.push("",`_"Merged vs opened" compares both counts within the same ${j}-day window, so`,"recently opened pull requests depress it by definition._"),Object.keys(E).length===0)N.push("","_No previous report to compare against; this is the baseline._");return N.join(`
|
|
6
|
-
`)}async function T(M,E,j,N,C=K()){if(!j)return M;try{let F=(await j.complete({system:"You write short factual summaries of dependency-health metrics. Interpret the numbers you are given; never invent figures, and never restate a table that already appears in the report. Three sentences at most.",messages:[{role:"user",content:[N?`Focus: ${N}`:"Focus: what changed and what needs attention.","","Metrics:",JSON.stringify(E,null,2)].join(`
|
|
7
|
-
`)}]})).text.trim();if(!F)return M;return M.replace("### Dependency health",`${F}
|
|
8
|
-
|
|
9
|
-
### Dependency health`)}catch(z){return C.warn(`\u26A0\uFE0F Could not write the report narrative: ${z}`),M}}function Y(M){if(M<24)return`${M}h`;return`${Math.round(M/24*10)/10}d`}function w(M){if(!M.scheduled)return{publish:!0};if(M.enabled===!0)return{publish:!0};return{publish:!1,reason:M.enabled===!1?"reports.enabled is false":"reports.enabled is not set \u2014 scheduled reports are opt-in"}}export{R as I,X as J,Z as K,W as L,_ as M,k as N,x as O,O as P,A as Q,L as R,$ as S,S as T,T as U,w as V};
|
package/dist/chunk-a4m6bqpq.js
DELETED
package/dist/chunk-djdf848n.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ag as c,Bg as d,yg as a,zg as b}from"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{c as updateDependencyFile,b as parseDependencyFile,a as isDependencyFile,d as generateDependencyFileUpdates};
|
package/dist/chunk-dsep28r5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{hb as a,ib as b,jb as c,kb as d,lb as e}from"./chunk-55znd3yn.js";import"./chunk-p8azbpq6.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.js";export{b as verifyChanges,c as stackedBranchName,d as runStackedTouch,e as detectChangedFiles,a as TEST_COMMANDS};
|
package/dist/chunk-e6sg7jg4.js
DELETED
package/dist/chunk-eme4fny7.js
DELETED
package/dist/chunk-fjp4k18r.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Nc as a,Oc as b,Pc as c,Qc as d,Rc as e,Sc as f}from"./chunk-ztw515ew.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{b as regenerateLockFile,e as missingLockFiles,d as lockFileFor,f as hasLockFile,a as getAllLockFilePaths,c as detectRequiredPackageManagers};
|
package/dist/chunk-gw3t78fw.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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-9b2yfhzj.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.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};
|
package/dist/chunk-h4084ykd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{W as a,X as b}from"./chunk-qv1nvaha.js";import"./chunk-3d3rwmmj.js";import"./chunk-eftyxrxw.js";import"./chunk-ja3rvd6y.js";import"./chunk-he97rsmj.js";import"./chunk-0ewzxzt3.js";import"./chunk-j0bsva07.js";import"./chunk-xny4kgcc.js";import"./chunk-1z4nhstx.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.js";export{b as renderDoctorReport,a as diagnose};
|
package/dist/chunk-jczf4z85.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{sd as a}from"./chunk-srznv36n.js";import"./chunk-7wk4px2k.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as PullRequestGenerator};
|
package/dist/chunk-m2qq154g.js
DELETED
package/dist/chunk-m8kqe55k.js
DELETED
package/dist/chunk-n42c80f3.js
DELETED
package/dist/chunk-nfcyqj66.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{dd as a}from"./chunk-19n3wnxq.js";import"./chunk-sczx20gw.js";import"./chunk-d2d5m2kx.js";import"./chunk-3wy8fypy.js";import"./chunk-89s9f3mf.js";import"./chunk-ja3rvd6y.js";import"./chunk-srznv36n.js";import"./chunk-0ewzxzt3.js";import"./chunk-1z4nhstx.js";import"./chunk-x4ea69ek.js";import"./chunk-03j2dx5h.js";import"./chunk-v6dephze.js";import"./chunk-7wk4px2k.js";import"./chunk-88j356ng.js";import"./chunk-675c6ddc.js";import"./chunk-p96zq2zc.js";import"./chunk-jpdd59fh.js";import"./chunk-p8azbpq6.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as Buddy};
|
package/dist/chunk-pvfavmy3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{jd as a}from"./chunk-d2d5m2kx.js";import"./chunk-89s9f3mf.js";import"./chunk-ja3rvd6y.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as RegistryClient};
|
package/dist/chunk-rfgacg5h.js
DELETED
package/dist/chunk-t0kvt1pm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ea as a,Fa as b,Ga as c,Ha as d,Ia as e,Ja as f,Ka as g}from"./chunk-v8746363.js";import"./chunk-he97rsmj.js";import"./chunk-0ewzxzt3.js";import"./chunk-1z4nhstx.js";import"./chunk-jpdd59fh.js";import"./chunk-p8azbpq6.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.js";export{g as runFixCi,e as latestFailurePerWorkflow,d as failsOnBaseBranch,b as extractErrorLines,c as describeFailure,a as classifyFailure,f as attemptFix};
|
package/dist/chunk-wfn702a2.js
DELETED
package/dist/chunk-xpsetmcw.js
DELETED
package/dist/chunk-yd834q68.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Jc as a,Kc as b,Lc as c,Mc as d}from"./chunk-2pv5zwbm.js";import"./chunk-ztw515ew.js";import"./chunk-vckn5ate.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{c as isWorkflowPermissionRefusal,a as gitAuthConfigArgs,b as WorkflowPermissionError,d as GitHubProvider};
|
package/dist/chunk-ymwjjyke.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{of as a,pf as b,qf as c}from"./chunk-675c6ddc.js";import"./chunk-p96zq2zc.js";import"./chunk-jpdd59fh.js";import"./chunk-p8azbpq6.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as matchesGlobs,c as appendUpgradeReport,b as analyzeGroupMajors};
|