@buddysh/buddy 0.11.10 → 0.11.12

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 (159) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/bin/cli.js +19 -19
  3. package/dist/{chunk-p9z0hzej.js → chunk-08daxhzx.js} +2 -2
  4. package/dist/{chunk-ja3rvd6y.js → chunk-0f1xye20.js} +1 -1
  5. package/dist/{chunk-be059ncv.js → chunk-0g4ybxwj.js} +2 -2
  6. package/dist/{chunk-2m0134q8.js → chunk-0m1z85m9.js} +1 -1
  7. package/dist/chunk-0m6b7bac.js +2 -0
  8. package/dist/{chunk-6xzzs109.js → chunk-0rbxek2f.js} +2 -2
  9. package/dist/chunk-0sm25gee.js +2 -0
  10. package/dist/chunk-11p0az6f.js +2 -0
  11. package/dist/{chunk-xny4kgcc.js → chunk-142zh7e5.js} +1 -1
  12. package/dist/chunk-16fr8xqp.js +2 -0
  13. package/dist/{chunk-jpdd59fh.js → chunk-1pecmenc.js} +1 -1
  14. package/dist/chunk-1w1h2tsf.js +2 -0
  15. package/dist/{chunk-nwrr6jas.js → chunk-1xe0960b.js} +2 -2
  16. package/dist/chunk-225s199d.js +2 -0
  17. package/dist/{chunk-a34szd4r.js → chunk-24xnjkvz.js} +3 -3
  18. package/dist/{chunk-emygmh7r.js → chunk-24xvskkf.js} +1 -1
  19. package/dist/{chunk-6wxwewbh.js → chunk-2e4e6zjs.js} +1 -1
  20. package/dist/{chunk-7bctsv0x.js → chunk-2hb8dan0.js} +1 -1
  21. package/dist/{chunk-z21tw4fz.js → chunk-2jjrxgs1.js} +2 -2
  22. package/dist/chunk-2z2gh050.js +44 -0
  23. package/dist/{chunk-6k6dgwmy.js → chunk-2z9pkk1y.js} +1 -1
  24. package/dist/{chunk-9m0epv44.js → chunk-33h1me7n.js} +2 -2
  25. package/dist/{chunk-khn11t39.js → chunk-3c114myc.js} +1 -1
  26. package/dist/{chunk-xffrrs85.js → chunk-3n4w3ak9.js} +11 -11
  27. package/dist/{chunk-rg996jqw.js → chunk-40pvn33p.js} +1 -1
  28. package/dist/{chunk-k3x0mabj.js → chunk-42xvqxdw.js} +2 -2
  29. package/dist/{chunk-1m5wprvm.js → chunk-54er1whp.js} +2 -2
  30. package/dist/{chunk-y7z0br2x.js → chunk-59993g25.js} +1 -1
  31. package/dist/{chunk-7crh00m7.js → chunk-5jvde2as.js} +2 -2
  32. package/dist/{chunk-y9senfb6.js → chunk-5pheqk23.js} +1 -1
  33. package/dist/{chunk-drkzf2gz.js → chunk-62j8q7sg.js} +1 -1
  34. package/dist/chunk-64kt1w23.js +2 -0
  35. package/dist/{chunk-4akhxmfk.js → chunk-65by8f14.js} +1 -1
  36. package/dist/chunk-6gdenphk.js +2 -0
  37. package/dist/{chunk-gzjxhd7a.js → chunk-750ae48c.js} +2 -2
  38. package/dist/{chunk-mdbf728w.js → chunk-77qe887p.js} +1 -1
  39. package/dist/{chunk-mg3em5qj.js → chunk-7b4jsg36.js} +2 -2
  40. package/dist/{chunk-hkb714k3.js → chunk-7c1284fb.js} +1 -1
  41. package/dist/chunk-7m1ab6p8.js +2 -0
  42. package/dist/{chunk-bggpgbdx.js → chunk-7m3pzkcj.js} +1 -1
  43. package/dist/chunk-81y75fg7.js +2 -0
  44. package/dist/{chunk-04qvf24t.js → chunk-89jytkd6.js} +1 -1
  45. package/dist/{chunk-bjymeq7e.js → chunk-8swwcx7w.js} +1 -1
  46. package/dist/{chunk-yxb1jwxp.js → chunk-9sdgy9nm.js} +2 -2
  47. package/dist/chunk-a30cyqr0.js +2 -0
  48. package/dist/{chunk-ysgex7h7.js → chunk-a3zgenkh.js} +1 -1
  49. package/dist/chunk-a56s1xrt.js +2 -0
  50. package/dist/{chunk-7ds5q6j3.js → chunk-apdrg3r7.js} +1 -1
  51. package/dist/chunk-axazt516.js +2 -0
  52. package/dist/{chunk-88xaexj1.js → chunk-b3s185kp.js} +1 -1
  53. package/dist/chunk-b59zbkfx.js +2 -0
  54. package/dist/{chunk-a3bnhq58.js → chunk-b9szrnxw.js} +1 -1
  55. package/dist/{chunk-89s9f3mf.js → chunk-bnp0r4eh.js} +1 -1
  56. package/dist/{chunk-se4g70q2.js → chunk-bsh3kp53.js} +1 -1
  57. package/dist/{chunk-k7x9af5r.js → chunk-c6ptrc0v.js} +2 -2
  58. package/dist/{chunk-vckn5ate.js → chunk-cj4d5ad7.js} +1 -1
  59. package/dist/{chunk-6w8vxy7s.js → chunk-cm6devhe.js} +1 -1
  60. package/dist/{chunk-34rmja4x.js → chunk-ctdfppxk.js} +2 -2
  61. package/dist/{chunk-jxd64dzs.js → chunk-cvwkdfvr.js} +1 -1
  62. package/dist/{chunk-amj037yy.js → chunk-d4gk9awk.js} +3 -3
  63. package/dist/{chunk-61gfjcqt.js → chunk-dd895pm0.js} +1 -1
  64. package/dist/{chunk-h8e796qs.js → chunk-ddky3026.js} +1 -1
  65. package/dist/{chunk-rrnvxj90.js → chunk-dsnd6ndd.js} +1 -1
  66. package/dist/{chunk-3waqfh3y.js → chunk-enq0gm64.js} +2 -2
  67. package/dist/{chunk-pmszvhja.js → chunk-esm5jjgf.js} +1 -1
  68. package/dist/chunk-esveeark.js +2 -0
  69. package/dist/chunk-ffbbc38r.js +2 -0
  70. package/dist/{chunk-fpzgxg8a.js → chunk-fmkb816y.js} +1 -1
  71. package/dist/chunk-g4803nvq.js +2 -0
  72. package/dist/{chunk-kh6v93yb.js → chunk-gpjde0j6.js} +2 -2
  73. package/dist/{chunk-4wbbbcs2.js → chunk-gweqk008.js} +2 -2
  74. package/dist/{chunk-kpdz73mc.js → chunk-hc651afv.js} +1 -1
  75. package/dist/{chunk-88j356ng.js → chunk-j46f90n8.js} +1 -1
  76. package/dist/chunk-jhz202wk.js +2 -0
  77. package/dist/{chunk-1szfwcst.js → chunk-jqh7vx2n.js} +1 -1
  78. package/dist/{chunk-qdmr84mc.js → chunk-k3r7v3dp.js} +2 -2
  79. package/dist/{chunk-s3ksf6s5.js → chunk-kbvj6qxc.js} +1 -1
  80. package/dist/{chunk-gvnsr72j.js → chunk-knpdntnh.js} +1 -1
  81. package/dist/chunk-kq0n3x2e.js +2 -0
  82. package/dist/{chunk-ktmgq0ja.js → chunk-ktn47bq8.js} +1 -1
  83. package/dist/chunk-ktzvchps.js +2 -0
  84. package/dist/chunk-m1zv8db4.js +2 -0
  85. package/dist/{chunk-d7jpbw1z.js → chunk-mt53v4sx.js} +1 -1
  86. package/dist/{chunk-90q6r1j7.js → chunk-nbyxgt9c.js} +1 -1
  87. package/dist/chunk-njrezpsw.js +2 -0
  88. package/dist/{chunk-gyf7psxg.js → chunk-nkztawjh.js} +1 -1
  89. package/dist/chunk-pegk4jhq.js +2 -0
  90. package/dist/{chunk-q90s02qc.js → chunk-q7y8dvbz.js} +1 -1
  91. package/dist/{chunk-wjmp2hsj.js → chunk-qdr900z7.js} +1 -1
  92. package/dist/chunk-rphwf28s.js +2 -0
  93. package/dist/chunk-rr8apsh5.js +2 -0
  94. package/dist/{chunk-db9rffcf.js → chunk-rxf8h1e5.js} +1 -1
  95. package/dist/{chunk-jj1gjkb7.js → chunk-ry5zh9cx.js} +1 -1
  96. package/dist/{chunk-785rgtn5.js → chunk-rygtb1x3.js} +5 -5
  97. package/dist/chunk-s1cgwkkr.js +3 -0
  98. package/dist/{chunk-7rjrea9g.js → chunk-sxfk3naz.js} +2 -2
  99. package/dist/chunk-tjvvb919.js +2 -0
  100. package/dist/chunk-tzmj8w3x.js +2 -0
  101. package/dist/{chunk-tx9m7y1z.js → chunk-v0y8eens.js} +2 -2
  102. package/dist/chunk-v9fnbdgr.js +2 -0
  103. package/dist/{chunk-ggzjv4s0.js → chunk-va3k91tf.js} +1 -1
  104. package/dist/{chunk-hdqmcp3n.js → chunk-vmt1bed1.js} +1 -1
  105. package/dist/chunk-vpsvtb9v.js +2 -0
  106. package/dist/{chunk-pxdrwhxx.js → chunk-vpw7adwd.js} +1 -1
  107. package/dist/{chunk-8tsw3cjk.js → chunk-vs68hsbp.js} +1 -1
  108. package/dist/{chunk-2145m12g.js → chunk-vtr2vbk0.js} +1 -1
  109. package/dist/{chunk-4hd1mryc.js → chunk-w55x2g9n.js} +2 -2
  110. package/dist/{chunk-hyp0wfta.js → chunk-wjfw6rx8.js} +2 -2
  111. package/dist/chunk-wt83nzn3.js +2 -0
  112. package/dist/{chunk-8dj94fsy.js → chunk-x1w6q9tk.js} +1 -1
  113. package/dist/{chunk-s3q7g2hy.js → chunk-xqveh8a5.js} +1 -1
  114. package/dist/chunk-xxwevpnr.js +2 -0
  115. package/dist/{chunk-wd8w0vjs.js → chunk-y3w8h4sy.js} +1 -1
  116. package/dist/{chunk-4c3dws2k.js → chunk-ycbk7tg9.js} +1 -1
  117. package/dist/chunk-yf01hyxn.js +2 -0
  118. package/dist/{chunk-srz5kgyg.js → chunk-yqfwvk9z.js} +1 -1
  119. package/dist/{chunk-0apd8zqn.js → chunk-z05djfac.js} +7 -7
  120. package/dist/{chunk-kpqez1ht.js → chunk-z18bksyr.js} +1 -1
  121. package/dist/{chunk-1tg7dfq5.js → chunk-zk8zdv23.js} +1 -1
  122. package/dist/src/index.js +1 -1
  123. package/dist/src/setup.js +1 -1
  124. package/dist/src/utils/lock-file.d.ts +19 -0
  125. package/package.json +1 -1
  126. package/dist/chunk-00vbhh0z.js +0 -2
  127. package/dist/chunk-0y706m2d.js +0 -2
  128. package/dist/chunk-1aee33aa.js +0 -2
  129. package/dist/chunk-1vhqtq6m.js +0 -2
  130. package/dist/chunk-2fx0tbc0.js +0 -2
  131. package/dist/chunk-3ggd7z2f.js +0 -2
  132. package/dist/chunk-3xbx315d.js +0 -2
  133. package/dist/chunk-4k9f9vn2.js +0 -2
  134. package/dist/chunk-4zvjzesh.js +0 -2
  135. package/dist/chunk-5dw0q5ng.js +0 -2
  136. package/dist/chunk-5qtdc2mb.js +0 -2
  137. package/dist/chunk-6gttmvww.js +0 -2
  138. package/dist/chunk-7f6mpphq.js +0 -2
  139. package/dist/chunk-7mmdxbcm.js +0 -2
  140. package/dist/chunk-7ze1qrmt.js +0 -2
  141. package/dist/chunk-9634xcvq.js +0 -2
  142. package/dist/chunk-97csq21c.js +0 -2
  143. package/dist/chunk-ea6rtyvy.js +0 -2
  144. package/dist/chunk-gs5b2ssa.js +0 -2
  145. package/dist/chunk-gw69sjx2.js +0 -2
  146. package/dist/chunk-j0fcqty9.js +0 -2
  147. package/dist/chunk-kszbmpw1.js +0 -2
  148. package/dist/chunk-mzb7cg8a.js +0 -2
  149. package/dist/chunk-pjq0qxst.js +0 -2
  150. package/dist/chunk-pksrcdh6.js +0 -2
  151. package/dist/chunk-tf9nqr0p.js +0 -2
  152. package/dist/chunk-tq1w2wwa.js +0 -2
  153. package/dist/chunk-w93akf6h.js +0 -2
  154. package/dist/chunk-wreexgkb.js +0 -44
  155. package/dist/chunk-x5jfh372.js +0 -2
  156. package/dist/chunk-ydt2sn0j.js +0 -2
  157. package/dist/chunk-z0qbkvyz.js +0 -2
  158. package/dist/chunk-zefqbamj.js +0 -2
  159. package/dist/chunk-zrg5ss0x.js +0 -3
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{ld as h}from"./chunk-89s9f3mf.js";import{nd as B}from"./chunk-ja3rvd6y.js";import{jg as E}from"./chunk-wreexgkb.js";import{Ah as f,wh as y,zh as w}from"./chunk-6k6dgwmy.js";import{Ih as A,Jh as V}from"./chunk-a3bnhq58.js";import{dl as v}from"./chunk-s3ksf6s5.js";import{spawn as N}from"child_process";import q from"fs";import F from"path";import T from"process";var P=8;async function M(X,Z,$=8){if(X.length===0)return[];let K=Math.max(1,Math.min($,X.length)),Y=Array.from({length:X.length}),H=0;async function Q(){while(!0){let z=H++;if(z>=X.length)return;Y[z]=await Z(X[z],z)}}return await Promise.all(Array.from({length:K},Q)),Y}function m(X,Z){let $=Math.max(1,Z),K=[];for(let Y=0;Y<X.length;Y+=$)K.push(X.slice(Y,Y+$));return K}class J{entries=new Map;async get(X,Z){let $=this.entries.get(X);if($)return $;let K=Z().catch((Y)=>{throw this.entries.delete(X),Y});return this.entries.set(X,K),K}clear(){this.entries.clear()}get size(){return this.entries.size}}var d=/^[\w.@/*+-]+$/;function C(X,Z){if(!d.test(X))throw new B(`Refusing to pass untrusted ${Z} to bun: ${JSON.stringify(X)}`)}function g(X){let Z={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"},$=X?.repository?.token||T.env.BUDDY_TOKEN||T.env.GITHUB_TOKEN||T.env.GH_TOKEN;if($)Z.Authorization=`Bearer ${$}`;return Z}function R(X){if(typeof X==="string")return X.trim();if(X&&typeof X==="object"&&"version"in X){let Z=X.version;if(typeof Z==="string")return Z.trim()}return""}class k{projectPath;logger;config;concurrency;packumentCache=new J;composerCache=new J;constructor(X,Z,$=void 0,K=P){this.projectPath=X;this.logger=Z;this.config=$;this.concurrency=K}clearCache(){this.packumentCache.clear(),this.composerCache.clear()}async fetchPackument(X){return this.packumentCache.get(X,async()=>{let $=`${w(X,this.config,this.projectPath)}/${encodeURIComponent(X).replace("%40","@")}`;try{let K=await A($,{headers:{"User-Agent":"buddy"},onRetry:({delayMs:Y,reason:H})=>this.logger.debug(`Retrying ${X} in ${Math.round(Y/1000)}s (${H})`)});if(!K.ok)return(K.status===404?this.logger.debug:this.logger.warn).call(this.logger,`No registry data for ${X}: HTTP ${K.status}`),null;return await K.json()}catch(K){return this.logger.warn(`Failed to fetch registry data for ${X}:`,K),null}})}async fetchComposerPackage(X){return this.composerCache.get(X,async()=>{let Z=f(this.config);try{let $=await A(`${Z}/packages/${X}.json`,{headers:{"User-Agent":"buddy"}});if(!$.ok)return null;return await $.json()}catch($){return this.logger.warn(`Failed to get Composer metadata for ${X}:`,$),null}})}shouldRespectVersion(X){if(!(this.config?.packages?.respectLatest??!0))return!1;let $=["latest","*","main","master","develop","dev"],K=X.toLowerCase().trim();return $.includes(K)}async getOutdatedPackages(X){this.logger.info("Checking for outdated packages...");try{let Z=await this.runBunOutdated(X),$=await this.getWorkspaceOutdatedPackages(),K=await this.getPackageJsonOutdated(X),Y=new Map;for(let G of Z)Y.set(G.name,G);for(let G of $)if(!Y.has(G.name))Y.set(G.name,G);for(let G of K)if(!Y.get(G.name))Y.set(G.name,G);let H=[...Y.values()].filter((G)=>{if(this.shouldRespectVersion(G.current))return this.logger.debug(`Skipping ${G.name} - version "${G.current}" should be respected`),!1;return!0}),Q=await M(H,async(G)=>{let[_,I]=await Promise.all([this.getPackageMetadata(G.name),this.findPackageLocation(G.name)]);return{name:G.name,currentVersion:G.current,newVersion:G.latest,updateType:E(G.current,G.latest),dependencyType:"dependencies",file:I||"package.json",metadata:_,releaseNotesUrl:this.getReleaseNotesUrl(G.name,_),changelogUrl:this.getChangelogUrl(G.name,_),homepage:_?.homepage}},this.concurrency),z=F.join(this.projectPath,"composer.json");if(q.existsSync(z))try{let G=await this.getComposerOutdatedPackages();Q.push(...G)}catch(G){this.logger.warn("Failed to check Composer packages:",G)}return this.logger.success(`Found ${Q.length} package updates`),Q}catch(Z){throw this.logger.error("Failed to check for outdated packages:",Z),new B(`Failed to check for outdated packages: ${Z instanceof Error?Z.message:"Unknown error"}`)}}async getUpdatesForPackages(X){let Z=X.join(" ");return this.getOutdatedPackages(Z)}async getUpdatesWithPattern(X){return this.getOutdatedPackages(X)}async getPackageMetadata(X){try{C(X,"package name");let Z=await this.fetchPackument(X);if(!Z)return;let $=Object.keys(Z.versions??{}),K=Z["dist-tags"]?.latest??$[$.length-1]??"",Y=Z.versions?.[K]??{},H=Y.repository??Z.repository,Q=Y.license??Z.license,z=Y.author??Z.author;return{name:Y.name??Z.name??X,description:Y.description??Z.description,repository:typeof H==="string"?H:H?.url,homepage:Y.homepage??Z.homepage,license:typeof Q==="string"?Q:Q?.type,author:typeof z==="string"?z:z?.name,keywords:Y.keywords??Z.keywords,latestVersion:K,versions:$,weeklyDownloads:void 0,dependencies:Y.dependencies,devDependencies:Y.devDependencies,peerDependencies:Y.peerDependencies}}catch(Z){this.logger.warn(`Failed to get metadata for ${X}:`,Z);return}}async packageExists(X){try{return C(X,"package name"),await this.fetchPackument(X)!==null}catch{return!1}}async getLatestVersion(X){try{return await this.getLatestVersionFromNpm(X)}catch{return null}}async getLatestVersionFromNpm(X){let Z=await this.fetchPackument(X);if(!Z)return null;let $=Object.keys(Z.versions??{});if($.length===0)return null;let K=this.config?.packages?.includePrerelease??!1,Y=Z["dist-tags"]?.latest;if(Y&&(K||!this.isPrerelease(Y)))return Y;let H=K?$:$.filter((z)=>!this.isPrerelease(z));if(H.length===0)return null;return[...H].sort((z,G)=>{try{return Bun.semver.order(G,z)}catch{return 0}})[0]||null}isPrerelease(X){return/-(?:alpha|beta|rc|dev|canary|next|experimental|snapshot|nightly)/i.test(X)}async runBunOutdated(X){let Z=[];if(X)for(let $ of X.split(/\s+/).filter(Boolean))C($,"package filter"),Z.push($);try{let $=await this.runCommand("bun",["outdated","--json",...Z]),K=this.parseBunOutdatedJson($);if(K)return K;this.logger.debug("bun outdated --json produced unrecognized output, falling back to table parsing")}catch($){this.logger.debug("bun outdated --json unavailable, falling back to table parsing:",$)}try{let $=await this.runCommand("bun",["outdated",...Z]);return this.parseBunOutdatedOutput($)}catch($){this.logger.error("Failed to run bun outdated:",$);let K=$ instanceof Error?$.message:String($);throw new B(`bun outdated command failed: ${K}`)}}parseBunOutdatedJson(X){let Z=X.trim();if(!Z||!Z.startsWith("[")&&!Z.startsWith("{"))return null;let $;try{$=JSON.parse(Z)}catch{return null}let K=Array.isArray($)?$:Object.entries($).map(([H,Q])=>({name:H,...Q&&typeof Q==="object"?Q:{}})),Y=[];for(let H of K){let Q=typeof H.name==="string"?H.name:void 0,z=R(H.current),G=R(H.latest);if(!Q||!z||!G)continue;let _={name:Q,current:z,update:R(H.update)||G,latest:G},I=typeof H.workspace==="string"?H.workspace:void 0;if(I)_.workspace=I;Y.push(_)}return Y}parseBunOutdatedOutput(X){let Z=[],$=`${String.fromCharCode(27)}[`,Y=X.replace(new RegExp(`${$}[0-9;]*m`,"g"),"").split(`
2
+ import{md as h}from"./chunk-bnp0r4eh.js";import{od as B}from"./chunk-0f1xye20.js";import{kg as E}from"./chunk-2z2gh050.js";import{Ah as w,Bh as f,xh as y}from"./chunk-2z9pkk1y.js";import{Jh as A,Kh as V}from"./chunk-b9szrnxw.js";import{el as v}from"./chunk-kbvj6qxc.js";import{spawn as N}from"child_process";import q from"fs";import F from"path";import T from"process";var P=8;async function M(X,Z,$=8){if(X.length===0)return[];let K=Math.max(1,Math.min($,X.length)),Y=Array.from({length:X.length}),H=0;async function Q(){while(!0){let z=H++;if(z>=X.length)return;Y[z]=await Z(X[z],z)}}return await Promise.all(Array.from({length:K},Q)),Y}function m(X,Z){let $=Math.max(1,Z),K=[];for(let Y=0;Y<X.length;Y+=$)K.push(X.slice(Y,Y+$));return K}class J{entries=new Map;async get(X,Z){let $=this.entries.get(X);if($)return $;let K=Z().catch((Y)=>{throw this.entries.delete(X),Y});return this.entries.set(X,K),K}clear(){this.entries.clear()}get size(){return this.entries.size}}var d=/^[\w.@/*+-]+$/;function C(X,Z){if(!d.test(X))throw new B(`Refusing to pass untrusted ${Z} to bun: ${JSON.stringify(X)}`)}function g(X){let Z={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"},$=X?.repository?.token||T.env.BUDDY_TOKEN||T.env.GITHUB_TOKEN||T.env.GH_TOKEN;if($)Z.Authorization=`Bearer ${$}`;return Z}function R(X){if(typeof X==="string")return X.trim();if(X&&typeof X==="object"&&"version"in X){let Z=X.version;if(typeof Z==="string")return Z.trim()}return""}class k{projectPath;logger;config;concurrency;packumentCache=new J;composerCache=new J;constructor(X,Z,$=void 0,K=P){this.projectPath=X;this.logger=Z;this.config=$;this.concurrency=K}clearCache(){this.packumentCache.clear(),this.composerCache.clear()}async fetchPackument(X){return this.packumentCache.get(X,async()=>{let $=`${w(X,this.config,this.projectPath)}/${encodeURIComponent(X).replace("%40","@")}`;try{let K=await A($,{headers:{"User-Agent":"buddy"},onRetry:({delayMs:Y,reason:H})=>this.logger.debug(`Retrying ${X} in ${Math.round(Y/1000)}s (${H})`)});if(!K.ok)return(K.status===404?this.logger.debug:this.logger.warn).call(this.logger,`No registry data for ${X}: HTTP ${K.status}`),null;return await K.json()}catch(K){return this.logger.warn(`Failed to fetch registry data for ${X}:`,K),null}})}async fetchComposerPackage(X){return this.composerCache.get(X,async()=>{let Z=f(this.config);try{let $=await A(`${Z}/packages/${X}.json`,{headers:{"User-Agent":"buddy"}});if(!$.ok)return null;return await $.json()}catch($){return this.logger.warn(`Failed to get Composer metadata for ${X}:`,$),null}})}shouldRespectVersion(X){if(!(this.config?.packages?.respectLatest??!0))return!1;let $=["latest","*","main","master","develop","dev"],K=X.toLowerCase().trim();return $.includes(K)}async getOutdatedPackages(X){this.logger.info("Checking for outdated packages...");try{let Z=await this.runBunOutdated(X),$=await this.getWorkspaceOutdatedPackages(),K=await this.getPackageJsonOutdated(X),Y=new Map;for(let G of Z)Y.set(G.name,G);for(let G of $)if(!Y.has(G.name))Y.set(G.name,G);for(let G of K)if(!Y.get(G.name))Y.set(G.name,G);let H=[...Y.values()].filter((G)=>{if(this.shouldRespectVersion(G.current))return this.logger.debug(`Skipping ${G.name} - version "${G.current}" should be respected`),!1;return!0}),Q=await M(H,async(G)=>{let[_,I]=await Promise.all([this.getPackageMetadata(G.name),this.findPackageLocation(G.name)]);return{name:G.name,currentVersion:G.current,newVersion:G.latest,updateType:E(G.current,G.latest),dependencyType:"dependencies",file:I||"package.json",metadata:_,releaseNotesUrl:this.getReleaseNotesUrl(G.name,_),changelogUrl:this.getChangelogUrl(G.name,_),homepage:_?.homepage}},this.concurrency),z=F.join(this.projectPath,"composer.json");if(q.existsSync(z))try{let G=await this.getComposerOutdatedPackages();Q.push(...G)}catch(G){this.logger.warn("Failed to check Composer packages:",G)}return this.logger.success(`Found ${Q.length} package updates`),Q}catch(Z){throw this.logger.error("Failed to check for outdated packages:",Z),new B(`Failed to check for outdated packages: ${Z instanceof Error?Z.message:"Unknown error"}`)}}async getUpdatesForPackages(X){let Z=X.join(" ");return this.getOutdatedPackages(Z)}async getUpdatesWithPattern(X){return this.getOutdatedPackages(X)}async getPackageMetadata(X){try{C(X,"package name");let Z=await this.fetchPackument(X);if(!Z)return;let $=Object.keys(Z.versions??{}),K=Z["dist-tags"]?.latest??$[$.length-1]??"",Y=Z.versions?.[K]??{},H=Y.repository??Z.repository,Q=Y.license??Z.license,z=Y.author??Z.author;return{name:Y.name??Z.name??X,description:Y.description??Z.description,repository:typeof H==="string"?H:H?.url,homepage:Y.homepage??Z.homepage,license:typeof Q==="string"?Q:Q?.type,author:typeof z==="string"?z:z?.name,keywords:Y.keywords??Z.keywords,latestVersion:K,versions:$,weeklyDownloads:void 0,dependencies:Y.dependencies,devDependencies:Y.devDependencies,peerDependencies:Y.peerDependencies}}catch(Z){this.logger.warn(`Failed to get metadata for ${X}:`,Z);return}}async packageExists(X){try{return C(X,"package name"),await this.fetchPackument(X)!==null}catch{return!1}}async getLatestVersion(X){try{return await this.getLatestVersionFromNpm(X)}catch{return null}}async getLatestVersionFromNpm(X){let Z=await this.fetchPackument(X);if(!Z)return null;let $=Object.keys(Z.versions??{});if($.length===0)return null;let K=this.config?.packages?.includePrerelease??!1,Y=Z["dist-tags"]?.latest;if(Y&&(K||!this.isPrerelease(Y)))return Y;let H=K?$:$.filter((z)=>!this.isPrerelease(z));if(H.length===0)return null;return[...H].sort((z,G)=>{try{return Bun.semver.order(G,z)}catch{return 0}})[0]||null}isPrerelease(X){return/-(?:alpha|beta|rc|dev|canary|next|experimental|snapshot|nightly)/i.test(X)}async runBunOutdated(X){let Z=[];if(X)for(let $ of X.split(/\s+/).filter(Boolean))C($,"package filter"),Z.push($);try{let $=await this.runCommand("bun",["outdated","--json",...Z]),K=this.parseBunOutdatedJson($);if(K)return K;this.logger.debug("bun outdated --json produced unrecognized output, falling back to table parsing")}catch($){this.logger.debug("bun outdated --json unavailable, falling back to table parsing:",$)}try{let $=await this.runCommand("bun",["outdated",...Z]);return this.parseBunOutdatedOutput($)}catch($){this.logger.error("Failed to run bun outdated:",$);let K=$ instanceof Error?$.message:String($);throw new B(`bun outdated command failed: ${K}`)}}parseBunOutdatedJson(X){let Z=X.trim();if(!Z||!Z.startsWith("[")&&!Z.startsWith("{"))return null;let $;try{$=JSON.parse(Z)}catch{return null}let K=Array.isArray($)?$:Object.entries($).map(([H,Q])=>({name:H,...Q&&typeof Q==="object"?Q:{}})),Y=[];for(let H of K){let Q=typeof H.name==="string"?H.name:void 0,z=R(H.current),G=R(H.latest);if(!Q||!z||!G)continue;let _={name:Q,current:z,update:R(H.update)||G,latest:G},I=typeof H.workspace==="string"?H.workspace:void 0;if(I)_.workspace=I;Y.push(_)}return Y}parseBunOutdatedOutput(X){let Z=[],$=`${String.fromCharCode(27)}[`,Y=X.replace(new RegExp(`${$}[0-9;]*m`,"g"),"").split(`
3
3
  `).filter((Q)=>Q.trim()),H=!1;for(let Q of Y){if(Q.includes("Package")&&Q.includes("Current")&&Q.includes("Update")){H=!0;continue}if(!H||!Q.trim())continue;if(Q.match(/^[\u2502\u251C\u2500\u253C\u2524\u2514\u2534\u2518\u250C\u252C\u2510|\-\s]+$/))continue;let z;if(Q.includes("\u2502"))z=Q.split("\u2502").map((G)=>G.trim());else z=Q.split("|").map((G)=>G.trim());if(z.length>=4){let G=z[1]?.trim()||"",_=z[2]?.trim()||"",I=z[3]?.trim()||"",W=z[4]?.trim()||"",L=z.length>=6?z[5]?.trim():void 0;if(G=G.replace(/\s*\(dev\)$/,"").replace(/\s*\(peer\)$/,"").replace(/\s*\(optional\)$/,""),G&&_&&W&&G!=="Package"){let O={name:G,current:_,update:I,latest:W};if(L&&L!=="Workspace")O.workspace=L;Z.push(O)}}}return Z}async getPackageJsonOutdated(X){try{let Z=F.join(this.projectPath,"package.json");if(!q.existsSync(Z))return[];let $;try{let I=q.readFileSync(Z,"utf-8"),W=JSON.parse(I);if(W===null||typeof W!=="object"||Array.isArray(W))throw new B(`package.json at ${Z} is not a JSON object`);$=W}catch(I){if(I instanceof B)throw I;let W=I instanceof Error?I.message:String(I);throw new B(`Failed to parse ${Z}: ${W}`)}let K=(I)=>{let W=$[I];return W&&typeof W==="object"&&!Array.isArray(W)?W:{}},Y={...K("dependencies"),...K("devDependencies"),...K("peerDependencies")},H=Object.keys(Y),Q=this.config?.packages?.ignore||[],z=this.config?.packages?.excludeMajor??!1,G=(X?H.filter((I)=>X.split(" ").some((W)=>I.includes(W))):H).flatMap((I)=>{if(!Y[I]||Q.includes(I))return[];let W=this.cleanVersionRange(Y[I]);return W?[{packageName:I,cleanVersion:W}]:[]});return(await M(G,async({packageName:I,cleanVersion:W})=>{let L=await this.getLatestVersion(I);if(!L)return null;if(Bun.semver.order(W,L)>=0)return null;if(z&&E(W,L)==="major")return null;return{name:I,current:W,update:L,latest:L}},this.concurrency)).filter((I)=>I!==null)}catch(Z){return this.logger.warn("Failed to check package.json versions:",Z),[]}}cleanVersionRange(X){if(X.startsWith("workspace:"))return null;return X.replace(/^[\^~>=<]/,"").trim()}async runCommand(X,Z){return new Promise(($,K)=>{let Y=N(X,Z,{cwd:this.projectPath,stdio:"pipe"}),H="",Q="";Y.stdout?.on("data",(z)=>{H+=z.toString()}),Y.stderr?.on("data",(z)=>{Q+=z.toString()}),Y.on("close",(z)=>{if(z===0)$(H);else K(Error(`Command failed with code ${z}: ${Q}`))}),Y.on("error",(z)=>{K(z)})})}getReleaseNotesUrl(X,Z){if(!Z?.repository)return;let $=Z.repository.match(/github\.com[/:]([^/]+\/[^/]+)/);if($)return`https://github.com/${$[1].replace(".git","")}/releases`;return}getChangelogUrl(X,Z){if(!Z?.repository)return;let $=Z.repository.match(/github\.com[/:]([^/]+\/[^/]+)/);if($)return`https://github.com/${$[1].replace(".git","")}/blob/main/CHANGELOG.md`;return}async getUpdatesForWorkspace(X){try{C(X,"workspace name");let Z=["outdated","--filter",X],$=await this.runCommand("bun",Z),K=this.parseBunOutdatedOutput($),Y=[];for(let H of K){let Q=E(H.current,H.latest),z=await this.getPackageMetadata(H.name);Y.push({name:H.name,currentVersion:H.current,newVersion:H.latest,updateType:Q,dependencyType:"dependencies",file:`${X}/package.json`,metadata:z,releaseNotesUrl:this.getReleaseNotesUrl(H.name,z),changelogUrl:this.getChangelogUrl(H.name,z),homepage:z?.homepage})}return Y}catch(Z){return this.logger.warn(`Failed to get updates for workspace ${X}:`,Z),[]}}async searchPackages(X,Z=10){try{let $=encodeURIComponent(X),Y=`${w(void 0,this.config,this.projectPath)}/-/v1/search?text=${$}&size=${Z}`,H=await A(Y,{headers:{"User-Agent":"buddy"}});if(!H.ok)throw Error(`HTTP ${H.status}: ${H.statusText}`);return(await H.json()).objects?.map((z)=>({name:z.package.name,version:z.package.version,description:z.package.description,keywords:z.package.keywords}))??[]}catch($){return this.logger.warn("Failed to search packages via registry API:",$),[]}}async getComposerOutdatedPackages(){this.logger.info("Checking for outdated Composer packages...");let X=[];try{this.logger.info("\uD83D\uDD0D Checking Composer availability...");try{let Q=await this.runCommand("composer",["--version"]);this.logger.info("\u2705 Composer version:",Q.split(`
4
4
  `)[0])}catch(Q){return this.logger.info("\u274C Composer not available:",Q),this.logger.warn("Composer not found, skipping Composer package updates"),[]}let Z=F.join(this.projectPath,"composer.json");if(this.logger.info(`\uD83D\uDD0D Reading composer.json from: ${Z}`),!q.existsSync(Z))return this.logger.info("\u274C composer.json not found"),[];let $=q.readFileSync(Z,"utf8"),K=JSON.parse($);this.logger.info("\uD83D\uDCE6 composer.json require packages:",Object.keys(K.require||{})),this.logger.info("\uD83D\uDCE6 composer.json require-dev packages:",Object.keys(K["require-dev"]||{})),this.logger.info("\uD83D\uDD0D Running composer outdated (including dev dependencies)...");let Y=await this.runCommand("composer",["outdated","--format=json"]);this.logger.info("\uD83D\uDCCA Raw composer outdated output length:",Y.length);let H;try{H=JSON.parse(Y),this.logger.info(`\uD83D\uDCCB Composer outdated found ${H.installed?.length||0} packages`)}catch(Q){return this.logger.info("\u274C Failed to parse composer outdated JSON:",Q),this.logger.info("Raw output:",Y.substring(0,500)),[]}if(H.installed){this.logger.info("\uD83D\uDD04 Processing outdated packages...");for(let Q of H.installed)if(this.logger.info(`
5
- \uD83D\uDCE6 Processing package: ${Q.name}`),this.logger.info(` Current version: ${Q.version}`),this.logger.info(` Latest version: ${Q.latest}`),Q.name&&Q.version&&Q.latest){let z=K.require?.[Q.name],G=K["require-dev"]?.[Q.name],_=z||G;if(this.logger.info(` Constraint: ${_||"NOT FOUND"}`),!_){this.logger.info(` \u26A0\uFE0F Skipping ${Q.name} - not found in composer.json`);continue}if((this.config?.packages?.ignore||[]).includes(Q.name)){this.logger.info(` \u26A0\uFE0F Skipping ${Q.name} - in ignore list`);continue}let W="require";if(K["require-dev"]&&K["require-dev"][Q.name])W="require-dev";this.logger.info(` Dependency type: ${W}`);let L=await this.getComposerPackageMetadata(Q.name),O=this.extractConstraintBaseVersion(_);if(this.logger.info(` Constraint base version: ${O}`),!O){this.logger.warn(`\u274C Could not extract base version from constraint "${_}" for ${Q.name}`);continue}let S=O,b=Q.latest;this.logger.info(` Using current version: ${S} (from constraint)`),this.logger.info(` Target latest version: ${b}`);let j=[];try{this.logger.info(` \uD83D\uDD0D Getting available versions for ${Q.name}...`);let x=await this.runCommand("composer",["show",Q.name,"--available","--format=json"]),U=JSON.parse(x);if(U.versions)j=U.versions,this.logger.info(` \uD83D\uDCCB Found ${j.length} available versions`)}catch(x){this.logger.warn(`\u274C Failed to get available versions for ${Q.name}, using latest only:`,x),j=[b]}this.logger.info(" \uD83C\uDFAF Finding best constraint updates...");let D=await this.findBestConstraintUpdates(_,j,S);this.logger.info(` \uD83D\uDCCA Found ${D.length} update candidates`);for(let x of D){let U=E(S,x.version);if(this.logger.info(` \uD83D\uDCC8 Update candidate: ${S} \u2192 ${x.version} (${U})`),(this.config?.packages?.excludeMajor??!1)&&U==="major"){this.logger.info(` \u26A0\uFE0F Skipping major update for ${Q.name} - excludeMajor is true`);continue}this.logger.info(` \u2705 Adding update: ${Q.name} ${S} \u2192 ${x.version}`),X.push({name:Q.name,currentVersion:S,newVersion:x.version,updateType:U,dependencyType:W,file:"composer.json",metadata:L,releaseNotesUrl:this.getComposerReleaseNotesUrl(Q.name,L),changelogUrl:this.getComposerChangelogUrl(Q.name,L),homepage:L?.homepage})}}}return this.logger.info(`\u2705 Final result: Found ${X.length} Composer package updates`),this.logger.success(`Found ${X.length} Composer package updates`),X}catch(Z){return this.logger.warn("Failed to check for outdated Composer packages:",Z),[]}}parseVersion(X){let $=X.replace(/^v/,"").split("-")[0].split("+")[0].split(".").map((K)=>Number.parseInt(K,10));if($.length<2||$.some((K)=>Number.isNaN(K)))return null;return{major:$[0]||0,minor:$[1]||0,patch:$[2]||0}}compareVersions(X,Z){let $=this.parseVersion(X),K=this.parseVersion(Z);if(!$||!K)return 0;if($.major!==K.major)return $.major-K.major;if($.minor!==K.minor)return $.minor-K.minor;return $.patch-K.patch}async getComposerPackageMetadata(X){try{let $=(await this.fetchComposerPackage(X))?.package;if(!$?.versions)return;let K=Object.keys($.versions),Y=K.find((Q)=>!Q.includes("dev")&&!Q.includes("alpha")&&!Q.includes("beta"))??K[0],H=(Y?$.versions[Y]:void 0)??{};return{name:$.name??X,description:H.description,repository:H.source?.url??H.homepage,homepage:H.homepage,license:Array.isArray(H.license)?H.license.join(", "):H.license,author:H.authors?.[0]?.name,keywords:H.keywords,latestVersion:Y,versions:K,weeklyDownloads:$.downloads?.monthly,dependencies:H.require,devDependencies:H["require-dev"]}}catch(Z){this.logger.warn(`Failed to get Composer metadata for ${X}:`,Z);return}}async composerPackageExists(X){try{return await this.fetchComposerPackage(X)!==null}catch{return!1}}async getComposerLatestVersion(X){try{let $=(await this.fetchComposerPackage(X))?.package;if(!$?.versions)return null;let K=Object.keys($.versions),Y=K.filter((Q)=>!Q.includes("dev")&&!Q.includes("alpha")&&!Q.includes("beta")&&!Q.includes("rc"));if(Y.length===0)return K[0]||null;let H=Y.sort((Q,z)=>{try{if(typeof Bun<"u"&&Bun.semver)return Bun.semver.order(Q,z);return Q.localeCompare(z,void 0,{numeric:!0})}catch{return Q.localeCompare(z)}});return H[H.length-1]||null}catch(Z){return this.logger.warn(`Failed to get latest Composer version for ${X}:`,Z),null}}getComposerReleaseNotesUrl(X,Z){if(!Z?.repository)return;let $=Z.repository.match(/github\.com[/:]([^/]+\/[^/]+)/);if($)return`https://github.com/${$[1].replace(".git","")}/releases`;return}getComposerChangelogUrl(X,Z){if(!Z?.repository)return;let $=Z.repository.match(/github\.com[/:]([^/]+\/[^/]+)/);if($)return`https://github.com/${$[1].replace(".git","")}/blob/main/CHANGELOG.md`;return}extractConstraintBaseVersion(X){let Z=X.match(/^[\^~>=<]*([\d.]+)/);if(Z)return Z[1];return null}async findBestConstraintUpdates(X,Z,$){let{getUpdateType:K}=await import("./chunk-1vhqtq6m.js"),Y=[],H=this.parseVersion($);if(!H)return[];let Q=null,z=null,G=null;for(let _ of Z){if(_.includes("dev")||_.includes("alpha")||_.includes("beta")||_.includes("RC"))continue;let I=this.parseVersion(_);if(!I)continue;if(this.compareVersions(_,$)<=0)continue;let L=K($,_);if(L==="patch"&&I.major===H.major&&I.minor===H.minor){if(!Q||this.compareVersions(_,Q)>0)Q=_}else if(L==="minor"&&I.major===H.major){if(!z||this.compareVersions(_,z)>0)z=_}else if(L==="major"){if(!G||this.compareVersions(_,G)>0)G=_}}if(Q)Y.push({version:Q,type:"patch"});if(z)Y.push({version:z,type:"minor"});if(G)Y.push({version:G,type:"major"});return Y}async getWorkspaceOutdatedPackages(){try{let X=await this.getWorkspaceNames(),Z=await this.findPackageJsonFiles(),$=[];this.logger.info(`Found ${X.length} workspace packages to check`);for(let K of X)try{let Y=await this.runBunOutdatedForWorkspace(K);$.push(...Y)}catch(Y){this.logger.warn(`Failed to check workspace ${K}:`,Y)}this.logger.info(`Checking ${Z.length} package.json files directly`);for(let K of Z){if(K==="package.json")continue;try{let Y=F.join(this.projectPath,K),H=q.readFileSync(Y,"utf-8"),Q=JSON.parse(H),z={...Q.dependencies,...Q.devDependencies,...Q.peerDependencies,...Q.optionalDependencies};for(let[G,_]of Object.entries(z)){if(typeof _!=="string"||_.startsWith("workspace:"))continue;if($.some((I)=>I.name===G))continue;try{let I=await this.getLatestVersion(G);if(I){let W=this.cleanVersionRange(_);if(W&&Bun.semver.order(W,I)<0)$.push({name:G,current:W,update:I,latest:I,file:K})}}catch{continue}}}catch(Y){this.logger.warn(`Failed to check packages in ${K}:`,Y)}}return this.logger.info(`Found ${$.length} outdated packages across workspaces`),$}catch(X){return this.logger.warn("Failed to check workspace packages:",X),[]}}async getWorkspaceNames(){let X=[],Z=await this.findPackageJsonFiles();for(let $ of Z)try{let K=F.join(this.projectPath,$),Y=q.readFileSync(K,"utf-8"),H=JSON.parse(Y);if(H.name&&$!=="package.json")X.push(H.name)}catch(K){this.logger.warn(`Failed to parse package.json ${$}:`,K)}return X}async findPackageJsonFiles(){let X=[],Z=async($,K="")=>{try{let Y=await q.promises.readdir($);for(let H of Y){let Q=F.join($,H),z=K?F.join(K,H):H,G=await q.promises.stat(Q);if(G.isDirectory()){if(!this.shouldSkipDirectory(H))await Z(Q,z)}else if(G.isFile()&&H==="package.json")X.push(z)}}catch{}};return await Z(this.projectPath),X}shouldSkipDirectory(X){return h(X)}async findPackageLocation(X){let Z=await this.findPackageJsonFiles();for(let $ of Z)try{let K=F.join(this.projectPath,$),Y=q.readFileSync(K,"utf-8"),H=JSON.parse(Y);if({...H.dependencies,...H.devDependencies,...H.peerDependencies,...H.optionalDependencies}[X])return $}catch{continue}return null}async getPackageVersionReleaseDate(X,Z){try{let K=(await this.fetchPackument(X))?.time?.[Z];if(!K)return null;let Y=new Date(K);return Number.isNaN(Y.getTime())?null:Y}catch($){return this.logger.debug(`Failed to get release date for ${X}@${Z}:`,$),null}}async getGitHubActionReleaseDate(X,Z){try{let[$,K]=X.split("/");if(!$||!K)return null;let Y=`${y(this.config)}/repos/${$}/${K}/releases/tags/${encodeURIComponent(Z)}`,H=await V(Y,{headers:g(this.config)});if(!H?.published_at)return null;let Q=new Date(H.published_at);return Number.isNaN(Q.getTime())?null:Q}catch($){return this.logger.debug(`Failed to get GitHub Action release date for ${X}@${Z}:`,$),null}}async getComposerPackageReleaseDate(X,Z){try{let K=(await this.fetchComposerPackage(X))?.package?.versions?.[Z]?.time;if(!K)return null;let Y=new Date(K);return Number.isNaN(Y.getTime())?null:Y}catch($){return this.logger.debug(`Failed to get Composer package release date for ${X}@${Z}:`,$),null}}async getDockerImageReleaseDate(X,Z){try{return this.logger.debug(`Docker image release date checking not fully implemented for ${X}:${Z}`),null}catch($){return this.logger.debug(`Failed to get Docker image release date for ${X}:${Z}:`,$),null}}async meetsMinimumReleaseAge(X,Z,$,K){let Y=K??this.config?.packages?.minimumReleaseAge??0,H=this.config?.packages?.minimumReleaseAgeExclude??[];if(Y===0)return!0;if(H.includes(X))return this.logger.debug(`Package ${X} is excluded from minimum release age requirement`),!0;let Q=null;switch($){case"github-actions":Q=await this.getGitHubActionReleaseDate(X,Z);break;case"require":case"require-dev":Q=await this.getComposerPackageReleaseDate(X,Z);break;case"docker-image":Q=await this.getDockerImageReleaseDate(X,Z);break;default:Q=await this.getPackageVersionReleaseDate(X,Z);break}if(!Q)return this.logger.warn(`Could not determine release date for ${X}@${Z} (${$||"unknown type"}), allowing update`),!0;let G=(new Date().getTime()-Q.getTime())/60000,_=G>=Y;if(!_)this.logger.info(`Package ${X}@${Z} (${$||"unknown type"}) is too new (${Math.round(G)} minutes old, minimum: ${Y} minutes)`);return _}async runBunOutdatedForWorkspace(X){try{C(X,"workspace name");let Z=await this.runCommand("bun",["outdated","--filter",X]);return this.parseBunOutdatedOutput(Z).map((K)=>({...K,workspace:X}))}catch(Z){return this.logger.warn(`Failed to run bun outdated for workspace ${X}:`,Z),[]}}}
6
- export{P as fd,M as gd,m as hd,J as id,k as jd};
5
+ \uD83D\uDCE6 Processing package: ${Q.name}`),this.logger.info(` Current version: ${Q.version}`),this.logger.info(` Latest version: ${Q.latest}`),Q.name&&Q.version&&Q.latest){let z=K.require?.[Q.name],G=K["require-dev"]?.[Q.name],_=z||G;if(this.logger.info(` Constraint: ${_||"NOT FOUND"}`),!_){this.logger.info(` \u26A0\uFE0F Skipping ${Q.name} - not found in composer.json`);continue}if((this.config?.packages?.ignore||[]).includes(Q.name)){this.logger.info(` \u26A0\uFE0F Skipping ${Q.name} - in ignore list`);continue}let W="require";if(K["require-dev"]&&K["require-dev"][Q.name])W="require-dev";this.logger.info(` Dependency type: ${W}`);let L=await this.getComposerPackageMetadata(Q.name),O=this.extractConstraintBaseVersion(_);if(this.logger.info(` Constraint base version: ${O}`),!O){this.logger.warn(`\u274C Could not extract base version from constraint "${_}" for ${Q.name}`);continue}let S=O,b=Q.latest;this.logger.info(` Using current version: ${S} (from constraint)`),this.logger.info(` Target latest version: ${b}`);let j=[];try{this.logger.info(` \uD83D\uDD0D Getting available versions for ${Q.name}...`);let x=await this.runCommand("composer",["show",Q.name,"--available","--format=json"]),U=JSON.parse(x);if(U.versions)j=U.versions,this.logger.info(` \uD83D\uDCCB Found ${j.length} available versions`)}catch(x){this.logger.warn(`\u274C Failed to get available versions for ${Q.name}, using latest only:`,x),j=[b]}this.logger.info(" \uD83C\uDFAF Finding best constraint updates...");let D=await this.findBestConstraintUpdates(_,j,S);this.logger.info(` \uD83D\uDCCA Found ${D.length} update candidates`);for(let x of D){let U=E(S,x.version);if(this.logger.info(` \uD83D\uDCC8 Update candidate: ${S} \u2192 ${x.version} (${U})`),(this.config?.packages?.excludeMajor??!1)&&U==="major"){this.logger.info(` \u26A0\uFE0F Skipping major update for ${Q.name} - excludeMajor is true`);continue}this.logger.info(` \u2705 Adding update: ${Q.name} ${S} \u2192 ${x.version}`),X.push({name:Q.name,currentVersion:S,newVersion:x.version,updateType:U,dependencyType:W,file:"composer.json",metadata:L,releaseNotesUrl:this.getComposerReleaseNotesUrl(Q.name,L),changelogUrl:this.getComposerChangelogUrl(Q.name,L),homepage:L?.homepage})}}}return this.logger.info(`\u2705 Final result: Found ${X.length} Composer package updates`),this.logger.success(`Found ${X.length} Composer package updates`),X}catch(Z){return this.logger.warn("Failed to check for outdated Composer packages:",Z),[]}}parseVersion(X){let $=X.replace(/^v/,"").split("-")[0].split("+")[0].split(".").map((K)=>Number.parseInt(K,10));if($.length<2||$.some((K)=>Number.isNaN(K)))return null;return{major:$[0]||0,minor:$[1]||0,patch:$[2]||0}}compareVersions(X,Z){let $=this.parseVersion(X),K=this.parseVersion(Z);if(!$||!K)return 0;if($.major!==K.major)return $.major-K.major;if($.minor!==K.minor)return $.minor-K.minor;return $.patch-K.patch}async getComposerPackageMetadata(X){try{let $=(await this.fetchComposerPackage(X))?.package;if(!$?.versions)return;let K=Object.keys($.versions),Y=K.find((Q)=>!Q.includes("dev")&&!Q.includes("alpha")&&!Q.includes("beta"))??K[0],H=(Y?$.versions[Y]:void 0)??{};return{name:$.name??X,description:H.description,repository:H.source?.url??H.homepage,homepage:H.homepage,license:Array.isArray(H.license)?H.license.join(", "):H.license,author:H.authors?.[0]?.name,keywords:H.keywords,latestVersion:Y,versions:K,weeklyDownloads:$.downloads?.monthly,dependencies:H.require,devDependencies:H["require-dev"]}}catch(Z){this.logger.warn(`Failed to get Composer metadata for ${X}:`,Z);return}}async composerPackageExists(X){try{return await this.fetchComposerPackage(X)!==null}catch{return!1}}async getComposerLatestVersion(X){try{let $=(await this.fetchComposerPackage(X))?.package;if(!$?.versions)return null;let K=Object.keys($.versions),Y=K.filter((Q)=>!Q.includes("dev")&&!Q.includes("alpha")&&!Q.includes("beta")&&!Q.includes("rc"));if(Y.length===0)return K[0]||null;let H=Y.sort((Q,z)=>{try{if(typeof Bun<"u"&&Bun.semver)return Bun.semver.order(Q,z);return Q.localeCompare(z,void 0,{numeric:!0})}catch{return Q.localeCompare(z)}});return H[H.length-1]||null}catch(Z){return this.logger.warn(`Failed to get latest Composer version for ${X}:`,Z),null}}getComposerReleaseNotesUrl(X,Z){if(!Z?.repository)return;let $=Z.repository.match(/github\.com[/:]([^/]+\/[^/]+)/);if($)return`https://github.com/${$[1].replace(".git","")}/releases`;return}getComposerChangelogUrl(X,Z){if(!Z?.repository)return;let $=Z.repository.match(/github\.com[/:]([^/]+\/[^/]+)/);if($)return`https://github.com/${$[1].replace(".git","")}/blob/main/CHANGELOG.md`;return}extractConstraintBaseVersion(X){let Z=X.match(/^[\^~>=<]*([\d.]+)/);if(Z)return Z[1];return null}async findBestConstraintUpdates(X,Z,$){let{getUpdateType:K}=await import("./chunk-esveeark.js"),Y=[],H=this.parseVersion($);if(!H)return[];let Q=null,z=null,G=null;for(let _ of Z){if(_.includes("dev")||_.includes("alpha")||_.includes("beta")||_.includes("RC"))continue;let I=this.parseVersion(_);if(!I)continue;if(this.compareVersions(_,$)<=0)continue;let L=K($,_);if(L==="patch"&&I.major===H.major&&I.minor===H.minor){if(!Q||this.compareVersions(_,Q)>0)Q=_}else if(L==="minor"&&I.major===H.major){if(!z||this.compareVersions(_,z)>0)z=_}else if(L==="major"){if(!G||this.compareVersions(_,G)>0)G=_}}if(Q)Y.push({version:Q,type:"patch"});if(z)Y.push({version:z,type:"minor"});if(G)Y.push({version:G,type:"major"});return Y}async getWorkspaceOutdatedPackages(){try{let X=await this.getWorkspaceNames(),Z=await this.findPackageJsonFiles(),$=[];this.logger.info(`Found ${X.length} workspace packages to check`);for(let K of X)try{let Y=await this.runBunOutdatedForWorkspace(K);$.push(...Y)}catch(Y){this.logger.warn(`Failed to check workspace ${K}:`,Y)}this.logger.info(`Checking ${Z.length} package.json files directly`);for(let K of Z){if(K==="package.json")continue;try{let Y=F.join(this.projectPath,K),H=q.readFileSync(Y,"utf-8"),Q=JSON.parse(H),z={...Q.dependencies,...Q.devDependencies,...Q.peerDependencies,...Q.optionalDependencies};for(let[G,_]of Object.entries(z)){if(typeof _!=="string"||_.startsWith("workspace:"))continue;if($.some((I)=>I.name===G))continue;try{let I=await this.getLatestVersion(G);if(I){let W=this.cleanVersionRange(_);if(W&&Bun.semver.order(W,I)<0)$.push({name:G,current:W,update:I,latest:I,file:K})}}catch{continue}}}catch(Y){this.logger.warn(`Failed to check packages in ${K}:`,Y)}}return this.logger.info(`Found ${$.length} outdated packages across workspaces`),$}catch(X){return this.logger.warn("Failed to check workspace packages:",X),[]}}async getWorkspaceNames(){let X=[],Z=await this.findPackageJsonFiles();for(let $ of Z)try{let K=F.join(this.projectPath,$),Y=q.readFileSync(K,"utf-8"),H=JSON.parse(Y);if(H.name&&$!=="package.json")X.push(H.name)}catch(K){this.logger.warn(`Failed to parse package.json ${$}:`,K)}return X}async findPackageJsonFiles(){let X=[],Z=async($,K="")=>{try{let Y=await q.promises.readdir($);for(let H of Y){let Q=F.join($,H),z=K?F.join(K,H):H,G=await q.promises.stat(Q);if(G.isDirectory()){if(!this.shouldSkipDirectory(H))await Z(Q,z)}else if(G.isFile()&&H==="package.json")X.push(z)}}catch{}};return await Z(this.projectPath),X}shouldSkipDirectory(X){return h(X)}async findPackageLocation(X){let Z=await this.findPackageJsonFiles();for(let $ of Z)try{let K=F.join(this.projectPath,$),Y=q.readFileSync(K,"utf-8"),H=JSON.parse(Y);if({...H.dependencies,...H.devDependencies,...H.peerDependencies,...H.optionalDependencies}[X])return $}catch{continue}return null}async getPackageVersionReleaseDate(X,Z){try{let K=(await this.fetchPackument(X))?.time?.[Z];if(!K)return null;let Y=new Date(K);return Number.isNaN(Y.getTime())?null:Y}catch($){return this.logger.debug(`Failed to get release date for ${X}@${Z}:`,$),null}}async getGitHubActionReleaseDate(X,Z){try{let[$,K]=X.split("/");if(!$||!K)return null;let Y=`${y(this.config)}/repos/${$}/${K}/releases/tags/${encodeURIComponent(Z)}`,H=await V(Y,{headers:g(this.config)});if(!H?.published_at)return null;let Q=new Date(H.published_at);return Number.isNaN(Q.getTime())?null:Q}catch($){return this.logger.debug(`Failed to get GitHub Action release date for ${X}@${Z}:`,$),null}}async getComposerPackageReleaseDate(X,Z){try{let K=(await this.fetchComposerPackage(X))?.package?.versions?.[Z]?.time;if(!K)return null;let Y=new Date(K);return Number.isNaN(Y.getTime())?null:Y}catch($){return this.logger.debug(`Failed to get Composer package release date for ${X}@${Z}:`,$),null}}async getDockerImageReleaseDate(X,Z){try{return this.logger.debug(`Docker image release date checking not fully implemented for ${X}:${Z}`),null}catch($){return this.logger.debug(`Failed to get Docker image release date for ${X}:${Z}:`,$),null}}async meetsMinimumReleaseAge(X,Z,$,K){let Y=K??this.config?.packages?.minimumReleaseAge??0,H=this.config?.packages?.minimumReleaseAgeExclude??[];if(Y===0)return!0;if(H.includes(X))return this.logger.debug(`Package ${X} is excluded from minimum release age requirement`),!0;let Q=null;switch($){case"github-actions":Q=await this.getGitHubActionReleaseDate(X,Z);break;case"require":case"require-dev":Q=await this.getComposerPackageReleaseDate(X,Z);break;case"docker-image":Q=await this.getDockerImageReleaseDate(X,Z);break;default:Q=await this.getPackageVersionReleaseDate(X,Z);break}if(!Q)return this.logger.warn(`Could not determine release date for ${X}@${Z} (${$||"unknown type"}), allowing update`),!0;let G=(new Date().getTime()-Q.getTime())/60000,_=G>=Y;if(!_)this.logger.info(`Package ${X}@${Z} (${$||"unknown type"}) is too new (${Math.round(G)} minutes old, minimum: ${Y} minutes)`);return _}async runBunOutdatedForWorkspace(X){try{C(X,"workspace name");let Z=await this.runCommand("bun",["outdated","--filter",X]);return this.parseBunOutdatedOutput(Z).map((K)=>({...K,workspace:X}))}catch(Z){return this.logger.warn(`Failed to run bun outdated for workspace ${X}:`,Z),[]}}}
6
+ export{P as gd,M as hd,m as id,J as jd,k as kd};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Aa as d,Ba as e,Ca as f,xa as a,ya as b,za as c}from"./chunk-ysgex7h7.js";import"./chunk-a3bnhq58.js";import"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.js";export{b as productFor,f as describeEol,c as cycleFor,d as checkEol,e as EOL_WARNING_DAYS,a as EOL_PRODUCTS};
2
+ import{Aa as d,Ba as e,Ca as f,xa as a,ya as b,za as c}from"./chunk-a3zgenkh.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{b as productFor,f as describeEol,c as cycleFor,d as checkEol,e as EOL_WARNING_DAYS,a as EOL_PRODUCTS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{D as s,E as t,F as u,G as v,H as w,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,u as p,v as q,w as r}from"./chunk-z21tw4fz.js";import"./chunk-s3ksf6s5.js";export{r as toFile,v as default,w as betaRefusalFallbackMiddleware,l as UnprocessableEntityError,f as RetryableError,m as RateLimitError,i as PermissionDeniedError,q as PagePromise,j as NotFoundError,n as InternalServerError,s as HUMAN_PROMPT,k as ConflictError,o as BetaFallbackState,u as BaseAnthropic,g as BadRequestError,h as AuthenticationError,a as AnthropicError,v as Anthropic,c as APIUserAbortError,p as APIPromise,b as APIError,e as APIConnectionTimeoutError,d as APIConnectionError,t as AI_PROMPT};
2
+ import{D as s,E as t,F as u,G as v,H as w,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,u as p,v as q,w as r}from"./chunk-2jjrxgs1.js";import"./chunk-kbvj6qxc.js";export{r as toFile,v as default,w as betaRefusalFallbackMiddleware,l as UnprocessableEntityError,f as RetryableError,m as RateLimitError,i as PermissionDeniedError,q as PagePromise,j as NotFoundError,n as InternalServerError,s as HUMAN_PROMPT,k as ConflictError,o as BetaFallbackState,u as BaseAnthropic,g as BadRequestError,h as AuthenticationError,a as AnthropicError,v as Anthropic,c as APIUserAbortError,p as APIPromise,b as APIError,e as APIConnectionTimeoutError,d as APIConnectionError,t as AI_PROMPT};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Oh as z}from"./chunk-8dj94fsy.js";function Y(q,F,M=""){if(typeof F!=="object"||F===null)return[];let C=F,Q=M||"(root)",N=[];if(typeof C.type==="string"){let K=D(q);if(!(C.type==="integer"?Number.isInteger(q):K===C.type||C.type==="number"&&K==="integer"))return N.push({path:Q,message:`expected ${C.type}, got ${K}`}),N}if(Array.isArray(C.enum)&&!C.enum.includes(q))N.push({path:Q,message:`expected one of ${C.enum.map((K)=>JSON.stringify(K)).join(", ")}`});if(Array.isArray(C.required)&&typeof q==="object"&&q!==null){for(let K of C.required)if(!(String(K)in q))N.push({path:M?`${M}.${K}`:String(K),message:"is required but missing"})}if(typeof C.properties==="object"&&C.properties!==null&&typeof q==="object"&&q!==null)for(let[K,V]of Object.entries(C.properties)){let X=q[K];if(X!==void 0)N.push(...Y(X,V,M?`${M}.${K}`:K))}if(C.items!==void 0&&Array.isArray(q))q.forEach((K,V)=>{N.push(...Y(K,C.items,`${M}[${V}]`))});return N}function D(q){if(q===null)return"null";if(Array.isArray(q))return"array";if(Number.isInteger(q))return"integer";return typeof q}async function B(q){let F=q.logger??z(),M=q.maxRetries??2,C=q.system??"You are running as a pipeline step. Answer the request directly and completely. There is no interactive user to ask follow-up questions of.",Q="";for(let N=1;N<=M+1;N++){let K=N===1?q.prompt:`${q.prompt}
2
+ import{Ph as z}from"./chunk-x1w6q9tk.js";function Y(q,F,M=""){if(typeof F!=="object"||F===null)return[];let C=F,Q=M||"(root)",N=[];if(typeof C.type==="string"){let K=D(q);if(!(C.type==="integer"?Number.isInteger(q):K===C.type||C.type==="number"&&K==="integer"))return N.push({path:Q,message:`expected ${C.type}, got ${K}`}),N}if(Array.isArray(C.enum)&&!C.enum.includes(q))N.push({path:Q,message:`expected one of ${C.enum.map((K)=>JSON.stringify(K)).join(", ")}`});if(Array.isArray(C.required)&&typeof q==="object"&&q!==null){for(let K of C.required)if(!(String(K)in q))N.push({path:M?`${M}.${K}`:String(K),message:"is required but missing"})}if(typeof C.properties==="object"&&C.properties!==null&&typeof q==="object"&&q!==null)for(let[K,V]of Object.entries(C.properties)){let X=q[K];if(X!==void 0)N.push(...Y(X,V,M?`${M}.${K}`:K))}if(C.items!==void 0&&Array.isArray(q))q.forEach((K,V)=>{N.push(...Y(K,C.items,`${M}[${V}]`))});return N}function D(q){if(q===null)return"null";if(Array.isArray(q))return"array";if(Number.isInteger(q))return"integer";return typeof q}async function B(q){let F=q.logger??z(),M=q.maxRetries??2,C=q.system??"You are running as a pipeline step. Answer the request directly and completely. There is no interactive user to ask follow-up questions of.",Q="";for(let N=1;N<=M+1;N++){let K=N===1?q.prompt:`${q.prompt}
3
3
 
4
4
  Your previous answer did not satisfy the required schema:
5
5
  ${Q}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{tf as k,xf as b}from"./chunk-k7x9af5r.js";import{zf as C}from"./chunk-jpdd59fh.js";import{Qf as x}from"./chunk-7rjrea9g.js";import{ug as v}from"./chunk-gvnsr72j.js";import{Oh as D}from"./chunk-8dj94fsy.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{uf as k,yf as b}from"./chunk-c6ptrc0v.js";import{Af as C}from"./chunk-1pecmenc.js";import{Rf as x}from"./chunk-sxfk3naz.js";import{vg as v}from"./chunk-knpdntnh.js";import{Ph as D}from"./chunk-x1w6q9tk.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 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};
92
+ export{T as df,y as ef,R as ff,A as gf,E as hf,N as if,V as jf,L as kf,S as lf,BJ as mf,w as nf,M as of,a as pf,_J as qf,GJ as rf};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{fc as F}from"./chunk-ggzjv4s0.js";import{Bf as c}from"./chunk-jpdd59fh.js";import{Nf as E,Qf as A}from"./chunk-7rjrea9g.js";import{Oh as m}from"./chunk-8dj94fsy.js";function S(T,f,r){let O=r?"pull request":"issue";return{name:"read_issue",tier:"read",description:`Read the ${O} this task is about: its title and description.`,parameters:{type:"object",properties:{}},async run(M,x){try{let e=r?(await T.getPullRequests("all")).find((h)=>h.number===f):(await T.getIssues("all")).find((h)=>h.number===f);if(!e)return{content:`Could not find ${O} #${f}.`,isError:!0};let k=(e.body??"").slice(0,20000);return x.log(`read ${O} #${f}`),{content:`# ${e.title}
2
+ import{fc as F}from"./chunk-va3k91tf.js";import{Cf as c}from"./chunk-1pecmenc.js";import{Of as E,Rf as A}from"./chunk-sxfk3naz.js";import{Ph as m}from"./chunk-x1w6q9tk.js";function S(T,f,r){let O=r?"pull request":"issue";return{name:"read_issue",tier:"read",description:`Read the ${O} this task is about: its title and description.`,parameters:{type:"object",properties:{}},async run(M,x){try{let e=r?(await T.getPullRequests("all")).find((h)=>h.number===f):(await T.getIssues("all")).find((h)=>h.number===f);if(!e)return{content:`Could not find ${O} #${f}.`,isError:!0};let k=(e.body??"").slice(0,20000);return x.log(`read ${O} #${f}`),{content:`# ${e.title}
3
3
 
4
4
  ${k||"(no description)"}`,untrusted:!0}}catch(e){return{content:`Could not read ${O} #${f}: ${e instanceof Error?e.message:String(e)}`,isError:!0}}}}}async function C(T){let f=T.logger??m(),r=F(T.config,f);if(!r)return"I need an AI provider configured to write a plan. See https://buddy.sh/ai/providers";let M=[`Write an implementation plan for ${T.isPullRequest?"pull request":"issue"} #${T.number} in this repository.`,"","Call `read_issue` first to see what is being asked for, then read enough of","the repository to be concrete about it.",...T.request?["","The person asking added this direction, which comes from them rather than","from the repository:",` ${T.request.replace(/\n/g," ")}`]:[],"","Produce: the files that would change and why, the order of the work, the","risks, and how the result would be verified. Prefer naming real paths you","have read over describing the change in the abstract.","","If the request is too vague to plan, say what you would need to know","instead of inventing a plan around the gap."].join(`
5
5
  `),x=await A(r,{mode:c,task:M,tools:[...E,S(T.provider,T.number,T.isPullRequest)],context:{workspace:T.workspace??process.cwd(),baseBranch:T.config.repository?.baseBranch??"main"},logger:f});if(!x.output)return x.stopReason==="completed"?"I finished researching but produced no plan. That is a bug \u2014 please open an issue.":`I could not finish the plan (${x.stopReason}). The issue may need narrowing.`;return x.output}export{S as Va,C as Wa};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cg as a,dg as b,eg as c,fg as d,gg as e,hg as f,ig as g,jg as h,kg as i,lg as j,mg as k,ng as l,og as m}from"./chunk-2z2gh050.js";import"./chunk-knpdntnh.js";import"./chunk-54er1whp.js";import"./chunk-ktn47bq8.js";import"./chunk-2z9pkk1y.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-z05djfac.js";import"./chunk-kbvj6qxc.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};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{fd as a}from"./chunk-08daxhzx.js";import"./chunk-2z9pkk1y.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{a as DeprecatedDependenciesChecker};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qe as p}from"./chunk-34rmja4x.js";import{Oh as E}from"./chunk-8dj94fsy.js";var x=["github-actions[bot]","buddy","buddy[bot]"];function w(f,r){let e=f.authorLogins[0];if(!e)return!1;return r?e===r:x.includes(e)}async function F(f){let r=f.logger??E(),{provider:e,prNumber:t}=f;if(!p(e,"reviewThreads","listReviewThreads"))return"This provider cannot resolve review threads.";let n=await e.listReviewThreads(t),i=n.filter((R)=>!R.isResolved&&w(R,f.author));if(i.length===0)return n.length===0?"There are no review threads on this pull request.":"None of the open threads here are mine to close.";if(!p(e,"reviewThreads","resolveReviewThread"))return"This provider cannot resolve review threads.";let o=0;for(let R of i)if(await e.resolveReviewThread(t,R.id))o++;else r.warn(`Could not resolve thread ${R.id} on #${t}`);if(o===0)return`I could not close any of the ${i.length} thread(s) I opened.`;let m=o<i.length?` (${i.length-o} refused)`:"";return`Closed ${o} thread(s) I opened${m}.`}export{F as mb};
2
+ import{re as p}from"./chunk-ctdfppxk.js";import{Ph as E}from"./chunk-x1w6q9tk.js";var x=["github-actions[bot]","buddy","buddy[bot]"];function w(f,r){let e=f.authorLogins[0];if(!e)return!1;return r?e===r:x.includes(e)}async function F(f){let r=f.logger??E(),{provider:e,prNumber:t}=f;if(!p(e,"reviewThreads","listReviewThreads"))return"This provider cannot resolve review threads.";let n=await e.listReviewThreads(t),i=n.filter((R)=>!R.isResolved&&w(R,f.author));if(i.length===0)return n.length===0?"There are no review threads on this pull request.":"None of the open threads here are mine to close.";if(!p(e,"reviewThreads","resolveReviewThread"))return"This provider cannot resolve review threads.";let o=0;for(let R of i)if(await e.resolveReviewThread(t,R.id))o++;else r.warn(`Could not resolve thread ${R.id} on #${t}`);if(o===0)return`I could not close any of the ${i.length} thread(s) I opened.`;let m=o<i.length?` (${i.length-o} refused)`:"";return`Closed ${o} thread(s) I opened${m}.`}export{F as mb};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sf as a,tf as b,uf as c,vf as d,wf as e,xf as f,yf as g}from"./chunk-c6ptrc0v.js";import"./chunk-24xvskkf.js";import"./chunk-2z2gh050.js";import"./chunk-knpdntnh.js";import"./chunk-54er1whp.js";import"./chunk-ktn47bq8.js";import"./chunk-2z9pkk1y.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-z05djfac.js";import"./chunk-kbvj6qxc.js";export{f as strategyAllows,b as ruleMatches,c as resolveRuleEffects,e as mergeGroupEffects,g as groupsToRules,a as ecosystemOf,d as applyRules};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ah as S,wh as G,zh as R}from"./chunk-6k6dgwmy.js";import{Ih as x}from"./chunk-a3bnhq58.js";import{Oh as K}from"./chunk-8dj94fsy.js";var{semver:H}=globalThis.Bun;import F from"process";class P{userAgent="Buddy/1.0.0 (https://github.com/stacksjs/buddy)";logger;constructor(B){this.logger=B??K()}githubHeaders(){let B={"User-Agent":this.userAgent,Accept:"application/vnd.github.v3+json"},J=F.env.BUDDY_TOKEN||F.env.GITHUB_TOKEN||F.env.GH_TOKEN;if(J)B.Authorization=`Bearer ${J}`;return B}async fetchPackageInfo(B,J,Y){if(F.env.APP_ENV==="test"){let X={stripe:{owner:"stripe",repo:"stripe-node"},typescript:{owner:"microsoft",repo:"TypeScript"},react:{owner:"facebook",repo:"react"}}[B]||{owner:"example",repo:B};return{packageInfo:{name:B,description:`Package ${B} description`,repository:{type:"git",url:`https://github.com/${X.owner}/${X.repo}`}},releaseNotes:[],changelog:[],compareUrl:this.generateCompareUrl(X.owner,X.repo,J,Y)}}try{let q=await this.fetchNpmPackageInfo(B),X=[],Z=[],Q;if(q.repository?.url){let O=this.parseGitHubUrl(q.repository.url);if(O)X=await this.fetchGitHubReleases(O.owner,O.repo,J,Y),Q=this.generateCompareUrl(O.owner,O.repo,J,Y),Z=await this.fetchChangelog(O.owner,O.repo)}return{packageInfo:q,releaseNotes:X,changelog:Z,compareUrl:Q}}catch(q){return this.logger.error(`\u274C Failed to fetch package info for ${B}:`,q),{packageInfo:{name:B,description:`Package ${B} - see npm for details`,repository:{type:"git",url:`https://github.com/search?q=${encodeURIComponent(B)}&type=repositories`}},releaseNotes:[],changelog:[]}}}async fetchNpmPackageInfo(B){try{let J=R(B),Y=await x(`${J}/${encodeURIComponent(B).replace("%40","@")}`,{headers:{"User-Agent":this.userAgent}});if(!Y.ok)throw Error(`NPM registry responded with ${Y.status}`);let q=await Y.json(),X=q["dist-tags"]?.latest,Z;try{let L=await x(`https://api.npmjs.org/downloads/point/last-week/${encodeURIComponent(B)}`,{headers:{"User-Agent":this.userAgent}});if(L.ok)Z=(await L.json()).downloads}catch{}let Q=typeof q.repository==="string"?{type:"git",url:q.repository}:q.repository?.url?{type:q.repository.type??"git",url:q.repository.url}:void 0,O=q.author,_=typeof O==="string"?O:O&&typeof O==="object"&&("name"in O)&&typeof O.name==="string"?O:void 0,$=Array.isArray(q.maintainers)?q.maintainers.filter((L)=>!!L&&typeof L==="object"&&("name"in L)&&typeof L.name==="string"):void 0;return{name:B,description:q.description,homepage:q.homepage,repository:Q,license:q.license,author:_,keywords:q.keywords,weeklyDownloads:Z,lastPublish:X?q.time?.[X]:void 0,maintainers:$}}catch(J){return this.logger.warn(`\u26A0\uFE0F Failed to fetch npm info for ${B}:`,J),{name:B,description:`NPM package ${B}`,homepage:`https://www.npmjs.com/package/${encodeURIComponent(B)}`}}}async fetchSpanReleases(B,J,Y,q=5){let X=await this.fetchNpmPackageInfo(B).catch(()=>null),Z=X?.repository?.url?this.parseGitHubUrl(X.repository.url):null;if(!Z)return this.logger.debug(`No GitHub repository for ${B}; no span notes available`),[];let Q=[];for(let O=1;O<=q;O++){let _=await x(`${G()}/repos/${Z.owner}/${Z.repo}/releases?per_page=100&page=${O}`,{headers:this.githubHeaders()}).catch(()=>null);if(!_?.ok)break;let $=await _.json().catch(()=>null);if(!Array.isArray($)||$.length===0)break;for(let j of $)Q.push({version:j.tag_name,date:j.published_at,title:j.name??j.tag_name,body:j.body??"",htmlUrl:j.html_url,isPrerelease:j.prerelease});if($.some((j)=>this.isVersionBetween(j.tag_name.replace(/^v/,""),"0.0.0",J))||$.length<100)break}return Q.filter((O)=>this.isVersionBetween(O.version.replace(/^v/,""),J,Y))}parseGitHubUrl(B){try{let J=B.replace(/^git\+/,"").replace(/\.git$/,"").replace(/^git:\/\//,"https://").replace(/^ssh:\/\/git@/,"https://").replace(/^git@github\.com:/,"https://github.com/"),Y=new URL(J);if(Y.hostname!=="github.com")return null;let q=Y.pathname.split("/").filter(Boolean);if(q.length>=2)return{owner:q[0],repo:q[1]};return null}catch{return null}}async fetchGitHubReleases(B,J,Y,q){try{let X=await x(`${G()}/repos/${B}/${J}/releases?per_page=50`,{headers:this.githubHeaders()});if(!X.ok)return[];return(await X.json()).filter((Q)=>{let O=Q.tag_name.replace(/^v/,"");return this.isVersionBetween(O,Y,q)}).map((Q)=>({version:Q.tag_name,date:Q.published_at,title:Q.name??Q.tag_name,body:Q.body??"",htmlUrl:Q.html_url,compareUrl:this.generateCompareUrl(B,J,Y,Q.tag_name),author:Q.author?.login,isPrerelease:Q.prerelease,assets:Q.assets?.map((O)=>({name:O.name,downloadUrl:O.browser_download_url,size:O.size,contentType:O.content_type}))??[]}))}catch(X){return this.logger.warn(`Failed to fetch GitHub releases for ${B}/${J}:`,X),[]}}async fetchChangelog(B,J){let Y=["CHANGELOG.md","CHANGELOG.rst","HISTORY.md","RELEASES.md"];for(let q of Y)try{let X=await x(`${G()}/repos/${B}/${J}/contents/${q}`,{headers:this.githubHeaders()});if(X.ok){let Z=await X.json();if(Z.content){let Q=atob(Z.content);return this.parseChangelog(Q)}}}catch{}return[]}parseChangelog(B){let J=[],Y=B.split(`
2
+ import{Ah as R,Bh as S,xh as G}from"./chunk-2z9pkk1y.js";import{Jh as x}from"./chunk-b9szrnxw.js";import{Ph as K}from"./chunk-x1w6q9tk.js";var{semver:H}=globalThis.Bun;import F from"process";class P{userAgent="Buddy/1.0.0 (https://github.com/stacksjs/buddy)";logger;constructor(B){this.logger=B??K()}githubHeaders(){let B={"User-Agent":this.userAgent,Accept:"application/vnd.github.v3+json"},J=F.env.BUDDY_TOKEN||F.env.GITHUB_TOKEN||F.env.GH_TOKEN;if(J)B.Authorization=`Bearer ${J}`;return B}async fetchPackageInfo(B,J,Y){if(F.env.APP_ENV==="test"){let X={stripe:{owner:"stripe",repo:"stripe-node"},typescript:{owner:"microsoft",repo:"TypeScript"},react:{owner:"facebook",repo:"react"}}[B]||{owner:"example",repo:B};return{packageInfo:{name:B,description:`Package ${B} description`,repository:{type:"git",url:`https://github.com/${X.owner}/${X.repo}`}},releaseNotes:[],changelog:[],compareUrl:this.generateCompareUrl(X.owner,X.repo,J,Y)}}try{let q=await this.fetchNpmPackageInfo(B),X=[],Z=[],Q;if(q.repository?.url){let O=this.parseGitHubUrl(q.repository.url);if(O)X=await this.fetchGitHubReleases(O.owner,O.repo,J,Y),Q=this.generateCompareUrl(O.owner,O.repo,J,Y),Z=await this.fetchChangelog(O.owner,O.repo)}return{packageInfo:q,releaseNotes:X,changelog:Z,compareUrl:Q}}catch(q){return this.logger.error(`\u274C Failed to fetch package info for ${B}:`,q),{packageInfo:{name:B,description:`Package ${B} - see npm for details`,repository:{type:"git",url:`https://github.com/search?q=${encodeURIComponent(B)}&type=repositories`}},releaseNotes:[],changelog:[]}}}async fetchNpmPackageInfo(B){try{let J=R(B),Y=await x(`${J}/${encodeURIComponent(B).replace("%40","@")}`,{headers:{"User-Agent":this.userAgent}});if(!Y.ok)throw Error(`NPM registry responded with ${Y.status}`);let q=await Y.json(),X=q["dist-tags"]?.latest,Z;try{let L=await x(`https://api.npmjs.org/downloads/point/last-week/${encodeURIComponent(B)}`,{headers:{"User-Agent":this.userAgent}});if(L.ok)Z=(await L.json()).downloads}catch{}let Q=typeof q.repository==="string"?{type:"git",url:q.repository}:q.repository?.url?{type:q.repository.type??"git",url:q.repository.url}:void 0,O=q.author,_=typeof O==="string"?O:O&&typeof O==="object"&&("name"in O)&&typeof O.name==="string"?O:void 0,$=Array.isArray(q.maintainers)?q.maintainers.filter((L)=>!!L&&typeof L==="object"&&("name"in L)&&typeof L.name==="string"):void 0;return{name:B,description:q.description,homepage:q.homepage,repository:Q,license:q.license,author:_,keywords:q.keywords,weeklyDownloads:Z,lastPublish:X?q.time?.[X]:void 0,maintainers:$}}catch(J){return this.logger.warn(`\u26A0\uFE0F Failed to fetch npm info for ${B}:`,J),{name:B,description:`NPM package ${B}`,homepage:`https://www.npmjs.com/package/${encodeURIComponent(B)}`}}}async fetchSpanReleases(B,J,Y,q=5){let X=await this.fetchNpmPackageInfo(B).catch(()=>null),Z=X?.repository?.url?this.parseGitHubUrl(X.repository.url):null;if(!Z)return this.logger.debug(`No GitHub repository for ${B}; no span notes available`),[];let Q=[];for(let O=1;O<=q;O++){let _=await x(`${G()}/repos/${Z.owner}/${Z.repo}/releases?per_page=100&page=${O}`,{headers:this.githubHeaders()}).catch(()=>null);if(!_?.ok)break;let $=await _.json().catch(()=>null);if(!Array.isArray($)||$.length===0)break;for(let j of $)Q.push({version:j.tag_name,date:j.published_at,title:j.name??j.tag_name,body:j.body??"",htmlUrl:j.html_url,isPrerelease:j.prerelease});if($.some((j)=>this.isVersionBetween(j.tag_name.replace(/^v/,""),"0.0.0",J))||$.length<100)break}return Q.filter((O)=>this.isVersionBetween(O.version.replace(/^v/,""),J,Y))}parseGitHubUrl(B){try{let J=B.replace(/^git\+/,"").replace(/\.git$/,"").replace(/^git:\/\//,"https://").replace(/^ssh:\/\/git@/,"https://").replace(/^git@github\.com:/,"https://github.com/"),Y=new URL(J);if(Y.hostname!=="github.com")return null;let q=Y.pathname.split("/").filter(Boolean);if(q.length>=2)return{owner:q[0],repo:q[1]};return null}catch{return null}}async fetchGitHubReleases(B,J,Y,q){try{let X=await x(`${G()}/repos/${B}/${J}/releases?per_page=50`,{headers:this.githubHeaders()});if(!X.ok)return[];return(await X.json()).filter((Q)=>{let O=Q.tag_name.replace(/^v/,"");return this.isVersionBetween(O,Y,q)}).map((Q)=>({version:Q.tag_name,date:Q.published_at,title:Q.name??Q.tag_name,body:Q.body??"",htmlUrl:Q.html_url,compareUrl:this.generateCompareUrl(B,J,Y,Q.tag_name),author:Q.author?.login,isPrerelease:Q.prerelease,assets:Q.assets?.map((O)=>({name:O.name,downloadUrl:O.browser_download_url,size:O.size,contentType:O.content_type}))??[]}))}catch(X){return this.logger.warn(`Failed to fetch GitHub releases for ${B}/${J}:`,X),[]}}async fetchChangelog(B,J){let Y=["CHANGELOG.md","CHANGELOG.rst","HISTORY.md","RELEASES.md"];for(let q of Y)try{let X=await x(`${G()}/repos/${B}/${J}/contents/${q}`,{headers:this.githubHeaders()});if(X.ok){let Z=await X.json();if(Z.content){let Q=atob(Z.content);return this.parseChangelog(Q)}}}catch{}return[]}parseChangelog(B){let J=[],Y=B.split(`
3
3
  `),q=null,X=null;for(let Z of Y){let Q=Z.match(/^##\s*\[?([^\]]+)\]?\s*-?\s*(.*)/);if(Q){if(q)J.push(q);q={version:Q[1],date:Q[2].trim(),changes:{}},X=null;continue}let O=Z.match(/^###\s*(.+)/);if(O&&q){X=O[1].toLowerCase();continue}let _=Z.match(/^[-*]\s*(.+)/);if(_&&q&&X){if(!q.changes)q.changes={};let $=X;if(!q.changes[$])q.changes[$]=[];q.changes[$].push(_[1])}}if(q)J.push(q);return J.slice(0,10)}generateCompareUrl(B,J,Y,q){let X=this.getComparableVersion(Y),Z=this.getComparableVersion(q);if(!X||!Z)return;return`https://github.com/${B}/${J}/compare/${encodeURIComponent(`v${X}`)}...${encodeURIComponent(`v${Z}`)}`}isVersionBetween(B,J,Y){let q=this.getComparableVersion(B),X=this.getComparableVersion(J),Z=this.getComparableVersion(Y);if(!q||!X||!Z)return!1;try{return H.order(q,X)>0&&H.order(q,Z)<=0}catch{return q>X&&q<=Z}}getComparableVersion(B){let J=B.split("||").flatMap((Y)=>{let q=Y.trim();if(q.startsWith("<"))return[];let X=q.match(/^(?:[~^]|>=?|=)?\s*v?(\d+(?:\.\d+){0,2}(?:-[0-9A-Z.-]+)?)/i);if(!X)return[];let[Z,Q]=X[1].split("-",2),O=Z.split(".");while(O.length<3)O.push("0");return[`${O.join(".")}${Q?`-${Q}`:""}`]});if(J.length===0)return null;return J.reduce((Y,q)=>{try{return H.order(q,Y)>0?q:Y}catch{return q>Y?q:Y}})}generatePackageBadges(B,J,Y){let q=encodeURIComponent(B.name),X=this.normalizeVersionForBadges(J),Z=this.normalizeVersionForBadges(Y),Q=encodeURIComponent(X),O=encodeURIComponent(Z);return{age:`[![age](https://developer.mend.io/api/mc/badges/age/npm/${q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`,adoption:`[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/${q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`,passing:`[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/${q}/${Q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`,confidence:`[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/${q}/${Q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`}}async fetchComposerPackageInfo(B){if(F.env.APP_ENV==="test")return{name:B,description:`PHP package ${B} description`,homepage:`https://packagist.org/packages/${B}`,repository:{type:"git",url:`https://github.com/example/${B}`},license:"MIT"};try{let J=await x(`${S()}/packages/${encodeURIComponent(B)}.json`,{headers:{"User-Agent":this.userAgent}});if(!J.ok)throw Error(`Packagist responded with ${J.status}`);let q=(await J.json()).package;if(!q?.versions)return{name:B};let X=Object.keys(q.versions),Z=X.find((L)=>!L.includes("dev")&&!L.includes("alpha")&&!L.includes("beta"))??X[0],Q=(Z?q.versions[Z]:void 0)??{},O=Array.isArray(Q.license)?Q.license[0]:Q.license,_=Q.authors?.[0],$=_&&typeof _==="object"&&"name"in _&&typeof _.name==="string"?_:void 0;return{name:q.name??B,description:Q.description,homepage:Q.homepage,repository:Q.source?.url?{type:"git",url:Q.source.url}:void 0,license:O,author:$,keywords:Q.keywords,lastPublish:Q.time}}catch(J){return this.logger.warn(`Failed to fetch Packagist info for ${B}:`,J),{name:B}}}generateComposerBadges(B,J,Y){let q=encodeURIComponent(B.name),X=this.normalizeVersionForBadges(J),Z=this.normalizeVersionForBadges(Y),Q=encodeURIComponent(X),O=encodeURIComponent(Z);return{age:`[![age](https://developer.mend.io/api/mc/badges/age/packagist/${q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`,adoption:`[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/${q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`,passing:`[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/${q}/${Q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`,confidence:`[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/${q}/${Q}/${O}?slim=true)](https://docs.renovatebot.com/merge-confidence/)`}}normalizeVersionForBadges(B){let J=B.replace(/^v/,"");if(J.split(".").length===2)J=`${J}.0`;return J}}
4
- export{P as Ve};
4
+ export{P as We};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ld as J}from"./chunk-89s9f3mf.js";import{md as Y}from"./chunk-ja3rvd6y.js";import{te as _}from"./chunk-hyp0wfta.js";import{we as x,xe as w}from"./chunk-4hd1mryc.js";import{Pe as z,Qe as M}from"./chunk-nwrr6jas.js";import{Xe as N}from"./chunk-88j356ng.js";import{yg as L,zg as S}from"./chunk-1m5wprvm.js";import{Oh as G}from"./chunk-8dj94fsy.js";import{dl as j}from"./chunk-s3ksf6s5.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-kpdz73mc.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};
2
+ import{md as J}from"./chunk-bnp0r4eh.js";import{nd as Y}from"./chunk-0f1xye20.js";import{ue as _}from"./chunk-wjfw6rx8.js";import{xe as x,ye as w}from"./chunk-w55x2g9n.js";import{Qe as z,Re as M}from"./chunk-1xe0960b.js";import{Ye as N}from"./chunk-j46f90n8.js";import{Ag as S,zg as L}from"./chunk-54er1whp.js";import{Ph as G}from"./chunk-x1w6q9tk.js";import{el as j}from"./chunk-kbvj6qxc.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-hc651afv.js");return await V(q,O)}catch(K){return this.logger.warn(`Failed to parse Composer file ${q}:`,K),null}}async parsePantryLockFile(q){try{let K=R(this.projectPath,q),O=await U(K,"utf-8");return await I(q,O)}catch(K){return this.logger.warn(`Failed to parse pantry.lock file ${q}:`,K),null}}extractDependencies(q,K,O,V){if(!q)return;for(let[Q,W]of Object.entries(q))V.push({name:Q,currentVersion:W,type:K,file:this.getRelativePath(O)})}async extractLockFileDependencies(q,K,O){let V=[];if(K==="package-lock.json")try{let Q=JSON.parse(q);if(Q.packages){for(let[W,B]of Object.entries(Q.packages))if(W&&W!==""&&B&&typeof B==="object"){let C=B;if(C.version){let T=W.startsWith("node_modules/")?W.replace("node_modules/",""):W;V.push({name:T,currentVersion:C.version,type:C.dev?"devDependencies":"dependencies",file:this.getRelativePath(O)})}}}}catch(Q){this.logger.warn("Failed to parse package-lock.json:",Q)}return V}async findFiles(q,K=this.projectPath){let O=[];try{let V=await A(K);for(let Q of V){let W=R(K,Q);try{let B=await Z(W);if(B.isDirectory()){if(!J(Q)){let C=await this.findFiles(q,W);O.push(...C)}}else if(B.isFile()&&Q===q){let C=E(this.projectPath,W);O.push(C.split(H).join("/"))}}catch{continue}}}catch{}return O}async findLockFiles(){let q=["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml"],K=[];for(let O of q){let V=await this.findFiles(O);K.push(...V)}return K}async findFilesByPattern(q){let K=[],O=q.replace("*.","");try{let V=await A(this.projectPath);for(let Q of V){let W=R(this.projectPath,Q),B=await Z(W);if(B.isFile()&&Q.endsWith(`.${O}`)){let C=E(this.projectPath,W);K.push(C.split(H).join("/"))}else if(B.isDirectory()&&!J(Q)){let C=await this.findFilesByPatternInDir(q,W);K.push(...C)}}}catch{}return K}async findFilesByPatternInDir(q,K){let O=[],V=q.replace("*.","");try{let Q=await A(K);for(let W of Q){let B=R(K,W),C=await Z(B);if(C.isFile()&&W.endsWith(`.${V}`)){let T=E(this.projectPath,B);O.push(T.split(H).join("/"))}else if(C.isDirectory()&&!J(W)){let T=await this.findFilesByPatternInDir(q,B);O.push(...T)}}}catch{}return O}shouldIgnorePath(q){if(this.ignoreGlobs.length===0)return!1;let K=q;if(q.startsWith("/")||q.includes(":"))K=this.getRelativePath(q);for(let O of this.ignoreGlobs)if(O.match(K))return this.logger.debug(`Ignoring path: ${K} (matched pattern)`),!0;return!1}getRelativePath(q){return E(this.projectPath,q).split(H).join("/")}async getDependencyCount(){return(await this.scanProject()).reduce((K,O)=>K+O.dependencies.length,0)}async getUniqueDependencies(){return(await this.scanProject()).flatMap((V)=>V.dependencies).filter((V,Q,W)=>Q===W.findIndex((B)=>B.name===V.name))}}
3
+ export{m as ld};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Oh as X}from"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.js";import{readFileSync as _}from"fs";function L(q){let z=q.split("/").pop()||"";return z==="composer.json"||z==="composer.lock"}async function R(q,z){try{let j=JSON.parse(z),A=[];if(j.require)J(j.require,"require",q,A);if(j["require-dev"])J(j["require-dev"],"require-dev",q,A);return{path:q,type:"composer.json",content:z,dependencies:A}}catch(j){return X().warn(`Failed to parse composer.json file ${q}:`,j),null}}async function S(q,z){try{let j=JSON.parse(z),A=[];if(j.packages){for(let b of j.packages)if(b.name&&b.version)A.push({name:b.name,currentVersion:b.version,type:"require",file:q})}if(j["packages-dev"]){for(let b of j["packages-dev"])if(b.name&&b.version)A.push({name:b.name,currentVersion:b.version,type:"require-dev",file:q})}return{path:q,type:"composer.lock",content:z,dependencies:A}}catch(j){return X().warn(`Failed to parse composer.lock file ${q}:`,j),null}}async function v(q,z){let j=q.split("/").pop()||"";if(j==="composer.json")return R(q,z);if(j==="composer.lock")return S(q,z);return null}function J(q,z,j,A){for(let[b,Z]of Object.entries(q)){if(b==="php"||b.startsWith("ext-"))continue;if(b.includes("/"))A.push({name:b,currentVersion:Z,type:z,file:j})}}async function U(q){let z=[],j=q.filter((b)=>b.file.endsWith("composer.json"));if(j.length===0)return z;let A=new Map;for(let b of j){if(!A.has(b.file))A.set(b.file,[]);A.get(b.file).push({name:b.name,newVersion:b.newVersion})}for(let[b,Z]of A)try{let K=_(b,"utf-8"),T=JSON.parse(K);for(let E of Z){let Y=!1;if(T.require&&T.require[E.name]){let H=T.require[E.name],O;if(H.includes(",")){let G=H.match(/\d+\.\d+(?:\.\d+)?/),Q=G?G[0]:null;O=H.replace(/\d+\.\d+(?:\.\d+)?/g,(W)=>{return Q!==null&&W===Q?E.newVersion:W})}else{let G=H.match(/^(\D*)/);O=`${G?G[1]:""}${E.newVersion}`}let $=new RegExp(`("${E.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"\\s*:\\s*")([^"]+)(")`,"g");K=K.replace($,`$1${O}$3`),Y=!0}if(!Y&&T["require-dev"]&&T["require-dev"][E.name]){let H=T["require-dev"][E.name],O;if(H.includes(",")){let G=H.match(/\d+\.\d+(?:\.\d+)?/),Q=G?G[0]:null;O=H.replace(/\d+\.\d+(?:\.\d+)?/g,(W)=>{return Q!==null&&W===Q?E.newVersion:W})}else{let G=H.match(/^(\D*)/);O=`${G?G[1]:""}${E.newVersion}`}let $=new RegExp(`("${E.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"\\s*:\\s*")([^"]+)(")`,"g");K=K.replace($,`$1${O}$3`),Y=!0}if(!Y)X().warn(`Package ${E.name} not found in ${b}`)}z.push({path:b,content:K,type:"update"})}catch(K){X().error(`Failed to update ${b}:`,K)}return z}export{S as parseComposerLock,R as parseComposerJson,v as parseComposerFile,L as isComposerFile,U as generateComposerUpdates};
2
+ import{Ph as X}from"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";import{readFileSync as _}from"fs";function L(q){let z=q.split("/").pop()||"";return z==="composer.json"||z==="composer.lock"}async function R(q,z){try{let j=JSON.parse(z),A=[];if(j.require)J(j.require,"require",q,A);if(j["require-dev"])J(j["require-dev"],"require-dev",q,A);return{path:q,type:"composer.json",content:z,dependencies:A}}catch(j){return X().warn(`Failed to parse composer.json file ${q}:`,j),null}}async function S(q,z){try{let j=JSON.parse(z),A=[];if(j.packages){for(let b of j.packages)if(b.name&&b.version)A.push({name:b.name,currentVersion:b.version,type:"require",file:q})}if(j["packages-dev"]){for(let b of j["packages-dev"])if(b.name&&b.version)A.push({name:b.name,currentVersion:b.version,type:"require-dev",file:q})}return{path:q,type:"composer.lock",content:z,dependencies:A}}catch(j){return X().warn(`Failed to parse composer.lock file ${q}:`,j),null}}async function v(q,z){let j=q.split("/").pop()||"";if(j==="composer.json")return R(q,z);if(j==="composer.lock")return S(q,z);return null}function J(q,z,j,A){for(let[b,Z]of Object.entries(q)){if(b==="php"||b.startsWith("ext-"))continue;if(b.includes("/"))A.push({name:b,currentVersion:Z,type:z,file:j})}}async function U(q){let z=[],j=q.filter((b)=>b.file.endsWith("composer.json"));if(j.length===0)return z;let A=new Map;for(let b of j){if(!A.has(b.file))A.set(b.file,[]);A.get(b.file).push({name:b.name,newVersion:b.newVersion})}for(let[b,Z]of A)try{let K=_(b,"utf-8"),T=JSON.parse(K);for(let E of Z){let Y=!1;if(T.require&&T.require[E.name]){let H=T.require[E.name],O;if(H.includes(",")){let G=H.match(/\d+\.\d+(?:\.\d+)?/),Q=G?G[0]:null;O=H.replace(/\d+\.\d+(?:\.\d+)?/g,(W)=>{return Q!==null&&W===Q?E.newVersion:W})}else{let G=H.match(/^(\D*)/);O=`${G?G[1]:""}${E.newVersion}`}let $=new RegExp(`("${E.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"\\s*:\\s*")([^"]+)(")`,"g");K=K.replace($,`$1${O}$3`),Y=!0}if(!Y&&T["require-dev"]&&T["require-dev"][E.name]){let H=T["require-dev"][E.name],O;if(H.includes(",")){let G=H.match(/\d+\.\d+(?:\.\d+)?/),Q=G?G[0]:null;O=H.replace(/\d+\.\d+(?:\.\d+)?/g,(W)=>{return Q!==null&&W===Q?E.newVersion:W})}else{let G=H.match(/^(\D*)/);O=`${G?G[1]:""}${E.newVersion}`}let $=new RegExp(`("${E.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"\\s*:\\s*")([^"]+)(")`,"g");K=K.replace($,`$1${O}$3`),Y=!0}if(!Y)X().warn(`Package ${E.name} not found in ${b}`)}z.push({path:b,content:K,type:"update"})}catch(K){X().error(`Failed to update ${b}:`,K)}return z}export{S as parseComposerLock,R as parseComposerJson,v as parseComposerFile,L as isComposerFile,U as generateComposerUpdates};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var Y={node:{registry:"github",source:"nodejs/node"},bun:{registry:"npm",source:"bun"},npm:{registry:"npm",source:"npm"},pnpm:{registry:"npm",source:"pnpm"},yarn:{registry:"npm",source:"yarn"},deno:{registry:"github",source:"denoland/deno"}};function Z(A,F){if(typeof A!=="object"||A===null||Array.isArray(A))return[];let z=[];for(let[B,J]of Object.entries(A)){if(typeof J!=="string"||!J.trim())continue;if(!Y[B])continue;z.push({name:B,currentVersion:J.trim(),type:"engines",file:F,metadata:{engine:"true",source:Y[B].source}})}return z}function $(A){if(typeof A!=="object"||A===null)return[];let F=A,z=[],B=(J,L)=>{if(typeof J!=="object"||J===null||Array.isArray(J))return;for(let[U,H]of Object.entries(J)){if(typeof H==="string"&&H.trim()){z.push({name:U,version:H.trim(),field:L});continue}if(typeof H==="object"&&H!==null){let M=H;if(typeof M["."]==="string")z.push({name:U,version:M["."].trim(),field:L});B(H,L)}}};return B(F.overrides,"overrides"),B(F.resolutions,"resolutions"),B(F.pnpm?.overrides,"pnpm.overrides"),z}function q(A,F){let z=A.version.trim();try{if(/^[\^~><=]/.test(z))return!Bun.semver.satisfies(F,z)}catch{return!0}return z!==F}async function C(A,F){let z=Y[A];if(!z)return null;let B=z.registry==="npm"?await F.npm(z.source):await F.github(z.source);return B?B.replace(/^v/,""):null}function R(A,F){let z=/^\s*(>=|\^|~|>|=)?\s*v?(\d+(?:\.\d+)*)\s*$/.exec(A);if(!z)return null;let[,B="",J]=z,L=J.split(".").map(Number),H=F.split(".").map(Number).slice(0,L.length),M=!1;for(let Q=0;Q<H.length;Q++){let X=H[Q]-(L[Q]??0);if(X!==0){M=X>0;break}}if(!M)return null;return`${B}${H.join(".")}`}function T(A,F){let z=(L)=>(/(\d+(?:\.\d+)*)/.exec(L)?.[1]??"0").split(".").map(Number),B=z(A),J=z(F);if((J[0]??0)!==(B[0]??0))return"major";if((J[1]??0)!==(B[1]??0))return"minor";return"patch"}function P(A,F){let z=/("engines"\s*:\s*\{)([\s\S]*?)(\})/.exec(A);if(!z)return A;let[B,J,L,U]=z,H=L;for(let M of F){if(M.dependencyType!=="engines")continue;let Q=M.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=M.currentVersion.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");H=H.replace(new RegExp(`("${Q}"\\s*:\\s*")${X}(")`),`$1${M.newVersion}$2`)}return H===L?A:A.replace(B,`${J}${H}${U}`)}
3
- export{Y as We,Z as Xe,$ as Ye,q as Ze,C as _e,R as $e,T as af,P as bf};
3
+ export{Y as Xe,Z as Ye,$ as Ze,q as _e,C as $e,R as af,T as bf,P as cf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ae as d,Be as e,Ce as f,De as g,Ee as h,xe as a,ye as b,ze as c}from"./chunk-w55x2g9n.js";import"./chunk-2z9pkk1y.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{e as updateGitHubActionsFile,d as sameActionVersion,b as parseGitHubActionsFile,a as isGitHubActionsFile,c as isCommitSha,f as generateGitHubActionsUpdates,h as fetchLatestActionVersion,g as fetchActionTagCommit};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{yf as Q,zf as J}from"./chunk-jpdd59fh.js";var L=`Verify your work before reporting it done: run the project's
2
+ import{Af as J,zf as Q}from"./chunk-1pecmenc.js";var L=`Verify your work before reporting it done: run the project's
3
3
  tests or build if one exists. If verification fails, report what failed rather
4
4
  than claiming success \u2014 a change that looks right and breaks the build costs
5
5
  more than no change at all.`,X={name:"docstrings",description:"Add missing doc comments to changed public APIs",mode:J,defaultOutput:"commit",buildTask:({files:j})=>["Add missing documentation comments to the public APIs changed on this branch.","","Follow the documentation style already used in the surrounding code \u2014 match its","density and conventions rather than importing a different house style.","Document what a caller needs: parameters, return value, thrown errors, and any","constraint the signature does not already show. Do not restate what the code says.","","Do not document code that was not changed, and do not modify behaviour.",j?.length?`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dh as V}from"./chunk-pxdrwhxx.js";import{Ih as P}from"./chunk-a3bnhq58.js";import{Lh as M,Oh as Q}from"./chunk-8dj94fsy.js";function X(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function Y(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Z{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
2
+ import{Eh as V}from"./chunk-vpw7adwd.js";import{Jh as P}from"./chunk-b9szrnxw.js";import{Mh as M,Ph as Q}from"./chunk-x1w6q9tk.js";function X(z){if(z==="running")return"in_progress";if(z==="success"||z==="failed"||z==="canceled"||z==="skipped"||z==="manual")return"completed";return"queued"}function Y(z){switch(z){case"success":return"success";case"failed":return"failure";case"canceled":return"cancelled";case"skipped":case"manual":return"skipped";default:return null}}class Z{token;apiUrl;logger;projectId;constructor(z,A,F,G,H){this.token=z;this.apiUrl=(G??"https://gitlab.com/api/v4").replace(/\/+$/,""),this.logger=H??Q(),this.projectId=encodeURIComponent(`${A}/${F}`)}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!0,nativeAutoMerge:!0,commentReactions:!0,ciLogs:!0,ciRuns:!0,reviewThreads:!0,teamReviewers:!1,draftPullRequests:!0,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!0,labels:!0}}async request(z,A,F,G={}){let H=await P(`${this.apiUrl}${A}`,{method:z,headers:{"PRIVATE-TOKEN":this.token,Accept:G.raw?"text/plain":"application/json","User-Agent":"buddy",...F?{"Content-Type":"application/json"}:{}},...F?{body:JSON.stringify(F)}:{}});if(!H.ok){let K=await H.text().catch(()=>"");throw Error(`GitLab ${z} ${A} failed: ${H.status} ${K.slice(0,200)}`)}let J=await H.text();if(G.raw)return J;return J.trim()?JSON.parse(J):void 0}async optional(z,A,F={}){try{return await this.request(z,A,void 0,F)}catch(G){if(String(G).includes("404"))return null;throw G}}async branchExists(z){return await this.optional("GET",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)!==null}async createBranch(z,A){await this.request("POST",`/projects/${this.projectId}/repository/branches`,{branch:z,ref:A})}async deleteBranch(z){await this.request("DELETE",`/projects/${this.projectId}/repository/branches/${encodeURIComponent(z)}`)}async commitChanges(z,A,F,G="main"){if(F.length===0)return;if(await this.branchExists(z))await this.deleteBranch(z);await this.createBranch(z,G);let J=await Promise.all(F.map(async(K)=>{if(K.type==="delete")return{action:"delete",file_path:K.path};return{action:await this.getFileContent(K.path,G)!==null?"update":"create",file_path:K.path,content:K.content}}));await this.request("POST",`/projects/${this.projectId}/repository/commits`,{branch:z,commit_message:A,actions:J})}async getFileContent(z,A){let F=await this.optional("GET",`/projects/${this.projectId}/repository/files/${encodeURIComponent(z)}?ref=${encodeURIComponent(A)}`);if(!F?.content)return null;return F.encoding==="base64"?Buffer.from(F.content,"base64").toString("utf-8"):F.content}async createPullRequest(z){let A=await this.request("POST",`/projects/${this.projectId}/merge_requests`,{source_branch:z.head,target_branch:z.base,title:z.draft?`Draft: ${z.title}`:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{},remove_source_branch:!0});return await this.assignPeople(A.iid,z),this.toPullRequest(A)}async assignPeople(z,A){let F=async(J=[])=>{return(await Promise.all(J.map(async(O)=>{return(await this.optional("GET",`/users?username=${encodeURIComponent(O)}`))?.[0]?.id??null}))).filter((O)=>O!==null)},[G,H]=await Promise.all([F(A.reviewers),F(A.assignees)]);if(G.length===0&&H.length===0)return;try{await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...G.length?{reviewer_ids:G}:{},...H.length?{assignee_ids:H}:{}})}catch(J){this.logger.warn(`\u26A0\uFE0F Could not assign reviewers on !${z}: ${M(J)}`)}}async getPullRequests(z="open"){let A=z==="all"?"state=all":z==="open"?"state=opened":"state=all",G=(await this.request("GET",`/projects/${this.projectId}/merge_requests?${A}&per_page=100`)).map((H)=>this.toPullRequest(H));return z==="closed"?G.filter((H)=>H.state!=="open"):G}async updatePullRequest(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{...A.title!==void 0?{title:A.draft?`Draft: ${A.title}`:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.base!==void 0?{target_branch:A.base}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toPullRequest(F)}async closePullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"close"})}async reopenPullRequest(z){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}`,{state_event:"reopen"})}async mergePullRequest(z,A="squash"){await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{squash:A==="squash",should_remove_source_branch:!0})}async getPullRequestDiff(z){return((await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/changes`)).changes??[]).map((F)=>[`diff --git a/${F.old_path} b/${F.new_path}`,`--- a/${F.old_path}`,`+++ b/${F.new_path}`,F.diff.replace(/\n$/,"")].join(`
3
3
  `)).join(`
4
4
  `)}async getPullRequestHeadSha(z){return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}`)).sha??""}async createComment(z,A){try{await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/notes`,{body:A})}catch(F){if(!String(F).includes("404"))throw F;await this.request("POST",`/projects/${this.projectId}/issues/${z}/notes`,{body:A})}}async createIssue(z){let A=await this.request("POST",`/projects/${this.projectId}/issues`,{title:z.title,description:z.body,...z.labels?.length?{labels:z.labels.join(",")}:{}});return this.toIssue(A)}async getIssues(z="open"){let A=z==="all"?"state=all":`state=${z==="open"?"opened":"closed"}`;return(await this.request("GET",`/projects/${this.projectId}/issues?${A}&per_page=100`)).map((G)=>this.toIssue(G))}async updateIssue(z,A){let F=await this.request("PUT",`/projects/${this.projectId}/issues/${z}`,{...A.title!==void 0?{title:A.title}:{},...A.body!==void 0?{description:A.body}:{},...A.labels!==void 0?{labels:A.labels.join(",")}:{}});return this.toIssue(F)}async closeIssue(z){await this.request("PUT",`/projects/${this.projectId}/issues/${z}`,{state_event:"close"})}async unpinIssue(z){return!1}async enableAutoMerge(z,A="squash"){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/merge`,{merge_when_pipeline_succeeds:!0,squash:A==="squash",should_remove_source_branch:!0}),!0}catch(F){return this.logger.debug(`Could not queue !${z} for auto-merge: ${M(F)}`),!1}}async getPullRequestChecksState(z){let F=(await this.optional("GET",`/projects/${this.projectId}/merge_requests/${z}/pipelines`))?.[0]?.status;if(!F)return"none";if(F==="success")return"success";if(["failed","canceled"].includes(F))return"failure";if(["running","pending","created","waiting_for_resource","preparing","scheduled"].includes(F))return"pending";return"none"}async createReview(z,A){if(await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/notes`,{body:A.body}),!A.comments?.length)return{posted:!0,inlineComments:0};let G=(await this.optional("GET",`/projects/${this.projectId}/merge_requests/${z}/versions`))?.[0];if(!G)return this.logger.warn("\u26A0\uFE0F Could not resolve diff positions; inline comments were not posted"),{posted:!0,inlineComments:0};let H=0;for(let J of A.comments)try{await this.request("POST",`/projects/${this.projectId}/merge_requests/${z}/discussions`,{body:J.body,position:{position_type:"text",base_sha:G.base_commit_sha,start_sha:G.start_commit_sha,head_sha:G.head_commit_sha,new_path:J.path,old_path:J.path,...J.side==="RIGHT"?{new_line:J.line}:{old_line:J.line}}}),H++}catch(K){this.logger.debug(`Could not place a comment on ${J.path}:${J.line}: ${M(K)}`)}return{posted:!0,inlineComments:H}}async createCheckRun(z,A,F){try{await this.request("POST",`/projects/${this.projectId}/statuses/${A}`,{state:F.conclusion==="failure"?"failed":"success",name:z,description:F.title.slice(0,140)})}catch(G){this.logger.warn(`\u26A0\uFE0F Could not report status ${z}: ${M(G)}`)}}async reactToComment(z,A){let F={eyes:"eyes","+1":"thumbsup","-1":"thumbsdown",rocket:"rocket",confused:"confused"};try{await this.request("POST",`/projects/${this.projectId}/notes/${z}/award_emoji`,{name:F[A]??"eyes"})}catch(G){this.logger.debug(`Could not react to note ${z}: ${M(G)}`)}}async hasWriteAccess(z){return(await this.optional("GET",`/projects/${this.projectId}/members/all?query=${encodeURIComponent(z)}`)??[]).some((F)=>F.username===z&&F.access_level>=30)}async getWorkflowRunLogs(z){return this.optional("GET",`/projects/${this.projectId}/jobs/${z}/trace`,{raw:!0}).catch((A)=>{return this.logger.debug(`Could not read the trace for job ${z}: ${M(A)}`),null})}async listWorkflowRuns(z,A={}){let F=A.limit??20;try{return(await this.request("GET",`/projects/${this.projectId}/jobs?per_page=${Math.min(F*5,100)}`)??[]).filter((H)=>H.ref===z).map((H)=>({id:H.id,name:H.name??"",headSha:H.commit?.id??"",headBranch:H.ref??z,status:X(H.status),conclusion:Y(H.status),createdAt:new Date(H.created_at??new Date().toISOString())})).filter((H)=>!A.status||H.status===A.status).slice(0,F)}catch(G){return this.logger.debug(`Could not list CI jobs for ${z}: ${M(G)}`),[]}}async rerunWorkflowRun(z){try{return await this.request("POST",`/projects/${this.projectId}/jobs/${z}/retry`),!0}catch(A){return this.logger.warn(`Could not retry job ${z}: ${M(A)}`),!1}}async listReviewThreads(z){try{return(await this.request("GET",`/projects/${this.projectId}/merge_requests/${z}/discussions?per_page=100`)??[]).filter((F)=>(F.notes??[]).some((G)=>G.resolvable)).map((F)=>({id:F.id,isResolved:(F.notes??[]).every((G)=>!G.resolvable||G.resolved),...F.notes?.[0]?.position?.new_path?{path:F.notes[0].position.new_path}:{},authorLogins:(F.notes??[]).map((G)=>G.author?.username).filter((G)=>typeof G==="string")}))}catch(A){return this.logger.debug(`Could not read discussions on !${z}: ${M(A)}`),[]}}async resolveReviewThread(z,A){try{return await this.request("PUT",`/projects/${this.projectId}/merge_requests/${z}/discussions/${encodeURIComponent(A)}`,{resolved:!0}),!0}catch(F){return this.logger.warn(`Could not resolve discussion ${A}: ${M(F)}`),!1}}async getBuddyBranches(){return(await this.request("GET",`/projects/${this.projectId}/repository/branches?search=buddy&per_page=100`)).filter((A)=>V(A.name)).map((A)=>({name:A.name,sha:A.commit?.id??"",lastCommitDate:A.commit?.committed_date?new Date(A.commit.committed_date):new Date(0)}))}async getOrphanedBuddyBranches(){let[z,A]=await Promise.all([this.getBuddyBranches(),this.getPullRequests("open")]),F=new Set(A.map((G)=>G.head));return z.filter((G)=>!F.has(G.name))}async cleanupStaleBranches(z=7,A=!1){let F=new Date(Date.now()-z*24*60*60*1000),G=(await this.getOrphanedBuddyBranches()).filter((K)=>K.lastCommitDate<F);if(A)return{deleted:G.map((K)=>K.name),failed:[]};let H=[],J=[];for(let K of G)try{await this.deleteBranch(K.name),H.push(K.name)}catch{J.push(K.name)}return{deleted:H,failed:J}}toPullRequest(z){let A=Boolean(z.draft??z.work_in_progress)||/^(?:draft|wip):/i.test(z.title);return{number:z.iid,title:z.title.replace(/^(?:draft|wip):\s*/i,""),body:z.description??"",head:z.source_branch,base:z.target_branch,state:z.state==="merged"?"merged":z.state==="opened"?"open":"closed",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.merged_at?{mergedAt:new Date(z.merged_at)}:{},author:z.author?.username??"",reviewers:(z.reviewers??[]).map((F)=>F.username),assignees:(z.assignees??[]).map((F)=>F.username),labels:z.labels??[],draft:A}}toIssue(z){return{number:z.iid,title:z.title,body:z.description??"",state:z.state==="closed"?"closed":"open",url:z.web_url,createdAt:new Date(z.created_at),updatedAt:new Date(z.updated_at),...z.closed_at?{closedAt:new Date(z.closed_at)}:{},author:z.author?.username??"",assignees:(z.assignees??[]).map((A)=>A.username),labels:z.labels??[]}}}
5
- export{Z as Bh};
5
+ export{Z as Ch};
@@ -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 bl,r as cl,s as dl};
3
+ export{q as cl,r as dl,s as el};
@@ -4,4 +4,4 @@ var A=1,F=30000,K=/<!--\s*buddy:manifest\s+v(\d+)\s*([\s\S]*?)-->/;function Y(j)
4
4
  <!-- buddy:manifest v1
5
5
  ${JSON.stringify(j)}
6
6
  -->`}function G(j,q={}){return L(j.updates,{group:j.name,...q})}function Z(j){if(!j)return null;let q=j.match(K);if(!q)return null;try{let w=JSON.parse(q[2].trim());if(!D(w))return null;return{...w,schemaVersion:Number(w.schemaVersion)||Number(q[1])||1,updates:w.updates.filter(z)}}catch{return null}}function I(j){return Z(j)!==null}function $(j){return j.replace(K,"").trimEnd()}function N(j,q,w={}){return $(j)+L(q,w)}function P(j){return j.updates.map((q)=>({name:q.name,currentVersion:q.current,newVersion:q.target}))}function R(j){return[...new Set(j.updates.map((q)=>q.file).filter(Boolean))]}function D(j){if(typeof j!=="object"||j===null)return!1;return Array.isArray(j.updates)}function z(j){if(typeof j!=="object"||j===null)return!1;let q=j;return typeof q.name==="string"&&typeof q.current==="string"&&typeof q.target==="string"}
7
- export{A as og,F as pg,L as qg,G as rg,Z as sg,I as tg,$ as ug,N as vg,P as wg,R as xg};
7
+ export{A as pg,F as qg,L as rg,G as sg,Z as tg,I as ug,$ as vg,N as wg,P as xg,R as yg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-rb1fh9vd.js";import{$d as n,Od as a,Pd as b,Qd as c,Rd as d,Sd as e,Td as f,Ud as g,Vd as h,Wd as i,Xd as j,Yd as k,Zd as l,_d as m,ae as o,be as p,ce as q,de as r,ee as s,fe as t}from"./chunk-0g4ybxwj.js";import"./chunk-142zh7e5.js";import"./chunk-24xvskkf.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{r as syntaxAnalyzer,q as shellcheckAnalyzer,p as secretsAnalyzer,b as runTool,t as runAnalyzers,e as relativize,d as parseToolJson,j as offsetToLine,n as markdownlintAnalyzer,c as mapSeverity,m as linterAnalyzer,i as hadolintAnalyzer,h as githubActionsAnalyzer,l as detectLinter,f as commandExists,g as actionlintAnalyzer,a as TOOL_TIMEOUT_MS,o as SECRET_RULES,k as LINTER_SPECS,s as BUILTIN_ANALYZERS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{execSync as h}from"child_process";import{existsSync as P,mkdirSync as F,mkdtempSync as L,rmSync as V,writeFileSync as U}from"fs";import{tmpdir as G}from"os";import{join as w}from"path";var i=new Set,A=!1;function q(){if(A)return;A=!0;let a=()=>{for(let e of i)try{h(`pantry stop ${e}`,{stdio:"ignore",timeout:1e4})}catch{}i.clear()};process.on("exit",a),process.on("SIGINT",()=>{a(),process.exit(130)}),process.on("SIGTERM",()=>{a(),process.exit(143)})}function o(a,e=!1){let s={encoding:"utf-8",timeout:30000,stdio:e?"pipe":["pipe","pipe","pipe"]};return h(`pantry ${a}`,s)}function O(a){let e=a.match(/Name:\s+(\S+)/)?.[1]??"",s=/Status:\s+running/i.test(a),t=a.match(/Port:\s+(\d+)/),r=a.match(/PID:\s+(\d+)/),S=a.match(/Data Dir:\s+(.+)/);return{name:e,running:s,port:t?Number.parseInt(t[1],10):null,pid:r?Number.parseInt(r[1],10):null,dataDir:S?S[1].trim():null}}class n{config;_startedByUs=!1;constructor(a){this.config={name:a.name,port:a.port??0,readyTimeoutMs:a.readyTimeoutMs??15000,pollIntervalMs:a.pollIntervalMs??200,quiet:a.quiet??!0}}static isAvailable(){try{return h("pantry --version",{stdio:"ignore",timeout:5000}),!0}catch{return!1}}status(){try{let a=o(`inspect ${this.config.name}`,!0);return O(a)}catch{return{name:this.config.name,running:!1,port:null,pid:null,dataDir:null}}}isRunning(){return this.status().running}getPort(){return this.status().port}async start(){if(q(),this.isRunning())return this.status();return o(`start ${this.config.name}`,this.config.quiet),this._startedByUs=!0,i.add(this.config.name),await this.waitReady(),this.status()}async stop(){if(!this._startedByUs)return;try{o(`stop ${this.config.name}`,this.config.quiet)}catch{}i.delete(this.config.name),this._startedByUs=!1}async forceStop(){try{o(`stop ${this.config.name}`,this.config.quiet)}catch{}i.delete(this.config.name),this._startedByUs=!1}async ensureRunning(){if(this.isRunning())return this.status();return this.start()}async waitReady(){let a=Date.now()+this.config.readyTimeoutMs;while(Date.now()<a){if(this.isRunning())return;await new Promise((e)=>setTimeout(e,this.config.pollIntervalMs))}throw Error(`Service '${this.config.name}' did not become ready within ${this.config.readyTimeoutMs}ms`)}}var v=new n({name:"mysql"});async function c(a){let e=await v.ensureRunning();return{port:a?.port??e.port??3306,host:a?.host??"localhost",database:a?.database??"test",username:a?.username??"root"}}async function u(){await v.stop()}function I(a){let e=null;return{get connection(){if(!e)throw Error("MySQL not started. Ensure beforeAll has run.");return e},beforeAll:async()=>{e=await c(a)},afterAll:async()=>{await u(),e=null}}}async function D(a,e){let s=await c(e);try{return await a(s)}finally{if(e?.stopAfter!==!1)await u()}}var R=new n({name:"postgres"});async function p(a){let e=await R.ensureRunning();return{port:a?.port??e.port??5432,host:a?.host??"localhost",database:a?.database??"postgres",username:a?.username??process.env.USER??"postgres"}}async function g(){await R.stop()}function T(a){let e=null;return{get connection(){if(!e)throw Error("Postgres not started. Ensure beforeAll has run.");return e},beforeAll:async()=>{e=await p(a)},afterAll:async()=>{await g(),e=null}}}async function C(a,e){let s=await p(e);try{return await a(s)}finally{if(e?.stopAfter!==!1)await g()}}var M=new n({name:"redis"});async function f(a){let e=await M.ensureRunning(),s=a?.port??e.port??6379,t=a?.host??"localhost";return{port:s,host:t,url:`redis://${t}:${s}`}}async function d(){await M.stop()}function E(a){let e=null;return{get connection(){if(!e)throw Error("Redis not started. Ensure beforeAll has run.");return e},beforeAll:async()=>{e=await f(a)},afterAll:async()=>{await d(),e=null}}}async function b(a,e){let s=await f(e);try{return await a(s)}finally{if(e?.stopAfter!==!1)await d()}}var l=new Set,k=!1;function H(){if(k)return;k=!0;let a=()=>{for(let e of l)try{if(P(e))V(e,{recursive:!0,force:!0})}catch{}l.clear()};process.on("exit",a),process.on("SIGINT",()=>{a(),process.exit(130)}),process.on("SIGTERM",()=>{a(),process.exit(143)})}function m(a="pantry-test-"){H();let e=L(w(G(),a));return l.add(e),e}function y(a){l.delete(a);try{if(P(a))V(a,{recursive:!0,force:!0})}catch{}}async function N(a,e){let s=m(a);try{return await e(s)}finally{y(s)}}function x(a,e){let s=m(a);try{return e(s)}finally{y(s)}}function _(a,e,s){let t=w(a,e),r=t.substring(0,t.lastIndexOf("/"));if(r&&!P(r))F(r,{recursive:!0});return U(t,s),t}function B(a,e){let s=w(a,e);return F(s,{recursive:!0}),s}var $={createTempDir:m,createTestDir:B,createTestFile:_,PantryService:n,removeTempDir:y,startMysql:c,startPostgres:p,startRedis:f,stopMysql:u,stopPostgres:g,stopRedis:d,useMysql:I,usePostgres:T,useRedis:E,withMysql:D,withPostgres:C,withRedis:b,withTempDir:N,withTempDirSync:x};export{n as Cg,c as Dg,u as Eg,I as Fg,D as Gg,p as Hg,g as Ig,T as Jg,C as Kg,f as Lg,d as Mg,E as Ng,b as Og,m as Pg,y as Qg,N as Rg,x as Sg,_ as Tg,B as Ug,$ as Vg};
2
+ import{execSync as h}from"child_process";import{existsSync as P,mkdirSync as F,mkdtempSync as L,rmSync as V,writeFileSync as U}from"fs";import{tmpdir as G}from"os";import{join as w}from"path";var i=new Set,A=!1;function q(){if(A)return;A=!0;let a=()=>{for(let e of i)try{h(`pantry stop ${e}`,{stdio:"ignore",timeout:1e4})}catch{}i.clear()};process.on("exit",a),process.on("SIGINT",()=>{a(),process.exit(130)}),process.on("SIGTERM",()=>{a(),process.exit(143)})}function o(a,e=!1){let s={encoding:"utf-8",timeout:30000,stdio:e?"pipe":["pipe","pipe","pipe"]};return h(`pantry ${a}`,s)}function O(a){let e=a.match(/Name:\s+(\S+)/)?.[1]??"",s=/Status:\s+running/i.test(a),t=a.match(/Port:\s+(\d+)/),r=a.match(/PID:\s+(\d+)/),S=a.match(/Data Dir:\s+(.+)/);return{name:e,running:s,port:t?Number.parseInt(t[1],10):null,pid:r?Number.parseInt(r[1],10):null,dataDir:S?S[1].trim():null}}class n{config;_startedByUs=!1;constructor(a){this.config={name:a.name,port:a.port??0,readyTimeoutMs:a.readyTimeoutMs??15000,pollIntervalMs:a.pollIntervalMs??200,quiet:a.quiet??!0}}static isAvailable(){try{return h("pantry --version",{stdio:"ignore",timeout:5000}),!0}catch{return!1}}status(){try{let a=o(`inspect ${this.config.name}`,!0);return O(a)}catch{return{name:this.config.name,running:!1,port:null,pid:null,dataDir:null}}}isRunning(){return this.status().running}getPort(){return this.status().port}async start(){if(q(),this.isRunning())return this.status();return o(`start ${this.config.name}`,this.config.quiet),this._startedByUs=!0,i.add(this.config.name),await this.waitReady(),this.status()}async stop(){if(!this._startedByUs)return;try{o(`stop ${this.config.name}`,this.config.quiet)}catch{}i.delete(this.config.name),this._startedByUs=!1}async forceStop(){try{o(`stop ${this.config.name}`,this.config.quiet)}catch{}i.delete(this.config.name),this._startedByUs=!1}async ensureRunning(){if(this.isRunning())return this.status();return this.start()}async waitReady(){let a=Date.now()+this.config.readyTimeoutMs;while(Date.now()<a){if(this.isRunning())return;await new Promise((e)=>setTimeout(e,this.config.pollIntervalMs))}throw Error(`Service '${this.config.name}' did not become ready within ${this.config.readyTimeoutMs}ms`)}}var v=new n({name:"mysql"});async function c(a){let e=await v.ensureRunning();return{port:a?.port??e.port??3306,host:a?.host??"localhost",database:a?.database??"test",username:a?.username??"root"}}async function u(){await v.stop()}function I(a){let e=null;return{get connection(){if(!e)throw Error("MySQL not started. Ensure beforeAll has run.");return e},beforeAll:async()=>{e=await c(a)},afterAll:async()=>{await u(),e=null}}}async function D(a,e){let s=await c(e);try{return await a(s)}finally{if(e?.stopAfter!==!1)await u()}}var R=new n({name:"postgres"});async function p(a){let e=await R.ensureRunning();return{port:a?.port??e.port??5432,host:a?.host??"localhost",database:a?.database??"postgres",username:a?.username??process.env.USER??"postgres"}}async function g(){await R.stop()}function T(a){let e=null;return{get connection(){if(!e)throw Error("Postgres not started. Ensure beforeAll has run.");return e},beforeAll:async()=>{e=await p(a)},afterAll:async()=>{await g(),e=null}}}async function C(a,e){let s=await p(e);try{return await a(s)}finally{if(e?.stopAfter!==!1)await g()}}var M=new n({name:"redis"});async function f(a){let e=await M.ensureRunning(),s=a?.port??e.port??6379,t=a?.host??"localhost";return{port:s,host:t,url:`redis://${t}:${s}`}}async function d(){await M.stop()}function E(a){let e=null;return{get connection(){if(!e)throw Error("Redis not started. Ensure beforeAll has run.");return e},beforeAll:async()=>{e=await f(a)},afterAll:async()=>{await d(),e=null}}}async function b(a,e){let s=await f(e);try{return await a(s)}finally{if(e?.stopAfter!==!1)await d()}}var l=new Set,k=!1;function H(){if(k)return;k=!0;let a=()=>{for(let e of l)try{if(P(e))V(e,{recursive:!0,force:!0})}catch{}l.clear()};process.on("exit",a),process.on("SIGINT",()=>{a(),process.exit(130)}),process.on("SIGTERM",()=>{a(),process.exit(143)})}function m(a="pantry-test-"){H();let e=L(w(G(),a));return l.add(e),e}function y(a){l.delete(a);try{if(P(a))V(a,{recursive:!0,force:!0})}catch{}}async function N(a,e){let s=m(a);try{return await e(s)}finally{y(s)}}function x(a,e){let s=m(a);try{return e(s)}finally{y(s)}}function _(a,e,s){let t=w(a,e),r=t.substring(0,t.lastIndexOf("/"));if(r&&!P(r))F(r,{recursive:!0});return U(t,s),t}function B(a,e){let s=w(a,e);return F(s,{recursive:!0}),s}var $={createTempDir:m,createTestDir:B,createTestFile:_,PantryService:n,removeTempDir:y,startMysql:c,startPostgres:p,startRedis:f,stopMysql:u,stopPostgres:g,stopRedis:d,useMysql:I,usePostgres:T,useRedis:E,withMysql:D,withPostgres:C,withRedis:b,withTempDir:N,withTempDirSync:x};export{n as Dg,c as Eg,u as Fg,I as Gg,D as Hg,p as Ig,g as Jg,T as Kg,C as Lg,f as Mg,d as Ng,E as Og,b as Pg,m as Qg,y as Rg,N as Sg,x as Tg,_ as Ug,B as Vg,$ as Wg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Jc as a,Kc as b,Lc as c,Mc as d}from"./chunk-3n4w3ak9.js";import"./chunk-s1cgwkkr.js";import"./chunk-cj4d5ad7.js";import"./chunk-2z2gh050.js";import"./chunk-knpdntnh.js";import"./chunk-54er1whp.js";import"./chunk-ktn47bq8.js";import"./chunk-2z9pkk1y.js";import"./chunk-vpw7adwd.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-z05djfac.js";import"./chunk-kbvj6qxc.js";export{c as isWorkflowPermissionRefusal,a as gitAuthConfigArgs,b as WorkflowPermissionError,d as GitHubProvider};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{te as a,ue as b,ve as c,we as d}from"./chunk-wjfw6rx8.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{c as updateZigManifest,b as parseZigManifest,a as isZigManifest,d as generateZigManifestUpdates};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dh as Z}from"./chunk-pxdrwhxx.js";import{Oh as K}from"./chunk-8dj94fsy.js";var R=".buddy/reports.jsonl",U=52;function X(M){if(!M?.trim())return[];let E=[];for(let j of M.split(`
2
+ import{Eh as Z}from"./chunk-vpw7adwd.js";import{Ph as K}from"./chunk-x1w6q9tk.js";var R=".buddy/reports.jsonl",U=52;function X(M){if(!M?.trim())return[];let E=[];for(let j of M.split(`
3
3
  `)){if(!j.trim())continue;try{let N=JSON.parse(j);if(N?.period&&N.generatedAt&&N.health&&N.activity)E.push(N)}catch{continue}}return E}function x(M,E){return`${[...M,E].slice(-U).map((N)=>JSON.stringify(N)).join(`
4
4
  `)}
5
5
  `}function W(M,E){for(let j=M.length-1;j>=0;j--)if(M[j].period===E)return M[j];return null}async function _(M,E,j=K()){try{return X(await M.getFileContent(R,E))}catch(N){return j.debug(`No report history at ${R}: ${N}`),[]}}var k=["7d","30d","90d"],O={"7d":7,"30d":30,"90d":90};function A(M){let E=new Date(M.now.getTime()-O[M.period]*24*60*60*1000),j=M.pullRequests.filter((q)=>M.branchPrefix?q.head.startsWith(M.branchPrefix):Z(q.head)),N=j.filter((q)=>q.createdAt>=E),C=j.filter((q)=>q.mergedAt!==void 0&&q.mergedAt>=E),z=j.filter((q)=>q.state==="closed"&&q.mergedAt===void 0&&q.updatedAt>=E),F=C.map((q)=>(q.mergedAt.getTime()-q.createdAt.getTime())/3600000).sort((q,Q)=>q-Q),H=Object.values(M.dependenciesByEcosystem).reduce((q,Q)=>q+Q,0),J=M.updates.length;return{period:M.period,generatedAt:M.now.toISOString(),health:{byEcosystem:{...M.dependenciesByEcosystem},total:H,outdated:J,outdatedPercent:H>0?Math.round(J/H*100):0,majorBehind:M.updates.filter((q)=>q.updateType==="major").length,vulnerable:M.updates.filter((q)=>(q.securityAdvisories?.length??0)>0).length,deprecated:M.deprecated??0,drifted:M.drifted??0},activity:{opened:N.length,merged:C.length,closed:z.length,open:j.filter((q)=>q.state==="open").length,medianHoursToMerge:L(F),mergeRate:N.length>0?Math.round(C.length/N.length*100):0}}}function L(M){if(M.length===0)return null;let E=Math.floor(M.length/2),j=M.length%2===0?(M[E-1]+M[E])/2:M[E];return Math.round(j*10)/10}function S(M,E){if(!E)return{};let j=new Set(["merged","mergeRate"]),N=[["outdated",M.health.outdated,E.health.outdated],["majorBehind",M.health.majorBehind,E.health.majorBehind],["vulnerable",M.health.vulnerable,E.health.vulnerable],["deprecated",M.health.deprecated,E.health.deprecated],["opened",M.activity.opened,E.activity.opened],["merged",M.activity.merged,E.activity.merged],["mergeRate",M.activity.mergeRate,E.activity.mergeRate]],C={};for(let[z,F,H]of N){let J=F-H;C[z]={current:F,previous:H,change:J,improved:j.has(z)?J>=0:J<=0}}return C}var $="<!-- buddy:report -->";function G(M){if(!M||M.change===0)return"\u2014";let E=M.change>0?"\u25B2":"\u25BC",j=M.change>0?"+":"";return`${E} ${j}${M.change}${M.improved?"":" \u26A0\uFE0F"}`}function T(M,E={}){let j=O[M.period],N=[$,"",`## Dependency report \u2014 last ${j} days`,"",`Generated ${M.generatedAt.slice(0,10)}.`,"","### Dependency health","","| Metric | Value | Change |","| --- | --- | --- |",`| Total dependencies | ${M.health.total} | |`,`| Outdated | ${M.health.outdated} (${M.health.outdatedPercent}%) | ${G(E.outdated)} |`,`| A major behind | ${M.health.majorBehind} | ${G(E.majorBehind)} |`,`| With known advisories | ${M.health.vulnerable} | ${G(E.vulnerable)} |`,`| Deprecated | ${M.health.deprecated} | ${G(E.deprecated)} |`];if(M.health.drifted>0)N.push(`| Held back by a dependant | ${M.health.drifted} | |`);N.push("","### By ecosystem","");let C=Object.entries(M.health.byEcosystem).filter(([,z])=>z>0).sort(([,z],[,F])=>F-z);if(C.length===0)N.push("No dependencies detected.");else{N.push("| Ecosystem | Dependencies |","| --- | --- |");for(let[z,F]of C)N.push(`| ${z} | ${F} |`)}if(N.push("","### Bot activity","","| Metric | Value | Change |","| --- | --- | --- |",`| Pull requests opened | ${M.activity.opened} | ${G(E.opened)} |`,`| Merged | ${M.activity.merged} | ${G(E.merged)} |`,`| Closed without merging | ${M.activity.closed} | |`,`| Currently open | ${M.activity.open} | |`),M.activity.medianHoursToMerge!==null)N.push(`| Median time to merge | ${w(M.activity.medianHoursToMerge)} | |`);if(N.push(`| Merged vs opened | ${M.activity.mergeRate}% | ${G(E.mergeRate)} |`),N.push("",`_"Merged vs opened" compares both counts within the same ${j}-day window, so`,"recently opened pull requests depress it by definition._"),Object.keys(E).length===0)N.push("","_No previous report to compare against; this is the baseline._");return N.join(`
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import"./chunk-s3ksf6s5.js";var z={error:"error",warning:"warning",info:"notice"};function E(j){let q=[];for(let h of j.findings){let x=[`file=${h.file}`,`title=${h.ruleId}`];if(h.line!==void 0)x.push(`line=${h.line}`);let y=B(`${h.message}${h.fix?` \u2014 ${h.fix}`:""}`);q.push(`::${z[h.severity]} ${x.join(",")}::${y}`)}return q.join(`
2
+ import"./chunk-kbvj6qxc.js";var z={error:"error",warning:"warning",info:"notice"};function E(j){let q=[];for(let h of j.findings){let x=[`file=${h.file}`,`title=${h.ruleId}`];if(h.line!==void 0)x.push(`line=${h.line}`);let y=B(`${h.message}${h.fix?` \u2014 ${h.fix}`:""}`);q.push(`::${z[h.severity]} ${x.join(",")}::${y}`)}return q.join(`
3
3
  `)}function B(j){return j.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
4
4
  `,"%0A")}export{E as formatGitHub};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Gc as a,Hc as b,Ic as c}from"./chunk-0m1z85m9.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{b as stripOperators,a as scanEcosystems,c as regenerateLockfiles};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{wh as M}from"./chunk-6k6dgwmy.js";import{Ih as K}from"./chunk-a3bnhq58.js";import{Oh as J}from"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.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{xh as M}from"./chunk-2z9pkk1y.js";import{Jh as K}from"./chunk-b9szrnxw.js";import{Ph as J}from"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.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};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ge as a,he as b}from"./chunk-142zh7e5.js";import"./chunk-kbvj6qxc.js";export{b as auditParsed,a as audit};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{La as a,Ma as b,Na as c,Oa as d,Pa as e,Qa as f,Ra as g,Sa as h,Ta as i,Ua as j}from"./chunk-k3x0mabj.js";import"./chunk-y7z0br2x.js";import"./chunk-ggzjv4s0.js";import"./chunk-emygmh7r.js";import"./chunk-kpqez1ht.js";import"./chunk-a3bnhq58.js";import"./chunk-8dj94fsy.js";import"./chunk-s3ksf6s5.js";export{c as stripNonCommandContext,d as parseCommand,f as mentionsBot,e as isReadOnlyCommand,i as dispatchCommand,j as createHandlers,h as checkPermission,b as READ_ONLY_COMMANDS,g as HELP_TEXT,a as COMMAND_ALIASES};
2
+ import{La as a,Ma as b,Na as c,Oa as d,Pa as e,Qa as f,Ra as g,Sa as h,Ta as i,Ua as j}from"./chunk-42xvqxdw.js";import"./chunk-59993g25.js";import"./chunk-va3k91tf.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{c as stripNonCommandContext,d as parseCommand,f as mentionsBot,e as isReadOnlyCommand,i as dispatchCommand,j as createHandlers,h as checkPermission,b as READ_ONLY_COMMANDS,g as HELP_TEXT,a as COMMAND_ALIASES};
@@ -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-s3ksf6s5.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-kbvj6qxc.js";export{c as findDrift,a as driftFor,d as describeDrift,b as ROOT};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ch as a}from"./chunk-k3r7v3dp.js";import"./chunk-vpw7adwd.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{a as GitLabProvider};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qe as a,Re as b,Se as c,Te as d,Ue as e,Ve as f}from"./chunk-1xe0960b.js";import"./chunk-b9szrnxw.js";import"./chunk-x1w6q9tk.js";import"./chunk-kbvj6qxc.js";export{e as updateDockerfile,d as resolveDockerDigest,b as parseDockerfile,a as isDockerfile,f as generateDockerfileUpdates,c as fetchLatestDockerImageVersion};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as Z}from"./chunk-ggzjv4s0.js";import{Xc as X}from"./chunk-tx9m7y1z.js";import{Sd as x,de as V}from"./chunk-be059ncv.js";import{me as U,ne as Y}from"./chunk-34rmja4x.js";import H from"process";var K=[["actionlint","actionlint"],["shellcheck","shellcheck"],["hadolint","hadolint"],["markdownlint","markdownlint"]];async function T(j,J={}){let W=J.env??H.env,Q=J.cwd??H.cwd(),F=J.hasCommand??x,G=[];G.push({name:"bun",status:"ok",detail:`Bun ${Bun.version}`});let C=await Bun.file(`${Q}/.git/HEAD`).exists();G.push(C?{name:"git repository",status:"ok",detail:Q}:{name:"git repository",status:"fail",detail:`${Q} is not a git repository`,remediation:"Run buddy from inside a repository, or run `git init`."});let $=X(j);G.push($.length===0?{name:"configuration",status:"ok",detail:"valid"}:{name:"configuration",status:"fail",detail:`${$.length} problem(s): ${$.slice(0,3).map((q)=>`${q.path} ${q.message}`).join("; ")}`,remediation:"Fix the paths reported above in buddy.config.ts."});let P=Boolean(j.repository?.owner&&j.repository.name);G.push(P?{name:"repository config",status:"ok",detail:`${j.repository.owner}/${j.repository.name}`}:{name:"repository config",status:"warn",detail:"owner and name are not set",remediation:"Set repository.owner and repository.name, or run in Actions where GITHUB_REPOSITORY is available. Local review works without them."});let B=j.repository?.provider??"github",D=j.repository?.token?{token:j.repository.token,source:"repository.token"}:Y(B,W);G.push(D?{name:"git token",status:"ok",detail:`found in ${D.source}`}:{name:"git token",status:"warn",detail:"no token found",remediation:`Set one of ${(U[B]??[]).join(", ")}. Local review does not need one.`});let b=Z(j,W);G.push(b?{name:"ai provider",status:"ok",detail:`${b.provider} via ${b.apiKeyEnv}`}:{name:"ai provider",status:"warn",detail:"no API key found",remediation:"Set ANTHROPIC_API_KEY (or OPENAI_API_KEY / GOOGLE_API_KEY). Dependency updates and static analysis work without one."});for(let[q,M]of K){let I=await F(M);G.push(I?{name:`analyzer: ${q}`,status:"ok",detail:`${M} found`}:{name:`analyzer: ${q}`,status:"warn",detail:`${M} not installed`,remediation:`Install ${M} to enable the ${q} analyzer. Reviews run without it and report it as skipped.`})}let w=V.filter((q)=>!K.some(([M])=>M===q.name)).map((q)=>q.name);return G.push({name:"native analyzers",status:"ok",detail:`${w.join(", ")} \u2014 always available`}),{checks:G,healthy:!G.some((q)=>q.status==="fail")}}var S={ok:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function E(j){let J=["","Buddy environment",""];for(let F of j.checks)if(J.push(`${S[F.status]} ${F.name}: ${F.detail}`),F.remediation)J.push(` \u2192 ${F.remediation}`);let W=j.checks.filter((F)=>F.status==="fail").length,Q=j.checks.filter((F)=>F.status==="warn").length;return J.push(""),J.push(j.healthy?`Ready. ${Q} optional capability/capabilities unavailable.`:`${W} problem(s) must be fixed before buddy can run.`),`${J.join(`
2
+ import{ec as Z}from"./chunk-va3k91tf.js";import{Yc as X}from"./chunk-v0y8eens.js";import{Td as x,ee as V}from"./chunk-0g4ybxwj.js";import{ne as U,oe as Y}from"./chunk-ctdfppxk.js";import H from"process";var K=[["actionlint","actionlint"],["shellcheck","shellcheck"],["hadolint","hadolint"],["markdownlint","markdownlint"]];async function T(j,J={}){let W=J.env??H.env,Q=J.cwd??H.cwd(),F=J.hasCommand??x,G=[];G.push({name:"bun",status:"ok",detail:`Bun ${Bun.version}`});let C=await Bun.file(`${Q}/.git/HEAD`).exists();G.push(C?{name:"git repository",status:"ok",detail:Q}:{name:"git repository",status:"fail",detail:`${Q} is not a git repository`,remediation:"Run buddy from inside a repository, or run `git init`."});let $=X(j);G.push($.length===0?{name:"configuration",status:"ok",detail:"valid"}:{name:"configuration",status:"fail",detail:`${$.length} problem(s): ${$.slice(0,3).map((q)=>`${q.path} ${q.message}`).join("; ")}`,remediation:"Fix the paths reported above in buddy.config.ts."});let P=Boolean(j.repository?.owner&&j.repository.name);G.push(P?{name:"repository config",status:"ok",detail:`${j.repository.owner}/${j.repository.name}`}:{name:"repository config",status:"warn",detail:"owner and name are not set",remediation:"Set repository.owner and repository.name, or run in Actions where GITHUB_REPOSITORY is available. Local review works without them."});let B=j.repository?.provider??"github",D=j.repository?.token?{token:j.repository.token,source:"repository.token"}:Y(B,W);G.push(D?{name:"git token",status:"ok",detail:`found in ${D.source}`}:{name:"git token",status:"warn",detail:"no token found",remediation:`Set one of ${(U[B]??[]).join(", ")}. Local review does not need one.`});let b=Z(j,W);G.push(b?{name:"ai provider",status:"ok",detail:`${b.provider} via ${b.apiKeyEnv}`}:{name:"ai provider",status:"warn",detail:"no API key found",remediation:"Set ANTHROPIC_API_KEY (or OPENAI_API_KEY / GOOGLE_API_KEY). Dependency updates and static analysis work without one."});for(let[q,M]of K){let I=await F(M);G.push(I?{name:`analyzer: ${q}`,status:"ok",detail:`${M} found`}:{name:`analyzer: ${q}`,status:"warn",detail:`${M} not installed`,remediation:`Install ${M} to enable the ${q} analyzer. Reviews run without it and report it as skipped.`})}let w=V.filter((q)=>!K.some(([M])=>M===q.name)).map((q)=>q.name);return G.push({name:"native analyzers",status:"ok",detail:`${w.join(", ")} \u2014 always available`}),{checks:G,healthy:!G.some((q)=>q.status==="fail")}}var S={ok:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function E(j){let J=["","Buddy environment",""];for(let F of j.checks)if(J.push(`${S[F.status]} ${F.name}: ${F.detail}`),F.remediation)J.push(` \u2192 ${F.remediation}`);let W=j.checks.filter((F)=>F.status==="fail").length,Q=j.checks.filter((F)=>F.status==="warn").length;return J.push(""),J.push(j.healthy?`Ready. ${Q} optional capability/capabilities unavailable.`:`${W} problem(s) must be fixed before buddy can run.`),`${J.join(`
3
3
  `)}
4
4
  `}
5
5
  export{T as W,E as X};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-s3ksf6s5.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-kbvj6qxc.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};