@seldonqa/cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.js +53 -13
  2. package/package.json +4 -4
package/dist/bin.js CHANGED
@@ -1,16 +1,56 @@
1
1
  #!/usr/bin/env node
2
- import{BlokSDK as mt}from"@blok/sdk";function W(n){let e=n.slice(2);for(let t=0;t<e.length;t+=1){let i=e[t];if(i==="--base-url"||i==="--api-key"){t+=1;continue}if(!i.startsWith("-"))return i==="api"}return!1}import{readFileSync as Ge}from"fs";import{createChangedFilesArchive as Qe,createCodebaseArchive as Ve,deltaBaseline as He,generateBaseline as Xe,getActionableReport as oe,getBaselinePlan as re,getCaseStatus as Ze,listBaselines as et,listBaselineVersions as tt,loadSeldonYamlConfig as C,promoteBaseline as nt,readSeldonYamlText as ae,renderReportMarkdown as it,seldonYamlPath as st,renderReportText as ot,renderTable as le,renderUpdateReportMarkdown as rt,renderUpdateReportText as at,runBaseline as lt,updateBaseline as dt,waitForBaselineReady as ct,waitForBaselineReport as pt}from"@blok/sdk";import{Command as ut}from"commander";var fe="\x1B[0m",ge={bold:"1",dim:"2",inverse:"7",red:"31",green:"32",yellow:"33",blue:"34",magenta:"35",cyan:"36",gray:"90"};function me(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.env.FORCE_COLOR!==void 0&&process.env.FORCE_COLOR!==""?!0:!!process.stdout.isTTY}function A(n,...e){return!me()||e.length===0?n:`${e.map(i=>`\x1B[${ge[i]}m`).join("")}${n}${fe}`}var j=n=>A(n,"bold"),J=n=>A(n,"dim");import{mkdirSync as he,readFileSync as be,writeFileSync as ye}from"fs";import{homedir as we}from"os";import{join as q}from"path";function G(){return process.env.SELDON_CONFIG_DIR??process.env.BLOK_CONFIG_DIR??q(we(),".config","seldon")}function Q(){return q(G(),"config.json")}function x(){try{return JSON.parse(be(Q(),"utf8"))}catch{return{}}}function $(n){let e={...x(),...n};return he(G(),{recursive:!0,mode:448}),ye(Q(),`${JSON.stringify(e,null,2)}
3
- `,{encoding:"utf8",mode:384}),e}function V(n,e,t){return{baseUrl:n.baseUrl??t.SELDON_BASE_URL??t.BLOK_BASE_URL??e.baseUrl,apiKey:n.apiKey??t.SELDON_API_KEY??t.BLOK_API_KEY??e.apiKey}}import{defaultSeldonYamlConfig as Se,getBaselinePlan as Ie,loadSeldonYamlConfig as Ce}from"@blok/sdk";import{defaultSeldonYamlConfig as ve,loadSeldonYamlConfig as U,saveSeldonYamlConfig as Re}from"@blok/sdk";function S(n,e){if(n.id)return n.id;let t=U(e),i=t?.baseline?.baselineId;if(i)return i;let s=t?.baseline?.experimentId;if(s)return process.stderr.write(`note: seldon.yml uses the legacy 'baseline.experimentId' \u2014 rename it to 'baseline.baselineId'.
4
- `),s;throw new Error("No baseline found here. Run `seldon baseline generate` first, or pass --id <baselineId>.")}function H(n,e){if(n.id)return n.id;let t=U(e),i=t?.baseline?.lastRunExperimentId;if(i)return i;let s=t?.baseline?.experimentId;if(s)return s;throw new Error("No run found here yet. Run `seldon baseline run` first, or pass --id <experimentId>.")}function I(n,e){let t=U(n)??ve(),i=e(t);return Re(n,i),i}var ke="Other",xe=3,Ae=3,$e=3,_=["none","skip","only","fixed"],Oe={none:" ",skip:"s",only:"o",fixed:"f"};function Ee(){return{get isTTY(){return!!process.stdin.isTTY},get columns(){return process.stdout.columns||80},get rows(){return process.stdout.rows||24},write:n=>process.stdout.write(n),onData:n=>process.stdin.on("data",n),offData:n=>process.stdin.removeListener("data",n),onResize:n=>process.stdout.on("resize",n),offResize:n=>process.stdout.removeListener("resize",n),setRawMode:n=>process.stdin.setRawMode?.(n),resume:()=>{process.stdin.setEncoding("utf8"),process.stdin.resume()},pause:()=>process.stdin.pause()}}function Te(n){let e=new Map;for(let i of n){let s=i.area?.trim()||ke;(e.get(s)??e.set(s,[]).get(s)).push(i)}let t=[];for(let[i,s]of e){t.push({kind:"header",text:`${i} (${s.length} case${s.length===1?"":"s"})`});for(let l of s)t.push({kind:"case",testCase:l})}return t}function Pe(n,e){let t=(Ce(e)??Se()).testCases,i=new Set(n.map(l=>l.id)),s=new Map(n.map(l=>[l.id,"none"]));for(let l of t?.fixed??[])i.has(l)&&s.set(l,"fixed");for(let l of t?.skip??[])i.has(l)&&s.set(l,"skip");for(let l of t?.only??[])i.has(l)&&s.set(l,"only");return s}function De(n,e){return e<=1||n.length<=e?n:`${n.slice(0,Math.max(0,e-1))}\u2026`}var L=class{constructor(e,t,i,s){this.planTitle=e;this.io=s;this.rows=Te(t),this.caseRowIndices=this.rows.reduce((l,f,g)=>f.kind==="case"?[...l,g]:l,[]),this.statuses=Pe(t,i),this.cursor=0}planTitle;io;rows;caseRowIndices;statuses;cursor;linesWrittenLastRender=0;resolveFn;get columns(){return this.io.columns}get availableRows(){return Math.max($e,this.io.rows-xe-Ae)}currentCase(){let e=this.rows[this.caseRowIndices[this.cursor]];if(e?.kind!=="case")throw new Error("cursor is not on a case row");return e.testCase}setStatus(e){let t=this.currentCase().id;this.statuses.set(t,this.statuses.get(t)===e?"none":e)}cycleStatus(){let e=this.currentCase().id,t=this.statuses.get(e)??"none",i=_[(_.indexOf(t)+1)%_.length];this.statuses.set(e,i)}moveCursor(e){let t=this.caseRowIndices.length;this.cursor=((this.cursor+e)%t+t)%t}counts(){let e={none:0,skip:0,only:0,fixed:0};for(let t of this.statuses.values())e[t]+=1;return e}viewportRange(){let e=this.rows.length,t=this.availableRows;if(e<=t)return[0,e];let i=this.caseRowIndices[this.cursor],s=Math.max(0,i-Math.floor(t/2));return s=Math.min(s,e-t),[s,s+t]}render(){let e=this.columns,t=[],i=(g,...m)=>{t.push({text:g,colors:m.length?m:void 0})};i(`Configure test cases \u2014 ${this.planTitle}`,"bold"),i("\u2191/\u2193 move \xB7 s/o/f set \xB7 space cycle \xB7 enter save \xB7 esc/q cancel","dim"),i("");let[s,l]=this.viewportRange();s>0&&i(` \u2191 ${s} more above`,"dim");for(let g=s;g<l;g+=1){let m=this.rows[g];if(m.kind==="header"){i(m.text,"bold");continue}let b=this.caseRowIndices[this.cursor]===g,w=this.statuses.get(m.testCase.id)??"none",v=`${b?"\u276F":" "} [${Oe[w]}] ${m.testCase.id}: ${m.testCase.title}`;b?i(v,"cyan","bold"):w==="skip"?i(v,"yellow"):w==="only"?i(v,"cyan"):w==="fixed"?i(v,"green"):i(v)}l<this.rows.length&&i(` \u2193 ${this.rows.length-l} more below`,"dim");let f=this.counts();i(""),i("Legend: [s]=skip [o]=only [f]=fixed [ ]=normal","dim"),i(`skip: ${f.skip} only: ${f.only} fixed: ${f.fixed}`,"dim"),this.linesWrittenLastRender>0&&this.io.write(`\x1B[${this.linesWrittenLastRender}A`);for(let{text:g,colors:m}of t){let b=De(g,e);this.io.write(`\r\x1B[2K${m?A(b,...m):b}
5
- `)}this.linesWrittenLastRender=t.length}finish(e){this.io.write(`
6
- `),this.cleanup(),this.resolveFn?.(e)}onData=e=>{if(e===""||e==="q"||e==="\x1B")return this.finish(!1);if(e==="\r"||e===`
7
- `)return this.finish(!0);if(e==="\x1B[A"||e==="k")return this.rerenderAfter(()=>this.moveCursor(-1));if(e==="\x1B[B"||e==="j")return this.rerenderAfter(()=>this.moveCursor(1));if(e===" ")return this.rerenderAfter(()=>this.cycleStatus());if(e==="s")return this.rerenderAfter(()=>this.setStatus("skip"));if(e==="o")return this.rerenderAfter(()=>this.setStatus("only"));if(e==="f")return this.rerenderAfter(()=>this.setStatus("fixed"))};rerenderAfter(e){e(),this.render()}onResize=()=>{this.linesWrittenLastRender=0,this.render()};cleanup(){this.io.setRawMode(!1),this.io.pause(),this.io.offData(this.onData),this.io.offResize(this.onResize),this.io.write("\x1B[?25h")}async run(){if(!this.io.isTTY)throw new Error("`seldon baseline configure` needs an interactive terminal (TTY). Run it directly in a shell.");return this.io.write("\x1B[?25l"),this.render(),this.io.setRawMode(!0),this.io.resume(),this.io.onData(this.onData),this.io.onResize(this.onResize),new Promise(e=>{this.resolveFn=e})}result(){let e=[],t=[],i=[];for(let[s,l]of this.statuses)l==="skip"?e.push(s):l==="only"?t.push(s):l==="fixed"&&i.push(s);return{skip:e,only:t,fixed:i}}};async function N(n,e,t,i){let{status:s}=i,l=await Ie(n,t),f=l.cases??[];if(f.length===0){s("This baseline has no test cases yet \u2014 wait for generation to finish, then try again.");return}let g=new L(l.title??"Baseline",f,e,i.io??Ee());if(!await g.run()){s("Aborted \u2014 no changes saved.");return}let{skip:b,only:w,fixed:k}=g.result();I(e,v=>({...v,testCases:{skip:b,only:w,fixed:k}})),s(`Saved to seldon.yml \u2014 skip: ${b.length}, only: ${w.length}, fixed: ${k.length}`)}import{existsSync as je}from"fs";import{buildInitialConfig as Ue,collectCodebaseFiles as _e,formatBytes as Le,saveSeldonYamlConfig as O,seldonYamlPath as X,summarizeCollectedFiles as Ne,summarizeSkipped as Be,uniqueIgnoredDirs as Fe}from"@blok/sdk";import{cancel as B,confirm as Ke,intro as Ye,isCancel as E,outro as Z,text as F}from"@clack/prompts";var K=12,ee=48,Y=8;function te(n){if(n.length<=ee)return n;let e=ee-1,t=Math.ceil(e/2),i=Math.floor(e/2);return`${n.slice(0,t)}\u2026${n.slice(n.length-i)}`}function Me(n,e){let t=[];n["too-large"]&&t.push(`${n["too-large"]} too large`),n.binary&&t.push(`${n.binary} binary`),n.hidden&&t.push(`${n.hidden} hidden`),n["root-file"]&&t.push(`${n["root-file"]} root file(s)`),t.length&&e(`Excluded from upload: ${t.join(", ")}`)}function ne(n,e,t,i){i(""),i(`Files that will be included: ${n.totalFiles} file(s), ${Le(n.totalBytes)}`);for(let s of n.rootEntries.slice(0,K)){let l=te(s.name);i(s.type==="dir"?` ${l}/ (${s.fileCount} file${s.fileCount===1?"":"s"})`:` ${l}`)}if(n.rootEntries.length>K&&i(` \u2026 and ${n.rootEntries.length-K} more`),e.length>0){let s=e.slice(0,Y).map(te).join(", "),l=e.length>Y?` (+${e.length-Y} more)`:"";i(`Automatically ignoring: ${s}${l}`)}Me(t,i)}function ze(n){let e=n.split(",").map(t=>t.trim().replace(/^\/+|\/+$/g,"")).filter(Boolean);return Array.from(new Set(e))}async function We(n,e,t){let{files:i,skipped:s,totalBytes:l}=await _e(n,{ignoreDirs:e});ne(Ne(i,l),Fe(s),Be(s),t)}async function ie(n,e){let{status:t}=e;if(Ye("Welcome to Seldon!"),je(X(n))){let m=await Ke({message:"seldon.yml already exists here. Reset it to defaults?",initialValue:!1});if(E(m)||!m){Z("Keeping the existing seldon.yml. Nothing changed.");return}}let i=await Ue(n),s=i.config;O(n,s),t("Created seldon.yml with smart defaults."),t("Analyzing your repository..."),ne(i.preview,i.ignored,i.skippedByReason,t);let l=await F({message:"Add more folders to ignore? (folder names, comma-separated \u2014 files aren't excluded here)",placeholder:"e.g. vendor, tmp (leave empty to skip)"});if(E(l)){B("Stopped \u2014 seldon.yml has the smart defaults saved above.");return}if(l.trim()){let m=ze(l);s={...s,baseline:{...s.baseline,generate:{...s.baseline?.generate,ignoreDirs:Array.from(new Set([...s.baseline?.generate?.ignoreDirs??[],...m]))}}},O(n,s),t(""),t("Updated \u2014 here's what will be included now:"),await We(n,s.baseline?.generate?.ignoreDirs??[],t)}let f=await F({message:"Default staging URL? (optional)",placeholder:"https://staging.example.com"});if(E(f)){B("Stopped \u2014 seldon.yml has been saved with what you've entered so far.");return}f.trim()&&(s={...s,baseline:{...s.baseline,run:{...s.baseline?.run,url:f.trim()}}});let g=await F({message:"Scope for baseline generation? (optional, e.g. 'checkout flow')",placeholder:"leave empty for full codebase analysis"});if(E(g)){B("Stopped \u2014 seldon.yml has been saved with what you've entered so far."),O(n,s);return}g.trim()&&(s={...s,baseline:{...s.baseline,generate:{...s.baseline?.generate,scope:g.trim()}}}),O(n,s),Z(["Configuration complete!","",`Saved to: ${X(n)}`,"","Next steps:"," 1. Generate your baseline: seldon baseline generate"," 2. Configure test cases: seldon baseline configure"," 3. Run against staging: seldon baseline run"," 4. After code changes: seldon baseline update"].join(`
8
- `))}import{spinner as Je}from"@clack/prompts";var se=["Still working","Reticulating splines","Reading through the codebase","Thinking it through","Almost there","Hang tight"];function qe(n){let e=Math.floor(n/1e3),t=Math.floor(e/60),i=e%60;return t>0?`${t}m ${i}s`:`${i}s`}function T(n){let e=Je(),t=0;return e.start(n),{onTick:s=>{let l=se[t%se.length];t+=1,e.message(`${n} (${qe(s)}) \u2014 ${l}...`)},stop:s=>e.stop(s)}}async function M(n,e){let t=T(n),i=Date.now(),s=setInterval(()=>t.onTick(Date.now()-i),2e3);try{return await e()}finally{clearInterval(s),t.stop("")}}function P(n,e){return n.json?"json":n.md?"markdown":e?.cli?.reportFormat??"text"}var ft={only:"o",skip:"s",fixed:"f",none:" "};function gt(n,e,t){return ft[Ze(n,e?.testCases,t)]}function de(n){let e={};for(let t of n??[]){let i=t.indexOf("=");i>0&&(e[t.slice(0,i)]=t.slice(i+1))}return e}function ce(n,e=[]){let t=n.out??(o=>process.stdout.write(`${o}
9
- `)),i=n.status??(o=>process.stderr.write(`${o}
10
- `)),s=new ut("seldon");s.description(["Seldon \u2014 generate QA baselines from any codebase and run them from your terminal or CI.","","Authenticate once:"," seldon login seldon_<your-key> (or: seldon config set-key <key>)","","Typical flow, from inside a project:"," seldon init # create seldon.yml, preview what will be analyzed"," seldon baseline generate # read this codebase, build a QA baseline"," seldon baseline cases # review the generated test cases"," seldon baseline configure # mark cases as skip / only / fixed"," seldon baseline run --url https://staging.example.com"," seldon baseline report --md # clean, actionable results","","When the code changes, re-evaluate the baseline (fixed cases are always kept):"," seldon baseline update # whole-repo re-eval: kept / re-anchored / nullified / added"," seldon baseline delta # PR-style: stage a DRAFT from your changes + auto-run","","Inspect and manage versions:"," seldon baseline list # every baseline your key can see (all sources)"," seldon baseline versions # this lineage's committed head + draft proposals"," seldon baseline promote <versionId> # make a draft the committed head runs resolve to","","Configuration lives in seldon.yml at the project root (config-as-code, no server copy).","","Everything else is reachable via: seldon api <operation> [--path k=v] [--query k=v] [--data '{json}']"].join(`
2
+ import{createHash as Ao}from"crypto";import{mkdir as xo,readFile as ki,writeFile as So}from"fs/promises";import{homedir as Co,tmpdir as _o}from"os";import{join as Di}from"path";import{execFileSync as To}from"child_process";import{readdir as Ro,readFile as Pi,stat as ji}from"fs/promises";import{join as qi,relative as Eo,sep as Ri}from"path";import{createRequire as Mr}from"module";var Nr=Mr("/"),Me,Fr,Dr;try{Me=Nr("worker_threads"),Fr=Me.Worker,Dr=Me.isMarkedAsUntransferable}catch{}var ie=Uint8Array,fe=Uint16Array,bn=Int32Array,An=new ie([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xn=new ie([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bt=new ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kt=function(n,t){for(var i=new fe(31),r=0;r<31;++r)i[r]=t+=1<<n[r-1];for(var a=new bn(i[30]),r=1;r<30;++r)for(var s=i[r];s<i[r+1];++s)a[s]=s-i[r]<<5|r;return{b:i,r:a}},Me=kt(An,2),Br=Me.b,mn=Me.r;Br[28]=258,mn[258]=28;var Tt=kt(xn,0),Ma=Tt.b,At=Tt.r,vn=new fe(32768);for(K=0;K<32768;++K)_e=(K&43690)>>1|(K&21845)<<1,_e=(_e&52428)>>2|(_e&13107)<<2,_e=(_e&61680)>>4|(_e&3855)<<4,vn[K]=((_e&65280)>>8|(_e&255)<<8)>>1;var _e,K,Ue=(function(n,t,i){for(var r=n.length,a=0,s=new fe(t);a<r;++a)n[a]&&++s[n[a]-1];var l=new fe(t);for(a=1;a<t;++a)l[a]=l[a-1]+s[a-1]<<1;var c;if(i){c=new fe(1<<t);var p=15-t;for(a=0;a<r;++a)if(n[a])for(var u=a<<4|n[a],f=t-n[a],g=l[n[a]-1]++<<f,v=g|(1<<f)-1;g<=v;++g)c[vn[g]>>p]=u}else for(c=new fe(r),a=0;a<r;++a)n[a]&&(c[a]=vn[l[n[a]-1]++]>>15-n[a]);return c}),Le=new ie(288);for(K=0;K<144;++K)Le[K]=8;var K;for(K=144;K<256;++K)Le[K]=9;var K;for(K=256;K<280;++K)Le[K]=7;var K;for(K=280;K<288;++K)Le[K]=8;var K,Ze=new ie(32);for(K=0;K<32;++K)Ze[K]=5;var K,Ur=Ue(Le,9,0);var Pr=Ue(Ze,5,0);var Rt=function(n){return(n+7)/8|0},Et=function(n,t,i){return(t==null||t<0)&&(t=0),(i==null||i>n.length)&&(i=n.length),new ie(n.subarray(t,i))};var jr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Xe=function(n,t,i){var r=new Error(t||jr[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Xe),!i)throw r;return r};var Ie=function(n,t,i){i<<=t&7;var r=t/8|0;n[r]|=i,n[r+1]|=i>>8},De=function(n,t,i){i<<=t&7;var r=t/8|0;n[r]|=i,n[r+1]|=i>>8,n[r+2]|=i>>16},gn=function(n,t){for(var i=[],r=0;r<n.length;++r)n[r]&&i.push({s:r,f:n[r]});var a=i.length,s=i.slice();if(!a)return{t:Lt,l:0};if(a==1){var l=new ie(i[0].s+1);return l[i[0].s]=1,{t:l,l:1}}i.sort(function(M,z){return M.f-z.f}),i.push({s:-1,f:25001});var c=i[0],p=i[1],u=0,f=1,g=2;for(i[0]={s:-1,f:c.f+p.f,l:c,r:p};f!=a-1;)c=i[i[u].f<i[g].f?u++:g++],p=i[u!=f&&i[u].f<i[g].f?u++:g++],i[f++]={s:-1,f:c.f+p.f,l:c,r:p};for(var v=s[0].s,r=1;r<a;++r)s[r].s>v&&(v=s[r].s);var R=new fe(v+1),F=yn(i[f-1],R,0);if(F>t){var r=0,$=0,w=F-t,T=1<<w;for(s.sort(function(z,P){return R[P.s]-R[z.s]||z.f-P.f});r<a;++r){var k=s[r].s;if(R[k]>t)$+=T-(1<<F-R[k]),R[k]=t;else break}for($>>=w;$>0;){var B=s[r].s;R[B]<t?$-=1<<t-R[B]++-1:++r}for(;r>=0&&$;--r){var N=s[r].s;R[N]==t&&(--R[N],++$)}F=t}return{t:new ie(R),l:F}},yn=function(n,t,i){return n.s==-1?Math.max(yn(n.l,t,i+1),yn(n.r,t,i+1)):t[n.s]=i},xt=function(n){for(var t=n.length;t&&!n[--t];);for(var i=new fe(++t),r=0,a=n[0],s=1,l=function(p){i[r++]=p},c=1;c<=t;++c)if(n[c]==a&&c!=t)++s;else{if(!a&&s>2){for(;s>138;s-=138)l(32754);s>2&&(l(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(l(a),--s;s>6;s-=6)l(8304);s>2&&(l(s-3<<5|8208),s=0)}for(;s--;)l(a);s=1,a=n[c]}return{c:i.subarray(0,r),n:t}},Be=function(n,t){for(var i=0,r=0;r<t.length;++r)i+=n[r]*t[r];return i},Ot=function(n,t,i){var r=i.length,a=Rt(t+2);n[a]=r&255,n[a+1]=r>>8,n[a+2]=n[a]^255,n[a+3]=n[a+1]^255;for(var s=0;s<r;++s)n[a+s+4]=i[s];return(a+4+r)*8},St=function(n,t,i,r,a,s,l,c,p,u,f){Ie(t,f++,i),++a[256];for(var g=gn(a,15),v=g.t,R=g.l,F=gn(s,15),$=F.t,w=F.l,T=xt(v),k=T.c,B=T.n,N=xt($),M=N.c,z=N.n,P=new fe(19),j=0;j<k.length;++j)++P[k[j]&31];for(var j=0;j<M.length;++j)++P[M[j]&31];for(var q=gn(P,7),X=q.t,pe=q.l,Z=19;Z>4&&!X[bt[Z-1]];--Z);var de=u+5<<3,H=Be(a,Le)+Be(s,Ze)+l,te=Be(a,v)+Be(s,$)+l+14+3*Z+Be(P,X)+2*P[16]+3*P[17]+7*P[18];if(p>=0&&de<=H&&de<=te)return Ot(t,f,n.subarray(p,p+u));var E,Q,J,he;if(Ie(t,f,1+(te<H)),f+=2,te<H){E=Ue(v,R,0),Q=v,J=Ue($,w,0),he=$;var ve=Ue(X,pe,0);Ie(t,f,B-257),Ie(t,f+5,z-1),Ie(t,f+10,Z-4),f+=14;for(var j=0;j<Z;++j)Ie(t,f+3*j,X[bt[j]]);f+=3*Z;for(var le=[k,M],ye=0;ye<2;++ye)for(var ue=le[ye],j=0;j<ue.length;++j){var oe=ue[j]&31;Ie(t,f,ve[oe]),f+=X[oe],oe>15&&(Ie(t,f,ue[j]>>5&127),f+=ue[j]>>12)}}else E=Ur,Q=Le,J=Pr,he=Ze;for(var j=0;j<c;++j){var G=r[j];if(G>255){var oe=G>>18&31;De(t,f,E[oe+257]),f+=Q[oe+257],oe>7&&(Ie(t,f,G>>23&31),f+=An[oe]);var ae=G&31;De(t,f,J[ae]),f+=he[ae],ae>3&&(De(t,f,G>>5&8191),f+=xn[ae])}else De(t,f,E[G]),f+=Q[G]}return De(t,f,E[256]),f+Q[256]},qr=new bn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lt=new ie(0),Yr=function(n,t,i,r,a,s){var l=s.z||n.length,c=new ie(r+l+5*(1+Math.ceil(l/7e3))+a),p=c.subarray(r,c.length-a),u=s.l,f=(s.r||0)&7;if(t){f&&(p[0]=s.r>>3);for(var g=qr[t-1],v=g>>13,R=g&8191,F=(1<<i)-1,$=s.p||new fe(32768),w=s.h||new fe(F+1),T=Math.ceil(i/3),k=2*T,B=function(xe){return(n[xe]^n[xe+1]<<T^n[xe+2]<<k)&F},N=new bn(25e3),M=new fe(288),z=new fe(32),P=0,j=0,q=s.i||0,X=0,pe=s.w||0,Z=0;q+2<l;++q){var de=B(q),H=q&32767,te=w[de];if($[H]=te,w[de]=H,pe<=q){var E=l-q;if((P>7e3||X>24576)&&(E>423||!u)){f=St(n,p,0,N,M,z,j,X,Z,q-Z,f),X=P=j=0,Z=q;for(var Q=0;Q<286;++Q)M[Q]=0;for(var Q=0;Q<30;++Q)z[Q]=0}var J=2,he=0,ve=R,le=H-te&32767;if(E>2&&de==B(q-le))for(var ye=Math.min(v,E)-1,ue=Math.min(32767,q),oe=Math.min(258,E);le<=ue&&--ve&&H!=te;){if(n[q+J]==n[q+J-le]){for(var G=0;G<oe&&n[q+G]==n[q+G-le];++G);if(G>J){if(J=G,he=le,G>ye)break;for(var ae=Math.min(le,G-2),ge=0,Q=0;Q<ae;++Q){var we=q-le+Q&32767,V=$[we],Ae=we-V&32767;Ae>ge&&(ge=Ae,te=we)}}}H=te,te=$[H],le+=H-te&32767}if(he){N[X++]=268435456|mn[J]<<18|At[he];var me=mn[J]&31,Oe=At[he]&31;j+=An[me]+xn[Oe],++M[257+me],++z[Oe],pe=q+J,++P}else N[X++]=n[q],++M[n[q]]}}for(q=Math.max(q,pe);q<l;++q)N[X++]=n[q],++M[n[q]];f=St(n,p,u,N,M,z,j,X,Z,q-Z,f),u||(s.r=f&7|p[f/8|0]<<3,f-=7,s.h=w,s.p=$,s.i=q,s.w=pe)}else{for(var q=s.w||0;q<l+u;q+=65535){var ke=q+65535;ke>=l&&(p[f/8|0]=u,ke=l),f=Ot(p,f+1,n.subarray(q,ke))}s.i=l}return Et(c,0,r+Rt(f)+a)},zr=(function(){for(var n=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(i&1&&-306674912)^i>>>1;n[t]=i}return n})(),Kr=function(){var n=-1;return{p:function(t){for(var i=n,r=0;r<t.length;++r)i=zr[i&255^t[r]]^i>>>8;n=i},d:function(){return~n}}};var Hr=function(n,t,i,r,a){if(!a&&(a={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),l=new ie(s.length+n.length);l.set(s),l.set(n,s.length),n=l,a.w=s.length}return Yr(n,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,i,r,a)},$t=function(n,t){var i={};for(var r in n)i[r]=n[r];for(var r in t)i[r]=t[r];return i};var ee=function(n,t,i){for(;i;++t)n[t]=i,i>>>=8};function Gr(n,t){return Hr(n,t||{},0,0)}var Mt=function(n,t,i,r){for(var a in n){var s=n[a],l=t+a,c=r;Array.isArray(s)&&(c=$t(r,s[1]),s=s[0]),ArrayBuffer.isView(s)?i[l]=[s,c]:(i[l+="/"]=[new ie(0),c],Mt(s,l,i,r))}},Ct=typeof TextEncoder<"u"&&new TextEncoder,Wr=typeof TextDecoder<"u"&&new TextDecoder,Qr=0;try{Wr.decode(Lt,{stream:!0}),Qr=1}catch{}function _t(n,t){if(t){for(var i=new ie(n.length),r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}if(Ct)return Ct.encode(n);for(var a=n.length,s=new ie(n.length+(n.length>>1)),l=0,c=function(f){s[l++]=f},r=0;r<a;++r){if(l+5>s.length){var p=new ie(l+8+(a-r<<1));p.set(s),s=p}var u=n.charCodeAt(r);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|n.charCodeAt(++r)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return Et(s,0,l)}var wn=function(n){var t=0;if(n)for(var i in n){var r=n[i].length;r>65535&&Xe(9),t+=r+4}return t},It=function(n,t,i,r,a,s,l,c){var p=r.length,u=i.extra,f=c&&c.length,g=wn(u);ee(n,t,l!=null?33639248:67324752),t+=4,l!=null&&(n[t++]=20,n[t++]=i.os),n[t]=20,t+=2,n[t++]=i.flag<<1|(s<0&&8),n[t++]=a&&8,n[t++]=i.compression&255,n[t++]=i.compression>>8;var v=new Date(i.mtime==null?Date.now():i.mtime),R=v.getFullYear()-1980;if((R<0||R>119)&&Xe(10),ee(n,t,R<<25|v.getMonth()+1<<21|v.getDate()<<16|v.getHours()<<11|v.getMinutes()<<5|v.getSeconds()>>1),t+=4,s!=-1&&(ee(n,t,i.crc),ee(n,t+4,s<0?-s-2:s),ee(n,t+8,i.size)),ee(n,t+12,p),ee(n,t+14,g),t+=16,l!=null&&(ee(n,t,f),ee(n,t+6,i.attrs),ee(n,t+10,l),t+=14),n.set(r,t),t+=p,g)for(var F in u){var $=u[F],w=$.length;ee(n,t,+F),ee(n,t+2,w),n.set($,t+4),t+=4+w}return f&&(n.set(c,t),t+=f),t},Vr=function(n,t,i,r,a){ee(n,t,101010256),ee(n,t+8,i),ee(n,t+10,i),ee(n,t+12,r),ee(n,t+16,a)};function Sn(n,t){t||(t={});var i={},r=[];Mt(n,"",i,t);var a=0,s=0;for(var l in i){var c=i[l],p=c[0],u=c[1],f=u.level==0?0:8,g=_t(l),v=g.length,R=u.comment,F=R&&_t(R),$=F&&F.length,w=wn(u.extra);v>65535&&Xe(11);var T=f?Gr(p,u):p,k=T.length,B=Kr();B.p(p),r.push($t(u,{size:p.length,crc:B.d(),c:T,f:g,m:F,u:v!=l.length||F&&R.length!=$,o:a,compression:f})),a+=30+v+w+k,s+=76+2*(v+w)+($||0)+k}for(var N=new ie(s+22),M=a,z=s-a,P=0;P<r.length;++P){var g=r[P];It(N,g.o,g,g.f,g.u,g.c.length);var j=30+g.f.length+wn(g.extra);N.set(g.c,g.o+j),It(N,a,g,g.f,g.u,g.c.length,g.o,g.m),a+=16+j+(g.m?g.m.length:0)}return Vr(N,a,r.length,z,M),N}import{readFileSync as hr,writeFileSync as Vo}from"fs";import{join as Jo,resolve as Zo}from"path";function Jr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var re={},en={},Te={},Nt;function Pe(){if(Nt)return Te;Nt=1;function n(l){return typeof l>"u"||l===null}function t(l){return typeof l=="object"&&l!==null}function i(l){return Array.isArray(l)?l:n(l)?[]:[l]}function r(l,c){if(c){let p=Object.keys(c);for(let u=0,f=p.length;u<f;u+=1){let g=p[u];l[g]=c[g]}}return l}function a(l,c){let p="";for(let u=0;u<c;u+=1)p+=l;return p}function s(l){return l===0&&Number.NEGATIVE_INFINITY===1/l}return Te.isNothing=n,Te.isObject=t,Te.toArray=i,Te.repeat=a,Te.isNegativeZero=s,Te.extend=r,Te}var Cn,Ft;function je(){if(Ft)return Cn;Ft=1;function n(i,r){let a="",s=i.reason||"(unknown reason)";return i.mark?(i.mark.name&&(a+='in "'+i.mark.name+'" '),a+="("+(i.mark.line+1)+":"+(i.mark.column+1)+")",!r&&i.mark.snippet&&(a+=`
3
+
4
+ `+i.mark.snippet),s+" "+a):s}function t(i,r){Error.call(this),this.name="YAMLException",this.reason=i,this.mark=r,this.message=n(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=function(r){return this.name+": "+n(this,r)},Cn=t,Cn}var _n,Dt;function Zr(){if(Dt)return _n;Dt=1;let n=Pe();function t(a,s,l,c,p){let u="",f="",g=Math.floor(p/2)-1;return c-s>g&&(u=" ... ",s=c-g+u.length),l-c>g&&(f=" ...",l=c+g-f.length),{str:u+a.slice(s,l).replace(/\t/g,"\u2192")+f,pos:c-s+u.length}}function i(a,s){return n.repeat(" ",s-a.length)+a}function r(a,s){if(s=Object.create(s||null),!a.buffer)return null;s.maxLength||(s.maxLength=79),typeof s.indent!="number"&&(s.indent=1),typeof s.linesBefore!="number"&&(s.linesBefore=3),typeof s.linesAfter!="number"&&(s.linesAfter=2);let l=/\r?\n|\r|\0/g,c=[0],p=[],u,f=-1;for(;u=l.exec(a.buffer);)p.push(u.index),c.push(u.index+u[0].length),a.position<=u.index&&f<0&&(f=c.length-2);f<0&&(f=c.length-1);let g="",v=Math.min(a.line+s.linesAfter,p.length).toString().length,R=s.maxLength-(s.indent+v+3);for(let $=1;$<=s.linesBefore&&!(f-$<0);$++){let w=t(a.buffer,c[f-$],p[f-$],a.position-(c[f]-c[f-$]),R);g=n.repeat(" ",s.indent)+i((a.line-$+1).toString(),v)+" | "+w.str+`
5
+ `+g}let F=t(a.buffer,c[f],p[f],a.position,R);g+=n.repeat(" ",s.indent)+i((a.line+1).toString(),v)+" | "+F.str+`
6
+ `,g+=n.repeat("-",s.indent+v+3+F.pos)+`^
7
+ `;for(let $=1;$<=s.linesAfter&&!(f+$>=p.length);$++){let w=t(a.buffer,c[f+$],p[f+$],a.position-(c[f]-c[f+$]),R);g+=n.repeat(" ",s.indent)+i((a.line+$+1).toString(),v)+" | "+w.str+`
8
+ `}return g.replace(/\n$/,"")}return _n=r,_n}var In,Bt;function se(){if(Bt)return In;Bt=1;let n=je(),t=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];function r(s){let l={};return s!==null&&Object.keys(s).forEach(function(c){s[c].forEach(function(p){l[String(p)]=c})}),l}function a(s,l){if(l=l||{},Object.keys(l).forEach(function(c){if(t.indexOf(c)===-1)throw new n('Unknown option "'+c+'" is met in definition of "'+s+'" YAML type.')}),this.options=l,this.tag=s,this.kind=l.kind||null,this.resolve=l.resolve||function(){return!0},this.construct=l.construct||function(c){return c},this.instanceOf=l.instanceOf||null,this.predicate=l.predicate||null,this.represent=l.represent||null,this.representName=l.representName||null,this.defaultStyle=l.defaultStyle||null,this.multi=l.multi||!1,this.styleAliases=r(l.styleAliases||null),i.indexOf(this.kind)===-1)throw new n('Unknown kind "'+this.kind+'" is specified for "'+s+'" YAML type.')}return In=a,In}var kn,Ut;function ai(){if(Ut)return kn;Ut=1;let n=je(),t=se();function i(s,l){let c=[];return s[l].forEach(function(p){let u=c.length;c.forEach(function(f,g){f.tag===p.tag&&f.kind===p.kind&&f.multi===p.multi&&(u=g)}),c[u]=p}),c}function r(){let s={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function l(c){c.multi?(s.multi[c.kind].push(c),s.multi.fallback.push(c)):s[c.kind][c.tag]=s.fallback[c.tag]=c}for(let c=0,p=arguments.length;c<p;c+=1)arguments[c].forEach(l);return s}function a(s){return this.extend(s)}return a.prototype.extend=function(l){let c=[],p=[];if(l instanceof t)p.push(l);else if(Array.isArray(l))p=p.concat(l);else if(l&&(Array.isArray(l.implicit)||Array.isArray(l.explicit)))l.implicit&&(c=c.concat(l.implicit)),l.explicit&&(p=p.concat(l.explicit));else throw new n("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");c.forEach(function(f){if(!(f instanceof t))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new n("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new n("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(f){if(!(f instanceof t))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let u=Object.create(a.prototype);return u.implicit=(this.implicit||[]).concat(c),u.explicit=(this.explicit||[]).concat(p),u.compiledImplicit=i(u,"implicit"),u.compiledExplicit=i(u,"explicit"),u.compiledTypeMap=r(u.compiledImplicit,u.compiledExplicit),u},kn=a,kn}var Tn,Pt;function si(){if(Pt)return Tn;Pt=1;let n=se();return Tn=new n("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),Tn}var Rn,jt;function li(){if(jt)return Rn;jt=1;let n=se();return Rn=new n("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),Rn}var En,qt;function ci(){if(qt)return En;qt=1;let n=se();return En=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),En}var On,Yt;function ui(){if(Yt)return On;Yt=1;let n=ai();return On=new n({explicit:[si(),li(),ci()]}),On}var Ln,zt;function fi(){if(zt)return Ln;zt=1;let n=se();function t(a){if(a===null)return!0;let s=a.length;return s===1&&a==="~"||s===4&&(a==="null"||a==="Null"||a==="NULL")}function i(){return null}function r(a){return a===null}return Ln=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:t,construct:i,predicate:r,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),Ln}var $n,Kt;function pi(){if(Kt)return $n;Kt=1;let n=se();function t(a){if(a===null)return!1;let s=a.length;return s===4&&(a==="true"||a==="True"||a==="TRUE")||s===5&&(a==="false"||a==="False"||a==="FALSE")}function i(a){return a==="true"||a==="True"||a==="TRUE"}function r(a){return Object.prototype.toString.call(a)==="[object Boolean]"}return $n=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:t,construct:i,predicate:r,represent:{lowercase:function(a){return a?"true":"false"},uppercase:function(a){return a?"TRUE":"FALSE"},camelcase:function(a){return a?"True":"False"}},defaultStyle:"lowercase"}),$n}var Mn,Ht;function di(){if(Ht)return Mn;Ht=1;let n=Pe(),t=se();function i(u){return u>=48&&u<=57||u>=65&&u<=70||u>=97&&u<=102}function r(u){return u>=48&&u<=55}function a(u){return u>=48&&u<=57}function s(u){if(u===null)return!1;let f=u.length,g=0,v=!1;if(!f)return!1;let R=u[g];if((R==="-"||R==="+")&&(R=u[++g]),R==="0"){if(g+1===f)return!0;if(R=u[++g],R==="b"){for(g++;g<f;g++){if(R=u[g],R!=="0"&&R!=="1")return!1;v=!0}return v&&isFinite(l(u))}if(R==="x"){for(g++;g<f;g++){if(!i(u.charCodeAt(g)))return!1;v=!0}return v&&isFinite(l(u))}if(R==="o"){for(g++;g<f;g++){if(!r(u.charCodeAt(g)))return!1;v=!0}return v&&isFinite(l(u))}}for(;g<f;g++){if(!a(u.charCodeAt(g)))return!1;v=!0}return v?isFinite(l(u)):!1}function l(u){let f=u,g=1,v=f[0];if((v==="-"||v==="+")&&(v==="-"&&(g=-1),f=f.slice(1),v=f[0]),f==="0")return 0;if(v==="0"){if(f[1]==="b")return g*parseInt(f.slice(2),2);if(f[1]==="x")return g*parseInt(f.slice(2),16);if(f[1]==="o")return g*parseInt(f.slice(2),8)}return g*parseInt(f,10)}function c(u){return l(u)}function p(u){return Object.prototype.toString.call(u)==="[object Number]"&&u%1===0&&!n.isNegativeZero(u)}return Mn=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:s,construct:c,predicate:p,represent:{binary:function(u){return u>=0?"0b"+u.toString(2):"-0b"+u.toString(2).slice(1)},octal:function(u){return u>=0?"0o"+u.toString(8):"-0o"+u.toString(8).slice(1)},decimal:function(u){return u.toString(10)},hexadecimal:function(u){return u>=0?"0x"+u.toString(16).toUpperCase():"-0x"+u.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Mn}var Nn,Gt;function hi(){if(Gt)return Nn;Gt=1;let n=Pe(),t=se(),i=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),r=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function a(u){return u===null||!i.test(u)?!1:isFinite(parseFloat(u,10))?!0:r.test(u)}function s(u){let f=u.toLowerCase(),g=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?g===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:g*parseFloat(f,10)}let l=/^[-+]?[0-9]+e/;function c(u,f){if(isNaN(u))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===u)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===u)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(u))return"-0.0";let g=u.toString(10);return l.test(g)?g.replace("e",".e"):g}function p(u){return Object.prototype.toString.call(u)==="[object Number]"&&(u%1!==0||n.isNegativeZero(u))}return Nn=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:a,construct:s,predicate:p,represent:c,defaultStyle:"lowercase"}),Nn}var Fn,Wt;function gi(){return Wt||(Wt=1,Fn=ui().extend({implicit:[fi(),pi(),di(),hi()]})),Fn}var Dn,Qt;function mi(){return Qt||(Qt=1,Dn=gi()),Dn}var Bn,Vt;function vi(){if(Vt)return Bn;Vt=1;let n=se(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function r(l){return l===null?!1:t.exec(l)!==null||i.exec(l)!==null}function a(l){let c=0,p=null,u=t.exec(l);if(u===null&&(u=i.exec(l)),u===null)throw new Error("Date resolve error");let f=+u[1],g=+u[2]-1,v=+u[3];if(!u[4])return new Date(Date.UTC(f,g,v));let R=+u[4],F=+u[5],$=+u[6];if(u[7]){for(c=u[7].slice(0,3);c.length<3;)c+="0";c=+c}if(u[9]){let T=+u[10],k=+(u[11]||0);p=(T*60+k)*6e4,u[9]==="-"&&(p=-p)}let w=new Date(Date.UTC(f,g,v,R,F,$,c));return p&&w.setTime(w.getTime()-p),w}function s(l){return l.toISOString()}return Bn=new n("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:r,construct:a,instanceOf:Date,represent:s}),Bn}var Un,Jt;function yi(){if(Jt)return Un;Jt=1;let n=se();function t(i){return i==="<<"||i===null}return Un=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:t}),Un}var Pn,Zt;function wi(){if(Zt)return Pn;Zt=1;let n=se(),t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
+ \r`;function i(l){if(l===null)return!1;let c=0,p=l.length,u=t;for(let f=0;f<p;f++){let g=u.indexOf(l.charAt(f));if(!(g>64)){if(g<0)return!1;c+=6}}return c%8===0}function r(l){let c=l.replace(/[\r\n=]/g,""),p=c.length,u=t,f=0,g=[];for(let R=0;R<p;R++)R%4===0&&R&&(g.push(f>>16&255),g.push(f>>8&255),g.push(f&255)),f=f<<6|u.indexOf(c.charAt(R));let v=p%4*6;return v===0?(g.push(f>>16&255),g.push(f>>8&255),g.push(f&255)):v===18?(g.push(f>>10&255),g.push(f>>2&255)):v===12&&g.push(f>>4&255),new Uint8Array(g)}function a(l){let c="",p=0,u=l.length,f=t;for(let v=0;v<u;v++)v%3===0&&v&&(c+=f[p>>18&63],c+=f[p>>12&63],c+=f[p>>6&63],c+=f[p&63]),p=(p<<8)+l[v];let g=u%3;return g===0?(c+=f[p>>18&63],c+=f[p>>12&63],c+=f[p>>6&63],c+=f[p&63]):g===2?(c+=f[p>>10&63],c+=f[p>>4&63],c+=f[p<<2&63],c+=f[64]):g===1&&(c+=f[p>>2&63],c+=f[p<<4&63],c+=f[64],c+=f[64]),c}function s(l){return Object.prototype.toString.call(l)==="[object Uint8Array]"}return Pn=new n("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i,construct:r,predicate:s,represent:a}),Pn}var jn,Xt;function bi(){if(Xt)return jn;Xt=1;let n=se(),t=Object.prototype.hasOwnProperty,i=Object.prototype.toString;function r(s){if(s===null)return!0;let l=[],c=s;for(let p=0,u=c.length;p<u;p+=1){let f=c[p],g=!1;if(i.call(f)!=="[object Object]")return!1;let v;for(v in f)if(t.call(f,v))if(!g)g=!0;else return!1;if(!g)return!1;if(l.indexOf(v)===-1)l.push(v);else return!1}return!0}function a(s){return s!==null?s:[]}return jn=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:r,construct:a}),jn}var qn,ei;function Ai(){if(ei)return qn;ei=1;let n=se(),t=Object.prototype.toString;function i(a){if(a===null)return!0;let s=a,l=new Array(s.length);for(let c=0,p=s.length;c<p;c+=1){let u=s[c];if(t.call(u)!=="[object Object]")return!1;let f=Object.keys(u);if(f.length!==1)return!1;l[c]=[f[0],u[f[0]]]}return!0}function r(a){if(a===null)return[];let s=a,l=new Array(s.length);for(let c=0,p=s.length;c<p;c+=1){let u=s[c],f=Object.keys(u);l[c]=[f[0],u[f[0]]]}return l}return qn=new n("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:i,construct:r}),qn}var Yn,ni;function xi(){if(ni)return Yn;ni=1;let n=se(),t=Object.prototype.hasOwnProperty;function i(a){if(a===null)return!0;let s=a;for(let l in s)if(t.call(s,l)&&s[l]!==null)return!1;return!0}function r(a){return a!==null?a:{}}return Yn=new n("tag:yaml.org,2002:set",{kind:"mapping",resolve:i,construct:r}),Yn}var zn,ti;function Hn(){return ti||(ti=1,zn=mi().extend({implicit:[vi(),yi()],explicit:[wi(),bi(),Ai(),xi()]})),zn}var ii;function Xr(){if(ii)return en;ii=1;let n=Pe(),t=je(),i=Zr(),r=Hn(),a=Object.prototype.hasOwnProperty,s=1,l=2,c=3,p=4,u=1,f=2,g=3,v=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,R=/[\x85\u2028\u2029]/,F=/[,\[\]{}]/,$=/^(?:!|!!|![0-9A-Za-z-]+!)$/,w=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function T(e){return Object.prototype.toString.call(e)}function k(e){return e===10||e===13}function B(e){return e===9||e===32}function N(e){return e===9||e===32||e===10||e===13}function M(e){return e===44||e===91||e===93||e===123||e===125}function z(e){if(e>=48&&e<=57)return e-48;let d=e|32;return d>=97&&d<=102?d-97+10:-1}function P(e){return e===120?2:e===117?4:e===85?8:0}function j(e){return e>=48&&e<=57?e-48:-1}function q(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
10
+ `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function X(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function pe(e,d,y){d==="__proto__"?Object.defineProperty(e,d,{configurable:!0,enumerable:!0,writable:!0,value:y}):e[d]=y}let Z=new Array(256),de=new Array(256);for(let e=0;e<256;e++)Z[e]=q(e)?1:0,de[e]=q(e);function H(e,d){this.input=e,this.filename=d.filename||null,this.schema=d.schema||r,this.onWarning=d.onWarning||null,this.legacy=d.legacy||!1,this.json=d.json||!1,this.listener=d.listener||null,this.maxDepth=typeof d.maxDepth=="number"?d.maxDepth:100,this.maxTotalMergeKeys=typeof d.maxTotalMergeKeys=="number"?d.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function te(e,d){let y={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return y.snippet=i(y),new t(d,y)}function E(e,d){throw te(e,d)}function Q(e,d){e.onWarning&&e.onWarning.call(null,te(e,d))}function J(e,d,y){let x=e.anchorMapTransactions;if(x.length!==0){let m=x[x.length-1];a.call(m,d)||(m[d]={existed:a.call(e.anchorMap,d),value:e.anchorMap[d]})}e.anchorMap[d]=y}function he(e){e.anchorMapTransactions.push(Object.create(null))}function ve(e){let d=e.anchorMapTransactions.pop(),y=e.anchorMapTransactions;if(y.length===0)return;let x=y[y.length-1],m=Object.keys(d);for(let I=0,o=m.length;I<o;I+=1){let h=m[I];a.call(x,h)||(x[h]=d[h])}}function le(e){let d=e.anchorMapTransactions.pop(),y=Object.keys(d);for(let x=y.length-1;x>=0;x-=1){let m=d[y[x]];m.existed?e.anchorMap[y[x]]=m.value:delete e.anchorMap[y[x]]}}function ye(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function ue(e,d){e.position=d.position,e.line=d.line,e.lineStart=d.lineStart,e.lineIndent=d.lineIndent,e.firstTabInLine=d.firstTabInLine,e.tag=d.tag,e.anchor=d.anchor,e.kind=d.kind,e.result=d.result}let oe={YAML:function(d,y,x){d.version!==null&&E(d,"duplication of %YAML directive"),x.length!==1&&E(d,"YAML directive accepts exactly one argument");let m=/^([0-9]+)\.([0-9]+)$/.exec(x[0]);m===null&&E(d,"ill-formed argument of the YAML directive");let I=parseInt(m[1],10),o=parseInt(m[2],10);I!==1&&E(d,"unacceptable YAML version of the document"),d.version=x[0],d.checkLineBreaks=o<2,o!==1&&o!==2&&Q(d,"unsupported YAML version of the document")},TAG:function(d,y,x){let m;x.length!==2&&E(d,"TAG directive accepts exactly two arguments");let I=x[0];m=x[1],$.test(I)||E(d,"ill-formed tag handle (first argument) of the TAG directive"),a.call(d.tagMap,I)&&E(d,'there is a previously declared suffix for "'+I+'" tag handle'),w.test(m)||E(d,"ill-formed tag prefix (second argument) of the TAG directive");try{m=decodeURIComponent(m)}catch{E(d,"tag prefix is malformed: "+m)}d.tagMap[I]=m}};function G(e,d,y,x){if(d<y){let m=e.input.slice(d,y);if(x)for(let I=0,o=m.length;I<o;I+=1){let h=m.charCodeAt(I);h===9||h>=32&&h<=1114111||E(e,"expected valid JSON character")}else v.test(m)&&E(e,"the stream contains non-printable characters");e.result+=m}}function ae(e,d,y,x){n.isObject(y)||E(e,"cannot merge mappings; the provided source object is unacceptable");let m=Object.keys(y);for(let I=0,o=m.length;I<o;I+=1){let h=m[I];e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys&&E(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")"),a.call(d,h)||(pe(d,h,y[h]),x[h]=!0)}}function ge(e,d,y,x,m,I,o,h,C){if(Array.isArray(m)){m=Array.prototype.slice.call(m);for(let b=0,A=m.length;b<A;b+=1)Array.isArray(m[b])&&E(e,"nested arrays are not supported inside keys"),typeof m=="object"&&T(m[b])==="[object Object]"&&(m[b]="[object Object]")}if(typeof m=="object"&&T(m)==="[object Object]"&&(m="[object Object]"),m=String(m),d===null&&(d={}),x==="tag:yaml.org,2002:merge")if(Array.isArray(I))for(let b=0,A=I.length;b<A;b+=1)ae(e,d,I[b],y);else ae(e,d,I,y);else!e.json&&!a.call(y,m)&&a.call(d,m)&&(e.line=o||e.line,e.lineStart=h||e.lineStart,e.position=C||e.position,E(e,"duplicated mapping key")),pe(d,m,I),delete y[m];return d}function we(e){let d=e.input.charCodeAt(e.position);d===10?e.position++:d===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):E(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function V(e,d,y){let x=0,m=e.input.charCodeAt(e.position);for(;m!==0;){for(;B(m);)m===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),m=e.input.charCodeAt(++e.position);if(d&&m===35)do m=e.input.charCodeAt(++e.position);while(m!==10&&m!==13&&m!==0);if(k(m))for(we(e),m=e.input.charCodeAt(e.position),x++,e.lineIndent=0;m===32;)e.lineIndent++,m=e.input.charCodeAt(++e.position);else break}return y!==-1&&x!==0&&e.lineIndent<y&&Q(e,"deficient indentation"),x}function Ae(e){let d=e.position,y=e.input.charCodeAt(d);return!!((y===45||y===46)&&y===e.input.charCodeAt(d+1)&&y===e.input.charCodeAt(d+2)&&(d+=3,y=e.input.charCodeAt(d),y===0||N(y)))}function me(e,d){d===1?e.result+=" ":d>1&&(e.result+=n.repeat(`
11
+ `,d-1))}function Oe(e,d,y){let x,m,I,o,h,C,b=e.kind,A=e.result,_=e.input.charCodeAt(e.position);if(N(_)||M(_)||_===35||_===38||_===42||_===33||_===124||_===62||_===39||_===34||_===37||_===64||_===96)return!1;if(_===63||_===45){let S=e.input.charCodeAt(e.position+1);if(N(S)||y&&M(S))return!1}for(e.kind="scalar",e.result="",x=m=e.position,I=!1;_!==0;){if(_===58){let S=e.input.charCodeAt(e.position+1);if(N(S)||y&&M(S))break}else if(_===35){let S=e.input.charCodeAt(e.position-1);if(N(S))break}else{if(e.position===e.lineStart&&Ae(e)||y&&M(_))break;if(k(_))if(o=e.line,h=e.lineStart,C=e.lineIndent,V(e,!1,-1),e.lineIndent>=d){I=!0,_=e.input.charCodeAt(e.position);continue}else{e.position=m,e.line=o,e.lineStart=h,e.lineIndent=C;break}}I&&(G(e,x,m,!1),me(e,e.line-o),x=m=e.position,I=!1),B(_)||(m=e.position+1),_=e.input.charCodeAt(++e.position)}return G(e,x,m,!1),e.result?!0:(e.kind=b,e.result=A,!1)}function ke(e,d){let y,x,m=e.input.charCodeAt(e.position);if(m!==39)return!1;for(e.kind="scalar",e.result="",e.position++,y=x=e.position;(m=e.input.charCodeAt(e.position))!==0;)if(m===39)if(G(e,y,e.position,!0),m=e.input.charCodeAt(++e.position),m===39)y=e.position,e.position++,x=e.position;else return!0;else k(m)?(G(e,y,x,!0),me(e,V(e,!1,d)),y=x=e.position):e.position===e.lineStart&&Ae(e)?E(e,"unexpected end of the document within a single quoted scalar"):(e.position++,B(m)||(x=e.position));E(e,"unexpected end of the stream within a single quoted scalar")}function xe(e,d){let y,x,m,I=e.input.charCodeAt(e.position);if(I!==34)return!1;for(e.kind="scalar",e.result="",e.position++,y=x=e.position;(I=e.input.charCodeAt(e.position))!==0;){if(I===34)return G(e,y,e.position,!0),e.position++,!0;if(I===92){if(G(e,y,e.position,!0),I=e.input.charCodeAt(++e.position),k(I))V(e,!1,d);else if(I<256&&Z[I])e.result+=de[I],e.position++;else if((m=P(I))>0){let o=m,h=0;for(;o>0;o--)I=e.input.charCodeAt(++e.position),(m=z(I))>=0?h=(h<<4)+m:E(e,"expected hexadecimal character");e.result+=X(h),e.position++}else E(e,"unknown escape sequence");y=x=e.position}else k(I)?(G(e,y,x,!0),me(e,V(e,!1,d)),y=x=e.position):e.position===e.lineStart&&Ae(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,B(I)||(x=e.position))}E(e,"unexpected end of the stream within a double quoted scalar")}function Ke(e,d){let y=!0,x,m,I,o=e.tag,h,C=e.anchor,b,A,_,S,L=Object.create(null),O,D,U,Y=e.input.charCodeAt(e.position);if(Y===91)b=93,S=!1,h=[];else if(Y===123)b=125,S=!0,h={};else return!1;for(e.anchor!==null&&J(e,e.anchor,h),Y=e.input.charCodeAt(++e.position);Y!==0;){if(V(e,!0,d),Y=e.input.charCodeAt(e.position),Y===b)return e.position++,e.tag=o,e.anchor=C,e.kind=S?"mapping":"sequence",e.result=h,!0;if(y?Y===44&&E(e,"expected the node content, but found ','"):E(e,"missed comma between flow collection entries"),D=O=U=null,A=_=!1,Y===63){let W=e.input.charCodeAt(e.position+1);N(W)&&(A=_=!0,e.position++,V(e,!0,d))}x=e.line,m=e.lineStart,I=e.position,Ce(e,d,s,!1,!0),D=e.tag,O=e.result,V(e,!0,d),Y=e.input.charCodeAt(e.position),(_||e.line===x)&&Y===58&&(A=!0,Y=e.input.charCodeAt(++e.position),V(e,!0,d),Ce(e,d,s,!1,!0),U=e.result),S?ge(e,h,L,D,O,U,x,m,I):A?h.push(ge(e,null,L,D,O,U,x,m,I)):h.push(O),V(e,!0,d),Y=e.input.charCodeAt(e.position),Y===44?(y=!0,Y=e.input.charCodeAt(++e.position)):y=!1}E(e,"unexpected end of the stream within a flow collection")}function He(e,d){let y,x=u,m=!1,I=!1,o=d,h=0,C=!1,b,A=e.input.charCodeAt(e.position);if(A===124)y=!1;else if(A===62)y=!0;else return!1;for(e.kind="scalar",e.result="";A!==0;)if(A=e.input.charCodeAt(++e.position),A===43||A===45)u===x?x=A===43?g:f:E(e,"repeat of a chomping mode identifier");else if((b=j(A))>=0)b===0?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):I?E(e,"repeat of an indentation width identifier"):(o=d+b-1,I=!0);else break;if(B(A)){do A=e.input.charCodeAt(++e.position);while(B(A));if(A===35)do A=e.input.charCodeAt(++e.position);while(!k(A)&&A!==0)}for(;A!==0;){for(we(e),e.lineIndent=0,A=e.input.charCodeAt(e.position);(!I||e.lineIndent<o)&&A===32;)e.lineIndent++,A=e.input.charCodeAt(++e.position);if(!I&&e.lineIndent>o&&(o=e.lineIndent),k(A)){h++;continue}if(!I&&o===0&&E(e,"missing indentation for block scalar"),e.lineIndent<o){x===g?e.result+=n.repeat(`
12
+ `,m?1+h:h):x===u&&m&&(e.result+=`
13
+ `);break}y?B(A)?(C=!0,e.result+=n.repeat(`
14
+ `,m?1+h:h)):C?(C=!1,e.result+=n.repeat(`
15
+ `,h+1)):h===0?m&&(e.result+=" "):e.result+=n.repeat(`
16
+ `,h):e.result+=n.repeat(`
17
+ `,m?1+h:h),m=!0,I=!0,h=0;let _=e.position;for(;!k(A)&&A!==0;)A=e.input.charCodeAt(++e.position);G(e,_,e.position,!1)}return!0}function Se(e,d){let y=e.tag,x=e.anchor,m=[],I=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&J(e,e.anchor,m);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,E(e,"tab characters must not be used in indentation")),o===45);){let h=e.input.charCodeAt(e.position+1);if(!N(h))break;if(I=!0,e.position++,V(e,!0,-1)&&e.lineIndent<=d){m.push(null),o=e.input.charCodeAt(e.position);continue}let C=e.line;if(Ce(e,d,c,!1,!0),m.push(e.result),V(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===C||e.lineIndent>d)&&o!==0)E(e,"bad indentation of a sequence entry");else if(e.lineIndent<d)break}return I?(e.tag=y,e.anchor=x,e.kind="sequence",e.result=m,!0):!1}function Ge(e,d,y){let x,m,I,o,h=e.tag,C=e.anchor,b={},A=Object.create(null),_=null,S=null,L=null,O=!1,D=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&J(e,e.anchor,b);let U=e.input.charCodeAt(e.position);for(;U!==0;){!O&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,E(e,"tab characters must not be used in indentation"));let Y=e.input.charCodeAt(e.position+1),W=e.line;if((U===63||U===58)&&N(Y))U===63?(O&&(ge(e,b,A,_,S,null,m,I,o),_=S=L=null),D=!0,O=!0,x=!0):O?(O=!1,x=!0):E(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,U=Y;else{if(m=e.line,I=e.lineStart,o=e.position,!Ce(e,y,l,!1,!0))break;if(e.line===W){for(U=e.input.charCodeAt(e.position);B(U);)U=e.input.charCodeAt(++e.position);if(U===58)U=e.input.charCodeAt(++e.position),N(U)||E(e,"a whitespace character is expected after the key-value separator within a block mapping"),O&&(ge(e,b,A,_,S,null,m,I,o),_=S=L=null),D=!0,O=!1,x=!1,_=e.tag,S=e.result;else if(D)E(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=h,e.anchor=C,!0}else if(D)E(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=h,e.anchor=C,!0}if((e.line===W||e.lineIndent>d)&&(O&&(m=e.line,I=e.lineStart,o=e.position),Ce(e,d,p,!0,x)&&(O?S=e.result:L=e.result),O||(ge(e,b,A,_,S,L,m,I,o),_=S=L=null),V(e,!0,-1),U=e.input.charCodeAt(e.position)),(e.line===W||e.lineIndent>d)&&U!==0)E(e,"bad indentation of a mapping entry");else if(e.lineIndent<d)break}return O&&ge(e,b,A,_,S,null,m,I,o),D&&(e.tag=h,e.anchor=C,e.kind="mapping",e.result=b),D}function fn(e){let d=!1,y=!1,x,m,I=e.input.charCodeAt(e.position);if(I!==33)return!1;e.tag!==null&&E(e,"duplication of a tag property"),I=e.input.charCodeAt(++e.position),I===60?(d=!0,I=e.input.charCodeAt(++e.position)):I===33?(y=!0,x="!!",I=e.input.charCodeAt(++e.position)):x="!";let o=e.position;if(d){do I=e.input.charCodeAt(++e.position);while(I!==0&&I!==62);e.position<e.length?(m=e.input.slice(o,e.position),I=e.input.charCodeAt(++e.position)):E(e,"unexpected end of the stream within a verbatim tag")}else{for(;I!==0&&!N(I);)I===33&&(y?E(e,"tag suffix cannot contain exclamation marks"):(x=e.input.slice(o-1,e.position+1),$.test(x)||E(e,"named tag handle cannot contain such characters"),y=!0,o=e.position+1)),I=e.input.charCodeAt(++e.position);m=e.input.slice(o,e.position),F.test(m)&&E(e,"tag suffix cannot contain flow indicator characters")}m&&!w.test(m)&&E(e,"tag name cannot contain such characters: "+m);try{m=decodeURIComponent(m)}catch{E(e,"tag name is malformed: "+m)}return d?e.tag=m:a.call(e.tagMap,x)?e.tag=e.tagMap[x]+m:x==="!"?e.tag="!"+m:x==="!!"?e.tag="tag:yaml.org,2002:"+m:E(e,'undeclared tag handle "'+x+'"'),!0}function We(e){let d=e.input.charCodeAt(e.position);if(d!==38)return!1;e.anchor!==null&&E(e,"duplication of an anchor property"),d=e.input.charCodeAt(++e.position);let y=e.position;for(;d!==0&&!N(d)&&!M(d);)d=e.input.charCodeAt(++e.position);return e.position===y&&E(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(y,e.position),!0}function Qe(e){let d=e.input.charCodeAt(e.position);if(d!==42)return!1;d=e.input.charCodeAt(++e.position);let y=e.position;for(;d!==0&&!N(d)&&!M(d);)d=e.input.charCodeAt(++e.position);e.position===y&&E(e,"name of an alias node must contain at least one character");let x=e.input.slice(y,e.position);return a.call(e.anchorMap,x)||E(e,'unidentified alias "'+x+'"'),e.result=e.anchorMap[x],V(e,!0,-1),!0}function pn(e,d,y,x){let m=ye(e);return he(e),ue(e,d),e.tag=null,e.anchor=null,e.kind=null,e.result=null,Ge(e,y,x)&&e.kind==="mapping"?(ve(e),!0):(le(e),ue(e,m),!1)}function Ce(e,d,y,x,m){let I,o,h=1,C=!1,b=!1,A=null,_,S,L;e.depth>=e.maxDepth&&E(e,"nesting exceeded maxDepth ("+e.maxDepth+")"),e.depth+=1,e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let O=I=o=p===y||c===y;if(x&&V(e,!0,-1)&&(C=!0,e.lineIndent>d?h=1:e.lineIndent===d?h=0:e.lineIndent<d&&(h=-1)),h===1)for(;;){let D=e.input.charCodeAt(e.position),U=ye(e);if(C&&(D===33&&e.tag!==null||D===38&&e.anchor!==null)||!fn(e)&&!We(e))break;A===null&&(A=U),V(e,!0,-1)?(C=!0,o=O,e.lineIndent>d?h=1:e.lineIndent===d?h=0:e.lineIndent<d&&(h=-1)):o=!1}if(o&&(o=C||m),h===1||p===y)if(s===y||l===y?S=d:S=d+1,L=e.position-e.lineStart,h===1)if(o&&(Se(e,L)||Ge(e,L,S))||Ke(e,S))b=!0;else{let D=e.input.charCodeAt(e.position);A!==null&&O&&!o&&D!==124&&D!==62&&pn(e,A,A.position-A.lineStart,S)||I&&He(e,S)||ke(e,S)||xe(e,S)?b=!0:Qe(e)?(b=!0,(e.tag!==null||e.anchor!==null)&&E(e,"alias node should not have any properties")):Oe(e,S,s===y)&&(b=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&J(e,e.anchor,e.result)}else h===0&&(b=o&&Se(e,L));if(e.tag===null)e.anchor!==null&&J(e,e.anchor,e.result);else if(e.tag==="?"){e.result!==null&&e.kind!=="scalar"&&E(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"');for(let D=0,U=e.implicitTypes.length;D<U;D+=1)if(_=e.implicitTypes[D],_.resolve(e.result)){e.result=_.construct(e.result),e.tag=_.tag,e.anchor!==null&&J(e,e.anchor,e.result);break}}else if(e.tag!=="!"){if(a.call(e.typeMap[e.kind||"fallback"],e.tag))_=e.typeMap[e.kind||"fallback"][e.tag];else{_=null;let D=e.typeMap.multi[e.kind||"fallback"];for(let U=0,Y=D.length;U<Y;U+=1)if(e.tag.slice(0,D[U].tag.length)===D[U].tag){_=D[U];break}}_||E(e,"unknown tag !<"+e.tag+">"),e.result!==null&&_.kind!==e.kind&&E(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+_.kind+'", not "'+e.kind+'"'),_.resolve(e.result,e.tag)?(e.result=_.construct(e.result,e.tag),e.anchor!==null&&J(e,e.anchor,e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.depth-=1,e.tag!==null||e.anchor!==null||b}function dn(e){let d=e.position,y=!1,x;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(x=e.input.charCodeAt(e.position))!==0&&(V(e,!0,-1),x=e.input.charCodeAt(e.position),!(e.lineIndent>0||x!==37));){y=!0,x=e.input.charCodeAt(++e.position);let m=e.position;for(;x!==0&&!N(x);)x=e.input.charCodeAt(++e.position);let I=e.input.slice(m,e.position),o=[];for(I.length<1&&E(e,"directive name must not be less than one character in length");x!==0;){for(;B(x);)x=e.input.charCodeAt(++e.position);if(x===35){do x=e.input.charCodeAt(++e.position);while(x!==0&&!k(x));break}if(k(x))break;for(m=e.position;x!==0&&!N(x);)x=e.input.charCodeAt(++e.position);o.push(e.input.slice(m,e.position))}x!==0&&we(e),a.call(oe,I)?oe[I](e,I,o):Q(e,'unknown document directive "'+I+'"')}if(V(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,V(e,!0,-1)):y&&E(e,"directives end mark is expected"),Ce(e,e.lineIndent-1,p,!1,!0),V(e,!0,-1),e.checkLineBreaks&&R.test(e.input.slice(d,e.position))&&Q(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ae(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,V(e,!0,-1));return}e.position<e.length-1&&E(e,"end of the stream or a document separator is expected")}function Ve(e,d){e=String(e),d=d||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
18
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));let y=new H(e,d),x=e.indexOf("\0");for(x!==-1&&(y.position=x,E(y,"null byte is not allowed in input")),y.input+="\0";y.input.charCodeAt(y.position)===32;)y.lineIndent+=1,y.position+=1;for(;y.position<y.length-1;)dn(y);return y.documents}function Je(e,d,y){d!==null&&typeof d=="object"&&typeof y>"u"&&(y=d,d=null);let x=Ve(e,y);if(typeof d!="function")return x;for(let m=0,I=x.length;m<I;m+=1)d(x[m])}function hn(e,d){let y=Ve(e,d);if(y.length!==0){if(y.length===1)return y[0];throw new t("expected a single document in the stream, but found more")}}return en.loadAll=Je,en.load=hn,en}var Kn={},ri;function eo(){if(ri)return Kn;ri=1;let n=Pe(),t=je(),i=Hn(),r=Object.prototype.toString,a=Object.prototype.hasOwnProperty,s=65279,l=9,c=10,p=13,u=32,f=33,g=34,v=35,R=37,F=38,$=39,w=42,T=44,k=45,B=58,N=61,M=62,z=63,P=64,j=91,q=93,X=96,pe=123,Z=124,de=125,H={};H[0]="\\0",H[7]="\\a",H[8]="\\b",H[9]="\\t",H[10]="\\n",H[11]="\\v",H[12]="\\f",H[13]="\\r",H[27]="\\e",H[34]='\\"',H[92]="\\\\",H[133]="\\N",H[160]="\\_",H[8232]="\\L",H[8233]="\\P";let te=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],E=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Q(o,h){if(h===null)return{};let C={},b=Object.keys(h);for(let A=0,_=b.length;A<_;A+=1){let S=b[A],L=String(h[S]);S.slice(0,2)==="!!"&&(S="tag:yaml.org,2002:"+S.slice(2));let O=o.compiledTypeMap.fallback[S];O&&a.call(O.styleAliases,L)&&(L=O.styleAliases[L]),C[S]=L}return C}function J(o){let h,C,b=o.toString(16).toUpperCase();if(o<=255)h="x",C=2;else if(o<=65535)h="u",C=4;else if(o<=4294967295)h="U",C=8;else throw new t("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+h+n.repeat("0",C-b.length)+b}let he=1,ve=2;function le(o){this.schema=o.schema||i,this.indent=Math.max(1,o.indent||2),this.noArrayIndent=o.noArrayIndent||!1,this.skipInvalid=o.skipInvalid||!1,this.flowLevel=n.isNothing(o.flowLevel)?-1:o.flowLevel,this.styleMap=Q(this.schema,o.styles||null),this.sortKeys=o.sortKeys||!1,this.lineWidth=o.lineWidth||80,this.noRefs=o.noRefs||!1,this.noCompatMode=o.noCompatMode||!1,this.condenseFlow=o.condenseFlow||!1,this.quotingType=o.quotingType==='"'?ve:he,this.forceQuotes=o.forceQuotes||!1,this.replacer=typeof o.replacer=="function"?o.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ye(o,h){let C=n.repeat(" ",h),b=0,A="",_=o.length;for(;b<_;){let S,L=o.indexOf(`
19
+ `,b);L===-1?(S=o.slice(b),b=_):(S=o.slice(b,L+1),b=L+1),S.length&&S!==`
20
+ `&&(A+=C),A+=S}return A}function ue(o,h){return`
21
+ `+n.repeat(" ",o.indent*h)}function oe(o,h){for(let C=0,b=o.implicitTypes.length;C<b;C+=1)if(o.implicitTypes[C].resolve(h))return!0;return!1}function G(o){return o===u||o===l}function ae(o){return o>=32&&o<=126||o>=161&&o<=55295&&o!==8232&&o!==8233||o>=57344&&o<=65533&&o!==s||o>=65536&&o<=1114111}function ge(o){return ae(o)&&o!==s&&o!==p&&o!==c}function we(o,h,C){let b=ge(o),A=b&&!G(o);return(C?b:b&&o!==T&&o!==j&&o!==q&&o!==pe&&o!==de)&&o!==v&&!(h===B&&!A)||ge(h)&&!G(h)&&o===v||h===B&&A}function V(o){return ae(o)&&o!==s&&!G(o)&&o!==k&&o!==z&&o!==B&&o!==T&&o!==j&&o!==q&&o!==pe&&o!==de&&o!==v&&o!==F&&o!==w&&o!==f&&o!==Z&&o!==N&&o!==M&&o!==$&&o!==g&&o!==R&&o!==P&&o!==X}function Ae(o){return!G(o)&&o!==B}function me(o,h){let C=o.charCodeAt(h),b;return C>=55296&&C<=56319&&h+1<o.length&&(b=o.charCodeAt(h+1),b>=56320&&b<=57343)?(C-55296)*1024+b-56320+65536:C}function Oe(o){return/^\n* /.test(o)}let ke=1,xe=2,Ke=3,He=4,Se=5;function Ge(o,h,C,b,A,_,S,L){let O,D=0,U=null,Y=!1,W=!1,wt=b!==-1,Ne=-1,Fe=V(me(o,0))&&Ae(me(o,o.length-1));if(h||S)for(O=0;O<o.length;D>=65536?O+=2:O++){if(D=me(o,O),!ae(D))return Se;Fe=Fe&&we(D,U,L),U=D}else{for(O=0;O<o.length;D>=65536?O+=2:O++){if(D=me(o,O),D===c)Y=!0,wt&&(W=W||O-Ne-1>b&&o[Ne+1]!==" ",Ne=O);else if(!ae(D))return Se;Fe=Fe&&we(D,U,L),U=D}W=W||wt&&O-Ne-1>b&&o[Ne+1]!==" "}return!Y&&!W?Fe&&!S&&!A(o)?ke:_===ve?Se:xe:C>9&&Oe(o)?Se:S?_===ve?Se:xe:W?He:Ke}function fn(o,h,C,b,A){o.dump=(function(){if(h.length===0)return o.quotingType===ve?'""':"''";if(!o.noCompatMode&&(te.indexOf(h)!==-1||E.test(h)))return o.quotingType===ve?'"'+h+'"':"'"+h+"'";let _=o.indent*Math.max(1,C),S=o.lineWidth===-1?-1:Math.max(Math.min(o.lineWidth,40),o.lineWidth-_),L=b||o.flowLevel>-1&&C>=o.flowLevel;function O(D){return oe(o,D)}switch(Ge(h,L,o.indent,S,O,o.quotingType,o.forceQuotes&&!b,A)){case ke:return h;case xe:return"'"+h.replace(/'/g,"''")+"'";case Ke:return"|"+We(h,o.indent)+Qe(ye(h,_));case He:return">"+We(h,o.indent)+Qe(ye(pn(h,S),_));case Se:return'"'+dn(h)+'"';default:throw new t("impossible error: invalid scalar style")}})()}function We(o,h){let C=Oe(o)?String(h):"",b=o[o.length-1]===`
22
+ `,_=b&&(o[o.length-2]===`
23
+ `||o===`
24
+ `)?"+":b?"":"-";return C+_+`
25
+ `}function Qe(o){return o[o.length-1]===`
26
+ `?o.slice(0,-1):o}function pn(o,h){let C=/(\n+)([^\n]*)/g,b=(function(){let L=o.indexOf(`
27
+ `);return L=L!==-1?L:o.length,C.lastIndex=L,Ce(o.slice(0,L),h)})(),A=o[0]===`
28
+ `||o[0]===" ",_,S;for(;S=C.exec(o);){let L=S[1],O=S[2];_=O[0]===" ",b+=L+(!A&&!_&&O!==""?`
29
+ `:"")+Ce(O,h),A=_}return b}function Ce(o,h){if(o===""||o[0]===" ")return o;let C=/ [^ ]/g,b,A=0,_,S=0,L=0,O="";for(;b=C.exec(o);)L=b.index,L-A>h&&(_=S>A?S:L,O+=`
30
+ `+o.slice(A,_),A=_+1),S=L;return O+=`
31
+ `,o.length-A>h&&S>A?O+=o.slice(A,S)+`
32
+ `+o.slice(S+1):O+=o.slice(A),O.slice(1)}function dn(o){let h="",C=0;for(let b=0;b<o.length;C>=65536?b+=2:b++){C=me(o,b);let A=H[C];!A&&ae(C)?(h+=o[b],C>=65536&&(h+=o[b+1])):h+=A||J(C)}return h}function Ve(o,h,C){let b="",A=o.tag;for(let _=0,S=C.length;_<S;_+=1){let L=C[_];o.replacer&&(L=o.replacer.call(C,String(_),L)),(y(o,h,L,!1,!1)||typeof L>"u"&&y(o,h,null,!1,!1))&&(b!==""&&(b+=","+(o.condenseFlow?"":" ")),b+=o.dump)}o.tag=A,o.dump="["+b+"]"}function Je(o,h,C,b){let A="",_=o.tag;for(let S=0,L=C.length;S<L;S+=1){let O=C[S];o.replacer&&(O=o.replacer.call(C,String(S),O)),(y(o,h+1,O,!0,!0,!1,!0)||typeof O>"u"&&y(o,h+1,null,!0,!0,!1,!0))&&((!b||A!=="")&&(A+=ue(o,h)),o.dump&&c===o.dump.charCodeAt(0)?A+="-":A+="- ",A+=o.dump)}o.tag=_,o.dump=A||"[]"}function hn(o,h,C){let b="",A=o.tag,_=Object.keys(C);for(let S=0,L=_.length;S<L;S+=1){let O="";b!==""&&(O+=", "),o.condenseFlow&&(O+='"');let D=_[S],U=C[D];o.replacer&&(U=o.replacer.call(C,D,U)),y(o,h,D,!1,!1)&&(o.dump.length>1024&&(O+="? "),O+=o.dump+(o.condenseFlow?'"':"")+":"+(o.condenseFlow?"":" "),y(o,h,U,!1,!1)&&(O+=o.dump,b+=O))}o.tag=A,o.dump="{"+b+"}"}function e(o,h,C,b){let A="",_=o.tag,S=Object.keys(C);if(o.sortKeys===!0)S.sort();else if(typeof o.sortKeys=="function")S.sort(o.sortKeys);else if(o.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let L=0,O=S.length;L<O;L+=1){let D="";(!b||A!=="")&&(D+=ue(o,h));let U=S[L],Y=C[U];if(o.replacer&&(Y=o.replacer.call(C,U,Y)),!y(o,h+1,U,!0,!0,!0))continue;let W=o.tag!==null&&o.tag!=="?"||o.dump&&o.dump.length>1024;W&&(o.dump&&c===o.dump.charCodeAt(0)?D+="?":D+="? "),D+=o.dump,W&&(D+=ue(o,h)),y(o,h+1,Y,!0,W)&&(o.dump&&c===o.dump.charCodeAt(0)?D+=":":D+=": ",D+=o.dump,A+=D)}o.tag=_,o.dump=A||"{}"}function d(o,h,C){let b=C?o.explicitTypes:o.implicitTypes;for(let A=0,_=b.length;A<_;A+=1){let S=b[A];if((S.instanceOf||S.predicate)&&(!S.instanceOf||typeof h=="object"&&h instanceof S.instanceOf)&&(!S.predicate||S.predicate(h))){if(C?S.multi&&S.representName?o.tag=S.representName(h):o.tag=S.tag:o.tag="?",S.represent){let L=o.styleMap[S.tag]||S.defaultStyle,O;if(r.call(S.represent)==="[object Function]")O=S.represent(h,L);else if(a.call(S.represent,L))O=S.represent[L](h,L);else throw new t("!<"+S.tag+'> tag resolver accepts not "'+L+'" style');o.dump=O}return!0}}return!1}function y(o,h,C,b,A,_,S){o.tag=null,o.dump=C,d(o,C,!1)||d(o,C,!0);let L=r.call(o.dump),O=b;b&&(b=o.flowLevel<0||o.flowLevel>h);let D=L==="[object Object]"||L==="[object Array]",U,Y;if(D&&(U=o.duplicates.indexOf(C),Y=U!==-1),(o.tag!==null&&o.tag!=="?"||Y||o.indent!==2&&h>0)&&(A=!1),Y&&o.usedDuplicates[U])o.dump="*ref_"+U;else{if(D&&Y&&!o.usedDuplicates[U]&&(o.usedDuplicates[U]=!0),L==="[object Object]")b&&Object.keys(o.dump).length!==0?(e(o,h,o.dump,A),Y&&(o.dump="&ref_"+U+o.dump)):(hn(o,h,o.dump),Y&&(o.dump="&ref_"+U+" "+o.dump));else if(L==="[object Array]")b&&o.dump.length!==0?(o.noArrayIndent&&!S&&h>0?Je(o,h-1,o.dump,A):Je(o,h,o.dump,A),Y&&(o.dump="&ref_"+U+o.dump)):(Ve(o,h,o.dump),Y&&(o.dump="&ref_"+U+" "+o.dump));else if(L==="[object String]")o.tag!=="?"&&fn(o,o.dump,h,_,O);else{if(L==="[object Undefined]")return!1;if(o.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+L)}if(o.tag!==null&&o.tag!=="?"){let W=encodeURI(o.tag[0]==="!"?o.tag.slice(1):o.tag).replace(/!/g,"%21");o.tag[0]==="!"?W="!"+W:W.slice(0,18)==="tag:yaml.org,2002:"?W="!!"+W.slice(18):W="!<"+W+">",o.dump=W+" "+o.dump}}return!0}function x(o,h){let C=[],b=[];m(o,C,b);let A=b.length;for(let _=0;_<A;_+=1)h.duplicates.push(C[b[_]]);h.usedDuplicates=new Array(A)}function m(o,h,C){if(o!==null&&typeof o=="object"){let b=h.indexOf(o);if(b!==-1)C.indexOf(b)===-1&&C.push(b);else if(h.push(o),Array.isArray(o))for(let A=0,_=o.length;A<_;A+=1)m(o[A],h,C);else{let A=Object.keys(o);for(let _=0,S=A.length;_<S;_+=1)m(o[A[_]],h,C)}}}function I(o,h){h=h||{};let C=new le(h);C.noRefs||x(o,C);let b=o;return C.replacer&&(b=C.replacer.call({"":b},"",b)),y(C,0,b,!0,!0)?C.dump+`
33
+ `:""}return Kn.dump=I,Kn}var oi;function no(){if(oi)return re;oi=1;let n=Xr(),t=eo();function i(r,a){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+a+" instead, which is now safe by default.")}}return re.Type=se(),re.Schema=ai(),re.FAILSAFE_SCHEMA=ui(),re.JSON_SCHEMA=gi(),re.CORE_SCHEMA=mi(),re.DEFAULT_SCHEMA=Hn(),re.load=n.load,re.loadAll=n.loadAll,re.dump=t.dump,re.YAMLException=je(),re.types={binary:wi(),float:hi(),map:ci(),null:fi(),pairs:Ai(),set:xi(),timestamp:vi(),bool:pi(),int:di(),merge:yi(),omap:bi(),seq:li(),str:si()},re.safeLoad=i("safeLoad","load"),re.safeLoadAll=i("safeLoadAll","loadAll"),re.safeDump=i("safeDump","dump"),re}var to=no(),io=Jr(to),{Type:Fa,Schema:Da,FAILSAFE_SCHEMA:Ba,JSON_SCHEMA:Ua,CORE_SCHEMA:Pa,DEFAULT_SCHEMA:ja,load:Si,loadAll:qa,dump:Ci,YAMLException:Ya,types:za,safeLoad:Ka,safeLoadAll:Ha,safeDump:Ga}=io;var ne=class extends Error{status;detail;requestId;constructor(n,t={}){super(n),this.name=new.target.name,this.status=t.status,this.detail=t.detail,this.requestId=t.requestId}},ro=class extends ne{},oo=class extends ne{},ao=class extends ne{},Gn=class extends ne{};function nn(n,t){if(n&&typeof n=="object"&&"detail"in n){let i=n.detail;if(typeof i=="string")return i}return t}function _i(n,t,i){let r={status:n,detail:t,requestId:i};return n===401||n===403?new ro(nn(t,"Authentication failed"),r):n===404?new oo(nn(t,"Not found"),r):n>=500?new ao(nn(t,"Server error"),r):new ne(nn(t,`Request failed with status ${n}`),r)}function Ii(n){try{return JSON.parse(n)}catch{return n}}var so=class{constructor(n){this.config=n}config;async request(n,t,i={}){let r=new URL(t.startsWith("http")?t:`${this.config.baseUrl}${t}`);if(i.query)for(let[u,f]of Object.entries(i.query))f!=null&&r.searchParams.set(u,String(f));let a={accept:"application/json",...i.headers};this.config.apiKey&&(a["X-API-Key"]=this.config.apiKey);let s;i.body!==void 0&&(a["content-type"]="application/json",s=JSON.stringify(i.body));let l=await fetch(r,{method:n,headers:a,body:s,signal:AbortSignal.timeout(i.timeoutMs??this.config.timeoutMs)}),c=await l.text(),p=c?Ii(c):null;if(!l.ok)throw _i(l.status,p,l.headers.get("x-request-id")??void 0);return p}async upload(n,t,i,r={}){let a=new URL(t.startsWith("http")?t:`${this.config.baseUrl}${t}`),s={accept:"application/json"};this.config.apiKey&&(s["X-API-Key"]=this.config.apiKey);let l=new FormData,c=new Blob([i.bytes],{type:i.contentType});l.append(i.field??"file",c,i.filename);let p=await fetch(a,{method:n,headers:s,body:l,signal:AbortSignal.timeout(r.timeoutMs??this.config.timeoutMs)}),u=await p.text(),f=u?Ii(u):null;if(!p.ok)throw _i(p.status,f,p.headers.get("x-request-id")??void 0);return f}},lo=(()=>{try{return"https://api.joinblok.co"}catch{return"http://127.0.0.1:8001"}})(),co=3e4,uo=3e5;function fo(n){return n.endsWith("/")?n.slice(0,-1):n}function po(n={}){let t=n.baseUrl??process.env.SELDON_BASE_URL??process.env.BLOK_BASE_URL??lo,i=n.apiKey??process.env.SELDON_API_KEY??process.env.BLOK_API_KEY??void 0,r=Number(process.env.SELDON_TIMEOUT_MS??process.env.BLOK_TIMEOUT_MS);return{baseUrl:fo(t),apiKey:i||void 0,timeoutMs:n.timeoutMs??(Number.isFinite(r)&&r>0?r:co),specCacheTtlMs:n.specCacheTtlMs??uo}}var ho=new Set(["get","post","put","patch","delete"]),go="_api_v1_";function mo(n){let t=n.indexOf(go);return t>0?n.slice(0,t):n}function vo(n){let t=new Set,i=n.components?.securitySchemes??{};for(let[r,a]of Object.entries(i))a?.type==="apiKey"&&a?.in==="header"&&t.add(r);return t}function yo(n){let t=n.security;if(!Array.isArray(t))return[];let i=[];for(let r of t)r&&typeof r=="object"&&i.push(...Object.keys(r));return i}var wo=class Fi{constructor(t,i){this.operations=t,this.apiKeySchemes=i}operations;apiKeySchemes;static fromSpec(t){let i=vo(t),r=[];for(let[a,s]of Object.entries(t.paths??{}))for(let[l,c]of Object.entries(s)){if(!ho.has(l))continue;let p=c,u=String(p.operationId??`${l}_${a}`),f=Array.isArray(p.parameters)?p.parameters.map(v=>({name:String(v.name),in:v.in,required:!!v.required,description:typeof v.description=="string"?v.description:void 0,schema:v.schema})):[],g=p.tags;r.push({operationId:u,name:mo(u),method:l.toUpperCase(),path:a,tag:g?.[0],summary:typeof p.summary=="string"?p.summary:void 0,description:typeof p.description=="string"?p.description:void 0,params:f,requestBodySchema:bo(p.requestBody),security:yo(p)})}return new Fi(r,i)}apiKeyOps(){return this.apiKeySchemes.size===0?[]:this.operations.filter(t=>t.security.some(i=>this.apiKeySchemes.has(i)))}get(t){return this.apiKeyOps().find(i=>i.name===t||i.operationId===t)}};function bo(n){if(!n||typeof n!="object")return;let t=n.content;if(t)return t["application/json"]?.schema??Object.values(t)[0]?.schema}function Bi(){if(process.env.BLOK_CACHE_DIR)return process.env.BLOK_CACHE_DIR;let n=Co()||_o();return Di(n,".cache","blok")}function Io(n){let t=Ao("sha256").update(n).digest("hex").slice(0,16);return Di(Bi(),`openapi-${t}.json`)}var ko=class{constructor(n,t=fetch){this.config=n,this.fetchImpl=t}config;fetchImpl;async load(n={}){let t=process.env.BLOK_SPEC_PATH;if(t)try{return JSON.parse(await ki(t,"utf8"))}catch(r){throw new Gn(`Could not read BLOK_SPEC_PATH (${t}): ${String(r)}`)}let i=Io(this.config.baseUrl);if(!n.refresh){let r=await this.readFreshCache(i);if(r)return r}return this.fetchAndCache(i)}async refresh(){return this.load({refresh:!0})}async readFreshCache(n){try{let t=await ki(n,"utf8"),i=JSON.parse(t);return Date.now()-i.ts<=this.config.specCacheTtlMs?i.spec:null}catch{return null}}async fetchAndCache(n){let t=new URL("/openapi.json",`${this.config.baseUrl}/`),i;try{i=await this.fetchImpl(t,{signal:AbortSignal.timeout(this.config.timeoutMs)})}catch(a){throw new Gn(`Could not fetch OpenAPI from ${t.toString()}: ${String(a)}`)}if(!i.ok)throw new Gn(`OpenAPI fetch failed (${i.status}) from ${t.toString()}`,{status:i.status});let r=await i.json();return await this.writeCache(n,r),r}async writeCache(n,t){try{await xo(Bi(),{recursive:!0});let i={ts:Date.now(),spec:t};await So(n,JSON.stringify(i),"utf8")}catch{}}};function Ti(n,t={}){return n.replace(/\{([^}]+)\}/g,(i,r)=>{let a=t[r];if(a===void 0)throw new ne(`Missing path parameter: ${r}`);return encodeURIComponent(String(a))})}var Ui=class{config;client;loader;registry;constructor(n={}){this.config=po(n),this.client=new so(this.config),this.loader=new ko(this.config)}async operations(n={}){if(!this.registry||n.refresh){let t=await this.loader.load(n);this.registry=wo.fromSpec(t)}return this.registry}async apiKeyOps(){return(await this.operations()).apiKeyOps()}async hasOperation(n){return(await this.operations()).get(n)!==void 0}async call(n,t={}){let i=(await this.operations()).get(n);if(!i)throw new ne(`Unknown or non-API-key operation: ${n}`);let r=Ti(i.path,t.path);return this.client.request(i.method,r,{query:t.query,body:t.body,timeoutMs:t.timeoutMs})}async upload(n,t,i={}){let r=(await this.operations()).get(n);if(!r)throw new ne(`Unknown or non-API-key operation: ${n}`);let a=Ti(r.path,i.path);return this.client.upload(r.method,a,t,{timeoutMs:i.timeoutMs})}};function Xn(n,t){if(n.length===0)return"";let i=n.map(c=>t.map(p=>p.cell(c))),r=t.map((c,p)=>Math.max(c.header.length,...i.map(u=>u[p].length))),a=(c,p,u="left")=>u==="right"?c.padStart(p):c.padEnd(p),s=t.map((c,p)=>a(c.header,r[p],c.align)).join(" "),l=i.map(c=>c.map((p,u)=>a(p,r[u],t[u].align)).join(" "));return[s,...l].join(`
34
+ `)}function Yi(n,t){return t<=0||n.length<=t?{shown:n,hiddenCount:0}:{shown:n.slice(0,t),hiddenCount:n.length-t}}var Ei={blocker:0,major:1,minor:2,cosmetic:3},Oi={fail:0,blocked:1,timed_out:2},Li={pass:"\u2705",fail:"\u274C",blocked:"\u{1F6AB}",timed_out:"\u231B"},Oo={pass:"PASS",fail:"FAIL",blocked:"BLOCKED",timed_out:"TIMED_OUT"};function Lo(n){let t=n.toLowerCase();return t==="pass"?"pass":t==="fail"?"fail":t==="timed_out"||t==="timedout"?"timed_out":"blocked"}function $o(n){return n?.evidence?.length?n.evidence.map(t=>{let i={file:t.source_path};return typeof t.start_line=="number"&&typeof t.end_line=="number"&&(i.lines={start:t.start_line,end:t.end_line}),t.chunk_hash&&(i.chunkHash=t.chunk_hash),t.note&&(i.note=t.note),i}):[]}function et(n){return n.lines?`\`${n.file}\` (lines ${n.lines.start}-${n.lines.end})`:`\`${n.file}\``}function Mo(n,t,i){let r=[];if(n==="blocked"){let l=t.unmet_preconditions??[];l.length?r.push(`Blocked \u2014 unmet preconditions: ${l.join("; ")}.`):r.push("Blocked before the case could be evaluated.")}else n==="timed_out"&&r.push("The run stalled and never completed; re-run to confirm before triaging.");if(i.length){let l=i.slice(0,3).map(et).join(", ");r.push(`Likely in ${l}.`)}let a=(t.expected??"").trim(),s=(t.actual??"").trim();return a&&s?r.push(`Expected: ${a} Observed: ${s}`):a?r.push(`Expected: ${a}`):s&&r.push(`Observed: ${s}`),r.length===0&&t.acceptance_criterion&&r.push(`Did not satisfy: ${t.acceptance_criterion}`),r.join(" ").trim()}function No(n){if(n.total===0)return"No cases were executed.";let t=Math.round(n.passRate*100),i=[`${n.passed}/${n.total} passed (${t}%)`];return n.failed&&i.push(`${n.failed} failed`),n.blocked&&i.push(`${n.blocked} blocked`),n.timedOut&&i.push(`${n.timedOut} timed out`),i.join(", ")+"."}function Fo(n){let t=n.test_plan??{title:"Untitled plan"},i=new Map;for(let v of t.test_cases??[])i.set(v.id,v);let r=n.experiment_id??"",a=n.report?.plan_title||t.title||"Untitled plan",s=t.open_questions??[];if(!n.report)return{experimentId:r,planTitle:a,status:"not_run",summary:{total:t.test_cases?.length??0,passed:0,failed:0,blocked:0,timedOut:0,passRate:0,headline:"Plan generated; not run yet."},failures:[],passed:[],coverage:{journeysExercised:[],unreachable:[],flakyCaseIds:[]},openQuestions:s};let l=n.report,c=l.case_results??[],p=[],u=[];for(let v of c){let R=Lo(v.verdict);if(R==="pass"){u.push({id:v.test_case_id,title:v.title});continue}let F=$o(i.get(v.test_case_id)),$=v.attempts??1,w=v.passes??0;p.push({id:v.test_case_id,title:v.title,area:i.get(v.test_case_id)?.area,verdict:R,severity:v.severity??void 0,acceptanceCriterion:v.acceptance_criterion,expected:v.expected??void 0,actual:v.actual??void 0,reproductionSteps:v.reproduction_steps??[],unmetPreconditions:v.unmet_preconditions??[],evidence:F,hint:Mo(R,v,F),screenshotUrls:v.screenshot_urls??[],recordingUrl:v.recording_url??void 0,attempts:$,passes:w,flaky:$>1&&w>0&&w<$})}p.sort((v,R)=>{let F=(Oi[v.verdict]??9)-(Oi[R.verdict]??9);if(F!==0)return F;let $=Ei[(v.severity??"").toLowerCase()]??9,w=Ei[(R.severity??"").toLowerCase()]??9;return $-w});let f=l.total_cases??c.length,g={total:f,passed:l.passed??0,failed:l.failed??0,blocked:l.blocked??0,timedOut:l.timed_out??0,passRate:f>0?(l.passed??0)/f:0};return{experimentId:r,planTitle:a,status:"complete",summary:{...g,headline:No(g)},failures:p,passed:u,coverage:{journeysExercised:l.coverage?.journeys_exercised??[],unreachable:l.coverage?.unreachable??[],confidenceNote:l.coverage?.confidence_note??void 0,flakyCaseIds:l.coverage?.flaky_case_ids??[]},narrative:l.summary||void 0,openQuestions:s}}var Do=8,Bo=8,$i=12,zi=5;function Ki(n){let t=n.summary,i=[];t.failed&&i.push(`\u274C${t.failed}`),t.blocked&&i.push(`\u{1F6AB}${t.blocked}`),t.timedOut&&i.push(`\u231B${t.timedOut}`);let r=Math.round(t.passRate*100);return[`${t.passed}/${t.total} passed (${r}%)`,...i].join(" \xB7 ")}function Hi(n){let t=n.failures.map(r=>({verdict:r.verdict,severity:r.severity,id:r.id,title:r.title})),i=n.passed.map(r=>({verdict:"pass",id:r.id,title:r.title}));return[...t,...i]}function Gi(n,t={}){let i=[`Seldon QA \u2014 ${n.planTitle} \xB7 ${Ki(n)}`];if(n.narrative&&i.push("",n.narrative),n.status==="not_run")return i.push("",`Plan has ${n.summary.total} case(s); run it against a URL to produce results.`),i.join(`
35
+ `);i.push("");for(let s of Hi(n)){let l=Oo[s.verdict].padEnd(Do),c=(s.severity?.toUpperCase()??"").padEnd(Bo);i.push(`${l} ${c} ${s.id} ${s.title}`)}let{shown:r,hiddenCount:a}=t.full?{shown:n.failures,hiddenCount:0}:Yi(n.failures,t.compactLimit??zi);for(let s of r){i.push("",`${s.id} ${s.title}${s.flaky?" (FLAKY)":""}`);let l=(c,p)=>` ${c.padEnd($i)}${p}`;s.acceptanceCriterion&&i.push(l("acceptance:",s.acceptanceCriterion)),s.expected&&i.push(l("expected:",s.expected)),s.actual&&i.push(l("observed:",s.actual)),s.evidence.length&&i.push(l("source:",s.evidence.map(et).join(", "))),s.reproductionSteps.length&&(i.push(l("repro:",s.reproductionSteps[0])),s.reproductionSteps.slice(1).forEach(c=>i.push(" ".repeat(2+$i)+c))),s.screenshotUrls.length&&i.push(l("evidence:",s.screenshotUrls.join(", "))),s.recordingUrl&&i.push(l("recording:",s.recordingUrl)),!s.acceptanceCriterion&&!s.expected&&!s.actual&&!s.evidence.length&&i.push(l("hint:",s.hint))}return a>0&&i.push("",`\u2026 +${a} more \u2014 pass \`full\` to see every detail block.`),n.coverage.unreachable.length&&i.push("",`Not reached: ${n.coverage.unreachable.join("; ")}`),n.coverage.flakyCaseIds.length&&i.push(`Flaky cases: ${n.coverage.flakyCaseIds.join(", ")}`),i.join(`
36
+ `)}function Wi(n,t={}){let i=[`**Seldon QA \u2014 ${n.planTitle}** \xB7 ${Ki(n)}`];if(n.narrative&&i.push("",`> ${n.narrative}`),n.status==="not_run")return i.push("",`_Plan has ${n.summary.total} case(s); run it against a URL to produce results._`),i.join(`
37
+ `);let r=Hi(n);if(r.length){i.push("","| | Case |","|---|---|");for(let l of r){let c=l.severity?`${Li[l.verdict]} \`${l.severity.toUpperCase()}\``:Li[l.verdict];i.push(`| ${c} | \`${l.id}\` ${l.title} |`)}}let{shown:a,hiddenCount:s}=t.full?{shown:n.failures,hiddenCount:0}:Yi(n.failures,t.compactLimit??zi);for(let l of a)i.push("","---",`##### ${l.id} \u2014 ${l.title}${l.flaky?" _(flaky)_":""}`),l.acceptanceCriterion&&i.push(`acceptance: ${l.acceptanceCriterion}`),l.expected&&i.push(`expected: ${l.expected}`),l.actual&&i.push(`observed: ${l.actual}`),l.evidence.length&&i.push(`source: ${l.evidence.map(et).join(", ")}`),l.reproductionSteps.length&&(i.push("repro:"),l.reproductionSteps.forEach((c,p)=>i.push(`${p+1}. ${c}`))),l.screenshotUrls.length&&i.push(`evidence: ${l.screenshotUrls.map((c,p)=>`[screenshot ${p+1}](${c})`).join(" ")}`),l.recordingUrl&&i.push(`recording: [gif](${l.recordingUrl})`),!l.acceptanceCriterion&&!l.expected&&!l.actual&&!l.evidence.length&&i.push(l.hint);return s>0&&i.push("",`_\u2026 +${s} more \u2014 pass \`full\` to see every detail block._`),(n.coverage.unreachable.length||n.coverage.flakyCaseIds.length)&&(i.push("","---"),n.coverage.unreachable.length&&i.push(`_Not reached: ${n.coverage.unreachable.join("; ")}_`),n.coverage.flakyCaseIds.length&&i.push(`_Flaky: ${n.coverage.flakyCaseIds.join(", ")}_`)),i.join(`
38
+ `)}function Mi(n){if(n&&!(typeof n.start!="number"||typeof n.end!="number"))return{start:n.start,end:n.end}}function Uo(n,t){return{id:n.test_case_id,title:t.get(n.test_case_id),oldLines:Mi(n.old_lines),newLines:Mi(n.new_lines)}}function Po(n){return{id:n.test_case_id,title:n.title,reason:n.reason??void 0,snippet:n.snippet??void 0}}function jo(n){return{id:n.test_case_id,verdict:n.verdict,reasoning:n.reasoning??void 0,snippet:n.snippet??void 0,decidedAt:n.decided_at??void 0}}function qo(n){let t=[`${n.kept} kept`];return n.reanchored&&t.push(`${n.reanchored} re-anchored`),n.added&&t.push(`${n.added} added`),n.nullified&&t.push(`${n.nullified} nullified`),`Baseline update: ${t.join(", ")}.`}function Qi(n,t){let i=[...new Set(n)],r=new Set((t.test_cases??[]).filter(l=>(l.status??"active")!=="nullified"&&(l.status??"active")!=="superseded").map(l=>l.id)),a=i.filter(l=>r.has(l)),s=i.filter(l=>!r.has(l));return{required:i,covered:a,missing:s,ok:s.length===0}}function Vi(n,t=[]){let i=n.test_plan??{title:"Untitled plan"},r=new Map;for(let v of i.test_cases??[])r.set(v.id,v.title);let a=t.length?t:(i.test_cases??[]).filter(v=>v.fixed).map(v=>v.id),s=n.diff??{},l=s.kept??[],c=(s.reanchored??[]).map(v=>Uo(v,r)),p=(s.nullified??[]).map(Po),u=(s.added??[]).map(v=>({id:v.test_case_id,title:v.title})),f=(n.decisions??[]).map(jo),g={total:i.test_cases?.length??0,kept:l.length,reanchored:c.length,nullified:p.length,added:u.length};return{experimentId:n.experiment_id??"",planTitle:i.title||"Untitled plan",summary:{...g,headline:qo(g)},kept:l,reanchored:c,nullified:p,added:u,decisions:f,fixedCoverage:Qi(a,i)}}function tn(n){return n?`${n.start}-${n.end}`:"?"}function Ji(n){let t=[];t.push(`Seldon baseline update \u2014 ${n.planTitle}`),t.push(n.summary.headline);let i=n.fixedCoverage;if(i.required.length&&t.push(i.ok?`Fixed cases preserved: ${i.covered.length}/${i.required.length}.`:`WARNING: fixed cases NOT covered: ${i.missing.join(", ")}`),n.added.length){t.push("",`Added (${n.added.length}):`);for(let r of n.added)t.push(` + [${r.id}] ${r.title??""}`.trimEnd())}if(n.reanchored.length){t.push("",`Re-anchored (${n.reanchored.length}):`);for(let r of n.reanchored)t.push(` ~ [${r.id}] ${r.title??""}`.trimEnd()+` (lines ${tn(r.oldLines)} -> ${tn(r.newLines)})`)}if(n.nullified.length){t.push("",`Nullified (${n.nullified.length}):`);for(let r of n.nullified)t.push(` - [${r.id}] ${r.title??""}`.trimEnd()),r.reason&&t.push(` reason: ${r.reason}`)}return!n.added.length&&!n.reanchored.length&&!n.nullified.length&&t.push("","No changes \u2014 every case still covers its functionality."),t.join(`
39
+ `)}function Zi(n){let t=[];t.push(`# Seldon baseline update \u2014 ${n.planTitle}`,"",`**${n.summary.headline}**`);let i=n.fixedCoverage;if(i.required.length&&t.push("",i.ok?`Fixed cases preserved: **${i.covered.length}/${i.required.length}**.`:`> **WARNING:** fixed cases not covered: ${i.missing.join(", ")}`),n.added.length){t.push("",`## Added (${n.added.length})`);for(let r of n.added)t.push(`- \`${r.id}\` ${r.title??""}`.trimEnd())}if(n.reanchored.length){t.push("",`## Re-anchored (${n.reanchored.length})`);for(let r of n.reanchored)t.push(`- \`${r.id}\` ${r.title??""}`.trimEnd()+` \u2014 lines ${tn(r.oldLines)} \u2192 ${tn(r.newLines)}`)}if(n.nullified.length){t.push("",`## Nullified (${n.nullified.length})`);for(let r of n.nullified)t.push(`- \`${r.id}\` ${r.title??""}`.trimEnd()+(r.reason?` \u2014 ${r.reason}`:""))}return!n.added.length&&!n.reanchored.length&&!n.nullified.length&&t.push("","## No changes","","Every case still covers its functionality."),t.join(`
40
+ `)}var nt=new Set([".git","node_modules",".venv","venv","__pycache__","dist","build",".next",".idea",".turbo","coverage",".seldon"]),Xi=256*1024,Yo=8e3,zo=50*1024*1024,Ko=8192,tt="application/zip",er=new Date("2020-01-01T00:00:00Z"),it=new Set(["seldon.yml","seldon.yaml"]),Ho=/^(readme|contributing)(\.|$)/i;function Jn(n){return n.startsWith(".")}function Go(n){return it.has(n)||Ho.test(n)}function nr(n){return Ri==="/"?n:n.split(Ri).join("/")}function tr(n){let t=Math.min(n.length,Ko);for(let i=0;i<t;i+=1)if(n[i]===0)return!0;return!1}async function rn(n,t={}){let i=new Set(nt);for(let g of t.ignoreDirs??[])i.add(g);let r=t.maxFileBytes??Xi,a=t.maxFiles??Yo,s=t.maxTotalBytes??zo,l=[],c=[],p=0,u=null;async function f(g){if(u)return;let v;try{v=await Ro(g,{withFileTypes:!0})}catch{return}v.sort((R,F)=>R.name.localeCompare(F.name));for(let R of v){if(u)return;let F=qi(g,R.name),$=nr(Eo(n,F));if(R.isSymbolicLink())continue;if(R.isDirectory()){if(Jn(R.name)){c.push({path:$,reason:"hidden"});continue}if(i.has(R.name)){c.push({path:$,reason:"ignored-dir"});continue}await f(F);continue}if(!R.isFile())continue;if(Jn(R.name)&&!it.has(R.name)){c.push({path:$,reason:"hidden"});continue}if(!$.includes("/")&&!Go(R.name)){c.push({path:$,reason:"root-file"});continue}let w;try{w=(await ji(F)).size}catch{continue}if(w>r){c.push({path:$,reason:"too-large"});continue}if(l.length>=a){u="limit-files";return}if(p+w>s){u="limit-bytes";return}let T;try{T=new Uint8Array(await Pi(F))}catch{continue}if(tr(T)){c.push({path:$,reason:"binary"});continue}l.push({path:$,bytes:T}),p+=w}}return await f(n),u&&c.push({path:"",reason:u}),{files:l,skipped:c,totalBytes:p}}async function on(n,t={}){let{files:i,skipped:r}=await rn(n,t);if(i.length===0)throw new ne(`No analysable files found under ${n} (everything was empty, ignored, or binary).`);let a={};for(let s of i)a[s.path]=s.bytes;return{bytes:Sn(a,{level:6,mtime:er}),filename:t.filename??"codebase.zip",fileCount:i.length,skipped:r}}function Ni(n,t){try{return To("git",["-C",n,...t],{encoding:"utf8",maxBuffer:64*1024*1024})}catch(i){throw new ne(`git ${t.join(" ")} failed (is '${n}' a git repository?): ${i.message.split(`
41
+ `)[0]}`)}}async function ir(n,t={}){let i=t.base?[`${t.base}...HEAD`]:["HEAD"],r=Ni(n,["diff",...i]);if(!r.trim())throw new ne(t.base?`No changes between ${t.base} and HEAD to reassess.`:"No uncommitted changes vs HEAD to reassess.");let a=Ni(n,["diff","--name-only","--diff-filter=d",...i]).split(`
42
+ `).map(f=>f.trim()).filter(Boolean),s=t.maxFileBytes??Xi,l=new Set(nt),c={"changes.patch":new TextEncoder().encode(r)},p=[],u=0;for(let f of a){let g=f.split("/"),v=g[g.length-1];if(Jn(v)&&!it.has(v)){p.push({path:f,reason:"hidden"});continue}if(g.some($=>l.has($))){p.push({path:f,reason:"ignored-dir"});continue}let R=qi(n,f),F;try{if((await ji(R)).size>s){p.push({path:f,reason:"too-large"});continue}F=new Uint8Array(await Pi(R))}catch{continue}if(tr(F)){p.push({path:f,reason:"binary"});continue}c[nr(f)]=F,u+=1}return{bytes:Sn(c,{level:6,mtime:er}),filename:t.filename??"changed.zip",fileCount:u,skipped:p,patch:r}}async function rr(n,t,i={}){let r=await on(t,i),a=await n.upload("upload_qa_package",{field:"file",filename:r.filename,contentType:tt,bytes:r.bytes});return{lineageId:(await n.call("create_qa_baseline",{body:{package_gcs_url:a.package_gcs_url,filename:a.filename,url:"",...i.scope?{scope:i.scope}:{},...i.label?{label:i.label}:{}}})).lineage_id,filename:r.filename,packageGcsUrl:a.package_gcs_url,fileCount:r.fileCount,skipped:r.skipped}}function Wo(n){return{id:n.id,lineageId:n.lineage_id,displayName:n.display_name,status:n.status,createdVia:n.created_via,caseCount:n.case_count,targetUrl:n.target_url??void 0,repoFullName:n.repo_full_name??void 0,installationId:n.installation_id??void 0,createdAt:n.created_at??void 0}}async function rt(n){return{baselines:((await n.call("list_all_baselines")).baselines??[]).map(Wo)}}async function or(n,t,i={}){let r=i.intervalMs??3e3,a=Date.now(),s=a+(i.timeoutMs??10*6e4);for(;;){i.onTick?.(Date.now()-a);let{baselines:l}=await rt(n),c=l.find(p=>p.lineageId===t&&p.status==="committed"&&p.caseCount>0);if(c)return c;if(Date.now()>=s)throw new ne(`Timed out waiting for the baseline plan for lineage ${t}.`);await new Promise(p=>setTimeout(p,r))}}async function qe(n,t){return n.call("get_baseline_plan",{path:{baseline_id:t}})}async function Qo(n,t,i){return n.call("patch_baseline_plan",{path:{baseline_id:t},body:{...i.targetUrl!==void 0?{target_url:i.targetUrl}:{},...i.credentials!==void 0?{credentials:i.credentials}:{},...i.clearCredentials?{clear_credentials:!0}:{}}})}async function ar(n,t){let i=await n.call("list_baseline_versions",{path:{baseline_id:t}});return{lineageId:i.lineage_id,committedHeadId:i.committed_head_id??void 0,versions:(i.versions??[]).map(r=>({id:r.id,lineageId:r.lineage_id,status:r.status,createdVia:r.created_via,title:r.title??void 0,caseCount:r.case_count,targetUrl:r.target_url??void 0,isHead:r.is_head,createdAt:r.created_at??void 0}))}}async function sr(n,t){return n.call("promote_baseline",{path:{baseline_id:t}})}async function lr(n,t,i={}){return i.credentials!==void 0&&await Qo(n,t,{credentials:i.credentials}),{experimentId:(await n.call("run_baseline",{path:{baseline_id:t},...i.url!==void 0?{body:{target_url:i.url}}:{}})).experiment_id}}async function cr(n,t){return n.call("get_experiment_qa_report",{path:{experiment_id:t}})}async function ur(n,t,i={}){let r=i.intervalMs??5e3,a=Date.now(),s=a+(i.timeoutMs??30*6e4);for(;;){i.onTick?.(Date.now()-a);let l=await cr(n,t);if(l.report!=null||Date.now()>=s)return l;await new Promise(c=>setTimeout(c,r))}}async function ot(n,t){let i=await cr(n,t);return Fo({...i,experiment_id:i.experiment_id??t})}var fr=3e5,Wn="update_baseline_from_package";async function pr(n,t,i,r={}){let a=r.fixedCaseIds??[];if(!await n.hasOperation(Wn))throw new ne(`Baseline update isn't available on this API yet: the server must expose the '${Wn}' operation (POST /code-tests/baselines/{id}/update). Re-run 'seldon baseline generate' to rebuild from scratch, or upgrade the API.`);let s=await on(t,r),l=await n.upload("upload_qa_package",{field:"file",filename:s.filename,contentType:tt,bytes:s.bytes}),c=await n.call(Wn,{path:{baseline_id:i},timeoutMs:fr,body:{package_gcs_url:l.package_gcs_url,filename:l.filename,...r.fixedCaseIds!==void 0?{fixed_case_ids:a}:{},...r.seldonYaml!==void 0?{seldon_yaml:r.seldonYaml}:{}}}),p=c.test_plan??{title:""},u=a.length?a:(p.test_cases??[]).filter(g=>g.fixed).map(g=>g.id),f=Qi(u,p);if(!f.ok)throw new ne(`Baseline update dropped fixed case(s) that must always be covered: ${f.missing.join(", ")}. Refusing the result \u2014 the baseline's fixed cases are agreed-upon and cannot be nullified.`);return Vi({...c,experiment_id:c.experiment_id??i},a)}var Qn="delta_baseline";async function dr(n,t,i){if(!await n.hasOperation(Qn))throw new ne(`Baseline delta isn't available on this API yet: the server must expose the '${Qn}' operation (POST /code-tests/baselines/{id}/delta). Upgrade the API, or use 'seldon baseline update' for a whole-package re-map.`);let r=await n.upload("upload_qa_package",{field:"file",filename:i.filename??(i.full?"repo.zip":"changed.zip"),contentType:tt,bytes:i.zipBytes}),a=await n.call(Qn,{path:{baseline_id:t},timeoutMs:fr,body:{package_gcs_url:r.package_gcs_url,filename:r.filename,...i.full?{full:!0}:{},...i.targetUrl!==void 0?{target_url:i.targetUrl}:{},...i.fixedCaseIds!==void 0?{fixed_case_ids:i.fixedCaseIds}:{},...i.seldonYaml!==void 0?{seldon_yaml:i.seldonYaml}:{},...i.autoRun!==void 0?{auto_run:i.autoRun}:{}}}),s=Vi({experiment_id:a.draft_baseline_id,test_plan:{title:""},diff:a.diff??void 0,decisions:a.decisions??void 0},i.fixedCaseIds??[]);return{draftBaselineId:a.draft_baseline_id,lineageId:a.lineage_id,experimentId:a.experiment_id??void 0,report:s}}function at(n,t){let i=new Map;for(let a of n){let s=a.path.indexOf("/");if(s===-1){i.set(a.path,{name:a.path,type:"file",fileCount:1});continue}let l=a.path.slice(0,s),c=i.get(l);c?c.fileCount+=1:i.set(l,{name:l,type:"dir",fileCount:1})}let r=Array.from(i.values()).sort((a,s)=>a.name.localeCompare(s.name));return{totalFiles:n.length,totalBytes:t,rootEntries:r}}function st(n){let t=new Set;for(let i of n){if(i.reason!=="ignored-dir"||!i.path)continue;let r=i.path.split("/").pop();r&&t.add(r)}return Array.from(t).sort()}function gr(n){if(n<1024)return`${n} B`;let t=["KB","MB","GB","TB"],i=n/1024,r=0;for(;i>=1024&&r<t.length-1;)i/=1024,r+=1;return`${i.toFixed(1)} ${t[r]}`}var Zn="seldon.yml",Xo=Array.from(nt),ea="ALL";function Ye(){return{baseline:{baselineId:"",lineageId:"",generate:{scope:"",filename:"codebase.zip",ignoreDirs:[...Xo]},run:{url:""}},testCases:{skip:[],only:[],fixed:[]},cli:{wait:!0,reportFormat:"markdown"}}}function Re(n){return Jo(Zo(n),Zn)}function ce(n){let t;try{t=hr(Re(n),"utf8")}catch{return null}return na(t)}function lt(n){try{return hr(Re(n),"utf8")}catch{return}}function na(n){let t;try{t=Si(n)}catch(i){throw new ne(`Could not parse ${Zn}: ${i.message}`)}if(t==null)return{};if(typeof t!="object"||Array.isArray(t))throw new ne(`${Zn} must be a YAML mapping at the top level.`);return t}function ta(n){return Ci(n,{noRefs:!0,lineWidth:-1})}function $e(n,t){Vo(Re(n),ta(t),"utf8")}function Vn(n,t){return!n||n.length===0?[]:n.includes(ea)?[...t]:n}function mr(n,t,i){return Vn(t?.only,i).includes(n)?"only":Vn(t?.skip,i).includes(n)?"skip":Vn(t?.fixed,i).includes(n)?"fixed":"none"}function ct(n){let t={};for(let i of n)t[i.reason]=(t[i.reason]??0)+1;return t}async function vr(n){let t=Ye(),i=t.baseline?.generate?.ignoreDirs??[],{files:r,skipped:a,totalBytes:s}=await rn(n,{ignoreDirs:i});return{config:t,preview:at(r,s),ignored:st(a),skippedByReason:ct(a)}}function yr(n){let t=n.slice(2);for(let i=0;i<t.length;i+=1){let r=t[i];if(r==="--base-url"||r==="--api-key"){i+=1;continue}if(!r.startsWith("-"))return r==="api"}return!1}import{readFileSync as ka}from"fs";import{Command as Ta}from"commander";var ia="\x1B[0m",ra={bold:"1",dim:"2",inverse:"7",red:"31",green:"32",yellow:"33",blue:"34",magenta:"35",cyan:"36",gray:"90"};function oa(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.env.FORCE_COLOR!==void 0&&process.env.FORCE_COLOR!==""?!0:!!process.stdout.isTTY}function an(n,...t){return!oa()||t.length===0?n:`${t.map(r=>`\x1B[${ra[r]}m`).join("")}${n}${ia}`}var ut=n=>an(n,"bold"),wr=n=>an(n,"dim");import{mkdirSync as aa,readFileSync as sa,writeFileSync as la}from"fs";import{homedir as ca}from"os";import{join as br}from"path";function Ar(){return process.env.SELDON_CONFIG_DIR??process.env.BLOK_CONFIG_DIR??br(ca(),".config","seldon")}function xr(){return br(Ar(),"config.json")}function ze(){try{return JSON.parse(sa(xr(),"utf8"))}catch{return{}}}function sn(n){let t={...ze(),...n};return aa(Ar(),{recursive:!0,mode:448}),la(xr(),`${JSON.stringify(t,null,2)}
43
+ `,{encoding:"utf8",mode:384}),t}function Sr(n,t,i){return{baseUrl:n.baseUrl??i.SELDON_BASE_URL??i.BLOK_BASE_URL??t.baseUrl,apiKey:n.apiKey??i.SELDON_API_KEY??i.BLOK_API_KEY??t.apiKey}}function be(n,t){if(n.id)return n.id;let i=ce(t),r=i?.baseline?.baselineId;if(r)return r;let a=i?.baseline?.experimentId;if(a)return process.stderr.write(`note: seldon.yml uses the legacy 'baseline.experimentId' \u2014 rename it to 'baseline.baselineId'.
44
+ `),a;throw new Error("No baseline found here. Run `seldon baseline generate` first, or pass --id <baselineId>.")}function Cr(n,t){if(n.id)return n.id;let i=ce(t),r=i?.baseline?.lastRunExperimentId;if(r)return r;let a=i?.baseline?.experimentId;if(a)return a;throw new Error("No run found here yet. Run `seldon baseline run` first, or pass --id <experimentId>.")}function Ee(n,t){let i=ce(n)??Ye(),r=t(i);return $e(n,r),r}var ua="Other",fa=3,pa=3,da=3,ft=["none","skip","only","fixed"],ha={none:" ",skip:"s",only:"o",fixed:"f"};function ga(){return{get isTTY(){return!!process.stdin.isTTY},get columns(){return process.stdout.columns||80},get rows(){return process.stdout.rows||24},write:n=>process.stdout.write(n),onData:n=>process.stdin.on("data",n),offData:n=>process.stdin.removeListener("data",n),onResize:n=>process.stdout.on("resize",n),offResize:n=>process.stdout.removeListener("resize",n),setRawMode:n=>process.stdin.setRawMode?.(n),resume:()=>{process.stdin.setEncoding("utf8"),process.stdin.resume()},pause:()=>process.stdin.pause()}}function ma(n){let t=new Map;for(let r of n){let a=r.area?.trim()||ua;(t.get(a)??t.set(a,[]).get(a)).push(r)}let i=[];for(let[r,a]of t){i.push({kind:"header",text:`${r} (${a.length} case${a.length===1?"":"s"})`});for(let s of a)i.push({kind:"case",testCase:s})}return i}function va(n,t){let i=(ce(t)??Ye()).testCases,r=new Set(n.map(s=>s.id)),a=new Map(n.map(s=>[s.id,"none"]));for(let s of i?.fixed??[])r.has(s)&&a.set(s,"fixed");for(let s of i?.skip??[])r.has(s)&&a.set(s,"skip");for(let s of i?.only??[])r.has(s)&&a.set(s,"only");return a}function ya(n,t){return t<=1||n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}\u2026`}var pt=class{constructor(t,i,r,a){this.planTitle=t;this.io=a;this.rows=ma(i),this.caseRowIndices=this.rows.reduce((s,l,c)=>l.kind==="case"?[...s,c]:s,[]),this.statuses=va(i,r),this.cursor=0}planTitle;io;rows;caseRowIndices;statuses;cursor;linesWrittenLastRender=0;resolveFn;get columns(){return this.io.columns}get availableRows(){return Math.max(da,this.io.rows-fa-pa)}currentCase(){let t=this.rows[this.caseRowIndices[this.cursor]];if(t?.kind!=="case")throw new Error("cursor is not on a case row");return t.testCase}setStatus(t){let i=this.currentCase().id;this.statuses.set(i,this.statuses.get(i)===t?"none":t)}cycleStatus(){let t=this.currentCase().id,i=this.statuses.get(t)??"none",r=ft[(ft.indexOf(i)+1)%ft.length];this.statuses.set(t,r)}moveCursor(t){let i=this.caseRowIndices.length;this.cursor=((this.cursor+t)%i+i)%i}counts(){let t={none:0,skip:0,only:0,fixed:0};for(let i of this.statuses.values())t[i]+=1;return t}viewportRange(){let t=this.rows.length,i=this.availableRows;if(t<=i)return[0,t];let r=this.caseRowIndices[this.cursor],a=Math.max(0,r-Math.floor(i/2));return a=Math.min(a,t-i),[a,a+i]}render(){let t=this.columns,i=[],r=(c,...p)=>{i.push({text:c,colors:p.length?p:void 0})};r(`Configure test cases \u2014 ${this.planTitle}`,"bold"),r("\u2191/\u2193 move \xB7 s/o/f set \xB7 space cycle \xB7 enter save \xB7 esc/q cancel","dim"),r("");let[a,s]=this.viewportRange();a>0&&r(` \u2191 ${a} more above`,"dim");for(let c=a;c<s;c+=1){let p=this.rows[c];if(p.kind==="header"){r(p.text,"bold");continue}let u=this.caseRowIndices[this.cursor]===c,f=this.statuses.get(p.testCase.id)??"none",v=`${u?"\u276F":" "} [${ha[f]}] ${p.testCase.id}: ${p.testCase.title}`;u?r(v,"cyan","bold"):f==="skip"?r(v,"yellow"):f==="only"?r(v,"cyan"):f==="fixed"?r(v,"green"):r(v)}s<this.rows.length&&r(` \u2193 ${this.rows.length-s} more below`,"dim");let l=this.counts();r(""),r("Legend: [s]=skip [o]=only [f]=fixed [ ]=normal","dim"),r(`skip: ${l.skip} only: ${l.only} fixed: ${l.fixed}`,"dim"),this.linesWrittenLastRender>0&&this.io.write(`\x1B[${this.linesWrittenLastRender}A`);for(let{text:c,colors:p}of i){let u=ya(c,t);this.io.write(`\r\x1B[2K${p?an(u,...p):u}
45
+ `)}this.linesWrittenLastRender=i.length}finish(t){this.io.write(`
46
+ `),this.cleanup(),this.resolveFn?.(t)}onData=t=>{if(t===""||t==="q"||t==="\x1B")return this.finish(!1);if(t==="\r"||t===`
47
+ `)return this.finish(!0);if(t==="\x1B[A"||t==="k")return this.rerenderAfter(()=>this.moveCursor(-1));if(t==="\x1B[B"||t==="j")return this.rerenderAfter(()=>this.moveCursor(1));if(t===" ")return this.rerenderAfter(()=>this.cycleStatus());if(t==="s")return this.rerenderAfter(()=>this.setStatus("skip"));if(t==="o")return this.rerenderAfter(()=>this.setStatus("only"));if(t==="f")return this.rerenderAfter(()=>this.setStatus("fixed"))};rerenderAfter(t){t(),this.render()}onResize=()=>{this.linesWrittenLastRender=0,this.render()};cleanup(){this.io.setRawMode(!1),this.io.pause(),this.io.offData(this.onData),this.io.offResize(this.onResize),this.io.write("\x1B[?25h")}async run(){if(!this.io.isTTY)throw new Error("`seldon baseline configure` needs an interactive terminal (TTY). Run it directly in a shell.");return this.io.write("\x1B[?25l"),this.render(),this.io.setRawMode(!0),this.io.resume(),this.io.onData(this.onData),this.io.onResize(this.onResize),new Promise(t=>{this.resolveFn=t})}result(){let t=[],i=[],r=[];for(let[a,s]of this.statuses)s==="skip"?t.push(a):s==="only"?i.push(a):s==="fixed"&&r.push(a);return{skip:t,only:i,fixed:r}}};async function dt(n,t,i,r){let{status:a}=r,s=await qe(n,i),l=s.cases??[];if(l.length===0){a("This baseline has no test cases yet \u2014 wait for generation to finish, then try again.");return}let c=new pt(s.title??"Baseline",l,t,r.io??ga());if(!await c.run()){a("Aborted \u2014 no changes saved.");return}let{skip:u,only:f,fixed:g}=c.result();Ee(t,v=>({...v,testCases:{skip:u,only:f,fixed:g}})),a(`Saved to seldon.yml \u2014 skip: ${u.length}, only: ${f.length}, fixed: ${g.length}`)}import{existsSync as wa}from"fs";import{cancel as ht,confirm as ba,intro as Aa,isCancel as ln,outro as _r,text as gt}from"@clack/prompts";var mt=12,Ir=48,vt=8;function kr(n){if(n.length<=Ir)return n;let t=Ir-1,i=Math.ceil(t/2),r=Math.floor(t/2);return`${n.slice(0,i)}\u2026${n.slice(n.length-r)}`}function xa(n,t){let i=[];n["too-large"]&&i.push(`${n["too-large"]} too large`),n.binary&&i.push(`${n.binary} binary`),n.hidden&&i.push(`${n.hidden} hidden`),n["root-file"]&&i.push(`${n["root-file"]} root file(s)`),i.length&&t(`Excluded from upload: ${i.join(", ")}`)}function Tr(n,t,i,r){r(""),r(`Files that will be included: ${n.totalFiles} file(s), ${gr(n.totalBytes)}`);for(let a of n.rootEntries.slice(0,mt)){let s=kr(a.name);r(a.type==="dir"?` ${s}/ (${a.fileCount} file${a.fileCount===1?"":"s"})`:` ${s}`)}if(n.rootEntries.length>mt&&r(` \u2026 and ${n.rootEntries.length-mt} more`),t.length>0){let a=t.slice(0,vt).map(kr).join(", "),s=t.length>vt?` (+${t.length-vt} more)`:"";r(`Automatically ignoring: ${a}${s}`)}xa(i,r)}function Sa(n){let t=n.split(",").map(i=>i.trim().replace(/^\/+|\/+$/g,"")).filter(Boolean);return Array.from(new Set(t))}async function Ca(n,t,i){let{files:r,skipped:a,totalBytes:s}=await rn(n,{ignoreDirs:t});Tr(at(r,s),st(a),ct(a),i)}async function Rr(n,t){let{status:i}=t;if(Aa("Welcome to Seldon!"),wa(Re(n))){let p=await ba({message:"seldon.yml already exists here. Reset it to defaults?",initialValue:!1});if(ln(p)||!p){_r("Keeping the existing seldon.yml. Nothing changed.");return}}let r=await vr(n),a=r.config;$e(n,a),i("Created seldon.yml with smart defaults."),i("Analyzing your repository..."),Tr(r.preview,r.ignored,r.skippedByReason,i);let s=await gt({message:"Add more folders to ignore? (folder names, comma-separated \u2014 files aren't excluded here)",placeholder:"e.g. vendor, tmp (leave empty to skip)"});if(ln(s)){ht("Stopped \u2014 seldon.yml has the smart defaults saved above.");return}if(s.trim()){let p=Sa(s);a={...a,baseline:{...a.baseline,generate:{...a.baseline?.generate,ignoreDirs:Array.from(new Set([...a.baseline?.generate?.ignoreDirs??[],...p]))}}},$e(n,a),i(""),i("Updated \u2014 here's what will be included now:"),await Ca(n,a.baseline?.generate?.ignoreDirs??[],i)}let l=await gt({message:"Default staging URL? (optional)",placeholder:"https://staging.example.com"});if(ln(l)){ht("Stopped \u2014 seldon.yml has been saved with what you've entered so far.");return}l.trim()&&(a={...a,baseline:{...a.baseline,run:{...a.baseline?.run,url:l.trim()}}});let c=await gt({message:"Scope for baseline generation? (optional, e.g. 'checkout flow')",placeholder:"leave empty for full codebase analysis"});if(ln(c)){ht("Stopped \u2014 seldon.yml has been saved with what you've entered so far."),$e(n,a);return}c.trim()&&(a={...a,baseline:{...a.baseline,generate:{...a.baseline?.generate,scope:c.trim()}}}),$e(n,a),_r(["Configuration complete!","",`Saved to: ${Re(n)}`,"","Next steps:"," 1. Generate your baseline: seldon baseline generate"," 2. Configure test cases: seldon baseline configure"," 3. Run against staging: seldon baseline run"," 4. After code changes: seldon baseline update"].join(`
48
+ `))}import{spinner as _a}from"@clack/prompts";var Er=["Still working","Reticulating splines","Reading through the codebase","Thinking it through","Almost there","Hang tight"];function Ia(n){let t=Math.floor(n/1e3),i=Math.floor(t/60),r=t%60;return i>0?`${i}m ${r}s`:`${r}s`}function cn(n){let t=_a(),i=0;return t.start(n),{onTick:a=>{let s=Er[i%Er.length];i+=1,t.message(`${n} (${Ia(a)}) \u2014 ${s}...`)},stop:a=>t.stop(a)}}async function yt(n,t){let i=cn(n),r=Date.now(),a=setInterval(()=>i.onTick(Date.now()-r),2e3);try{return await t()}finally{clearInterval(a),i.stop("")}}function un(n,t){return n.json?"json":n.md?"markdown":t?.cli?.reportFormat??"text"}var Ra={only:"o",skip:"s",fixed:"f",none:" "};function Ea(n,t,i){return Ra[mr(n,t?.testCases,i)]}function Or(n){let t={};for(let i of n??[]){let r=i.indexOf("=");r>0&&(t[i.slice(0,r)]=i.slice(r+1))}return t}function Lr(n,t=[]){let i=n.out??(w=>process.stdout.write(`${w}
49
+ `)),r=n.status??(w=>process.stderr.write(`${w}
50
+ `)),a=new Ta("seldon");a.description(["Seldon \u2014 generate QA baselines from any codebase and run them from your terminal or CI.","","Authenticate once:"," seldon login seldon_<your-key> (or: seldon config set-key <key>)","","Typical flow, from inside a project:"," seldon init # create seldon.yml, preview what will be analyzed"," seldon baseline generate # read this codebase, build a QA baseline"," seldon baseline cases # review the generated test cases"," seldon baseline configure # mark cases as skip / only / fixed"," seldon baseline run --url https://staging.example.com"," seldon baseline report --md # clean, actionable results","","When the code changes, re-evaluate the baseline (fixed cases are always kept):"," seldon baseline update # whole-repo re-eval: kept / re-anchored / nullified / added"," seldon baseline delta # PR-style: stage a DRAFT from your changes + auto-run","","Inspect and manage versions:"," seldon baseline list # every baseline your key can see (all sources)"," seldon baseline versions # this lineage's committed head + draft proposals"," seldon baseline promote <versionId> # make a draft the committed head runs resolve to","","Configuration lives in seldon.yml at the project root (config-as-code, no server copy).","","Everything else is reachable via: seldon api <operation> [--path k=v] [--query k=v] [--data '{json}']"].join(`
11
51
  `)).option("--base-url <url>","Seldon API base URL (overrides SELDON_BASE_URL / config)").option("--api-key <key>","API key (overrides SELDON_API_KEY / config)").addHelpText("after",["","Environment variables:"," SELDON_API_KEY Your API key. Set this and you're good to go (BLOK_API_KEY also accepted)."," SELDON_BASE_URL Override the API base URL (defaults to the baked-in production URL).","","Get an API key: Settings \u2192 API keys in the Seldon product."].join(`
12
- `));let l=()=>{let o=s.opts();return n.makeSdk({baseUrl:o.baseUrl,apiKey:o.apiKey})},f=o=>t(JSON.stringify(o,null,2)),g=(o,r,a)=>{r==="json"?f(o):t(r==="markdown"?it(o,{full:a}):ot(o,{full:a}))},m=(o,r)=>{r==="json"?f(o):t(r==="markdown"?rt(o):at(o))},b=async o=>{let r=o.path??process.cwd(),a=S(o,r),c=C(r),u=o.url||c?.baseline?.run?.url||void 0;i(`Launching QA run for baseline ${a} ...`);let{experimentId:d}=await lt(l(),a,{url:u,credentials:o.credentials});if(I(r,p=>({...p,baseline:{...p.baseline,lastRunExperimentId:d,...o.url?{run:{...p.baseline?.run,url:o.url}}:{}}})),i(`Run started \u2014 experiment ${d}. View it in the app under QA, or: seldon baseline report`),!o.wait)return;let h=T("Running test cases");await pt(l(),d,{onTick:h.onTick}),h.stop(""),i("Test run complete."),g(await oe(l(),d),P(o,c),o.full)},w=o=>o.option("--url <url>","Live product URL to test against (default: seldon.yml baseline.run.url)").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Run a specific baseline instead of the saved one").option("--credentials <creds>","Inline login, e.g. 'username: a@b.com, password: secret'").option("--no-wait","Submit the run without waiting for results").option("--md","Render the report as Markdown").option("--json","Render the report as JSON").option("--full","Show every failure/blocked case's full detail block (default: capped at 5, ledger always lists every case)"),k=async o=>{let r=o.path??process.cwd(),a=H(o,r),c=C(r);g(await oe(l(),a),P(o,c),o.full)},v=o=>o.option("--path <dir>","Project directory (default: current directory)").option("--id <experimentId>","Report on a specific run instead of the last one").option("--md","Render as Markdown (great for PRs / agents)").option("--json","Render as JSON (stable schema for agents)").option("--full","Show every failure/blocked case's full detail block (default: capped at 5, ledger always lists every case)"),D=s.command("config").description("Manage local CLI configuration.");D.command("show").description("Print the saved config (api key redacted).").action(()=>{let o=x();f({baseUrl:o.baseUrl,apiKey:o.apiKey?"****":void 0})}),D.command("set-key <key>").description("Save an API key to the config file.").action(o=>{$({apiKey:o}),i("Saved API key.")}),D.command("set-url <url>").description("Save the API base URL to the config file.").action(o=>{$({baseUrl:o}),i("Saved base URL.")}),s.command("login <key>").description("Save your API key (alias for `config set-key`).").action(o=>{$({apiKey:o}),i("Saved API key. You're ready to go.")}),s.command("init [path]").description("Create seldon.yml for this project and preview what a baseline would include.").action(async o=>{let r=o??process.cwd();await ie(r,{status:i})});let y=s.command("baseline").description("Generate and inspect a QA baseline for the current codebase.");y.command("list").description("List every baseline your API key can see (across every source), not just the one saved locally.").option("--json","Output as JSON").action(async o=>{let{baselines:r}=await et(l());if(o.json){f({baselines:r});return}if(r.length===0){t("No baselines found for this API key. Generate one with: seldon baseline generate");return}t(j(`${r.length} baseline${r.length===1?"":"s"}`)+`
13
- `),t(le(r,[{header:"ID",cell:a=>a.id},{header:"NAME",cell:a=>a.displayName},{header:"SOURCE",cell:a=>a.createdVia},{header:"CASES",align:"right",cell:a=>String(a.caseCount)},{header:"STATUS",cell:a=>a.status},{header:"UPDATED",cell:a=>a.createdAt?new Date(a.createdAt).toISOString().slice(0,10):"?"}]))}),y.command("generate [path]").description("Read a local codebase, build a QA baseline (test plan), and tie it to this folder.").option("--scope <text>","Free-text emphasis for the analysis (e.g. 'focus on checkout')").option("--name <name>","Baseline name shown in the app (unique per tenant)").option("--no-wait","Return immediately without waiting for the plan to finish generating").option("--json","Output the baseline handle as JSON").action(async(o,r)=>{let a=o??process.cwd(),u=C(a)?.baseline?.generate;i(`Reading codebase at ${a} ...`);let d=await Xe(l(),a,{scope:r.scope??u?.scope,label:r.name,filename:u?.filename,ignoreDirs:u?.ignoreDirs});I(a,p=>({...p,baseline:{...p.baseline,lineageId:d.lineageId}})),i(`Uploaded ${d.fileCount} file(s); baseline created (lineage ${d.lineageId}).`);let h={lineageId:d.lineageId};if(r.wait){let p=T("Generating test plan (this can take a few minutes)"),R=await ct(l(),d.lineageId,{onTick:p.onTick});p.stop(""),I(a,z=>({...z,baseline:{...z.baseline,baselineId:R.id}})),h={lineageId:d.lineageId,baselineId:R.id,caseCount:R.caseCount},i(`Baseline ready: ${R.caseCount} test case(s). It now appears in the app under QA Baselines.`),i("Run it with: seldon baseline run --url <url>")}r.json?f({...d,...h}):i(`Saved baseline id to ${st(a)}`)}),y.command("show").description("Show the baseline tied to this folder and its status.").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Inspect a specific baseline instead of the saved one").action(async o=>{let r=o.path??process.cwd(),a=S(o,r),c=await re(l(),a),u=C(r);f({baselineId:c.baseline_id??a,lineageId:c.lineage_id,planTitle:c.title,caseCount:c.case_count??c.cases?.length??0,status:c.status,targetUrl:c.target_url||void 0,lastRunExperimentId:u?.baseline?.lastRunExperimentId||void 0,defaultUrl:u?.baseline?.run?.url||void 0})});let ue=async o=>{let r=o.path??process.cwd(),a=S(o,r),c=await re(l(),a),u=c.cases??[];if(o.json){f(u);return}let d=C(r),h=u.map(p=>p.id);t(`${c.title??"Baseline"} \u2014 ${u.length} case(s)`);for(let p of u)t(` [${gt(p.id,d,h)}] [${p.id}] ${p.title} (${p.priority??"?"} \xB7 ${p.area??"general"})`),p.acceptance_criterion&&t(` ${p.acceptance_criterion}`);t(""),t("Legend: [s]=skip [o]=only [f]=fixed [ ]=run normally \xB7 seldon baseline configure")};if(y.command("cases").description("Browse and mark test cases (interactive in a terminal; use --list/--json for a static dump).").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Inspect a specific baseline instead of the saved one").option("--json","Output full case objects as JSON (always static, never interactive)").option("--list","Force the static text listing even in an interactive terminal").action(async o=>{if(!o.json&&!o.list&&process.stdin.isTTY){let r=o.path??process.cwd(),a=S(o,r);await N(l(),r,a,{status:i});return}await ue(o)}),y.command("configure").description("Alias for `seldon baseline cases` \u2014 interactively mark test cases as skip / only / fixed.").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Configure a specific baseline instead of the saved one").action(async o=>{let r=o.path??process.cwd(),a=S(o,r);await N(l(),r,a,{status:i})}),y.command("update [path]").description("Re-evaluate the baseline against the current code. Fixed cases are always kept.").option("--id <baselineId>","Update a specific baseline instead of the saved one").option("--name <filename>","Archive name reported to the API").option("--md","Render the diff as Markdown").option("--json","Render the diff as JSON").action(async(o,r)=>{let a=o??process.cwd(),c=S(r,a),u=C(a),d=await M(`Re-evaluating baseline against ${a}`,()=>dt(l(),a,c,{seldonYaml:ae(a),filename:r.name??u?.baseline?.generate?.filename,ignoreDirs:u?.baseline?.generate?.ignoreDirs}));i(`Update complete: ${d.summary.headline}`),m(d,P(r,u))}),y.command("delta [path]").description("Reassess the baseline from your code changes: writes a DRAFT and auto-runs the affected cases.").option("--id <baselineId>","Reassess a specific baseline instead of the saved one").option("--zip <file>","Use a prebuilt zip (scoped changed-files, or a repo zip with --full) instead of building from git").option("--full","Re-map the whole repo (adds cases for new files) instead of only the changed area").option("--base <ref>","Scoped mode: diff <base>...HEAD instead of the working tree vs HEAD").option("--url <url>","Target URL for the auto-run of the affected cases").option("--no-auto-run","Write the draft without running the affected cases").option("--md","Render the diff as Markdown").option("--json","Render the diff as JSON").action(async(o,r)=>{let a=o??process.cwd(),c=S(r,a),u=C(a),d,h=!!r.full;if(r.zip)d=new Uint8Array(Ge(r.zip));else if(r.full)d=(await Ve(a,{ignoreDirs:u?.baseline?.generate?.ignoreDirs})).bytes,h=!0;else{let R=await Qe(a,{base:r.base});i(`Reassessing ${R.fileCount} changed file(s) against the baseline ...`),d=R.bytes}let p=await M("Reassessing baseline against the changes",()=>He(l(),c,{zipBytes:d,full:h,targetUrl:r.url,seldonYaml:ae(a),autoRun:r.autoRun}));i(`Delta complete: ${p.report.summary.headline}`),I(a,R=>({...R,baseline:{...R.baseline,...p.experimentId?{lastRunExperimentId:p.experimentId}:{}}})),p.experimentId?i(`Draft ${p.draftBaselineId} \u2014 running affected cases as experiment ${p.experimentId} (view under QA).`):i(`Draft ${p.draftBaselineId} \u2014 no affected cases ran (nothing affected, or no target URL).`),m(p.report,P(r,u))}),y.command("versions").description("List every version of this baseline's lineage \u2014 the committed head and any draft proposals.").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Inspect a specific lineage (any version id) instead of the saved one").option("--json","Output as JSON").action(async o=>{let r=o.path??process.cwd(),a=S(o,r),{versions:c,committedHeadId:u}=await tt(l(),a);if(o.json){f({committedHeadId:u,versions:c});return}if(c.length===0){t("No versions found for this baseline.");return}t(j(`${c.length} version${c.length===1?"":"s"} \u2014 committed head: ${u??"none"}`)+`
14
- `),t(le(c,[{header:"",cell:d=>d.isHead?"*":d.status==="draft"?"d":" "},{header:"ID",cell:d=>d.id},{header:"STATUS",cell:d=>d.status},{header:"SOURCE",cell:d=>d.createdVia},{header:"CASES",align:"right",cell:d=>String(d.caseCount)},{header:"UPDATED",cell:d=>d.createdAt?new Date(d.createdAt).toISOString().slice(0,10):"?"}])),t(J(`
15
- * = committed head (what runs use) \xB7 d = draft \xB7 promote a draft: seldon baseline promote <id>`))}),y.command("promote [versionId]").description("Promote a draft version to the committed head (the version runs resolve to).").option("--path <dir>","Project directory (default: current directory)").option("--id <versionId>","Promote a specific draft version instead of the positional arg / saved one").action(async(o,r)=>{let a=r.path??process.cwd(),c=o??S(r,a),u=await nt(l(),c),d=u.baseline_id??c;I(a,h=>({...h,baseline:{...h.baseline,baselineId:d}})),i(`Promoted to committed head ${d} (${u.case_count??u.cases?.length??0} case(s)). Runs now resolve to it.`)}),w(y.command("run").description("Run the current baseline against a live URL and print the report.")).action(b),v(y.command("report").description("Show the latest QA report for the current baseline (clean and actionable).")).action(k),w(s.command("run").description("Alias for `seldon baseline run`.")).action(b),v(s.command("report").description("Alias for `seldon baseline report`.")).action(k),e.length>0){let o=s.command("api").description("Call any API operation directly by name (auto-generated from the live OpenAPI spec).\n seldon api <operation> [--path key=value] [--query key=value] [--data '{json}']\n Run `seldon api --help` to see all available operations.");for(let r of e)o.command(r.name).description(r.summary??`${r.method} ${r.path}`).option("--path <pairs...>","Path params as key=value").option("--query <pairs...>","Query params as key=value").option("--data <json>","JSON request body").action(async a=>{f(await l().call(r.name,{path:de(a.path),query:de(a.query),body:a.data?JSON.parse(a.data):void 0}))})}return s}function pe(n){let e=V(n,x(),process.env);return new mt(e)}async function ht(){try{return await pe({}).apiKeyOps()}catch{return[]}}async function bt(){let n=W(process.argv)?await ht():[];await ce({makeSdk:pe},n).parseAsync(process.argv)}bt().catch(n=>{process.stderr.write(`${n.message}
52
+ `));let s=()=>{let w=a.opts();return n.makeSdk({baseUrl:w.baseUrl,apiKey:w.apiKey})},l=w=>i(JSON.stringify(w,null,2)),c=(w,T,k)=>{T==="json"?l(w):i(T==="markdown"?Wi(w,{full:k}):Gi(w,{full:k}))},p=(w,T)=>{T==="json"?l(w):i(T==="markdown"?Zi(w):Ji(w))},u=async w=>{let T=w.path??process.cwd(),k=be(w,T),B=ce(T),N=w.url||B?.baseline?.run?.url||void 0;r(`Launching QA run for baseline ${k} ...`);let{experimentId:M}=await lr(s(),k,{url:N,credentials:w.credentials});if(Ee(T,P=>({...P,baseline:{...P.baseline,lastRunExperimentId:M,...w.url?{run:{...P.baseline?.run,url:w.url}}:{}}})),r(`Run started \u2014 experiment ${M}. View it in the app under QA, or: seldon baseline report`),!w.wait)return;let z=cn("Running test cases");await ur(s(),M,{onTick:z.onTick}),z.stop(""),r("Test run complete."),c(await ot(s(),M),un(w,B),w.full)},f=w=>w.option("--url <url>","Live product URL to test against (default: seldon.yml baseline.run.url)").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Run a specific baseline instead of the saved one").option("--credentials <creds>","Inline login, e.g. 'username: a@b.com, password: secret'").option("--no-wait","Submit the run without waiting for results").option("--md","Render the report as Markdown").option("--json","Render the report as JSON").option("--full","Show every failure/blocked case's full detail block (default: capped at 5, ledger always lists every case)"),g=async w=>{let T=w.path??process.cwd(),k=Cr(w,T),B=ce(T);c(await ot(s(),k),un(w,B),w.full)},v=w=>w.option("--path <dir>","Project directory (default: current directory)").option("--id <experimentId>","Report on a specific run instead of the last one").option("--md","Render as Markdown (great for PRs / agents)").option("--json","Render as JSON (stable schema for agents)").option("--full","Show every failure/blocked case's full detail block (default: capped at 5, ledger always lists every case)"),R=a.command("config").description("Manage local CLI configuration.");R.command("show").description("Print the saved config (api key redacted).").action(()=>{let w=ze();l({baseUrl:w.baseUrl,apiKey:w.apiKey?"****":void 0})}),R.command("set-key <key>").description("Save an API key to the config file.").action(w=>{sn({apiKey:w}),r("Saved API key.")}),R.command("set-url <url>").description("Save the API base URL to the config file.").action(w=>{sn({baseUrl:w}),r("Saved base URL.")}),a.command("login <key>").description("Save your API key (alias for `config set-key`).").action(w=>{sn({apiKey:w}),r("Saved API key. You're ready to go.")}),a.command("init [path]").description("Create seldon.yml for this project and preview what a baseline would include.").action(async w=>{let T=w??process.cwd();await Rr(T,{status:r})});let F=a.command("baseline").description("Generate and inspect a QA baseline for the current codebase.");F.command("list").description("List every baseline your API key can see (across every source), not just the one saved locally.").option("--json","Output as JSON").action(async w=>{let{baselines:T}=await rt(s());if(w.json){l({baselines:T});return}if(T.length===0){i("No baselines found for this API key. Generate one with: seldon baseline generate");return}i(ut(`${T.length} baseline${T.length===1?"":"s"}`)+`
53
+ `),i(Xn(T,[{header:"ID",cell:k=>k.id},{header:"NAME",cell:k=>k.displayName},{header:"SOURCE",cell:k=>k.createdVia},{header:"CASES",align:"right",cell:k=>String(k.caseCount)},{header:"STATUS",cell:k=>k.status},{header:"UPDATED",cell:k=>k.createdAt?new Date(k.createdAt).toISOString().slice(0,10):"?"}]))}),F.command("generate [path]").description("Read a local codebase, build a QA baseline (test plan), and tie it to this folder.").option("--scope <text>","Free-text emphasis for the analysis (e.g. 'focus on checkout')").option("--name <name>","Baseline name shown in the app (unique per tenant)").option("--no-wait","Return immediately without waiting for the plan to finish generating").option("--json","Output the baseline handle as JSON").action(async(w,T)=>{let k=w??process.cwd(),N=ce(k)?.baseline?.generate;r(`Reading codebase at ${k} ...`);let M=await rr(s(),k,{scope:T.scope??N?.scope,label:T.name,filename:N?.filename,ignoreDirs:N?.ignoreDirs});Ee(k,P=>({...P,baseline:{...P.baseline,lineageId:M.lineageId}})),r(`Uploaded ${M.fileCount} file(s); baseline created (lineage ${M.lineageId}).`);let z={lineageId:M.lineageId};if(T.wait){let P=cn("Generating test plan (this can take a few minutes)"),j=await or(s(),M.lineageId,{onTick:P.onTick});P.stop(""),Ee(k,q=>({...q,baseline:{...q.baseline,baselineId:j.id}})),z={lineageId:M.lineageId,baselineId:j.id,caseCount:j.caseCount},r(`Baseline ready: ${j.caseCount} test case(s). It now appears in the app under QA Baselines.`),r("Run it with: seldon baseline run --url <url>")}T.json?l({...M,...z}):r(`Saved baseline id to ${Re(k)}`)}),F.command("show").description("Show the baseline tied to this folder and its status.").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Inspect a specific baseline instead of the saved one").action(async w=>{let T=w.path??process.cwd(),k=be(w,T),B=await qe(s(),k),N=ce(T);l({baselineId:B.baseline_id??k,lineageId:B.lineage_id,planTitle:B.title,caseCount:B.case_count??B.cases?.length??0,status:B.status,targetUrl:B.target_url||void 0,lastRunExperimentId:N?.baseline?.lastRunExperimentId||void 0,defaultUrl:N?.baseline?.run?.url||void 0})});let $=async w=>{let T=w.path??process.cwd(),k=be(w,T),B=await qe(s(),k),N=B.cases??[];if(w.json){l(N);return}let M=ce(T),z=N.map(P=>P.id);i(`${B.title??"Baseline"} \u2014 ${N.length} case(s)`);for(let P of N)i(` [${Ea(P.id,M,z)}] [${P.id}] ${P.title} (${P.priority??"?"} \xB7 ${P.area??"general"})`),P.acceptance_criterion&&i(` ${P.acceptance_criterion}`);i(""),i("Legend: [s]=skip [o]=only [f]=fixed [ ]=run normally \xB7 seldon baseline configure")};if(F.command("cases").description("Browse and mark test cases (interactive in a terminal; use --list/--json for a static dump).").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Inspect a specific baseline instead of the saved one").option("--json","Output full case objects as JSON (always static, never interactive)").option("--list","Force the static text listing even in an interactive terminal").action(async w=>{if(!w.json&&!w.list&&process.stdin.isTTY){let T=w.path??process.cwd(),k=be(w,T);await dt(s(),T,k,{status:r});return}await $(w)}),F.command("configure").description("Alias for `seldon baseline cases` \u2014 interactively mark test cases as skip / only / fixed.").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Configure a specific baseline instead of the saved one").action(async w=>{let T=w.path??process.cwd(),k=be(w,T);await dt(s(),T,k,{status:r})}),F.command("update [path]").description("Re-evaluate the baseline against the current code. Fixed cases are always kept.").option("--id <baselineId>","Update a specific baseline instead of the saved one").option("--name <filename>","Archive name reported to the API").option("--md","Render the diff as Markdown").option("--json","Render the diff as JSON").action(async(w,T)=>{let k=w??process.cwd(),B=be(T,k),N=ce(k),M=await yt(`Re-evaluating baseline against ${k}`,()=>pr(s(),k,B,{seldonYaml:lt(k),filename:T.name??N?.baseline?.generate?.filename,ignoreDirs:N?.baseline?.generate?.ignoreDirs}));r(`Update complete: ${M.summary.headline}`),p(M,un(T,N))}),F.command("delta [path]").description("Reassess the baseline from your code changes: writes a DRAFT and auto-runs the affected cases.").option("--id <baselineId>","Reassess a specific baseline instead of the saved one").option("--zip <file>","Use a prebuilt zip (scoped changed-files, or a repo zip with --full) instead of building from git").option("--full","Re-map the whole repo (adds cases for new files) instead of only the changed area").option("--base <ref>","Scoped mode: diff <base>...HEAD instead of the working tree vs HEAD").option("--url <url>","Target URL for the auto-run of the affected cases").option("--no-auto-run","Write the draft without running the affected cases").option("--md","Render the diff as Markdown").option("--json","Render the diff as JSON").action(async(w,T)=>{let k=w??process.cwd(),B=be(T,k),N=ce(k),M,z=!!T.full;if(T.zip)M=new Uint8Array(ka(T.zip));else if(T.full)M=(await on(k,{ignoreDirs:N?.baseline?.generate?.ignoreDirs})).bytes,z=!0;else{let j=await ir(k,{base:T.base});r(`Reassessing ${j.fileCount} changed file(s) against the baseline ...`),M=j.bytes}let P=await yt("Reassessing baseline against the changes",()=>dr(s(),B,{zipBytes:M,full:z,targetUrl:T.url,seldonYaml:lt(k),autoRun:T.autoRun}));r(`Delta complete: ${P.report.summary.headline}`),Ee(k,j=>({...j,baseline:{...j.baseline,...P.experimentId?{lastRunExperimentId:P.experimentId}:{}}})),P.experimentId?r(`Draft ${P.draftBaselineId} \u2014 running affected cases as experiment ${P.experimentId} (view under QA).`):r(`Draft ${P.draftBaselineId} \u2014 no affected cases ran (nothing affected, or no target URL).`),p(P.report,un(T,N))}),F.command("versions").description("List every version of this baseline's lineage \u2014 the committed head and any draft proposals.").option("--path <dir>","Project directory (default: current directory)").option("--id <baselineId>","Inspect a specific lineage (any version id) instead of the saved one").option("--json","Output as JSON").action(async w=>{let T=w.path??process.cwd(),k=be(w,T),{versions:B,committedHeadId:N}=await ar(s(),k);if(w.json){l({committedHeadId:N,versions:B});return}if(B.length===0){i("No versions found for this baseline.");return}i(ut(`${B.length} version${B.length===1?"":"s"} \u2014 committed head: ${N??"none"}`)+`
54
+ `),i(Xn(B,[{header:"",cell:M=>M.isHead?"*":M.status==="draft"?"d":" "},{header:"ID",cell:M=>M.id},{header:"STATUS",cell:M=>M.status},{header:"SOURCE",cell:M=>M.createdVia},{header:"CASES",align:"right",cell:M=>String(M.caseCount)},{header:"UPDATED",cell:M=>M.createdAt?new Date(M.createdAt).toISOString().slice(0,10):"?"}])),i(wr(`
55
+ * = committed head (what runs use) \xB7 d = draft \xB7 promote a draft: seldon baseline promote <id>`))}),F.command("promote [versionId]").description("Promote a draft version to the committed head (the version runs resolve to).").option("--path <dir>","Project directory (default: current directory)").option("--id <versionId>","Promote a specific draft version instead of the positional arg / saved one").action(async(w,T)=>{let k=T.path??process.cwd(),B=w??be(T,k),N=await sr(s(),B),M=N.baseline_id??B;Ee(k,z=>({...z,baseline:{...z.baseline,baselineId:M}})),r(`Promoted to committed head ${M} (${N.case_count??N.cases?.length??0} case(s)). Runs now resolve to it.`)}),f(F.command("run").description("Run the current baseline against a live URL and print the report.")).action(u),v(F.command("report").description("Show the latest QA report for the current baseline (clean and actionable).")).action(g),f(a.command("run").description("Alias for `seldon baseline run`.")).action(u),v(a.command("report").description("Alias for `seldon baseline report`.")).action(g),t.length>0){let w=a.command("api").description("Call any API operation directly by name (auto-generated from the live OpenAPI spec).\n seldon api <operation> [--path key=value] [--query key=value] [--data '{json}']\n Run `seldon api --help` to see all available operations.");for(let T of t)w.command(T.name).description(T.summary??`${T.method} ${T.path}`).option("--path <pairs...>","Path params as key=value").option("--query <pairs...>","Query params as key=value").option("--data <json>","JSON request body").action(async k=>{l(await s().call(T.name,{path:Or(k.path),query:Or(k.query),body:k.data?JSON.parse(k.data):void 0}))})}return a}function $r(n){let t=Sr(n,ze(),process.env);return new Ui(t)}async function Oa(){try{return await $r({}).apiKeyOps()}catch{return[]}}async function La(){let n=yr(process.argv)?await Oa():[];await Lr({makeSdk:$r},n).parseAsync(process.argv)}La().catch(n=>{process.stderr.write(`${n.message}
16
56
  `),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seldonqa/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Seldon - generate QA baselines from any codebase and run them from your terminal (thin client over @blok/sdk).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,14 +14,14 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@clack/prompts": "^0.10.1",
17
- "commander": "^12.1.0",
18
- "@blok/sdk": "0.1.0"
17
+ "commander": "^12.1.0"
19
18
  },
20
19
  "devDependencies": {
21
20
  "@types/node": "^20.14.0",
22
21
  "tsup": "^8.1.0",
23
22
  "typescript": "^5.5.0",
24
- "vitest": "^2.0.0"
23
+ "vitest": "^2.0.0",
24
+ "@blok/sdk": "0.1.0"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsup && node -e \"const fs=require('fs');const f='dist/bin.js';const c=fs.readFileSync(f,'utf8');if(!c.startsWith('#!/usr/bin/env node')){fs.writeFileSync(f,'#!/usr/bin/env node\\n'+c,'utf8')}fs.chmodSync(f,0o755)\"",