klaudius 0.34.0 → 0.34.1

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.
@@ -1,4 +1,4 @@
1
- import{a as m,m as q,n as J,p as R}from"./chunk-FNV6SXGT.js";import{useEffect as Oe,useMemo as Me,useRef as ie,useState as E}from"react";import{Box as B,Text as k,useApp as Fe,useInput as Ye}from"ink";import{Box as ce,Text as we}from"ink";import{jsx as le,jsxs as Ae}from"react/jsx-runtime";var ke={pending:"\u25CB",current:"\u25C9",done:"\u2713",skipped:"\xB7"},Ie={pending:void 0,current:"cyan",done:"green",skipped:void 0};function pe({items:e}){return le(ce,{flexDirection:"column",width:28,flexShrink:0,children:e.map(r=>{let o=r.status==="skipped"||r.status==="pending";return le(ce,{children:Ae(we,{color:Ie[r.status],bold:r.status==="current",dimColor:o&&r.status!=="current",children:[ke[r.status]," ",r.title]})},r.id)})})}import{useEffect as Re,useState as ue}from"react";import{Box as Q,Text as Y,useInput as Ee}from"ink";import Ce from"ink-text-input";import{jsx as D,jsxs as Z}from"react/jsx-runtime";function de({spec:e,masked:r,onSubmit:o,onBack:t}){let u=typeof e.initialValue=="string"?e.initialValue:"",n=r&&u.length>0,[i,b]=ue(n?"":u),[g,c]=ue(null);Re(()=>(m("TextPromptUI:mount",{masked:r,message:e.message.slice(0,60),initial:typeof e.initialValue=="string"?e.initialValue.slice(0,30):null}),()=>{m("TextPromptUI:unmount")}),[r,e.message,e.initialValue]),Ee((d,x)=>{m("TextPromptUI:useInput fired",{input:d,ctrl:x.ctrl,escape:x.escape,return:x.return}),x.escape&&t()});let A=d=>{m("TextPromptUI:handleSubmit",{raw:d.slice(0,30)});let x=d.length===0&&n?u:d;if(e.validate){let l=e.validate(x);if(l){m("TextPromptUI:validate failed",{err:l}),c(l);return}}c(null),o(x)};return Z(Q,{flexDirection:"column",children:[Z(Y,{children:[D(Y,{color:"cyan",children:"?"})," ",e.message]}),Z(Q,{children:[D(Y,{color:"green",children:"\u203A "}),D(Ce,{value:i,onChange:b,onSubmit:A,placeholder:n?"type or paste a new value \u2014 or press Enter to keep the current one":e.placeholder,mask:r?"\u2022":void 0})]}),g&&D(Q,{marginTop:0,children:D(Y,{color:"red",children:g})})]})}import{useState as ze}from"react";import{Box as _,Text as $,useInput as Ue}from"ink";import{jsx as j,jsxs as ee}from"react/jsx-runtime";function me({spec:e,onSubmit:r,onBack:o}){let t=e.options??[],u=typeof e.initialValue=="string"?Math.max(0,t.findIndex(b=>b.value===e.initialValue)):0,[n,i]=ze(u===-1?0:u);return Ue((b,g)=>{if(g.escape)o();else if(g.upArrow)i(c=>(c-1+t.length)%t.length);else if(g.downArrow)i(c=>(c+1)%t.length);else if(g.return){let c=t[n];c&&r(c.value)}}),ee(_,{flexDirection:"column",children:[ee($,{children:[j($,{color:"cyan",children:"?"})," ",e.message]}),j(_,{flexDirection:"column",marginTop:0,children:t.map((b,g)=>{let c=g===n;return ee($,{color:c?"cyan":void 0,bold:c,children:[c?"\u25CF ":"\u25CB ",b.label]},b.value)})}),j(_,{marginTop:1,children:j($,{dimColor:!0,children:"Use the \u2191 \u2193 arrow keys to choose, then press Enter"})})]})}import{useState as Ne}from"react";import{Box as te,Text as z,useInput as De}from"ink";import{jsx as L,jsxs as V}from"react/jsx-runtime";function fe({spec:e,onSubmit:r,onBack:o}){let[t,u]=Ne(typeof e.initialValue=="boolean"?e.initialValue:!0);return De((n,i)=>{i.escape?o():i.leftArrow||i.rightArrow?u(b=>!b):n==="y"||n==="Y"?u(!0):n==="n"||n==="N"?u(!1):i.return&&r(t)}),V(te,{flexDirection:"column",children:[V(z,{children:[L(z,{color:"cyan",children:"?"})," ",e.message]}),V(te,{marginTop:0,children:[V(z,{color:t?"cyan":void 0,bold:t,children:[t?"\u25CF ":"\u25CB ","Yes"]}),L(z,{children:" "}),V(z,{color:t?void 0:"cyan",bold:!t,children:[t?"\u25CB ":"\u25CF ","No"]})]}),L(te,{marginTop:1,children:L(z,{dimColor:!0,children:"Use the \u2190 \u2192 arrow keys (or y / n) to choose, then press Enter"})})]})}import{useState as re}from"react";import{Box as H,Text as W,useInput as Ve}from"ink";import{jsx as O,jsxs as X}from"react/jsx-runtime";function ge({spec:e,onSubmit:r,onBack:o}){let t=e.options??[],u=new Set(typeof e.initialValue=="string"?e.initialValue.split(",").map(d=>d.trim()).filter(Boolean):[]),[n,i]=re(0),[b,g]=re(u),[c,A]=re(null);return Ve((d,x)=>{if(x.escape)o();else if(x.upArrow)i(l=>(l-1+t.length)%t.length);else if(x.downArrow)i(l=>(l+1)%t.length);else if(d===" "){let l=t[n];l&&(A(null),g(y=>{let T=new Set(y);return T.has(l.value)?T.delete(l.value):T.add(l.value),T}))}else if(x.return){let l=t.map(T=>T.value).filter(T=>b.has(T)).join(","),y=e.validate?.(l);if(y){A(y);return}r(l)}}),X(H,{flexDirection:"column",children:[X(W,{children:[O(W,{color:"cyan",children:"?"})," ",e.message]}),O(H,{flexDirection:"column",marginTop:0,children:t.map((d,x)=>{let l=x===n,y=b.has(d.value);return X(W,{color:l?"cyan":void 0,bold:l,children:[l?"\u203A ":" ",y?"\u25C9 ":"\u25EF ",d.label]},d.value)})}),c&&O(H,{marginTop:0,children:O(W,{color:"red",children:c})}),O(H,{marginTop:1,children:X(W,{dimColor:!0,children:["\u2191 \u2193 to move, Space to tick/untick, Enter to confirm",e.validate?" (tick at least one)":" (ticking none is fine)"]})})]})}import{Box as xe,Text as Se}from"ink";import{jsx as oe,jsxs as We}from"react/jsx-runtime";function ne({title:e,body:r}){let o=r.split(`
1
+ import{a as m,n as q,o as J,q as R}from"./chunk-3XX6MJ72.js";import{useEffect as Oe,useMemo as Me,useRef as ie,useState as E}from"react";import{Box as B,Text as k,useApp as Fe,useInput as Ye}from"ink";import{Box as ce,Text as we}from"ink";import{jsx as le,jsxs as Ae}from"react/jsx-runtime";var ke={pending:"\u25CB",current:"\u25C9",done:"\u2713",skipped:"\xB7"},Ie={pending:void 0,current:"cyan",done:"green",skipped:void 0};function pe({items:e}){return le(ce,{flexDirection:"column",width:28,flexShrink:0,children:e.map(r=>{let o=r.status==="skipped"||r.status==="pending";return le(ce,{children:Ae(we,{color:Ie[r.status],bold:r.status==="current",dimColor:o&&r.status!=="current",children:[ke[r.status]," ",r.title]})},r.id)})})}import{useEffect as Re,useState as ue}from"react";import{Box as Q,Text as Y,useInput as Ee}from"ink";import Ce from"ink-text-input";import{jsx as D,jsxs as Z}from"react/jsx-runtime";function de({spec:e,masked:r,onSubmit:o,onBack:t}){let u=typeof e.initialValue=="string"?e.initialValue:"",n=r&&u.length>0,[i,b]=ue(n?"":u),[g,c]=ue(null);Re(()=>(m("TextPromptUI:mount",{masked:r,message:e.message.slice(0,60),initial:typeof e.initialValue=="string"?e.initialValue.slice(0,30):null}),()=>{m("TextPromptUI:unmount")}),[r,e.message,e.initialValue]),Ee((d,x)=>{m("TextPromptUI:useInput fired",{input:d,ctrl:x.ctrl,escape:x.escape,return:x.return}),x.escape&&t()});let A=d=>{m("TextPromptUI:handleSubmit",{raw:d.slice(0,30)});let x=d.length===0&&n?u:d;if(e.validate){let l=e.validate(x);if(l){m("TextPromptUI:validate failed",{err:l}),c(l);return}}c(null),o(x)};return Z(Q,{flexDirection:"column",children:[Z(Y,{children:[D(Y,{color:"cyan",children:"?"})," ",e.message]}),Z(Q,{children:[D(Y,{color:"green",children:"\u203A "}),D(Ce,{value:i,onChange:b,onSubmit:A,placeholder:n?"type or paste a new value \u2014 or press Enter to keep the current one":e.placeholder,mask:r?"\u2022":void 0})]}),g&&D(Q,{marginTop:0,children:D(Y,{color:"red",children:g})})]})}import{useState as ze}from"react";import{Box as _,Text as $,useInput as Ue}from"ink";import{jsx as j,jsxs as ee}from"react/jsx-runtime";function me({spec:e,onSubmit:r,onBack:o}){let t=e.options??[],u=typeof e.initialValue=="string"?Math.max(0,t.findIndex(b=>b.value===e.initialValue)):0,[n,i]=ze(u===-1?0:u);return Ue((b,g)=>{if(g.escape)o();else if(g.upArrow)i(c=>(c-1+t.length)%t.length);else if(g.downArrow)i(c=>(c+1)%t.length);else if(g.return){let c=t[n];c&&r(c.value)}}),ee(_,{flexDirection:"column",children:[ee($,{children:[j($,{color:"cyan",children:"?"})," ",e.message]}),j(_,{flexDirection:"column",marginTop:0,children:t.map((b,g)=>{let c=g===n;return ee($,{color:c?"cyan":void 0,bold:c,children:[c?"\u25CF ":"\u25CB ",b.label]},b.value)})}),j(_,{marginTop:1,children:j($,{dimColor:!0,children:"Use the \u2191 \u2193 arrow keys to choose, then press Enter"})})]})}import{useState as Ne}from"react";import{Box as te,Text as z,useInput as De}from"ink";import{jsx as L,jsxs as V}from"react/jsx-runtime";function fe({spec:e,onSubmit:r,onBack:o}){let[t,u]=Ne(typeof e.initialValue=="boolean"?e.initialValue:!0);return De((n,i)=>{i.escape?o():i.leftArrow||i.rightArrow?u(b=>!b):n==="y"||n==="Y"?u(!0):n==="n"||n==="N"?u(!1):i.return&&r(t)}),V(te,{flexDirection:"column",children:[V(z,{children:[L(z,{color:"cyan",children:"?"})," ",e.message]}),V(te,{marginTop:0,children:[V(z,{color:t?"cyan":void 0,bold:t,children:[t?"\u25CF ":"\u25CB ","Yes"]}),L(z,{children:" "}),V(z,{color:t?void 0:"cyan",bold:!t,children:[t?"\u25CB ":"\u25CF ","No"]})]}),L(te,{marginTop:1,children:L(z,{dimColor:!0,children:"Use the \u2190 \u2192 arrow keys (or y / n) to choose, then press Enter"})})]})}import{useState as re}from"react";import{Box as H,Text as W,useInput as Ve}from"ink";import{jsx as O,jsxs as X}from"react/jsx-runtime";function ge({spec:e,onSubmit:r,onBack:o}){let t=e.options??[],u=new Set(typeof e.initialValue=="string"?e.initialValue.split(",").map(d=>d.trim()).filter(Boolean):[]),[n,i]=re(0),[b,g]=re(u),[c,A]=re(null);return Ve((d,x)=>{if(x.escape)o();else if(x.upArrow)i(l=>(l-1+t.length)%t.length);else if(x.downArrow)i(l=>(l+1)%t.length);else if(d===" "){let l=t[n];l&&(A(null),g(y=>{let T=new Set(y);return T.has(l.value)?T.delete(l.value):T.add(l.value),T}))}else if(x.return){let l=t.map(T=>T.value).filter(T=>b.has(T)).join(","),y=e.validate?.(l);if(y){A(y);return}r(l)}}),X(H,{flexDirection:"column",children:[X(W,{children:[O(W,{color:"cyan",children:"?"})," ",e.message]}),O(H,{flexDirection:"column",marginTop:0,children:t.map((d,x)=>{let l=x===n,y=b.has(d.value);return X(W,{color:l?"cyan":void 0,bold:l,children:[l?"\u203A ":" ",y?"\u25C9 ":"\u25EF ",d.label]},d.value)})}),c&&O(H,{marginTop:0,children:O(W,{color:"red",children:c})}),O(H,{marginTop:1,children:X(W,{dimColor:!0,children:["\u2191 \u2193 to move, Space to tick/untick, Enter to confirm",e.validate?" (tick at least one)":" (ticking none is fine)"]})})]})}import{Box as xe,Text as Se}from"ink";import{jsx as oe,jsxs as We}from"react/jsx-runtime";function ne({title:e,body:r}){let o=r.split(`
2
2
  `);return We(xe,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,children:[oe(Se,{color:"cyan",bold:!0,children:e}),oe(xe,{flexDirection:"column",marginTop:0,children:o.map((t,u)=>oe(Se,{dimColor:!1,children:t.length===0?" ":t},u))})]})}import{jsx as a,jsxs as M}from"react/jsx-runtime";function Rt({defaults:e,onComplete:r,onlySection:o,banner:t}){let{exit:u}=Fe(),n=ie({...e}),i=ie(new Map),[,b]=E(0),g=()=>b(f=>f+1),[c,A]=E(null),[d,x]=E(null),[l,y]=E([]),[T,se]=E(null),[ae,he]=E(!1),[G,be]=E({current:0,total:0}),U=()=>{let f=i.current;for(let S of R){let C=S.isApplicable(n.current),I=f.get(S.id);C?o&&S.id!==o?I!=="current"&&f.set(S.id,"done"):(I==="skipped"||!I)&&f.set(S.id,"pending"):f.set(S.id,"skipped")}};i.current.size===0&&U();let K=ie(!1);Oe(()=>{if(m("WizardApp:useEffect fired",{startedAlready:K.current}),K.current){m("WizardApp:useEffect returning early (startedRef true)");return}K.current=!0,m("WizardApp:orchestrator starting");let f=0,S=0,C=null,I=null,F=0,Pe=p=>{let v=++f;return m("orchestrator:promptFn called",{id:v,type:p.type,message:p.message.slice(0,60)}),se(null),new Promise((P,s)=>{x({id:v,spec:p,resolve:w=>{m("orchestrator:prompt resolved",{id:v,type:p.type,value:typeof w=="string"?w.slice(0,30):w}),S++,P(w)},reject:w=>{m("orchestrator:prompt rejected",{id:v,reason:w.message}),s(w)}})})},Be=p=>{y(v=>[...v,p])};return(async()=>{try{let p=o?R.filter(s=>s.id===o):R,v=()=>p.filter(s=>s.isApplicable(n.current)).length,P=0;for(;P<p.length;){let s=p[P];if(!s.isApplicable(n.current)){i.current.set(s.id,"skipped"),P++,U(),g();continue}y(C?[{title:"Something went wrong in this step",body:`${C}
3
3
 
4
4
  Your answers in the earlier steps are kept. Try this step again below.`+(F>=2?`