@buddysh/buddy 0.11.15 → 0.11.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/bin/cli.js +19 -19
- package/dist/{chunk-mg67hhgj.js → chunk-0kce7e60.js} +1 -1
- package/dist/chunk-0n03s02h.js +2 -0
- package/dist/{chunk-s82adeq9.js → chunk-16aeend1.js} +1 -1
- package/dist/{chunk-qcvtp2mt.js → chunk-1a14rx5n.js} +1 -1
- package/dist/{chunk-sztjfky1.js → chunk-1g43mpqn.js} +1 -1
- package/dist/{chunk-eccac8h7.js → chunk-1jgh0ff1.js} +1 -1
- package/dist/chunk-1k4p8wyx.js +2 -0
- package/dist/{chunk-m00hfvnp.js → chunk-1mkwhnsf.js} +1 -1
- package/dist/{chunk-6prz7chv.js → chunk-1pdvjg0x.js} +1 -1
- package/dist/chunk-2309x9r7.js +2 -0
- package/dist/{chunk-jkn2sdm0.js → chunk-26yejy1v.js} +1 -1
- package/dist/{chunk-dkhherd0.js → chunk-2f7j0dmw.js} +1 -1
- package/dist/{chunk-drmk6r1m.js → chunk-2z9mh5y4.js} +1 -1
- package/dist/chunk-3jm67wxm.js +2 -0
- package/dist/chunk-3mnpvfg3.js +2 -0
- package/dist/chunk-485kgdtb.js +2 -0
- package/dist/{chunk-nn5rzwty.js → chunk-4chtv4nh.js} +1 -1
- package/dist/{chunk-7b156stw.js → chunk-4dz5x4xw.js} +1 -1
- package/dist/{chunk-01d81hn0.js → chunk-4r03rh93.js} +1 -1
- package/dist/{chunk-3a63hke8.js → chunk-4wv5s3vr.js} +1 -1
- package/dist/{chunk-a6hv92fx.js → chunk-51m5tgwp.js} +1 -1
- package/dist/chunk-5t07s3dv.js +2 -0
- package/dist/{chunk-ymh0kwm4.js → chunk-67bjaw56.js} +2 -2
- package/dist/{chunk-9kscva05.js → chunk-6b0fmw0d.js} +1 -1
- package/dist/chunk-6bqs7rtc.js +2 -0
- package/dist/{chunk-ebnc6980.js → chunk-6gvx1g6h.js} +1 -1
- package/dist/{chunk-c4cj24qm.js → chunk-6kd81nf9.js} +2 -2
- package/dist/{chunk-j6geg3qt.js → chunk-6w0n6c07.js} +1 -1
- package/dist/{chunk-y1d6e0ye.js → chunk-743mhx0e.js} +1 -1
- package/dist/{chunk-eh71jv8w.js → chunk-7hm46cej.js} +1 -1
- package/dist/{chunk-t879n4ab.js → chunk-7p1b809h.js} +1 -1
- package/dist/chunk-8b7cwedf.js +2 -0
- package/dist/{chunk-dg2q6egm.js → chunk-8r2819xn.js} +1 -1
- package/dist/{chunk-4qv88x27.js → chunk-8wrbxhs3.js} +1 -1
- package/dist/{chunk-s5czyzje.js → chunk-9chq5m4p.js} +3 -3
- package/dist/chunk-9fagkyrp.js +2 -0
- package/dist/{chunk-kjhqe26r.js → chunk-9gabxm8n.js} +1 -1
- package/dist/{chunk-c9266b5x.js → chunk-a8wcn3mh.js} +1 -1
- package/dist/{chunk-zjp519wm.js → chunk-bafzw99p.js} +1 -1
- package/dist/{chunk-gcwg4b2w.js → chunk-bgb44971.js} +1 -1
- package/dist/{chunk-4fh7w98z.js → chunk-bw43q8k7.js} +1 -1
- package/dist/{chunk-v808b36p.js → chunk-byqzhgzs.js} +1 -1
- package/dist/chunk-bz5yx7g6.js +2 -0
- package/dist/{chunk-zy49dwqk.js → chunk-c63e4ssc.js} +2 -2
- package/dist/{chunk-xn2960z7.js → chunk-cb25v2mp.js} +1 -1
- package/dist/{chunk-ma01xp3y.js → chunk-d09qj570.js} +1 -1
- package/dist/chunk-dttp44vs.js +2 -0
- package/dist/{chunk-1znpbjrv.js → chunk-dxd0eg4r.js} +1 -1
- package/dist/{chunk-6np84pfr.js → chunk-ewhvahnb.js} +1 -1
- package/dist/{chunk-2z85fqdp.js → chunk-fsghqtgf.js} +2 -2
- package/dist/chunk-fzs7vpps.js +2 -0
- package/dist/{chunk-zpgm9yzy.js → chunk-g09atq0m.js} +1 -1
- package/dist/{chunk-k907b533.js → chunk-gg1ddvnf.js} +1 -1
- package/dist/chunk-gkb0gja4.js +2 -0
- package/dist/{chunk-rwz433q2.js → chunk-gq9gkyah.js} +2 -2
- package/dist/{chunk-92gh2n65.js → chunk-gvpsbmeg.js} +1 -1
- package/dist/{chunk-wf1jcxtr.js → chunk-h2f92qwd.js} +1 -1
- package/dist/{chunk-66nntsnf.js → chunk-hd74jxm2.js} +1 -1
- package/dist/{chunk-p16pnhj3.js → chunk-her5azyp.js} +1 -1
- package/dist/{chunk-4kyxrwxn.js → chunk-hk4d7rky.js} +1 -1
- package/dist/chunk-hxkxset4.js +2 -0
- package/dist/{chunk-9n1kth4b.js → chunk-j57716xw.js} +1 -1
- package/dist/chunk-jgq5d6s2.js +2 -0
- package/dist/chunk-k8sd78td.js +2 -0
- package/dist/{chunk-awjm9n45.js → chunk-km4aszfp.js} +1 -1
- package/dist/chunk-kthwzc4p.js +2 -0
- package/dist/{chunk-028354j6.js → chunk-m3rftash.js} +7 -7
- package/dist/{chunk-bstgsak0.js → chunk-m9qtb4xj.js} +1 -1
- package/dist/{chunk-2b07w74s.js → chunk-mr2d1zp0.js} +1 -1
- package/dist/{chunk-xyzcgskb.js → chunk-mthd2c8m.js} +1 -1
- package/dist/{chunk-w2ccdet4.js → chunk-mtn4angk.js} +1 -1
- package/dist/{chunk-37zd94a7.js → chunk-nk8wxxy7.js} +2 -2
- package/dist/{chunk-cx89kty3.js → chunk-nznpzbq4.js} +1 -1
- package/dist/{chunk-hc2pdv4j.js → chunk-p9xksx9p.js} +1 -1
- package/dist/{chunk-ym9475ry.js → chunk-pag93kz1.js} +1 -1
- package/dist/{chunk-bgw39afd.js → chunk-psjrcpgb.js} +1 -1
- package/dist/{chunk-q99xd3m5.js → chunk-pxfrq43h.js} +1 -1
- package/dist/chunk-q4j2f72t.js +2 -0
- package/dist/{chunk-fgec04jx.js → chunk-qbep9dk4.js} +1 -1
- package/dist/{chunk-j7qktvpg.js → chunk-qngnmrpw.js} +1 -1
- package/dist/chunk-r1jvyhhd.js +4 -0
- package/dist/{chunk-p2h2z6d3.js → chunk-r7qa2ykf.js} +2 -2
- package/dist/chunk-rqj1vrfs.js +2 -0
- package/dist/{chunk-34vracy4.js → chunk-s0ps33ft.js} +1 -1
- package/dist/{chunk-qjzpzd7j.js → chunk-s3b3vrsj.js} +1 -1
- package/dist/chunk-s4fccg73.js +2 -0
- package/dist/{chunk-zrec546r.js → chunk-sddaassq.js} +1 -1
- package/dist/{chunk-6qw89f68.js → chunk-sj7n6xa1.js} +1 -1
- package/dist/{chunk-t5hq4ke1.js → chunk-t1r2ycn7.js} +1 -1
- package/dist/{chunk-1tdkpeva.js → chunk-tjj6ttj1.js} +1 -1
- package/dist/{chunk-dq681xgx.js → chunk-tsd9jw07.js} +1 -1
- package/dist/{chunk-s609kp6h.js → chunk-ttkjzy0m.js} +1 -1
- package/dist/chunk-txe5z472.js +2 -0
- package/dist/chunk-vffz69jj.js +2 -0
- package/dist/{chunk-sn0qr6q7.js → chunk-vs61069x.js} +1 -1
- package/dist/{chunk-3a5gcj3y.js → chunk-wc2z7krw.js} +1 -1
- package/dist/{chunk-jn3t9v6d.js → chunk-wfg3bp85.js} +1 -1
- package/dist/{chunk-5sh69bkj.js → chunk-wfwrm4k3.js} +1 -1
- package/dist/{chunk-3nn2j810.js → chunk-whtdmv3p.js} +1 -1
- package/dist/{chunk-gjhxc6ma.js → chunk-wk175yyw.js} +1 -1
- package/dist/chunk-wn9vr9ct.js +2 -0
- package/dist/{chunk-zwtx6vn3.js → chunk-wzncz6j5.js} +1 -1
- package/dist/{chunk-m8brd9b5.js → chunk-y2ntnpdb.js} +1 -1
- package/dist/{chunk-xhn5331s.js → chunk-y5fdq7cd.js} +1 -1
- package/dist/{chunk-7t8s2mcf.js → chunk-yh13j2af.js} +1 -1
- package/dist/chunk-yr6qyeab.js +2 -0
- package/dist/{chunk-q9mxgp0n.js → chunk-z2gcfvze.js} +11 -11
- package/dist/chunk-zj2pt1bx.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/registry/registry-client.d.ts +1 -0
- package/dist/src/setup.js +1 -1
- package/dist/src/utils/dependency-file-parser.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunk-18en5afz.js +0 -2
- package/dist/chunk-2bp1j0w0.js +0 -2
- package/dist/chunk-3578axtf.js +0 -2
- package/dist/chunk-3r0jb90q.js +0 -2
- package/dist/chunk-4x1mv7qj.js +0 -2
- package/dist/chunk-5qberaya.js +0 -2
- package/dist/chunk-86xv8x00.js +0 -2
- package/dist/chunk-87k997bm.js +0 -2
- package/dist/chunk-8jvmqdvc.js +0 -2
- package/dist/chunk-94tnmc7j.js +0 -4
- package/dist/chunk-c8xfj0m5.js +0 -2
- package/dist/chunk-cj5fkyxv.js +0 -2
- package/dist/chunk-d3m5kcpp.js +0 -2
- package/dist/chunk-dg1c0fyk.js +0 -2
- package/dist/chunk-fzfgvt8s.js +0 -2
- package/dist/chunk-j21m6rf6.js +0 -2
- package/dist/chunk-jjwxbcfz.js +0 -2
- package/dist/chunk-n5mz7csc.js +0 -2
- package/dist/chunk-nd780ymh.js +0 -2
- package/dist/chunk-tmzd2p2n.js +0 -2
- package/dist/chunk-tqsrr90t.js +0 -2
- package/dist/chunk-v9avf6sc.js +0 -2
- package/dist/chunk-w2vsf1q0.js +0 -2
- package/dist/chunk-xjrb50hz.js +0 -2
- package/dist/chunk-y0rng1vc.js +0 -2
- package/dist/chunk-z0rsmhe4.js +0 -2
- package/dist/chunk-zcsahxe6.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ka as a,la as b,ma as c,na as d,oa as e,pa as f,qa as g,ra as h,sa as i,ta as j,ua as k,va as l,wa as m}from"./chunk-
|
|
2
|
+
import{ka as a,la as b,ma as c,na as d,oa as e,pa as f,qa as g,ra as h,sa as i,ta as j,ua as k,va as l,wa as m}from"./chunk-psjrcpgb.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{e as summarizeGates,l as runPostMerge,d as runGates,i as runAiGates,m as isMergeEvent,f as gateIcon,j as findLinkedIssues,a as checkTitleFormat,g as checkLinkedIssue,b as checkDescription,c as checkDependencies,h as checkCustomAssertions,k as appendChangelogEntry};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{td as a}from"./chunk-hd74jxm2.js";import"./chunk-gvpsbmeg.js";import"./chunk-c63e4ssc.js";import"./chunk-x9vpk4kk.js";import"./chunk-r1jvyhhd.js";import"./chunk-2z9mh5y4.js";import"./chunk-yh13j2af.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{a as PullRequestGenerator};
|
|
@@ -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-
|
|
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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-16aeend1.js";import{spawn as E}from"child_process";async function y(z,A){return new Promise((k,x)=>{let q=E("git",z,{stdio:"pipe",cwd:A}),C="",D="";q.stdout?.on("data",(B)=>C+=B.toString()),q.stderr?.on("data",(B)=>D+=B.toString()),q.on("close",(B)=>{if(B===0)k(C);else x(Error(D||`git exited with code ${B}`))}),q.on("error",x)})}async function H(z,A,k){for(let x of z){let q=x.path.replace(/^\.\//,"").replace(/^\/+/,"");try{if(await y(["show",`${A}:${q}`],k)!==x.content)return!0;continue}catch{}try{if(await y(["show",`origin/${A}:${q}`],k)!==x.content)return!0;continue}catch{return!0}}return!1}async function I(z,A,k){if(z.length===0)return!1;if(await y(["add","--",...z],k),!(await y(["diff","--cached","--name-only"],k)).trim())return!1;await y(["commit","-m",A],k);let q=(await y(["rev-parse","--abbrev-ref","HEAD"],k)).trim();return await y(["push","origin",`HEAD:${q}`],k),!0}export{H as hasBranchDifferences,I as commitAndPush};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Rh as O}from"./chunk-wzncz6j5.js";import{Gj as A}from"./chunk-m3rftash.js";import{gl as x}from"./chunk-16aeend1.js";function T(z){let G=z.split("/").pop()||"";if(["deps.yaml","dependencies.yaml","pkgx.yaml",".deps.yaml"].includes(G))return!0;let j=G.replace(/\.(yaml|yml)$/,"");return["deps","dependencies","pkgx",".deps"].includes(j)}async function V(z,G){try{if(!T(z))return null;let J=[];try{let H=await A(z);if(H&&typeof H==="object"){if(H.allDependencies&&Array.isArray(H.allDependencies)){for(let K of H.allDependencies)if(K.name&&K.constraint)J.push({name:K.name,currentVersion:K.constraint,type:"dependencies",file:z})}}}catch(H){O().warn(`ts-pantry failed to parse ${z}, attempting fallback YAML parsing:`,H)}if(J.length===0)try{J=await B(G,z)}catch(H){O().warn(`Fallback YAML parsing failed for ${z}:`,H),J=[]}let j=z.split("/").pop()||"";return{path:z,type:j,content:G,dependencies:J}}catch(J){return O().warn(`Failed to parse dependency file ${z}:`,J),null}}async function B(z,G){let J=[],j=z.split(`
|
|
3
|
+
`),H=!1;for(let K of j){let Q=K.trim();if(Q==="dependencies:"){H=!0;continue}if(H){if(Q&&!K.startsWith(" ")&&!K.startsWith("\t")){H=!1;continue}let X=Q.match(/^([\w@/-]+):\s*(.+)$/);if(X){let[,Z,$]=X;J.push({name:Z.trim(),currentVersion:$.trim(),type:"dependencies",file:G})}}}return J}function b(z){try{return Bun.YAML.parse(z),!0}catch{return!1}}async function S(z,G,J){try{if(!T(z))return O().info(`\u26A0\uFE0F updateDependencyFile: ${z} is not a dependency file, returning original content`),G;if(G.trim().startsWith("{")&&G.includes('"require"'))return O().info(`\u26A0\uFE0F updateDependencyFile: Content appears to be JSON (composer.json), but file is ${z}`),O().info(`Content preview: ${G.substring(0,200)}`),G;let j=G;for(let H of J){let K=H.name.replace(/\s*\(dev\)$/,"").replace(/\s*\(peer\)$/,"").replace(/\s*\(optional\)$/,""),Q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`^([ \\t]*)("${Q}"|'${Q}'|${Q})([ \\t]*:[ \\t]*)(["']?)([^\\s#"']+)\\4([ \\t]*#[^\\r\\n]*)?`,"gm");j=j.replace(X,(Z,$,w,E,W,_,R)=>{if(["latest","*","main","master","develop","dev"].includes(_.toLowerCase().trim()))return O().info(`\u26A0\uFE0F Skipping update for ${K} - version "${_}" should be respected`),Z;if(U(_))return Z;let Y=_.match(/^(\D*)/)?.[1]??"",q=/^[\^~>=<]/.test(H.newVersion)?H.newVersion:`${Y}${H.newVersion}`;return`${$}${w}${E}${W}${q}${W}${R??""}`})}if(j!==G&&b(G)&&!b(j))return O().warn(`\u26A0\uFE0F Skipping updates for ${z}: the rewrite no longer parses as YAML, so the file is left unchanged`),G;return j}catch(j){return O().warn(`Failed to update dependency file ${z}:`,j),G}}async function v(z){let G=[],J=new Map;for(let j of z)if(T(j.file)){if(!J.has(j.file))J.set(j.file,[]);J.get(j.file).push(j)}for(let[j,H]of J)try{let K=await import("fs");if(K.existsSync(j)){let Q=K.readFileSync(j,"utf-8"),X=await S(j,Q,H);if(X!==Q)G.push({path:j,content:X,type:"update"}),O().info(`\u2705 Generated update for ${j} with ${H.length} package changes`);else O().info(`\u2139\uFE0F No changes needed for ${j} - versions already up to date`)}else O().warn(`\u26A0\uFE0F Dependency file ${j} does not exist`)}catch(K){O().warn(`Failed to generate updates for dependency file ${j}:`,K)}return G}function U(z){return/^(?:workspace|file|link|portal|git|github|gitlab|bitbucket|https?|git\+[a-z]+):/i.test(z.trim())}
|
|
4
|
+
export{T as Ag,V as Bg,S as Cg,v as Dg,U as Eg};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
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(`
|
|
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
|
|
5
|
+
export{Z as Eh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import _ from"process";var g=30000,b=2,D=500,A=30000,R=new Set(["GET","HEAD","PUT","DELETE","OPTIONS"]),S=new Set([408,425,429,500,502,503,504]);class w extends Error{url;method;attempts;timedOut;constructor(z,C,K,G,V,$){super(z,$);this.url=C;this.method=K;this.attempts=G;this.timedOut=V;this.name="HttpRequestError"}}function I(z){return new Promise((C)=>setTimeout(C,z))}function x(z){if(typeof z==="number"&&z>0)return z;let C=Number(_.env.BUDDY_HTTP_TIMEOUT_MS);if(Number.isFinite(C)&&C>0)return C;return g}function M(z,C=Date.now()){let K=z.get("retry-after");if(K){let G=Number(K);if(Number.isFinite(G)&&G>=0)return G*1000;let V=Date.parse(K);if(!Number.isNaN(V))return Math.max(0,V-C)}if(z.get("x-ratelimit-remaining")==="0"){let G=Number(z.get("x-ratelimit-reset"));if(Number.isFinite(G)&&G>0)return Math.max(0,G*1000-C)}return null}function h(z){if(S.has(z.status))return!0;if(z.status===403)return z.headers.get("x-ratelimit-remaining")==="0"||z.headers.has("retry-after");return!1}function f(z){return z.status===429||z.status===403}function L(z,C,K){let G=C*2**(z-1),V=Math.random()*C;return Math.min(G+V,K)}async function E(z,C={}){let{timeoutMs:K,retries:G=b,retryBaseMs:V=D,maxDelayMs:$=A,retryNonIdempotent:O=!1,onRetry:q,signal:W,...H}=C,Y=(H.method??"GET").toUpperCase(),N=O||R.has(Y),B=x(K),j=Math.max(1,G+1),J,P=!1;for(let Z=1;Z<=j;Z++){let k=AbortSignal.timeout(B),v=W?AbortSignal.any([W,k]):k;try{let Q=await fetch(z,{...H,signal:v});if(Z<j&&h(Q)){if(N||f(Q)){let F=M(Q.headers),X=Math.min(F??L(Z,V,$),$);q?.({attempt:Z,delayMs:X,reason:`HTTP ${Q.status}`}),await I(X);continue}}return Q}catch(Q){if(J=Q,W?.aborted)throw Q;if(P=Q instanceof Error&&(Q.name==="TimeoutError"||Q.name==="AbortError"),!(Z<j&&N))break;let X=L(Z,V,$);q?.({attempt:Z,delayMs:X,reason:P?`timeout after ${B}ms`:"network error"}),await I(X)}}let U=P?`timed out after ${B}ms`:`network error: ${J instanceof Error?J.message:String(J)}`;throw new w(`${Y} ${z} failed after ${j} attempt(s): ${U}`,z,Y,j,P,{cause:J})}async function c(z,C={}){try{let K=await E(z,C);if(!K.ok)return null;return await K.json()}catch{return null}}
|
|
3
|
-
export{g as
|
|
3
|
+
export{g as Hh,b as Ih,w as Jh,M as Kh,E as Lh,c as Mh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wd as j,zd as q}from"./chunk-
|
|
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
3
|
export{U as ud};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{D as s,E as t,F as u,G as v,H as w,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,u as p,v as q,w as r}from"./chunk-
|
|
2
|
+
import{D as s,E as t,F as u,G as v,H as w,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,u as p,v as q,w as r}from"./chunk-nk8wxxy7.js";import"./chunk-16aeend1.js";export{r as toFile,v as default,w as betaRefusalFallbackMiddleware,l as UnprocessableEntityError,f as RetryableError,m as RateLimitError,i as PermissionDeniedError,q as PagePromise,j as NotFoundError,n as InternalServerError,s as HUMAN_PROMPT,k as ConflictError,o as BetaFallbackState,u as BaseAnthropic,g as BadRequestError,h as AuthenticationError,a as AnthropicError,v as Anthropic,c as APIUserAbortError,p as APIPromise,b as APIError,e as APIConnectionTimeoutError,d as APIConnectionError,t as AI_PROMPT};
|
|
@@ -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-
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-16aeend1.js";var z={error:"error",warning:"warning",info:"notice"};function E(j){let q=[];for(let h of j.findings){let x=[`file=${h.file}`,`title=${h.ruleId}`];if(h.line!==void 0)x.push(`line=${h.line}`);let y=B(`${h.message}${h.fix?` \u2014 ${h.fix}`:""}`);q.push(`::${z[h.severity]} ${x.join(",")}::${y}`)}return q.join(`
|
|
3
3
|
`)}function B(j){return j.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
4
4
|
`,"%0A")}export{E as formatGitHub};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lb as a,Mb as b,Nb as c,Ob as d,Pb as e}from"./chunk-5yfaptmp.js";import"./chunk-
|
|
2
|
+
import{Lb as a,Mb as b,Nb as c,Ob as d,Pb as e}from"./chunk-5yfaptmp.js";import"./chunk-16aeend1.js";export{d as upsertReviewState,b as serializeReviewState,c as parseReviewState,e as needsReview,a as REVIEW_STATE_VERSION};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hb as a,Ib as b,Jb as c,Kb as d}from"./chunk-vckhctmr.js";import"./chunk-
|
|
2
|
+
import{Hb as a,Ib as b,Jb as c,Kb as d}from"./chunk-vckhctmr.js";import"./chunk-16aeend1.js";export{c as findDrift,a as driftFor,d as describeDrift,b as ROOT};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ge as a,he as b}from"./chunk-142zh7e5.js";import"./chunk-
|
|
2
|
+
import{ge as a,he as b}from"./chunk-142zh7e5.js";import"./chunk-16aeend1.js";export{b as auditParsed,a as audit};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Cb as a,Db as b}from"./chunk-4dz5x4xw.js";import"./chunk-q2tjkhez.js";import"./chunk-5yfaptmp.js";import"./chunk-vs61069x.js";import"./chunk-wfwrm4k3.js";import"./chunk-mr2d1zp0.js";import"./chunk-142zh7e5.js";import"./chunk-743mhx0e.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{b as runReviewForPR,a as reviewPullRequest};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sf as D}from"./chunk-24xvskkf.js";import{
|
|
2
|
+
import{Sf as D}from"./chunk-24xvskkf.js";import{Rh as C}from"./chunk-wzncz6j5.js";var O=".buddy/learnings.jsonl",R=20;function T(P){if(!P)return[];let E=[];for(let v of P.split(`
|
|
3
3
|
`)){let L=v.trim();if(!L||L.startsWith("#"))continue;try{let A=JSON.parse(L);if(typeof A.text!=="string"||!A.text.trim())continue;E.push({id:typeof A.id==="string"?A.id:_(A.text),text:A.text.trim(),...Array.isArray(A.paths)?{paths:A.paths.filter((o)=>typeof o==="string")}:{},...typeof A.kind==="string"?{kind:A.kind}:{},...A.source&&typeof A.source==="object"?{source:A.source}:{},createdAt:typeof A.createdAt==="string"?A.createdAt:new Date(0).toISOString()})}catch{continue}}return E}function M(P){return`${P.map((E)=>JSON.stringify(E)).join(`
|
|
4
4
|
`)}
|
|
5
5
|
`}function N(P,E={}){return{id:_(P),text:P.trim(),...E.paths?.length?{paths:E.paths}:{},...E.kind?{kind:E.kind}:{},...E.source?{source:E.source}:{},createdAt:new Date().toISOString()}}function Y(P,E){return[...P.filter((v)=>v.id!==E.id),E]}function q(P,E,v=R){let L=P.map((A)=>{if(!A.paths?.length)return{learning:A,score:1};let o=D(A.paths),I=E.some((V)=>o.matches(V));return{learning:A,score:I?2:0}}).filter((A)=>A.score>0);return L.sort((A,o)=>{if(A.score!==o.score)return o.score-A.score;return o.learning.createdAt.localeCompare(A.learning.createdAt)}),L.slice(0,v).map((A)=>A.learning)}function B(P){if(P.length===0)return"";return`Things this repository has told you before:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sf as K}from"./chunk-24xvskkf.js";import{lg as D}from"./chunk-
|
|
2
|
+
import{Sf as K}from"./chunk-24xvskkf.js";import{lg as D}from"./chunk-c63e4ssc.js";var F=[[0,59],[0,23],[1,31],[1,12],[0,6]];function I(j,J){let[U,B]=F[J],H=new Set;for(let Q of j.split(",")){let[X,Z]=Q.split("/"),q=Z===void 0?1:Number(Z);if(!Number.isInteger(q)||q<1)return null;let $,G;if(X==="*")$=U,G=B;else if(X.includes("-")){let[Y,_]=X.split("-").map(Number);if(!Number.isInteger(Y)||!Number.isInteger(_))return null;$=Y,G=_}else{let Y=Number(X);if(!Number.isInteger(Y))return null;$=Y,G=Y}if($<U||G>B||$>G)return null;for(let Y=$;Y<=G;Y+=q)H.add(Y)}return H.size>0?H:null}function L(j){let J=j.trim().split(/\s+/);if(J.length!==5)return null;let U=J.map((Z,q)=>I(Z,q));if(U.some((Z)=>Z===null))return null;let[,B,H,Q,X]=U;return{hours:B,daysOfMonth:H,months:Q,daysOfWeek:X}}function N(j,J){if(!J)return{hour:j.getHours(),day:j.getDate(),month:j.getMonth()+1,weekday:j.getDay()};let U=new Intl.DateTimeFormat("en-US",{timeZone:J,hour:"numeric",hour12:!1,day:"numeric",month:"numeric",weekday:"short"}),B=Object.fromEntries(U.formatToParts(j).map((Q)=>[Q.type,Q.value])),H=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return{hour:Number(B.hour)%24,day:Number(B.day),month:Number(B.month),weekday:Math.max(0,H.indexOf(B.weekday))}}function C(j,J=new Date,U){let B=L(j);if(!B)return!1;let{hour:H,day:Q,month:X,weekday:Z}=N(J,U);if(!B.hours.has(H)||!B.months.has(X))return!1;let q=B.daysOfMonth.size<31,$=B.daysOfWeek.size<7;if(q&&$)return B.daysOfMonth.has(Q)||B.daysOfWeek.has(Z);return B.daysOfMonth.has(Q)&&B.daysOfWeek.has(Z)}function W(j){if(j.dependencyType==="github-actions")return"github-actions";if(j.dependencyType==="docker-image")return"docker";if(j.dependencyType==="zig-dependencies")return"zig";if(j.dependencyType==="python"||j.dependencyType==="rust"||j.dependencyType==="go"||j.dependencyType==="ruby")return j.dependencyType;if(j.file.endsWith("composer.json")||j.file.endsWith("composer.lock"))return"composer";if(j.file.endsWith("package.json"))return"npm";return"pkgx"}function A(j,J,U=new Date){if(j.matchPackages?.length){if(!K(j.matchPackages).matches(J.name))return!1}if(j.matchEcosystems?.length&&!j.matchEcosystems.includes(W(J)))return!1;if(j.matchDepTypes?.length&&!j.matchDepTypes.includes(J.dependencyType))return!1;if(j.matchUpdateTypes?.length&&!j.matchUpdateTypes.includes(J.updateType))return!1;if(j.matchFiles?.length){if(!K(j.matchFiles).matches(J.file))return!1}if(j.matchCurrentVersion&&!E(J.currentVersion,j.matchCurrentVersion))return!1;if(j.schedule&&!C(j.schedule,U,j.scheduleTimezone))return!1;return!0}function E(j,J){let U=j.replace(/^[\^~>=<\s]+/,"").trim();return U?D(U,J):!1}function S(j,J=[],U=new Date){let B={enabled:!0,labels:[],reviewers:[],assignees:[],prPriority:0};for(let H of J){if(!A(H,j,U))continue;if(H.enabled!==void 0)B.enabled=H.enabled;if(H.strategy!==void 0)B.strategy=H.strategy;if(H.groupName!==void 0)B.groupName=H.groupName;if(H.autoMerge!==void 0)B.autoMerge=H.autoMerge;if(H.minimumReleaseAge!==void 0)B.minimumReleaseAge=H.minimumReleaseAge;if(H.prPriority!==void 0)B.prPriority=H.prPriority;if(H.autoMigrate!==void 0)B.autoMigrate=H.autoMigrate;for(let Q of H.labels??[])if(!B.labels.includes(Q))B.labels.push(Q);for(let Q of H.reviewers??[])if(!B.reviewers.includes(Q))B.reviewers.push(Q);for(let Q of H.assignees??[])if(!B.assignees.includes(Q))B.assignees.push(Q)}return B}function k(j,J=[],U=new Date){let B=[];for(let H of j){let Q=S(H,J,U);if(!Q.enabled)continue;if(Q.strategy&&!V(Q.strategy,H.updateType))continue;B.push({update:H,effects:Q})}return B}function T(j){let J=new Set,U=new Set,B=new Set,H=0;for(let Q of j)Q.labels.forEach((X)=>J.add(X)),Q.reviewers.forEach((X)=>U.add(X)),Q.assignees.forEach((X)=>B.add(X)),H=Math.max(H,Q.prPriority);return{labels:[...J],reviewers:[...U],assignees:[...B],autoMerge:j.length>0&&j.every((Q)=>Q.autoMerge===!0),prPriority:H,autoMigrate:j.some((Q)=>Q.autoMigrate===!0)}}function V(j,J){switch(j){case"all":return!0;case"major":return J==="major";case"minor":return J==="minor"||J==="patch";case"patch":return J==="patch"}}function b(j=[]){return j.map((J)=>({matchPackages:J.patterns,groupName:J.name,...J.strategy?{strategy:J.strategy}:{}}))}
|
|
3
3
|
export{W as sf,A as tf,S as uf,k as vf,T as wf,V as xf,b as yf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Eb as a,Fb as b,Gb as c}from"./chunk-q2tjkhez.js";import"./chunk-
|
|
2
|
+
import{Eb as a,Fb as b,Gb as c}from"./chunk-q2tjkhez.js";import"./chunk-16aeend1.js";export{b as renderDiffForReview,a as parseUnifiedDiff,c as collectGitDiff};
|
|
@@ -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{
|
|
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.
|
|
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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Rh as z}from"./chunk-wzncz6j5.js";function Y(q,F,M=""){if(typeof F!=="object"||F===null)return[];let C=F,Q=M||"(root)",N=[];if(typeof C.type==="string"){let K=D(q);if(!(C.type==="integer"?Number.isInteger(q):K===C.type||C.type==="number"&&K==="integer"))return N.push({path:Q,message:`expected ${C.type}, got ${K}`}),N}if(Array.isArray(C.enum)&&!C.enum.includes(q))N.push({path:Q,message:`expected one of ${C.enum.map((K)=>JSON.stringify(K)).join(", ")}`});if(Array.isArray(C.required)&&typeof q==="object"&&q!==null){for(let K of C.required)if(!(String(K)in q))N.push({path:M?`${M}.${K}`:String(K),message:"is required but missing"})}if(typeof C.properties==="object"&&C.properties!==null&&typeof q==="object"&&q!==null)for(let[K,V]of Object.entries(C.properties)){let X=q[K];if(X!==void 0)N.push(...Y(X,V,M?`${M}.${K}`:K))}if(C.items!==void 0&&Array.isArray(q))q.forEach((K,V)=>{N.push(...Y(K,C.items,`${M}[${V}]`))});return N}function D(q){if(q===null)return"null";if(Array.isArray(q))return"array";if(Number.isInteger(q))return"integer";return typeof q}async function B(q){let F=q.logger??z(),M=q.maxRetries??2,C=q.system??"You are running as a pipeline step. Answer the request directly and completely. There is no interactive user to ask follow-up questions of.",Q="";for(let N=1;N<=M+1;N++){let K=N===1?q.prompt:`${q.prompt}
|
|
3
3
|
|
|
4
4
|
Your previous answer did not satisfy the required schema:
|
|
5
5
|
${Q}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{zh as W}from"./chunk-yh13j2af.js";import{Lh as y}from"./chunk-s0ps33ft.js";import{Rh as J}from"./chunk-wzncz6j5.js";import{gl as F}from"./chunk-16aeend1.js";import S from"process";function G(E){let q=E.replace(/\\/g,"/");return q.includes(".github/workflows/")&&(q.endsWith(".yml")||q.endsWith(".yaml"))}async function L(E,q){try{if(!G(E))return null;let I=[],j=q.split(`
|
|
3
3
|
`);for(let K=0;K<j.length;K++){let Q=j[K].trim().match(/^-?\s*uses:\s*(.+)/);if(Q){let $=Q[1].trim().replace(/['"`]/g,"");if($.startsWith("./")||$.startsWith("docker://"))continue;let X=$.split("@");if(X.length===2){let[_,Y]=X;if(!_||!_.trim())continue;let[z,...k]=Y.split("#"),M=z.trim(),V={name:_.trim(),currentVersion:M,type:"github-actions",file:E};if(v(M)){let x=k.join("#").trim().split(/\s+/)[0];V.metadata=x?{pinnedSha:M,pinnedVersion:x}:{pinnedSha:M}}if(!I.find((x)=>x.name===V.name&&x.currentVersion===V.currentVersion))I.push(V)}}}return{path:E,type:"github-actions",content:q,dependencies:I}}catch(I){return J().warn(`Failed to parse GitHub Actions file ${E}:`,I),null}}function v(E){return/^[0-9a-f]{40}$/i.test(E)}function R(E,q){return E.replace(/^v/i,"")===q.replace(/^v/i,"")}async function U(E,q,I){try{if(!G(E))return q;let j=q;for(let K of I){let O=K.name.replace(/\s*\(.*\)$/,""),Z=O.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(K.resolved?.sha){let $=new RegExp(`((?:^\\s*-\\s*)?uses:\\s*["']?)(${Z})@(${K.currentVersion})(["']?)([ \\t]*#[^\\n]*)?`,"gm");j=j.replace($,`$1$2@${K.resolved.sha}$4 # ${K.newVersion}`);continue}let Q=new RegExp(`((?:^\\s*-\\s*)?uses:\\s*["']?)(${O.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})@(${K.currentVersion.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})(["']?)`,"gm");j=j.replace(Q,`$1$2@${K.newVersion}$4`)}return j}catch(j){return J().warn(`Failed to update GitHub Actions file ${E}:`,j),q}}async function D(E){let q=[],I=new Map;for(let j of E)if(G(j.file)){if(!I.has(j.file))I.set(j.file,[]);I.get(j.file).push(j)}for(let[j,K]of I)try{let O=await import("fs");if(O.existsSync(j)){let Z=O.readFileSync(j,"utf-8"),Q=await U(j,Z,K);q.push({path:j,content:Q,type:"update"})}}catch(O){J().warn(`Failed to generate updates for GitHub Actions file ${j}:`,O)}return q}async function b(E,q){let[I,j]=E.split("/");if(!I||!j)return null;let K={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"},O=S.env.BUDDY_TOKEN||S.env.GITHUB_TOKEN||S.env.GH_TOKEN;if(O)K.Authorization=`Bearer ${O}`;try{let Z=await y(`${W()}/repos/${I}/${j}/commits/${encodeURIComponent(q)}`,{headers:K});if(!Z.ok)return null;let Q=await Z.json();return Q.sha&&v(Q.sha)?Q.sha:null}catch{return null}}async function P(E){try{if(!E.includes("/"))return J().info(`\u26A0\uFE0F Invalid action name format: ${E}`),null;let[q,I]=E.split("/");J().info(`\uD83D\uDD0D Fetching latest version for ${q}/${I}`);let j={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"},K=S.env.BUDDY_TOKEN||S.env.GITHUB_TOKEN||S.env.GH_TOKEN;if(K)j.Authorization=`Bearer ${K}`;let O=W();J().info(`\uD83D\uDCE1 Trying latest release for ${q}/${I}`);let Z=await y(`${O}/repos/${q}/${I}/releases/latest`,{headers:j});if(Z.ok){let X=await Z.json();if(X.tag_name)return J().info(`\u2705 Found latest release: ${X.tag_name}`),X.tag_name}else J().info(`\u26A0\uFE0F Latest release not found: ${Z.status} ${Z.statusText}`);J().info(`\uD83D\uDCE1 Trying all releases for ${q}/${I}`);let Q=await y(`${O}/repos/${q}/${I}/releases?per_page=10`,{headers:j});if(Q.ok){let X=await Q.json();if(!Array.isArray(X))J().info("\u26A0\uFE0F Unexpected releases response format (expected array)");else{J().info(`\uD83D\uDCCB Found ${X.length} releases`);let _=X.filter((Y)=>Y.tag_name&&!Y.tag_name.includes("-")).sort((Y,z)=>{let k=Y.published_at?new Date(Y.published_at).getTime():0;return(z.published_at?new Date(z.published_at).getTime():0)-k});if(_.length>0)return J().info(`\u2705 Found latest stable release: ${_[0].tag_name}`),_[0].tag_name||null}}else J().info(`\u26A0\uFE0F Releases not found: ${Q.status} ${Q.statusText}`);J().info(`\uD83D\uDCE1 Trying tags for ${q}/${I}`);let $=await y(`${O}/repos/${q}/${I}/tags?per_page=10`,{headers:j});if($.ok){let X=await $.json();if(!Array.isArray(X))J().info("\u26A0\uFE0F Unexpected tags response format (expected array)");else{J().info(`\uD83D\uDCCB Found ${X.length} tags`);let _=X.filter((Y)=>Y.name&&!Y.name.includes("-")).map((Y)=>Y.name).sort((Y,z)=>{let k=Y.replace(/^v/,""),M=z.replace(/^v/,""),V=k.split(".").map(Number),B=M.split(".").map(Number);for(let x=0;x<Math.max(V.length,B.length);x++){let H=V[x]||0,T=B[x]||0;if(H!==T)return T-H}return 0});if(_.length>0)return J().info(`\u2705 Found latest stable tag: ${_[0]}`),_[0]}}else J().info(`\u26A0\uFE0F Tags not found: ${$.status} ${$.statusText}`);return J().info(`\u274C No version found for ${E}`),null}catch(q){return J().warn(`Failed to fetch latest version for ${E}:`,q),null}}
|
|
4
4
|
export{G as xe,L as ye,v as ze,R as Ae,U as Be,D as Ce,b as De,P as Ee};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class I extends Error{status;method;url;repository;responseBody;constructor(j,k,q,P,Q,S){super(j);this.status=k;this.method=q;this.url=P;this.repository=Q;this.responseBody=S;this.name="GitHubApiError"}get isNotFound(){return this.status===404||this.status===410}get isForbidden(){return this.status===403}}function G(j,k=2000){let q=J(j);return q.length>k?`${q.slice(0,k)}\u2026 (truncated)`:q}function J(j){if(j instanceof Error){let k=j.cause;if(k!==void 0&&k!==null){let q=k instanceof Error?k.message:String(k);if(q&&!j.message.includes(q))return`${j.message} (cause: ${q})`}return j.message}if(typeof j==="string")return j;try{return JSON.stringify(j)}catch{return String(j)}}import K from"process";var C={silent:0,error:1,warn:2,info:3,debug:4};function B(j){return j.map((k)=>k instanceof Error?G(k):k)}function N(){let j=K.env.BUDDY_LOG_LEVEL?.toLowerCase();return j&&j in C?j:void 0}class z{level;constructor(j=!1,k){this.level=k??N()??(j?"debug":"info")}enabled(j){return C[this.level]>=C[j]}info(j,...k){if(this.enabled("info"))console.log(j,...B(k))}warn(j,...k){if(this.enabled("warn"))console.warn(j,...B(k))}error(j,...k){if(this.enabled("error"))console.error(j,...B(k))}debug(j,...k){if(this.enabled("debug"))console.log(`\x1B[90m\uD83D\uDC1B\x1B[0m ${j}`,...B(k))}success(j,...k){if(this.enabled("info"))console.log(`\x1B[32m\u2713\x1B[0m ${j}`,...B(k))}get logLevel(){return this.level}static verbose(){return new z(!0,"debug")}static quiet(){return new z(!1,"info")}static silent(){return new z(!1,"silent")}static withLevel(j){return new z(!1,j)}}var H=new z(!1);function Y(j){H=j}function Z(){return H}
|
|
3
|
-
export{I as
|
|
3
|
+
export{I as Nh,G as Oh,z as Ph,Y as Qh,Z as Rh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Va as t,Wa as u}from"./chunk-
|
|
2
|
+
import{Va as t,Wa as u}from"./chunk-her5azyp.js";import{$a as z,Xa as v,Ya as w,Za as x,_a as y,ab as A,bb as B,cb as C,db as D,eb as E,fb as F,gb as G}from"./chunk-jqh7vx2n.js";import{hb as H,ib as I,jb as J,kb as K,lb as L}from"./chunk-gg1ddvnf.js";import"./chunk-vs61069x.js";import"./chunk-wfwrm4k3.js";import{Af as b,Bf as c,Cf as d,Df as e,Ef as f,zf as a}from"./chunk-1pecmenc.js";import{Ff as g,Gf as h,Hf as i,If as j,Jf as k,Kf as l,Lf as m,Mf as n,Nf as o,Of as p,Pf as q,Qf as r,Rf as s}from"./chunk-hk4d7rky.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-cj4d5ad7.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{i as writeFileTool,r as wrapUntrusted,F as withTouchOffer,I as verifyChanges,w as unitTestsTouch,J as stackedBranchName,y as simplifyTouch,n as shellTool,K as runStackedTouch,u as runPlan,s as runAgent,a as reviewMode,g as resolveWorkspacePath,D as renderTouchOffer,h as readFileTool,z as planTouch,d as planMode,G as parseTouchSelections,j as listDirTool,b as implementMode,E as hasTouchOffer,B as getFinishingTouch,f as getAgentMode,k as fsTools,c as fixCiMode,v as docstringsTouch,L as detectChangedFiles,t as createReadIssueTool,m as buildShellEnv,x as autofixTouch,q as Toolbelt,o as ToolPermissionError,C as TOUCH_OFFER_MARKER,H as TEST_COMMANDS,l as SHELL_ENV_ALLOWLIST,A as FINISHING_TOUCHES,p as BUILTIN_TOOLS,e as AGENT_MODES};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{mb as w}from"./chunk-
|
|
2
|
+
import{mb as w}from"./chunk-byqzhgzs.js";import{Ab as u,Bb as v,Cb as x,Db as y,nb as d,ob as e,pb as f,qb as g,rb as h,sb as i,tb as j,ub as k,vb as l,wb as q,xb as r,yb as s,zb as t}from"./chunk-4dz5x4xw.js";import{Eb as a,Fb as b,Gb as c}from"./chunk-q2tjkhez.js";import{Lb as m,Mb as n,Nb as o,Pb as p}from"./chunk-5yfaptmp.js";import"./chunk-vs61069x.js";import"./chunk-wfwrm4k3.js";import{Ed as z,Fd as A,Gd as B,Hd as C,Id as D,Jd as E,Kd as F,Ld as G,Md as H,Nd as I}from"./chunk-7m3pzkcj.js";import"./chunk-mr2d1zp0.js";import"./chunk-142zh7e5.js";import"./chunk-743mhx0e.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{g as validateFindings,I as shouldFail,n as serializeReviewState,y as runReviewForPR,x as reviewPullRequest,j as reviewDiff,w as resolveBuddyThreads,u as renderFinding,b as renderDiffForReview,v as prepareReview,a as parseUnifiedDiff,o as parseReviewState,p as needsReview,s as loadGuidelines,G as formatReview,C as formatPretty,D as formatGithub,E as formatAgent,f as fingerprint,A as diffArgsFor,l as defaultIncludePath,h as dedupeFindings,F as countBySeverity,t as composeInstructions,B as collectLocalDiff,c as collectGitDiff,H as applySuggestion,k as anchorMap,d as SEVERITY_ORDER,m as REVIEW_STATE_VERSION,e as REVIEW_SCHEMA,z as REVIEW_FORMATS,r as MAX_GUIDELINE_CHARS,q as DEFAULT_GUIDELINE_FILES,i as DEFAULT_EXCLUDED_PATHS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import z from"fs";import F from"os";import Y from"path";import K from"process";var G="https://api.github.com",P="https://github.com",S="https://registry.npmjs.org",A="https://packagist.org";function $(j){return j.trim().replace(/\/+$/,"")}function b(...j){for(let q of j)if(q&&q.trim())return q;return}function y(j){return $(b(j?.repository?.apiUrl,K.env.GITHUB_API_URL,G))}function L(j){return $(b(j?.repository?.serverUrl,K.env.GITHUB_SERVER_URL,P))}function C(){return K.env.HOME||K.env.USERPROFILE||F.homedir()}var H=new Map;function D(j){let q=H.get(j);if(q)return q;let J={scoped:new Map},Q=[Y.join(C(),".npmrc"),Y.join(j,".npmrc")];for(let X of Q){let M;try{M=z.readFileSync(X,"utf-8")}catch{continue}for(let O of M.split(`
|
|
3
3
|
`)){let W=O.trim();if(!W||W.startsWith("#")||W.startsWith(";"))continue;let x=W.indexOf("=");if(x===-1)continue;let Z=W.slice(0,x).trim(),V=I(W.slice(x+1).trim());if(!V)continue;if(Z==="registry")J.default=V;else if(Z.endsWith(":registry")&&Z.startsWith("@"))J.scoped.set(Z.slice(0,-9),V)}}return H.set(j,J),J}function I(j){return j.replace(/\$\{([^}]+)\}/g,(q,J)=>K.env[J]??"")}function w(){H.clear()}function N(j,q,J=K.cwd()){let Q=j?.startsWith("@")?j.split("/")[0]:void 0,X=D(J);return $(b(Q?q?.registries?.npmScopes?.[Q]:void 0,q?.registries?.npm,K.env.NPM_CONFIG_REGISTRY,Q?X.scoped.get(Q):void 0,X.default,S))}function U(j){return $(b(j?.registries?.composer,K.env.COMPOSER_REGISTRY_URL,A))}
|
|
4
|
-
export{y as
|
|
4
|
+
export{y as zh,L as Ah,w as Bh,N as Ch,U as Dh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ea as a,Fa as b,Ga as c,Ha as d,Ia as e,Ja as f,Ka as g}from"./chunk-9chq5m4p.js";import"./chunk-s3b3vrsj.js";import"./chunk-6gvx1g6h.js";import"./chunk-743mhx0e.js";import"./chunk-1pecmenc.js";import"./chunk-hk4d7rky.js";import"./chunk-z18bksyr.js";import"./chunk-cj4d5ad7.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{g as runFixCi,e as latestFailurePerWorkflow,d as failsOnBaseBranch,b as extractErrorLines,c as describeFailure,a as classifyFailure,f as attemptFix};
|