@buddysh/buddy 0.11.15 → 0.11.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/bin/cli.js +19 -19
- package/dist/{chunk-mg67hhgj.js → chunk-0kce7e60.js} +1 -1
- package/dist/chunk-0n03s02h.js +2 -0
- package/dist/{chunk-s82adeq9.js → chunk-16aeend1.js} +1 -1
- package/dist/{chunk-qcvtp2mt.js → chunk-1a14rx5n.js} +1 -1
- package/dist/{chunk-sztjfky1.js → chunk-1g43mpqn.js} +1 -1
- package/dist/chunk-1k4p8wyx.js +2 -0
- package/dist/{chunk-m00hfvnp.js → chunk-1mkwhnsf.js} +1 -1
- package/dist/{chunk-6prz7chv.js → chunk-1pdvjg0x.js} +1 -1
- package/dist/{chunk-9kscva05.js → chunk-20ex3fxc.js} +1 -1
- package/dist/chunk-2309x9r7.js +2 -0
- package/dist/{chunk-jkn2sdm0.js → chunk-26yejy1v.js} +1 -1
- package/dist/{chunk-dkhherd0.js → chunk-2f7j0dmw.js} +1 -1
- package/dist/{chunk-drmk6r1m.js → chunk-2z9mh5y4.js} +1 -1
- package/dist/chunk-3jm67wxm.js +2 -0
- package/dist/chunk-3mnpvfg3.js +2 -0
- package/dist/chunk-485kgdtb.js +2 -0
- package/dist/{chunk-nn5rzwty.js → chunk-4chtv4nh.js} +1 -1
- package/dist/{chunk-7b156stw.js → chunk-4dz5x4xw.js} +1 -1
- package/dist/chunk-4jgf7sfa.js +2 -0
- package/dist/{chunk-01d81hn0.js → chunk-4r03rh93.js} +1 -1
- package/dist/{chunk-3a63hke8.js → chunk-4wv5s3vr.js} +1 -1
- package/dist/{chunk-a6hv92fx.js → chunk-51m5tgwp.js} +1 -1
- package/dist/chunk-5t07s3dv.js +2 -0
- package/dist/{chunk-ebnc6980.js → chunk-6gvx1g6h.js} +1 -1
- package/dist/{chunk-c4cj24qm.js → chunk-6kd81nf9.js} +2 -2
- package/dist/{chunk-j6geg3qt.js → chunk-6w0n6c07.js} +1 -1
- package/dist/{chunk-y1d6e0ye.js → chunk-743mhx0e.js} +1 -1
- package/dist/{chunk-eh71jv8w.js → chunk-7hm46cej.js} +1 -1
- package/dist/{chunk-t879n4ab.js → chunk-7p1b809h.js} +1 -1
- package/dist/chunk-8b7cwedf.js +2 -0
- package/dist/{chunk-dg2q6egm.js → chunk-8r2819xn.js} +1 -1
- package/dist/{chunk-4qv88x27.js → chunk-8wrbxhs3.js} +1 -1
- package/dist/{chunk-s5czyzje.js → chunk-9chq5m4p.js} +3 -3
- package/dist/chunk-9fagkyrp.js +2 -0
- package/dist/{chunk-kjhqe26r.js → chunk-9gabxm8n.js} +1 -1
- package/dist/{chunk-c9266b5x.js → chunk-a8wcn3mh.js} +1 -1
- package/dist/chunk-aann4nkc.js +2 -0
- package/dist/{chunk-zjp519wm.js → chunk-bafzw99p.js} +1 -1
- package/dist/{chunk-gcwg4b2w.js → chunk-bgb44971.js} +1 -1
- package/dist/{chunk-4fh7w98z.js → chunk-bw43q8k7.js} +1 -1
- package/dist/{chunk-v808b36p.js → chunk-byqzhgzs.js} +1 -1
- package/dist/{chunk-zy49dwqk.js → chunk-c63e4ssc.js} +2 -2
- package/dist/{chunk-xn2960z7.js → chunk-cb25v2mp.js} +1 -1
- package/dist/{chunk-ma01xp3y.js → chunk-d09qj570.js} +1 -1
- package/dist/chunk-dttp44vs.js +2 -0
- package/dist/{chunk-1znpbjrv.js → chunk-dxd0eg4r.js} +1 -1
- package/dist/{chunk-6np84pfr.js → chunk-ewhvahnb.js} +1 -1
- package/dist/{chunk-2z85fqdp.js → chunk-fsghqtgf.js} +2 -2
- package/dist/chunk-fzs7vpps.js +2 -0
- package/dist/{chunk-zpgm9yzy.js → chunk-g09atq0m.js} +1 -1
- package/dist/{chunk-k907b533.js → chunk-gg1ddvnf.js} +1 -1
- package/dist/chunk-gkb0gja4.js +2 -0
- package/dist/{chunk-rwz433q2.js → chunk-gq9gkyah.js} +2 -2
- package/dist/{chunk-92gh2n65.js → chunk-gvpsbmeg.js} +1 -1
- package/dist/{chunk-wf1jcxtr.js → chunk-h2f92qwd.js} +1 -1
- package/dist/{chunk-66nntsnf.js → chunk-hd74jxm2.js} +1 -1
- package/dist/{chunk-p16pnhj3.js → chunk-her5azyp.js} +1 -1
- package/dist/{chunk-4kyxrwxn.js → chunk-hk4d7rky.js} +1 -1
- package/dist/chunk-hxkxset4.js +2 -0
- package/dist/{chunk-9n1kth4b.js → chunk-j57716xw.js} +1 -1
- package/dist/chunk-jgq5d6s2.js +2 -0
- package/dist/{chunk-awjm9n45.js → chunk-km4aszfp.js} +1 -1
- package/dist/{chunk-ymh0kwm4.js → chunk-knhvdm94.js} +2 -2
- package/dist/{chunk-q9mxgp0n.js → chunk-kpsvwjac.js} +11 -11
- package/dist/chunk-kthwzc4p.js +2 -0
- package/dist/{chunk-028354j6.js → chunk-m3rftash.js} +7 -7
- package/dist/{chunk-bstgsak0.js → chunk-m9qtb4xj.js} +1 -1
- package/dist/{chunk-2b07w74s.js → chunk-mr2d1zp0.js} +1 -1
- package/dist/{chunk-xyzcgskb.js → chunk-mthd2c8m.js} +1 -1
- package/dist/{chunk-w2ccdet4.js → chunk-mtn4angk.js} +1 -1
- package/dist/chunk-n960rjcr.js +2 -0
- package/dist/{chunk-37zd94a7.js → chunk-nk8wxxy7.js} +2 -2
- package/dist/{chunk-eccac8h7.js → chunk-nzk13c4q.js} +1 -1
- package/dist/{chunk-cx89kty3.js → chunk-nznpzbq4.js} +1 -1
- package/dist/{chunk-hc2pdv4j.js → chunk-p9xksx9p.js} +1 -1
- package/dist/{chunk-n5mz7csc.js → chunk-pa7pav6h.js} +1 -1
- package/dist/{chunk-ym9475ry.js → chunk-pag93kz1.js} +1 -1
- package/dist/{chunk-bgw39afd.js → chunk-psjrcpgb.js} +1 -1
- package/dist/{chunk-q99xd3m5.js → chunk-pxfrq43h.js} +1 -1
- package/dist/chunk-q4j2f72t.js +2 -0
- package/dist/{chunk-fgec04jx.js → chunk-qbep9dk4.js} +1 -1
- package/dist/{chunk-j7qktvpg.js → chunk-qngnmrpw.js} +1 -1
- package/dist/chunk-r1jvyhhd.js +4 -0
- package/dist/{chunk-p2h2z6d3.js → chunk-r7qa2ykf.js} +2 -2
- package/dist/chunk-rqj1vrfs.js +2 -0
- package/dist/{chunk-34vracy4.js → chunk-s0ps33ft.js} +1 -1
- package/dist/{chunk-qjzpzd7j.js → chunk-s3b3vrsj.js} +1 -1
- package/dist/chunk-s4fccg73.js +2 -0
- package/dist/{chunk-zrec546r.js → chunk-sddaassq.js} +1 -1
- package/dist/{chunk-6qw89f68.js → chunk-sj7n6xa1.js} +1 -1
- package/dist/{chunk-t5hq4ke1.js → chunk-t1r2ycn7.js} +1 -1
- package/dist/{chunk-1tdkpeva.js → chunk-tjj6ttj1.js} +1 -1
- package/dist/{chunk-dq681xgx.js → chunk-tsd9jw07.js} +1 -1
- package/dist/{chunk-s609kp6h.js → chunk-ttkjzy0m.js} +1 -1
- package/dist/chunk-txe5z472.js +2 -0
- package/dist/chunk-vffz69jj.js +2 -0
- package/dist/{chunk-sn0qr6q7.js → chunk-vs61069x.js} +1 -1
- package/dist/{chunk-3a5gcj3y.js → chunk-wc2z7krw.js} +1 -1
- package/dist/{chunk-jn3t9v6d.js → chunk-wfg3bp85.js} +1 -1
- package/dist/{chunk-5sh69bkj.js → chunk-wfwrm4k3.js} +1 -1
- package/dist/{chunk-3nn2j810.js → chunk-whtdmv3p.js} +1 -1
- package/dist/{chunk-gjhxc6ma.js → chunk-wk175yyw.js} +1 -1
- package/dist/chunk-wn9vr9ct.js +2 -0
- package/dist/{chunk-zwtx6vn3.js → chunk-wzncz6j5.js} +1 -1
- package/dist/{chunk-m8brd9b5.js → chunk-y2ntnpdb.js} +1 -1
- package/dist/{chunk-xhn5331s.js → chunk-y5fdq7cd.js} +1 -1
- package/dist/{chunk-7t8s2mcf.js → chunk-yh13j2af.js} +1 -1
- package/dist/chunk-yr6qyeab.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/dist/src/utils/dependency-file-parser.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunk-18en5afz.js +0 -2
- package/dist/chunk-2bp1j0w0.js +0 -2
- package/dist/chunk-3578axtf.js +0 -2
- package/dist/chunk-3r0jb90q.js +0 -2
- package/dist/chunk-4x1mv7qj.js +0 -2
- package/dist/chunk-5qberaya.js +0 -2
- package/dist/chunk-86xv8x00.js +0 -2
- package/dist/chunk-87k997bm.js +0 -2
- package/dist/chunk-8jvmqdvc.js +0 -2
- package/dist/chunk-94tnmc7j.js +0 -4
- package/dist/chunk-c8xfj0m5.js +0 -2
- package/dist/chunk-cj5fkyxv.js +0 -2
- package/dist/chunk-d3m5kcpp.js +0 -2
- package/dist/chunk-dg1c0fyk.js +0 -2
- package/dist/chunk-fzfgvt8s.js +0 -2
- package/dist/chunk-j21m6rf6.js +0 -2
- package/dist/chunk-jjwxbcfz.js +0 -2
- package/dist/chunk-nd780ymh.js +0 -2
- package/dist/chunk-tmzd2p2n.js +0 -2
- package/dist/chunk-tqsrr90t.js +0 -2
- package/dist/chunk-v9avf6sc.js +0 -2
- package/dist/chunk-w2vsf1q0.js +0 -2
- package/dist/chunk-xjrb50hz.js +0 -2
- package/dist/chunk-y0rng1vc.js +0 -2
- package/dist/chunk-z0rsmhe4.js +0 -2
- package/dist/chunk-zcsahxe6.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$a as e,Xa as a,Ya as b,Za as c,_a as d,ab as f,bb as g,cb as h,db as i,eb as j,fb as k,gb as l}from"./chunk-jqh7vx2n.js";import"./chunk-1pecmenc.js";import"./chunk-
|
|
2
|
+
import{$a as e,Xa as a,Ya as b,Za as c,_a as d,ab as f,bb as g,cb as h,db as i,eb as j,fb as k,gb as l}from"./chunk-jqh7vx2n.js";import"./chunk-1pecmenc.js";import"./chunk-16aeend1.js";export{k as withTouchOffer,b as unitTestsTouch,d as simplifyTouch,i as renderTouchOffer,e as planTouch,l as parseTouchSelections,j as hasTouchOffer,g as getFinishingTouch,a as docstringsTouch,c as autofixTouch,h as TOUCH_OFFER_MARKER,f as FINISHING_TOUCHES};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qb as p,Rb as q,Sb as r,Tb as s,Ub as t,Vb as u,Wb as v,Xb as w,Yb as x}from"./chunk-
|
|
2
|
+
import{Qb as p,Rb as q,Sb as r,Tb as s,Ub as t,Vb as u,Wb as v,Xb as w,Yb as x}from"./chunk-vs61069x.js";import{$b as i,Zb as g,_b as h,ac as j,bc as k,cc as l,dc as m,ec as n,fc as o}from"./chunk-wfwrm4k3.js";import"./chunk-24xvskkf.js";import{Uf as a,Vf as b,Wf as c,Xf as d,Yf as e,Zf as f}from"./chunk-z18bksyr.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{s as serializeLearnings,v as selectLearnings,j as resolveModelAlias,n as resolveAiProvider,w as renderLearnings,d as redactError,c as redactDeep,b as redact,r as parseLearnings,x as loadLearnings,m as createOpenAiProvider,t as createLearning,l as createGoogleProvider,k as createAnthropicProvider,o as createAiClient,u as addLearning,a as REDACTED,i as PROVIDER_PRIORITY,h as PROVIDER_KEY_ENV,g as MODEL_ALIASES,q as DEFAULT_PROMPT_LIMIT,p as DEFAULT_LEARNINGS_FILE,f as AiProviderError,e as AiBudgetExceededError};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ud as R}from"./chunk-
|
|
2
|
+
import{ud as R}from"./chunk-s3b3vrsj.js";import{re as F,se as A}from"./chunk-743mhx0e.js";import{Bf as S}from"./chunk-1pecmenc.js";import{Rf as L}from"./chunk-hk4d7rky.js";import{Oh as K,Rh as O}from"./chunk-wzncz6j5.js";import{gl as P}from"./chunk-16aeend1.js";var b=[{kind:"lockfile-drift",mechanical:!0,patterns:[/lockfile had changes, but lockfile is frozen/i,/your lockfile does not satisfy your workspace/i,/the lockfile (?:is|was) out of date/i,/npm ci can only install packages when your package\.json and package-lock\.json .* are in sync/i,/composer\.lock is not up to date/i]},{kind:"flake",mechanical:!0,patterns:[/\bECONNRESET\b|\bETIMEDOUT\b|\bENOTFOUND\b|\bEAI_AGAIN\b/,/socket hang up/i,/502 Bad Gateway|503 Service Unavailable|504 Gateway Time-?out/i,/rate limit exceeded/i,/the runner has received a shutdown signal/i]},{kind:"install",mechanical:!1,patterns:[/could not resolve (?:dependency|host)/i,/no matching version found for/i,/unable to resolve dependency tree/i,/peer dep(?:endency)? .* conflict/i]},{kind:"type-error",mechanical:!1,patterns:[/error TS\d{4}:/,/\berror\[E\d+\]:/,/Type '.*' is not assignable to type/]},{kind:"test-failure",mechanical:!1,patterns:[/\d+ (?:tests? )?fail(?:ed|ing)\b/i,/\(fail\)/,/AssertionError|expect\(received\)/,/\u25CF .* \u203A /]},{kind:"lint",mechanical:!1,patterns:[/\b\d+ problems? \(\d+ errors?/i,/eslint|pickier|biome|oxlint/i]}];function N(x){if(!x.trim())return{kind:"unknown",mechanical:!1,evidence:[]};let H=x.split(`
|
|
3
3
|
`);for(let z of b){let J=[];for(let V of H)if(z.patterns.some((Q)=>Q.test(V))){if(J.push(V.trim()),J.length>=5)break}if(J.length>0)return{kind:z.kind,mechanical:z.mechanical,evidence:J}}return{kind:"unknown",mechanical:!1,evidence:T(H)}}function T(x,H=40){let z=x.filter((J)=>/\b(?:error|failed|failure|exception|panic|fatal)\b/i.test(J)&&!/^\s*(?:at\s|\s*\.\.\.)/.test(J));return(z.length>0?z:x.slice(-H)).slice(-H).map((J)=>J.trim()).filter(Boolean)}function G(x){switch(x.kind){case"lockfile-drift":return"The lock file is out of step with its manifest.";case"flake":return"A network or runner problem, unrelated to the change.";case"install":return"Dependencies could not be resolved.";case"type-error":return"The change does not type-check.";case"test-failure":return"One or more tests failed.";case"lint":return"Lint or formatting checks failed.";default:return"The failure could not be classified automatically."}}var w=3;async function M(x,H,z,J){let V=J??O();try{let Q=await x.listWorkflowRuns(H,{status:"completed",limit:20});for(let Y of _(Q).slice(0,w)){let Z=await x.getWorkflowRunLogs(Y.id);if(!Z)continue;if(N(Z).kind===z)return V.info(`\uD83E\uDDED ${H} already fails the same way (run ${Y.id}) \u2014 not this pull request's to fix`),!0}return!1}catch(Q){return V.debug(`Could not check ${H} for a pre-existing failure: ${K(Q)}`),!1}}function _(x){let H=new Map;for(let z of x)if(!H.has(z.name))H.set(z.name,z);return[...H.values()].filter((z)=>z.conclusion==="failure")}function h(x,H){if(!x)return"Tried to regenerate the lock file, but the install did not succeed.";if(!H)return"Regenerated the lock file, but could not push it to the branch. The change is in the workspace only, so the run will still be red until someone commits it.";return"Regenerated the lock file and pushed the result. No model was needed."}function f(x){let H="Repairs run on the pull request's branch, and answering a comment runs on the default branch, so anything I changed here would land on the wrong tree. ";if(x.kind==="lockfile-drift")return`Regenerating the lock file would fix this, and no model would be needed. ${H}The \`fix-ci\` job will do it on the next failing run, or you can run \`buddy fix-ci --run-id <id> --pr <number>\` yourself.`;return`${H}The \`fix-ci\` job runs on the failing run itself and can repair this; this reply is the diagnosis it would start from.`}async function I(x){let H=x.logger??O(),z=N(x.log),J=x.maxAttempts??3;if(H.info(`\uD83E\uDE7A CI failure classified as ${z.kind}`),x.failsOnBase??(x.checkBase?await x.checkBase(z.kind):!1))return{failure:z,action:"skipped",fixed:!1,report:$(z,"This failure also occurs on the base branch, so it is not caused by this change. Fixing it here would only mask it.")};if((x.priorAttempts??0)>=J)return{failure:z,action:"skipped",fixed:!1,report:$(z,`Already attempted ${x.priorAttempts} time(s); stopping rather than looping.`)};if(x.analysisOnly&&z.kind!=="flake")return{failure:z,action:"reported",fixed:!1,report:$(z,f(z))};if(z.kind==="lockfile-drift"&&x.regenerateLockfile){if(x.dryRun)return{failure:z,action:"mechanical-fix",fixed:!1,report:$(z,"Regenerating the lock file would fix this. No model would be needed. Nothing was changed, because this was a dry run.")};H.info("\uD83D\uDD27 Regenerating the lock file");let{regenerated:Y,pushed:Z}=await x.regenerateLockfile();return{failure:z,action:"mechanical-fix",fixed:Z,report:$(z,h(Y,Z))}}if(z.kind==="flake"){if(x.dryRun)return{failure:z,action:"retry",fixed:!1,report:$(z,"This looks transient, and re-running the failed jobs would likely clear it. Nothing was changed, because this was a dry run.")};if(!x.rerun)return{failure:z,action:"retry",fixed:!1,report:$(z,"This looks transient. Re-running the failed job is likely to clear it.")};H.info("\uD83D\uDD01 Re-running the failed jobs");let Y=await x.rerun();return{failure:z,action:"retry",fixed:!1,report:$(z,Y?"This looks transient, so I re-ran the failed jobs. No model was needed.":"This looks transient, but I could not re-run the failed jobs \u2014 `actions: write` is the usual reason. "+"Re-running them from the Actions tab is likely to clear it.")}}if(!x.ai)return{failure:z,action:"reported",fixed:!1,report:$(z,"No AI provider is configured, so this needs a human. See https://buddy.sh/ai/providers to enable automatic repair.")};let Q=await L(x.ai,{mode:S,task:["A CI job on this branch is failing. Diagnose the root cause and fix it if the fix is clear.","",`Classification: ${z.kind} \u2014 ${G(z)}`,"","Relevant log lines:",z.evidence.join(`
|
|
4
4
|
`),"","Verify your fix by running the project's tests or build before reporting it done.","If the fix is not clear, explain what you found rather than guessing."].join(`
|
|
5
5
|
`),context:{workspace:x.workspace,baseBranch:x.baseBranch,...x.branch?{branch:x.branch}:{}},logger:H});return{failure:z,action:"agent-fix",fixed:Q.stopReason==="completed",report:$(z,Q.output||"The repair run ended without a conclusion.")}}function $(x,H){let z=`## \uD83E\uDE7A CI failure analysis
|
|
@@ -20,8 +20,8 @@ ${x.evidence.slice(0,20).join(`
|
|
|
20
20
|
${JSON.stringify(J)}
|
|
21
21
|
-->`;return`${(x??"").replace(B,"").trimEnd()}
|
|
22
22
|
|
|
23
|
-
${V}`}async function m(x,H,z){if(!F(x,"ciRuns","listWorkflowRuns"))return null;try{let J=await x.getPullRequestHeadSha(H.number),V=await x.listWorkflowRuns(H.head,{status:"completed",limit:30}),Q=J?V.filter((Y)=>Y.headSha===J):V;return _(Q)[0]?.id??null}catch(J){return z.debug(`Could not resolve the failing run for #${H.number}: ${K(J)}`),null}}async function c(x){let H=x.logger??O(),{config:z,provider:J}=x,V=x.workspace??process.cwd();A(J,"ciLogs","getWorkflowRunLogs","reading CI logs");let Q;if(x.prNumber){if(Q=(await J.getPullRequests("open")).find((W)=>W.number===x.prNumber),!Q)return`Could not find open pull request #${x.prNumber}.`}let Y=x.runId??(Q?await m(J,Q,H):null);if(!Y)return Q?"Nothing is failing at the head of this pull request, so there is nothing to diagnose.":"No run to diagnose. Pass --run-id, or --pr so I can find the failing run myself.";let Z=await J.getWorkflowRunLogs(Y);if(!Z)return H.warn(`\u26A0\uFE0F Could not read the logs for run ${Y}; nothing to diagnose`),`Could not read the logs for run ${Y}. They may have expired.`;let U=E(Q?.body)?.attempts??0,j=z.repository?.baseBranch??"main",D=F(J,"ciRuns","listWorkflowRuns"),y=F(J,"ciRuns","rerunWorkflowRun"),{createAiClient:v}=await import("./chunk-
|
|
23
|
+
${V}`}async function m(x,H,z){if(!F(x,"ciRuns","listWorkflowRuns"))return null;try{let J=await x.getPullRequestHeadSha(H.number),V=await x.listWorkflowRuns(H.head,{status:"completed",limit:30}),Q=J?V.filter((Y)=>Y.headSha===J):V;return _(Q)[0]?.id??null}catch(J){return z.debug(`Could not resolve the failing run for #${H.number}: ${K(J)}`),null}}async function c(x){let H=x.logger??O(),{config:z,provider:J}=x,V=x.workspace??process.cwd();A(J,"ciLogs","getWorkflowRunLogs","reading CI logs");let Q;if(x.prNumber){if(Q=(await J.getPullRequests("open")).find((W)=>W.number===x.prNumber),!Q)return`Could not find open pull request #${x.prNumber}.`}let Y=x.runId??(Q?await m(J,Q,H):null);if(!Y)return Q?"Nothing is failing at the head of this pull request, so there is nothing to diagnose.":"No run to diagnose. Pass --run-id, or --pr so I can find the failing run myself.";let Z=await J.getWorkflowRunLogs(Y);if(!Z)return H.warn(`\u26A0\uFE0F Could not read the logs for run ${Y}; nothing to diagnose`),`Could not read the logs for run ${Y}. They may have expired.`;let U=E(Q?.body)?.attempts??0,j=z.repository?.baseBranch??"main",D=F(J,"ciRuns","listWorkflowRuns"),y=F(J,"ciRuns","rerunWorkflowRun"),{createAiClient:v}=await import("./chunk-8wrbxhs3.js"),C=await I({log:Z,priorAttempts:U,workspace:V,baseBranch:j,ai:x.analysisOnly?null:v(z,H),logger:H,dryRun:Boolean(x.dryRun),analysisOnly:Boolean(x.analysisOnly),...D?{checkBase:(X)=>M({listWorkflowRuns:(W,k)=>J.listWorkflowRuns(W,k),getWorkflowRunLogs:(W)=>J.getWorkflowRunLogs(W)},j,X,H)}:{},...y?{rerun:()=>J.rerunWorkflowRun(Y)}:{},...x.analysisOnly?{}:{regenerateLockfile:()=>g(V,H)}});if(H.info(`
|
|
24
24
|
${C.report}
|
|
25
|
-
`),x.prNumber&&!x.dryRun){if(await J.createComment(x.prNumber,C.report),C.action!=="skipped"&&Q)try{await J.updatePullRequest(x.prNumber,{body:q(Q.body,U+1)})}catch(X){H.warn(`Could not record the fix attempt on PR #${x.prNumber}: ${K(X)}`)}}return await R(z.notifications,"fixci.completed",{...x.prNumber?{number:x.prNumber}:{},action:C.action,fixed:C.fixed}),`${C.action}${C.fixed?" (fixed)":""}`}async function g(x,H){let{regenerateLockFile:z,detectRequiredPackageManagers:J,getAllLockFilePaths:V,hasLockFile:Q}=await import("./chunk-
|
|
25
|
+
`),x.prNumber&&!x.dryRun){if(await J.createComment(x.prNumber,C.report),C.action!=="skipped"&&Q)try{await J.updatePullRequest(x.prNumber,{body:q(Q.body,U+1)})}catch(X){H.warn(`Could not record the fix attempt on PR #${x.prNumber}: ${K(X)}`)}}return await R(z.notifications,"fixci.completed",{...x.prNumber?{number:x.prNumber}:{},action:C.action,fixed:C.fixed}),`${C.action}${C.fixed?" (fixed)":""}`}async function g(x,H){let{regenerateLockFile:z,detectRequiredPackageManagers:J,getAllLockFilePaths:V,hasLockFile:Q}=await import("./chunk-3mnpvfg3.js"),{commitAndPush:Y}=await import("./chunk-qngnmrpw.js"),Z=J(["package.json","composer.json"],x).filter((j)=>Q(j,x)),U=!1;for(let j of Z){let D=await z(j,x);if(D.success)U=!0;else H.warn(`\u26A0\uFE0F ${D.message}`)}if(!U)return{regenerated:!1,pushed:!1};try{return{regenerated:!0,pushed:await Y(V(),`fix(deps): regenerate the lock file
|
|
26
26
|
|
|
27
27
|
The lock file had drifted from the manifest, which failed CI.`,x)}}catch(j){return H.warn(`\u26A0\uFE0F Could not push the regenerated lock file: ${K(j)}`),{regenerated:!0,pushed:!1}}}export{N as Ea,T as Fa,G as Ga,M as Ha,_ as Ia,I as Ja,c as Ka};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as a,ba as b,ca as c,da as d,ea as e,fa as f,ga as g,ha as h,ia as i,ja as j}from"./chunk-69qyr9ef.js";import"./chunk-
|
|
2
|
+
import{aa as a,ba as b,ca as c,da as d,ea as e,fa as f,ga as g,ha as h,ia as i,ja as j}from"./chunk-69qyr9ef.js";import"./chunk-16aeend1.js";export{d as similarity,j as renderQuickLinks,b as renderPackageContext,h as parseQuickSelection,a as findMentionedPackages,e as findDuplicates,c as constrainLabels,i as clearQuickSelection,f as QUICK_LINKS_MARKER,g as QUICK_ACTIONS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ch as B,Dh as E}from"./chunk-yh13j2af.js";import{Lh as z}from"./chunk-s0ps33ft.js";import{Rh as A}from"./chunk-wzncz6j5.js";class H{logger;constructor(b){this.logger=b??A()}async checkDeprecatedDependencies(b){let j=[];for(let q of b){let w=await this.checkFileForDeprecatedDependencies(q);j.push(...w)}return j}async checkFileForDeprecatedDependencies(b){let j=[];for(let q of b.dependencies){let w=await this.checkDependencyDeprecation(q,b.type);if(w.deprecated)j.push({name:q.name,currentVersion:q.currentVersion,datasource:this.getDatasourceFromFileType(b.type),file:b.path,type:q.type,replacementAvailable:!1,deprecationMessage:w.message,suggestedReplacement:w.suggestedReplacement})}return j}async checkDependencyDeprecation(b,j){try{if(j==="package.json"||j.includes("lock"))return await this.checkNpmDeprecation(b);else if(j==="composer.json"||j==="composer.lock")return await this.checkComposerDeprecation(b);else if(j==="deps.yaml"||j==="deps.yml"||j.includes("deps"))return await this.checkBunDeprecation(b);return{deprecated:!1}}catch(q){return this.logger.warn(`Failed to check deprecation for ${b.name}:`,q),{deprecated:!1}}}async checkNpmDeprecation(b){try{let j=B(b.name),q=await z(`${j}/${encodeURIComponent(b.name).replace("%40","@")}`,{headers:{"User-Agent":"buddy"}});if(!q.ok)return{deprecated:!1};let w=await q.json();if(w.deprecated)return{deprecated:!0,message:w.deprecated,suggestedReplacement:this.extractSuggestedReplacement(w.deprecated)};let x=w.versions?.[b.currentVersion];if(x?.deprecated)return{deprecated:!0,message:x.deprecated,suggestedReplacement:this.extractSuggestedReplacement(x.deprecated)};return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check npm deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkComposerDeprecation(b){try{let j=await z(`${E()}/packages/${b.name}.json`,{headers:{"User-Agent":"buddy"}});if(!j.ok)return{deprecated:!1};let q=await j.json();if(q.package?.abandoned){let w=typeof q.package.abandoned==="string"?q.package.abandoned:null;return{deprecated:!0,message:`Package is abandoned${w?`, use ${w} instead`:""}`,suggestedReplacement:w||void 0}}return{deprecated:!1}}catch(j){return this.logger.warn(`Failed to check Composer deprecation for ${b.name}:`,j),{deprecated:!1}}}async checkBunDeprecation(b){return await this.checkNpmDeprecation(b)}extractSuggestedReplacement(b){let j=[/use\s+([a-z0-9@/-]+)\s+instead/i,/replaced\s+by\s+([a-z0-9@/-]+)/i,/migrate\s+to\s+([a-z0-9@/-]+)/i,/switch\s+to\s+([a-z0-9@/-]+)/i];for(let q of j){let w=b.match(q);if(w)return w[1]}return}getDatasourceFromFileType(b){if(b==="package.json"||b.includes("lock"))return"npm";else if(b==="composer.json"||b==="composer.lock")return"composer";else if(b==="deps.yaml"||b==="deps.yml"||b.includes("deps"))return"bun";else if(b==="github-actions")return"github-actions";return"unknown"}}
|
|
3
3
|
export{H as fd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ed as a}from"./chunk-kpsvwjac.js";import"./chunk-a8wcn3mh.js";import"./chunk-knhvdm94.js";import"./chunk-mthd2c8m.js";import"./chunk-bnp0r4eh.js";import"./chunk-0f1xye20.js";import"./chunk-hd74jxm2.js";import"./chunk-6gvx1g6h.js";import"./chunk-743mhx0e.js";import"./chunk-d09qj570.js";import"./chunk-wk175yyw.js";import"./chunk-4wv5s3vr.js";import"./chunk-gvpsbmeg.js";import"./chunk-j46f90n8.js";import"./chunk-7hm46cej.js";import"./chunk-wc2z7krw.js";import"./chunk-1pecmenc.js";import"./chunk-hk4d7rky.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-cj4d5ad7.js";import"./chunk-c63e4ssc.js";import"./chunk-x9vpk4kk.js";import"./chunk-r1jvyhhd.js";import"./chunk-2z9mh5y4.js";import"./chunk-yh13j2af.js";import"./chunk-6w0n6c07.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{a as Buddy};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ec as X}from"./chunk-
|
|
2
|
+
import{ec as X}from"./chunk-wfwrm4k3.js";import{Yc as I}from"./chunk-4r03rh93.js";import{Td as C,ee as P}from"./chunk-mr2d1zp0.js";import{ne as x,oe as V}from"./chunk-743mhx0e.js";import Y from"process";var Z=[["actionlint","actionlint"],["shellcheck","shellcheck"],["hadolint","hadolint"],["markdownlint","markdownlint"]];async function R(q,J={}){let W=J.env??Y.env,Q=J.cwd??Y.cwd(),F=J.hasCommand??C,G=[];G.push({name:"bun",status:"ok",detail:`Bun ${Bun.version}`});let H=!1,$;try{let j=Bun.spawn(["git","rev-parse","--is-inside-work-tree"],{cwd:Q,stdout:"pipe",stderr:"ignore",timeout:5000}),[M,D]=await Promise.all([j.exited,new Response(j.stdout).text()]);H=M===0&&D.trim()==="true"}catch(j){$=j instanceof Error?j.message:String(j)}G.push(H?{name:"git repository",status:"ok",detail:Q}:{name:"git repository",status:"fail",detail:$?`Git could not inspect ${Q}: ${$}`:`${Q} is not a git repository`,remediation:$?"Check that Git is installed and the working directory exists.":"Run buddy from inside a repository, or run `git init`."});let b=I(q);G.push(b.length===0?{name:"configuration",status:"ok",detail:"valid"}:{name:"configuration",status:"fail",detail:`${b.length} problem(s): ${b.slice(0,3).map((j)=>`${j.path} ${j.message}`).join("; ")}`,remediation:"Fix the paths reported above in buddy.config.ts."});let S=Boolean(q.repository?.owner&&q.repository.name);G.push(S?{name:"repository config",status:"ok",detail:`${q.repository.owner}/${q.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 K=q.repository?.provider??"github",U=q.repository?.token?{token:q.repository.token,source:"repository.token"}:V(K,W);G.push(U?{name:"git token",status:"ok",detail:`found in ${U.source}`}:{name:"git token",status:"warn",detail:"no token found",remediation:`Set one of ${(x[K]??[]).join(", ")}. Local review does not need one.`});let B=X(q,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[j,M]of Z){let D=await F(M);G.push(D?{name:`analyzer: ${j}`,status:"ok",detail:`${M} found`}:{name:`analyzer: ${j}`,status:"warn",detail:`${M} not installed`,remediation:`Install ${M} to enable the ${j} analyzer. Reviews run without it and report it as skipped.`})}let w=P.filter((j)=>!Z.some(([M])=>M===j.name)).map((j)=>j.name);return G.push({name:"native analyzers",status:"ok",detail:`${w.join(", ")} \u2014 always available`}),{checks:G,healthy:!G.some((j)=>j.status==="fail")}}var A={ok:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function E(q){let J=["","Buddy environment",""];for(let F of q.checks)if(J.push(`${A[F.status]} ${F.name}: ${F.detail}`),F.remediation)J.push(` \u2192 ${F.remediation}`);let W=q.checks.filter((F)=>F.status==="fail").length,Q=q.checks.filter((F)=>F.status==="warn").length;return J.push(""),J.push(q.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{R as W,E as X};
|
|
@@ -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-
|
|
2
|
+
import{Aa as d,Ba as e,Ca as f,xa as a,ya as b,za as c}from"./chunk-1a14rx5n.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{b as productFor,f as describeEol,c as cycleFor,d as checkEol,e as EOL_WARNING_DAYS,a as EOL_PRODUCTS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A as V0,B as z0,C as EQ,a as N,b as X,c as R,r as dQ,s as $0,t as HQ,x as F,y as U,z as AQ}from"./chunk-
|
|
2
|
+
import{A as V0,B as z0,C as EQ,a as N,b as X,c as R,r as dQ,s as $0,t as HQ,x as F,y as U,z as AQ}from"./chunk-nk8wxxy7.js";import"./chunk-16aeend1.js";import*as O from"fs/promises";import*as XQ from"fs";import*as T from"path";import*as FQ from"child_process";import*as M0 from"crypto";import*as A0 from"readline";function S(V){if(V.inputSchema.type!=="object")throw Error(`JSON schema for tool "${V.name}" must be an object, but got ${V.inputSchema.type}`);return{type:"custom",name:V.name,input_schema:V.inputSchema,description:V.description,run:V.run,parse:(Q)=>Q,...V.close?{close:V.close}:{}}}import*as b from"fs/promises";import*as C from"path";import{randomUUID as L0}from"crypto";var e=493,T0=420;function YQ(V,Q){let $=C.relative(V,Q);return $===""||!$.startsWith(".."+C.sep)&&$!==".."&&!C.isAbsolute($)}async function OQ(V,Q){for(let $ of V)if(YQ(await r(C.resolve($)),Q))return $;return}var y0=40;function QQ(V){let Q=V?.code;return typeof Q==="string"?Q:void 0}async function r(V){let Q=[],$=V,z=0;for(;;){let K;try{K=await b.realpath($)}catch(Z){let q;try{q=(await b.lstat($)).isSymbolicLink()}catch(Y){let W=QQ(Y);if(W!=="ENOENT"&&W!=="ENOTDIR")throw Y;let J=C.dirname($);if(J===$)throw Y;Q.push(C.basename($)),$=J;continue}if(!q)throw Z;if(++z>y0)throw Object.assign(Error("too many levels of symbolic links"),{code:"ELOOP"});$=C.resolve(C.dirname($),await b.readlink($));continue}return Q.length?C.join(K,...Q.reverse()):K}}async function fQ(V,Q,$){let z=$?.allowedRoots??[],K=await r(C.resolve(V)),Z;try{Z=await r(C.resolve(K,Q))}catch(Y){throw new U(n(Y,`path ${JSON.stringify(Q)}`))}if(YQ(K,Z)||await OQ(z,Z)!==void 0)return Z;let q=z.length?"the session's working directory and its other permitted directories":"the session's working directory";throw new U(`path ${JSON.stringify(Q)} is outside ${q}`)}async function RQ(V,Q){let $=C.dirname(V),z=C.join($,`.tmp-${process.pid}-${L0()}`),K;try{K=await b.open(z,"wx",T0),await K.writeFile(Q,"utf-8"),await K.sync(),await K.close(),K=void 0,await b.rename(z,V)}catch(Z){if(K)await K.close().catch(()=>{});throw await b.unlink(z).catch(()=>{}),Z}}function n(V,Q){let $=QQ(V);switch($){case"ENOENT":return`${Q}: no such file or directory`;case"EACCES":case"EPERM":return`${Q}: permission denied`;case"ENOTDIR":return`${Q}: not a directory`;case"EISDIR":return`${Q}: is a directory`;case"ELOOP":return`${Q}: too many levels of symbolic links`;case"ENAMETOOLONG":return`${Q}: file name too long`;case"ENOSPC":return`${Q}: no space left on device`;case"EMFILE":case"ENFILE":return`${Q}: too many open files`;default:return`${Q}: ${$!==void 0?`i/o error (${$})`:"i/o error"}`}}import*as G from"fs/promises";import*as uQ from"fs";import*as w from"path";import{execFile as b0}from"child_process";import{promisify as x0}from"util";import{Readable as v0}from"stream";import{pipeline as P0}from"stream/promises";var E0=x0(b0);async function F0(V){let{client:Q,sessionId:$}=V;if(!Q)return async()=>{};let z=HQ(Q),K=V.session;if(!K){if($===void 0)return async()=>{};z.warn("AgentToolContext.sessionId is deprecated and costs an extra session fetch; fetch the session once and set `session` instead",{component:"agent-tool-context"}),K=await Q.beta.sessions.retrieve($)}let Z=w.resolve(V.workdir,"skills"),q=[];for(let Y of K.agent.skills)try{let W=await Q.beta.skills.versions.retrieve(Y.version,{skill_id:Y.skill_id}),J=w.basename(W.name.trim());if(J===""||J==="."||J==="..")J=Y.skill_id;let H=w.resolve(Z,J);if(H!==Z&&!H.startsWith(Z+w.sep)){z.warn("skill name escapes the skills dir; skipping",{component:"agent-tool-context",name:W.name});continue}let M=await Q.beta.skills.versions.download(W.id,{skill_id:Y.skill_id});await G.rm(H,{recursive:!0,force:!0}),await G.mkdir(H,{recursive:!0,mode:e}),q.push(H),await mQ(M,H),z.info("downloaded skill",{component:"agent-tool-context",skill_id:Y.skill_id,version:W.id,dest:H})}catch(W){z.warn("failed to download skill",{component:"agent-tool-context",skill_id:Y.skill_id,error:String(W)})}return async()=>{for(let Y of q)await G.rm(Y,{recursive:!0,force:!0}).catch((W)=>{z.warn("failed to clean up skill",{component:"agent-tool-context",dest:Y,error:String(W)})})}}function f0(V){for(let Q of V){let $=Q.trim();if(!$)continue;if(w.isAbsolute($)||$.split(/[\\/]/).includes(".."))throw new R(`refusing to extract unsafe archive member: ${$}`)}}var LQ="skill archive listing is inconsistent; refusing to extract",g0={unzip:new Set(["-","d","?"]),tar:new Set(["-","d","C"])};function gQ(V){let Q=V.split(`
|
|
3
3
|
`);if(Q[Q.length-1]==="")Q.pop();return Q}function u0(V,Q){return/^[\x20-\x7E]+$/.test(Q)&&!/[\\^#]/.test(Q)&&!(V==="unzip"&&Q.startsWith("-"))}function S0(V,Q,$){let z=gQ(Q),K=gQ($);if(z.length!==K.length)throw new R(LQ);let Z=[],q=[];return z.forEach((Y,W)=>{if(g0[V].has(K[W].charAt(0))){Z.push(Y);return}if(!u0(V,Y))throw new R(`refusing to extract archive: cannot safely exclude member ${JSON.stringify(Y)}`);q.push(Y)}),{plain:Z,special:q}}async function SQ(V){for(let Q of await G.readdir(V,{withFileTypes:!0}))if(Q.isDirectory())await SQ(w.join(V,Q.name));else if(!Q.isFile())throw new R(LQ)}async function jQ(V,Q){try{let{stdout:$}=await E0(V,Q);return $}catch($){if(QQ($)==="ENOENT")throw new R(`skill extraction requires the \`${V}\` command, but it was not found on PATH`);throw $}}function m0(V){let Q,$=!1;for(let z of V){let K=z.trim().split("/").filter((q)=>q!==""&&q!==".");if(K.length===0)continue;let Z=K[0];if(Q===void 0)Q=Z;else if(Z!==Q)return"";if(K.length>1)$=!0}return Q!==void 0&&$?Q:""}async function mQ(V,Q){let $=w.join(Q,`.skill-archive-${process.pid}-${Date.now()}`);if(!V.body)throw new R("skill download response had no body");await P0(v0.fromWeb(V.body),uQ.createWriteStream($));let z=w.join(w.dirname(Q),`.skill-stage-${process.pid}-${Date.now()}`),K=w.join(w.dirname(Q),`.skill-exclude-${process.pid}-${Date.now()}`);try{let Z=await _0($,4),q=Z.length>=4&&Z[0]===80&&Z[1]===75&&Z[2]===3&&Z[3]===4,Y=q?"unzip":"tar",W=await jQ(Y,q?["-Z1",$]:["-tf",$]),J=await jQ(Y,q?["-Z","--h","--t",$]:["-tvf",$]),{plain:H,special:M}=S0(Y,W,J);f0([...H,...M]);let j=m0(H);if(await G.mkdir(z,{recursive:!0,mode:e}),H.length>0)await jQ(Y,await p0(Y,$,z,M,K));await SQ(z);let v=j?w.join(z,j):z,P=await G.readdir(v).catch((E)=>{throw QQ(E)==="ENOENT"?new R(LQ):E});for(let E of P)await G.rename(w.join(v,E),w.join(Q,E))}finally{await G.rm($,{force:!0}),await G.rm(K,{force:!0}),await G.rm(z,{recursive:!0,force:!0})}}async function p0(V,Q,$,z,K){let Z=z.map((q)=>q.replace(/[*?[\\]/g,"\\$&"));if(V==="unzip")return["-oq",Q,"-d",$,...Z.length>0?["-x",...Z]:[]];if(Z.length===0)return["-xf",Q,"-C",$];return await G.writeFile(K,Z.join(`
|
|
4
4
|
`)+`
|
|
5
5
|
`,{flag:"wx",mode:384}),["-xf",Q,"-C",$,"-X",K]}async function _0(V,Q){let $=await G.open(V,"r");try{let z=Buffer.alloc(Q),{bytesRead:K}=await $.read(z,0,Q,0);return z.subarray(0,K)}finally{await $.close()}}import*as q0 from"path";import{createHash as V1}from"crypto";import*as A from"fs/promises";import*as k from"path";import{constants as i}from"fs";import{createHash as h0,randomBytes as d0}from"crypto";var cQ=448,c0=384,n0=448,TQ=i.O_NOFOLLOW??0,i0=i.O_NONBLOCK??0;class D extends Error{constructor(V,Q){super(`path ${JSON.stringify(Q)} ${V}`);this.name="FileStoreError",this.reason=V,this.relPath=Q}}D.ESCAPES_ROOT="escapes the store root";D.IS_A_SYMLINK="is a symlink";D.NOT_A_FILE="is not a regular file";D.NOT_A_DIRECTORY="is not a directory";D.NOT_UTF8="is not valid utf-8";D.MOVE_DESTINATION_EXISTS="already exists";function yQ(V){return V.startsWith("/")&&!V.split("/").includes("..")}class l{constructor(V,Q,$=!1){this.hashes=new Map,this.rootPath=V,this.removedOnDispose=Q,this.decoder=$?new TextDecoder("utf-8",{fatal:!0}):void 0}static async open(V,Q){if(!l0())throw Error("FileStore requires O_NOFOLLOW support on this platform");let $=!1;try{await A.lstat(V)}catch(z){if(z.code!=="ENOENT")throw z;$=!0}return new l(k.resolve(V),$,Q?.utf8??!1)}async createRoot(){await a0(this.rootPath)}root(){return{path:this.rootPath,removedOnDispose:this.removedOnDispose}}async dispose(){if(!this.removedOnDispose)return;await A.rm(this.rootPath,{recursive:!0,force:!0})}async put(V,Q,$){let z=V.replace(/\\/g,"/");if(z.endsWith("/")||z.endsWith("/.")||z===""||z===".")throw new D(D.NOT_A_FILE,V);let K=this.resolveUnderRoot(V),Z=typeof Q==="string"?dQ(Q):Q;this.requireUtf8(V,Z),await pQ(this.rootPath,k.dirname(K)),await o0(K,Z,$?.executable??!1)}async get(V){let Q=this.resolveUnderRoot(V),$;try{$=await nQ(V,Q)}catch(K){if(K.code==="ENOENT")return null;throw K}let z;try{let K=await $.readFile();z=new Uint8Array(K.buffer,K.byteOffset,K.byteLength)}finally{await $.close()}return this.requireUtf8(V,z),z}async ls(V="/"){let Q=this.resolveUnderRoot(V);return new Set((await _Q(this.rootPath,V,Q)).map(([$])=>$))}async findSymlinks(V="/"){let Q=this.resolveUnderRoot(V);return t0(this.rootPath,V,Q)}async hashtree(V="/"){let Q=this.resolveUnderRoot(V),$=JQ.nowNs(),z=Object.create(null);for(let[K,Z]of await _Q(this.rootPath,V,Q)){let q=await this.hashViaCache(K,Z,$);if(q!==null)z[K]=q}return z}async hashFile(V){let Q=this.resolveUnderRoot(V),$;try{$=await A.lstat(Q,{bigint:!0})}catch(K){if(K.code==="ENOENT")return null;throw K}if($.isSymbolicLink())throw new D(D.IS_A_SYMLINK,V);if(!$.isFile())throw new D(D.NOT_A_FILE,V);let z=k.relative(this.rootPath,Q).split(k.sep).join("/");return this.hashViaCache(z,Q,JQ.nowNs())}async move(V,Q){let $=this.resolveUnderRoot(V),z=this.resolveUnderRoot(Q);if($===this.rootPath||z===this.rootPath)return;if(await A.stat(z).then(()=>!0,()=>!1))throw new D(D.MOVE_DESTINATION_EXISTS,Q);await pQ(this.rootPath,k.dirname(z)),await A.rename($,z)}async remove(V){let Q=this.resolveUnderRoot(V);if(Q===this.rootPath)return;let $;try{$=await A.lstat(Q,{bigint:!0})}catch(z){if(z.code==="ENOENT")return;throw z}if($.isDirectory())await A.rm(Q,{recursive:!0,force:!0});else try{await A.unlink(Q)}catch(z){if(z.code!=="ENOENT")throw z}}resolveUnderRoot(V){let Q=V.replace(/\\/g,"/").replace(/^\/+/,""),$=Q.split("/").filter((z)=>z!==""&&z!==".");if(k.posix.isAbsolute(Q)||$.includes(".."))throw new D(D.ESCAPES_ROOT,V);return $.length===0?this.rootPath:k.join(this.rootPath,...$)}requireUtf8(V,Q){if(!this.decoder)return;try{this.decoder.decode(Q)}catch{throw new D(D.NOT_UTF8,V)}}async hashViaCache(V,Q,$){let z;try{z=await A.lstat(Q,{bigint:!0})}catch(q){if(q.code==="ENOENT")return null;throw q}if(!z.isFile())return null;let K=this.hashes.get(V),Z;if(K!==void 0&&e0(K,z))Z=K.sha;else try{Z=await JQ.hashFile(Q)}catch(q){let Y=q.code;if(Y==="ENOENT"||q instanceof D)return null;if(Y==="ELOOP"||Y==="EMLINK")return null;throw q}if(Q1(z,$))this.hashes.set(V,{mtimeNs:z.mtimeNs,ctimeNs:z.ctimeNs,size:z.size,sha:Z});return Z}}l.isPathLegal=yQ;function l0(){return TQ!==0}async function a0(V){let Q=[],$=V;for(;;){try{await A.stat($);break}catch(K){let Z=K.code;if(Z!=="ENOENT"&&Z!=="ENOTDIR"&&Z!=="ELOOP")throw K}Q.push($);let z=k.dirname($);if(z===$)break;$=z}for(let z of Q.reverse())try{await A.mkdir(z,{mode:cQ})}catch(K){if(K.code!=="EEXIST")throw K}}async function pQ(V,Q){let $=k.relative(V,Q);if($==="")return;let z=V;for(let K of $.split(k.sep)){z=k.join(z,K);try{await A.mkdir(z,{mode:cQ})}catch(Z){if(Z.code!=="EEXIST")throw Z}}}async function o0(V,Q,$){let z=$?n0:c0,K=k.join(k.dirname(V),`.fs-${d0(8).toString("hex")}.tmp`),Z;try{Z=await A.open(K,i.O_WRONLY|i.O_CREAT|i.O_EXCL|TQ,z),await Z.writeFile(Q),await Z.close(),Z=void 0,await A.rename(K,V)}catch(q){if(Z)await Z.close().catch(()=>{});throw await A.unlink(K).catch(()=>{}),q}}async function nQ(V,Q){let $;try{$=await A.open(Q,i.O_RDONLY|TQ|i0)}catch(z){let K=z.code;if(K==="ELOOP"||K==="EMLINK")throw new D(D.IS_A_SYMLINK,V);throw z}try{if(!(await $.stat()).isFile())throw new D(D.NOT_A_FILE,V)}catch(z){throw await $.close().catch(()=>{}),z}return $}async function s0(V){let Q=h0("sha256"),$=await nQ(k.basename(V),V),z=new Uint8Array(1048576);try{for(;;){let{bytesRead:K}=await $.read(z,0,z.length);if(K===0)break;Q.update(z.subarray(0,K))}}finally{await $.close()}return Q.digest("hex")}async function _Q(V,Q,$){if(!await r0(Q,$))return[];let z=[];return await iQ($,(K,Z)=>{if(Z.isFile())z.push([k.relative(V,K).split(k.sep).join("/"),K])}),z.sort(),z}async function t0(V,Q,$){let z=(q)=>k.relative(V,q).split(k.sep).join("/"),K;try{K=await A.lstat($,{bigint:!0})}catch(q){let Y=q.code;if(Y==="ENOENT"||Y==="ENOTDIR")return new Set;throw q}if(K.isSymbolicLink())return new Set([z($)]);if(!K.isDirectory())throw new D(D.NOT_A_DIRECTORY,Q);let Z=new Set;return await iQ($,(q,Y)=>{if(Y.isSymbolicLink())Z.add(z(q))}),Z}async function r0(V,Q){let $;try{$=await A.lstat(Q,{bigint:!0})}catch(z){let K=z.code;if(K==="ENOENT"||K==="ENOTDIR")return!1;throw z}if(!$.isDirectory())throw new D(D.NOT_A_DIRECTORY,V);return!0}async function iQ(V,Q){let $=[V];while($.length){let z=$.pop(),K;try{K=await A.readdir(z,{withFileTypes:!0})}catch(Z){if(Z.code==="ENOENT")continue;throw Z}for(let Z of K){let q=k.join(z,Z.name);if(Q(q,Z),Z.isDirectory()&&!Z.isSymbolicLink())$.push(q)}}}function e0(V,Q){return Q.mtimeNs===V.mtimeNs&&Q.ctimeNs===V.ctimeNs&&Q.size===V.size}function Q1(V,Q){return(V.mtimeNs>V.ctimeNs?V.mtimeNs:V.ctimeNs)<Q-JQ.timestampTrustMarginNs}var $1=2000000000n,JQ={hashFile:s0,timestampTrustMarginNs:$1,nowNs:()=>BigInt(Date.now())*1000000n},lQ=l,hQ=Symbol.asyncDispose;if(hQ)Object.defineProperty(l.prototype,hQ,{value:l.prototype.dispose,configurable:!0,writable:!0});var I,g,BQ,$Q,MQ,B,a,DQ,f,K0,NQ,Z0,X0,bQ,vQ,aQ,oQ,xQ,sQ,tQ,WQ,UQ,rQ,eQ,z1=30000,o=".anthropic-memory-store",Y0=1;function Q0(V){return V1("sha256").update(`version ${Y0}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{re as p}from"./chunk-
|
|
2
|
+
import{re as p}from"./chunk-743mhx0e.js";import{Rh as E}from"./chunk-wzncz6j5.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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{tg as C,yg as B}from"./chunk-x9vpk4kk.js";import{Ag as v,Bg as x}from"./chunk-
|
|
2
|
+
import{tg as C,yg as B}from"./chunk-x9vpk4kk.js";import{Ag as v,Bg as x}from"./chunk-r1jvyhhd.js";import{zh as w}from"./chunk-yh13j2af.js";import{Lh as S}from"./chunk-s0ps33ft.js";import{gl as T}from"./chunk-16aeend1.js";var R={critical:"\uD83D\uDD34 Critical",high:"\uD83D\uDFE0 High",moderate:"\uD83D\uDFE1 Moderate",low:"\u26AA Low"};function F(J){let Q=J.filter((O)=>(O.securityAdvisories?.length??0)>0);if(Q.length===0)return"";let q=Q.reduce((O,Z)=>O+(Z.securityAdvisories?.length??0),0),X=`## \uD83D\uDD12 Security Advisories
|
|
3
3
|
|
|
4
4
|
`;X+=`This PR resolves ${q} known ${q===1?"vulnerability":"vulnerabilities"} `,X+=`across ${Q.length} ${Q.length===1?"package":"packages"}.
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import{tg as C,yg as B}from"./chunk-x9vpk4kk.js";import{Ag as v,Bg as x}from"./c
|
|
|
7
7
|
`,X+=`|---|---|---|---|---|
|
|
8
8
|
`;for(let O of Q)for(let Z of O.securityAdvisories??[]){let L=R[Z.severity]??Z.severity,_=Z.url?`[${Z.id}](${Z.url})`:Z.id,$=Z.aliases.length>0?` (${Z.aliases.join(", ")})`:"",G=Z.summary.replace(/\|/g,"\\|").replace(/\s*\n\s*/g," ").trim();X+=`| \`${O.name}\` | ${L} | ${_}${$} | \`${Z.fixedVersion??"n/a"}\` | ${G} |
|
|
9
9
|
`}return`${X}
|
|
10
|
-
`}async function u(J,Q){try{let q=Q.split("/").pop()||"";if(q==="package.json"){let X=JSON.parse(J),O=[];return W(X.dependencies,"dependencies",Q,O),W(X.devDependencies,"devDependencies",Q,O),W(X.peerDependencies,"peerDependencies",Q,O),W(X.optionalDependencies,"optionalDependencies",Q,O),{path:Q,type:"package.json",content:J,dependencies:O}}if(v(Q))return await x(Q,J);if(q==="composer.json"||q==="composer.lock"){let{parseComposerFile:X}=await import("./chunk-
|
|
10
|
+
`}async function u(J,Q){try{let q=Q.split("/").pop()||"";if(q==="package.json"){let X=JSON.parse(J),O=[];return W(X.dependencies,"dependencies",Q,O),W(X.devDependencies,"devDependencies",Q,O),W(X.peerDependencies,"peerDependencies",Q,O),W(X.optionalDependencies,"optionalDependencies",Q,O),{path:Q,type:"package.json",content:J,dependencies:O}}if(v(Q))return await x(Q,J);if(q==="composer.json"||q==="composer.lock"){let{parseComposerFile:X}=await import("./chunk-1pdvjg0x.js");return await X(Q,J)}return null}catch{return null}}function W(J,Q,q,X){if(!J)return;for(let[O,Z]of Object.entries(J))X.push({name:O,currentVersion:Z,type:Q,file:q})}function n(J){let{existsSync:Q}=T("fs"),{join:q}=T("path");if(Q(q(J,"bun.lockb"))||Q(q(J,"bun.lock")))return"bun";if(Q(q(J,"pnpm-lock.yaml")))return"pnpm";if(Q(q(J,"yarn.lock")))return"yarn";if(Q(q(J,"package-lock.json")))return"npm";return"bun"}function d(J,Q){if(Q)return Q;if(J.length===1){let Z=J[0];return`chore(deps): update dependency ${Z.name} to ${Z.newVersion}`}let q=J.filter((Z)=>Z.updateType==="major"),X=J.filter((Z)=>Z.updateType==="minor"),O=J.filter((Z)=>Z.updateType==="patch");if(q.length>0)return`chore(deps): update ${q.length} major dependencies`;else if(X.length>0)return`chore(deps): update ${X.length} minor dependencies`;else return`chore(deps): update ${O.length} patch dependencies`}function o(J,Q){if(Q)return Q;if(J.length===1){let X=J[0];return`chore(deps): update dependency ${X.name} to v${X.newVersion}`}let q=J.filter((X)=>X.updateType==="major");if(q.length>0)return`chore(deps): update ${q.length} major dependencies`;else return"chore(deps): update all non-major dependencies"}function z(J,Q){if(Q)return Q;let q=`This PR contains the following updates:
|
|
11
11
|
|
|
12
12
|
`;q+=F(J),q+=`| Package | Change | Age | Adoption | Passing | Confidence |
|
|
13
13
|
`,q+=`|---|---|---|---|---|---|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ac as m,Bc as n,Cc as o,Dc as p,Ec as q,Fc as r,Gc as s,Hc as t,Ic as u,oc as a,pc as b,qc as c,rc as d,sc as e,tc as f,uc as g,vc as h,wc as i,xc as j,yc as k,zc as l}from"./chunk-
|
|
2
|
+
import{Ac as m,Bc as n,Cc as o,Dc as p,Ec as q,Fc as r,Gc as s,Hc as t,Ic as u,oc as a,pc as b,qc as c,rc as d,sc as e,tc as f,uc as g,vc as h,wc as i,xc as j,yc as k,zc as l}from"./chunk-mtn4angk.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{t as stripOperators,l as splitConstraint,s as scanEcosystems,o as rustAdapter,n as rubyAdapter,c as regenerateWith,u as regenerateLockfiles,m as pythonAdapter,k as pep440UpdateType,h as parsePep440,f as numericUpdateType,j as isPep440Prerelease,g as goAdapter,a as escapeRegex,b as detectFiles,i as comparePep440,e as compareNumeric,d as commandAvailable,r as adapterNamed,q as adapterFor,p as BUILTIN_ADAPTERS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Rh as K}from"./chunk-wzncz6j5.js";import{gl as N}from"./chunk-16aeend1.js";function F(q){return(q.split(/[/\\]/).pop()||"")==="build.zig.zon"}async function S(q,z){try{if(!F(q))return null;let J=[],j=z.match(/\.dependencies\s*=\s*\.?\{/);if(j){let Q=j.index+j[0].length,A=1,T=Q;while(T<z.length&&A>0){if(z[T]==="{")A++;else if(z[T]==="}")A--;T++}let G=z.slice(Q,T-1),O=/\.(\w+)\s*=\s*\.?\{/g,W=O.exec(G);while(W!==null){let b=W[1],X=W.index+W[0].length,Y=1,V=X;while(V<G.length&&Y>0){if(G[V]==="{")Y++;else if(G[V]==="}")Y--;V++}let _=G.slice(X,V-1),$=_.match(/\.url\s*=\s*"([^"]+)"/),R=_.match(/\.hash\s*=\s*"([^"]+)"/);if($){let H=$[1],v=H.match(/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i),E=v?v[1]:"unknown",Z={url:H};if(R)Z.hash=R[1];J.push({name:b,currentVersion:E,type:"zig-dependencies",file:q,metadata:Z})}W=O.exec(G)}}return{path:q,type:"build.zig.zon",content:z,dependencies:J}}catch(J){return K().warn(`Failed to parse Zig manifest ${q}:`,J),null}}async function w(q,z,J){try{if(!F(q))return K().info(`\u26A0\uFE0F updateZigManifest: ${q} is not a Zig manifest file, returning original content`),z;let j=z;for(let Q of J){let A=Q.name.trim(),T=new RegExp(`(\\.${A}\\s*=\\s*\\.?\\{[^}]*\\.url\\s*=\\s*")([^"]+)("[^}]*\\})`,"s"),G=j.match(T);if(G){let[O,W,b,X]=G,Y=/\/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/i,V=b.replace(Y,(H)=>{return H.startsWith("/v")?`/v${Q.newVersion}`:`/${Q.newVersion}`}),_=Q.resolved?.hash,$=X;if(_)$=X.replace(/(\.hash\s*=\s*")([^"]+)(")/,`$1${_}$3`);else if(/\.hash\s*=/.test(X)){K().warn(`\u26A0\uFE0F No hash available for ${A}; leaving ${q} unchanged to avoid a hash mismatch`);continue}let R=`${W}${V}${$}`;j=j.replace(O,R),K().info(`\u2705 Updated ${A} from ${G[2]} to ${V}`)}else K().warn(`\u26A0\uFE0F Could not find dependency block for ${A} in ${q}`)}return j}catch(j){return K().warn(`Failed to update Zig manifest ${q}:`,j),z}}async function U(q){let z=[],J=new Map;for(let j of q)if(F(j.file)){if(!J.has(j.file))J.set(j.file,[]);J.get(j.file).push(j)}for(let[j,Q]of J)try{let A=await import("fs");if(A.existsSync(j)){let T=A.readFileSync(j,"utf-8"),G=await w(j,T,Q);if(G!==T)z.push({path:j,content:G,type:"update"}),K().info(`\u2705 Generated update for ${j} with ${Q.length} package changes`);else K().info(`\u2139\uFE0F No changes needed for ${j} - versions already up to date`)}else K().warn(`\u26A0\uFE0F Zig manifest file ${j} does not exist`)}catch(A){K().warn(`Failed to generate updates for Zig manifest ${j}:`,A)}return z}
|
|
3
3
|
export{F as te,S as ue,w as ve,U as we};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jc as a,Kc as b,Lc as c,Mc as d}from"./chunk-4chtv4nh.js";import"./chunk-j57716xw.js";import"./chunk-cj4d5ad7.js";import"./chunk-c63e4ssc.js";import"./chunk-x9vpk4kk.js";import"./chunk-r1jvyhhd.js";import"./chunk-2z9mh5y4.js";import"./chunk-yh13j2af.js";import"./chunk-6w0n6c07.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{c as isWorkflowPermissionRefusal,a as gitAuthConfigArgs,b as WorkflowPermissionError,d as GitHubProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fg as mc,Gg as nc,Hg as oc,Ig as pc,Jg as qc,Kg as rc,Lg as sc,Mg as tc,Ng as uc,Og as vc,Pg as wc,Qg as xc,Rg as yc,Sg as zc,Tg as Ac,Ug as Bc,Vg as Cc,Wg as Dc,Xg as Ec,Yg as Fc}from"./chunk-2z9mh5y4.js";import{$h as i,$i as ha,$j as hb,$k as hc,Ai as I,Aj as Ia,Ak as Ib,Bi as J,Bj as Ja,Bk as Jb,Ci as K,Cj as Ka,Ck as Kb,Di as L,Dj as La,Dk as Lb,Ei as M,Ej as Ma,Ek as Mb,Fi as N,Fj as Na,Fk as Nb,Gi as O,Gj as Oa,Gk as Ob,Hi as P,Hj as Pa,Hk as Pb,Ii as Q,Ij as Qa,Ik as Qb,Ji as R,Jj as Ra,Jk as Rb,Ki as S,Kj as Sa,Kk as Sb,Li as T,Lj as Ta,Lk as Tb,Mi as U,Mj as Ua,Mk as Ub,Ni as V,Nj as Va,Nk as Vb,Oi as W,Oj as Wa,Ok as Wb,Pi as X,Pj as Xa,Pk as Xb,Qi as Y,Qj as Ya,Qk as Yb,Ri as Z,Rj as Za,Rk as Zb,Sh as a,Si as _,Sj as _a,Sk as _b,Th as b,Ti as $,Tj as $a,Tk as $b,Uh as c,Ui as aa,Uj as ab,Uk as ac,Vi as ba,Vj as bb,Vk as bc,Wh as d,Wi as ca,Wj as cb,Wk as cc,Xh as e,Xi as da,Xj as db,Xk as dc,Yh as f,Yi as ea,Yj as eb,Yk as ec,Zh as g,Zi as fa,Zj as fb,Zk as fc,_h as h,_i as ga,_j as gb,_k as gc,ai as j,aj as ia,ak as ib,al as ic,bi as k,bj as ja,bk as jb,bl as jc,ci as l,cj as ka,ck as kb,cl as kc,di as m,dj as la,dk as lb,dl as lc,ei as n,ej as ma,ek as mb,fi as o,fj as na,fk as nb,gi as p,gj as oa,gk as ob,hi as q,hj as pa,hk as pb,ii as r,ij as qa,ik as qb,ji as s,jj as ra,jk as rb,ki as t,kj as sa,kk as sb,li as u,lj as ta,lk as tb,mi as v,mj as ua,mk as ub,ni as w,nj as va,nk as vb,oi as x,oj as wa,ok as wb,pi as y,pj as xa,pk as xb,qi as z,qj as ya,qk as yb,ri as A,rj as za,rk as zb,si as B,sj as Aa,sk as Ab,ti as C,tj as Ba,tk as Bb,ui as D,uj as Ca,uk as Cb,vj as Da,vk as Db,wi as E,wj as Ea,wk as Eb,xi as F,xj as Fa,xk as Fb,yi as G,yj as Ga,yk as Gb,zi as H,zj as Ha,zk as Hb}from"./chunk-m3rftash.js";import"./chunk-16aeend1.js";export{Ta as ziglangOfficialDownload,ab as zigRegistryMirror,bb as zigPurgedDevBuildHint,eb as zigOriginVersions,Wb as writeOciLayout,Xb as writeDockerArchive,Cc as withTempDirSync,Bc as withTempDir,yc as withRedis,uc as withPostgres,qc as withMysql,ic as waitForAppStoreBuilds,ac as verifyBlob,n as validatePackageSpec,Aa as validatePackage,sa as v,xc as useRedis,tc as usePostgres,pc as useMysql,zb as updatePackageVersionMap,ca as updateApp,sb as uninstallShellInit,ub as toTypeName,tb as toSafeVarName,vb as toPackageVarName,Fc as testingRuntime,mb as supportedPackages,wc as stopRedis,sc as stopPostgres,oc as stopMysql,vc as startRedis,rc as startPostgres,S as startPeriodicCleanup,nc as startMysql,Ua as sqliteOfficialDownloadUrl,va as showPackageInfo,x as shouldProceedWithGitHubRequest,R as setupCleanupHandlers,Ub as serializeConfig,wa as searchPackagesCommand,j as searchPackages,V as scanPantryPackages,$ as scanInstalledApps,N as saveToCacheAndOutput,w as saveRateLimitInfo,K as savePackageAsTypeScript,z as saveGitHubPackageCache,db as satisfiesInstallerConstraint,ib as retryNetworkOperation,q as resolveVersionFromMetadata,Ka as resolveVersionConstraint,h as resolveVersion,Ma as resolveTransitiveDependencies,ka as resolvePackageName,G as resolvePackageDomain,Cb as resolvePackageDependencies,Xa as resolveLatestVersion,gb as resolveInstallerConstraintFromCandidates,Oa as resolveDependencyFile,Bb as resolveDependenciesFromYaml,Ab as resolveDependencies,Mb as resolveBuildStages,qb as renderShellSnippet,dc as renderDockerfile,Ac as removeTempDir,Za as registryVersionsForPlatform,Ya as registryPlatformKey,_a as registryDownloadSource,Eb as readProjectDependencies,W as readPantryPackageInfo,pb as rcFileFor,$b as pushImage,_b as pullImage,jc as provisionMacApp,ta as pkg,o as parseVersion,la as parsePackageSpec,cb as parseInstallerConstraint,Zb as parseImageRef,Nb as parseFreezer,Lb as parseExecForm,Kb as parseDockerfile,Ia as parseDepsYamlConfig,Ha as parseDependencyFile,b as pantry,c as packages,Qa as normalizeInstallerVersion,B as logPkgxProjects,Pb as loadFreezer,xa as listPopularPackages,za as listAliases,ya as listActivePackages,g as isVersionAvailable,fa as isValidPackageName,ga as isSupportedPlatform,ha as isSupportedArchitecture,kb as isSupported,hb as isRetryableNetworkError,ra as isPackageInCategory,ea as isPackageDomain,da as isPackageAlias,_ as isNewerVersion,I as isKnownAlias,lb as isInstallable,$a as installedRegistryBinaries,rb as installShellInit,Wa as installPackages,Va as installPackage,F as guessOriginalDomain,Ra as globalBinDir,Ca as getVersionInfo,M as getValidCachedPackage,Ga as getSystemInfo,nb as getPrimaryBinary,l as getPopularPackages,f as getPhpVersionsForWorkflow,k as getPackagesByPattern,qa as getPackagesByCategory,i as getPackageInfo,H as getPackageAliases,d as getLatestVersion,Db as getInstallCommand,y as getGitHubPackageCache,J as getCanonicalDomain,Ja as getAvailableVersionsForPackage,e as getAvailableVersions,ja as getAllPackageDomains,ia as getAllPackageAliases,m as getActivePackages,kc as generateMacCertificateRequests,wb as generateIndex,yb as generateDocs,ec as generateContainerFiles,xb as generateAliases,Ea as formatSearchResults,ma as formatPackageSpec,Da as formatPackageInfo,C as formatObjectWithoutQuotedKeys,Fa as formatInstallPlan,Pa as findDependencyFiles,P as fetchPkgxProjects,X as fetchPantryPackageWithMetadata,Q as fetchPantryPackage,A as fetchPackageListFromGitHub,aa as fetchDesktopCatalogue,U as fetchAndSavePackage,T as fetchAndSaveAllPackages,bc as extractLayer,lc as exportAppleCertificateP12,hc as ensureAppStoreVersions,jb as downloadFileReliably,Sb as digestHex,Rb as digest,ob as detectShell,Sa as detectPlatform,ua as dependencies,Ib as definePantryConfig,Gb as definePackageList,Fb as defineDependencies,Na as deduplicateDependencies,Dc as createTestFile,Ec as createTestDir,zc as createTempDir,Ob as createMatcher,na as createInstallationContext,Ba as createInstallPlan,D as convertDomainToVarName,E as convertDomainToFileName,p as compareVersionsDesc,La as compareVersions,fb as compareInstallerVersionsDesc,Jb as collectBuildContext,O as cleanupBrowserResources,L as cleanStaleOutputFiles,ba as checkAppUpdates,Vb as buildManifest,Tb as buildLayerFromRootfs,cc as buildImage,fc as appStoreConnectToken,a as aliases,oa as VERSION_SPECS,Y as SYSTEM_APPS,mc as PantryService,Yb as PANTRY_REGISTRY,pa as PACKAGE_CATEGORIES,u as PACKAGE_ALIASES,Qb as MEDIA_TYPE,Z as MAS_APPS,Hb as DISTRIBUTION_CONFIG,t as DEFAULT_TIMEOUT_MS,s as DEFAULT_CACHE_EXPIRATION_MINUTES,r as DEFAULT_CACHE_DIR,gc as AppStoreConnectClient,v as ALL_KNOWN_PACKAGES};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Gh as Z}from"./chunk-6w0n6c07.js";import{Rh as K}from"./chunk-wzncz6j5.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{fc as _}from"./chunk-
|
|
2
|
+
import{fc as _}from"./chunk-wfwrm4k3.js";import{Rh as X}from"./chunk-wzncz6j5.js";import{gl as M}from"./chunk-16aeend1.js";var K={review:"review","full-review":"full-review",full:"full-review",summary:"summary",resolve:"resolve",pause:"pause",resume:"resume",ignore:"ignore",rebase:"rebase",retry:"rebase",merge:"merge",plan:"plan","fix-ci":"fix-ci",fix:"fix-ci",remember:"remember",help:"help"},Q=["help","summary"];function V(H){return H.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ").split(`
|
|
3
3
|
`).filter((C)=>!C.trimStart().startsWith(">")).join(`
|
|
4
|
-
`)}function $(H,C="@buddy"){if(!H)return null;let B=V(H),O=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`(?:^|\\s)${O}\\b[ \\t]*(.*)`,"i"),z=B.match(j);if(!z)return null;let A=(z[1]??"").trim();if(!A)return{name:"help",args:"",raw:z[0].trim()};let[D,...E]=A.split(/\s+/),J=K[D.toLowerCase()];if(!J)return{name:"chat",args:A,raw:z[0].trim()};return{name:J,args:E.join(" "),raw:z[0].trim()}}function G(H){return Q.includes(H)}function F(H,C="@buddy"){return Boolean(H?.toLowerCase().includes(C.toLowerCase()))}var Y="**Buddy commands**\n\n| Command | What it does |\n|---|---|\n| `@buddy review` | Review new changes since the last review |\n| `@buddy full-review` | Review the whole diff again, ignoring previous findings |\n| `@buddy summary` | Post a fresh summary without inline findings |\n| `@buddy pause` / `resume` | Stop or restart reviewing this pull request |\n| `@buddy rebase` | Rebase a dependency update pull request |\n| `@buddy merge` | Re-check auto-merge conditions now |\n| `@buddy fix-ci` | Diagnose the failing checks, and retry a flake |\n| `@buddy plan` | Research the repository and write an implementation plan |\n| `@buddy resolve` | Close the review threads Buddy opened |\n| `@buddy remember <text>` | Record a durable note for future runs |\n| `@buddy help` | Show this table |\n\nAnything else after the mention is treated as a question.";function Z(H){if(H.actor.isBot)return"comment was written by a bot";if(G(H.command.name))return null;if(!H.actor.canWrite)return`@${H.actor.login} does not have write access`;return null}async function L(H,C){let B=H.logger??X(),O=Z(H);if(O)return B.info(`\uD83D\uDEAB Ignoring \`${H.command.name}\`: ${O}`),{handled:!1,refusal:O};if(H.command.name==="help")return{handled:!0,reply:Y};let j=C[H.command.name];if(!j)return{handled:!1,refusal:`no handler for ${H.command.name}`,reply:`I don't know how to \`${H.command.name}\` yet. Try \`@buddy help\`.`};return B.info(`\uD83E\uDD16 Running \`${H.command.name}\` for @${H.actor.login}`),await j(H)}function T(H){return{async review(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{})}},async "full-review"(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{full:!0})}},async summary(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to summarize \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{summaryOnly:!0})}},async pause(C){return await I(H,C.number,!0),{handled:!0,reply:"Paused. I will not review this pull request again until you say `@buddy resume`."}},async resume(C){return await I(H,C.number,!1),{handled:!0,reply:"Resumed. I will review the next push."}},async ignore(C){return await I(H,C.number,!0),{handled:!0,reply:"Understood \u2014 I will leave this pull request alone."}},async rebase(C){return{handled:!0,reply:await H.rebase(C.number)}},async merge(C){return{handled:!0,reply:(await H.merge()).includes(C.number)?"Merged.":"This pull request does not currently qualify for auto-merge. Check the conditions in your config and whether its checks have passed."}},async "fix-ci"(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no checks to look at \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.fixCi(C.number)}},async remember(C){let B=C.command.args.trim();if(!B)return{handled:!1,reply:"Tell me what to remember, e.g. `@buddy remember we pin react to 17`."};return{handled:!0,reply:await H.remember(B,C)}},async resolve(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no review threads here \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.resolve(C.number)}},async plan(C){return{handled:!0,reply:await H.plan(C.number,C.isPullRequest,C.command.args.trim())}},async chat(C){let B=_(H.config,C.logger);if(!B)return{handled:!1,reply:"I need an AI provider configured to answer questions. See https://buddy.sh/ai/providers"};return{handled:!0,reply:(await B.complete({system:"You are Buddy, answering a question in a pull request or issue thread. Be brief and concrete. If you do not know, say so rather than guessing.",messages:[{role:"user",content:C.command.args}]})).text}}}}async function I(H,C,B){let j=(await H.provider.getPullRequests("open")).find((E)=>E.number===C);if(!j)return;let{parseReviewState:z,upsertReviewState:A}=await import("./chunk-
|
|
4
|
+
`)}function $(H,C="@buddy"){if(!H)return null;let B=V(H),O=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`(?:^|\\s)${O}\\b[ \\t]*(.*)`,"i"),z=B.match(j);if(!z)return null;let A=(z[1]??"").trim();if(!A)return{name:"help",args:"",raw:z[0].trim()};let[D,...E]=A.split(/\s+/),J=K[D.toLowerCase()];if(!J)return{name:"chat",args:A,raw:z[0].trim()};return{name:J,args:E.join(" "),raw:z[0].trim()}}function G(H){return Q.includes(H)}function F(H,C="@buddy"){return Boolean(H?.toLowerCase().includes(C.toLowerCase()))}var Y="**Buddy commands**\n\n| Command | What it does |\n|---|---|\n| `@buddy review` | Review new changes since the last review |\n| `@buddy full-review` | Review the whole diff again, ignoring previous findings |\n| `@buddy summary` | Post a fresh summary without inline findings |\n| `@buddy pause` / `resume` | Stop or restart reviewing this pull request |\n| `@buddy rebase` | Rebase a dependency update pull request |\n| `@buddy merge` | Re-check auto-merge conditions now |\n| `@buddy fix-ci` | Diagnose the failing checks, and retry a flake |\n| `@buddy plan` | Research the repository and write an implementation plan |\n| `@buddy resolve` | Close the review threads Buddy opened |\n| `@buddy remember <text>` | Record a durable note for future runs |\n| `@buddy help` | Show this table |\n\nAnything else after the mention is treated as a question.";function Z(H){if(H.actor.isBot)return"comment was written by a bot";if(G(H.command.name))return null;if(!H.actor.canWrite)return`@${H.actor.login} does not have write access`;return null}async function L(H,C){let B=H.logger??X(),O=Z(H);if(O)return B.info(`\uD83D\uDEAB Ignoring \`${H.command.name}\`: ${O}`),{handled:!1,refusal:O};if(H.command.name==="help")return{handled:!0,reply:Y};let j=C[H.command.name];if(!j)return{handled:!1,refusal:`no handler for ${H.command.name}`,reply:`I don't know how to \`${H.command.name}\` yet. Try \`@buddy help\`.`};return B.info(`\uD83E\uDD16 Running \`${H.command.name}\` for @${H.actor.login}`),await j(H)}function T(H){return{async review(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{})}},async "full-review"(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to review \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{full:!0})}},async summary(C){if(!C.isPullRequest)return{handled:!1,reply:"There is nothing to summarize \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.review(C.number,{summaryOnly:!0})}},async pause(C){return await I(H,C.number,!0),{handled:!0,reply:"Paused. I will not review this pull request again until you say `@buddy resume`."}},async resume(C){return await I(H,C.number,!1),{handled:!0,reply:"Resumed. I will review the next push."}},async ignore(C){return await I(H,C.number,!0),{handled:!0,reply:"Understood \u2014 I will leave this pull request alone."}},async rebase(C){return{handled:!0,reply:await H.rebase(C.number)}},async merge(C){return{handled:!0,reply:(await H.merge()).includes(C.number)?"Merged.":"This pull request does not currently qualify for auto-merge. Check the conditions in your config and whether its checks have passed."}},async "fix-ci"(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no checks to look at \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.fixCi(C.number)}},async remember(C){let B=C.command.args.trim();if(!B)return{handled:!1,reply:"Tell me what to remember, e.g. `@buddy remember we pin react to 17`."};return{handled:!0,reply:await H.remember(B,C)}},async resolve(C){if(!C.isPullRequest)return{handled:!1,reply:"There are no review threads here \u2014 this is an issue, not a pull request."};return{handled:!0,reply:await H.resolve(C.number)}},async plan(C){return{handled:!0,reply:await H.plan(C.number,C.isPullRequest,C.command.args.trim())}},async chat(C){let B=_(H.config,C.logger);if(!B)return{handled:!1,reply:"I need an AI provider configured to answer questions. See https://buddy.sh/ai/providers"};return{handled:!0,reply:(await B.complete({system:"You are Buddy, answering a question in a pull request or issue thread. Be brief and concrete. If you do not know, say so rather than guessing.",messages:[{role:"user",content:C.command.args}]})).text}}}}async function I(H,C,B){let j=(await H.provider.getPullRequests("open")).find((E)=>E.number===C);if(!j)return;let{parseReviewState:z,upsertReviewState:A}=await import("./chunk-tjj6ttj1.js"),D=z(j.body);await H.provider.updatePullRequest(C,{body:A(j.body,{reviewedSha:D?.reviewedSha??"",fingerprints:D?.fingerprints??[],reviewedAt:D?.reviewedAt??new Date().toISOString(),...B?{paused:!0}:{}})})}export{K as La,Q as Ma,V as Na,$ as Oa,G as Pa,F as Qa,Y as Ra,Z as Sa,L as Ta,T as Ua};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pg as a,qg as b,rg as c,sg as d,tg as e,ug as f,vg as g,wg as h,xg as i,yg as j,zg as k}from"./chunk-x9vpk4kk.js";import"./chunk-
|
|
2
|
+
import{pg as a,qg as b,rg as c,sg as d,tg as e,ug as f,vg as g,wg as h,xg as i,yg as j,zg as k}from"./chunk-x9vpk4kk.js";import"./chunk-16aeend1.js";export{h as withManifest,g as stripManifest,c as serializeManifest,d as serializeGroupManifest,e as parseManifest,i as manifestUpdates,j as manifestFiles,f as hasManifest,k as findGroupForPullRequest,a as MANIFEST_SCHEMA_VERSION,b as MANIFEST_MAX_LENGTH};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rf as Z}from"./chunk-
|
|
2
|
+
import{Rf as Z}from"./chunk-hk4d7rky.js";import{Rh as Y}from"./chunk-wzncz6j5.js";import W from"process";var $=[["bun","test"],["npm","test","--silent"]];async function E(G,H){let I=H?[H]:await L(G);for(let z of I){let j=Bun.spawn(z,{cwd:G,stdout:"pipe",stderr:"pipe",env:{PATH:W.env.PATH??"",HOME:W.env.HOME??"",CI:"1"}}),[J,K,Q]=await Promise.all([new Response(j.stdout).text(),new Response(j.stderr).text(),j.exited]);return{ran:!0,passed:Q===0,output:`${J}
|
|
3
3
|
${K}`.trim().slice(-4000)}}return{ran:!1,passed:!1,output:""}}async function L(G){let H=Bun.file(`${G}/package.json`);if(!await H.exists())return[];try{return(await H.json()).scripts?.test?$:[]}catch{return[]}}function O(G,H){return`${G.head}/buddy-${H}`}async function N(G){let H=G.logger??Y(),{provider:I,pullRequest:z,touch:j}=G;H.info(`\u2728 Running finishing touch '${j.name}' on PR #${z.number}`);let J=await Z(G.ai,{mode:j.mode,task:j.buildTask({summary:z.title,files:G.files??[]}),context:{workspace:G.workspace,baseBranch:z.base,branch:z.head},logger:H}),K=await _(G.workspace);if(K.length===0)return{mode:"none",changedFiles:[],verified:!1,comment:J.stopReason==="completed"?`**${j.description}** \u2014 nothing to change.`:`**${j.description}** \u2014 stopped before finishing (${J.stopReason}), and left nothing behind.`};let Q=J.stopReason==="completed",P=await E(G.workspace,G.testCommand);if(!(Q&&j.defaultOutput!=="suggestion"&&(P.passed||!P.ran)))return{mode:"suggestions",changedFiles:K,verified:P.passed,comment:X(j,K,P,J.stopReason)};let V=O(z,j.name);try{await I.createBranch(V,z.head),await I.commitChanges(V,`chore: ${j.description.toLowerCase()} for #${z.number}`,await x(G.workspace,K),z.head);let U=await I.createPullRequest({title:`${j.description} for #${z.number}`,body:y(j,z,K,P),head:V,base:z.head,labels:["buddy","finishing-touch"]});return{mode:"stacked-pr",pullRequest:U,changedFiles:K,verified:P.passed,comment:`**${j.description}** \u2014 opened [#${U.number}](${U.url}) targeting this branch.`+(P.ran?"":" No test script was found, so this is unverified.")}}catch(U){return H.warn(`\u26A0\uFE0F Could not open a stacked pull request: ${U}`),{mode:"suggestions",changedFiles:K,verified:P.passed,comment:X(j,K,P,J.stopReason)}}}async function _(G){let H=Bun.spawn(["git","status","--porcelain"],{cwd:G,stdout:"pipe",stderr:"ignore"}),[I,z]=await Promise.all([new Response(H.stdout).text(),H.exited]);if(z!==0)return[];let j=[];for(let J of I.split(`
|
|
4
4
|
`)){if(!J.trim())continue;let K=J.slice(0,2),Q=J.slice(3).trim();if(K.includes("D"))continue;j.push(Q.includes(" -> ")?Q.split(" -> ")[1]:Q)}return j}async function x(G,H){let I=[];for(let z of H){let j=Bun.file(`${G}/${z}`);if(await j.exists())I.push({path:z,content:await j.text(),type:"update"})}return I}function y(G,H,I,z){return[`${G.description}, requested on #${H.number}.`,"",`This targets \`${H.head}\` rather than \`${H.base}\`, so merging it`,"adds these changes to that pull request.","",z.ran?z.passed?"\u2705 The repository's tests pass with these changes.":"\u26A0\uFE0F The repository's tests do **not** pass with these changes.":"\u2139\uFE0F No test script was found, so these changes are unverified.","","### Files changed","",...I.map((j)=>`- \`${j}\``)].join(`
|
|
5
5
|
`)}function X(G,H,I,z){let j=[`**${G.description}**`,""];if(z&&z!=="completed")j.push(`The agent stopped before finishing (${z}), so what follows is`,"partial work rather than a complete change.","");if(I.ran&&!I.passed)j.push("The repository's tests do not pass with these changes, so no branch was","opened. Treat what follows as a starting point rather than a result.","");if(j.push("Files that would change:","",...H.map((J)=>`- \`${J}\``)),I.output)j.push("","<details><summary>Test output</summary>","","```",I.output,"```","","</details>");return j.join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hb as a,ib as b,jb as c,kb as d,lb as e}from"./chunk-gg1ddvnf.js";import"./chunk-hk4d7rky.js";import"./chunk-z18bksyr.js";import"./chunk-cj4d5ad7.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{b as verifyChanges,c as stackedBranchName,d as runStackedTouch,e as detectChangedFiles,a as TEST_COMMANDS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{X as
|
|
2
|
+
import{Gh as V}from"./chunk-6w0n6c07.js";import{Lh as M}from"./chunk-s0ps33ft.js";import{Oh as K,Rh as Q}from"./chunk-wzncz6j5.js";class X{token;apiUrl;logger;slug;constructor(j,z,A,C,F){this.token=j;this.apiUrl=(C??"https://api.bitbucket.org/2.0").replace(/\/+$/,""),this.logger=F??Q(),this.slug=`${encodeURIComponent(z)}/${encodeURIComponent(A)}`}capabilities(){return{pinIssues:!1,checkRuns:!0,inlineReviewComments:!0,reviewSuggestions:!1,nativeAutoMerge:!1,commentReactions:!1,ciLogs:!1,ciRuns:!1,reviewThreads:!1,teamReviewers:!1,draftPullRequests:!1,permissionLookup:!0,branchHousekeeping:!0,reopenPullRequests:!1,labels:!1}}async request(j,z,A,C={}){let F={Authorization:`Bearer ${this.token}`,Accept:C.raw?"text/plain":"application/json","User-Agent":"buddy"},H;if(C.form)F["Content-Type"]="application/x-www-form-urlencoded",H=new URLSearchParams(C.form).toString();else if(A)F["Content-Type"]="application/json",H=JSON.stringify(A);let G=await M(`${this.apiUrl}${z}`,{method:j,headers:F,...H?{body:H}:{}});if(!G.ok){let J=await G.text().catch(()=>"");throw Error(`Bitbucket ${j} ${z} failed: ${G.status} ${J.slice(0,200)}`)}let I=await G.text();if(C.raw)return I;return I.trim()?JSON.parse(I):void 0}async optional(j,z){try{return await this.request(j,z)}catch(A){if(String(A).includes("404"))return null;throw A}}async collect(j,z=10){let A=[],C=`${this.apiUrl}${j}`;for(let F=0;F<z&&C;F++){let H=C,G=await this.optional("GET",H.startsWith(this.apiUrl)?H.slice(this.apiUrl.length):H);if(!G)break;A.push(...G.values??[]),C=G.next}return A}async branchExists(j){return await this.optional("GET",`/repositories/${this.slug}/refs/branches/${encodeURIComponent(j)}`)!==null}async createBranch(j,z){await this.request("POST",`/repositories/${this.slug}/refs/branches`,{name:j,target:{hash:z}})}async deleteBranch(j){await this.request("DELETE",`/repositories/${this.slug}/refs/branches/${encodeURIComponent(j)}`)}async commitChanges(j,z,A,C="main"){if(A.length===0)return;let F={message:z,branch:j};for(let I of A)if(I.type==="delete")F.files=F.files?`${F.files},${I.path}`:I.path;else F[I.path]=I.content;let H=new URLSearchParams;for(let[I,J]of Object.entries(F)){if(I==="files")continue;H.append(I,J)}for(let I of A)if(I.type==="delete")H.append("files",I.path);let G=await this.headOf(C);if(G)H.append("parents",G);await this.request("POST",`/repositories/${this.slug}/src`,void 0,{form:Object.fromEntries(H.entries())})}async headOf(j){return(await this.optional("GET",`/repositories/${this.slug}/refs/branches/${encodeURIComponent(j)}`))?.target?.hash??null}async getFileContent(j,z){try{return await this.request("GET",`/repositories/${this.slug}/src/${encodeURIComponent(z)}/${j}`,void 0,{raw:!0})}catch(A){if(String(A).includes("404"))return null;throw A}}async createPullRequest(j){if(j.draft)this.logger.debug("Bitbucket has no draft pull requests; opening as ready");let z=await this.request("POST",`/repositories/${this.slug}/pullrequests`,{title:j.title,description:j.body,source:{branch:{name:j.head}},destination:{branch:{name:j.base}},close_source_branch:!0,...j.reviewers?.length?{reviewers:j.reviewers.map((A)=>({nickname:A}))}:{}});return this.toPullRequest(z)}async getPullRequests(j="open"){let A=(j==="open"?["OPEN"]:j==="closed"?["MERGED","DECLINED","SUPERSEDED"]:["OPEN","MERGED","DECLINED","SUPERSEDED"]).map((F)=>`state=${F}`).join("&");return(await this.collect(`/repositories/${this.slug}/pullrequests?${A}&pagelen=50`)).map((F)=>this.toPullRequest(F))}async updatePullRequest(j,z){let A=await this.request("PUT",`/repositories/${this.slug}/pullrequests/${j}`,{...z.title!==void 0?{title:z.title}:{},...z.body!==void 0?{description:z.body}:{},...z.base!==void 0?{destination:{branch:{name:z.base}}}:{}});return this.toPullRequest(A)}async closePullRequest(j){await this.request("POST",`/repositories/${this.slug}/pullrequests/${j}/decline`)}async reopenPullRequest(j){throw Error(`Bitbucket cannot reopen declined pull request #${j}; open a new one from the same branch.`)}async mergePullRequest(j,z="squash"){let A={merge:"merge_commit",squash:"squash",rebase:"fast_forward"};await this.request("POST",`/repositories/${this.slug}/pullrequests/${j}/merge`,{merge_strategy:A[z]??"squash",close_source_branch:!0})}async getPullRequestDiff(j){return await this.request("GET",`/repositories/${this.slug}/pullrequests/${j}/diff`,void 0,{raw:!0})}async getPullRequestHeadSha(j){return(await this.request("GET",`/repositories/${this.slug}/pullrequests/${j}`)).source?.commit?.hash??""}async createComment(j,z){await this.request("POST",`/repositories/${this.slug}/pullrequests/${j}/comments`,{content:{raw:z}})}async createIssue(j){let z=await this.request("POST",`/repositories/${this.slug}/issues`,{title:j.title,content:{raw:j.body},kind:"task"});return this.toIssue(z)}async getIssues(j="open"){let A=(await this.collect(`/repositories/${this.slug}/issues?pagelen=50`)).map((C)=>this.toIssue(C));return j==="all"?A:A.filter((C)=>C.state===j)}async updateIssue(j,z){let A=await this.request("PUT",`/repositories/${this.slug}/issues/${j}`,{...z.title!==void 0?{title:z.title}:{},...z.body!==void 0?{content:{raw:z.body}}:{}});return this.toIssue(A)}async closeIssue(j){await this.request("PUT",`/repositories/${this.slug}/issues/${j}`,{state:"closed"})}async unpinIssue(j){return!1}async getPullRequestChecksState(j){let z=await this.getPullRequestHeadSha(j);if(!z)return"none";let A=await this.collect(`/repositories/${this.slug}/commit/${z}/statuses?pagelen=50`);if(A.length===0)return"none";if(A.some((C)=>C.state==="FAILED"||C.state==="STOPPED"))return"failure";if(A.some((C)=>C.state==="INPROGRESS"))return"pending";if(A.every((C)=>C.state==="SUCCESSFUL"))return"success";return"pending"}async createReview(j,z){if(await this.createComment(j,z.body),!z.comments?.length)return{posted:!0,inlineComments:0};let A=0;for(let C of z.comments)try{await this.request("POST",`/repositories/${this.slug}/pullrequests/${j}/comments`,{content:{raw:C.body},inline:{path:C.path,...C.side==="RIGHT"?{to:C.line}:{from:C.line}}}),A++}catch(F){this.logger.debug(`Could not place a comment on ${C.path}:${C.line}: ${K(F)}`)}return{posted:!0,inlineComments:A}}async createCheckRun(j,z,A){try{await this.request("POST",`/repositories/${this.slug}/commit/${z}/statuses/build`,{key:j.replace(/[^\w-]/g,"-").slice(0,40),state:A.conclusion==="failure"?"FAILED":"SUCCESSFUL",name:A.title.slice(0,100),description:A.summary.slice(0,300),url:"https://buddy.sh"})}catch(C){this.logger.warn(`\u26A0\uFE0F Could not report build status ${j}: ${K(C)}`)}}async hasWriteAccess(j){let A=(await this.optional("GET",`/repositories/${this.slug}/permissions-config/users`))?.values?.find((C)=>C.user?.nickname===j);return A?.permission==="write"||A?.permission==="admin"}async getBuddyBranches(){return(await this.collect(`/repositories/${this.slug}/refs/branches?q=${encodeURIComponent('name ~ "buddy/"')}&pagelen=50`)).filter((z)=>V(z.name)).map((z)=>({name:z.name,sha:z.target?.hash??"",lastCommitDate:z.target?.date?new Date(z.target.date):new Date(0)}))}async getOrphanedBuddyBranches(){let[j,z]=await Promise.all([this.getBuddyBranches(),this.getPullRequests("open")]),A=new Set(z.map((C)=>C.head));return j.filter((C)=>!A.has(C.name))}async cleanupStaleBranches(j=7,z=!1){let A=new Date(Date.now()-j*24*60*60*1000),C=(await this.getOrphanedBuddyBranches()).filter((G)=>G.lastCommitDate<A);if(z)return{deleted:C.map((G)=>G.name),failed:[]};let F=[],H=[];for(let G of C)try{await this.deleteBranch(G.name),F.push(G.name)}catch{H.push(G.name)}return{deleted:F,failed:H}}toPullRequest(j){let z=j.state==="MERGED"?"merged":j.state==="OPEN"?"open":"closed";return{number:j.id,title:j.title,body:j.description??"",head:j.source?.branch?.name??"",base:j.destination?.branch?.name??"",state:z,url:j.links?.html?.href??"",createdAt:new Date(j.created_on),updatedAt:new Date(j.updated_on),...z==="merged"?{mergedAt:new Date(j.updated_on)}:{},author:j.author?.nickname??j.author?.display_name??"",reviewers:(j.reviewers??[]).map((A)=>A.nickname??A.display_name??"").filter(Boolean),assignees:[],labels:[],draft:!1}}toIssue(j){let z=["new","open","on hold"].includes(j.state);return{number:j.id,title:j.title,body:j.content?.raw??"",state:z?"open":"closed",url:j.links?.html?.href??"",createdAt:new Date(j.created_on),updatedAt:new Date(j.updated_on),...z?{}:{closedAt:new Date(j.updated_on)},author:j.reporter?.nickname??j.reporter?.display_name??"",assignees:[],labels:[]}}}
|
|
3
|
+
export{X as Fh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ch as R,Dh as S,zh as G}from"./chunk-yh13j2af.js";import{Lh as x}from"./chunk-s0ps33ft.js";import{Rh as K}from"./chunk-wzncz6j5.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:`[](https://docs.renovatebot.com/merge-confidence/)`,adoption:`[](https://docs.renovatebot.com/merge-confidence/)`,passing:`[](https://docs.renovatebot.com/merge-confidence/)`,confidence:`[](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:`[](https://docs.renovatebot.com/merge-confidence/)`,adoption:`[](https://docs.renovatebot.com/merge-confidence/)`,passing:`[](https://docs.renovatebot.com/merge-confidence/)`,confidence:`[](https://docs.renovatebot.com/merge-confidence/)`}}normalizeVersionForBadges(B){let J=B.replace(/^v/,"");if(J.split(".").length===2)J=`${J}.0`;return J}}
|
|
4
4
|
export{P as We};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-16aeend1.js";function f(i){return JSON.stringify({ok:!i.failed,summary:{workflows:i.workflows.length,findings:i.findings.length,errors:i.findings.filter((n)=>n.severity==="error").length,warnings:i.findings.filter((n)=>n.severity==="warning").length,info:i.findings.filter((n)=>n.severity==="info").length},findings:i.findings},null,2)}export{f as formatJson};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{We as c}from"./chunk-
|
|
2
|
+
import{We as c}from"./chunk-gvpsbmeg.js";import{bg as l,kg as A}from"./chunk-c63e4ssc.js";import{sg as y}from"./chunk-x9vpk4kk.js";import{Ah as k}from"./chunk-yh13j2af.js";import{Rh as i}from"./chunk-wzncz6j5.js";import u from"process";var d=/\{([a-z_]+)\}/gi,b={title:"title",message:"message",group:"group",count:"count",strategy:"strategy",update_type:"updateType",updateType:"updateType",packages:"packages",updates_table:"updatesTable",release_notes:"releaseNotes",footer:"footer",package_count:"packageCount"};function h(W,$){return W.replace(d,(Y,R)=>{let K=b[R]??b[R.toLowerCase()];if(!K)return Y;let H=$[K];return H===void 0?Y:String(H)})}function f(W,$={},Y){return{...$,group:W.name,count:W.updates.length,packageCount:W.updates.length,updateType:W.updateType,packages:W.updates.map((R)=>R.name).join(", "),...Y?{strategy:Y}:{}}}class p{config;releaseNotesFetcher=new c;verbose=!1;logger;constructor(W,$){this.config=W;this.verbose=W?.verbose||u.env.BUDDY_VERBOSE==="true",this.logger=$??i()}get releaseNotesSettings(){let W=this.config?.releaseNotes;return{enabled:W?.enabled??!0,maxReleases:W?.maxReleases??3,maxBodyLength:W?.maxBodyLength??1000,includeCompareLinks:W?.includeCompareLinks??!0}}repositoryFileUrl(W){let $=k(this.config),{owner:Y,name:R,baseBranch:K}=this.config?.repository??{};return`${$}/${Y}/${R}/blob/${K||"main"}/${W}`}log(W,$){if(this.verbose){let Y=new Date().toISOString();if(this.logger.info(`[${Y}] PR-GEN: ${W}`),$)this.logger.info(JSON.stringify($,null,2))}}async generatePullRequests(W){let $=[];for(let Y of W){let R=this.generateTitle(Y),K=await this.generateBody(Y),H={number:0,title:R,body:K,head:`buddy/update-${Y.name.toLowerCase().replace(/\s+/g,"-")}`,base:"main",state:"open",url:"",createdAt:new Date,updatedAt:new Date,author:"github-actions[bot]",reviewers:[],assignees:[],labels:this.generateLabels(Y),draft:!1};$.push(H)}return $}generateLabels(W){let $=["dependencies"];if(W.updateType==="major")$.push("major");else if(W.updateType==="minor")$.push("minor");else if(W.updateType==="patch")$.push("patch");let Y=W.updates.filter((D)=>D.file==="package.json"||D.file.endsWith("/package.json")||D.file.endsWith("\\package.json")).length,R=W.updates.filter((D)=>D.file.endsWith("composer.json")||D.file.endsWith("composer.lock")).length,K=W.updates.filter((D)=>D.file.endsWith("build.zig.zon")).length,H=W.updates.filter((D)=>(D.file.includes(".yaml")||D.file.includes(".yml"))&&!D.file.includes(".github/workflows/")).length,Z=W.updates.filter((D)=>D.file.includes(".github/workflows/")).length;if(Y>0)$.push("npm");if(R>0)$.push("composer");if(K>0)$.push("zig");if(H>0)$.push("system");if(Z>0)$.push("github-actions");if(W.updates.length===1){let D=W.updates[0];$.push(D.name)}if(W.updates.length>=5)$.push("bulk-update");return $}generateTitle(W){let $=this.config?.pullRequest?.titleFormat;if($)return h($,f(W,{title:this.defaultTitle(W)},this.config?.packages?.strategy));return this.defaultTitle(W)}defaultTitle(W){if(W.updates.length===1){let R=W.updates[0];return`chore(deps): update dependency ${R.name} to v${R.newVersion}`}let $=W.updates.filter((R)=>R.updateType==="major").length,Y=W.updates.filter((R)=>R.updateType==="minor").length;if($>0)return`chore(deps): update ${W.updates.length} dependencies (major)`;else if(Y>0)return`chore(deps): update ${W.updates.length} dependencies (minor)`;else return`chore(deps): update ${W.updates.length} dependencies (patch)`}async generateBody(W){if(this.log("\uD83D\uDE80 Starting PR body generation",{groupName:W.name,totalUpdates:W.updates.length,updates:W.updates.map((Q)=>({name:Q.name,file:Q.file,dependencyType:Q.dependencyType,currentVersion:Q.currentVersion,newVersion:Q.newVersion,updateType:Q.updateType}))}),W.updates.length===0)this.log("\u26A0\uFE0F WARNING: No updates in group - this will result in sparse PR body",{groupName:W.name,groupTitle:W.title});let $=W.updates.filter((Q)=>Q.file==="package.json"||Q.file.endsWith("/package.json")||Q.file.endsWith("\\package.json")).length,Y=W.updates.filter((Q)=>(Q.file.includes(".yaml")||Q.file.includes(".yml"))&&!Q.file.includes(".github/workflows/")).length,R=W.updates.filter((Q)=>Q.file.includes(".github/workflows/")).length,K=W.updates.filter((Q)=>Q.file.endsWith("composer.json")||Q.file.endsWith("composer.lock")).length,H=W.updates.filter((Q)=>Q.file.endsWith("build.zig.zon")).length;if(this.log("\uD83D\uDCCA Package type counts",{packageJsonCount:$,dependencyFileCount:Y,githubActionsCount:R,composerCount:K,total:W.updates.length}),W.updates.length>0)this.log("\uD83D\uDD0D File path analysis",{files:W.updates.map((Q)=>({name:Q.name,file:Q.file,isExactMatch:Q.file==="package.json",endsWithSlash:Q.file.endsWith("/package.json"),endsWithBackslash:Q.file.endsWith("\\package.json"),matchesAny:Q.file==="package.json"||Q.file.endsWith("/package.json")||Q.file.endsWith("\\package.json")}))});let Z=`This PR contains the following updates:
|
|
3
3
|
|
|
4
4
|
`;Z+=l(W.updates);let D=W.updates.length>1;if(D){if(Z+=`## Package Updates Summary
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fc as F}from"./chunk-
|
|
2
|
+
import{fc as F}from"./chunk-wfwrm4k3.js";import{Cf as c}from"./chunk-1pecmenc.js";import{Of as E,Rf as A}from"./chunk-hk4d7rky.js";import{Rh as m}from"./chunk-wzncz6j5.js";function S(T,f,r){let O=r?"pull request":"issue";return{name:"read_issue",tier:"read",description:`Read the ${O} this task is about: its title and description.`,parameters:{type:"object",properties:{}},async run(M,x){try{let e=r?(await T.getPullRequests("all")).find((h)=>h.number===f):(await T.getIssues("all")).find((h)=>h.number===f);if(!e)return{content:`Could not find ${O} #${f}.`,isError:!0};let k=(e.body??"").slice(0,20000);return x.log(`read ${O} #${f}`),{content:`# ${e.title}
|
|
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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vf as F,Xf as O,Yf as U}from"./chunk-z18bksyr.js";import{$f as w}from"./chunk-cj4d5ad7.js";import{
|
|
2
|
+
import{Vf as F,Xf as O,Yf as U}from"./chunk-z18bksyr.js";import{$f as w}from"./chunk-cj4d5ad7.js";import{Rh as S}from"./chunk-wzncz6j5.js";import{readdir as g,stat as _}from"fs/promises";import{join as x,relative as E,resolve as C}from"path";var D=1e5;function M(G,q){let J=w(G),Q=C(q),K=C(Q,J),$=E(Q,K);if($.startsWith("..")||C(Q,$)!==K)throw Error(`Refusing to access a path outside the workspace: ${G}`);return K}var h={name:"read_file",tier:"read",description:"Read a UTF-8 text file from the repository. Paths are relative to the repository root.",parameters:{type:"object",properties:{path:{type:"string",description:"Repository-relative path, e.g. src/index.ts"}},required:["path"]},async run(G,q){let J=String(G.path??""),Q=M(J,q.workspace),K=Bun.file(Q);if(!await K.exists())return{content:`File not found: ${J}`,isError:!0};let $=await K.text();if($.length>D)return{content:`${$.slice(0,D)}
|
|
3
3
|
|
|
4
4
|
[truncated at ${D} characters]`};return{content:$}}},T={name:"write_file",tier:"write",description:"Write a UTF-8 text file in the repository, creating or replacing it.",parameters:{type:"object",properties:{path:{type:"string",description:"Repository-relative path"},content:{type:"string",description:"Full file content to write"}},required:["path","content"]},async run(G,q){let J=String(G.path??""),Q=M(J,q.workspace);return await Bun.write(Q,String(G.content??"")),q.log(`wrote ${J}`),{content:`Wrote ${J}`}}},m={name:"list_dir",tier:"read",description:"List the entries of a directory in the repository.",parameters:{type:"object",properties:{path:{type:"string",description:"Repository-relative directory, defaults to the root"}}},async run(G,q){let J=G.path?String(G.path):".",Q=J==="."?C(q.workspace):M(J,q.workspace);try{let K=await g(Q);return{content:(await Promise.all(K.map(async(z)=>{return(await _(x(Q,z)).catch(()=>null))?.isDirectory()?`${z}/`:z}))).sort().join(`
|
|
5
5
|
`)||"(empty)"}}catch(K){return{content:`Could not list ${J}: ${K}`,isError:!0}}}},L=[h,T,m];import u from"process";var d=120000,v=30000,c=["PATH","HOME","LANG","LC_ALL","TZ","TMPDIR","SHELL","USER","PWD","NODE_ENV","CI","BUN_INSTALL","XDG_CACHE_HOME"],p=/_(?:TOKEN|KEY|SECRET|PASSWORD|CREDENTIAL|CREDENTIALS)$|^(?:GITHUB_TOKEN|ANTHROPIC_API_KEY|OPENAI_API_KEY|NPM_TOKEN)$/i;function l(G=u.env,q=[]){let J=new Set([...c,...q]),Q={};for(let[K,$]of Object.entries(G)){if($===void 0)continue;if(!J.has(K))continue;if(p.test(K))continue;Q[K]=$}return Q}var y={name:"run_command",tier:"shell",description:"Run a shell command in the repository. The environment is stripped of credentials, so commands cannot authenticate to external services.",parameters:{type:"object",properties:{command:{type:"string",description:"Command to run, e.g. bun test"},timeoutMs:{type:"number",description:"Optional timeout in milliseconds"}},required:["command"]},async run(G,q){let J=String(G.command??"").trim();if(!J)return{content:"No command supplied",isError:!0};let Q=Number(G.timeoutMs)>0?Number(G.timeoutMs):d;q.log(`running: ${J}`);try{let K=Bun.spawn(["sh","-c",J],{cwd:q.workspace,env:l(),stdout:"pipe",stderr:"pipe"}),$=setTimeout(()=>K.kill(),Q),[z,V,I]=await Promise.all([new Response(K.stdout).text(),new Response(K.stderr).text(),K.exited]);clearTimeout($);let H=[z,V].filter(Boolean).join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{W as a,X as b}from"./chunk-bafzw99p.js";import"./chunk-wfwrm4k3.js";import"./chunk-4r03rh93.js";import"./chunk-0f1xye20.js";import"./chunk-s3b3vrsj.js";import"./chunk-6gvx1g6h.js";import"./chunk-mr2d1zp0.js";import"./chunk-142zh7e5.js";import"./chunk-743mhx0e.js";import"./chunk-24xvskkf.js";import"./chunk-z18bksyr.js";import"./chunk-s0ps33ft.js";import"./chunk-wzncz6j5.js";import"./chunk-16aeend1.js";export{b as renderDoctorReport,a as diagnose};
|