@buddysh/buddy 0.11.17 → 0.11.18

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +12 -0
  3. package/bin/cli.ts +14 -1
  4. package/dist/bin/cli.js +42 -40
  5. package/dist/bin/entry.d.ts +1 -0
  6. package/dist/bin/entry.js +3 -0
  7. package/dist/bin/stacks.d.ts +1 -0
  8. package/dist/bin/stacks.js +3 -0
  9. package/dist/{chunk-7hm46cej.js → chunk-09qpgqgj.js} +1 -1
  10. package/dist/{chunk-wk175yyw.js → chunk-0baffydm.js} +1 -1
  11. package/dist/{chunk-pxfrq43h.js → chunk-0g44mytk.js} +1 -1
  12. package/dist/{chunk-1a14rx5n.js → chunk-0hrxtesf.js} +2 -2
  13. package/dist/{chunk-4chtv4nh.js → chunk-13cpe0kf.js} +1 -1
  14. package/dist/{chunk-qngnmrpw.js → chunk-18wwzwcz.js} +1 -1
  15. package/dist/{chunk-bw43q8k7.js → chunk-249qcsjm.js} +1 -1
  16. package/dist/chunk-255r8t6k.js +2 -0
  17. package/dist/{chunk-k8sd78td.js → chunk-292qaqqe.js} +1 -1
  18. package/dist/chunk-2c2bkhwj.js +2 -0
  19. package/dist/chunk-2k7b8te1.js +5 -0
  20. package/dist/{chunk-ewhvahnb.js → chunk-2z54h4e9.js} +2 -2
  21. package/dist/{chunk-j57716xw.js → chunk-339ae7vn.js} +1 -1
  22. package/dist/{chunk-4r03rh93.js → chunk-35wxea5y.js} +1 -1
  23. package/dist/{chunk-bnp0r4eh.js → chunk-3zp7a103.js} +1 -1
  24. package/dist/{chunk-bafzw99p.js → chunk-48a66w2p.js} +2 -2
  25. package/dist/chunk-4aavwqyt.js +2 -0
  26. package/dist/{chunk-byqzhgzs.js → chunk-4yy4f6wc.js} +1 -1
  27. package/dist/{chunk-r1jvyhhd.js → chunk-5107xbwj.js} +1 -1
  28. package/dist/{chunk-wzncz6j5.js → chunk-56t2za4k.js} +1 -1
  29. package/dist/{chunk-nk8wxxy7.js → chunk-5czhqsvn.js} +2 -2
  30. package/dist/chunk-6c6e5xgb.js +2 -0
  31. package/dist/{chunk-r7qa2ykf.js → chunk-6v9c84ds.js} +2 -2
  32. package/dist/chunk-7qp8ng5e.js +2 -0
  33. package/dist/chunk-7rdqaj9g.js +2 -0
  34. package/dist/chunk-87x43s85.js +2 -0
  35. package/dist/{chunk-g09atq0m.js → chunk-8efgn47g.js} +1 -1
  36. package/dist/{chunk-wfwrm4k3.js → chunk-97857d8t.js} +1 -1
  37. package/dist/chunk-981xyxzj.js +2 -0
  38. package/dist/{chunk-her5azyp.js → chunk-9mpeqda3.js} +2 -2
  39. package/dist/{chunk-qbep9dk4.js → chunk-a12s15m8.js} +1 -1
  40. package/dist/chunk-a7veqg3a.js +2 -0
  41. package/dist/{chunk-2f7j0dmw.js → chunk-ad8ws736.js} +1 -1
  42. package/dist/{chunk-dxd0eg4r.js → chunk-b22d85q8.js} +1 -1
  43. package/dist/{chunk-9chq5m4p.js → chunk-b27ezdzq.js} +4 -4
  44. package/dist/{chunk-cb25v2mp.js → chunk-b75yqx1f.js} +1 -1
  45. package/dist/{chunk-mthd2c8m.js → chunk-b8bfag6k.js} +2 -2
  46. package/dist/chunk-b9b3xwar.js +2 -0
  47. package/dist/chunk-bjvx1r6g.js +2 -0
  48. package/dist/{chunk-1g43mpqn.js → chunk-c067bnx5.js} +1 -1
  49. package/dist/{chunk-a8wcn3mh.js → chunk-c5d5webv.js} +2 -2
  50. package/dist/chunk-c7s8nsbr.js +2 -0
  51. package/dist/chunk-ckvtfmyg.js +2 -0
  52. package/dist/{chunk-0f1xye20.js → chunk-d2vrstjq.js} +1 -1
  53. package/dist/{chunk-7m3pzkcj.js → chunk-d3cqth47.js} +1 -1
  54. package/dist/{chunk-s3b3vrsj.js → chunk-dbhgxe35.js} +2 -2
  55. package/dist/{chunk-sj7n6xa1.js → chunk-dcbkac9x.js} +1 -1
  56. package/dist/{chunk-m3rftash.js → chunk-drn3hq53.js} +7 -7
  57. package/dist/{chunk-16aeend1.js → chunk-eaz23nsf.js} +1 -1
  58. package/dist/{chunk-69qyr9ef.js → chunk-ejfyc7r8.js} +1 -1
  59. package/dist/{chunk-51m5tgwp.js → chunk-ems4rhqe.js} +1 -1
  60. package/dist/{chunk-6kd81nf9.js → chunk-erges5h8.js} +1 -1
  61. package/dist/chunk-f1d20z92.js +2 -0
  62. package/dist/{chunk-km4aszfp.js → chunk-f4rmh2s9.js} +1 -1
  63. package/dist/chunk-ff1dah6m.js +2 -0
  64. package/dist/chunk-fz9th4yv.js +2 -0
  65. package/dist/{chunk-67bjaw56.js → chunk-g482e1b0.js} +3 -3
  66. package/dist/{chunk-1pdvjg0x.js → chunk-gkdmk7xt.js} +1 -1
  67. package/dist/{chunk-fsghqtgf.js → chunk-gs26n8tm.js} +2 -2
  68. package/dist/{chunk-0kce7e60.js → chunk-h3vdnyqy.js} +1 -1
  69. package/dist/chunk-haemkbh1.js +2 -0
  70. package/dist/chunk-hgcr63c6.js +2 -0
  71. package/dist/chunk-hh4zq6m0.js +2 -0
  72. package/dist/{chunk-d09qj570.js → chunk-hzpsmg4z.js} +1 -1
  73. package/dist/{chunk-8wrbxhs3.js → chunk-j5k195b6.js} +1 -1
  74. package/dist/{chunk-1jgh0ff1.js → chunk-j9xw849s.js} +2 -2
  75. package/dist/{chunk-z2gcfvze.js → chunk-jan74vw2.js} +5 -5
  76. package/dist/{chunk-wfg3bp85.js → chunk-jf4s1r34.js} +1 -1
  77. package/dist/{chunk-h2f92qwd.js → chunk-jpbq9xqv.js} +1 -1
  78. package/dist/chunk-k1w134pz.js +2 -0
  79. package/dist/{chunk-s0ps33ft.js → chunk-kqwdg3nw.js} +1 -1
  80. package/dist/chunk-ksght1x7.js +2 -0
  81. package/dist/chunk-mkfsh53w.js +2 -0
  82. package/dist/{chunk-sddaassq.js → chunk-mm9b9pwb.js} +1 -1
  83. package/dist/{chunk-mr2d1zp0.js → chunk-n2de4spv.js} +1 -1
  84. package/dist/chunk-nfcxgb5d.js +2 -0
  85. package/dist/{chunk-26yejy1v.js → chunk-nkwfez01.js} +1 -1
  86. package/dist/{chunk-whtdmv3p.js → chunk-nn9rcqsz.js} +2 -2
  87. package/dist/{chunk-6b0fmw0d.js → chunk-npjgqzfg.js} +1 -1
  88. package/dist/{chunk-743mhx0e.js → chunk-p09rsh3z.js} +1 -1
  89. package/dist/chunk-pbrpej0s.js +2 -0
  90. package/dist/chunk-pz2nmnhh.js +2 -0
  91. package/dist/{chunk-7p1b809h.js → chunk-r7c4arkp.js} +1 -1
  92. package/dist/{chunk-gq9gkyah.js → chunk-r976qdkb.js} +2 -2
  93. package/dist/{chunk-hk4d7rky.js → chunk-rb6gzts6.js} +1 -1
  94. package/dist/{chunk-gg1ddvnf.js → chunk-rxqph6cj.js} +2 -2
  95. package/dist/{chunk-gvpsbmeg.js → chunk-rzxj5fgp.js} +1 -1
  96. package/dist/{chunk-6gvx1g6h.js → chunk-s3t54kj1.js} +2 -2
  97. package/dist/{chunk-pag93kz1.js → chunk-sc4bxrwb.js} +1 -1
  98. package/dist/{chunk-4wv5s3vr.js → chunk-sveh3wjr.js} +1 -1
  99. package/dist/{chunk-4dz5x4xw.js → chunk-t74w5ddy.js} +1 -1
  100. package/dist/{chunk-ttkjzy0m.js → chunk-tp3hze1v.js} +1 -1
  101. package/dist/chunk-v02hzntq.js +2 -0
  102. package/dist/{chunk-8r2819xn.js → chunk-v9aakgat.js} +1 -1
  103. package/dist/chunk-vg0pry4b.js +2 -0
  104. package/dist/chunk-vgys0c1v.js +2 -0
  105. package/dist/{chunk-t1r2ycn7.js → chunk-vjav82c6.js} +1 -1
  106. package/dist/{chunk-wc2z7krw.js → chunk-vna64r40.js} +1 -1
  107. package/dist/{chunk-mtn4angk.js → chunk-vx23zjwq.js} +1 -1
  108. package/dist/{chunk-psjrcpgb.js → chunk-w20n4t27.js} +2 -2
  109. package/dist/{chunk-c63e4ssc.js → chunk-w3ktf7th.js} +2 -2
  110. package/dist/{chunk-hd74jxm2.js → chunk-wjzravb7.js} +2 -2
  111. package/dist/{chunk-y5fdq7cd.js → chunk-wk4rtet9.js} +1 -1
  112. package/dist/{chunk-6w0n6c07.js → chunk-wkjv03yr.js} +1 -1
  113. package/dist/{chunk-5yfaptmp.js → chunk-wm6g7y1r.js} +1 -1
  114. package/dist/chunk-wq4g8082.js +2 -0
  115. package/dist/chunk-x8dry63m.js +2 -0
  116. package/dist/{chunk-vs61069x.js → chunk-xaw1yts1.js} +1 -1
  117. package/dist/chunk-y2zqnbbf.js +2 -0
  118. package/dist/{chunk-vckhctmr.js → chunk-yy8vb4yk.js} +1 -1
  119. package/dist/chunk-za2yg8vc.js +2 -0
  120. package/dist/{chunk-jqh7vx2n.js → chunk-zdh3gd22.js} +1 -1
  121. package/dist/{chunk-y2ntnpdb.js → chunk-zrnfjw7d.js} +1 -1
  122. package/dist/src/index.js +1 -1
  123. package/dist/src/setup.js +1 -1
  124. package/dist/src/stacks-cli.d.ts +7 -0
  125. package/package.json +4 -2
  126. package/dist/chunk-0n03s02h.js +0 -2
  127. package/dist/chunk-1k4p8wyx.js +0 -2
  128. package/dist/chunk-1mkwhnsf.js +0 -2
  129. package/dist/chunk-2309x9r7.js +0 -2
  130. package/dist/chunk-3jm67wxm.js +0 -2
  131. package/dist/chunk-3mnpvfg3.js +0 -2
  132. package/dist/chunk-485kgdtb.js +0 -2
  133. package/dist/chunk-5t07s3dv.js +0 -2
  134. package/dist/chunk-6bqs7rtc.js +0 -2
  135. package/dist/chunk-8b7cwedf.js +0 -2
  136. package/dist/chunk-9fagkyrp.js +0 -2
  137. package/dist/chunk-9gabxm8n.js +0 -2
  138. package/dist/chunk-bgb44971.js +0 -2
  139. package/dist/chunk-bz5yx7g6.js +0 -2
  140. package/dist/chunk-dttp44vs.js +0 -2
  141. package/dist/chunk-fzs7vpps.js +0 -2
  142. package/dist/chunk-gkb0gja4.js +0 -2
  143. package/dist/chunk-hxkxset4.js +0 -2
  144. package/dist/chunk-jgq5d6s2.js +0 -2
  145. package/dist/chunk-kthwzc4p.js +0 -2
  146. package/dist/chunk-m9qtb4xj.js +0 -2
  147. package/dist/chunk-p9xksx9p.js +0 -2
  148. package/dist/chunk-q4j2f72t.js +0 -2
  149. package/dist/chunk-rqj1vrfs.js +0 -2
  150. package/dist/chunk-s4fccg73.js +0 -2
  151. package/dist/chunk-tjj6ttj1.js +0 -2
  152. package/dist/chunk-tsd9jw07.js +0 -2
  153. package/dist/chunk-txe5z472.js +0 -2
  154. package/dist/chunk-vffz69jj.js +0 -2
  155. package/dist/chunk-wn9vr9ct.js +0 -2
  156. package/dist/chunk-yr6qyeab.js +0 -2
  157. package/dist/chunk-zj2pt1bx.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Gh as V}from"./chunk-6w0n6c07.js";import{Lh as P}from"./chunk-s0ps33ft.js";import{Oh as M,Rh as Q}from"./chunk-wzncz6j5.js";function X(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function Y(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Z{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
2
+ import{Ih as V}from"./chunk-wkjv03yr.js";import{Nh as P}from"./chunk-kqwdg3nw.js";import{Qh as M,Th as Q}from"./chunk-56t2za4k.js";function X(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function Y(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Z{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
3
3
  `)).join(`
4
4
  `)}async getPullRequestHeadSha(z){return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}`)).sha??""}async createComment(z,A){try{await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/notes`,{body:A})}catch(F){if(!String(F).includes("404"))throw F;await this.request("POST",`/projects/${this.projectId}/issues/${z}/notes`,{body:A})}}async createIssue(z){let A=await this.request("POST",`/projects/${this.projectId}/issues`,{title:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{}});return this.toIssue(A)}async getIssues(z="open"){let A=z==="all"?"state=all":`state=${z==="open"?"opened":"closed"}`;return(await this.request("GET",`/projects/${this.projectId}/issues?${A}&per_page=100`)).map((G)=>this.toIssue(G))}async updateIssue(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/issues/${z}`,{...A.title!==void 0?{title:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toIssue(F)}async closeIssue(z){await this.request("PUT",`/projects/${this.projectId}/issues/${z}`,{state_event:"close"})}async unpinIssue(z){return!1}async enableAutoMerge(z,A="squash"){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{merge_when_pipeline_succeeds:!0,squash:A==="squash",should_remove_source_branch:!0}),!0}catch(F){return this.logger.debug(`Could not queue !${z} for auto-merge: ${M(F)}`),!1}}async getPullRequestChecksState(z){let F=(await this.optional("GET",`/projects/${this.projectId}/merge_requests/${z}/pipelines`))?.[0]?.status;if(!F)return"none";if(F==="success")return"success";if(["failed","canceled"].includes(F))return"failure";if(["running","pending","created","waiting_for_resource","preparing","scheduled"].includes(F))return"pending";return"none"}async createReview(z,A){if(await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/notes`,{body:A.body}),!A.comments?.length)return{posted:!0,inlineComments:0};let G=(await this.optional("GET",`/projects/${this.projectId}/merge_requests/${z}/versions`))?.[0];if(!G)return this.logger.warn("\u26A0\uFE0F Could not resolve diff positions; inline comments were not posted"),{posted:!0,inlineComments:0};let H=0;for(let J of A.comments)try{await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/discussions`,{body:J.body,position:{position_type:"text",base_sha:G.base_commit_sha,start_sha:G.start_commit_sha,head_sha:G.head_commit_sha,new_path:J.path,old_path:J.path,...J.side==="RIGHT"?{new_line:J.line}:{old_line:J.line}}}),H++}catch(K){this.logger.debug(`Could not place a comment on ${J.path}:${J.line}: ${M(K)}`)}return{posted:!0,inlineComments:H}}async createCheckRun(z,A,F){try{await this.request("POST",`/projects/${this.projectId}/statuses/${A}`,{state:F.conclusion==="failure"?"failed":"success",name:z,description:F.title.slice(0,140)})}catch(G){this.logger.warn(`\u26A0\uFE0F Could not report status ${z}: ${M(G)}`)}}async reactToComment(z,A){let F={eyes:"eyes","+1":"thumbsup","-1":"thumbsdown",rocket:"rocket",confused:"confused"};try{await this.request("POST",`/projects/${this.projectId}/notes/${z}/award_emoji`,{name:F[A]??"eyes"})}catch(G){this.logger.debug(`Could not react to note ${z}: ${M(G)}`)}}async hasWriteAccess(z){return(await this.optional("GET",`/projects/${this.projectId}/members/all?query=${encodeURIComponent(z)}`)??[]).some((F)=>F.username===z&&F.access_level>=30)}async getWorkflowRunLogs(z){return this.optional("GET",`/projects/${this.projectId}/jobs/${z}/trace`,{raw:!0}).catch((A)=>{return this.logger.debug(`Could not read the trace for job ${z}: ${M(A)}`),null})}async listWorkflowRuns(z,A={}){let F=A.limit??20;try{return(await this.request("GET",`/projects/${this.projectId}/jobs?per_page=${Math.min(F*5,100)}`)??[]).filter((H)=>H.ref===z).map((H)=>({id:H.id,name:H.name??"",headSha:H.commit?.id??"",headBranch:H.ref??z,status:X(H.status),conclusion:Y(H.status),createdAt:new Date(H.created_at??new Date().toISOString())})).filter((H)=>!A.status||H.status===A.status).slice(0,F)}catch(G){return this.logger.debug(`Could not list CI jobs for ${z}: ${M(G)}`),[]}}async rerunWorkflowRun(z){try{return await this.request("POST",`/projects/${this.projectId}/jobs/${z}/retry`),!0}catch(A){return this.logger.warn(`Could not retry job ${z}: ${M(A)}`),!1}}async listReviewThreads(z){try{return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/discussions?per_page=100`)??[]).filter((F)=>(F.notes??[]).some((G)=>G.resolvable)).map((F)=>({id:F.id,isResolved:(F.notes??[]).every((G)=>!G.resolvable||G.resolved),...F.notes?.[0]?.position?.new_path?{path:F.notes[0].position.new_path}:{},authorLogins:(F.notes??[]).map((G)=>G.author?.username).filter((G)=>typeof G==="string")}))}catch(A){return this.logger.debug(`Could not read discussions on !${z}: ${M(A)}`),[]}}async resolveReviewThread(z,A){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/discussions/${encodeURIComponent(A)}`,{resolved:!0}),!0}catch(F){return this.logger.warn(`Could not resolve discussion ${A}: ${M(F)}`),!1}}async getBuddyBranches(){return(await this.request("GET",`/projects/${this.projectId}/repository/branches?search=buddy&per_page=100`)).filter((A)=>V(A.name)).map((A)=>({name:A.name,sha:A.commit?.id??"",lastCommitDate:A.commit?.committed_date?new Date(A.commit.committed_date):new Date(0)}))}async getOrphanedBuddyBranches(){let[z,A]=await Promise.all([this.getBuddyBranches(),this.getPullRequests("open")]),F=new Set(A.map((G)=>G.head));return z.filter((G)=>!F.has(G.name))}async cleanupStaleBranches(z=7,A=!1){let F=new Date(Date.now()-z*24*60*60*1000),G=(await this.getOrphanedBuddyBranches()).filter((K)=>K.lastCommitDate<F);if(A)return{deleted:G.map((K)=>K.name),failed:[]};let H=[],J=[];for(let K of G)try{await this.deleteBranch(K.name),H.push(K.name)}catch{J.push(K.name)}return{deleted:H,failed:J}}toPullRequest(z){let A=Boolean(z.draft??z.work_in_progress)||/^(?:draft|wip):/i.test(z.title);return{number:z.iid,title:z.title.replace(/^(?:draft|wip):\s*/i,""),body:z.description??"",head:z.source_branch,base:z.target_branch,state:z.state==="merged"?"merged":z.state==="opened"?"open":"closed",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.merged_at?{mergedAt:new Date(z.merged_at)}:{},author:z.author?.username??"",reviewers:(z.reviewers??[]).map((F)=>F.username),assignees:(z.assignees??[]).map((F)=>F.username),labels:z.labels??[],draft:A}}toIssue(z){return{number:z.iid,title:z.title,body:z.description??"",state:z.state==="closed"?"closed":"open",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.closed_at?{closedAt:new Date(z.closed_at)}:{},author:z.author?.username??"",assignees:(z.assignees??[]).map((A)=>A.username),labels:z.labels??[]}}}
5
- export{Z as Eh};
5
+ export{Z as Gh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ga as a,ha as b,ia as c,ja as d,ka as e,la as f,ma as g,na as h,oa as i,pa as j}from"./chunk-ejfyc7r8.js";import"./chunk-eaz23nsf.js";export{d as similarity,j as renderQuickLinks,b as renderPackageContext,h as parseQuickSelection,a as findMentionedPackages,e as findDuplicates,c as constrainLabels,i as clearQuickSelection,f as QUICK_LINKS_MARKER,g as QUICK_ACTIONS};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Hb as a,Ib as b,Jb as c,Kb as d,Lb as e}from"./chunk-wm6g7y1r.js";import"./chunk-eaz23nsf.js";export{d as upsertReviewState,b as serializeReviewState,c as parseReviewState,e as needsReview,a as REVIEW_STATE_VERSION};
@@ -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-2z54h4e9.js";import"./chunk-wkjv03yr.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{m as withNarrative,n as shouldPublishReport,l as renderReport,c as parseHistory,f as loadHistory,e as findPrevious,i as computeMetrics,j as computeDeltas,d as appendHistory,g as REPORT_PERIODS,k as REPORT_MARKER,h as PERIOD_DAYS,a as HISTORY_PATH,b as HISTORY_LIMIT};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{pg as a,qg as b,rg as c,sg as d,tg as e,ug as f,vg as g,wg as h,xg as i,yg as j,zg as k}from"./chunk-x9vpk4kk.js";import"./chunk-16aeend1.js";export{h as withManifest,g as stripManifest,c as serializeManifest,d as serializeGroupManifest,e as parseManifest,i as manifestUpdates,j as manifestFiles,f as hasManifest,k as findGroupForPullRequest,a as MANIFEST_SCHEMA_VERSION,b as MANIFEST_MAX_LENGTH};
2
+ import{pg as a,qg as b,rg as c,sg as d,tg as e,ug as f,vg as g,wg as h,xg as i,yg as j,zg as k}from"./chunk-x9vpk4kk.js";import"./chunk-eaz23nsf.js";export{h as withManifest,g as stripManifest,c as serializeManifest,d as serializeGroupManifest,e as parseManifest,i as manifestUpdates,j as manifestFiles,f as hasManifest,k as findGroupForPullRequest,a as MANIFEST_SCHEMA_VERSION,b as MANIFEST_MAX_LENGTH};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Vf as K,Xf as T,Yf as S,Zf as F}from"./chunk-z18bksyr.js";import{Lh as N}from"./chunk-s0ps33ft.js";import{Rh as C}from"./chunk-wzncz6j5.js";import{gl as _}from"./chunk-16aeend1.js";var x={claude:"claude-opus-5","claude-opus":"claude-opus-5",opus:"claude-opus-5","claude-sonnet":"claude-sonnet-5",sonnet:"claude-sonnet-5","claude-haiku":"claude-haiku-4-5",haiku:"claude-haiku-4-5","claude-fable":"claude-fable-5",fable:"claude-fable-5"},L={anthropic:"claude-opus-5"},w={anthropic:["ANTHROPIC_API_KEY"],openai:["OPENAI_API_KEY"],google:["GOOGLE_API_KEY","GEMINI_API_KEY"],openrouter:["OPENROUTER_API_KEY"],"openai-compatible":["OPENAI_COMPATIBLE_API_KEY","OPENAI_API_KEY"]},D=["anthropic","openai","google","openrouter"];function M(j){return x[j.toLowerCase().trim()]??j}var b=16000;function k(j){let Z;async function $(){if(Z)return Z;let H;try{H=(await import("./chunk-sddaassq.js")).default}catch{throw new F(`The Anthropic provider needs @anthropic-ai/sdk, which is an optional peer dependency.
2
+ import{Vf as K,Xf as T,Yf as S,Zf as F}from"./chunk-z18bksyr.js";import{Nh as N}from"./chunk-kqwdg3nw.js";import{Th as C}from"./chunk-56t2za4k.js";import{il as _}from"./chunk-eaz23nsf.js";var x={claude:"claude-opus-5","claude-opus":"claude-opus-5",opus:"claude-opus-5","claude-sonnet":"claude-sonnet-5",sonnet:"claude-sonnet-5","claude-haiku":"claude-haiku-4-5",haiku:"claude-haiku-4-5","claude-fable":"claude-fable-5",fable:"claude-fable-5"},L={anthropic:"claude-opus-5"},w={anthropic:["ANTHROPIC_API_KEY"],openai:["OPENAI_API_KEY"],google:["GOOGLE_API_KEY","GEMINI_API_KEY"],openrouter:["OPENROUTER_API_KEY"],"openai-compatible":["OPENAI_COMPATIBLE_API_KEY","OPENAI_API_KEY"]},D=["anthropic","openai","google","openrouter"];function M(j){return x[j.toLowerCase().trim()]??j}var b=16000;function k(j){let Z;async function $(){if(Z)return Z;let H;try{H=(await import("./chunk-mm9b9pwb.js")).default}catch{throw new F(`The Anthropic provider needs @anthropic-ai/sdk, which is an optional peer dependency.
3
3
  Install it with: bun add @anthropic-ai/sdk`,"anthropic")}return Z=new H({apiKey:j.apiKey,...j.baseUrl?{baseURL:j.baseUrl}:{}}),Z}return{name:"anthropic",async complete(H,G){let W={};if(H.effort)W.effort=H.effort;if(H.jsonSchema)W.format={type:"json_schema",schema:H.jsonSchema};let z=await(await $()).messages.create({model:G,max_tokens:H.maxTokens??b,...H.system?{system:H.system}:{},messages:H.messages.map((Q)=>({role:Q.role,content:Q.content})),...H.tools?.length?{tools:H.tools.map((Q)=>({name:Q.name,description:Q.description,input_schema:Q.parameters}))}:{},...Object.keys(W).length>0?{output_config:W}:{}}),X="",J=[];for(let Q of z.content)if(Q.type==="text")X+=Q.text;else if(Q.type==="tool_use")J.push({id:Q.id,name:Q.name,input:Q.input});return{text:X,toolCalls:J,json:y(X,H.jsonSchema!==void 0),stopReason:P(z.stop_reason),usage:{inputTokens:z.usage.input_tokens,outputTokens:z.usage.output_tokens,...z.usage.cache_read_input_tokens!=null?{cachedInputTokens:z.usage.cache_read_input_tokens}:{}},model:z.model}}}}function P(j){switch(j){case"end_turn":case"stop_sequence":return"end";case"tool_use":return"tool_use";case"max_tokens":return"max_tokens";case"refusal":return"refusal";default:return"other"}}function y(j,Z){if(!Z)return;try{return JSON.parse(j)}catch{throw new F("Model returned malformed JSON for a schema-constrained request","anthropic")}}var f=16000,A="https://generativelanguage.googleapis.com/v1beta";function U(j){let Z=(j.baseUrl??A).replace(/\/+$/,"");return{name:"google",async complete($,H){let G={contents:$.messages.map((Y)=>({role:Y.role==="assistant"?"model":"user",parts:[{text:Y.content}]})),generationConfig:{maxOutputTokens:$.maxTokens??f,...$.jsonSchema?{responseMimeType:"application/json",responseSchema:$.jsonSchema}:{}}};if($.system)G.systemInstruction={parts:[{text:$.system}]};if($.tools?.length)G.tools=[{functionDeclarations:$.tools.map((Y)=>({name:Y.name,description:Y.description,parameters:Y.parameters}))}];let W=await N(`${Z}/models/${encodeURIComponent(H)}:generateContent`,{method:"POST",headers:{"x-goog-api-key":j.apiKey,"Content-Type":"application/json"},body:JSON.stringify(G)});if(!W.ok){let Y=await W.text().catch(()=>"");throw new F(`google request failed: ${W.status} ${W.statusText} ${K(Y.slice(0,500))}`.trim(),"google",W.status)}let z=await W.json(),X=z.candidates?.[0],J="",Q=[];for(let[Y,V]of(X?.content?.parts??[]).entries()){if(V.text)J+=V.text;if(V.functionCall?.name)Q.push({id:`${V.functionCall.name}-${Y}`,name:V.functionCall.name,input:V.functionCall.args??{}})}return{text:J,toolCalls:Q,json:$.jsonSchema?h(J):void 0,stopReason:E(X?.finishReason,Q.length>0),usage:{inputTokens:z.usageMetadata?.promptTokenCount??0,outputTokens:z.usageMetadata?.candidatesTokenCount??0,...z.usageMetadata?.cachedContentTokenCount!=null?{cachedInputTokens:z.usageMetadata.cachedContentTokenCount}:{}},model:z.modelVersion??H}}}}function E(j,Z){if(Z)return"tool_use";switch(j){case"STOP":return"end";case"MAX_TOKENS":return"max_tokens";case"SAFETY":case"PROHIBITED_CONTENT":case"BLOCKLIST":return"refusal";default:return"other"}}function h(j){try{return JSON.parse(j)}catch{throw new F("Model returned malformed JSON for a schema-constrained request","google")}}var g=16000,v="https://api.openai.com/v1",m="https://openrouter.ai/api/v1";function O(j){let Z=j.provider??"openai",$=(j.baseUrl??q(Z)).replace(/\/+$/,"");return{name:Z,async complete(H,G){let W=[];if(H.system)W.push({role:"system",content:H.system});for(let B of H.messages)W.push({role:B.role,content:B.content});let z={model:G,messages:W,max_completion_tokens:H.maxTokens??g};if(H.tools?.length)z.tools=H.tools.map((B)=>({type:"function",function:{name:B.name,description:B.description,parameters:B.parameters}}));if(H.jsonSchema)z.response_format={type:"json_schema",json_schema:{name:"response",schema:H.jsonSchema,strict:!0}};if(H.effort)z.reasoning_effort=H.effort;let X={Authorization:`Bearer ${j.apiKey}`,"Content-Type":"application/json"};if(Z==="openrouter")X["HTTP-Referer"]="https://github.com/stacksjs/buddy",X["X-Title"]="buddy";let J=await N(`${$}/chat/completions`,{method:"POST",headers:X,body:JSON.stringify(z)});if(!J.ok){let B=await J.text().catch(()=>"");throw new F(`${Z} request failed: ${J.status} ${J.statusText} ${K(B.slice(0,500))}`.trim(),Z,J.status)}let Q=await J.json(),Y=Q.choices?.[0],V=Y?.message?.content??"",I=(Y?.message?.tool_calls??[]).map((B)=>({id:B.id,name:B.function?.name??"",input:p(B.function?.arguments,Z)}));return{text:V,toolCalls:I,json:H.jsonSchema?d(V,Z):void 0,stopReason:c(Y?.finish_reason,I.length>0),usage:{inputTokens:Q.usage?.prompt_tokens??0,outputTokens:Q.usage?.completion_tokens??0,...Q.usage?.prompt_tokens_details?.cached_tokens!=null?{cachedInputTokens:Q.usage.prompt_tokens_details.cached_tokens}:{}},model:Q.model??G}}}}function q(j){return j==="openrouter"?m:v}function c(j,Z){if(Z||j==="tool_calls")return"tool_use";switch(j){case"stop":return"end";case"length":return"max_tokens";case"content_filter":return"refusal";default:return"other"}}function p(j,Z){if(!j)return{};try{return JSON.parse(j)}catch{throw new F("Model returned malformed JSON tool arguments",Z)}}function d(j,Z){try{return JSON.parse(j)}catch{throw new F("Model returned malformed JSON for a schema-constrained request",Z)}}import R from"process";function u(j,Z=R.env){let $=j.ai;if($?.enabled===!1)return null;let H=$?.provider?[$.provider]:D;for(let G of H){let W=i(G,$?.apiKeyEnv,Z);if(!W)continue;let{key:z,source:X}=W,J=a(G,$?.model);if(!J)continue;return{provider:G,model:J,apiKey:z,apiKeyEnv:X,...$?.baseUrl?{baseUrl:$.baseUrl}:{}}}return null}function Vj(j,Z=C()){let $=u(j);if(!$)return Z.debug("AI disabled: no provider configured with an available API key"),null;let H=n($),G=j.ai?.maxTokensPerRun,W=j.ai?.effort,z=0;return{provider:$.provider,model:$.model,get tokensUsed(){return z},async complete(X){if(G!==void 0&&z>=G)throw new S(z,G);let J=X.model?M(X.model):$.model;try{let Q=await H.complete({...X,effort:X.effort??W},J);return z+=Q.usage.outputTokens,Z.debug(`AI ${$.provider}/${Q.model}: ${Q.usage.inputTokens} in, ${Q.usage.outputTokens} out (${Q.stopReason})`),Q}catch(Q){if(Q instanceof S)throw Q;let Y=T(Q);throw Z.warn(`\u26A0\uFE0F AI request failed (${$.provider}): ${Y}`),Q instanceof F?Q:new F(Y,$.provider)}}}}function n(j){switch(j.provider){case"anthropic":return k({apiKey:j.apiKey,baseUrl:j.baseUrl});case"google":return U({apiKey:j.apiKey,baseUrl:j.baseUrl});case"openai":case"openrouter":case"openai-compatible":return O({apiKey:j.apiKey,baseUrl:j.baseUrl,provider:j.provider})}}function i(j,Z,$){let H=Z?[Z,...w[j]]:w[j];for(let G of H){let W=$[G];if(W&&W.trim().length>0)return{key:W.trim(),source:G}}return}function a(j,Z){let $=R.env.BUDDY_MODEL||Z;if($)return M($);return L[j]}
4
4
  export{x as Zb,w as _b,D as $b,M as ac,k as bc,U as cc,O as dc,u as ec,Vj as fc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ud as a}from"./chunk-g482e1b0.js";import"./chunk-3zp7a103.js";import"./chunk-d2vrstjq.js";import"./chunk-w3ktf7th.js";import"./chunk-x9vpk4kk.js";import"./chunk-5107xbwj.js";import"./chunk-2z9mh5y4.js";import"./chunk-yh13j2af.js";import"./chunk-kqwdg3nw.js";import"./chunk-56t2za4k.js";import"./chunk-drn3hq53.js";import"./chunk-eaz23nsf.js";export{a as RegistryClient};
@@ -1,5 +1,5 @@
1
1
  // @bun
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}
2
+ import{fc as F}from"./chunk-97857d8t.js";import{Cf as c}from"./chunk-1pecmenc.js";import{Of as E,Rf as A}from"./chunk-rb6gzts6.js";import{Th as m}from"./chunk-56t2za4k.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
- `),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};
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 Da,C as Ea};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ae as d,Be as e,Ce as f,De as g,Ee as h,xe as a,ye as b,ze as c}from"./chunk-wk175yyw.js";import"./chunk-yh13j2af.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{e as updateGitHubActionsFile,d as sameActionVersion,b as parseGitHubActionsFile,a as isGitHubActionsFile,c as isCommitSha,f as generateGitHubActionsUpdates,h as fetchLatestActionVersion,g as fetchActionTagCommit};
2
+ import{Ae as d,Be as e,Ce as f,De as g,Ee as h,xe as a,ye as b,ze as c}from"./chunk-0baffydm.js";import"./chunk-yh13j2af.js";import"./chunk-kqwdg3nw.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{e as updateGitHubActionsFile,d as sameActionVersion,b as parseGitHubActionsFile,a as isGitHubActionsFile,c as isCommitSha,f as generateGitHubActionsUpdates,h as fetchLatestActionVersion,g as fetchActionTagCommit};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Cb as a,Db as b}from"./chunk-t74w5ddy.js";import"./chunk-q2tjkhez.js";import"./chunk-wm6g7y1r.js";import"./chunk-xaw1yts1.js";import"./chunk-97857d8t.js";import"./chunk-n2de4spv.js";import"./chunk-142zh7e5.js";import"./chunk-p09rsh3z.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-kqwdg3nw.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{b as runReviewForPR,a as reviewPullRequest};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-16aeend1.js";var $={error:"\x1B[31m",warning:"\x1B[33m",info:"\x1B[34m"},R={error:"error",warning:"warn ",info:"info "};function a(i,g={}){let l=g.color??!0,r=(n,t)=>l?`${n}${t}\x1B[0m`:t;if(i.workflows.length===0)return r("\x1B[90m","buddy security: no workflows found under .github/workflows.");if(i.findings.length===0)return r("\x1B[32m",`buddy security: ${i.workflows.length} workflow${i.workflows.length===1?"":"s"} clean.`);let e=new Map;for(let n of i.findings){if(!e.has(n.file))e.set(n.file,[]);e.get(n.file).push(n)}let s=[];for(let[n,t]of e){s.push(r("\x1B[1m",n));for(let o of t){let u=r($[o.severity],R[o.severity]),w=o.line!==void 0?r("\x1B[90m",`:${o.line}`):"",E=r("\x1B[90m",`(${o.ruleId})`);if(s.push(` ${u}${w} ${o.message} ${E}`),o.detail)s.push(r("\x1B[2m",` ${o.detail}`));if(o.fix)s.push(r("\x1B[2m",` fix: ${o.fix}`))}s.push("")}let f=i.findings.filter((n)=>n.severity==="error").length,c=i.findings.filter((n)=>n.severity==="warning").length,d=`${f} error${f===1?"":"s"}, ${c} warning${c===1?"":"s"} across ${e.size} workflow${e.size===1?"":"s"}`;return s.push(r(i.failed?"\x1B[31m":"\x1B[33m",d)),s.join(`
2
+ import"./chunk-eaz23nsf.js";var $={error:"\x1B[31m",warning:"\x1B[33m",info:"\x1B[34m"},R={error:"error",warning:"warn ",info:"info "};function a(i,g={}){let l=g.color??!0,r=(n,t)=>l?`${n}${t}\x1B[0m`:t;if(i.workflows.length===0)return r("\x1B[90m","buddy security: no workflows found under .github/workflows.");if(i.findings.length===0)return r("\x1B[32m",`buddy security: ${i.workflows.length} workflow${i.workflows.length===1?"":"s"} clean.`);let e=new Map;for(let n of i.findings){if(!e.has(n.file))e.set(n.file,[]);e.get(n.file).push(n)}let s=[];for(let[n,t]of e){s.push(r("\x1B[1m",n));for(let o of t){let u=r($[o.severity],R[o.severity]),w=o.line!==void 0?r("\x1B[90m",`:${o.line}`):"",E=r("\x1B[90m",`(${o.ruleId})`);if(s.push(` ${u}${w} ${o.message} ${E}`),o.detail)s.push(r("\x1B[2m",` ${o.detail}`));if(o.fix)s.push(r("\x1B[2m",` fix: ${o.fix}`))}s.push("")}let f=i.findings.filter((n)=>n.severity==="error").length,c=i.findings.filter((n)=>n.severity==="warning").length,d=`${f} error${f===1?"":"s"}, ${c} warning${c===1?"":"s"} across ${e.size} workflow${e.size===1?"":"s"}`;return s.push(r(i.failed?"\x1B[31m":"\x1B[33m",d)),s.join(`
3
3
  `)}export{a as formatPretty};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Fg as mc,Gg as nc,Hg as oc,Ig as pc,Jg as qc,Kg as rc,Lg as sc,Mg as tc,Ng as uc,Og as vc,Pg as wc,Qg as xc,Rg as yc,Sg as zc,Tg as Ac,Ug as Bc,Vg as Cc,Wg as Dc,Xg as Ec,Yg as Fc}from"./chunk-2z9mh5y4.js";import{$h as i,$i as ha,$j as hb,$k as hc,Ai as I,Aj as Ia,Ak as Ib,Bi as J,Bj as Ja,Bk as Jb,Ci as K,Cj as Ka,Ck as Kb,Di as L,Dj as La,Dk as Lb,Ei as M,Ej as Ma,Ek as Mb,Fi as N,Fj as Na,Fk as Nb,Gi as O,Gj as Oa,Gk as Ob,Hi as P,Hj as Pa,Hk as Pb,Ii as Q,Ij as Qa,Ik as Qb,Ji as R,Jj as Ra,Jk as Rb,Ki as S,Kj as Sa,Kk as Sb,Li as T,Lj as Ta,Lk as Tb,Mi as U,Mj as Ua,Mk as Ub,Ni as V,Nj as Va,Nk as Vb,Oi as W,Oj as Wa,Ok as Wb,Pi as X,Pj as Xa,Pk as Xb,Qi as Y,Qj as Ya,Qk as Yb,Ri as Z,Rj as Za,Rk as Zb,Sh as a,Si as _,Sj as _a,Sk as _b,Th as b,Ti as $,Tj as $a,Tk as $b,Uh as c,Ui as aa,Uj as ab,Uk as ac,Vi as ba,Vj as bb,Vk as bc,Wh as d,Wi as ca,Wj as cb,Wk as cc,Xh as e,Xi as da,Xj as db,Xk as dc,Yh as f,Yi as ea,Yj as eb,Yk as ec,Zh as g,Zi as fa,Zj as fb,Zk as fc,_h as h,_i as ga,_j as gb,_k as gc,ai as j,aj as ia,ak as ib,al as ic,bi as k,bj as ja,bk as jb,bl as jc,ci as l,cj as ka,ck as kb,cl as kc,di as m,dj as la,dk as lb,dl as lc,ei as n,ej as ma,ek as mb,fi as o,fj as na,fk as nb,gi as p,gj as oa,gk as ob,hi as q,hj as pa,hk as pb,ii as r,ij as qa,ik as qb,ji as s,jj as ra,jk as rb,ki as t,kj as sa,kk as sb,li as u,lj as ta,lk as tb,mi as v,mj as ua,mk as ub,ni as w,nj as va,nk as vb,oi as x,oj as wa,ok as wb,pi as y,pj as xa,pk as xb,qi as z,qj as ya,qk as yb,ri as A,rj as za,rk as zb,si as B,sj as Aa,sk as Ab,ti as C,tj as Ba,tk as Bb,ui as D,uj as Ca,uk as Cb,vj as Da,vk as Db,wi as E,wj as Ea,wk as Eb,xi as F,xj as Fa,xk as Fb,yi as G,yj as Ga,yk as Gb,zi as H,zj as Ha,zk as Hb}from"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{Ta as ziglangOfficialDownload,ab as zigRegistryMirror,bb as zigPurgedDevBuildHint,eb as zigOriginVersions,Wb as writeOciLayout,Xb as writeDockerArchive,Cc as withTempDirSync,Bc as withTempDir,yc as withRedis,uc as withPostgres,qc as withMysql,ic as waitForAppStoreBuilds,ac as verifyBlob,n as validatePackageSpec,Aa as validatePackage,sa as v,xc as useRedis,tc as usePostgres,pc as useMysql,zb as updatePackageVersionMap,ca as updateApp,sb as uninstallShellInit,ub as toTypeName,tb as toSafeVarName,vb as toPackageVarName,Fc as testingRuntime,mb as supportedPackages,wc as stopRedis,sc as stopPostgres,oc as stopMysql,vc as startRedis,rc as startPostgres,S as startPeriodicCleanup,nc as startMysql,Ua as sqliteOfficialDownloadUrl,va as showPackageInfo,x as shouldProceedWithGitHubRequest,R as setupCleanupHandlers,Ub as serializeConfig,wa as searchPackagesCommand,j as searchPackages,V as scanPantryPackages,$ as scanInstalledApps,N as saveToCacheAndOutput,w as saveRateLimitInfo,K as savePackageAsTypeScript,z as saveGitHubPackageCache,db as satisfiesInstallerConstraint,ib as retryNetworkOperation,q as resolveVersionFromMetadata,Ka as resolveVersionConstraint,h as resolveVersion,Ma as resolveTransitiveDependencies,ka as resolvePackageName,G as resolvePackageDomain,Cb as resolvePackageDependencies,Xa as resolveLatestVersion,gb as resolveInstallerConstraintFromCandidates,Oa as resolveDependencyFile,Bb as resolveDependenciesFromYaml,Ab as resolveDependencies,Mb as resolveBuildStages,qb as renderShellSnippet,dc as renderDockerfile,Ac as removeTempDir,Za as registryVersionsForPlatform,Ya as registryPlatformKey,_a as registryDownloadSource,Eb as readProjectDependencies,W as readPantryPackageInfo,pb as rcFileFor,$b as pushImage,_b as pullImage,jc as provisionMacApp,ta as pkg,o as parseVersion,la as parsePackageSpec,cb as parseInstallerConstraint,Zb as parseImageRef,Nb as parseFreezer,Lb as parseExecForm,Kb as parseDockerfile,Ia as parseDepsYamlConfig,Ha as parseDependencyFile,b as pantry,c as packages,Qa as normalizeInstallerVersion,B as logPkgxProjects,Pb as loadFreezer,xa as listPopularPackages,za as listAliases,ya as listActivePackages,g as isVersionAvailable,fa as isValidPackageName,ga as isSupportedPlatform,ha as isSupportedArchitecture,kb as isSupported,hb as isRetryableNetworkError,ra as isPackageInCategory,ea as isPackageDomain,da as isPackageAlias,_ as isNewerVersion,I as isKnownAlias,lb as isInstallable,$a as installedRegistryBinaries,rb as installShellInit,Wa as installPackages,Va as installPackage,F as guessOriginalDomain,Ra as globalBinDir,Ca as getVersionInfo,M as getValidCachedPackage,Ga as getSystemInfo,nb as getPrimaryBinary,l as getPopularPackages,f as getPhpVersionsForWorkflow,k as getPackagesByPattern,qa as getPackagesByCategory,i as getPackageInfo,H as getPackageAliases,d as getLatestVersion,Db as getInstallCommand,y as getGitHubPackageCache,J as getCanonicalDomain,Ja as getAvailableVersionsForPackage,e as getAvailableVersions,ja as getAllPackageDomains,ia as getAllPackageAliases,m as getActivePackages,kc as generateMacCertificateRequests,wb as generateIndex,yb as generateDocs,ec as generateContainerFiles,xb as generateAliases,Ea as formatSearchResults,ma as formatPackageSpec,Da as formatPackageInfo,C as formatObjectWithoutQuotedKeys,Fa as formatInstallPlan,Pa as findDependencyFiles,P as fetchPkgxProjects,X as fetchPantryPackageWithMetadata,Q as fetchPantryPackage,A as fetchPackageListFromGitHub,aa as fetchDesktopCatalogue,U as fetchAndSavePackage,T as fetchAndSaveAllPackages,bc as extractLayer,lc as exportAppleCertificateP12,hc as ensureAppStoreVersions,jb as downloadFileReliably,Sb as digestHex,Rb as digest,ob as detectShell,Sa as detectPlatform,ua as dependencies,Ib as definePantryConfig,Gb as definePackageList,Fb as defineDependencies,Na as deduplicateDependencies,Dc as createTestFile,Ec as createTestDir,zc as createTempDir,Ob as createMatcher,na as createInstallationContext,Ba as createInstallPlan,D as convertDomainToVarName,E as convertDomainToFileName,p as compareVersionsDesc,La as compareVersions,fb as compareInstallerVersionsDesc,Jb as collectBuildContext,O as cleanupBrowserResources,L as cleanStaleOutputFiles,ba as checkAppUpdates,Vb as buildManifest,Tb as buildLayerFromRootfs,cc as buildImage,fc as appStoreConnectToken,a as aliases,oa as VERSION_SPECS,Y as SYSTEM_APPS,mc as PantryService,Yb as PANTRY_REGISTRY,pa as PACKAGE_CATEGORIES,u as PACKAGE_ALIASES,Qb as MEDIA_TYPE,Z as MAS_APPS,Hb as DISTRIBUTION_CONFIG,t as DEFAULT_TIMEOUT_MS,s as DEFAULT_CACHE_EXPIRATION_MINUTES,r as DEFAULT_CACHE_DIR,gc as AppStoreConnectClient,v as ALL_KNOWN_PACKAGES};
2
+ import{Fg as mc,Gg as nc,Hg as oc,Ig as pc,Jg as qc,Kg as rc,Lg as sc,Mg as tc,Ng as uc,Og as vc,Pg as wc,Qg as xc,Rg as yc,Sg as zc,Tg as Ac,Ug as Bc,Vg as Cc,Wg as Dc,Xg as Ec,Yg as Fc}from"./chunk-2z9mh5y4.js";import{$h as g,$i as fa,$j as fb,$k as fc,Ai as G,Aj as Ga,Ak as Gb,Bi as H,Bj as Ha,Bk as Hb,Ci as I,Cj as Ia,Ck as Ib,Di as J,Dj as Ja,Dk as Jb,Ei as K,Ej as Ka,Ek as Kb,Fi as L,Fj as La,Fk as Lb,Gi as M,Gj as Ma,Gk as Mb,Hi as N,Hj as Na,Hk as Nb,Ii as O,Ij as Oa,Ik as Ob,Ji as P,Jj as Pa,Jk as Pb,Ki as Q,Kj as Qa,Kk as Qb,Li as R,Lj as Ra,Lk as Rb,Mi as S,Mj as Sa,Mk as Sb,Ni as T,Nj as Ta,Nk as Tb,Oi as U,Oj as Ua,Ok as Ub,Pi as V,Pj as Va,Pk as Vb,Qi as W,Qj as Wa,Qk as Wb,Ri as X,Rj as Xa,Rk as Xb,Si as Y,Sj as Ya,Sk as Yb,Ti as Z,Tj as Za,Tk as Zb,Uh as a,Ui as _,Uj as _a,Uk as _b,Vh as b,Vi as $,Vj as $a,Vk as $b,Wh as c,Wi as aa,Wj as ab,Wk as ac,Xi as ba,Xj as bb,Xk as bc,Yh as d,Yi as ca,Yj as cb,Yk as cc,Zh as e,Zi as da,Zj as db,Zk as dc,_h as f,_i as ea,_j as eb,_k as ec,ai as h,aj as ga,ak as gb,al as gc,bi as i,bj as ha,bk as hb,bl as hc,ci as j,cj as ia,ck as ib,cl as ic,di as k,dj as ja,dk as jb,dl as jc,ei as l,ej as ka,ek as kb,el as kc,fi as m,fj as la,fk as lb,fl as lc,gi as n,gj as ma,gk as mb,hi as o,hj as na,hk as nb,ii as p,ij as oa,ik as ob,ji as q,jj as pa,jk as pb,ki as r,kj as qa,kk as qb,li as s,lj as ra,lk as rb,mi as t,mj as sa,mk as sb,ni as u,nj as ta,nk as tb,oi as v,oj as ua,ok as ub,pi as w,pj as va,pk as vb,qi as x,qj as wa,qk as wb,ri as y,rj as xa,rk as xb,si as z,sj as ya,sk as yb,ti as A,tj as za,tk as zb,ui as B,uj as Aa,uk as Ab,vi as C,vj as Ba,vk as Bb,wi as D,wj as Ca,wk as Cb,xj as Da,xk as Db,yi as E,yj as Ea,yk as Eb,zi as F,zj as Fa,zk as Fb}from"./chunk-drn3hq53.js";import"./chunk-eaz23nsf.js";export{Ta as ziglangOfficialDownload,ab as zigRegistryMirror,bb as zigPurgedDevBuildHint,eb as zigOriginVersions,Wb as writeOciLayout,Xb as writeDockerArchive,Cc as withTempDirSync,Bc as withTempDir,yc as withRedis,uc as withPostgres,qc as withMysql,ic as waitForAppStoreBuilds,ac as verifyBlob,n as validatePackageSpec,Aa as validatePackage,sa as v,xc as useRedis,tc as usePostgres,pc as useMysql,zb as updatePackageVersionMap,ca as updateApp,sb as uninstallShellInit,ub as toTypeName,tb as toSafeVarName,vb as toPackageVarName,Fc as testingRuntime,mb as supportedPackages,wc as stopRedis,sc as stopPostgres,oc as stopMysql,vc as startRedis,rc as startPostgres,S as startPeriodicCleanup,nc as startMysql,Ua as sqliteOfficialDownloadUrl,va as showPackageInfo,x as shouldProceedWithGitHubRequest,R as setupCleanupHandlers,Ub as serializeConfig,wa as searchPackagesCommand,j as searchPackages,V as scanPantryPackages,$ as scanInstalledApps,N as saveToCacheAndOutput,w as saveRateLimitInfo,K as savePackageAsTypeScript,z as saveGitHubPackageCache,db as satisfiesInstallerConstraint,ib as retryNetworkOperation,q as resolveVersionFromMetadata,Ka as resolveVersionConstraint,h as resolveVersion,Ma as resolveTransitiveDependencies,ka as resolvePackageName,G as resolvePackageDomain,Cb as resolvePackageDependencies,Xa as resolveLatestVersion,gb as resolveInstallerConstraintFromCandidates,Oa as resolveDependencyFile,Bb as resolveDependenciesFromYaml,Ab as resolveDependencies,Mb as resolveBuildStages,qb as renderShellSnippet,dc as renderDockerfile,Ac as removeTempDir,Za as registryVersionsForPlatform,Ya as registryPlatformKey,_a as registryDownloadSource,Eb as readProjectDependencies,W as readPantryPackageInfo,pb as rcFileFor,$b as pushImage,_b as pullImage,jc as provisionMacApp,ta as pkg,o as parseVersion,la as parsePackageSpec,cb as parseInstallerConstraint,Zb as parseImageRef,Nb as parseFreezer,Lb as parseExecForm,Kb as parseDockerfile,Ia as parseDepsYamlConfig,Ha as parseDependencyFile,b as pantry,c as packages,Qa as normalizeInstallerVersion,B as logPkgxProjects,Pb as loadFreezer,xa as listPopularPackages,za as listAliases,ya as listActivePackages,g as isVersionAvailable,fa as isValidPackageName,ga as isSupportedPlatform,ha as isSupportedArchitecture,kb as isSupported,hb as isRetryableNetworkError,ra as isPackageInCategory,ea as isPackageDomain,da as isPackageAlias,_ as isNewerVersion,I as isKnownAlias,lb as isInstallable,$a as installedRegistryBinaries,rb as installShellInit,Wa as installPackages,Va as installPackage,F as guessOriginalDomain,Ra as globalBinDir,Ca as getVersionInfo,M as getValidCachedPackage,Ga as getSystemInfo,nb as getPrimaryBinary,l as getPopularPackages,f as getPhpVersionsForWorkflow,k as getPackagesByPattern,qa as getPackagesByCategory,i as getPackageInfo,H as getPackageAliases,d as getLatestVersion,Db as getInstallCommand,y as getGitHubPackageCache,J as getCanonicalDomain,Ja as getAvailableVersionsForPackage,e as getAvailableVersions,ja as getAllPackageDomains,ia as getAllPackageAliases,m as getActivePackages,kc as generateMacCertificateRequests,wb as generateIndex,yb as generateDocs,ec as generateContainerFiles,xb as generateAliases,Ea as formatSearchResults,ma as formatPackageSpec,Da as formatPackageInfo,C as formatObjectWithoutQuotedKeys,Fa as formatInstallPlan,Pa as findDependencyFiles,P as fetchPkgxProjects,X as fetchPantryPackageWithMetadata,Q as fetchPantryPackage,A as fetchPackageListFromGitHub,aa as fetchDesktopCatalogue,U as fetchAndSavePackage,T as fetchAndSaveAllPackages,bc as extractLayer,lc as exportAppleCertificateP12,hc as ensureAppStoreVersions,jb as downloadFileReliably,Sb as digestHex,Rb as digest,ob as detectShell,Sa as detectPlatform,ua as dependencies,Ib as definePantryConfig,Gb as definePackageList,Fb as defineDependencies,Na as deduplicateDependencies,Dc as createTestFile,Ec as createTestDir,zc as createTempDir,Ob as createMatcher,na as createInstallationContext,Ba as createInstallPlan,D as convertDomainToVarName,E as convertDomainToFileName,p as compareVersionsDesc,La as compareVersions,fb as compareInstallerVersionsDesc,Jb as collectBuildContext,O as cleanupBrowserResources,L as cleanStaleOutputFiles,ba as checkAppUpdates,Vb as buildManifest,Tb as buildLayerFromRootfs,cc as buildImage,fc as appStoreConnectToken,a as aliases,oa as VERSION_SPECS,Y as SYSTEM_APPS,mc as PantryService,Yb as PANTRY_REGISTRY,pa as PACKAGE_CATEGORIES,u as PACKAGE_ALIASES,Qb as MEDIA_TYPE,Z as MAS_APPS,Hb as DISTRIBUTION_CONFIG,t as DEFAULT_TIMEOUT_MS,s as DEFAULT_CACHE_EXPIRATION_MINUTES,r as DEFAULT_CACHE_DIR,gc as AppStoreConnectClient,v as ALL_KNOWN_PACKAGES};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ud as R}from"./chunk-s3b3vrsj.js";import{re as F,se as A}from"./chunk-743mhx0e.js";import{Bf as S}from"./chunk-1pecmenc.js";import{Rf as L}from"./chunk-hk4d7rky.js";import{Oh as K,Rh as O}from"./chunk-wzncz6j5.js";import{gl as P}from"./chunk-16aeend1.js";var b=[{kind:"lockfile-drift",mechanical:!0,patterns:[/lockfile had changes, but lockfile is frozen/i,/your lockfile does not satisfy your workspace/i,/the lockfile (?:is|was) out of date/i,/npm ci can only install packages when your package\.json and package-lock\.json .* are in sync/i,/composer\.lock is not up to date/i]},{kind:"flake",mechanical:!0,patterns:[/\bECONNRESET\b|\bETIMEDOUT\b|\bENOTFOUND\b|\bEAI_AGAIN\b/,/socket hang up/i,/502 Bad Gateway|503 Service Unavailable|504 Gateway Time-?out/i,/rate limit exceeded/i,/the runner has received a shutdown signal/i]},{kind:"install",mechanical:!1,patterns:[/could not resolve (?:dependency|host)/i,/no matching version found for/i,/unable to resolve dependency tree/i,/peer dep(?:endency)? .* conflict/i]},{kind:"type-error",mechanical:!1,patterns:[/error TS\d{4}:/,/\berror\[E\d+\]:/,/Type '.*' is not assignable to type/]},{kind:"test-failure",mechanical:!1,patterns:[/\d+ (?:tests? )?fail(?:ed|ing)\b/i,/\(fail\)/,/AssertionError|expect\(received\)/,/\u25CF .* \u203A /]},{kind:"lint",mechanical:!1,patterns:[/\b\d+ problems? \(\d+ errors?/i,/eslint|pickier|biome|oxlint/i]}];function N(x){if(!x.trim())return{kind:"unknown",mechanical:!1,evidence:[]};let H=x.split(`
2
+ import{Ed as R}from"./chunk-dbhgxe35.js";import{re as F,se as A}from"./chunk-p09rsh3z.js";import{Bf as S}from"./chunk-1pecmenc.js";import{Rf as L}from"./chunk-rb6gzts6.js";import{Qh as K,Th as O}from"./chunk-56t2za4k.js";import{il as P}from"./chunk-eaz23nsf.js";var b=[{kind:"lockfile-drift",mechanical:!0,patterns:[/lockfile had changes, but lockfile is frozen/i,/your lockfile does not satisfy your workspace/i,/the lockfile (?:is|was) out of date/i,/npm ci can only install packages when your package\.json and package-lock\.json .* are in sync/i,/composer\.lock is not up to date/i]},{kind:"flake",mechanical:!0,patterns:[/\bECONNRESET\b|\bETIMEDOUT\b|\bENOTFOUND\b|\bEAI_AGAIN\b/,/socket hang up/i,/502 Bad Gateway|503 Service Unavailable|504 Gateway Time-?out/i,/rate limit exceeded/i,/the runner has received a shutdown signal/i]},{kind:"install",mechanical:!1,patterns:[/could not resolve (?:dependency|host)/i,/no matching version found for/i,/unable to resolve dependency tree/i,/peer dep(?:endency)? .* conflict/i]},{kind:"type-error",mechanical:!1,patterns:[/error TS\d{4}:/,/\berror\[E\d+\]:/,/Type '.*' is not assignable to type/]},{kind:"test-failure",mechanical:!1,patterns:[/\d+ (?:tests? )?fail(?:ed|ing)\b/i,/\(fail\)/,/AssertionError|expect\(received\)/,/\u25CF .* \u203A /]},{kind:"lint",mechanical:!1,patterns:[/\b\d+ problems? \(\d+ errors?/i,/eslint|pickier|biome|oxlint/i]}];function N(x){if(!x.trim())return{kind:"unknown",mechanical:!1,evidence:[]};let H=x.split(`
3
3
  `);for(let z of b){let J=[];for(let V of H)if(z.patterns.some((Q)=>Q.test(V))){if(J.push(V.trim()),J.length>=5)break}if(J.length>0)return{kind:z.kind,mechanical:z.mechanical,evidence:J}}return{kind:"unknown",mechanical:!1,evidence:T(H)}}function T(x,H=40){let z=x.filter((J)=>/\b(?:error|failed|failure|exception|panic|fatal)\b/i.test(J)&&!/^\s*(?:at\s|\s*\.\.\.)/.test(J));return(z.length>0?z:x.slice(-H)).slice(-H).map((J)=>J.trim()).filter(Boolean)}function G(x){switch(x.kind){case"lockfile-drift":return"The lock file is out of step with its manifest.";case"flake":return"A network or runner problem, unrelated to the change.";case"install":return"Dependencies could not be resolved.";case"type-error":return"The change does not type-check.";case"test-failure":return"One or more tests failed.";case"lint":return"Lint or formatting checks failed.";default:return"The failure could not be classified automatically."}}var w=3;async function M(x,H,z,J){let V=J??O();try{let Q=await x.listWorkflowRuns(H,{status:"completed",limit:20});for(let Y of _(Q).slice(0,w)){let Z=await x.getWorkflowRunLogs(Y.id);if(!Z)continue;if(N(Z).kind===z)return V.info(`\uD83E\uDDED ${H} already fails the same way (run ${Y.id}) \u2014 not this pull request's to fix`),!0}return!1}catch(Q){return V.debug(`Could not check ${H} for a pre-existing failure: ${K(Q)}`),!1}}function _(x){let H=new Map;for(let z of x)if(!H.has(z.name))H.set(z.name,z);return[...H.values()].filter((z)=>z.conclusion==="failure")}function h(x,H){if(!x)return"Tried to regenerate the lock file, but the install did not succeed.";if(!H)return"Regenerated the lock file, but could not push it to the branch. The change is in the workspace only, so the run will still be red until someone commits it.";return"Regenerated the lock file and pushed the result. No model was needed."}function f(x){let H="Repairs run on the pull request's branch, and answering a comment runs on the default branch, so anything I changed here would land on the wrong tree. ";if(x.kind==="lockfile-drift")return`Regenerating the lock file would fix this, and no model would be needed. ${H}The \`fix-ci\` job will do it on the next failing run, or you can run \`buddy fix-ci --run-id <id> --pr <number>\` yourself.`;return`${H}The \`fix-ci\` job runs on the failing run itself and can repair this; this reply is the diagnosis it would start from.`}async function I(x){let H=x.logger??O(),z=N(x.log),J=x.maxAttempts??3;if(H.info(`\uD83E\uDE7A CI failure classified as ${z.kind}`),x.failsOnBase??(x.checkBase?await x.checkBase(z.kind):!1))return{failure:z,action:"skipped",fixed:!1,report:$(z,"This failure also occurs on the base branch, so it is not caused by this change. Fixing it here would only mask it.")};if((x.priorAttempts??0)>=J)return{failure:z,action:"skipped",fixed:!1,report:$(z,`Already attempted ${x.priorAttempts} time(s); stopping rather than looping.`)};if(x.analysisOnly&&z.kind!=="flake")return{failure:z,action:"reported",fixed:!1,report:$(z,f(z))};if(z.kind==="lockfile-drift"&&x.regenerateLockfile){if(x.dryRun)return{failure:z,action:"mechanical-fix",fixed:!1,report:$(z,"Regenerating the lock file would fix this. No model would be needed. Nothing was changed, because this was a dry run.")};H.info("\uD83D\uDD27 Regenerating the lock file");let{regenerated:Y,pushed:Z}=await x.regenerateLockfile();return{failure:z,action:"mechanical-fix",fixed:Z,report:$(z,h(Y,Z))}}if(z.kind==="flake"){if(x.dryRun)return{failure:z,action:"retry",fixed:!1,report:$(z,"This looks transient, and re-running the failed jobs would likely clear it. Nothing was changed, because this was a dry run.")};if(!x.rerun)return{failure:z,action:"retry",fixed:!1,report:$(z,"This looks transient. Re-running the failed job is likely to clear it.")};H.info("\uD83D\uDD01 Re-running the failed jobs");let Y=await x.rerun();return{failure:z,action:"retry",fixed:!1,report:$(z,Y?"This looks transient, so I re-ran the failed jobs. No model was needed.":"This looks transient, but I could not re-run the failed jobs \u2014 `actions: write` is the usual reason. "+"Re-running them from the Actions tab is likely to clear it.")}}if(!x.ai)return{failure:z,action:"reported",fixed:!1,report:$(z,"No AI provider is configured, so this needs a human. See https://buddy.sh/ai/providers to enable automatic repair.")};let Q=await L(x.ai,{mode:S,task:["A CI job on this branch is failing. Diagnose the root cause and fix it if the fix is clear.","",`Classification: ${z.kind} \u2014 ${G(z)}`,"","Relevant log lines:",z.evidence.join(`
4
4
  `),"","Verify your fix by running the project's tests or build before reporting it done.","If the fix is not clear, explain what you found rather than guessing."].join(`
5
5
  `),context:{workspace:x.workspace,baseBranch:x.baseBranch,...x.branch?{branch:x.branch}:{}},logger:H});return{failure:z,action:"agent-fix",fixed:Q.stopReason==="completed",report:$(z,Q.output||"The repair run ended without a conclusion.")}}function $(x,H){let z=`## \uD83E\uDE7A CI failure analysis
@@ -20,8 +20,8 @@ ${x.evidence.slice(0,20).join(`
20
20
  ${JSON.stringify(J)}
21
21
  -->`;return`${(x??"").replace(B,"").trimEnd()}
22
22
 
23
- ${V}`}async function m(x,H,z){if(!F(x,"ciRuns","listWorkflowRuns"))return null;try{let J=await x.getPullRequestHeadSha(H.number),V=await x.listWorkflowRuns(H.head,{status:"completed",limit:30}),Q=J?V.filter((Y)=>Y.headSha===J):V;return _(Q)[0]?.id??null}catch(J){return z.debug(`Could not resolve the failing run for #${H.number}: ${K(J)}`),null}}async function c(x){let H=x.logger??O(),{config:z,provider:J}=x,V=x.workspace??process.cwd();A(J,"ciLogs","getWorkflowRunLogs","reading CI logs");let Q;if(x.prNumber){if(Q=(await J.getPullRequests("open")).find((W)=>W.number===x.prNumber),!Q)return`Could not find open pull request #${x.prNumber}.`}let Y=x.runId??(Q?await m(J,Q,H):null);if(!Y)return Q?"Nothing is failing at the head of this pull request, so there is nothing to diagnose.":"No run to diagnose. Pass --run-id, or --pr so I can find the failing run myself.";let Z=await J.getWorkflowRunLogs(Y);if(!Z)return H.warn(`\u26A0\uFE0F Could not read the logs for run ${Y}; nothing to diagnose`),`Could not read the logs for run ${Y}. They may have expired.`;let U=E(Q?.body)?.attempts??0,j=z.repository?.baseBranch??"main",D=F(J,"ciRuns","listWorkflowRuns"),y=F(J,"ciRuns","rerunWorkflowRun"),{createAiClient:v}=await import("./chunk-8wrbxhs3.js"),C=await I({log:Z,priorAttempts:U,workspace:V,baseBranch:j,ai:x.analysisOnly?null:v(z,H),logger:H,dryRun:Boolean(x.dryRun),analysisOnly:Boolean(x.analysisOnly),...D?{checkBase:(X)=>M({listWorkflowRuns:(W,k)=>J.listWorkflowRuns(W,k),getWorkflowRunLogs:(W)=>J.getWorkflowRunLogs(W)},j,X,H)}:{},...y?{rerun:()=>J.rerunWorkflowRun(Y)}:{},...x.analysisOnly?{}:{regenerateLockfile:()=>g(V,H)}});if(H.info(`
23
+ ${V}`}async function m(x,H,z){if(!F(x,"ciRuns","listWorkflowRuns"))return null;try{let J=await x.getPullRequestHeadSha(H.number),V=await x.listWorkflowRuns(H.head,{status:"completed",limit:30}),Q=J?V.filter((Y)=>Y.headSha===J):V;return _(Q)[0]?.id??null}catch(J){return z.debug(`Could not resolve the failing run for #${H.number}: ${K(J)}`),null}}async function c(x){let H=x.logger??O(),{config:z,provider:J}=x,V=x.workspace??process.cwd();A(J,"ciLogs","getWorkflowRunLogs","reading CI logs");let Q;if(x.prNumber){if(Q=(await J.getPullRequests("open")).find((W)=>W.number===x.prNumber),!Q)return`Could not find open pull request #${x.prNumber}.`}let Y=x.runId??(Q?await m(J,Q,H):null);if(!Y)return Q?"Nothing is failing at the head of this pull request, so there is nothing to diagnose.":"No run to diagnose. Pass --run-id, or --pr so I can find the failing run myself.";let Z=await J.getWorkflowRunLogs(Y);if(!Z)return H.warn(`\u26A0\uFE0F Could not read the logs for run ${Y}; nothing to diagnose`),`Could not read the logs for run ${Y}. They may have expired.`;let U=E(Q?.body)?.attempts??0,j=z.repository?.baseBranch??"main",D=F(J,"ciRuns","listWorkflowRuns"),y=F(J,"ciRuns","rerunWorkflowRun"),{createAiClient:v}=await import("./chunk-j5k195b6.js"),C=await I({log:Z,priorAttempts:U,workspace:V,baseBranch:j,ai:x.analysisOnly?null:v(z,H),logger:H,dryRun:Boolean(x.dryRun),analysisOnly:Boolean(x.analysisOnly),...D?{checkBase:(X)=>M({listWorkflowRuns:(W,k)=>J.listWorkflowRuns(W,k),getWorkflowRunLogs:(W)=>J.getWorkflowRunLogs(W)},j,X,H)}:{},...y?{rerun:()=>J.rerunWorkflowRun(Y)}:{},...x.analysisOnly?{}:{regenerateLockfile:()=>g(V,H)}});if(H.info(`
24
24
  ${C.report}
25
- `),x.prNumber&&!x.dryRun){if(await J.createComment(x.prNumber,C.report),C.action!=="skipped"&&Q)try{await J.updatePullRequest(x.prNumber,{body:q(Q.body,U+1)})}catch(X){H.warn(`Could not record the fix attempt on PR #${x.prNumber}: ${K(X)}`)}}return await R(z.notifications,"fixci.completed",{...x.prNumber?{number:x.prNumber}:{},action:C.action,fixed:C.fixed}),`${C.action}${C.fixed?" (fixed)":""}`}async function g(x,H){let{regenerateLockFile:z,detectRequiredPackageManagers:J,getAllLockFilePaths:V,hasLockFile:Q}=await import("./chunk-3mnpvfg3.js"),{commitAndPush:Y}=await import("./chunk-qngnmrpw.js"),Z=J(["package.json","composer.json"],x).filter((j)=>Q(j,x)),U=!1;for(let j of Z){let D=await z(j,x);if(D.success)U=!0;else H.warn(`\u26A0\uFE0F ${D.message}`)}if(!U)return{regenerated:!1,pushed:!1};try{return{regenerated:!0,pushed:await Y(V(),`fix(deps): regenerate the lock file
25
+ `),x.prNumber&&!x.dryRun){if(await J.createComment(x.prNumber,C.report),C.action!=="skipped"&&Q)try{await J.updatePullRequest(x.prNumber,{body:q(Q.body,U+1)})}catch(X){H.warn(`Could not record the fix attempt on PR #${x.prNumber}: ${K(X)}`)}}return await R(z.notifications,"fixci.completed",{...x.prNumber?{number:x.prNumber}:{},action:C.action,fixed:C.fixed}),`${C.action}${C.fixed?" (fixed)":""}`}async function g(x,H){let{regenerateLockFile:z,detectRequiredPackageManagers:J,getAllLockFilePaths:V,hasLockFile:Q}=await import("./chunk-pbrpej0s.js"),{commitAndPush:Y}=await import("./chunk-18wwzwcz.js"),Z=J(["package.json","composer.json"],x).filter((j)=>Q(j,x)),U=!1;for(let j of Z){let D=await z(j,x);if(D.success)U=!0;else H.warn(`\u26A0\uFE0F ${D.message}`)}if(!U)return{regenerated:!1,pushed:!1};try{return{regenerated:!0,pushed:await Y(V(),`fix(deps): regenerate the lock file
26
26
 
27
- The lock file had drifted from the manifest, which failed CI.`,x)}}catch(j){return H.warn(`\u26A0\uFE0F Could not push the regenerated lock file: ${K(j)}`),{regenerated:!0,pushed:!1}}}export{N as Ea,T as Fa,G as Ga,M as Ha,_ as Ia,I as Ja,c as Ka};
27
+ The lock file had drifted from the manifest, which failed CI.`,x)}}catch(j){return H.warn(`\u26A0\uFE0F Could not push the regenerated lock file: ${K(j)}`),{regenerated:!0,pushed:!1}}}export{N as Ya,T as Za,G as _a,M as $a,_ as ab,I as bb,c as cb};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ac as m,Bc as n,Cc as o,Dc as p,Ec as q,Fc as r,Gc as s,Hc as t,Ic as u,oc as a,pc as b,qc as c,rc as d,sc as e,tc as f,uc as g,vc as h,wc as i,xc as j,yc as k,zc as l}from"./chunk-mtn4angk.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{t as stripOperators,l as splitConstraint,s as scanEcosystems,o as rustAdapter,n as rubyAdapter,c as regenerateWith,u as regenerateLockfiles,m as pythonAdapter,k as pep440UpdateType,h as parsePep440,f as numericUpdateType,j as isPep440Prerelease,g as goAdapter,a as escapeRegex,b as detectFiles,i as comparePep440,e as compareNumeric,d as commandAvailable,r as adapterNamed,q as adapterFor,p as BUILTIN_ADAPTERS};
2
+ import{Ac as m,Bc as n,Cc as o,Dc as p,Ec as q,Fc as r,Gc as s,Hc as t,Ic as u,oc as a,pc as b,qc as c,rc as d,sc as e,tc as f,uc as g,vc as h,wc as i,xc as j,yc as k,zc as l}from"./chunk-vx23zjwq.js";import"./chunk-kqwdg3nw.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{t as stripOperators,l as splitConstraint,s as scanEcosystems,o as rustAdapter,n as rubyAdapter,c as regenerateWith,u as regenerateLockfiles,m as pythonAdapter,k as pep440UpdateType,h as parsePep440,f as numericUpdateType,j as isPep440Prerelease,g as goAdapter,a as escapeRegex,b as detectFiles,i as comparePep440,e as compareNumeric,d as commandAvailable,r as adapterNamed,q as adapterFor,p as BUILTIN_ADAPTERS};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{md as J}from"./chunk-bnp0r4eh.js";import{nd as Y}from"./chunk-0f1xye20.js";import{ue as _}from"./chunk-d09qj570.js";import{xe as x,ye as w}from"./chunk-wk175yyw.js";import{Qe as z,Re as M}from"./chunk-4wv5s3vr.js";import{Ye as N}from"./chunk-j46f90n8.js";import{Ag as L,Bg as S}from"./chunk-r1jvyhhd.js";import{Rh as G}from"./chunk-wzncz6j5.js";import{gl as j}from"./chunk-16aeend1.js";var{Glob:D}=globalThis.Bun;import{lstat as Z,readdir as A,readFile as U}from"fs/promises";import{join as R,relative as E,sep as H}from"path";async function I(q,K){try{let O=JSON.parse(K),V=[];if(O.packages){for(let Q of Object.values(O.packages))if(Q.name&&Q.version)V.push({name:Q.name,currentVersion:Q.version,type:"dependencies",file:q})}return{path:q,type:"pantry.lock",content:K,dependencies:V}}catch(O){return G().warn(`Failed to parse pantry.lock file ${q}:`,O),null}}class m{projectPath;logger;ignoreGlobs=[];constructor(q,K,O){this.projectPath=q;this.logger=K;if(O&&O.length>0)this.ignoreGlobs=O.map((V)=>new D(V)),this.logger.info(`Initialized ${this.ignoreGlobs.length} ignore patterns: ${O.join(", ")}`)}async scanProject(){this.logger.info("Scanning project for package files...");let q=Date.now(),K=[];try{let O=await this.findFiles("package.json");for(let X of O){if(this.shouldIgnorePath(X))continue;let $=await this.parsePackageJsonFile(X);if($)K.push($)}let V=await this.findDependencyFiles();for(let X of V){if(this.shouldIgnorePath(X))continue;let $=await this.parseDependencyFile(X);if($)K.push($)}let Q=await this.findLockFiles();for(let X of Q){if(this.shouldIgnorePath(X))continue;let $=await this.parseLockFile(X);if($)K.push($)}let W=await this.findComposerFiles();for(let X of W){if(this.shouldIgnorePath(X))continue;let $=await this.parseComposerFile(X);if($)K.push($)}let B=await this.findGitHubActionsFiles();for(let X of B){if(this.shouldIgnorePath(X))continue;let $=await this.parseGitHubActionsFile(X);if($)K.push($)}let C=await this.findDockerfiles();this.logger.info(`\uD83D\uDD0D Found ${C.length} Dockerfile(s): ${C.join(", ")}`);for(let X of C){if(this.shouldIgnorePath(X))continue;let $=await this.parseDockerfile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed Dockerfile: ${X} with ${$.dependencies.length} dependencies`)}let T=await this.findZigManifests();this.logger.info(`\uD83D\uDD0D Found ${T.length} Zig manifest(s): ${T.join(", ")}`);for(let X of T){if(this.shouldIgnorePath(X))continue;let $=await this.parseZigManifestFile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed Zig manifest: ${X} with ${$.dependencies.length} dependencies`)}let b=await this.findFiles("pantry.lock");for(let X of b){if(this.shouldIgnorePath(X))continue;let $=await this.parsePantryLockFile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed pantry.lock: ${X} with ${$.dependencies.length} dependencies`)}let v=Date.now()-q;return this.logger.success(`Found ${K.length} package files in ${v}ms`),K}catch(O){throw this.logger.error("Failed to scan project:",O),new Y(`Failed to scan project: ${O instanceof Error?O.message:"Unknown error"}`)}}async parsePackageJsonFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),V=JSON.parse(O),Q=[];return this.extractDependencies(V.dependencies,"dependencies",q,Q),this.extractDependencies(V.devDependencies,"devDependencies",q,Q),this.extractDependencies(V.peerDependencies,"peerDependencies",q,Q),this.extractDependencies(V.optionalDependencies,"optionalDependencies",q,Q),Q.push(...N(V.engines,q)),{path:q,type:"package.json",content:O,dependencies:Q}}catch(K){return this.logger.warn(`Failed to parse package.json file ${q}:`,K),null}}async parseLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),V=q.split("/").pop()||"",Q;if(V==="bun.lockb")Q="bun.lockb";else if(V==="package-lock.json")Q="package-lock.json";else if(V==="yarn.lock")Q="yarn.lock";else if(V==="pnpm-lock.yaml")Q="pnpm-lock.yaml";else return null;let W=await this.extractLockFileDependencies(O,Q,q);return{path:q,type:Q,content:O,dependencies:W}}catch(K){return this.logger.warn(`Failed to parse lock file ${q}:`,K),null}}async parseDependencyFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await S(q,O)}catch(K){return this.logger.warn(`Failed to parse dependency file ${q}:`,K),null}}async findDependencyFiles(){let q=[],K=["deps.yaml","deps.yml","dependencies.yaml","dependencies.yml","pkgx.yaml","pkgx.yml",".deps.yaml",".deps.yml"];for(let Q of K){let W=await this.findFiles(Q);q.push(...W)}let O=await this.findFilesByPattern("*.yaml"),V=await this.findFilesByPattern("*.yml");for(let Q of[...O,...V])if(L(Q)&&!q.includes(Q))q.push(Q);return q}async findGitHubActionsFiles(){let q=[];try{if(!(await Z(R(this.projectPath,".github")).catch(()=>null))?.isDirectory())return q;let V=R(this.projectPath,".github","workflows");if((await Z(V).catch(()=>null))?.isDirectory()){let W=await this.findFilesByPatternInDir("*.yaml",V),B=await this.findFilesByPatternInDir("*.yml",V);for(let C of[...W,...B])if(x(C))q.push(C)}}catch{}return q}async findDockerfiles(){return this.findFilesMatching(z)}async findFilesMatching(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isFile()){if(q(Q))O.push(E(this.projectPath,W).split(H).join("/"))}else if(B.isDirectory()&&!J(Q))O.push(...await this.findFilesMatching(q,W))}catch{continue}}}catch{}return O}async parseGitHubActionsFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await w(q,O)}catch(K){return this.logger.warn(`Failed to parse GitHub Actions file ${q}:`,K),null}}async parseDockerfile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await M(q,O)}catch(K){return this.logger.warn(`Failed to parse Dockerfile ${q}:`,K),null}}async findZigManifests(){let q=[];try{let K=await this.findFiles("build.zig.zon");q.push(...K)}catch{}return q}async parseZigManifestFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await _(q,O)}catch(K){return this.logger.warn(`Failed to parse Zig manifest ${q}:`,K),null}}async findComposerFiles(){let q=[];try{let K=await this.findFiles("composer.json");q.push(...K);let O=await this.findFiles("composer.lock");q.push(...O)}catch{}return q}async parseComposerFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),{parseComposerFile:V}=await import("./chunk-1pdvjg0x.js");return await V(q,O)}catch(K){return this.logger.warn(`Failed to parse Composer file ${q}:`,K),null}}async parsePantryLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await I(q,O)}catch(K){return this.logger.warn(`Failed to parse pantry.lock file ${q}:`,K),null}}extractDependencies(q,K,O,V){if(!q)return;for(let[Q,W]of Object.entries(q))V.push({name:Q,currentVersion:W,type:K,file:this.getRelativePath(O)})}async extractLockFileDependencies(q,K,O){let V=[];if(K==="package-lock.json")try{let Q=JSON.parse(q);if(Q.packages){for(let[W,B]of Object.entries(Q.packages))if(W&&W!==""&&B&&typeof B==="object"){let C=B;if(C.version){let T=W.startsWith("node_modules/")?W.replace("node_modules/",""):W;V.push({name:T,currentVersion:C.version,type:C.dev?"devDependencies":"dependencies",file:this.getRelativePath(O)})}}}}catch(Q){this.logger.warn("Failed to parse package-lock.json:",Q)}return V}async findFiles(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isDirectory()){if(!J(Q)){let C=await this.findFiles(q,W);O.push(...C)}}else if(B.isFile()&&Q===q){let C=E(this.projectPath,W);O.push(C.split(H).join("/"))}}catch{continue}}}catch{}return O}async findLockFiles(){let q=["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml"],K=[];for(let O of q){let V=await this.findFiles(O);K.push(...V)}return K}async findFilesByPattern(q){let K=[],O=q.replace("*.","");try{let V=await A(this.projectPath);for(let Q of V){let W=R(this.projectPath,Q),B=await Z(W);if(B.isFile()&&Q.endsWith(`.${O}`)){let C=E(this.projectPath,W);K.push(C.split(H).join("/"))}else if(B.isDirectory()&&!J(Q)){let C=await this.findFilesByPatternInDir(q,W);K.push(...C)}}}catch{}return K}async findFilesByPatternInDir(q,K){let O=[],V=q.replace("*.","");try{let Q=await A(K);for(let W of Q){let B=R(K,W),C=await Z(B);if(C.isFile()&&W.endsWith(`.${V}`)){let T=E(this.projectPath,B);O.push(T.split(H).join("/"))}else if(C.isDirectory()&&!J(W)){let T=await this.findFilesByPatternInDir(q,B);O.push(...T)}}}catch{}return O}shouldIgnorePath(q){if(this.ignoreGlobs.length===0)return!1;let K=q;if(q.startsWith("/")||q.includes(":"))K=this.getRelativePath(q);for(let O of this.ignoreGlobs)if(O.match(K))return this.logger.debug(`Ignoring path: ${K} (matched pattern)`),!0;return!1}getRelativePath(q){return E(this.projectPath,q).split(H).join("/")}async getDependencyCount(){return(await this.scanProject()).reduce((K,O)=>K+O.dependencies.length,0)}async getUniqueDependencies(){return(await this.scanProject()).flatMap((V)=>V.dependencies).filter((V,Q,W)=>Q===W.findIndex((B)=>B.name===V.name))}}
3
- export{m as ld};
2
+ import{wd as J}from"./chunk-3zp7a103.js";import{xd as Y}from"./chunk-d2vrstjq.js";import{ue as _}from"./chunk-hzpsmg4z.js";import{xe as x,ye as w}from"./chunk-0baffydm.js";import{Qe as z,Re as M}from"./chunk-sveh3wjr.js";import{Ye as N}from"./chunk-j46f90n8.js";import{Ag as L,Bg as S}from"./chunk-5107xbwj.js";import{Th as G}from"./chunk-56t2za4k.js";import{il as j}from"./chunk-eaz23nsf.js";var{Glob:D}=globalThis.Bun;import{lstat as Z,readdir as A,readFile as U}from"fs/promises";import{join as R,relative as E,sep as H}from"path";async function I(q,K){try{let O=JSON.parse(K),V=[];if(O.packages){for(let Q of Object.values(O.packages))if(Q.name&&Q.version)V.push({name:Q.name,currentVersion:Q.version,type:"dependencies",file:q})}return{path:q,type:"pantry.lock",content:K,dependencies:V}}catch(O){return G().warn(`Failed to parse pantry.lock file ${q}:`,O),null}}class m{projectPath;logger;ignoreGlobs=[];constructor(q,K,O){this.projectPath=q;this.logger=K;if(O&&O.length>0)this.ignoreGlobs=O.map((V)=>new D(V)),this.logger.info(`Initialized ${this.ignoreGlobs.length} ignore patterns: ${O.join(", ")}`)}async scanProject(){this.logger.info("Scanning project for package files...");let q=Date.now(),K=[];try{let O=await this.findFiles("package.json");for(let X of O){if(this.shouldIgnorePath(X))continue;let $=await this.parsePackageJsonFile(X);if($)K.push($)}let V=await this.findDependencyFiles();for(let X of V){if(this.shouldIgnorePath(X))continue;let $=await this.parseDependencyFile(X);if($)K.push($)}let Q=await this.findLockFiles();for(let X of Q){if(this.shouldIgnorePath(X))continue;let $=await this.parseLockFile(X);if($)K.push($)}let W=await this.findComposerFiles();for(let X of W){if(this.shouldIgnorePath(X))continue;let $=await this.parseComposerFile(X);if($)K.push($)}let B=await this.findGitHubActionsFiles();for(let X of B){if(this.shouldIgnorePath(X))continue;let $=await this.parseGitHubActionsFile(X);if($)K.push($)}let C=await this.findDockerfiles();this.logger.info(`\uD83D\uDD0D Found ${C.length} Dockerfile(s): ${C.join(", ")}`);for(let X of C){if(this.shouldIgnorePath(X))continue;let $=await this.parseDockerfile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed Dockerfile: ${X} with ${$.dependencies.length} dependencies`)}let T=await this.findZigManifests();this.logger.info(`\uD83D\uDD0D Found ${T.length} Zig manifest(s): ${T.join(", ")}`);for(let X of T){if(this.shouldIgnorePath(X))continue;let $=await this.parseZigManifestFile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed Zig manifest: ${X} with ${$.dependencies.length} dependencies`)}let b=await this.findFiles("pantry.lock");for(let X of b){if(this.shouldIgnorePath(X))continue;let $=await this.parsePantryLockFile(X);if($)K.push($),this.logger.info(`\uD83D\uDCE6 Parsed pantry.lock: ${X} with ${$.dependencies.length} dependencies`)}let v=Date.now()-q;return this.logger.success(`Found ${K.length} package files in ${v}ms`),K}catch(O){throw this.logger.error("Failed to scan project:",O),new Y(`Failed to scan project: ${O instanceof Error?O.message:"Unknown error"}`)}}async parsePackageJsonFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),V=JSON.parse(O),Q=[];return this.extractDependencies(V.dependencies,"dependencies",q,Q),this.extractDependencies(V.devDependencies,"devDependencies",q,Q),this.extractDependencies(V.peerDependencies,"peerDependencies",q,Q),this.extractDependencies(V.optionalDependencies,"optionalDependencies",q,Q),Q.push(...N(V.engines,q)),{path:q,type:"package.json",content:O,dependencies:Q}}catch(K){return this.logger.warn(`Failed to parse package.json file ${q}:`,K),null}}async parseLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),V=q.split("/").pop()||"",Q;if(V==="bun.lockb")Q="bun.lockb";else if(V==="package-lock.json")Q="package-lock.json";else if(V==="yarn.lock")Q="yarn.lock";else if(V==="pnpm-lock.yaml")Q="pnpm-lock.yaml";else return null;let W=await this.extractLockFileDependencies(O,Q,q);return{path:q,type:Q,content:O,dependencies:W}}catch(K){return this.logger.warn(`Failed to parse lock file ${q}:`,K),null}}async parseDependencyFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await S(q,O)}catch(K){return this.logger.warn(`Failed to parse dependency file ${q}:`,K),null}}async findDependencyFiles(){let q=[],K=["deps.yaml","deps.yml","dependencies.yaml","dependencies.yml","pkgx.yaml","pkgx.yml",".deps.yaml",".deps.yml"];for(let Q of K){let W=await this.findFiles(Q);q.push(...W)}let O=await this.findFilesByPattern("*.yaml"),V=await this.findFilesByPattern("*.yml");for(let Q of[...O,...V])if(L(Q)&&!q.includes(Q))q.push(Q);return q}async findGitHubActionsFiles(){let q=[];try{if(!(await Z(R(this.projectPath,".github")).catch(()=>null))?.isDirectory())return q;let V=R(this.projectPath,".github","workflows");if((await Z(V).catch(()=>null))?.isDirectory()){let W=await this.findFilesByPatternInDir("*.yaml",V),B=await this.findFilesByPatternInDir("*.yml",V);for(let C of[...W,...B])if(x(C))q.push(C)}}catch{}return q}async findDockerfiles(){return this.findFilesMatching(z)}async findFilesMatching(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isFile()){if(q(Q))O.push(E(this.projectPath,W).split(H).join("/"))}else if(B.isDirectory()&&!J(Q))O.push(...await this.findFilesMatching(q,W))}catch{continue}}}catch{}return O}async parseGitHubActionsFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await w(q,O)}catch(K){return this.logger.warn(`Failed to parse GitHub Actions file ${q}:`,K),null}}async parseDockerfile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await M(q,O)}catch(K){return this.logger.warn(`Failed to parse Dockerfile ${q}:`,K),null}}async findZigManifests(){let q=[];try{let K=await this.findFiles("build.zig.zon");q.push(...K)}catch{}return q}async parseZigManifestFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await _(q,O)}catch(K){return this.logger.warn(`Failed to parse Zig manifest ${q}:`,K),null}}async findComposerFiles(){let q=[];try{let K=await this.findFiles("composer.json");q.push(...K);let O=await this.findFiles("composer.lock");q.push(...O)}catch{}return q}async parseComposerFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8"),{parseComposerFile:V}=await import("./chunk-gkdmk7xt.js");return await V(q,O)}catch(K){return this.logger.warn(`Failed to parse Composer file ${q}:`,K),null}}async parsePantryLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await I(q,O)}catch(K){return this.logger.warn(`Failed to parse pantry.lock file ${q}:`,K),null}}extractDependencies(q,K,O,V){if(!q)return;for(let[Q,W]of Object.entries(q))V.push({name:Q,currentVersion:W,type:K,file:this.getRelativePath(O)})}async extractLockFileDependencies(q,K,O){let V=[];if(K==="package-lock.json")try{let Q=JSON.parse(q);if(Q.packages){for(let[W,B]of Object.entries(Q.packages))if(W&&W!==""&&B&&typeof B==="object"){let C=B;if(C.version){let T=W.startsWith("node_modules/")?W.replace("node_modules/",""):W;V.push({name:T,currentVersion:C.version,type:C.dev?"devDependencies":"dependencies",file:this.getRelativePath(O)})}}}}catch(Q){this.logger.warn("Failed to parse package-lock.json:",Q)}return V}async findFiles(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isDirectory()){if(!J(Q)){let C=await this.findFiles(q,W);O.push(...C)}}else if(B.isFile()&&Q===q){let C=E(this.projectPath,W);O.push(C.split(H).join("/"))}}catch{continue}}}catch{}return O}async findLockFiles(){let q=["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml"],K=[];for(let O of q){let V=await this.findFiles(O);K.push(...V)}return K}async findFilesByPattern(q){let K=[],O=q.replace("*.","");try{let V=await A(this.projectPath);for(let Q of V){let W=R(this.projectPath,Q),B=await Z(W);if(B.isFile()&&Q.endsWith(`.${O}`)){let C=E(this.projectPath,W);K.push(C.split(H).join("/"))}else if(B.isDirectory()&&!J(Q)){let C=await this.findFilesByPatternInDir(q,W);K.push(...C)}}}catch{}return K}async findFilesByPatternInDir(q,K){let O=[],V=q.replace("*.","");try{let Q=await A(K);for(let W of Q){let B=R(K,W),C=await Z(B);if(C.isFile()&&W.endsWith(`.${V}`)){let T=E(this.projectPath,B);O.push(T.split(H).join("/"))}else if(C.isDirectory()&&!J(W)){let T=await this.findFilesByPatternInDir(q,B);O.push(...T)}}}catch{}return O}shouldIgnorePath(q){if(this.ignoreGlobs.length===0)return!1;let K=q;if(q.startsWith("/")||q.includes(":"))K=this.getRelativePath(q);for(let O of this.ignoreGlobs)if(O.match(K))return this.logger.debug(`Ignoring path: ${K} (matched pattern)`),!0;return!1}getRelativePath(q){return E(this.projectPath,q).split(H).join("/")}async getDependencyCount(){return(await this.scanProject()).reduce((K,O)=>K+O.dependencies.length,0)}async getUniqueDependencies(){return(await this.scanProject()).flatMap((V)=>V.dependencies).filter((V,Q,W)=>Q===W.findIndex((B)=>B.name===V.name))}}
3
+ export{m as vd};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ki as A,li as E,mi as _,ni as T,oi as C}from"./chunk-drn3hq53.js";import"./chunk-eaz23nsf.js";export{T as PACKAGE_ALIASES,_ as DEFAULT_TIMEOUT_MS,E as DEFAULT_CACHE_EXPIRATION_MINUTES,A as DEFAULT_CACHE_DIR,C as ALL_KNOWN_PACKAGES};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Gc as a,Hc as b,Ic as c}from"./chunk-vx23zjwq.js";import"./chunk-kqwdg3nw.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{b as stripOperators,a as scanEcosystems,c as regenerateLockfiles};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Rh as x}from"./chunk-wzncz6j5.js";import{lstat as R}from"fs/promises";import{join as W}from"path";var N=/^catalog:(.*)$/;function S(X){let J;try{J=Bun.YAML.parse(X)}catch{return{entries:[],hasCatalogs:!1}}if(typeof J!=="object"||J===null)return{entries:[],hasCatalogs:!1};let B=J,z=[],Z=!1,H=(M,U)=>{if(typeof M!=="object"||M===null||Array.isArray(M))return;Z=!0;for(let[j,q]of Object.entries(M))if(typeof q==="string"&&q.trim())z.push({name:j,version:q.trim(),catalog:U})};if(H(B.catalog,"default"),typeof B.catalogs==="object"&&B.catalogs!==null)for(let[M,U]of Object.entries(B.catalogs))H(U,M);return{entries:z,hasCatalogs:Z}}function w(X,J,B){let z=N.exec(X.trim());if(!z)return null;let Z=z[1].trim()||"default";return J.find((H)=>H.name===B&&H.catalog===Z)?.version??null}function f(X){return N.test(X.trim())}function V(X,J,B){let z=X.split(`
2
+ import{Th as x}from"./chunk-56t2za4k.js";import{lstat as R}from"fs/promises";import{join as W}from"path";var N=/^catalog:(.*)$/;function S(X){let J;try{J=Bun.YAML.parse(X)}catch{return{entries:[],hasCatalogs:!1}}if(typeof J!=="object"||J===null)return{entries:[],hasCatalogs:!1};let B=J,z=[],Z=!1,H=(M,U)=>{if(typeof M!=="object"||M===null||Array.isArray(M))return;Z=!0;for(let[j,q]of Object.entries(M))if(typeof q==="string"&&q.trim())z.push({name:j,version:q.trim(),catalog:U})};if(H(B.catalog,"default"),typeof B.catalogs==="object"&&B.catalogs!==null)for(let[M,U]of Object.entries(B.catalogs))H(U,M);return{entries:z,hasCatalogs:Z}}function w(X,J,B){let z=N.exec(X.trim());if(!z)return null;let Z=z[1].trim()||"default";return J.find((H)=>H.name===B&&H.catalog===Z)?.version??null}function f(X){return N.test(X.trim())}function V(X,J,B){let z=X.split(`
3
3
  `),Z=/^(\s*)(["']?)([^"':]+)\2(\s*:\s*)(["']?)(.+?)\5(\s*(?:#.*)?)$/,H=null,M=!1,U=0;for(let j=0;j<z.length;j++){let q=z[j],F=q.length-q.trimStart().length,Y=q.trim();if(/^catalog\s*:\s*$/.test(Y)){H="default",M=!1;continue}if(/^catalogs\s*:\s*$/.test(Y)){M=!0,U=F,H=null;continue}if(M&&F>U&&/^[\w@./-]+\s*:\s*$/.test(Y)){H=Y.replace(/\s*:\s*$/,"");continue}if(M&&Y&&F<=U)M=!1,H=null;if(H!==J.catalog)continue;let $=Z.exec(q);if(!$||$[3].trim()!==J.name||$[6].trim()!==J.version)continue;let[,D,G,E,P,K,,Q]=$;return z[j]=`${D}${G}${E}${G}${P}${K}${B}${K}${Q}`,z.join(`
4
4
  `)}return X}var I="pnpm-workspace.yaml",_="pnpm-workspace.yml";async function b(X,J,B={}){let z=B.logger??x(),Z=new Set(B.ignore??[]);for(let H of[I,_]){let M=W(X,H);if(!(await R(M).catch(()=>null))?.isFile())continue;let{entries:j,hasCatalogs:q}=S(await Bun.file(M).text());if(!q)return{updates:[],entries:[],file:H};return z.debug(`\uD83D\uDCE6 ${H}: ${j.length} catalog entr(ies)`),{updates:(await Promise.all(j.map(async(Y)=>{if(Z.has(Y.name))return null;try{let $=await J(Y.name);if(!$)return null;let D=Y.version.replace(/^[\^~>=<\s]+/,"").trim();if(!D||D===$)return null;return{name:Y.name,currentVersion:Y.version,newVersion:A(Y.version,$),updateType:k(D,$),dependencyType:"catalog",file:H,resolved:{catalog:Y.catalog}}}catch($){return z.debug(`Could not resolve catalog entry ${Y.name}: ${$}`),null}}))).filter((Y)=>Y!==null),entries:j,file:H}}return{updates:[],entries:[]}}function A(X,J){return`${/^([\^~]|>=|<=|>|<)?/.exec(X.trim())?.[1]??""}${J}`}function k(X,J){let B=(H)=>H.split(".").map((M)=>Number.parseInt(M,10)||0),z=B(X),Z=B(J);if((z[0]??0)!==(Z[0]??0))return"major";if((z[1]??0)!==(Z[1]??0))return"minor";return"patch"}function C(X,J){let B=X;for(let z of J){if(z.dependencyType!=="catalog")continue;B=V(B,{name:z.name,version:z.currentVersion,catalog:z.resolved?.catalog??"default"},z.newVersion)}return B}
5
5
  export{S as gc,w as hc,f as ic,V as jc,I as kc,_ as lc,b as mc,C as nc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ch as B,Dh as E}from"./chunk-yh13j2af.js";import{Lh as z}from"./chunk-s0ps33ft.js";import{Rh as A}from"./chunk-wzncz6j5.js";class H{logger;constructor(b){this.logger=b??A()}async checkDeprecatedDependencies(b){let j=[];for(let q of b){let w=await this.checkFileForDeprecatedDependencies(q);j.push(...w)}return j}async checkFileForDeprecatedDependencies(b){let j=[];for(let q of b.dependencies){let w=await this.checkDependencyDeprecation(q,b.type);if(w.deprecated)j.push({name:q.name,currentVersion:q.currentVersion,datasource:this.getDatasourceFromFileType(b.type),file:b.path,type:q.type,replacementAvailable:!1,deprecationMessage:w.message,suggestedReplacement:w.suggestedReplacement})}return j}async checkDependencyDeprecation(b,j){try{if(j==="package.json"||j.includes("lock"))return await this.checkNpmDeprecation(b);else if(j==="composer.json"||j==="composer.lock")return await this.checkComposerDeprecation(b);else if(j==="deps.yaml"||j==="deps.yml"||j.includes("deps"))return await this.checkBunDeprecation(b);return{deprecated:!1}}catch(q){return this.logger.warn(`Failed to check deprecation for ${b.name}:`,q),{deprecated:!1}}}async checkNpmDeprecation(b){try{let j=B(b.name),q=await z(`${j}/${encodeURIComponent(b.name).replace("%40","@")}`,{headers:{"User-Agent":"buddy"}});if(!q.ok)return{deprecated:!1};let w=await q.json();if(w.deprecated)return{deprecated:!0,message:w.deprecated,suggestedReplacement:this.extractSuggestedReplacement(w.deprecated)};let x=w.versions?.[b.currentVersion];if(x?.deprecated)return{deprecated:!0,message:x.deprecated,suggestedReplacement:this.extractSuggestedReplacement(x.deprecated)};return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check npm deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkComposerDeprecation(b){try{let j=await z(`${E()}/packages/${b.name}.json`,{headers:{"User-Agent":"buddy"}});if(!j.ok)return{deprecated:!1};let q=await j.json();if(q.package?.abandoned){let w=typeof q.package.abandoned==="string"?q.package.abandoned:null;return{deprecated:!0,message:`Package is abandoned${w?`, use ${w} instead`:""}`,suggestedReplacement:w||void 0}}return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check Composer deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkBunDeprecation(b){return await this.checkNpmDeprecation(b)}extractSuggestedReplacement(b){let j=[/use\s+([a-z0-9@/-]+)\s+instead/i,/replaced\s+by\s+([a-z0-9@/-]+)/i,/migrate\s+to\s+([a-z0-9@/-]+)/i,/switch\s+to\s+([a-z0-9@/-]+)/i];for(let q of j){let w=b.match(q);if(w)return w[1]}return}getDatasourceFromFileType(b){if(b==="package.json"||b.includes("lock"))return"npm";else if(b==="composer.json"||b==="composer.lock")return"composer";else if(b==="deps.yaml"||b==="deps.yml"||b.includes("deps"))return"bun";else if(b==="github-actions")return"github-actions";return"unknown"}}
3
- export{H as fd};
2
+ import{Ch as B,Dh as E}from"./chunk-yh13j2af.js";import{Nh as z}from"./chunk-kqwdg3nw.js";import{Th as A}from"./chunk-56t2za4k.js";class H{logger;constructor(b){this.logger=b??A()}async checkDeprecatedDependencies(b){let j=[];for(let q of b){let w=await this.checkFileForDeprecatedDependencies(q);j.push(...w)}return j}async checkFileForDeprecatedDependencies(b){let j=[];for(let q of b.dependencies){let w=await this.checkDependencyDeprecation(q,b.type);if(w.deprecated)j.push({name:q.name,currentVersion:q.currentVersion,datasource:this.getDatasourceFromFileType(b.type),file:b.path,type:q.type,replacementAvailable:!1,deprecationMessage:w.message,suggestedReplacement:w.suggestedReplacement})}return j}async checkDependencyDeprecation(b,j){try{if(j==="package.json"||j.includes("lock"))return await this.checkNpmDeprecation(b);else if(j==="composer.json"||j==="composer.lock")return await this.checkComposerDeprecation(b);else if(j==="deps.yaml"||j==="deps.yml"||j.includes("deps"))return await this.checkBunDeprecation(b);return{deprecated:!1}}catch(q){return this.logger.warn(`Failed to check deprecation for ${b.name}:`,q),{deprecated:!1}}}async checkNpmDeprecation(b){try{let j=B(b.name),q=await z(`${j}/${encodeURIComponent(b.name).replace("%40","@")}`,{headers:{"User-Agent":"buddy"}});if(!q.ok)return{deprecated:!1};let w=await q.json();if(w.deprecated)return{deprecated:!0,message:w.deprecated,suggestedReplacement:this.extractSuggestedReplacement(w.deprecated)};let x=w.versions?.[b.currentVersion];if(x?.deprecated)return{deprecated:!0,message:x.deprecated,suggestedReplacement:this.extractSuggestedReplacement(x.deprecated)};return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check npm deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkComposerDeprecation(b){try{let j=await z(`${E()}/packages/${b.name}.json`,{headers:{"User-Agent":"buddy"}});if(!j.ok)return{deprecated:!1};let q=await j.json();if(q.package?.abandoned){let w=typeof q.package.abandoned==="string"?q.package.abandoned:null;return{deprecated:!0,message:`Package is abandoned${w?`, use ${w} instead`:""}`,suggestedReplacement:w||void 0}}return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check Composer deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkBunDeprecation(b){return await this.checkNpmDeprecation(b)}extractSuggestedReplacement(b){let j=[/use\s+([a-z0-9@/-]+)\s+instead/i,/replaced\s+by\s+([a-z0-9@/-]+)/i,/migrate\s+to\s+([a-z0-9@/-]+)/i,/switch\s+to\s+([a-z0-9@/-]+)/i];for(let q of j){let w=b.match(q);if(w)return w[1]}return}getDatasourceFromFileType(b){if(b==="package.json"||b.includes("lock"))return"npm";else if(b==="composer.json"||b==="composer.lock")return"composer";else if(b==="deps.yaml"||b==="deps.yml"||b.includes("deps"))return"bun";else if(b==="github-actions")return"github-actions";return"unknown"}}
3
+ export{H as pd};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{kc as a,lc as b,mc as c,nc as d}from"./chunk-c067bnx5.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{c as scanCatalogs,d as applyCatalogUpdates,b as WORKSPACE_FILE_ALT,a as WORKSPACE_FILE};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{te as a,ue as b,ve as c,we as d}from"./chunk-hzpsmg4z.js";import"./chunk-56t2za4k.js";import"./chunk-eaz23nsf.js";export{c as updateZigManifest,b as parseZigManifest,a as isZigManifest,d as generateZigManifestUpdates};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  class c extends Error{code;details;constructor(b,j,x){super(b);this.code=j;this.details=x;this.name="BuddyError"}}class k extends c{packageName;constructor(b,j){super(b,"REGISTRY_ERROR");this.packageName=j;this.name="PackageRegistryError"}}class q extends c{operation;constructor(b,j){super(b,"GIT_PROVIDER_ERROR");this.operation=j;this.name="GitProviderError"}}class w extends c{configKey;constructor(b,j){super(b,"CONFIG_ERROR");this.configKey=j;this.name="ConfigurationError"}}
3
- export{c as nd,k as od,q as pd,w as qd};
3
+ export{c as xd,k as yd,q as zd,w as Ad};
@@ -13,4 +13,4 @@ var G=["pretty","json","github","agent"];function Q(k,j){switch(k){case"staged":
13
13
  `);if(j<1||j>z.length)return null;return z.splice(j-1,1,...q.split(`
14
14
  `)),z.join(`
15
15
  `)}function P(k,j="major"){let q=["critical","major","minor","nit"],z=q.indexOf(j);return k.some((D)=>q.indexOf(D.severity)<=z)}
16
- export{G as Ed,Q as Fd,L as Gd,X as Hd,Z as Id,$ as Jd,B as Kd,N as Ld,O as Md,P as Nd};
16
+ export{G as $c,Q as ad,L as bd,X as cd,Z as dd,$ as ed,B as fd,N as gd,O as hd,P as id};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{wd as j,zd as q}from"./chunk-6gvx1g6h.js";async function U(A,D,G){let x=q(A);if(x.length===0)return;let z=new j;for(let H of x)z.register(H);await z.emit(D,G)}
3
- export{U as ud};
2
+ import{Gd as j,Jd as q}from"./chunk-s3t54kj1.js";async function U(A,D,G){let x=q(A);if(x.length===0)return;let z=new j;for(let H of x)z.register(H);await z.emit(D,G)}
3
+ export{U as Ed};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$e as e,Xe as a,Ye as b,Ze as c,_e as d,af as f,bf as g,cf as h}from"./chunk-j46f90n8.js";import"./chunk-16aeend1.js";export{e as resolveEngineVersion,d as pinBlocksUpdate,b as extractEngines,g as engineUpdateType,c as collectResolutionPins,f as bumpEngineConstraint,h as applyEngineUpdates,a as KNOWN_ENGINES};
2
+ import{$e as e,Xe as a,Ye as b,Ze as c,_e as d,af as f,bf as g,cf as h}from"./chunk-j46f90n8.js";import"./chunk-eaz23nsf.js";export{e as resolveEngineVersion,d as pinBlocksUpdate,b as extractEngines,g as engineUpdateType,c as collectResolutionPins,f as bumpEngineConstraint,h as applyEngineUpdates,a as KNOWN_ENGINES};