@buddysh/buddy 0.11.6 → 0.11.7

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/dist/bin/cli.js +19 -19
  3. package/dist/{chunk-xj99g66b.js → chunk-03j2dx5h.js} +2 -2
  4. package/dist/chunk-06k6abjj.js +2 -0
  5. package/dist/{chunk-c64qrkpz.js → chunk-0ewzxzt3.js} +2 -2
  6. package/dist/{chunk-90x7e4ra.js → chunk-19n3wnxq.js} +5 -5
  7. package/dist/{chunk-2r5s586j.js → chunk-1n42ghef.js} +2 -2
  8. package/dist/chunk-1q6s6a5e.js +2 -0
  9. package/dist/{chunk-wsxy4w86.js → chunk-1szfwcst.js} +1 -1
  10. package/dist/{chunk-3nygvd78.js → chunk-1z4nhstx.js} +2 -2
  11. package/dist/{chunk-3f34dgnn.js → chunk-1z9a3hpe.js} +1 -1
  12. package/dist/chunk-23c6tfbw.js +2 -0
  13. package/dist/{chunk-rfvn4j6n.js → chunk-2egzc1fp.js} +1 -1
  14. package/dist/chunk-2ppt1rrx.js +2 -0
  15. package/dist/chunk-2pv5zwbm.js +38 -0
  16. package/dist/{chunk-kzgyhhtz.js → chunk-305184z3.js} +1 -1
  17. package/dist/{chunk-ge2r1zmq.js → chunk-39ne6m3w.js} +1 -1
  18. package/dist/{chunk-e6wny1pp.js → chunk-3d3rwmmj.js} +1 -1
  19. package/dist/{chunk-88k998tw.js → chunk-3d5pjrz7.js} +2 -2
  20. package/dist/chunk-3jw9d546.js +2 -0
  21. package/dist/{chunk-j8era2yj.js → chunk-3wy8fypy.js} +2 -2
  22. package/dist/{chunk-86kymmen.js → chunk-3z759ya5.js} +1 -1
  23. package/dist/{chunk-d84k4mek.js → chunk-3zk2ye6r.js} +1 -1
  24. package/dist/{chunk-zc7g037n.js → chunk-4b0p7kgk.js} +1 -1
  25. package/dist/chunk-4d13qb9f.js +2 -0
  26. package/dist/{chunk-bxdbf2kj.js → chunk-4gx2f1k6.js} +1 -1
  27. package/dist/{chunk-43p5vzvb.js → chunk-4mwgk0jh.js} +2 -2
  28. package/dist/{chunk-te6etc5c.js → chunk-4rvgatmm.js} +1 -1
  29. package/dist/{chunk-jhfkzveb.js → chunk-4wh0wryv.js} +2 -2
  30. package/dist/{chunk-nj38e2km.js → chunk-4ycesykg.js} +1 -1
  31. package/dist/chunk-52jcty4n.js +2 -0
  32. package/dist/{chunk-tvrz1xp5.js → chunk-55znd3yn.js} +1 -1
  33. package/dist/chunk-5ct11b1j.js +2 -0
  34. package/dist/{chunk-rp3ytb19.js → chunk-5gybfx14.js} +1 -1
  35. package/dist/chunk-5zs6jrpt.js +2 -0
  36. package/dist/{chunk-1zv0s60b.js → chunk-675c6ddc.js} +2 -2
  37. package/dist/{chunk-wkq57ssc.js → chunk-6k6dgwmy.js} +1 -1
  38. package/dist/{chunk-4sqwtry6.js → chunk-6sm15trq.js} +1 -1
  39. package/dist/chunk-6t1rb4tz.js +2 -0
  40. package/dist/{chunk-d7e6tqmr.js → chunk-7wk4px2k.js} +2 -2
  41. package/dist/{chunk-e3wax332.js → chunk-88j356ng.js} +1 -1
  42. package/dist/{chunk-5qssa20j.js → chunk-89s9f3mf.js} +1 -1
  43. package/dist/{chunk-9cnq8y3d.js → chunk-97cvp0t3.js} +1 -1
  44. package/dist/{chunk-kbkvw42w.js → chunk-9b2yfhzj.js} +1 -1
  45. package/dist/{chunk-nf9dfx4t.js → chunk-9b4z1bpx.js} +1 -1
  46. package/dist/{chunk-m1zp48mr.js → chunk-a1fkxmxq.js} +1 -1
  47. package/dist/chunk-a4m6bqpq.js +2 -0
  48. package/dist/{chunk-zpxg12ep.js → chunk-bggpgbdx.js} +1 -1
  49. package/dist/{chunk-3k62kevg.js → chunk-c87s8txp.js} +1 -1
  50. package/dist/{chunk-zhfrmseh.js → chunk-cbqg29zr.js} +1 -1
  51. package/dist/{chunk-ffp0mgf5.js → chunk-d2d5m2kx.js} +3 -3
  52. package/dist/{chunk-b4a5gw9c.js → chunk-ddmvjp0y.js} +1 -1
  53. package/dist/chunk-djdf848n.js +2 -0
  54. package/dist/chunk-dsep28r5.js +2 -0
  55. package/dist/chunk-e6sg7jg4.js +2 -0
  56. package/dist/{chunk-qzens4rg.js → chunk-efqnnrwq.js} +1 -1
  57. package/dist/{chunk-ej7gpg23.js → chunk-eftyxrxw.js} +2 -2
  58. package/dist/chunk-eme4fny7.js +2 -0
  59. package/dist/{chunk-yj6xx2b8.js → chunk-emygmh7r.js} +1 -1
  60. package/dist/{chunk-d73ympxb.js → chunk-f001yg2a.js} +3 -3
  61. package/dist/{chunk-bprmzg0p.js → chunk-f0z6kyqt.js} +1 -1
  62. package/dist/chunk-f298fv6p.js +2 -0
  63. package/dist/chunk-fjp4k18r.js +2 -0
  64. package/dist/{chunk-ak9s0vnr.js → chunk-fvhnza91.js} +2 -2
  65. package/dist/{chunk-abfyz98y.js → chunk-gvnsr72j.js} +1 -1
  66. package/dist/{chunk-1p9hgr6z.js → chunk-gw3t78fw.js} +1 -1
  67. package/dist/chunk-h4084ykd.js +2 -0
  68. package/dist/{chunk-e1cvrjf0.js → chunk-he97rsmj.js} +2 -2
  69. package/dist/{chunk-k8pnnyq1.js → chunk-hkb714k3.js} +1 -1
  70. package/dist/{chunk-k53ndvfv.js → chunk-j0bsva07.js} +2 -2
  71. package/dist/{chunk-t3340cv5.js → chunk-ja3rvd6y.js} +1 -1
  72. package/dist/chunk-jczf4z85.js +2 -0
  73. package/dist/{chunk-ffb50kwa.js → chunk-jpdd59fh.js} +1 -1
  74. package/dist/{chunk-f7aw9cr3.js → chunk-kpqez1ht.js} +1 -1
  75. package/dist/{chunk-56q8k98m.js → chunk-ktmgq0ja.js} +1 -1
  76. package/dist/{chunk-mfhwcnxr.js → chunk-m17kvr7m.js} +1 -1
  77. package/dist/chunk-m2qq154g.js +2 -0
  78. package/dist/chunk-m8kqe55k.js +2 -0
  79. package/dist/chunk-n42c80f3.js +2 -0
  80. package/dist/{chunk-27jza51d.js → chunk-na0b9r57.js} +1 -1
  81. package/dist/chunk-nfcyqj66.js +2 -0
  82. package/dist/{chunk-bjg4gxs4.js → chunk-nhe8axrf.js} +2 -2
  83. package/dist/{chunk-j3bzf5m0.js → chunk-njfbmhm4.js} +7 -7
  84. package/dist/{chunk-47ancrn1.js → chunk-p8azbpq6.js} +2 -2
  85. package/dist/{chunk-d1yhv10h.js → chunk-p96zq2zc.js} +2 -2
  86. package/dist/chunk-pvfavmy3.js +2 -0
  87. package/dist/{chunk-jaewrjw3.js → chunk-q0tve4cm.js} +1 -1
  88. package/dist/{chunk-pkcvytq6.js → chunk-q5pxt13t.js} +1 -1
  89. package/dist/{chunk-95je030a.js → chunk-qczzpthf.js} +1 -1
  90. package/dist/{chunk-qmhd1bgx.js → chunk-qk43d3vv.js} +1 -1
  91. package/dist/{chunk-5bedx7s3.js → chunk-qv1nvaha.js} +1 -1
  92. package/dist/{chunk-rpkwbqr8.js → chunk-qz5nqeza.js} +1 -1
  93. package/dist/chunk-rfgacg5h.js +2 -0
  94. package/dist/{chunk-8mrbvnae.js → chunk-sczx20gw.js} +2 -2
  95. package/dist/chunk-sf4p2t84.js +2 -0
  96. package/dist/chunk-sjk83y3d.js +2 -0
  97. package/dist/{chunk-8dq3gews.js → chunk-srznv36n.js} +2 -2
  98. package/dist/chunk-t0kvt1pm.js +2 -0
  99. package/dist/{chunk-erbqszzp.js → chunk-t3a1703q.js} +1 -1
  100. package/dist/{chunk-1zz8bd1c.js → chunk-tgh61e5e.js} +2 -2
  101. package/dist/{chunk-kqam9qmd.js → chunk-v6dephze.js} +2 -2
  102. package/dist/{chunk-2vmaeyh3.js → chunk-v8746363.js} +3 -3
  103. package/dist/{chunk-kypdeb29.js → chunk-vckn5ate.js} +1 -1
  104. package/dist/{chunk-y1hppm93.js → chunk-w16pwfh3.js} +1 -1
  105. package/dist/{chunk-6qb96bg0.js → chunk-wcjf072v.js} +1 -1
  106. package/dist/chunk-wfn702a2.js +2 -0
  107. package/dist/{chunk-pwa2tt2e.js → chunk-wr1q4k9e.js} +1 -1
  108. package/dist/{chunk-df75rm51.js → chunk-wts1sqw7.js} +1 -1
  109. package/dist/{chunk-mtp0aygy.js → chunk-x4ea69ek.js} +2 -2
  110. package/dist/{chunk-7g13yp3v.js → chunk-xe2xdg6z.js} +1 -1
  111. package/dist/{chunk-myswpb7z.js → chunk-xny4kgcc.js} +1 -1
  112. package/dist/chunk-xpsetmcw.js +2 -0
  113. package/dist/{chunk-pqbzatbq.js → chunk-xzhzvdcv.js} +1 -1
  114. package/dist/chunk-yd834q68.js +2 -0
  115. package/dist/{chunk-nr1c0dny.js → chunk-yke7v3gh.js} +1 -1
  116. package/dist/chunk-ymwjjyke.js +2 -0
  117. package/dist/{chunk-0xxqw1h6.js → chunk-ysp81zyt.js} +1 -1
  118. package/dist/{chunk-e4bcngja.js → chunk-z456ptfw.js} +1 -1
  119. package/dist/{chunk-0t8q4880.js → chunk-zkv7e2q2.js} +1 -1
  120. package/dist/{chunk-nz0ns7ah.js → chunk-ztw515ew.js} +2 -2
  121. package/dist/src/git/github-provider.d.ts +8 -0
  122. package/dist/src/index.js +1 -1
  123. package/dist/src/setup.js +1 -1
  124. package/package.json +1 -1
  125. package/dist/chunk-042211k4.js +0 -2
  126. package/dist/chunk-04sy4xt9.js +0 -2
  127. package/dist/chunk-0j7rmr49.js +0 -2
  128. package/dist/chunk-217bhn06.js +0 -2
  129. package/dist/chunk-2k4gkkc6.js +0 -2
  130. package/dist/chunk-2kkwhrfz.js +0 -2
  131. package/dist/chunk-4m1vgh1w.js +0 -38
  132. package/dist/chunk-9ychha5r.js +0 -2
  133. package/dist/chunk-az2vad31.js +0 -2
  134. package/dist/chunk-ba1t70ph.js +0 -2
  135. package/dist/chunk-dbawp9kg.js +0 -2
  136. package/dist/chunk-dh9dw57m.js +0 -2
  137. package/dist/chunk-dkhvqxrk.js +0 -2
  138. package/dist/chunk-ecs7b2kg.js +0 -2
  139. package/dist/chunk-edgg7wxb.js +0 -2
  140. package/dist/chunk-h82t0mnh.js +0 -2
  141. package/dist/chunk-k10hm62v.js +0 -2
  142. package/dist/chunk-mmc8tvbb.js +0 -2
  143. package/dist/chunk-p3qck29r.js +0 -2
  144. package/dist/chunk-qe63pqwy.js +0 -2
  145. package/dist/chunk-qxc77b08.js +0 -2
  146. package/dist/chunk-r9k5vnrw.js +0 -2
  147. package/dist/chunk-rnv477z3.js +0 -2
  148. package/dist/chunk-s7da3h7c.js +0 -2
  149. package/dist/chunk-swphrsyr.js +0 -2
  150. package/dist/chunk-sx8pyc83.js +0 -2
  151. package/dist/chunk-sy3h7j1x.js +0 -2
  152. package/dist/chunk-ttx1jk5b.js +0 -2
  153. package/dist/chunk-v5qn8kjd.js +0 -2
  154. package/dist/chunk-vj9stet1.js +0 -2
  155. package/dist/chunk-w6bd9r6p.js +0 -2
  156. package/dist/chunk-x59yras6.js +0 -2
  157. package/dist/chunk-xfmzts7d.js +0 -2
@@ -0,0 +1,38 @@
1
+ // @bun
2
+ import{Nc as T,Oc as y,Pc as v}from"./chunk-ztw515ew.js";import{$f as I,Zf as D,_f as S}from"./chunk-vckn5ate.js";import{wh as P}from"./chunk-6k6dgwmy.js";import{Hh as U}from"./chunk-ddmvjp0y.js";import{Jh as A,Kh as G,Nh as F}from"./chunk-f0z6kyqt.js";import{Buffer as R}from"buffer";import{spawn as k}from"child_process";import q from"process";var E=/\b(?:gh[pousr]_[A-Z0-9_]{20,}|github_pat_[A-Z0-9_]{20,}|[A-Z0-9]{40,})\b/gi;function w(Q){return Q==="completed"||Q==="in_progress"?Q:"queued"}function g(Q){if(typeof Q!=="string")return null;if(Q==="success"||Q==="cancelled")return Q;if(Q==="failure"||Q==="timed_out"||Q==="action_required")return"failure";return"skipped"}function N(Q,X){let Y=Q.replace(E,"[REDACTED]");if(X&&X.length>=8)Y=Y.split(X).join("[REDACTED]");return Y}class W extends Error{constructor(Q){super(Q);this.name="LockfileRegenerationError"}}function f(Q,X){let Y=`http.${Q.replace(/\/+$/,"")}/.extraheader`,Z=R.from(`x-access-token:${X}`).toString("base64");return["-c",`${Y}=`,"-c",`${Y}=AUTHORIZATION: basic ${Z}`]}class B extends Error{constructor(Q){super(Q);this.name="WorkflowPermissionError"}}function d(Q){let X=`${G(Q)} ${Q?.message??""}`;return/refusing to allow (?:a GitHub App|an OAuth App|a Personal Access Token)[^\n]*workflow/i.test(X)}function h(Q){let X=`${G(Q)} ${Q?.message??""}`;return/not permitted to create or approve pull requests/i.test(X)||Q?.status===403&&/pull/i.test(X)}class l{token;owner;repo;hasWorkflowPermissions;workflowToken;apiUrl;cache={pullRequests:new Map,issues:new Map};cacheTTL=120000;logger;constructor(Q,X,Y,Z=!1,$,J,K){this.token=Q;this.owner=X;this.repo=Y;this.hasWorkflowPermissions=Z;this.workflowToken=$;this.apiUrl=J?J.replace(/\/+$/,""):P(),this.logger=K??F()}capabilities(){return{pinIssues:!0,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!0,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}isCacheValid(Q){return Date.now()-Q<this.cacheTTL}clearCache(){this.cache.pullRequests.clear(),this.cache.issues.clear()}async branchExists(Q){try{return await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/git/ref/heads/${Q}`),!0}catch(X){if(X.message?.includes("404"))return!1;return this.logger.warn(`\u26A0\uFE0F Error checking branch ${Q}: ${G(X)}`),!1}}async createBranch(Q,X){try{let Z=(await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/git/ref/heads/${X}`)).object.sha;await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/git/refs`,{ref:`refs/heads/${Q}`,sha:Z}),this.logger.info(`\u2705 Created branch ${Q} from ${X}`)}catch(Y){throw this.logger.error(`\u274C Failed to create branch ${Q}: ${G(Y)}`),Y}}async commitChanges(Q,X,Y,Z="main"){try{await this.commitChangesWithGit(Q,X,Y,Z)}catch($){if($ instanceof W||$ instanceof D)throw $;if(d($)){let J=Y.filter((_)=>!_.path.includes(".github/workflows/")),K=Y.length-J.length;if(J.length===0)throw new B(`The token may not update workflow files (${K} in this change). Grant the GitHub App the Workflows permission, or use a PAT with the workflow scope as BUDDY_TOKEN.`);this.logger.warn(`\u26A0\uFE0F The token may not update workflow files; committing the ${J.length} other file(s) without the ${K} workflow file(s)`),await this.commitChangesWithGit(Q,X,J,Z);return}this.logger.warn(`\u26A0\uFE0F Git CLI commit failed, falling back to GitHub API: ${$}`),await this.commitChangesWithAPI(Q,X,Y,Z)}}async commitChangesWithGit(Q,X,Y,Z="main"){try{let $=Y.filter((V)=>V.path.includes(".github/workflows/")),J=Y.filter((V)=>!V.path.includes(".github/workflows/"));if($.length>0&&!this.hasWorkflowPermissions)if(this.logger.warn(`\u26A0\uFE0F Detected ${$.length} workflow file(s). These require elevated permissions.`),this.logger.warn(`\u26A0\uFE0F Workflow files: ${$.map((V)=>V.path).join(", ")}`),this.logger.warn("\u2139\uFE0F Workflow files will be skipped in this commit. BUDDY_TOKEN not detected or lacks workflow permissions."),J.length>0)this.logger.info(`\uD83D\uDCDD Committing ${J.length} non-workflow files...`),Y=J;else{this.logger.warn("\u26A0\uFE0F All files are workflow files. No files will be committed in this PR."),this.logger.warn("\uD83D\uDCA1 To update workflow files, ensure BUDDY_TOKEN is set with workflow:write permissions."),this.logger.info('\uD83D\uDCDD Creating empty commit to avoid "No commits between branches" error...');try{await this.runCommand("git",["commit","--allow-empty","-m","Workflow files require elevated permissions - no changes committed"]),this.logger.info("\u2705 Created empty commit for workflow-only PR")}catch(V){this.logger.warn(`\u26A0\uFE0F Failed to create empty commit: ${V}`);try{let x=Bun.file("README.md");if(await x.exists()){let H=`${await x.text()}
3
+
4
+ <!-- Updated by Buddy -->
5
+ `;await Bun.write("README.md",H),await this.runCommand("git",["add","README.md"]),await this.runCommand("git",["commit","-m","Update README for workflow-only PR"]),this.logger.info("\u2705 Created README update for workflow-only PR")}}catch(j){this.logger.error(`\u274C Failed to create any commit: ${j}`)}}return}else if($.length>0)this.logger.info(`\u2705 Including ${$.length} workflow file(s) with elevated permissions`);try{await this.runCommand("git",["config","user.name","github-actions[bot]"]),await this.runCommand("git",["config","user.email","41898282+github-actions[bot]@users.noreply.github.com"]),this.logger.info("\u2705 Git identity configured for github-actions[bot]")}catch(V){this.logger.warn("\u26A0\uFE0F Failed to configure Git identity:",V)}await this.runCommand("git",["fetch","origin"]),this.logger.info(`\uD83D\uDD04 Recreating ${Q} from origin/${Z} (Renovate-style)...`);try{await this.runCommand("git",["checkout",Q])}catch{try{await this.runCommand("git",["checkout","-b",Q,`origin/${Q}`])}catch{await this.runCommand("git",["checkout","-b",Q])}}await this.runCommand("git",["reset","--hard",`origin/${Z}`]),await this.runCommand("git",["clean","-fd"]),this.logger.info(`\u2705 Reset ${Q} to origin/${Z}`),await I(Y,async(V)=>{try{return await this.runCommand("git",["cat-file","-e",`origin/${Z}:${V}`]),!0}catch{return!1}});for(let V of Y){let j=S(V.path);if(q.env.NODE_ENV==="test"||q.env.BUN_ENV==="test"){if(["package.json","bun.lock","bun.lockb","package-lock.json","yarn.lock"].includes(j)&&V.content==='{"name":"x"}'){this.logger.warn(`\u26A0\uFE0F Skipping test file write to ${j} to prevent overwriting project files`);continue}}if(V.type==="delete")try{await this.runCommand("git",["rm",j])}catch{}else await Bun.write(j,V.content),await this.runCommand("git",["add",j])}if(!(q.env.NODE_ENV==="test"||q.env.BUN_ENV==="test")){let V=Y.map((x)=>x.path.replace(/^\.\//,"").replace(/^\/+/,"")),j=v(V);if(j.length>0){this.logger.info(`\uD83D\uDD12 Regenerating lock files for: ${j.join(", ")}`);let x=q.cwd(),M=[];for(let H of j)try{let z=await y(H,x);if(z.success)for(let C of T())try{await this.runCommand("git",["add",C])}catch{}else M.push(`${H}: ${z.message}`)}catch(z){M.push(`${H}: ${z instanceof Error?z.message:String(z)}`)}if(M.length>0){let H=M.map((z)=>` - ${z}`).join(`
6
+ `);throw new W(`Lock file regeneration failed; refusing to open PR with stale lockfiles.
7
+ ${H}`)}}}if((await this.runCommand("git",["status","--porcelain"])).trim()){await this.runCommand("git",["commit","-m",X]);let V=this.workflowToken||void 0;await this.runCommand("git",["push","origin",Q,"--force-with-lease"],V),this.logger.info(`\u2705 Successfully recreated ${Q} with fresh changes from ${Z}: ${X}`)}else this.logger.info(`\u2139\uFE0F No file changes after resetting to ${Z} \u2014 skipping push to prevent PR auto-close`)}catch($){throw this.logger.error(`\u274C Failed to commit changes to ${Q} with Git CLI: ${G($)}`),$}}async commitChangesWithAPI(Q,X,Y,Z="main"){try{let $=Y.filter((C)=>C.path.includes(".github/workflows/")),J=Y.filter((C)=>!C.path.includes(".github/workflows/"));if($.length>0&&!this.hasWorkflowPermissions)if(this.logger.warn(`\u26A0\uFE0F Detected ${$.length} workflow file(s). These require elevated permissions.`),this.logger.warn(`\u26A0\uFE0F Workflow files: ${$.map((C)=>C.path).join(", ")}`),this.logger.warn("\u2139\uFE0F Workflow files will be skipped in this commit. Consider using a GitHub App with workflow permissions for workflow updates."),J.length>0)this.logger.info(`\uD83D\uDCDD Committing ${J.length} non-workflow files...`),Y=J;else{this.logger.warn("\u26A0\uFE0F All files are workflow files. No files will be committed in this PR."),this.logger.warn("\uD83D\uDCA1 To update workflow files, consider using a GitHub App with appropriate permissions.");return}else if($.length>0)this.logger.info(`\u2705 Including ${$.length} workflow file(s) with elevated permissions`);if(Y.some((C)=>C.path.endsWith("package.json")||C.path.endsWith("composer.json")))this.logger.warn("\u26A0\uFE0F Committing manifest files via API \u2014 lock files will not be updated."),this.logger.warn(" Lock file regeneration requires the Git CLI commit path (local filesystem).");this.logger.info(`\uD83D\uDD04 Recreating ${Q} from ${Z} via API (Renovate-style)...`);let V=(await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/git/ref/heads/${Z}`)).object.sha,x=(await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/git/commits/${V}`)).tree.sha;await I(Y,async(C)=>{let O=C.split("/").map((L)=>encodeURIComponent(L)).join("/");try{return await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/contents/${O}?ref=${encodeURIComponent(Z)}`),!0}catch(L){if(L.message?.includes("404"))return!1;throw L}});let M=[];for(let C of Y){let O=S(C.path);if(C.type==="delete")M.push({path:O,mode:"100644",type:"blob",sha:null});else{let L=await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/git/blobs`,{content:R.from(C.content).toString("base64"),encoding:"base64"});M.push({path:O,mode:"100644",type:"blob",sha:L.sha})}}let H=await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/git/trees`,{base_tree:x,tree:M});if(H.sha===x){this.logger.info(`\u2139\uFE0F No file changes relative to ${Z} \u2014 skipping push to prevent PR auto-close`);return}let z=await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/git/commits`,{message:X,tree:H.sha,parents:[V],author:{name:"github-actions[bot]",email:"41898282+github-actions[bot]@users.noreply.github.com"},committer:{name:"github-actions[bot]",email:"41898282+github-actions[bot]@users.noreply.github.com"}});await this.apiRequest(`PATCH /repos/${this.owner}/${this.repo}/git/refs/heads/${Q}`,{sha:z.sha,force:!0}),this.logger.info(`\u2705 Committed changes to ${Q}: ${X}`)}catch($){throw this.logger.error(`\u274C Failed to commit changes to ${Q}: ${G($)}`),$}}async createPullRequest(Q){try{return await this.createPullRequestWithCLI(Q)}catch(X){this.logger.warn(`\u26A0\uFE0F GitHub CLI failed, falling back to API: ${X}`)}try{return await this.createPullRequestWithAPI(Q)}catch(X){if(!h(X))throw X;if(this.workflowToken&&this.workflowToken!==this.token)return this.logger.info("\uD83D\uDD11 GITHUB_TOKEN may not open pull requests in this repository, retrying with BUDDY_TOKEN"),await this.createPullRequestWithAPI(Q,this.workflowToken);throw Error('GitHub Actions may not open pull requests in this repository. Either set a BUDDY_TOKEN repository secret (a token with contents, pull requests and workflows write access), or enable Settings > Actions > General > "Allow GitHub Actions to create and approve pull requests".',{cause:X})}}async createPullRequestWithCLI(Q){try{let X=["pr","create","--title",Q.title,"--body",Q.body,"--head",Q.head,"--base",Q.base];if(Q.draft)X.push("--draft");if(Q.reviewers&&Q.reviewers.length>0)this.logger.info(`\uD83D\uDD0D Adding reviewers via CLI: ${Q.reviewers.join(", ")}`),X.push("--reviewer",Q.reviewers.join(","));if(Q.assignees&&Q.assignees.length>0)X.push("--assignee",Q.assignees.join(","));let Z=(await this.runCommand("gh",X)).match(/https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);if(!Z)throw Error("Failed to parse PR number from GitHub CLI output");let $=Number.parseInt(Z[1]),J=Z[0];if(this.logger.info(`\u2705 Created PR #${$}: ${Q.title}`),Q.labels&&Q.labels.length>0)try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${$}/labels`,{labels:Q.labels}),this.logger.info(`\u2705 Added labels to PR #${$}: ${Q.labels.join(", ")}`)}catch(K){this.logger.warn(`\u26A0\uFE0F Failed to add labels: ${K}`);for(let _ of Q.labels)try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${$}/labels`,{labels:[_]})}catch(V){this.logger.warn(`\u26A0\uFE0F Failed to add label '${_}': ${V}`)}}return{number:$,title:Q.title,body:Q.body,head:Q.head,base:Q.base,state:"open",url:J,createdAt:new Date,updatedAt:new Date,author:"github-actions[bot]",reviewers:Q.reviewers||[],assignees:Q.assignees||[],labels:Q.labels||[],draft:Q.draft||!1}}catch(X){throw this.logger.error(`\u274C Failed to create PR with GitHub CLI: ${Q.title}: ${G(X)}`),X}}async createPullRequestWithAPI(Q,X){try{let Y=await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/pulls`,{title:Q.title,body:Q.body,head:Q.head,base:Q.base,draft:Q.draft||!1},X);if(Q.reviewers&&Q.reviewers.length>0)try{this.logger.info(`\uD83D\uDD0D Adding reviewers to PR #${Y.number}: ${Q.reviewers.join(", ")}`),await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/pulls/${Y.number}/requested_reviewers`,{reviewers:Q.reviewers,team_reviewers:Q.teamReviewers||[]}),this.logger.info(`\u2705 Successfully added reviewers: ${Q.reviewers.join(", ")}`)}catch(Z){this.logger.error(`\u274C Failed to add reviewers: ${Z}`),this.logger.error(` Reviewers: ${Q.reviewers.join(", ")}`),this.logger.error(` Repository: ${this.owner}/${this.repo}`),this.logger.error(` PR: #${Y.number}`)}if(Q.assignees&&Q.assignees.length>0)try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${Y.number}/assignees`,{assignees:Q.assignees})}catch(Z){this.logger.warn(`\u26A0\uFE0F Failed to add assignees: ${Z}`)}if(Q.labels&&Q.labels.length>0)try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${Y.number}/labels`,{labels:Q.labels})}catch(Z){this.logger.warn(`\u26A0\uFE0F Failed to add labels: ${Z}`);for(let $ of Q.labels)try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${Y.number}/labels`,{labels:[$]})}catch(J){this.logger.warn(`\u26A0\uFE0F Failed to add label '${$}': ${J}`)}}return this.logger.info(`\u2705 Created PR #${Y.number}: ${Q.title}`),{number:Y.number,title:Y.title,body:Y.body||"",head:Y.head.ref,base:Y.base.ref,state:Y.state,url:Y.html_url,createdAt:new Date(Y.created_at),updatedAt:new Date(Y.updated_at),author:Y.user.login,reviewers:Q.reviewers||[],assignees:Q.assignees||[],labels:Q.labels||[],draft:Y.draft}}catch(Y){throw this.logger.error(`\u274C Failed to create PR with API: ${Q.title}: ${G(Y)}`),Y}}gitServerUrl(){return this.apiUrl==="https://api.github.com"?"https://github.com":this.apiUrl.replace(/\/api\/v3$/,"")}getEffectiveToken(Q=!1){if(Q&&this.workflowToken)return this.workflowToken;return this.token}async runCommand(Q,X,Y){let Z=Y||this.token;if(Q==="git"&&Y)X=[...f(this.gitServerUrl(),Y),...X];return new Promise(($,J)=>{let K=k(Q,X,{stdio:"pipe",env:{...q.env,GITHUB_TOKEN:Z,GH_TOKEN:Z}}),_="",V="";K.stdout?.on("data",(j)=>{_+=j.toString()}),K.stderr?.on("data",(j)=>{V+=j.toString()}),K.on("close",(j)=>{if(j===0)$(_);else J(Error(`Command failed with code ${j}: ${N(V,Z)}`))}),K.on("error",(j)=>{J(j)})})}async getPullRequestFiles(Q){let X=[];for(let Y=1;Y<=30;Y++){let Z=await this.apiRequestWithRetry(`GET /repos/${this.owner}/${this.repo}/pulls/${Q}/files?per_page=100&page=${Y}`);if(X.push(...Z.map(($)=>$.filename)),Z.length<100)break}return X}async getPullRequests(Q="open"){let X=`${Q}`,Y=this.cache.pullRequests.get(X);if(Y&&this.isCacheValid(Y.timestamp))return this.logger.info(`\uD83D\uDCE6 Using cached PRs (state: ${Q}, ${Y.data.length} PRs)`),Y.data;try{let J=[];for(let _=1;_<=20;_++){let V=await this.apiRequestWithRetry(`GET /repos/${this.owner}/${this.repo}/pulls?state=${Q}&per_page=100&page=${_}`);if(!Array.isArray(V)||V.length===0)break;if(J.push(...V),V.length<100)break}let K=J.map((_)=>({number:_.number,title:_.title,body:_.body??"",head:_.head.ref,base:_.base.ref,state:_.state,url:_.html_url,createdAt:new Date(_.created_at),updatedAt:new Date(_.updated_at),mergedAt:_.merged_at?new Date(_.merged_at):void 0,author:_.user.login,reviewers:_.requested_reviewers?.map((V)=>V.login)??[],assignees:_.assignees?.map((V)=>V.login)??[],labels:_.labels?.map((V)=>V.name)??[],draft:_.draft}));return this.cache.pullRequests.set(X,{data:K,timestamp:Date.now()}),this.logger.info(`\u2705 Fetched and cached ${K.length} PRs (state: ${Q})`),K}catch(Z){throw this.logger.error(`\u274C Failed to get PRs: ${G(Z)}`),Z}}async updatePullRequest(Q,X){this.cache.pullRequests.clear();try{let Y={};if(X.title)Y.title=X.title;if(X.body)Y.body=X.body;if(X.base)Y.base=X.base;if(X.draft!==void 0)Y.draft=X.draft;let Z=await this.apiRequest(`PATCH /repos/${this.owner}/${this.repo}/pulls/${Q}`,Y);if(X.labels&&X.labels.length>0)try{await this.apiRequest(`PUT /repos/${this.owner}/${this.repo}/issues/${Q}/labels`,{labels:X.labels}),this.logger.info(`\u2705 Updated labels for PR #${Q}: ${X.labels.join(", ")}`)}catch($){this.logger.warn(`\u26A0\uFE0F Failed to update labels for PR #${Q}: ${$}`);for(let J of X.labels)try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${Q}/labels`,{labels:[J]})}catch(K){this.logger.warn(`\u26A0\uFE0F Failed to add label '${J}' to PR #${Q}: ${K}`)}}if(X.reviewers&&X.reviewers.length>0)try{this.logger.info(`\uD83D\uDD0D Adding reviewers to existing PR #${Q}: ${X.reviewers.join(", ")}`),await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/pulls/${Q}/requested_reviewers`,{reviewers:X.reviewers,team_reviewers:X.teamReviewers||[]}),this.logger.info(`\u2705 Updated reviewers for PR #${Q}: ${X.reviewers.join(", ")}`)}catch($){this.logger.error(`\u274C Failed to update reviewers for PR #${Q}: ${$}`),this.logger.error(` Reviewers: ${X.reviewers.join(", ")}`),this.logger.error(` Repository: ${this.owner}/${this.repo}`)}if(X.assignees&&X.assignees.length>0)try{await this.runCommand("gh",["issue","edit",Q.toString(),"--add-assignee",X.assignees.join(",")]),this.logger.info(`\u2705 Updated assignees for PR #${Q}: ${X.assignees.join(", ")}`)}catch($){this.logger.warn(`\u26A0\uFE0F Failed to update assignees for PR #${Q}: ${$}`)}return this.logger.info(`\u2705 Updated PR #${Q}`),{number:Z.number,title:Z.title,body:Z.body||"",head:Z.head.ref,base:Z.base.ref,state:Z.state,url:Z.html_url,createdAt:new Date(Z.created_at),updatedAt:new Date(Z.updated_at),author:Z.user.login,reviewers:[],assignees:[],labels:X.labels||[],draft:Z.draft}}catch(Y){throw this.logger.error(`\u274C Failed to update PR #${Q}: ${G(Y)}`),Y}}async closePullRequest(Q){this.cache.pullRequests.clear();try{await this.apiRequest(`PATCH /repos/${this.owner}/${this.repo}/pulls/${Q}`,{state:"closed"}),this.logger.info(`\u2705 Closed PR #${Q}`)}catch(X){throw this.logger.error(`\u274C Failed to close PR #${Q}: ${G(X)}`),X}}async reopenPullRequest(Q){this.cache.pullRequests.clear();try{await this.apiRequest(`PATCH /repos/${this.owner}/${this.repo}/pulls/${Q}`,{state:"open"}),this.logger.info(`\u2705 Reopened PR #${Q}`)}catch(X){throw this.logger.error(`\u274C Failed to reopen PR #${Q}: ${G(X)}`),X}}async createComment(Q,X){try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/${Q}/comments`,{body:X}),this.logger.info(`\uD83D\uDCAC Added comment to PR #${Q}`)}catch(Y){throw this.logger.error(`\u274C Failed to add comment to PR #${Q}: ${G(Y)}`),Y}}async mergePullRequest(Q,X="merge"){try{let Y=X==="rebase"?"rebase":X==="squash"?"squash":"merge",$=(await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/pulls/${Q}`)).head.ref;await this.apiRequest(`PUT /repos/${this.owner}/${this.repo}/pulls/${Q}/merge`,{merge_method:Y}),this.logger.info(`\u2705 Merged PR #${Q} using ${X}`);try{await this.deleteBranch($),this.logger.info(`\uD83E\uDDF9 Cleaned up branch ${$} after merge`)}catch(J){this.logger.warn(`\u26A0\uFE0F Failed to clean up branch ${$}:`,J)}}catch(Y){throw this.logger.error(`\u274C Failed to merge PR #${Q}: ${G(Y)}`),Y}}async getPullRequestHeadSha(Q){try{return(await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/pulls/${Q}`))?.head?.sha??""}catch(X){return this.logger.debug(`Could not read head SHA for PR #${Q}: ${G(X)}`),""}}async hasWriteAccess(Q){try{let X=await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/collaborators/${encodeURIComponent(Q)}/permission`);return["write","maintain","admin"].includes(X?.permission)}catch(X){if(X instanceof A&&X.isNotFound)return!1;return this.logger.warn(`\u26A0\uFE0F Could not resolve permissions for @${Q}: ${G(X)}`),!1}}async reactToComment(Q,X){try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/issues/comments/${Q}/reactions`,{content:X})}catch(Y){this.logger.debug(`Could not react to comment ${Q}: ${G(Y)}`)}}async getWorkflowRunLogs(Q){try{let X=await U(`${this.apiUrl}/repos/${this.owner}/${this.repo}/actions/runs/${Q}/logs`,{headers:{Authorization:`Bearer ${this.token}`,Accept:"application/vnd.github+json","User-Agent":"buddy"}});if(!X.ok)return this.logger.debug(`Could not fetch logs for run ${Q}: ${X.status}`),null;return R.from(await X.arrayBuffer()).toString("utf-8").replace(/[^\t\n\r\x20-\x7E]+/g," ")}catch(X){return this.logger.debug(`Could not fetch logs for run ${Q}: ${G(X)}`),null}}async listWorkflowRuns(Q,X={}){let Y=new URLSearchParams({branch:Q,per_page:String(X.limit??20)});if(X.status)Y.set("status",X.status);try{return((await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/actions/runs?${Y.toString()}`))?.workflow_runs??[]).map((J)=>({id:Number(J.id),name:String(J.name??""),headSha:String(J.head_sha??""),headBranch:String(J.head_branch??Q),status:w(J.status),conclusion:g(J.conclusion),createdAt:new Date(String(J.created_at??new Date().toISOString()))}))}catch(Z){return this.logger.debug(`Could not list workflow runs for ${Q}: ${G(Z)}`),[]}}async rerunWorkflowRun(Q,X=!0){let Y=X?"rerun-failed-jobs":"rerun";try{let Z=await U(`${this.apiUrl}/repos/${this.owner}/${this.repo}/actions/runs/${Q}/${Y}`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`,Accept:"application/vnd.github+json","User-Agent":"buddy"}});if(!Z.ok)return this.logger.warn(`Could not re-run workflow run ${Q}: ${Z.status} ${Z.statusText}`),!1;return!0}catch(Z){return this.logger.warn(`Could not re-run workflow run ${Q}: ${G(Z)}`),!1}}async createCheckRun(Q,X,Y){try{await this.apiRequest(`POST /repos/${this.owner}/${this.repo}/check-runs`,{name:Q,head_sha:X,status:"completed",conclusion:Y.conclusion,completed_at:new Date().toISOString(),output:{title:Y.title,summary:Y.summary}}),this.logger.info(`\u2705 Reported check run ${Q}: ${Y.conclusion}`)}catch(Z){this.logger.warn(`\u26A0\uFE0F Could not report check run ${Q}: ${G(Z)}`)}}async getFileContent(Q,X){try{let Y=await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/contents/${encodeURIComponent(Q)}?ref=${encodeURIComponent(X)}`);if(!Y?.content)return null;return R.from(Y.content,Y.encoding==="base64"?"base64":"utf-8").toString("utf-8")}catch(Y){if(Y instanceof A&&Y.isNotFound)return null;throw Y}}async getPullRequestDiff(Q){let X=await U(`${this.apiUrl}/repos/${this.owner}/${this.repo}/pulls/${Q}`,{headers:{Authorization:`Bearer ${this.token}`,Accept:"application/vnd.github.v3.diff","User-Agent":"buddy"}});if(!X.ok)throw new A(`Failed to fetch diff for PR #${Q}: ${X.status} ${X.statusText}`,X.status,"GET",`${this.apiUrl}/repos/${this.owner}/${this.repo}/pulls/${Q}`,`${this.owner}/${this.repo}`);return await X.text()}async createReview(Q,X){let Y=`POST /repos/${this.owner}/${this.repo}/pulls/${Q}/reviews`;try{return await this.apiRequest(Y,{body:X.body,event:X.event,...X.comments?.length?{comments:X.comments}:{}}),this.logger.success(`\u2705 Posted review on PR #${Q} (${X.comments?.length??0} inline comment(s))`),{posted:!0,inlineComments:X.comments?.length??0}}catch(Z){if(!X.comments?.length)throw this.logger.error(`\u274C Failed to post review on PR #${Q}: ${G(Z)}`),Z;return this.logger.warn(`\u26A0\uFE0F Review with inline comments was rejected (${G(Z)}); posting the summary alone`),await this.apiRequest(Y,{body:X.body,event:X.event}),{posted:!0,inlineComments:0}}}async enableAutoMerge(Q,X="squash"){let Y=await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/pulls/${Q}`),Z=`mutation($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
8
+ enablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId, mergeMethod: $mergeMethod }) {
9
+ pullRequest { number }
10
+ }
11
+ }`,$=await this.graphqlRequest(`mutation($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
12
+ enablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId, mergeMethod: $mergeMethod }) {
13
+ pullRequest { number }
14
+ }
15
+ }`,{pullRequestId:Y.node_id,mergeMethod:X.toUpperCase()});if($.errors?.length){let J=$.errors.map((K)=>K.message).join("; ");return this.logger.info(`\u2139\uFE0F GitHub could not queue auto-merge for PR #${Q}: ${J}`),!1}return this.logger.success(`\u2705 Auto-merge queued for PR #${Q} (${X})`),!0}async listReviewThreads(Q){try{let Y=await this.graphqlRequest(`query($owner: String!, $repo: String!, $number: Int!) {
16
+ repository(owner: $owner, name: $repo) {
17
+ pullRequest(number: $number) {
18
+ reviewThreads(first: 100) {
19
+ nodes {
20
+ id
21
+ isResolved
22
+ path
23
+ comments(first: 10) { nodes { author { login } } }
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }`,{owner:this.owner,repo:this.repo,number:Q});if(Y.errors?.length)return this.logger.debug(`Could not read review threads on #${Q}: ${Y.errors.map(($)=>$.message).join("; ")}`),[];return(Y.data?.repository?.pullRequest?.reviewThreads?.nodes??[]).filter(Boolean).map(($)=>({id:String($.id),isResolved:Boolean($.isResolved),...$.path?{path:String($.path)}:{},authorLogins:($.comments?.nodes??[]).map((J)=>J?.author?.login).filter((J)=>typeof J==="string")}))}catch(Y){return this.logger.debug(`Could not read review threads on #${Q}: ${G(Y)}`),[]}}async resolveReviewThread(Q,X){try{let Z=await this.graphqlRequest(`mutation($threadId: ID!) {
29
+ resolveReviewThread(input: { threadId: $threadId }) {
30
+ thread { isResolved }
31
+ }
32
+ }`,{threadId:X});if(Z.errors?.length)return this.logger.warn(`Could not resolve review thread: ${Z.errors.map(($)=>$.message).join("; ")}`),!1;return Boolean(Z.data?.resolveReviewThread?.thread?.isResolved)}catch(Z){return this.logger.warn(`Could not resolve review thread: ${G(Z)}`),!1}}async getPullRequestChecksState(Q){try{let Y=(await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/pulls/${Q}`)).head.sha,[Z,$]=await Promise.all([this.apiRequest(`GET /repos/${this.owner}/${this.repo}/commits/${Y}/status`),this.apiRequest(`GET /repos/${this.owner}/${this.repo}/commits/${Y}/check-runs?per_page=100`)]),J=$?.check_runs??[],K=(Z?.statuses?.length??0)>0;if(J.length===0&&!K)return"none";if(J.some((j)=>j.conclusion!==null&&["failure","cancelled","timed_out","action_required"].includes(j.conclusion))||Z?.state==="failure"||Z?.state==="error")return"failure";if(J.some((j)=>j.status!=="completed")||Z?.state==="pending")return"pending";return"success"}catch(X){return this.logger.warn(`\u26A0\uFE0F Could not read check state for PR #${Q}: ${G(X)}`),"pending"}}async graphqlRequest(Q,X){let Y=await U(`${this.apiUrl}/graphql`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json","User-Agent":"buddy"},body:JSON.stringify({query:Q,variables:X})});if(!Y.ok)throw new A(`GraphQL request failed: ${Y.status} ${Y.statusText}`,Y.status,"POST",`${this.apiUrl}/graphql`,`${this.owner}/${this.repo}`);return await Y.json()}async deleteBranch(Q){try{await this.runCommand("git",["push","origin","--delete",Q]),this.logger.info(`\u2705 Deleted branch ${Q} via git`)}catch(X){try{await this.runCommand("git",["branch","-D",Q])}catch{}if(/remote ref does not exist|unable to delete '[^']*': remote ref/i.test(G(X))){this.logger.info(`\u2139\uFE0F Branch ${Q} was already gone`);return}throw this.logger.warn(`\u26A0\uFE0F Failed to delete remote branch ${Q}: ${G(X)}`),X}}async getBuddyBranches(){try{let Q=await this.runCommand("git",["branch","-r","--format=%(refname:short) %(objectname) %(committerdate:iso8601)"]),X=[];for(let Y of Q.split(`
33
+ `)){let Z=Y.trim();if(!Z)continue;let $=Z.split(" ");if($.length<3)continue;let J=$[0],K=$[1],_=$.slice(2).join(" "),V=J.replace(/^origin\//,"");if(!V.startsWith("buddy/"))continue;try{let j=new Date(_);X.push({name:V,sha:K,lastCommitDate:j})}catch{this.logger.warn(`\u26A0\uFE0F Failed to parse date for branch ${V}: ${_}`),X.push({name:V,sha:K,lastCommitDate:new Date(0)})}}return this.logger.info(`\uD83D\uDD0D Found ${X.length} buddy branches using local git`),X}catch(Q){return this.logger.warn("\u26A0\uFE0F Failed to fetch buddy branches via git, falling back to API:",Q),this.getBuddyBranchesViaAPI()}}async getBuddyBranchesViaAPI(){try{let Q=[],X=1,Y=100;while(!0){let J=await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/branches?per_page=${Y}&page=${X}`);if(!J||J.length===0)break;if(Q=Q.concat(J),J.length<Y)break;X++}this.logger.info(`\uD83D\uDD0D Found ${Q.length} total branches in repository`);let Z=Q.filter((J)=>J.name.startsWith("buddy/"));return this.logger.info(`\uD83E\uDD16 Found ${Z.length} buddy branches`),await Promise.all(Z.map(async(J)=>{try{let K=await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/commits/${J.commit.sha}`);return{name:J.name,sha:J.commit.sha,lastCommitDate:new Date(K.commit.committer.date)}}catch(K){return this.logger.warn(`\u26A0\uFE0F Failed to get commit info for branch ${J.name}: ${G(K)}`),{name:J.name,sha:J.commit.sha,lastCommitDate:new Date(0)}}}))}catch(Q){return this.logger.warn("\u26A0\uFE0F Failed to fetch buddy branches:",Q),[]}}async getOrphanedBuddyBranches(){try{let Q=await this.getBuddyBranches(),X=await this.getOpenPRBranches();return Q.filter((Z)=>!X.has(Z.name))}catch(Q){return this.logger.warn("\u26A0\uFE0F Failed to identify orphaned branches:",Q),[]}}prDetectionSuccessful=!1;async getOpenPRBranches(){this.prDetectionSuccessful=!1;try{let Q=await this.getPullRequests("open"),X=new Set(Q.map((Y)=>Y.head).filter((Y)=>Y.startsWith("buddy/")));return this.logger.info(`\uD83D\uDD0D GitHub API reports ${Q.length} open PR(s); ${X.size} are buddy branches`),this.logger.info(`\uD83D\uDEE1\uFE0F Protecting ${X.size} branches with confirmed open PRs`),this.prDetectionSuccessful=!0,X}catch(Q){this.logger.warn("\u26A0\uFE0F Failed to fetch open PRs via API, falling back to age-based protection:",Q);try{let X=await this.getBuddyBranches(),Y=new Date;Y.setDate(Y.getDate()-30);let Z=new Set;for(let $ of X)if($.lastCommitDate>Y)Z.add($.name);return this.logger.info(`\uD83D\uDEE1\uFE0F Conservative fallback: protecting ${Z.size} branches newer than 30 days`),Z}catch{return this.logger.info("\u26A0\uFE0F Could not enumerate branches for age-based fallback"),new Set}}}async cleanupStaleBranches(Q=7,X=!1){this.logger.info("\uD83D\uDD0D Looking for buddy branches without open PRs...");let Y=await this.getOrphanedBuddyBranches();this.logger.info(`\uD83D\uDD0D Found ${Y.length} orphaned buddy branches (no associated open PRs)`);let Z=Y;if(this.prDetectionSuccessful)this.logger.info(`\uD83C\uDFAF PR detection successful - cleaning up ALL ${Z.length} orphaned branches (any age)`);else{let V=new Date;V.setDate(V.getDate()-Q),Z=Y.filter((j)=>j.lastCommitDate<V),this.logger.info(`\u26A0\uFE0F PR detection failed - only deleting branches older than ${Q} days`),this.logger.info(`\uD83D\uDD0D Found ${Z.length} stale buddy branches (older than ${Q} days)`)}if(Z.length>0){if(this.logger.info("\uD83D\uDCCB Sample of branches to delete:"),Z.slice(0,5).forEach((V)=>{let j=Math.floor((Date.now()-V.lastCommitDate.getTime())/86400000);this.logger.info(` - ${V.name} (${j} days old)`)}),Z.length>5)this.logger.info(` ... and ${Z.length-5} more`)}if(Z.length===0)return this.logger.info("\u2705 No branches to clean up!"),{deleted:[],failed:[]};let $=Z;if(X)return this.logger.info("\uD83D\uDD0D [DRY RUN] Would delete the following branches:"),$.forEach((V)=>{let j=Math.floor((Date.now()-V.lastCommitDate.getTime())/86400000);this.logger.info(` - ${V.name} (${j} days old, last commit: ${V.lastCommitDate.toISOString()})`)}),{deleted:$.map((V)=>V.name),failed:[]};let J=[],K=[];this.logger.info(`\uD83E\uDDF9 Cleaning up ${$.length} stale branches...`);let _=5;for(let V=0;V<$.length;V+=_){let j=$.slice(V,V+_),x=Math.floor(V/_)+1,M=Math.ceil($.length/_);this.logger.info(`\uD83D\uDD04 Processing batch ${x}/${M} (${j.length} branches)`);for(let H of j){try{await this.deleteBranch(H.name),J.push(H.name),this.logger.info(`\u2705 Deleted: ${H.name}`)}catch(z){K.push(H.name),this.logger.warn(`\u274C Failed to delete ${H.name}: ${G(z)}`)}await new Promise((z)=>setTimeout(z,200))}if(V+_<$.length)this.logger.info(`\u23F3 Waiting ${3} seconds before next batch...`),await new Promise((z)=>setTimeout(z,3000))}if(this.logger.info("\uD83C\uDF89 Cleanup complete!"),this.logger.info(` \u2705 Successfully deleted: ${J.length} branches`),this.logger.info(` \u274C Failed to delete: ${K.length} branches`),K.length>0)this.logger.info("\u274C Failed branches:"),K.forEach((V)=>this.logger.info(` - ${V}`));return{deleted:J,failed:K}}async apiRequest(Q,X,Y,Z=0){let[$,J]=Q.split(" "),K=`${this.apiUrl}${J}`,_=Y||this.token,V={method:$,headers:{Authorization:`Bearer ${_}`,Accept:"application/vnd.github.v3+json","Content-Type":"application/json","User-Agent":"buddy"}};if(X&&($==="POST"||$==="PATCH"||$==="PUT"))V.body=JSON.stringify(X);let j=await U(K,{...V,retries:Z,onRetry:({delayMs:x,reason:M})=>this.logger.info(`\u23F3 ${M} on ${$} ${J}, retrying in ${Math.round(x/1000)}s...`)});if(!j.ok){let x=await j.text(),M=_?"token present ([REDACTED])":"NO TOKEN \u2014 ensure GITHUB_TOKEN or BUDDY_TOKEN is set";throw new A(`GitHub API error: ${j.status} ${j.statusText}
34
+ URL: ${$} ${K}
35
+ Auth: ${M}
36
+ Repo: ${this.owner}/${this.repo}
37
+ ${x}`,j.status,$,K,`${this.owner}/${this.repo}`,x)}if(j.headers.get("content-type")?.includes("application/json"))return j.json();return j.text()}async apiRequestWithRetry(Q,X,Y=3){return this.apiRequest(Q,X,void 0,Math.max(0,Y-1))}async createIssue(Q){this.cache.issues.clear();try{let X=await this.apiRequestWithRetry(`POST /repos/${this.owner}/${this.repo}/issues`,{title:Q.title,body:Q.body,assignees:Q.assignees||[],labels:Q.labels||[],milestone:Q.milestone});return this.logger.info(`\u2705 Created issue #${X.number}: ${Q.title}`),{number:X.number,title:X.title,body:X.body,state:X.state,url:X.html_url,createdAt:new Date(X.created_at),updatedAt:new Date(X.updated_at),closedAt:X.closed_at?new Date(X.closed_at):void 0,author:X.user.login,assignees:X.assignees?.map((Y)=>Y.login)||[],labels:X.labels?.map((Y)=>typeof Y==="string"?Y:Y.name)||[],pinned:!1}}catch(X){throw this.logger.error(`\u274C Failed to create issue: ${Q.title}: ${G(X)}`),X}}async getIssues(Q="open"){let X=`${Q}`,Y=this.cache.issues.get(X);if(Y&&this.isCacheValid(Y.timestamp))return this.logger.info(`\uD83D\uDCE6 Using cached issues (state: ${Q}, ${Y.data.length} issues)`),Y.data;try{let J=[];for(let _=1;_<=20;_++){let V=await this.apiRequestWithRetry(`GET /repos/${this.owner}/${this.repo}/issues?state=${Q}&sort=updated&direction=desc&per_page=100&page=${_}`);if(!Array.isArray(V)||V.length===0)break;if(J.push(...V),V.length<100)break}let K=J.filter((_)=>!_.pull_request).map((_)=>({number:_.number,title:_.title,body:_.body||"",state:_.state,url:_.html_url,createdAt:new Date(_.created_at),updatedAt:new Date(_.updated_at),closedAt:_.closed_at?new Date(_.closed_at):void 0,author:_.user.login,assignees:_.assignees?.map((V)=>V.login)||[],labels:_.labels?.map((V)=>typeof V==="string"?V:V.name)||[],pinned:!1}));return this.cache.issues.set(X,{data:K,timestamp:Date.now()}),this.logger.info(`\u2705 Fetched and cached ${K.length} issues (state: ${Q})`),K}catch(Z){throw this.logger.error("\u274C Failed to get issues:",Z),Z}}async updateIssue(Q,X){this.cache.issues.clear();try{let Y={};if(X.title!==void 0)Y.title=X.title;if(X.body!==void 0)Y.body=X.body;if(X.assignees!==void 0)Y.assignees=X.assignees;if(X.labels!==void 0)Y.labels=X.labels;if(X.milestone!==void 0)Y.milestone=X.milestone;let Z=await this.apiRequestWithRetry(`PATCH /repos/${this.owner}/${this.repo}/issues/${Q}`,Y);return this.logger.info(`\u2705 Updated issue #${Q}: ${Z.title}`),{number:Z.number,title:Z.title,body:Z.body,state:Z.state,url:Z.html_url,createdAt:new Date(Z.created_at),updatedAt:new Date(Z.updated_at),closedAt:Z.closed_at?new Date(Z.closed_at):void 0,author:Z.user.login,assignees:Z.assignees?.map(($)=>$.login)||[],labels:Z.labels?.map(($)=>typeof $==="string"?$:$.name)||[],pinned:!1}}catch(Y){throw this.logger.error(`\u274C Failed to update issue #${Q}: ${G(Y)}`),Y}}async closeIssue(Q){this.cache.issues.clear();try{await this.apiRequestWithRetry(`PATCH /repos/${this.owner}/${this.repo}/issues/${Q}`,{state:"closed"}),this.logger.info(`\u2705 Closed issue #${Q}`)}catch(X){throw this.logger.error(`\u274C Failed to close issue #${Q}: ${G(X)}`),X}}async pinIssue(Q){return await this.setIssuePinned(Q,!0)}async unpinIssue(Q){return await this.setIssuePinned(Q,!1)}async setIssuePinned(Q,X){let Y=X?"pin":"unpin";try{let Z=await this.apiRequest(`GET /repos/${this.owner}/${this.repo}/issues/${Q}`),$=X?"mutation($issueId: ID!) { pinIssue(input: { issueId: $issueId }) { issue { number } } }":"mutation($issueId: ID!) { unpinIssue(input: { issueId: $issueId }) { issue { number } } }",J=await this.graphqlRequest($,{issueId:Z.node_id});if(J.errors?.length){let K=J.errors.map((_)=>_.message).join("; ");return this.logger.info(`\u26A0\uFE0F Failed to ${Y} issue #${Q}: ${K}`),!1}return this.logger.info(`\uD83D\uDCCC ${X?"Pinned":"Unpinned"} issue #${Q}`),!0}catch(Z){return this.logger.info(`\u26A0\uFE0F Failed to ${Y} issue #${Q}: ${G(Z)}`),!1}}}
38
+ export{f as Jc,B as Kc,d as Lc,l as Mc};
@@ -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-y1hppm93.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.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-w16pwfh3.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.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,2 +1,2 @@
1
1
  // @bun
2
- import{mb as w}from"./chunk-erbqszzp.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-qmhd1bgx.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-bxdbf2kj.js";import"./chunk-e6wny1pp.js";import{Cd as z,Dd as A,Ed as B,Fd as C,Gd as D,Hd as E,Id as F,Jd as G,Kd as H,Ld as I}from"./chunk-zpxg12ep.js";import"./chunk-k53ndvfv.js";import"./chunk-myswpb7z.js";import"./chunk-3nygvd78.js";import"./chunk-yj6xx2b8.js";import"./chunk-f7aw9cr3.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.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};
2
+ import{mb as w}from"./chunk-t3a1703q.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-qk43d3vv.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-4gx2f1k6.js";import"./chunk-3d3rwmmj.js";import{Dd as z,Ed as A,Fd as B,Gd as C,Hd as D,Id as E,Jd as F,Kd as G,Ld as H,Md as I}from"./chunk-bggpgbdx.js";import"./chunk-j0bsva07.js";import"./chunk-xny4kgcc.js";import"./chunk-1z4nhstx.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.js";export{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
- import{Tf as K,Vf as T,Wf as S,Xf as F}from"./chunk-f7aw9cr3.js";import{Gh as N}from"./chunk-b4a5gw9c.js";import{Mh as C}from"./chunk-bprmzg0p.js";import{bl as _}from"./chunk-4sqwtry6.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-pwa2tt2e.js")).default}catch{throw new F(`The Anthropic provider needs @anthropic-ai/sdk, which is an optional peer dependency.
2
+ import{Uf as K,Wf as T,Xf as S,Yf as F}from"./chunk-kpqez1ht.js";import{Hh as N}from"./chunk-ddmvjp0y.js";import{Nh as C}from"./chunk-f0z6kyqt.js";import{cl as _}from"./chunk-6sm15trq.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-wr1q4k9e.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{Gh as P}from"./chunk-b4a5gw9c.js";import{Jh as M,Mh as Q}from"./chunk-bprmzg0p.js";function V(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function X(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Y{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
2
+ import{Hh as P}from"./chunk-ddmvjp0y.js";import{Kh as M,Nh as Q}from"./chunk-f0z6kyqt.js";function V(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function X(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Y{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
3
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:V(H.status),conclusion:X(H.status),createdAt:new Date(H.created_at??new Date().toISOString())})).filter((H)=>!A.status||H.status===A.status).slice(0,F)}catch(G){return this.logger.debug(`Could not list CI jobs for ${z}: ${M(G)}`),[]}}async rerunWorkflowRun(z){try{return await this.request("POST",`/projects/${this.projectId}/jobs/${z}/retry`),!0}catch(A){return this.logger.warn(`Could not retry job ${z}: ${M(A)}`),!1}}async listReviewThreads(z){try{return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/discussions?per_page=100`)??[]).filter((F)=>(F.notes??[]).some((G)=>G.resolvable)).map((F)=>({id:F.id,isResolved:(F.notes??[]).every((G)=>!G.resolvable||G.resolved),...F.notes?.[0]?.position?.new_path?{path:F.notes[0].position.new_path}:{},authorLogins:(F.notes??[]).map((G)=>G.author?.username).filter((G)=>typeof G==="string")}))}catch(A){return this.logger.debug(`Could not read discussions on !${z}: ${M(A)}`),[]}}async resolveReviewThread(z,A){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/discussions/${encodeURIComponent(A)}`,{resolved:!0}),!0}catch(F){return this.logger.warn(`Could not resolve discussion ${A}: ${M(F)}`),!1}}async getBuddyBranches(){return(await this.request("GET",`/projects/${this.projectId}/repository/branches?search=buddy&per_page=100`)).filter((A)=>A.name.startsWith("buddy/")).map((A)=>({name:A.name,sha:A.commit?.id??"",lastCommitDate:A.commit?.committed_date?new Date(A.commit.committed_date):new Date(0)}))}async getOrphanedBuddyBranches(){let[z,A]=await Promise.all([this.getBuddyBranches(),this.getPullRequests("open")]),F=new Set(A.map((G)=>G.head));return z.filter((G)=>!F.has(G.name))}async cleanupStaleBranches(z=7,A=!1){let F=new Date(Date.now()-z*24*60*60*1000),G=(await this.getOrphanedBuddyBranches()).filter((K)=>K.lastCommitDate<F);if(A)return{deleted:G.map((K)=>K.name),failed:[]};let H=[],J=[];for(let K of G)try{await this.deleteBranch(K.name),H.push(K.name)}catch{J.push(K.name)}return{deleted:H,failed:J}}toPullRequest(z){let A=Boolean(z.draft??z.work_in_progress)||/^(?:draft|wip):/i.test(z.title);return{number:z.iid,title:z.title.replace(/^(?:draft|wip):\s*/i,""),body:z.description??"",head:z.source_branch,base:z.target_branch,state:z.state==="merged"?"merged":z.state==="opened"?"open":"closed",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.merged_at?{mergedAt:new Date(z.merged_at)}:{},author:z.author?.username??"",reviewers:(z.reviewers??[]).map((F)=>F.username),assignees:(z.assignees??[]).map((F)=>F.username),labels:z.labels??[],draft:A}}toIssue(z){return{number:z.iid,title:z.title,body:z.description??"",state:z.state==="closed"?"closed":"open",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.closed_at?{closedAt:new Date(z.closed_at)}:{},author:z.author?.username??"",assignees:(z.assignees??[]).map((A)=>A.username),labels:z.labels??[]}}}
5
- export{Y as Ah};
5
+ export{Y as Bh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{se as a,te as b,ue as c,ve as d}from"./chunk-x4ea69ek.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.js";export{c as updateZigManifest,b as parseZigManifest,a as isZigManifest,d as generateZigManifestUpdates};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{kd as J}from"./chunk-5qssa20j.js";import{ld as Y}from"./chunk-t3340cv5.js";import{se as _}from"./chunk-mtp0aygy.js";import{ve as x,we as w}from"./chunk-xj99g66b.js";import{Oe as z,Pe as M}from"./chunk-kqam9qmd.js";import{We as N}from"./chunk-e3wax332.js";import{xg as L,yg as S}from"./chunk-ak9s0vnr.js";import{Mh as G}from"./chunk-bprmzg0p.js";import{bl as j}from"./chunk-4sqwtry6.js";var{Glob:D}=globalThis.Bun;import{readdir as A,readFile as U,stat as Z}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{let O=R(this.projectPath,".github","workflows");if((await Z(O).catch(()=>null))?.isDirectory()){let Q=await this.findFilesByPatternInDir("*.yaml",O),W=await this.findFilesByPatternInDir("*.yml",O);for(let B of[...Q,...W])if(x(B))q.push(B)}}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-e4bcngja.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 jd};
2
+ import{ld as J}from"./chunk-89s9f3mf.js";import{md as Y}from"./chunk-ja3rvd6y.js";import{te as _}from"./chunk-x4ea69ek.js";import{we as x,xe as w}from"./chunk-03j2dx5h.js";import{Pe as z,Qe as M}from"./chunk-v6dephze.js";import{Xe as N}from"./chunk-88j356ng.js";import{yg as L,zg as S}from"./chunk-fvhnza91.js";import{Nh as G}from"./chunk-f0z6kyqt.js";import{cl as j}from"./chunk-6sm15trq.js";var{Glob:D}=globalThis.Bun;import{readdir as A,readFile as U,stat as Z}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{let O=R(this.projectPath,".github","workflows");if((await Z(O).catch(()=>null))?.isDirectory()){let Q=await this.findFilesByPatternInDir("*.yaml",O),W=await this.findFilesByPatternInDir("*.yml",O);for(let B of[...Q,...W])if(x(B))q.push(B)}}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-z456ptfw.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 kd};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Va as t,Wa as u}from"./chunk-zhfrmseh.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-wsxy4w86.js";import{hb as H,ib as I,jb as J,kb as K,lb as L}from"./chunk-tvrz1xp5.js";import"./chunk-bxdbf2kj.js";import"./chunk-e6wny1pp.js";import{Af as d,Bf as e,Cf as f,xf as a,yf as b,zf as c}from"./chunk-ffb50kwa.js";import{Df as g,Ef as h,Ff as i,Gf as j,Hf as k,If as l,Jf as m,Kf as n,Lf as o,Mf as p,Nf as q,Of as r,Pf as s}from"./chunk-47ancrn1.js";import"./chunk-yj6xx2b8.js";import"./chunk-f7aw9cr3.js";import"./chunk-kypdeb29.js";import"./chunk-b4a5gw9c.js";import"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.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};
2
+ import{Va as t,Wa as u}from"./chunk-cbqg29zr.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-1szfwcst.js";import{hb as H,ib as I,jb as J,kb as K,lb as L}from"./chunk-55znd3yn.js";import"./chunk-4gx2f1k6.js";import"./chunk-3d3rwmmj.js";import{Af as c,Bf as d,Cf as e,Df as f,yf as a,zf as b}from"./chunk-jpdd59fh.js";import{Ef as g,Ff as h,Gf as i,Hf as j,If as k,Jf as l,Kf as m,Lf as n,Mf as o,Nf as p,Of as q,Pf as r,Qf as s}from"./chunk-p8azbpq6.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.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"./chunk-4sqwtry6.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};
2
+ import"./chunk-6sm15trq.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};
@@ -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-4sqwtry6.js";export{c as findDrift,a as driftFor,d as describeDrift,b as ROOT};
2
+ import{Hb as a,Ib as b,Jb as c,Kb as d}from"./chunk-vckhctmr.js";import"./chunk-6sm15trq.js";export{c as findDrift,a as driftFor,d as describeDrift,b as ROOT};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{rf as a,sf as b,tf as c,uf as d,vf as e,wf as f,xf as g}from"./chunk-p96zq2zc.js";import"./chunk-emygmh7r.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{f as strategyAllows,b as ruleMatches,c as resolveRuleEffects,e as mergeGroupEffects,g as groupsToRules,a as ecosystemOf,d as applyRules};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Qf as D}from"./chunk-yj6xx2b8.js";import{Mh as C}from"./chunk-bprmzg0p.js";var O=".buddy/learnings.jsonl",R=20;function T(P){if(!P)return[];let E=[];for(let v of P.split(`
2
+ import{Rf as D}from"./chunk-emygmh7r.js";import{Nh as C}from"./chunk-f0z6kyqt.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,4 +1,4 @@
1
1
  // @bun
2
- import{fc as _}from"./chunk-e6wny1pp.js";import{Mh as X}from"./chunk-bprmzg0p.js";import{bl as M}from"./chunk-4sqwtry6.js";var K={review:"review","full-review":"full-review",full:"full-review",summary:"summary",resolve:"resolve",pause:"pause",resume:"resume",ignore:"ignore",rebase:"rebase",retry:"rebase",merge:"merge",plan:"plan","fix-ci":"fix-ci",fix:"fix-ci",remember:"remember",help:"help"},Q=["help","summary"];function V(H){return H.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ").split(`
2
+ import{fc as _}from"./chunk-3d3rwmmj.js";import{Nh as X}from"./chunk-f0z6kyqt.js";import{cl as M}from"./chunk-6sm15trq.js";var K={review:"review","full-review":"full-review",full:"full-review",summary:"summary",resolve:"resolve",pause:"pause",resume:"resume",ignore:"ignore",rebase:"rebase",retry:"rebase",merge:"merge",plan:"plan","fix-ci":"fix-ci",fix:"fix-ci",remember:"remember",help:"help"},Q=["help","summary"];function V(H){return H.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ").split(`
3
3
  `).filter((C)=>!C.trimStart().startsWith(">")).join(`
4
- `)}function $(H,C="@buddy"){if(!H)return null;let B=V(H),O=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`(?:^|\\s)${O}\\b[ \\t]*(.*)`,"i"),z=B.match(j);if(!z)return null;let A=(z[1]??"").trim();if(!A)return{name:"help",args:"",raw:z[0].trim()};let[D,...E]=A.split(/\s+/),J=K[D.toLowerCase()];if(!J)return{name:"chat",args:A,raw:z[0].trim()};return{name:J,args:E.join(" "),raw:z[0].trim()}}function G(H){return Q.includes(H)}function F(H,C="@buddy"){return Boolean(H?.toLowerCase().includes(C.toLowerCase()))}var Y="**Buddy commands**\n\n| Command | What it does |\n|---|---|\n| `@buddy review` | Review new changes since the last review |\n| `@buddy full-review` | Review the whole diff again, ignoring previous findings |\n| `@buddy summary` | Post a fresh summary without inline findings |\n| `@buddy pause` / `resume` | Stop or restart reviewing this pull request |\n| `@buddy rebase` | Rebase a dependency update pull request |\n| `@buddy merge` | Re-check auto-merge conditions now |\n| `@buddy fix-ci` | Diagnose the failing checks, and retry a flake |\n| `@buddy plan` | Research the repository and write an implementation plan |\n| `@buddy resolve` | Close the review threads Buddy opened |\n| `@buddy remember <text>` | Record a durable note for future runs |\n| `@buddy help` | Show this table |\n\nAnything else after the mention is treated as a question.";function Z(H){if(H.actor.isBot)return"comment was written by a bot";if(G(H.command.name))return null;if(!H.actor.canWrite)return`@${H.actor.login} does not have write access`;return null}async function L(H,C){let B=H.logger??X(),O=Z(H);if(O)return B.info(`\uD83D\uDEAB Ignoring \`${H.command.name}\`: ${O}`),{handled:!1,refusal:O};if(H.command.name==="help")return{handled:!0,reply:Y};let j=C[H.command.name];if(!j)return{handled:!1,refusal:`no handler for ${H.command.name}`,reply:`I don't know how to \`${H.command.name}\` yet. Try \`@buddy help\`.`};return B.info(`\uD83E\uDD16 Running \`${H.command.name}\` for @${H.actor.login}`),await j(H)}function T(H){return{async review(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{})}},async "full-review"(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{full:!0})}},async summary(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to summarize \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{summaryOnly:!0})}},async pause(C){return await I(H,C.number,!0),{handled:!0,reply:"Paused. I will not review this pull request again until you say `@buddy resume`."}},async resume(C){return await I(H,C.number,!1),{handled:!0,reply:"Resumed. I will review the next push."}},async ignore(C){return await I(H,C.number,!0),{handled:!0,reply:"Understood \u2014 I will leave this pull request alone."}},async rebase(C){return{handled:!0,reply:await H.rebase(C.number)}},async merge(C){return{handled:!0,reply:(await H.merge()).includes(C.number)?"Merged.":"This pull request does not currently qualify for auto-merge. Check the conditions in your config and whether its checks have passed."}},async "fix-ci"(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no checks to look at \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.fixCi(C.number)}},async remember(C){let B=C.command.args.trim();if(!B)return{handled:!1,reply:"Tell me what to remember, e.g. `@buddy remember we pin react to 17`."};return{handled:!0,reply:await H.remember(B,C)}},async resolve(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no review threads here \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.resolve(C.number)}},async plan(C){return{handled:!0,reply:await H.plan(C.number,C.isPullRequest,C.command.args.trim())}},async chat(C){let B=_(H.config,C.logger);if(!B)return{handled:!1,reply:"I need an AI provider configured to answer questions. See https://buddy.sh/ai/providers"};return{handled:!0,reply:(await B.complete({system:"You are Buddy, answering a question in a pull request or issue thread. Be brief and concrete. If you do not know, say so rather than guessing.",messages:[{role:"user",content:C.command.args}]})).text}}}}async function I(H,C,B){let j=(await H.provider.getPullRequests("open")).find((E)=>E.number===C);if(!j)return;let{parseReviewState:z,upsertReviewState:A}=await import("./chunk-qzens4rg.js"),D=z(j.body);await H.provider.updatePullRequest(C,{body:A(j.body,{reviewedSha:D?.reviewedSha??"",fingerprints:D?.fingerprints??[],reviewedAt:D?.reviewedAt??new Date().toISOString(),...B?{paused:!0}:{}})})}export{K as La,Q as Ma,V as Na,$ as Oa,G as Pa,F as Qa,Y as Ra,Z as Sa,L as Ta,T as Ua};
4
+ `)}function $(H,C="@buddy"){if(!H)return null;let B=V(H),O=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`(?:^|\\s)${O}\\b[ \\t]*(.*)`,"i"),z=B.match(j);if(!z)return null;let A=(z[1]??"").trim();if(!A)return{name:"help",args:"",raw:z[0].trim()};let[D,...E]=A.split(/\s+/),J=K[D.toLowerCase()];if(!J)return{name:"chat",args:A,raw:z[0].trim()};return{name:J,args:E.join(" "),raw:z[0].trim()}}function G(H){return Q.includes(H)}function F(H,C="@buddy"){return Boolean(H?.toLowerCase().includes(C.toLowerCase()))}var Y="**Buddy commands**\n\n| Command | What it does |\n|---|---|\n| `@buddy review` | Review new changes since the last review |\n| `@buddy full-review` | Review the whole diff again, ignoring previous findings |\n| `@buddy summary` | Post a fresh summary without inline findings |\n| `@buddy pause` / `resume` | Stop or restart reviewing this pull request |\n| `@buddy rebase` | Rebase a dependency update pull request |\n| `@buddy merge` | Re-check auto-merge conditions now |\n| `@buddy fix-ci` | Diagnose the failing checks, and retry a flake |\n| `@buddy plan` | Research the repository and write an implementation plan |\n| `@buddy resolve` | Close the review threads Buddy opened |\n| `@buddy remember <text>` | Record a durable note for future runs |\n| `@buddy help` | Show this table |\n\nAnything else after the mention is treated as a question.";function Z(H){if(H.actor.isBot)return"comment was written by a bot";if(G(H.command.name))return null;if(!H.actor.canWrite)return`@${H.actor.login} does not have write access`;return null}async function L(H,C){let B=H.logger??X(),O=Z(H);if(O)return B.info(`\uD83D\uDEAB Ignoring \`${H.command.name}\`: ${O}`),{handled:!1,refusal:O};if(H.command.name==="help")return{handled:!0,reply:Y};let j=C[H.command.name];if(!j)return{handled:!1,refusal:`no handler for ${H.command.name}`,reply:`I don't know how to \`${H.command.name}\` yet. Try \`@buddy help\`.`};return B.info(`\uD83E\uDD16 Running \`${H.command.name}\` for @${H.actor.login}`),await j(H)}function T(H){return{async review(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{})}},async "full-review"(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{full:!0})}},async summary(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to summarize \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{summaryOnly:!0})}},async pause(C){return await I(H,C.number,!0),{handled:!0,reply:"Paused. I will not review this pull request again until you say `@buddy resume`."}},async resume(C){return await I(H,C.number,!1),{handled:!0,reply:"Resumed. I will review the next push."}},async ignore(C){return await I(H,C.number,!0),{handled:!0,reply:"Understood \u2014 I will leave this pull request alone."}},async rebase(C){return{handled:!0,reply:await H.rebase(C.number)}},async merge(C){return{handled:!0,reply:(await H.merge()).includes(C.number)?"Merged.":"This pull request does not currently qualify for auto-merge. Check the conditions in your config and whether its checks have passed."}},async "fix-ci"(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no checks to look at \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.fixCi(C.number)}},async remember(C){let B=C.command.args.trim();if(!B)return{handled:!1,reply:"Tell me what to remember, e.g. `@buddy remember we pin react to 17`."};return{handled:!0,reply:await H.remember(B,C)}},async resolve(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no review threads here \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.resolve(C.number)}},async plan(C){return{handled:!0,reply:await H.plan(C.number,C.isPullRequest,C.command.args.trim())}},async chat(C){let B=_(H.config,C.logger);if(!B)return{handled:!1,reply:"I need an AI provider configured to answer questions. See https://buddy.sh/ai/providers"};return{handled:!0,reply:(await B.complete({system:"You are Buddy, answering a question in a pull request or issue thread. Be brief and concrete. If you do not know, say so rather than guessing.",messages:[{role:"user",content:C.command.args}]})).text}}}}async function I(H,C,B){let j=(await H.provider.getPullRequests("open")).find((E)=>E.number===C);if(!j)return;let{parseReviewState:z,upsertReviewState:A}=await import("./chunk-efqnnrwq.js"),D=z(j.body);await H.provider.updatePullRequest(C,{body:A(j.body,{reviewedSha:D?.reviewedSha??"",fingerprints:D?.fingerprints??[],reviewedAt:D?.reviewedAt??new Date().toISOString(),...B?{paused:!0}:{}})})}export{K as La,Q as Ma,V as Na,$ as Oa,G as Pa,F as Qa,Y as Ra,Z as Sa,L as Ta,T as Ua};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vh as M}from"./chunk-wkq57ssc.js";import{Gh as K}from"./chunk-b4a5gw9c.js";import{Mh as J}from"./chunk-bprmzg0p.js";import"./chunk-4sqwtry6.js";function Q(j){let q=j.match(/github\.com\/([^/]+)\/([^/]+)\/(?:archive|releases\/download)\/(?:refs\/tags\/)?v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i);if(!q)return null;return{owner:q[1],repo:q[2].replace(/\.git$/,""),version:q[3],hasVPrefix:/\/v\d/.test(j)}}async function S(j,q){let y=J();try{let B={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"};if(q)B.Authorization=`Bearer ${q}`;let E=await K(`${M()}/repos/${j.owner}/${j.repo}/releases/latest`,{headers:B});if(!E.ok)return y.debug(`No latest release for ${j.owner}/${j.repo}: ${E.status}`),null;let F=await E.json();if(!F.tag_name)return null;let I=F.tag_name.replace(/^v/,"");return/^\d+\.\d+\.\d+/.test(I)?I:null}catch(B){return y.debug(`Failed to fetch latest Zig version for ${j.owner}/${j.repo}: ${B}`),null}}function X(j,q){return j.replace(/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i,(y)=>y.startsWith("/v")?`/v${q}`:`/${q}`)}async function Y(){try{return await Bun.spawn(["zig","version"],{stdout:"pipe",stderr:"pipe"}).exited===0}catch{return!1}}async function _(j){let q=J();try{let y=Bun.spawn(["zig","fetch",j],{stdout:"pipe",stderr:"pipe"}),[B,E]=await Promise.all([new Response(y.stdout).text(),y.exited]);if(E!==0){let I=await new Response(y.stderr).text();return q.warn(`\u26A0\uFE0F zig fetch failed for ${j}: ${I.trim()}`),null}let F=B.trim();return F.length>0?F:null}catch(y){return q.warn(`\u26A0\uFE0F Could not run zig fetch for ${j}: ${y}`),null}}export{X as zigUrlForVersion,Q as parseZigSource,Y as isZigAvailable,_ as fetchZigHash,S as fetchLatestZigVersion};
2
+ import{wh as M}from"./chunk-6k6dgwmy.js";import{Hh as K}from"./chunk-ddmvjp0y.js";import{Nh as J}from"./chunk-f0z6kyqt.js";import"./chunk-6sm15trq.js";function Q(j){let q=j.match(/github\.com\/([^/]+)\/([^/]+)\/(?:archive|releases\/download)\/(?:refs\/tags\/)?v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i);if(!q)return null;return{owner:q[1],repo:q[2].replace(/\.git$/,""),version:q[3],hasVPrefix:/\/v\d/.test(j)}}async function S(j,q){let y=J();try{let B={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"};if(q)B.Authorization=`Bearer ${q}`;let E=await K(`${M()}/repos/${j.owner}/${j.repo}/releases/latest`,{headers:B});if(!E.ok)return y.debug(`No latest release for ${j.owner}/${j.repo}: ${E.status}`),null;let F=await E.json();if(!F.tag_name)return null;let I=F.tag_name.replace(/^v/,"");return/^\d+\.\d+\.\d+/.test(I)?I:null}catch(B){return y.debug(`Failed to fetch latest Zig version for ${j.owner}/${j.repo}: ${B}`),null}}function X(j,q){return j.replace(/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i,(y)=>y.startsWith("/v")?`/v${q}`:`/${q}`)}async function Y(){try{return await Bun.spawn(["zig","version"],{stdout:"pipe",stderr:"pipe"}).exited===0}catch{return!1}}async function _(j){let q=J();try{let y=Bun.spawn(["zig","fetch",j],{stdout:"pipe",stderr:"pipe"}),[B,E]=await Promise.all([new Response(y.stdout).text(),y.exited]);if(E!==0){let I=await new Response(y.stderr).text();return q.warn(`\u26A0\uFE0F zig fetch failed for ${j}: ${I.trim()}`),null}let F=B.trim();return F.length>0?F:null}catch(y){return q.warn(`\u26A0\uFE0F Could not run zig fetch for ${j}: ${y}`),null}}export{X as zigUrlForVersion,Q as parseZigSource,Y as isZigAvailable,_ as fetchZigHash,S as fetchLatestZigVersion};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{uh as L$}from"./chunk-k8pnnyq1.js";import{vh as P$}from"./chunk-wkq57ssc.js";import{Gh as Z1}from"./chunk-b4a5gw9c.js";import{Mh as H}from"./chunk-bprmzg0p.js";import{$k as u7,al as B,bl as O1}from"./chunk-4sqwtry6.js";var N=B((Kz,R0)=>{var{FORCE_COLOR:x$,NODE_DISABLE_COLORS:h$,TERM:d$}=process.env,G={enabled:!h$&&d$!=="dumb"&&x$!=="0",reset:F(0,0),bold:F(1,22),dim:F(2,22),italic:F(3,23),underline:F(4,24),inverse:F(7,27),hidden:F(8,28),strikethrough:F(9,29),black:F(30,39),red:F(31,39),green:F(32,39),yellow:F(33,39),blue:F(34,39),magenta:F(35,39),cyan:F(36,39),white:F(37,39),gray:F(90,39),grey:F(90,39),bgBlack:F(40,49),bgRed:F(41,49),bgGreen:F(42,49),bgYellow:F(43,49),bgBlue:F(44,49),bgMagenta:F(45,49),bgCyan:F(46,49),bgWhite:F(47,49)};function U0($,Y){let Z=0,z,X="",Q="";for(;Z<$.length;Z++)if(z=$[Z],X+=z.open,Q+=z.close,Y.includes(z.close))Y=Y.replace(z.rgx,z.close+z.open);return X+Y+Q}function v$($,Y){let Z={has:$,keys:Y};return Z.reset=G.reset.bind(Z),Z.bold=G.bold.bind(Z),Z.dim=G.dim.bind(Z),Z.italic=G.italic.bind(Z),Z.underline=G.underline.bind(Z),Z.inverse=G.inverse.bind(Z),Z.hidden=G.hidden.bind(Z),Z.strikethrough=G.strikethrough.bind(Z),Z.black=G.black.bind(Z),Z.red=G.red.bind(Z),Z.green=G.green.bind(Z),Z.yellow=G.yellow.bind(Z),Z.blue=G.blue.bind(Z),Z.magenta=G.magenta.bind(Z),Z.cyan=G.cyan.bind(Z),Z.white=G.white.bind(Z),Z.gray=G.gray.bind(Z),Z.grey=G.grey.bind(Z),Z.bgBlack=G.bgBlack.bind(Z),Z.bgRed=G.bgRed.bind(Z),Z.bgGreen=G.bgGreen.bind(Z),Z.bgYellow=G.bgYellow.bind(Z),Z.bgBlue=G.bgBlue.bind(Z),Z.bgMagenta=G.bgMagenta.bind(Z),Z.bgCyan=G.bgCyan.bind(Z),Z.bgWhite=G.bgWhite.bind(Z),Z}function F($,Y){let Z={open:`\x1B[${$}m`,close:`\x1B[${Y}m`,rgx:new RegExp(`\\x1b\\[${Y}m`,"g")};return function(z){if(this!==void 0&&this.has!==void 0)return this.has.includes($)||(this.has.push($),this.keys.push(Z)),z===void 0?this:G.enabled?U0(this.keys,z+""):z+"";return z===void 0?v$([$],[Z]):G.enabled?U0([Z],z+""):z+""}}R0.exports=G});var F0=B((Qz,G0)=>{G0.exports=($,Y)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Y){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var V1=B((Hz,N0)=>{N0.exports=($)=>{let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),Z=new RegExp(Y,"g");return typeof $==="string"?$.replace(Z,""):$}});var W=B((Jz,W0)=>{var y1={to($,Y){if(!Y)return`\x1B[${$+1}G`;return`\x1B[${Y+1};${$+1}H`},move($,Y){let Z="";if($<0)Z+=`\x1B[${-$}D`;else if($>0)Z+=`\x1B[${$}C`;if(Y<0)Z+=`\x1B[${-Y}A`;else if(Y>0)Z+=`\x1B[${Y}B`;return Z},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},y$={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},f$={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Y="";for(let Z=0;Z<$;Z++)Y+=this.line+(Z<$-1?y1.up():"");if($)Y+=y1.left;return Y}};W0.exports={cursor:y1,scroll:y$,erase:f$,beep:"\x07"}});var A0=B((Mz,E0)=>{function g$($,Y){var Z=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!Z){if(Array.isArray($)||(Z=m$($))||Y&&$&&typeof $.length==="number"){if(Z)$=Z;var z=0,X=function(){};return{s:X,n:function(){if(z>=$.length)return{done:!0};return{done:!1,value:$[z++]}},e:function(U){throw U},f:X}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ import{vh as L$}from"./chunk-hkb714k3.js";import{wh as P$}from"./chunk-6k6dgwmy.js";import{Hh as Z1}from"./chunk-ddmvjp0y.js";import{Nh as H}from"./chunk-f0z6kyqt.js";import{al as u7,bl as B,cl as O1}from"./chunk-6sm15trq.js";var N=B((Kz,R0)=>{var{FORCE_COLOR:x$,NODE_DISABLE_COLORS:h$,TERM:d$}=process.env,G={enabled:!h$&&d$!=="dumb"&&x$!=="0",reset:F(0,0),bold:F(1,22),dim:F(2,22),italic:F(3,23),underline:F(4,24),inverse:F(7,27),hidden:F(8,28),strikethrough:F(9,29),black:F(30,39),red:F(31,39),green:F(32,39),yellow:F(33,39),blue:F(34,39),magenta:F(35,39),cyan:F(36,39),white:F(37,39),gray:F(90,39),grey:F(90,39),bgBlack:F(40,49),bgRed:F(41,49),bgGreen:F(42,49),bgYellow:F(43,49),bgBlue:F(44,49),bgMagenta:F(45,49),bgCyan:F(46,49),bgWhite:F(47,49)};function U0($,Y){let Z=0,z,X="",Q="";for(;Z<$.length;Z++)if(z=$[Z],X+=z.open,Q+=z.close,Y.includes(z.close))Y=Y.replace(z.rgx,z.close+z.open);return X+Y+Q}function v$($,Y){let Z={has:$,keys:Y};return Z.reset=G.reset.bind(Z),Z.bold=G.bold.bind(Z),Z.dim=G.dim.bind(Z),Z.italic=G.italic.bind(Z),Z.underline=G.underline.bind(Z),Z.inverse=G.inverse.bind(Z),Z.hidden=G.hidden.bind(Z),Z.strikethrough=G.strikethrough.bind(Z),Z.black=G.black.bind(Z),Z.red=G.red.bind(Z),Z.green=G.green.bind(Z),Z.yellow=G.yellow.bind(Z),Z.blue=G.blue.bind(Z),Z.magenta=G.magenta.bind(Z),Z.cyan=G.cyan.bind(Z),Z.white=G.white.bind(Z),Z.gray=G.gray.bind(Z),Z.grey=G.grey.bind(Z),Z.bgBlack=G.bgBlack.bind(Z),Z.bgRed=G.bgRed.bind(Z),Z.bgGreen=G.bgGreen.bind(Z),Z.bgYellow=G.bgYellow.bind(Z),Z.bgBlue=G.bgBlue.bind(Z),Z.bgMagenta=G.bgMagenta.bind(Z),Z.bgCyan=G.bgCyan.bind(Z),Z.bgWhite=G.bgWhite.bind(Z),Z}function F($,Y){let Z={open:`\x1B[${$}m`,close:`\x1B[${Y}m`,rgx:new RegExp(`\\x1b\\[${Y}m`,"g")};return function(z){if(this!==void 0&&this.has!==void 0)return this.has.includes($)||(this.has.push($),this.keys.push(Z)),z===void 0?this:G.enabled?U0(this.keys,z+""):z+"";return z===void 0?v$([$],[Z]):G.enabled?U0([Z],z+""):z+""}}R0.exports=G});var F0=B((Qz,G0)=>{G0.exports=($,Y)=>{if($.meta&&$.name!=="escape")return;if($.ctrl){if($.name==="a")return"first";if($.name==="c")return"abort";if($.name==="d")return"abort";if($.name==="e")return"last";if($.name==="g")return"reset"}if(Y){if($.name==="j")return"down";if($.name==="k")return"up"}if($.name==="return")return"submit";if($.name==="enter")return"submit";if($.name==="backspace")return"delete";if($.name==="delete")return"deleteForward";if($.name==="abort")return"abort";if($.name==="escape")return"exit";if($.name==="tab")return"next";if($.name==="pagedown")return"nextPage";if($.name==="pageup")return"prevPage";if($.name==="home")return"home";if($.name==="end")return"end";if($.name==="up")return"up";if($.name==="down")return"down";if($.name==="right")return"right";if($.name==="left")return"left";return!1}});var V1=B((Hz,N0)=>{N0.exports=($)=>{let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),Z=new RegExp(Y,"g");return typeof $==="string"?$.replace(Z,""):$}});var W=B((Jz,W0)=>{var y1={to($,Y){if(!Y)return`\x1B[${$+1}G`;return`\x1B[${Y+1};${$+1}H`},move($,Y){let Z="";if($<0)Z+=`\x1B[${-$}D`;else if($>0)Z+=`\x1B[${$}C`;if(Y<0)Z+=`\x1B[${-Y}A`;else if(Y>0)Z+=`\x1B[${Y}B`;return Z},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},y$={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},f$={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Y="";for(let Z=0;Z<$;Z++)Y+=this.line+(Z<$-1?y1.up():"");if($)Y+=y1.left;return Y}};W0.exports={cursor:y1,scroll:y$,erase:f$,beep:"\x07"}});var A0=B((Mz,E0)=>{function g$($,Y){var Z=typeof Symbol<"u"&&$[Symbol.iterator]||$["@@iterator"];if(!Z){if(Array.isArray($)||(Z=m$($))||Y&&$&&typeof $.length==="number"){if(Z)$=Z;var z=0,X=function(){};return{s:X,n:function(){if(z>=$.length)return{done:!0};return{done:!1,value:$[z++]}},e:function(U){throw U},f:X}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Q=!0,K=!1,J;return{s:function(){Z=Z.call($)},n:function(){var U=Z.next();return Q=U.done,U},e:function(U){K=!0,J=U},f:function(){try{if(!Q&&Z.return!=null)Z.return()}finally{if(K)throw J}}}}function m$($,Y){if(!$)return;if(typeof $==="string")return V0($,Y);var Z=Object.prototype.toString.call($).slice(8,-1);if(Z==="Object"&&$.constructor)Z=$.constructor.name;if(Z==="Map"||Z==="Set")return Array.from($);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return V0($,Y)}function V0($,Y){if(Y==null||Y>$.length)Y=$.length;for(var Z=0,z=Array(Y);Z<Y;Z++)z[Z]=$[Z];return z}var u$=V1(),C0=W(),O0=C0.erase,c$=C0.cursor,n$=($)=>[...u$($)].length;E0.exports=function($,Y){if(!Y)return O0.line+c$.to(0);let Z=0,z=$.split(/\r?\n/);var X=g$(z),Q;try{for(X.s();!(Q=X.n()).done;){let K=Q.value;Z+=1+Math.floor(Math.max(n$(K)-1,0)/Y)}}catch(K){X.e(K)}finally{X.f()}return O0.lines(Z)}});var f1=B((Bz,I0)=>{var K1={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},i$={arrowUp:K1.arrowUp,arrowDown:K1.arrowDown,arrowLeft:K1.arrowLeft,arrowRight:K1.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},l$=process.platform==="win32"?i$:K1;I0.exports=l$});var S0=B((Uz,q0)=>{var r=N(),s=f1(),g1=Object.freeze({password:{scale:1,render:($)=>"*".repeat($.length)},emoji:{scale:2,render:($)=>"\uD83D\uDE03".repeat($.length)},invisible:{scale:0,render:($)=>""},default:{scale:1,render:($)=>`${$}`}}),p$=($)=>g1[$]||g1.default,Q1=Object.freeze({aborted:r.red(s.cross),done:r.green(s.tick),exited:r.yellow(s.cross),default:r.cyan("?")}),a$=($,Y,Z)=>Y?Q1.aborted:Z?Q1.exited:$?Q1.done:Q1.default,s$=($)=>r.gray($?s.ellipsis:s.pointerSmall),o$=($,Y)=>r.gray($?Y?s.pointerSmall:"+":s.line);q0.exports={styles:g1,render:p$,symbols:Q1,symbol:a$,delimiter:s$,item:o$}});var D0=B((Rz,j0)=>{var t$=V1();j0.exports=function($,Y){let Z=String(t$($)||"").split(/\r?\n/);if(!Y)return Z.length;return Z.map((z)=>Math.ceil(z.length/Y)).reduce((z,X)=>z+X)}});var P0=B((Gz,T0)=>{T0.exports=($,Y={})=>{let Z=Number.isSafeInteger(parseInt(Y.margin))?Array(parseInt(Y.margin)).fill(" ").join(""):Y.margin||"",z=Y.width;return($||"").split(/\r?\n/g).map((X)=>X.split(/\s+/g).reduce((Q,K)=>{if(K.length+Z.length>=z||Q[Q.length-1].length+K.length+1<z)Q[Q.length-1]+=` ${K}`;else Q.push(`${Z}${K}`);return Q},[Z]).join(`
4
4
  `)).join(`
5
5
  `)}});var w0=B((Fz,L0)=>{L0.exports=($,Y,Z)=>{Z=Z||Y;let z=Math.min(Y-Z,$-Math.floor(Z/2));if(z<0)z=0;let X=Math.min(z+Z,Y);return{startIndex:z,endIndex:X}}});var P=B((Nz,_0)=>{_0.exports={action:F0(),clear:A0(),style:S0(),strip:V1(),figures:f1(),lines:D0(),wrap:P0(),entriesToDisplay:w0()}});var d=B((Wz,h0)=>{var b0=O1("readline"),r$=P(),e$=r$.action,$Y=O1("events"),k0=W(),YY=k0.beep,ZY=k0.cursor,zY=N();class x0 extends $Y{constructor($={}){super();this.firstRender=!0,this.in=$.stdin||process.stdin,this.out=$.stdout||process.stdout,this.onRender=($.onRender||(()=>{return})).bind(this);let Y=b0.createInterface({input:this.in,escapeCodeTimeout:50});if(b0.emitKeypressEvents(this.in,Y),this.in.isTTY)this.in.setRawMode(!0);let Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,z=(X,Q)=>{let K=e$(Q,Z);if(K===!1)this._&&this._(X,Q);else if(typeof this[K]==="function")this[K](Q);else this.bell()};this.close=()=>{if(this.out.write(ZY.show),this.in.removeListener("keypress",z),this.in.isTTY)this.in.setRawMode(!1);Y.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",z)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(YY)}render(){if(this.onRender(zY),this.firstRender)this.firstRender=!1}}h0.exports=x0});var m0=B((Vz,g0)=>{function d0($,Y,Z,z,X,Q,K){try{var J=$[Q](K),M=J.value}catch(U){Z(U);return}if(J.done)Y(M);else Promise.resolve(M).then(z,X)}function v0($){return function(){var Y=this,Z=arguments;return new Promise(function(z,X){var Q=$.apply(Y,Z);function K(M){d0(Q,z,X,K,J,"next",M)}function J(M){d0(Q,z,X,K,J,"throw",M)}K(void 0)})}}var C1=N(),XY=d(),y0=W(),KY=y0.erase,H1=y0.cursor,E1=P(),m1=E1.style,u1=E1.clear,QY=E1.lines,HY=E1.figures;class f0 extends XY{constructor($={}){super($);this.transform=m1.render($.style),this.scale=this.transform.scale,this.msg=$.message,this.initial=$.initial||"",this.validator=$.validate||(()=>!0),this.value="",this.errorMsg=$.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=u1("",this.out.columns),this.render()}set value($){if(!$&&this.initial)this.placeholder=!0,this.rendered=C1.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render($);this._value=$,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
@@ -1067,4 +1067,4 @@ ${Y}:`),$.errors.length>0)H().info("\u274C Errors:"),$.errors.forEach((Z)=>H().i
1067
1067
  2. \u26A0\uFE0F Using default GITHUB_TOKEN (limited functionality):`),H().info(" \u2022 Dependency updates: \u2705 Will work"),H().info(" \u2022 Dashboard creation: \u2705 Will work"),H().info(" \u2022 Workflow file updates: \u274C Won't work"),H().info(" \uD83D\uDCA1 Consider setting up a Personal Access Token later for full functionality");H().info(`
1068
1068
  3. \uD83D\uDD27 Configure repository permissions:`),H().info(` - Go to: https://github.com/${$.owner}/${$.name}/settings/actions`),H().info(' - Under "Workflow permissions":'),H().info(' \u2705 Select "Read and write permissions"'),H().info(' \u2705 Check "Allow GitHub Actions to create and approve pull requests"'),H().info(' - Click "Save"'),H().info(`
1069
1069
  \uD83C\uDF89 Setup Complete!`),H().info("\uD83D\uDCA1 Your workflows will now run automatically on schedule!"),H().info("\uD83D\uDCCA First dashboard update will appear within 24 hours"),H().info("\uD83D\uDD17 Learn more: https://docs.github.com/en/actions")}
1070
- export{j$ as Vg,g7 as Wg,m7 as Xg,D$ as Yg,I$ as Zg,i7 as _g,a7 as $g,_5 as ah,b5 as bh,k5 as ch,x5 as dh,h5 as eh,s7 as fh,d5 as gh,v5 as hh,y5 as ih,f5 as jh,g5 as kh,w$ as lh,zz as mh,m5 as nh,_$ as oh,u5 as ph,c5 as qh,n5 as rh,i5 as sh,l5 as th};
1070
+ export{j$ as Wg,g7 as Xg,m7 as Yg,D$ as Zg,I$ as _g,i7 as $g,a7 as ah,_5 as bh,b5 as ch,k5 as dh,x5 as eh,h5 as fh,s7 as gh,d5 as hh,v5 as ih,y5 as jh,f5 as kh,g5 as lh,w$ as mh,zz as nh,m5 as oh,_$ as ph,u5 as qh,c5 as rh,n5 as sh,i5 as th,l5 as uh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Mh as F}from"./chunk-bprmzg0p.js";var R=/^(?:build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(?:\([^)]+\))?!?: .+/;function Y(M,G){let P=R.test(M.trim());return{name:"title-format",mode:G,passed:P,summary:P?"Title follows conventional commit format":"Title does not follow conventional commit format",...P?{}:{detail:"Expected something like `feat(scope): add the thing` or `fix: correct the off-by-one`."}}}function B(M,G){let P=M.trim();if(P.length<20)return{name:"description",mode:G.mode,passed:!1,summary:"Description is missing or too short",detail:"Explain what changed and why, so a reviewer does not have to reconstruct it from the diff."};let z=(G.requireSections??[]).filter((j)=>!new RegExp(`^#{1,6}\\s*${w(j)}\\b`,"im").test(P));return{name:"description",mode:G.mode,passed:z.length===0,summary:z.length===0?"Description is complete":`Description is missing ${z.length} required section(s)`,...z.length>0?{detail:`Missing: ${z.map((j)=>`\`${j}\``).join(", ")}`}:{}}}function C(M,G){let P=[];for(let z of M??[]){if(G.blockVulnerable!==!1&&z.vulnerable)P.push(`\`${z.name}@${z.version}\` has a known vulnerability`);if(G.blockDeprecated!==!1&&z.deprecated)P.push(`\`${z.name}\` is deprecated`);if(G.blockEol!==!1&&z.eol)P.push(z.eol);if(G.licenseAllowlist?.length&&z.license){if(!G.licenseAllowlist.includes(z.license))P.push(`\`${z.name}\` is licensed \`${z.license}\`, which is not on the allowlist`)}}return{name:"dependency-gate",mode:G.mode,passed:P.length===0,summary:P.length===0?"Dependencies satisfy the configured policy":`${P.length} dependency policy violation(s)`,...P.length>0?{detail:P.map((z)=>`- ${z}`).join(`
2
+ import{Nh as F}from"./chunk-f0z6kyqt.js";var R=/^(?:build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(?:\([^)]+\))?!?: .+/;function Y(M,G){let P=R.test(M.trim());return{name:"title-format",mode:G,passed:P,summary:P?"Title follows conventional commit format":"Title does not follow conventional commit format",...P?{}:{detail:"Expected something like `feat(scope): add the thing` or `fix: correct the off-by-one`."}}}function B(M,G){let P=M.trim();if(P.length<20)return{name:"description",mode:G.mode,passed:!1,summary:"Description is missing or too short",detail:"Explain what changed and why, so a reviewer does not have to reconstruct it from the diff."};let z=(G.requireSections??[]).filter((j)=>!new RegExp(`^#{1,6}\\s*${w(j)}\\b`,"im").test(P));return{name:"description",mode:G.mode,passed:z.length===0,summary:z.length===0?"Description is complete":`Description is missing ${z.length} required section(s)`,...z.length>0?{detail:`Missing: ${z.map((j)=>`\`${j}\``).join(", ")}`}:{}}}function C(M,G){let P=[];for(let z of M??[]){if(G.blockVulnerable!==!1&&z.vulnerable)P.push(`\`${z.name}@${z.version}\` has a known vulnerability`);if(G.blockDeprecated!==!1&&z.deprecated)P.push(`\`${z.name}\` is deprecated`);if(G.blockEol!==!1&&z.eol)P.push(z.eol);if(G.licenseAllowlist?.length&&z.license){if(!G.licenseAllowlist.includes(z.license))P.push(`\`${z.name}\` is licensed \`${z.license}\`, which is not on the allowlist`)}}return{name:"dependency-gate",mode:G.mode,passed:P.length===0,summary:P.length===0?"Dependencies satisfy the configured policy":`${P.length} dependency policy violation(s)`,...P.length>0?{detail:P.map((z)=>`- ${z}`).join(`
3
3
  `)}:{}}}function q(M,G){let P=[];if(G.titleFormat&&G.titleFormat!=="off")P.push(Y(M.title,G.titleFormat));if(G.description&&G.description.mode!=="off")P.push(B(M.body,G.description));if(G.dependencyGate&&G.dependencyGate.mode!=="off")P.push(C(M.dependencies,G.dependencyGate));return P}function S(M){if(M.length===0)return{conclusion:"neutral",title:"No checks configured",summary:"No pre-merge checks are enabled."};let G=M.filter((x)=>!x.passed&&x.mode==="error"),P=M.filter((x)=>!x.passed&&x.mode==="warning"),z=M.filter((x)=>x.neutral),j=M.map((x)=>{return`${H(x)} **${x.name}** \u2014 ${x.summary}${x.detail?`
4
4
 
5
5
  ${x.detail}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Dd as a,Ed as b,Fd as c,Gd as d,Hd as e,Id as f,Jd as g,Kd as h,Ld as i,Md as j}from"./chunk-bggpgbdx.js";import"./chunk-6sm15trq.js";export{j as shouldFail,h as formatReview,d as formatPretty,e as formatGithub,f as formatAgent,b as diffArgsFor,g as countBySeverity,c as collectLocalDiff,i as applySuggestion,a as REVIEW_FORMATS};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Pf as Z}from"./chunk-47ancrn1.js";import{Mh as Y}from"./chunk-bprmzg0p.js";import W from"process";var $=[["bun","test"],["npm","test","--silent"]];async function E(G,H){let I=H?[H]:await L(G);for(let z of I){let j=Bun.spawn(z,{cwd:G,stdout:"pipe",stderr:"pipe",env:{PATH:W.env.PATH??"",HOME:W.env.HOME??"",CI:"1"}}),[J,K,Q]=await Promise.all([new Response(j.stdout).text(),new Response(j.stderr).text(),j.exited]);return{ran:!0,passed:Q===0,output:`${J}
2
+ import{Qf as Z}from"./chunk-p8azbpq6.js";import{Nh as Y}from"./chunk-f0z6kyqt.js";import W from"process";var $=[["bun","test"],["npm","test","--silent"]];async function E(G,H){let I=H?[H]:await L(G);for(let z of I){let j=Bun.spawn(z,{cwd:G,stdout:"pipe",stderr:"pipe",env:{PATH:W.env.PATH??"",HOME:W.env.HOME??"",CI:"1"}}),[J,K,Q]=await Promise.all([new Response(j.stdout).text(),new Response(j.stderr).text(),j.exited]);return{ran:!0,passed:Q===0,output:`${J}
3
3
  ${K}`.trim().slice(-4000)}}return{ran:!1,passed:!1,output:""}}async function L(G){let H=Bun.file(`${G}/package.json`);if(!await H.exists())return[];try{return(await H.json()).scripts?.test?$:[]}catch{return[]}}function O(G,H){return`${G.head}/buddy-${H}`}async function N(G){let H=G.logger??Y(),{provider:I,pullRequest:z,touch:j}=G;H.info(`\u2728 Running finishing touch '${j.name}' on PR #${z.number}`);let J=await Z(G.ai,{mode:j.mode,task:j.buildTask({summary:z.title,files:G.files??[]}),context:{workspace:G.workspace,baseBranch:z.base,branch:z.head},logger:H}),K=await _(G.workspace);if(K.length===0)return{mode:"none",changedFiles:[],verified:!1,comment:J.stopReason==="completed"?`**${j.description}** \u2014 nothing to change.`:`**${j.description}** \u2014 stopped before finishing (${J.stopReason}), and left nothing behind.`};let Q=J.stopReason==="completed",P=await E(G.workspace,G.testCommand);if(!(Q&&j.defaultOutput!=="suggestion"&&(P.passed||!P.ran)))return{mode:"suggestions",changedFiles:K,verified:P.passed,comment:X(j,K,P,J.stopReason)};let V=O(z,j.name);try{await I.createBranch(V,z.head),await I.commitChanges(V,`chore: ${j.description.toLowerCase()} for #${z.number}`,await x(G.workspace,K),z.head);let U=await I.createPullRequest({title:`${j.description} for #${z.number}`,body:y(j,z,K,P),head:V,base:z.head,labels:["buddy","finishing-touch"]});return{mode:"stacked-pr",pullRequest:U,changedFiles:K,verified:P.passed,comment:`**${j.description}** \u2014 opened [#${U.number}](${U.url}) targeting this branch.`+(P.ran?"":" No test script was found, so this is unverified.")}}catch(U){return H.warn(`\u26A0\uFE0F Could not open a stacked pull request: ${U}`),{mode:"suggestions",changedFiles:K,verified:P.passed,comment:X(j,K,P,J.stopReason)}}}async function _(G){let H=Bun.spawn(["git","status","--porcelain"],{cwd:G,stdout:"pipe",stderr:"ignore"}),[I,z]=await Promise.all([new Response(H.stdout).text(),H.exited]);if(z!==0)return[];let j=[];for(let J of I.split(`
4
4
  `)){if(!J.trim())continue;let K=J.slice(0,2),Q=J.slice(3).trim();if(K.includes("D"))continue;j.push(Q.includes(" -> ")?Q.split(" -> ")[1]:Q)}return j}async function x(G,H){let I=[];for(let z of H){let j=Bun.file(`${G}/${z}`);if(await j.exists())I.push({path:z,content:await j.text(),type:"update"})}return I}function y(G,H,I,z){return[`${G.description}, requested on #${H.number}.`,"",`This targets \`${H.head}\` rather than \`${H.base}\`, so merging it`,"adds these changes to that pull request.","",z.ran?z.passed?"\u2705 The repository's tests pass with these changes.":"\u26A0\uFE0F The repository's tests do **not** pass with these changes.":"\u2139\uFE0F No test script was found, so these changes are unverified.","","### Files changed","",...I.map((j)=>`- \`${j}\``)].join(`
5
5
  `)}function X(G,H,I,z){let j=[`**${G.description}**`,""];if(z&&z!=="completed")j.push(`The agent stopped before finishing (${z}), so what follows is`,"partial work rather than a complete change.","");if(I.ran&&!I.passed)j.push("The repository's tests do not pass with these changes, so no branch was","opened. Treat what follows as a starting point rather than a result.","");if(j.push("Files that would change:","",...H.map((J)=>`- \`${J}\``)),I.output)j.push("","<details><summary>Test output</summary>","","```",I.output,"```","","</details>");return j.join(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Da as a}from"./chunk-9b4z1bpx.js";import"./chunk-19n3wnxq.js";import"./chunk-sczx20gw.js";import"./chunk-d2d5m2kx.js";import"./chunk-3wy8fypy.js";import"./chunk-89s9f3mf.js";import"./chunk-ja3rvd6y.js";import"./chunk-srznv36n.js";import"./chunk-0ewzxzt3.js";import"./chunk-1z4nhstx.js";import"./chunk-x4ea69ek.js";import"./chunk-03j2dx5h.js";import"./chunk-v6dephze.js";import"./chunk-7wk4px2k.js";import"./chunk-88j356ng.js";import"./chunk-675c6ddc.js";import"./chunk-p96zq2zc.js";import"./chunk-jpdd59fh.js";import"./chunk-p8azbpq6.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-vckn5ate.js";import"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as Scheduler};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Gh as X}from"./chunk-b4a5gw9c.js";import{Mh as Z}from"./chunk-bprmzg0p.js";var V={node:"nodejs","library/node":"nodejs",python:"python","library/python":"python",debian:"debian","library/debian":"debian",ubuntu:"ubuntu","library/ubuntu":"ubuntu",alpine:"alpine","library/alpine":"alpine",php:"php","library/php":"php",ruby:"ruby","library/ruby":"ruby",golang:"go","library/golang":"go",postgres:"postgresql","library/postgres":"postgresql",mysql:"mysql","library/mysql":"mysql",redis:"redis","library/redis":"redis",nginx:"nginx","library/nginx":"nginx"};function q(j){let x=j.replace(/^(?:docker\.io|registry-1\.docker\.io)\//,"");return V[x]??V[x.split("/").pop()??""]??null}function G(j,x){let z=/^v?(\d+(?:\.\d+)*)/.exec(j.trim());if(!z)return null;let H=z[1].split(".");for(let k=H.length;k>=1;k--){let K=H.slice(0,k).join("."),B=x.find((J)=>J.cycle===K);if(B)return B}return null}async function F(j,x,z={}){let H=z.logger??Z(),k=q(j);if(!k)return null;let K=z.baseUrl??"https://endoflife.date",B=await X(`${K}/api/${k}.json`,{headers:{"User-Agent":"buddy",Accept:"application/json"}}).catch(()=>null);if(!B?.ok)return H.debug(`Could not read the support window for ${k}`),null;let J=await B.json().catch(()=>null);if(!Array.isArray(J))return null;let v=G(x,J);if(!v)return null;if(v.eol===!1)return{product:k,cycle:v.cycle,eol:!1};if(v.eol===!0)return{product:k,cycle:v.cycle,eol:!0};let M=new Date(v.eol);if(Number.isNaN(M.getTime()))return{product:k,cycle:v.cycle,eol:!1};let $=z.now??new Date,Q=Math.round((M.getTime()-$.getTime())/86400000);return{product:k,cycle:v.cycle,eol:Q<0,date:v.eol,daysRemaining:Q}}var I=90;function N(j){if(!j)return"";if(j.eol)return j.date?`\`${j.product} ${j.cycle}\` reached end of life on ${j.date} and no longer receives security fixes.`:`\`${j.product} ${j.cycle}\` has reached end of life and no longer receives security fixes.`;if(j.daysRemaining!==void 0&&j.daysRemaining<=I)return`\`${j.product} ${j.cycle}\` reaches end of life in ${j.daysRemaining} day(s), on ${j.date}.`;return""}
2
+ import{Hh as X}from"./chunk-ddmvjp0y.js";import{Nh as Z}from"./chunk-f0z6kyqt.js";var V={node:"nodejs","library/node":"nodejs",python:"python","library/python":"python",debian:"debian","library/debian":"debian",ubuntu:"ubuntu","library/ubuntu":"ubuntu",alpine:"alpine","library/alpine":"alpine",php:"php","library/php":"php",ruby:"ruby","library/ruby":"ruby",golang:"go","library/golang":"go",postgres:"postgresql","library/postgres":"postgresql",mysql:"mysql","library/mysql":"mysql",redis:"redis","library/redis":"redis",nginx:"nginx","library/nginx":"nginx"};function q(j){let x=j.replace(/^(?:docker\.io|registry-1\.docker\.io)\//,"");return V[x]??V[x.split("/").pop()??""]??null}function G(j,x){let z=/^v?(\d+(?:\.\d+)*)/.exec(j.trim());if(!z)return null;let H=z[1].split(".");for(let k=H.length;k>=1;k--){let K=H.slice(0,k).join("."),B=x.find((J)=>J.cycle===K);if(B)return B}return null}async function F(j,x,z={}){let H=z.logger??Z(),k=q(j);if(!k)return null;let K=z.baseUrl??"https://endoflife.date",B=await X(`${K}/api/${k}.json`,{headers:{"User-Agent":"buddy",Accept:"application/json"}}).catch(()=>null);if(!B?.ok)return H.debug(`Could not read the support window for ${k}`),null;let J=await B.json().catch(()=>null);if(!Array.isArray(J))return null;let v=G(x,J);if(!v)return null;if(v.eol===!1)return{product:k,cycle:v.cycle,eol:!1};if(v.eol===!0)return{product:k,cycle:v.cycle,eol:!0};let M=new Date(v.eol);if(Number.isNaN(M.getTime()))return{product:k,cycle:v.cycle,eol:!1};let $=z.now??new Date,Q=Math.round((M.getTime()-$.getTime())/86400000);return{product:k,cycle:v.cycle,eol:Q<0,date:v.eol,daysRemaining:Q}}var I=90;function N(j){if(!j)return"";if(j.eol)return j.date?`\`${j.product} ${j.cycle}\` reached end of life on ${j.date} and no longer receives security fixes.`:`\`${j.product} ${j.cycle}\` has reached end of life and no longer receives security fixes.`;if(j.daysRemaining!==void 0&&j.daysRemaining<=I)return`\`${j.product} ${j.cycle}\` reaches end of life in ${j.daysRemaining} day(s), on ${j.date}.`;return""}
3
3
  export{V as xa,q as ya,G as za,F as Aa,I as Ba,N as Ca};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{bg as a,cg as b,dg as c,eg as d,fg as e,gg as f,hg as g,ig as h,jg as i,kg as j,lg as k,mg as l,ng as m}from"./chunk-f001yg2a.js";import"./chunk-gvnsr72j.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{h as sortUpdatesByPriority,j as satisfiesRange,a as parsePackageFile,g as groupUpdates,i as getUpdateType,f as generateBranchName,d as formatPRTitle,e as formatPRBody,c as formatCommitMessage,l as extractPackageNamesFromPRBody,b as detectPackageManager,k as checkForRebaseRequests,m as checkForAutoClose};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{sf as k,wf as b}from"./chunk-d1yhv10h.js";import{yf as C}from"./chunk-ffb50kwa.js";import{Pf as x}from"./chunk-47ancrn1.js";import{tg as v}from"./chunk-abfyz98y.js";import{Mh as D}from"./chunk-bprmzg0p.js";var T={type:"object",properties:{changes:{type:"array",items:{type:"object",properties:{description:{type:"string",description:"What upstream changed"},version:{type:"string",description:"Version the change landed in"},affectedFiles:{type:"array",items:{type:"string"}},action:{type:"string",description:"What must be done in this repository"},automatable:{type:"boolean",description:"Whether the fix is mechanical"}},required:["description","affectedFiles","action","automatable"],additionalProperties:!1}},codemod:{type:"object",properties:{command:{type:"string",description:"Command that applies the official codemod"},source:{type:"string",description:"Where the codemod is documented"}},required:["command","source"],additionalProperties:!1},confidence:{type:"string",enum:["high","medium","low"]},effort:{type:"integer",description:"1 (trivial) to 5 (demanding)"},risks:{type:"array",items:{type:"string"}}},required:["changes","confidence","effort","risks"],additionalProperties:!1},f=[/^(?:bunx|npx|pnpm dlx|yarn dlx)\s+[\w@/.-]+(?:\s+[\w@/.:=-]+)*$/];function y(J){let Y=J.trim();if(/[;&|`$><\n]/.test(Y))return!1;return f.some((Q)=>Q.test(Y))}function R(J){let Y=J.usage.slice(0,100).map((Q)=>`${Q.path}:${Q.line} (${Q.kind}) ${Q.text}`).join(`
2
+ import{tf as k,xf as b}from"./chunk-p96zq2zc.js";import{zf as C}from"./chunk-jpdd59fh.js";import{Qf as x}from"./chunk-p8azbpq6.js";import{ug as v}from"./chunk-gvnsr72j.js";import{Nh as D}from"./chunk-f0z6kyqt.js";var T={type:"object",properties:{changes:{type:"array",items:{type:"object",properties:{description:{type:"string",description:"What upstream changed"},version:{type:"string",description:"Version the change landed in"},affectedFiles:{type:"array",items:{type:"string"}},action:{type:"string",description:"What must be done in this repository"},automatable:{type:"boolean",description:"Whether the fix is mechanical"}},required:["description","affectedFiles","action","automatable"],additionalProperties:!1}},codemod:{type:"object",properties:{command:{type:"string",description:"Command that applies the official codemod"},source:{type:"string",description:"Where the codemod is documented"}},required:["command","source"],additionalProperties:!1},confidence:{type:"string",enum:["high","medium","low"]},effort:{type:"integer",description:"1 (trivial) to 5 (demanding)"},risks:{type:"array",items:{type:"string"}}},required:["changes","confidence","effort","risks"],additionalProperties:!1},f=[/^(?:bunx|npx|pnpm dlx|yarn dlx)\s+[\w@/.-]+(?:\s+[\w@/.:=-]+)*$/];function y(J){let Y=J.trim();if(/[;&|`$><\n]/.test(Y))return!1;return f.some((Q)=>Q.test(Y))}function R(J){let Y=J.usage.slice(0,100).map((Q)=>`${Q.path}:${Q.line} (${Q.kind}) ${Q.text}`).join(`
3
3
  `);return[`Analyse upgrading \`${J.packageName}\` from ${J.fromVersion} to ${J.toVersion}.`,"","Report only breaking changes that affect THIS repository, judged against the","usage sites below. A breaking change in a feature this repository does not use","is not worth reporting, and listing it makes the real ones harder to find.","","Mark a change automatable only when the fix is a mechanical edit you could write","exactly. Anything needing judgement is not automatable.","","If the package publishes an official codemod for this upgrade, report the command.","","Set confidence honestly: high when every change is understood and mechanical,","low when the notes are unclear or the change touches something subtle. A low","confidence plan is more useful than a wrong high confidence one.","","--- Release notes across the version span ---",J.releaseNotes||"(none available)","",`--- Usage in this repository (${J.usage.length} site(s)) ---`,Y||"(no direct usage found)"].join(`
4
4
  `)}function A(J,Y){let Q=J??{},Z=new Set(Y.knownFiles),K=(Array.isArray(Q.changes)?Q.changes:[]).filter(($)=>Boolean($&&typeof $.description==="string"&&typeof $.action==="string")).map(($)=>({description:$.description,...$.version?{version:$.version}:{},affectedFiles:(Array.isArray($.affectedFiles)?$.affectedFiles:[]).filter((j)=>Z.has(j)),action:$.action,automatable:$.automatable===!0})),H=Q.codemod&&y(Q.codemod.command)?Q.codemod:void 0;return{packageName:Y.packageName,fromVersion:Y.fromVersion,toVersion:Y.toVersion,changes:K,...H?{codemod:H}:{},confidence:h(Q.confidence,K),effort:m(Q.effort),risks:(Array.isArray(Q.risks)?Q.risks:[]).filter(($)=>typeof $==="string")}}function E(J,Y="high"){let Q={low:0,medium:1,high:2};return Q[J.confidence]<Q[Y]}function h(J,Y){let Q=J==="high"||J==="medium"||J==="low"?J:"low";if(Q==="high"&&Y.some((Z)=>!Z.automatable))return"medium";return Q}function m(J){let Y=Number(J);if(!Number.isFinite(Y))return 3;return Math.min(5,Math.max(1,Math.round(Y)))}import{resolve as g}from"path";var c=/\.(?:[cm]?[jt]sx?|vue|svelte)$/,u=/(?:^|\/)(?:[\w.-]*\.config\.[cm]?[jt]s|\.?[\w-]*rc(?:\.\w+)?|tsconfig\.json|vite\.config\.[cm]?[jt]s)$/;async function N(J,Y,Q){let Z=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=`${Z}(?:/[^'"\`]*)?`,H=new RegExp(`(?:^|\\s)import\\s[^'"\`]*['"\`]${K}['"\`]|from\\s*['"\`]${K}['"\`]`),$=new RegExp(`require\\s*\\(\\s*['"\`]${K}['"\`]\\s*\\)`),j=new RegExp(`import\\s*\\(\\s*['"\`]${K}['"\`]\\s*\\)`),W=new RegExp(`(?:^|[^\\w@/.-])${Z}(?![\\w/.-])`),q=[];for(let X of Y){let B=c.test(X),_=u.test(X);if(!B&&!_)continue;let U;try{let z=Bun.file(g(Q,X));if(!await z.exists())continue;U=await z.text()}catch{continue}if(!U.includes(J))continue;for(let[z,G]of U.split(`
5
5
  `).entries()){let F=null;if(H.test(G)||j.test(G))F="import";else if($.test(G))F="require";else if(_&&W.test(G))F="config";if(F)q.push({path:X,line:z+1,text:G.trim().slice(0,200),kind:F})}}return q}function V(J){let Y=new Map;for(let Q of J)Y.set(Q.path,(Y.get(Q.path)??0)+1);return[...Y.entries()].map(([Q,Z])=>({path:Q,count:Z})).sort((Q,Z)=>Z.count-Q.count)}var d={high:"\uD83D\uDFE2 high",medium:"\uD83D\uDFE1 medium",low:"\uD83D\uDD34 low"};function L(J,Y,Q=[]){let Z=`## \uD83D\uDD27 Migration report
@@ -89,4 +89,4 @@ ${K.result.report}`);if(Q.length===0&&Y.length===0)return"";let Z=["## Major upg
89
89
  ---
90
90
 
91
91
  ${Y}${Z}`}
92
- export{T as bf,y as cf,R as df,A as ef,E as ff,N as gf,V as hf,L as if,S as jf,BJ as kf,w as lf,M as mf,a as nf,_J as of,GJ as pf};
92
+ export{T as cf,y as df,R as ef,A as ff,E as gf,N as hf,V as if,L as jf,S as kf,BJ as lf,w as mf,M as nf,a as of,_J as pf,GJ as qf};
@@ -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 vh,L as wh,w as xh,N as yh,U as zh};
4
+ export{y as wh,L as xh,w as yh,N as zh,U as Ah};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,q=(a,b,d)=>{var f=a!=null&&typeof a==="object";if(f){var g=b?o??=new WeakMap:p??=new WeakMap,h=g.get(a);if(h)return h}d=a!=null?j(k(a)):{};let c=b||!a||!a.__esModule?i(d,"default",{value:a,enumerable:!0}):d;for(let e of l(a))if(!m.call(c,e))i(c,e,{get:n.bind(a,e),enumerable:!0});if(f)g.set(a,c);return c};var r=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var s=import.meta.require;
3
- export{q as $k,r as al,s as bl};
3
+ export{q as al,r as bl,s as cl};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{kd as a}from"./chunk-3wy8fypy.js";import"./chunk-89s9f3mf.js";import"./chunk-ja3rvd6y.js";import"./chunk-x4ea69ek.js";import"./chunk-03j2dx5h.js";import"./chunk-v6dephze.js";import"./chunk-88j356ng.js";import"./chunk-fvhnza91.js";import"./chunk-ktmgq0ja.js";import"./chunk-6k6dgwmy.js";import"./chunk-ddmvjp0y.js";import"./chunk-f0z6kyqt.js";import"./chunk-njfbmhm4.js";import"./chunk-6sm15trq.js";export{a as PackageScanner};