@qitqode/qitqode-android-arm64 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-7b60whxm.js → chunk-0eh3yc6e.js} +1 -1
- package/bundle/{chunk-fge37dke.js → chunk-0mh600tv.js} +1 -1
- package/bundle/{chunk-5f0nhthe.js → chunk-0s4cp6q2.js} +1 -1
- package/bundle/{chunk-s8z7v1me.js → chunk-13jq2ygc.js} +1 -1
- package/bundle/{chunk-kwfe4em6.js → chunk-1a6q1f5n.js} +1 -1
- package/bundle/{chunk-he9kpk9r.js → chunk-1acn5me8.js} +3 -3
- package/bundle/{chunk-82xrfk5x.js → chunk-29q89bge.js} +1 -1
- package/bundle/{chunk-waa1ggtj.js → chunk-2phyc1c0.js} +1 -1
- package/bundle/{chunk-njsmma3a.js → chunk-30wp95w1.js} +1 -1
- package/bundle/{chunk-wf41m019.js → chunk-32fpqd0n.js} +1 -1
- package/bundle/chunk-4y9wbfd2.js +8 -0
- package/bundle/{chunk-3cx4p07h.js → chunk-539cw9r0.js} +1 -1
- package/bundle/{chunk-epmc4aht.js → chunk-53jstmdp.js} +1 -1
- package/bundle/{chunk-nga216dm.js → chunk-6vnqbejg.js} +1 -1
- package/bundle/{chunk-3zwma68w.js → chunk-702bt91p.js} +2 -2
- package/bundle/{chunk-26cr51wa.js → chunk-705qkpra.js} +1 -1
- package/bundle/{chunk-66qmmmdp.js → chunk-76c400ze.js} +1 -1
- package/bundle/{chunk-ddx2pcr4.js → chunk-7bxxc4a3.js} +1 -1
- package/bundle/{chunk-qxdpgdfk.js → chunk-7pckez5z.js} +1 -1
- package/bundle/{chunk-gefx3n08.js → chunk-7r92d7v9.js} +1 -1
- package/bundle/{chunk-w0sng8a9.js → chunk-9bw6bx5c.js} +1 -1
- package/bundle/{chunk-9009v4d0.js → chunk-b5ym419d.js} +1 -1
- package/bundle/{chunk-2qm46qvn.js → chunk-bhg69t69.js} +1 -1
- package/bundle/{chunk-gc5rhnht.js → chunk-bkfafcbw.js} +1 -1
- package/bundle/{chunk-khpfseej.js → chunk-bnw744ej.js} +2 -2
- package/bundle/{chunk-4064rbtp.js → chunk-c987bemn.js} +1 -1
- package/bundle/{chunk-4aajzxm9.js → chunk-dcv6wj9x.js} +1 -1
- package/bundle/{chunk-rjhvdfn5.js → chunk-dtcvqrmn.js} +1 -1
- package/bundle/{chunk-x00hwy3x.js → chunk-dwqvcdmf.js} +1 -1
- package/bundle/{chunk-2t5yh25f.js → chunk-e0hha3be.js} +1 -1
- package/bundle/{chunk-66wv82vf.js → chunk-fd8x2nb4.js} +1 -1
- package/bundle/{chunk-tsmj98yf.js → chunk-fv5mrdyc.js} +1 -1
- package/bundle/{chunk-6yhn9syz.js → chunk-fveaq0pb.js} +1 -1
- package/bundle/{chunk-k3hgwszx.js → chunk-gkbx6edf.js} +1 -1
- package/bundle/{chunk-txkdt4ep.js → chunk-gq9hb2e8.js} +1 -1
- package/bundle/{chunk-wb05bp10.js → chunk-gswhjd1h.js} +1 -1
- package/bundle/{chunk-b7ncyat6.js → chunk-hq7s4f75.js} +1 -1
- package/bundle/{chunk-f30em1wx.js → chunk-j1h64m65.js} +1 -1
- package/bundle/{chunk-qq9m8fxv.js → chunk-k1qd8ecm.js} +4 -4
- package/bundle/{chunk-bnaj2hh3.js → chunk-k3m7jfdh.js} +1 -1
- package/bundle/{chunk-6qwk6z87.js → chunk-k6981ysw.js} +1 -1
- package/bundle/{chunk-qxre2gqn.js → chunk-m4g4djss.js} +1 -1
- package/bundle/{chunk-qgfbsmsx.js → chunk-maa21rh9.js} +1 -1
- package/bundle/{chunk-ayb3bdb7.js → chunk-mrq35ftw.js} +1 -1
- package/bundle/{chunk-vfd3azkp.js → chunk-mt2by7rx.js} +1 -1
- package/bundle/{chunk-dmkgjf1v.js → chunk-mwkms65j.js} +1 -1
- package/bundle/{chunk-f81kk8ra.js → chunk-nas631g2.js} +1 -1
- package/bundle/{chunk-h4hs2rhf.js → chunk-nsp1za8t.js} +1 -1
- package/bundle/{chunk-c2a74stf.js → chunk-nsw5x43k.js} +1 -1
- package/bundle/{chunk-5nmm1kvx.js → chunk-qsme16gk.js} +1 -1
- package/bundle/{chunk-nfafk3ts.js → chunk-qwmae3vk.js} +1 -1
- package/bundle/{chunk-58f4y4b7.js → chunk-rdreeyv0.js} +1 -1
- package/bundle/{chunk-bjv1h2dq.js → chunk-rjcz4kbm.js} +1 -1
- package/bundle/{chunk-vkjqy92f.js → chunk-rwwvy89t.js} +1 -1
- package/bundle/{chunk-f8cae1ap.js → chunk-s5aefff0.js} +1 -1
- package/bundle/{chunk-ezgfhy4e.js → chunk-tax3ecy5.js} +1 -1
- package/bundle/{chunk-w9qh2479.js → chunk-tk4z6r09.js} +1 -1
- package/bundle/{chunk-qn8tz704.js → chunk-tr0rm1ka.js} +1 -1
- package/bundle/{chunk-q3c8mfbq.js → chunk-ty14zznd.js} +1 -1
- package/bundle/{chunk-33ebjca6.js → chunk-vd8cmdpv.js} +1 -1
- package/bundle/{chunk-c3yjbent.js → chunk-vgt3artc.js} +1 -1
- package/bundle/{chunk-ytyzrqev.js → chunk-vkkz40je.js} +1 -1
- package/bundle/{chunk-8g4jdqq1.js → chunk-vpjyk76v.js} +1 -1
- package/bundle/{chunk-xs6v0r9m.js → chunk-wwvek9zf.js} +1 -1
- package/bundle/{chunk-nwj6mcxz.js → chunk-x7a3kqe5.js} +1 -1
- package/bundle/{chunk-8csas2jc.js → chunk-xb22grz6.js} +1 -1
- package/bundle/{chunk-9cn8cmt0.js → chunk-y31f8k5f.js} +1 -1
- package/bundle/{chunk-n6v36np0.js → chunk-y3eeva80.js} +1 -1
- package/bundle/{chunk-qc89yj61.js → chunk-zq32jhj1.js} +1 -1
- package/bundle/chunk-zxwjxszn.js +2 -0
- package/bundle/index.js +3 -3
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-37cbrnke.js +0 -8
- package/bundle/chunk-e01jgnnm.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h as x}from"./chunk-
|
|
2
|
+
import{h as x}from"./chunk-vd8cmdpv.js";import{j as D}from"./chunk-0z1keh2w.js";import{H as A}from"./chunk-vgt3artc.js";import{be as P}from"./chunk-f4mnp6xd.js";import{eg as j}from"./chunk-bwadggys.js";import{Fg as R,Gg as S,Hg as k}from"./chunk-nsp1za8t.js";import{Ch as $}from"./chunk-1acn5me8.js";import{yj as B}from"./chunk-k1qd8ecm.js";import{Co as F,ho as G,jo as W,ko as Y,lo as _,mo as O,no as b,wo as v,xo as K}from"./chunk-4y9wbfd2.js";import{fH as H}from"./chunk-g7v6sp3c.js";var X="forgewise",p=(J,z=process.env)=>J.trim()||z.QLEX_API_KEY?.trim()||"",U=(J)=>H.gen(function*(){let z=J.trim();if(!z)yield*H.sync(()=>{j.println(j.Style.TEXT_DANGER+"Error: API key cannot be empty."+j.Style.TEXT_NORMAL)}),process.exit(1);yield*(yield*B.Service).set(X,{type:"api",key:z,metadata:{method:"api-key"}}),yield*D(j.Style.TEXT_SUCCESS+"Signed in with API key."+j.Style.TEXT_NORMAL)}).pipe(H.withSpan("forgewise.login.apikey"));async function u(){let J=!Y();try{return await S({tryOpen:J,onCode:(z)=>{if(process.stdout.write(`
|
|
3
3
|
`),process.stdout.write(" To sign in, open: "+z.verificationUri+`
|
|
4
4
|
`),process.stdout.write(" and enter code: "+z.userCode+`
|
|
5
5
|
`),z.verificationUriComplete)process.stdout.write(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Kn as z2}from"./chunk-sa0rrreh.js";import{Gq as i0,Iq as s0}from"./chunk-
|
|
2
|
+
import{Kn as z2}from"./chunk-sa0rrreh.js";import{Gq as i0,Iq as s0}from"./chunk-29q89bge.js";import{Yr as Q2}from"./chunk-dt3bsmfe.js";import{bs as E0}from"./chunk-0tm6589k.js";import{js as x0}from"./chunk-gswhjd1h.js";import{Fs as t}from"./chunk-wgkcyqn1.js";import{Os as e}from"./chunk-59csnjc3.js";import{Ys as $2,ct as f,gt as S,ht as a0,jt as o,lt as j0}from"./chunk-1bxfzd6r.js";import{mt as p}from"./chunk-6p6m5956.js";import{Qy as d0}from"./chunk-w7a33cwa.js";import{AB as V0,EE as g,Rz as o0,UG as K0,UN as w,ZE as c,eK as Z2,fH as J,mB as L}from"./chunk-g7v6sp3c.js";import{tO as W0,vO as e0,xO as L2}from"./chunk-e0vrxetq.js";function z0(Z,Q=!1){let z=Z.length,$=0,X="",Y=0,U=16,G=0,W=0,I=0,H=0,q=0;function R(j,_){let V=0,B=0;while(V<j||!_){let M=Z.charCodeAt($);if(M>=48&&M<=57)B=B*16+M-48;else if(M>=65&&M<=70)B=B*16+M-65+10;else if(M>=97&&M<=102)B=B*16+M-97+10;else break;$++,V++}if(V<j)B=-1;return B}function N(j){$=j,X="",Y=0,U=16,q=0}function A(){let j=$;if(Z.charCodeAt($)===48)$++;else{$++;while($<Z.length&&s(Z.charCodeAt($)))$++}if($<Z.length&&Z.charCodeAt($)===46)if($++,$<Z.length&&s(Z.charCodeAt($))){$++;while($<Z.length&&s(Z.charCodeAt($)))$++}else return q=3,Z.substring(j,$);let _=$;if($<Z.length&&(Z.charCodeAt($)===69||Z.charCodeAt($)===101)){if($++,$<Z.length&&Z.charCodeAt($)===43||Z.charCodeAt($)===45)$++;if($<Z.length&&s(Z.charCodeAt($))){$++;while($<Z.length&&s(Z.charCodeAt($)))$++;_=$}else q=3}return Z.substring(j,_)}function O(){let j="",_=$;while(!0){if($>=z){j+=Z.substring(_,$),q=2;break}let V=Z.charCodeAt($);if(V===34){j+=Z.substring(_,$),$++;break}if(V===92){if(j+=Z.substring(_,$),$++,$>=z){q=2;break}switch(Z.charCodeAt($++)){case 34:j+='"';break;case 92:j+="\\";break;case 47:j+="/";break;case 98:j+="\b";break;case 102:j+="\f";break;case 110:j+=`
|
|
3
3
|
`;break;case 114:j+="\r";break;case 116:j+="\t";break;case 117:let M=R(4,!0);if(M>=0)j+=String.fromCharCode(M);else q=4;break;default:q=5}_=$;continue}if(V>=0&&V<=31)if(Q0(V)){j+=Z.substring(_,$),q=2;break}else q=6;$++}return j}function K(){if(X="",q=0,Y=$,W=G,H=I,$>=z)return Y=z,U=17;let j=Z.charCodeAt($);if(b0(j)){do $++,X+=String.fromCharCode(j),j=Z.charCodeAt($);while(b0(j));return U=15}if(Q0(j)){if($++,X+=String.fromCharCode(j),j===13&&Z.charCodeAt($)===10)$++,X+=`
|
|
4
4
|
`;return G++,I=$,U=14}switch(j){case 123:return $++,U=1;case 125:return $++,U=2;case 91:return $++,U=3;case 93:return $++,U=4;case 58:return $++,U=6;case 44:return $++,U=5;case 34:return $++,X=O(),U=10;case 47:let _=$-1;if(Z.charCodeAt($+1)===47){$+=2;while($<z){if(Q0(Z.charCodeAt($)))break;$++}return X=Z.substring(_,$),U=12}if(Z.charCodeAt($+1)===42){$+=2;let V=z-1,B=!1;while($<V){let M=Z.charCodeAt($);if(M===42&&Z.charCodeAt($+1)===47){$+=2,B=!0;break}if($++,Q0(M)){if(M===13&&Z.charCodeAt($)===10)$++;G++,I=$}}if(!B)$++,q=1;return X=Z.substring(_,$),U=13}return X+=String.fromCharCode(j),$++,U=16;case 45:if(X+=String.fromCharCode(j),$++,$===z||!s(Z.charCodeAt($)))return U=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return X+=A(),U=11;default:while($<z&&y(j))$++,j=Z.charCodeAt($);if(Y!==$){switch(X=Z.substring(Y,$),X){case"true":return U=8;case"false":return U=9;case"null":return U=7}return U=16}return X+=String.fromCharCode(j),$++,U=16}}function y(j){if(b0(j)||Q0(j))return!1;switch(j){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let j;do j=K();while(j>=12&&j<=15);return j}return{setPosition:N,getPosition:()=>$,scan:Q?v:K,getToken:()=>U,getTokenValue:()=>X,getTokenOffset:()=>Y,getTokenLength:()=>$-Y,getTokenStartLine:()=>W,getTokenStartCharacter:()=>Y-H,getTokenError:()=>q}}function b0(Z){return Z===32||Z===9}function Q0(Z){return Z===10||Z===13}function s(Z){return Z>=48&&Z<=57}var u0;(function(Z){Z[Z.lineFeed=10]="lineFeed",Z[Z.carriageReturn=13]="carriageReturn",Z[Z.space=32]="space",Z[Z._0=48]="_0",Z[Z._1=49]="_1",Z[Z._2=50]="_2",Z[Z._3=51]="_3",Z[Z._4=52]="_4",Z[Z._5=53]="_5",Z[Z._6=54]="_6",Z[Z._7=55]="_7",Z[Z._8=56]="_8",Z[Z._9=57]="_9",Z[Z.a=97]="a",Z[Z.b=98]="b",Z[Z.c=99]="c",Z[Z.d=100]="d",Z[Z.e=101]="e",Z[Z.f=102]="f",Z[Z.g=103]="g",Z[Z.h=104]="h",Z[Z.i=105]="i",Z[Z.j=106]="j",Z[Z.k=107]="k",Z[Z.l=108]="l",Z[Z.m=109]="m",Z[Z.n=110]="n",Z[Z.o=111]="o",Z[Z.p=112]="p",Z[Z.q=113]="q",Z[Z.r=114]="r",Z[Z.s=115]="s",Z[Z.t=116]="t",Z[Z.u=117]="u",Z[Z.v=118]="v",Z[Z.w=119]="w",Z[Z.x=120]="x",Z[Z.y=121]="y",Z[Z.z=122]="z",Z[Z.A=65]="A",Z[Z.B=66]="B",Z[Z.C=67]="C",Z[Z.D=68]="D",Z[Z.E=69]="E",Z[Z.F=70]="F",Z[Z.G=71]="G",Z[Z.H=72]="H",Z[Z.I=73]="I",Z[Z.J=74]="J",Z[Z.K=75]="K",Z[Z.L=76]="L",Z[Z.M=77]="M",Z[Z.N=78]="N",Z[Z.O=79]="O",Z[Z.P=80]="P",Z[Z.Q=81]="Q",Z[Z.R=82]="R",Z[Z.S=83]="S",Z[Z.T=84]="T",Z[Z.U=85]="U",Z[Z.V=86]="V",Z[Z.W=87]="W",Z[Z.X=88]="X",Z[Z.Y=89]="Y",Z[Z.Z=90]="Z",Z[Z.asterisk=42]="asterisk",Z[Z.backslash=92]="backslash",Z[Z.closeBrace=125]="closeBrace",Z[Z.closeBracket=93]="closeBracket",Z[Z.colon=58]="colon",Z[Z.comma=44]="comma",Z[Z.dot=46]="dot",Z[Z.doubleQuote=34]="doubleQuote",Z[Z.minus=45]="minus",Z[Z.openBrace=123]="openBrace",Z[Z.openBracket=91]="openBracket",Z[Z.plus=43]="plus",Z[Z.slash=47]="slash",Z[Z.formFeed=12]="formFeed",Z[Z.tab=9]="tab"})(u0||(u0={}));var x=Array(20).fill(0).map((Z,Q)=>{return" ".repeat(Q)});var L0={" ":{"\n":Array(200).fill(0).map((Z,Q)=>{return`
|
|
5
5
|
`+" ".repeat(Q)}),"\r":Array(200).fill(0).map((Z,Q)=>{return"\r"+" ".repeat(Q)}),"\r\n":Array(200).fill(0).map((Z,Q)=>{return`\r
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Aq as a,Bq as b,Cq as c}from"./chunk-
|
|
2
|
+
import{Aq as a,Bq as b,Cq as c}from"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-e0vrxetq.js";export{c as makeRuntime,a as attachWith,b as attach};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bn as C,Hn as K,kn as j,ln as R,mn as O,nn as A,tn as y,yn as q,zn as M}from"./chunk-
|
|
2
|
+
import{Bn as C,Hn as K,kn as j,ln as R,mn as O,nn as A,tn as y,yn as q,zn as M}from"./chunk-k6981ysw.js";import{Or as D}from"./chunk-z0kbyr00.js";import{Fs as m,Is as v}from"./chunk-wgkcyqn1.js";import{gt as d,it as b,lt as I}from"./chunk-1bxfzd6r.js";import{yO as T,zO as _}from"./chunk-e0vrxetq.js";import P from"path";function pt(t){let e=t&&typeof t==="object"&&"cause"in t?t.cause??t:t;if(!(e instanceof D.RunFailedError))return{error:e,detail:v(e),missing:!1};let r=e.stderr.toString().split(/\r?\n/).map((o)=>o.trim()).filter(Boolean),n=r.filter((o)=>o.startsWith("error:")).map((o)=>o.replace(/^error:\s*/,""));return{error:e,detail:n[0]??r.at(-1),missing:r.some((o)=>o.includes("No version matching"))}}var $={resolve:(t)=>q(t)},z={readText:(t)=>d.readText(t),write:async(t,e)=>{await d.write(t,e)},exists:(t)=>d.exists(t),files:(t,e)=>K(t,e)},G=z;function V(t){if(typeof t==="string")return t;if(!Array.isArray(t))return;if(typeof t[0]!=="string")return;return t[0]}function H(t){if(!t||typeof t!=="object"||Array.isArray(t))return;let e=t;if(!Array.isArray(e.plugin))return;return e.plugin}function Q(t){if(typeof t==="string"){let e=t.trim();if(e)return e;return}if(!m(t))return;for(let e of["import","default"]){let r=t[e];if(typeof r!=="string")continue;let n=r.trim();if(!n)continue;return n}}function U(t){if(!m(t))return;let e=t.config;if(!m(e))return;return e}function E(t,e){let r=t.exports;if(!m(r))return;let n=r[`./${e}`];if(!Q(n))return;return{opts:U(n)}}function X(t){let e=t.main;if(typeof e!=="string")return!1;return Boolean(e.trim())}function Y(t){let e=typeof t.json.name==="string"&&t.json.name.trim().length>0?t.json.name.trim():P.basename(t.dir),r=[],n=E(t.json,"server");if(n)r.push({kind:"server",opts:n.opts});else if(X(t.json))r.push({kind:"server"});let o=E(t.json,"tui");if(o)r.push({kind:"tui",opts:o.opts});if(!r.some((c)=>c.kind==="tui")&&C(e,t).length)r.push({kind:"tui"});return r}function g(t,e,r,n=!1){return A(t,O(t,e,r,{formattingOptions:{tabSize:2,insertSpaces:!0},isArrayInsertion:n}))}function Z(t,e,r,n,o=!1){let c=y(r).pkg,u=(e??[]).map((i,p)=>({item:i,i:p,spec:V(i)})).filter((i)=>{if(!i.spec)return!1;if(i.spec===r)return!0;if(i.spec.startsWith("file://"))return!1;return y(i.spec).pkg===c});if(!u.length){if(!e)return{mode:"add",text:g(t,["plugin"],[n])};return{mode:"add",text:g(t,["plugin",e.length],n,!0)}}if(!o)return{mode:"noop",text:t};let s=u[0];if(!s)return{mode:"noop",text:t};if(u.length===1&&s.spec===r)return{mode:"noop",text:t};let a=t;if(typeof s.item==="string")a=g(a,["plugin",s.i],n);if(Array.isArray(s.item)&&typeof s.item[0]==="string")a=g(a,["plugin",s.i,0],r);let l=u.map((i)=>i.i).filter((i)=>i!==s.i).sort((i,p)=>p-i);for(let i of l)a=g(a,["plugin",i],void 0);return{mode:"replace",text:a}}async function gt(t,e=$){let r=await e.resolve(t).then((n)=>({ok:!0,item:n}),(n)=>({ok:!1,error:n}));if(!r.ok)return{ok:!1,code:"install_failed",error:r.error};return{ok:!0,target:r.item}}async function dt(t){let e=await M(t).then((n)=>({ok:!0,item:n}),(n)=>({ok:!1,error:n}));if(!e.ok)return{ok:!1,code:"manifest_read_failed",file:t,error:e.error};let r=await Promise.resolve().then(()=>Y(e.item)).then((n)=>({ok:!0,item:n}),(n)=>({ok:!1,error:n}));if(!r.ok)return{ok:!1,code:"manifest_read_failed",file:e.item.pkg,error:r.error};if(!r.item.length)return{ok:!1,code:"manifest_no_targets",file:e.item.pkg};return{ok:!0,targets:r.item}}function tt(t){if(t.global)return t.config??I.Path.config;let r=t.vcs==="git"&&t.worktree!=="/"?t.worktree:t.directory;return P.join(r,".qitqode")}function et(t){if(t==="server")return"qitqode";return"tui"}async function rt(t,e,r,n,o){let x=[];try{let c=et(e.kind);const S=T(x,await b.acquire(`plug-config:${d.resolve(P.join(t,c))}`),1);let u=o.files(t,c);let s=u[0];for(let f of u){if(!await o.exists(f))continue;s=f;break}let a=await o.readText(s).catch((f)=>{if(f.code==="ENOENT")return"{}";return f});if(a instanceof Error)return{ok:!1,code:"patch_failed",kind:e.kind,error:a};let l=a.trim()?a:"{}";let i=[];let p=j(l,i,{allowTrailingComma:!0});if(i.length){let f=i[0],h=l.substring(0,f.offset).split(`
|
|
3
3
|
`);return{ok:!1,code:"invalid_json",kind:e.kind,file:s,line:h.length,col:h[h.length-1].length+1,parse:R(f.error)}}let N=H(p);let F=e.opts?[r,e.opts]:r;let k=Z(l,N,r,F,n);if(k.mode==="noop")return{ok:!0,item:{kind:e.kind,mode:k.mode,file:s}};let w=await o.write(s,k.text).catch((f)=>f);if(w instanceof Error)return{ok:!1,code:"patch_failed",kind:e.kind,error:w};return{ok:!0,item:{kind:e.kind,mode:k.mode,file:s}}}catch(J){var B=J,L=1}finally{var W=_(x,B,L);W&&await W}}async function mt(t,e=G){let r=tt(t),n=[];for(let o of t.targets){let c=await rt(r,o,t.spec,Boolean(t.force),e);if(!c.ok)return{...c,dir:r};n.push(c.item)}return{ok:!0,dir:r,items:n}}
|
|
4
4
|
export{pt as p,z as q,gt as r,dt as s,mt as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{eh as r}from"./chunk-
|
|
2
|
+
import{eh as r}from"./chunk-1acn5me8.js";import{Nj as e}from"./chunk-k1qd8ecm.js";import{_l as t}from"./chunk-rdreeyv0.js";import{Pn as l}from"./chunk-ydgst3h8.js";import{mt as a}from"./chunk-6p6m5956.js";import{UN as o}from"./chunk-g7v6sp3c.js";var S={PromptAppend:t.define("tui.prompt.append",a.object({text:a.string()})),CommandExecute:t.define("tui.command.execute",a.object({command:a.union([a.enum(["session.list","session.new","session.share","session.interrupt","session.compact","session.page.up","session.page.down","session.line.up","session.line.down","session.half.page.up","session.half.page.down","session.first","session.last","prompt.clear","prompt.submit","agent.cycle"]),a.string()])})),ToastShow:t.define("tui.toast.show",a.object({title:a.string().optional(),message:a.string(),variant:a.enum(["info","success","warning","error"]),duration:a.number().default(5000).optional().describe("Duration in milliseconds")})),SessionSelect:t.define("tui.session.select",a.object({sessionID:e.zod.describe("Session ID to navigate to")})),InstructionsLoaded:r};class m extends o.Class("ConsoleState")({consoleManagedProviders:o.mutable(o.Array(o.String)),activeOrgName:o.optional(o.String),switchableOrgCount:o.Number}){static zod=l(this)}var f=m.make({consoleManagedProviders:[],activeOrgName:void 0,switchableOrgCount:0});
|
|
3
3
|
export{S as Ag,m as Bg,f as Cg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X as s,Y as t,_ as a}from"./chunk-nr2j8ytn.js";import{$ as o}from"./chunk-4pmvxnkj.js";import{Qd as i}from"./chunk-
|
|
2
|
+
import{X as s,Y as t,_ as a}from"./chunk-nr2j8ytn.js";import{$ as o}from"./chunk-4pmvxnkj.js";import{Qd as i}from"./chunk-vkkz40je.js";import{be as n}from"./chunk-f4mnp6xd.js";import{eg as J}from"./chunk-bwadggys.js";import{lg as f}from"./chunk-7r92d7v9.js";import"./chunk-0s4cp6q2.js";import"./chunk-mrq35ftw.js";import"./chunk-nsp1za8t.js";import"./chunk-brk6bge4.js";import"./chunk-nfg7nt13.js";import"./chunk-qgkb6n8k.js";import"./chunk-dcv6wj9x.js";import{Ch as p,rh as l}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{Uk as g}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import{bo as b}from"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import{Fr as d}from"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import{Os as I,Xs as D}from"./chunk-59csnjc3.js";import{gt as x}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";import q from"path";import{pathToFileURL as Kj}from"url";import{EOL as T}from"os";function G(j){let M=j.state;return{input:M.input,metadata:"metadata"in M?M.metadata:{},part:j}}function z(j){let M=j.description?J.Style.TEXT_DIM+` ${j.description}`+J.Style.TEXT_NORMAL:"";J.println(J.Style.TEXT_NORMAL+j.icon,J.Style.TEXT_NORMAL+j.title+M)}function h(j,M){if(J.empty(),z(j),!M?.trim())return;J.println(M),J.empty()}function u(j){let M=j.state,X="input"in M?M.input:void 0,Z=("title"in M&&M.title?M.title:void 0)||(X&&typeof X==="object"&&Object.keys(X).length>0?JSON.stringify(X):"Unknown");z({icon:"\u2699",title:`${j.tool} ${Z}`})}function e(j){let M=j.path??"",X=`${j.kind} "${j.pattern}"`,Z=M?`in ${E(M)}`:"",H=j.count===void 0?Z:`${Z}${Z?" \xB7 ":""}${j.count} ${j.count===1?"match":"matches"}`;z({icon:"\u2731",title:X,...H&&{description:H}})}function Mj(j){e({kind:"Glob",pattern:j.input.pattern,path:j.input.path,count:j.metadata.count})}function Nj(j){e({kind:"Grep",pattern:j.input.pattern,path:j.input.path,count:j.metadata.matches})}function Vj(j){let M=E(j.input.filePath),X=Object.entries(j.input).filter(([H,C])=>{if(H==="filePath")return!1;return typeof C==="string"||typeof C==="number"||typeof C==="boolean"}),Z=X.length?`[${X.map(([H,C])=>`${H}=${C}`).join(", ")}]`:void 0;z({icon:"\u2192",title:`Read ${M}`,...Z&&{description:Z}})}function Xj(j){h({icon:"\u2190",title:`Write ${E(j.input.filePath)}`},j.part.state.status==="completed"?j.part.state.output:void 0)}function Yj(j){z({icon:"%",title:`WebFetch ${j.input.url}`})}function Zj(j){let M=E(j.input.filePath),X=j.metadata.diff;h({icon:"\u2190",title:`Edit ${M}`},X)}function _j(j){z({icon:"\u25C7",title:`Exa Code Search "${j.input.query}"`})}function $j(j){z({icon:"\u25C8",title:`Web Search "${j.input.query}"`})}function c(j){let M=j.part.state.input?.operation??j.part.state.input,X=j.part.state.status,Z=typeof M?.subagent_type==="string"&&M.subagent_type.trim().length>0?M.subagent_type:"unknown",H=d.titlecase(Z),C=typeof M?.description==="string"&&M.description.trim().length>0?M.description:void 0,w=X==="error"?"\u2717":X==="running"?"\u2022":"\u2713",L=C??`${H} Task`;z({icon:w,title:L,description:C?`${H} Agent`:void 0})}function Gj(j){z({icon:"\u2192",title:`Skill "${j.input.name}"`})}function Hj(j){let M=j.part.state.status==="completed"?j.part.state.output?.trim():void 0;h({icon:"$",title:`${j.input.command}`},M)}function E(j){if(!j)return"";if(q.isAbsolute(j))return q.relative(process.cwd(),j)||".";return j}var Dj=n({command:"run [message..]",describe:"run qitqode with a message",builder:(j)=>{return j.positional("message",{describe:"message to send",type:"string",array:!0,default:[]}).option("command",{describe:"the command to run, use message for args",type:"string"}).option("continue",{alias:["c"],describe:"continue the last session",type:"boolean"}).option("session",{alias:["s"],describe:"session id to continue",type:"string"}).option("fork",{describe:"fork the session before continuing (requires --continue or --session)",type:"boolean"}).option("share",{type:"boolean",describe:"share the session"}).option("model",{type:"string",alias:["m"],describe:"model to use in the format of provider/model"}).option("agent",{type:"string",describe:"agent to use"}).option("format",{type:"string",choices:["default","json"],default:"default",describe:"format: default (formatted) or json (raw JSON events)"}).option("file",{alias:["f"],type:"string",array:!0,describe:"file(s) to attach to message"}).option("title",{type:"string",describe:"title for the session (uses truncated prompt if no value provided)"}).option("attach",{type:"string",describe:"attach to a running qitqode server (e.g., http://localhost:4096)"}).option("password",{alias:["p"],type:"string",describe:"basic auth password (defaults to QITQODE_SERVER_PASSWORD)"}).option("dir",{type:"string",describe:"directory to run in, path on remote server if attaching"}).option("port",{type:"number",describe:"port for the local server (defaults to random port if no value provided)"}).option("variant",{type:"string",describe:"model variant (provider-specific reasoning effort, e.g., high, max, minimal)"}).option("thinking",{type:"boolean",describe:"show thinking blocks",default:!1}).option("dangerously-skip-permissions",{type:"boolean",describe:"auto-approve permissions that are not explicitly denied (dangerous!)",default:!1})},handler:async(j)=>{let M=[...j.message,...j["--"]||[]].join(" "),X=(()=>{if(!j.dir)return;if(j.attach)return j.dir;try{return process.chdir(j.dir),process.cwd()}catch{J.error("Failed to change directory to "+j.dir),process.exit(1)}})(),Z=[];if(j.file){let N=Array.isArray(j.file)?j.file:[j.file];for(let Y of N){let V=q.resolve(process.cwd(),Y);if(!await x.exists(V))J.error(`File not found: ${Y}`),process.exit(1);let W=await x.isDir(V)?"application/x-directory":"text/plain";Z.push({type:"file",url:Kj(V).href,filename:q.basename(V),mime:W})}}if(!process.stdin.isTTY)M+=`
|
|
3
3
|
`+await Bun.stdin.text();if(M.trim().length===0&&!j.command)J.error("You must provide a message or a command"),process.exit(1);if(j.fork&&!j.continue&&!j.session)J.error("--fork requires --continue or --session"),process.exit(1);let H=[{permission:"question",action:"deny",pattern:"*"},{permission:"plan_enter",action:"deny",pattern:"*"},{permission:"plan_exit",action:"deny",pattern:"*"}];function C(){if(j.title===void 0)return;if(j.title!=="")return j.title;return M.slice(0,50)+(M.length>50?"...":"")}async function w(N){let Y=j.continue?(await N.session.list()).data?.find((_)=>!_.parentID)?.id:j.session;if(Y&&j.fork)return(await N.session.fork({sessionID:Y})).data?.id;if(Y)return Y;let V=C();return(await N.session.create({title:V,permission:H})).data?.id}async function L(N,Y){let V=await N.config.get();if(!V.data)return;if(V.data.share!=="auto"&&!I.QITQODE_AUTO_SHARE&&!j.share)return;let W=await N.session.share({sessionID:Y}).catch((_)=>{if(_ instanceof Error&&_.message.includes("disabled"))J.println(J.Style.TEXT_DANGER_BOLD+"! "+_.message);return{error:_}});if(!W.error&&"data"in W&&W.data?.share?.url)J.println(J.Style.TEXT_INFO_BOLD+"~ "+W.data.share.url)}async function v(N){function Y(B){try{if(B.tool==="bash")return Hj(G(B));if(B.tool==="glob")return Mj(G(B));if(B.tool==="grep")return Nj(G(B));if(B.tool==="read")return Vj(G(B));if(B.tool==="write")return Xj(G(B));if(B.tool==="webfetch")return Yj(G(B));if(B.tool==="edit")return Zj(G(B));if(B.tool==="codesearch")return _j(G(B));if(B.tool==="websearch")return $j(G(B));if(B.tool==="actor")return c(G(B));if(B.tool==="skill")return Gj(G(B));return u(B)}catch{return u(B)}}function V(B,F){if(j.format==="json")return process.stdout.write(JSON.stringify({type:B,timestamp:Date.now(),sessionID:S,...F})+T),!0;return!1}let W=await N.event.subscribe(),_;async function r(B,F){let A=new Map,Q=D.create({service:"cli.run"}),O=W.stream[Symbol.asyncIterator](),Jj=B.completion.then(()=>"DONE");try{while(!0){let y=await Promise.race([O.next(),Jj]);if(y==="DONE")break;if(y.done)break;let $=y.value;if(F.onEvent($),B.onEvent($),Q.debug("event received",{type:$.type}),$.type==="message.updated"&&$.properties.info.role==="assistant"&&j.format!=="json"&&A.get("start")!==!0)J.empty(),J.println(`> ${$.properties.info.agent} \xB7 ${$.properties.info.modelID}`),J.empty(),A.set("start",!0);if($.type==="message.part.updated"){let K=$.properties.part;if(K.sessionID!==S)continue;if(K.type==="tool"&&(K.state.status==="completed"||K.state.status==="error")){if(V("tool_use",{part:K}))continue;if(K.state.status==="completed"){Y(K);continue}z({icon:"\u2717",title:`${K.tool} failed`}),J.error(K.state.error)}if(K.type==="tool"&&K.tool==="actor"&&K.state.status==="running"&&j.format!=="json"){if(A.get(K.id)===!0)continue;c(G(K)),A.set(K.id,!0)}if(K.type==="step-start"){if(V("step_start",{part:K}))continue}if(K.type==="step-finish"){if(V("step_finish",{part:K}))continue}if(K.type==="text"&&K.time?.end){if(V("text",{part:K}))continue;let R=K.text.trim();if(!R)continue;if(!process.stdout.isTTY){process.stdout.write(R+T);continue}J.empty(),J.println(R),J.empty()}if(K.type==="reasoning"&&K.time?.end&&j.thinking){if(V("reasoning",{part:K}))continue;let R=K.text.trim();if(!R)continue;let k=`Thinking: ${R}`;if(process.stdout.isTTY){J.empty(),J.println(`${J.Style.TEXT_DIM}\x1B[3m${k}\x1B[0m${J.Style.TEXT_NORMAL}`),J.empty();continue}process.stdout.write(k+T)}}if($.type==="session.error"){let K=$.properties;if(K.sessionID!==S||!K.error)continue;let R=String(K.error.name);if("data"in K.error&&K.error.data&&"message"in K.error.data)R=String(K.error.data.message);if(_=_?_+T+R:R,V("error",{error:K.error}))continue;J.error(R)}if($.type==="permission.asked"){let K=$.properties;if(K.sessionID!==S)continue;if(j["dangerously-skip-permissions"])await N.permission.reply({requestID:K.id,reply:"once"});else J.println(J.Style.TEXT_WARNING_BOLD+"!",J.Style.TEXT_NORMAL+`permission requested: ${K.permission} (${K.patterns.join(", ")}); auto-rejecting`),await N.permission.reply({requestID:K.id,reply:"reject"})}}}finally{F.fail(Error("QitQode event stream closed before connecting")),B.stop(),await O.return?.(void 0).catch(()=>{})}}let jj=await(async()=>{if(!j.agent)return;let B=j.agent;if(j.attach){let A=await N.app.agents(void 0,{throwOnError:!0}).then((O)=>O.data??[]).catch(()=>{return});if(!A){J.println(J.Style.TEXT_WARNING_BOLD+"!",J.Style.TEXT_NORMAL,`failed to list agents from ${j.attach}. Falling back to default agent`);return}let Q=A.find((O)=>O.name===B);if(!Q){J.println(J.Style.TEXT_WARNING_BOLD+"!",J.Style.TEXT_NORMAL,`agent "${B}" not found. Falling back to default agent`);return}if(Q.mode==="subagent"){J.println(J.Style.TEXT_WARNING_BOLD+"!",J.Style.TEXT_NORMAL,`agent "${B}" is a subagent, not a primary agent. Falling back to default agent`);return}return B}let F=await p.runPromise(l.Service.use((A)=>A.get(B)));if(!F){J.println(J.Style.TEXT_WARNING_BOLD+"!",J.Style.TEXT_NORMAL,`agent "${B}" not found. Falling back to default agent`);return}if(F.mode==="subagent"){J.println(J.Style.TEXT_WARNING_BOLD+"!",J.Style.TEXT_NORMAL,`agent "${B}" is a subagent, not a primary agent. Falling back to default agent`);return}return B})(),m=a(jj),S=await w(N);if(!S)J.error("Session not found"),process.exit(1);await L(N,S);let Bj=D.create({service:"cli.run.poll"}),P=t({sessionID:S,query:async()=>{try{return(await N.session.status()).data?.[S]}catch(B){throw Bj.debug("session.status query failed",{error:B}),B}}}),U=s();r(P,U).catch((B)=>{console.error(B),process.exit(1)});try{await U.wait()}catch(B){throw P.stop(),B}if(j.command)await N.session.command({sessionID:S,agent:m,model:j.model,command:j.command,arguments:M,variant:j.variant});else{let B=j.model?g.parseModel(j.model):void 0;await N.session.prompt({sessionID:S,agent:m,model:B,variant:j.variant,parts:[...Z,{type:"text",text:M}]})}P.markStarted()}if(j.attach){let N=o({password:j.password}),Y=b({baseUrl:j.attach,directory:X,headers:N});return await v(Y)}await i(process.cwd(),async()=>{let Y=b({baseUrl:"http://qitqode.internal",fetch:async(V,W)=>{let _=new Request(V,W);return f.Default().app.fetch(_)}});await v(Y)})}});export{Dj as RunCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{lg as E}from"./chunk-
|
|
2
|
+
import{lg as E}from"./chunk-7r92d7v9.js";import"./chunk-0s4cp6q2.js";import"./chunk-mrq35ftw.js";import"./chunk-nsp1za8t.js";import"./chunk-brk6bge4.js";import"./chunk-nfg7nt13.js";import"./chunk-qgkb6n8k.js";import"./chunk-dcv6wj9x.js";import"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import{xO as z}from"./chunk-e0vrxetq.js";var J={command:"generate",handler:async()=>{let A=await E.openapi();for(let q of Object.values(A.paths))for(let y of["get","post","put","delete","patch"]){let k=q[y];if(!k?.operationId)continue;k["x-codeSamples"]=[{lang:"js",source:['import { createQitQodeClient } from "@qitqode/sdk"',"","const client = createQitQodeClient()",`await client.${k.operationId}({`," ...","})"].join(`
|
|
3
3
|
`)}]}let F=JSON.stringify(A,null,2),B=await import("./chunk-cfwz1hgr.js"),C=await import("./chunk-5wx962mw.js"),D=await import("./chunk-2vaphpz0.js"),G=await(B.format??B.default?.format)(F,{parser:"json",plugins:[C.default??C,D.default??D],printWidth:120});await new Promise((q,y)=>{process.stdout.write(G,(k)=>{if(k)y(k);else q()})})}};export{J as GenerateCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$d as J,Rd as y,Td as T,Ud as t,Vd as O,Wd as l,Yd as v,Zd as Q,_d as X}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{be as w}from"./chunk-f4mnp6xd.js";import{eg as f}from"./chunk-bwadggys.js";import{Ch as q,Sg as Y,Tg as mt,Ug as pt,Vg as st,Wg as et,Xg as ft,Yg as E,kh as Mt}from"./chunk-
|
|
2
|
+
import{$d as J,Rd as y,Td as T,Ud as t,Vd as O,Wd as l,Yd as v,Zd as Q,_d as X}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{be as w}from"./chunk-f4mnp6xd.js";import{eg as f}from"./chunk-bwadggys.js";import{Ch as q,Sg as Y,Tg as mt,Ug as pt,Vg as st,Wg as et,Xg as ft,Yg as E,kh as Mt}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{Ej as L,el as F,xj as nt}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import{Ol as $}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import{mn as P,nn as h}from"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import{es as g}from"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import{gt as D,lt as A}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import{fH as a}from"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import{tO as ut}from"./chunk-e0vrxetq.js";import W from"path";function G(o){switch(o){case"authenticated":return"\u2713";case"expired":return"\u26A0";case"not_authenticated":return"\u2717"}}function H(o){switch(o){case"authenticated":return"authenticated";case"expired":return"expired";case"not_authenticated":return"not authenticated"}}function N(o){return typeof o==="object"&&o!==null&&"type"in o}function k(o){return N(o)&&o.type==="remote"}function B(o){return Object.entries(o.mcp??{}).filter((e)=>N(e[1]))}function U(o,e){let r=o.mcp_origins?.[e];if(!r)return"qitqode";let i=A.Path.home,m=r.source===i?"~":r.source.startsWith(i+W.sep)?"~"+r.source.slice(i.length):r.source;return`${r.type}:${m}`}function C(o){return B(o).filter((e)=>k(e[1])&&e[1].oauth!==!1)}async function I(){return q.runPromise(a.gen(function*(){let o=yield*F.Service,e=yield*E.Service,r=yield*o.get(),i=yield*e.status(),m=yield*a.all(Object.fromEntries(B(r).map(([p])=>[p,e.hasStoredTokens(p)])),{concurrency:"unbounded"});return{config:r,statuses:i,stored:m}}))}async function S(){return q.runPromise(a.gen(function*(){let o=yield*F.Service,e=yield*E.Service,r=yield*o.get(),i=yield*a.all(Object.fromEntries(C(r).map(([m])=>[m,e.getAuthStatus(m)])),{concurrency:"unbounded"});return{config:r,auth:i}}))}async function V(o,e=!1){let r=[W.join(o,"qitqode.json"),W.join(o,"qitqode.jsonc")];if(!e)r.push(W.join(o,".qitqode","qitqode.json"),W.join(o,".qitqode","qitqode.jsonc"));for(let i of r)if(await D.exists(i))return i;return r[0]}async function R(o,e,r){let i="{}";if(await D.exists(r))i=await D.readText(r);let m=P(i,["mcp",o],e,{formattingOptions:{tabSize:2,insertSpaces:!0}});return await D.write(r,h(i,m)),r}var tt=ut(Mt(),1);function yt(o){let e=tt.parse(o);if(!e.every((r)=>typeof r==="string"))throw Error("Shell operators are not supported; enter only the command and its arguments");if(e.length===0)throw Error("Command is required");return e}var ot=w({command:"add",describe:"add an MCP server",async handler(){await $.provide({directory:process.cwd(),async fn(){f.empty(),O("Add MCP server");let o=$.project,[e,r]=await Promise.all([V($.worktree),V(A.Path.config,!0)]),i=r;if(o.vcs==="git"){let c=await X({message:"Location",options:[{label:"Current project",value:e,hint:e},{label:"Global",value:r,hint:r}]});if(y(c))throw new f.CancelledError;i=c}let m=await J({message:"Enter MCP server name",validate:(c)=>c&&c.length>0?void 0:"Required"});if(y(m))throw new f.CancelledError;let p=await X({message:"Select MCP server type",options:[{label:"Local",value:"local",hint:"Run a local command"},{label:"Remote",value:"remote",hint:"Connect to a remote URL"}]});if(y(p))throw new f.CancelledError;if(p==="local"){let c=await J({message:"Enter command to run",placeholder:"e.g., qitqode x @modelcontextprotocol/server-filesystem",validate:(s)=>s&&s.length>0?void 0:"Required"});if(y(c))throw new f.CancelledError;let u;try{u=yt(c)}catch(s){t.error(s instanceof Error?s.message:"Invalid command"),l("MCP server was not added");return}await R(m,{type:"local",command:u},i),t.success(`MCP server "${m}" added to ${i}`),l("MCP server added successfully");return}if(p==="remote"){let c=await J({message:"Enter MCP server URL",placeholder:"e.g., https://example.com/mcp",validate:(s)=>{if(!s)return"Required";if(s.length===0)return"Required";return URL.canParse(s)?void 0:"Invalid URL"}});if(y(c))throw new f.CancelledError;let u=await T({message:"Does this server require OAuth authentication?",initialValue:!1});if(y(u))throw new f.CancelledError;let n;if(u){let s=await T({message:"Do you have a pre-registered client ID?",initialValue:!1});if(y(s))throw new f.CancelledError;if(s){let d=await J({message:"Enter client ID",validate:(j)=>j&&j.length>0?void 0:"Required"});if(y(d))throw new f.CancelledError;let M=await T({message:"Do you have a client secret?",initialValue:!1});if(y(M))throw new f.CancelledError;let _;if(M){let j=await v({message:"Enter client secret"});if(y(j))throw new f.CancelledError;_=j}n={type:"remote",url:c,oauth:{clientId:d,..._&&{clientSecret:_}}}}else n={type:"remote",url:c,oauth:{}}}else n={type:"remote",url:c,oauth:!1};await R(m,n,i),t.success(`MCP server "${m}" added to ${i}`)}l("MCP server added successfully")}})}});var it=w({command:"list",aliases:["ls"],describe:"list MCP servers and their status",async handler(){await $.provide({directory:process.cwd(),async fn(){f.empty(),O("MCP Servers");let{config:o,statuses:e,stored:r}=await I(),i=B(o);if(i.length===0){t.warn("No MCP servers configured"),l("Add servers with: qitqode mcp add");return}for(let[m,p]of i){let c=e[m],u=k(p)&&p.oauth!==!1,n=r[m],s,d,M="";if(!c)s="\u25CB",d="not initialized";else if(c.status==="connected"){if(s="\u2713",d="connected",u&&n)M=" (OAuth)"}else if(c.status==="disabled")s="\u25CB",d="disabled";else if(c.status==="pending")s="\u25CB",d="pending approval";else if(c.status==="needs_auth")s="\u26A0",d="needs authentication";else if(c.status==="needs_client_registration")s="\u2717",d="needs client registration",M=`
|
|
3
3
|
`+c.error;else s="\u2717",d="failed",M=`
|
|
4
4
|
`+c.error;let _=p.type==="remote"?L.redactString(p.url):L.redactCommand(p.command).join(" ");t.info(`${s} ${m} ${f.Style.TEXT_DIM}${d} ${U(o,m)}${M}
|
|
5
5
|
${f.Style.TEXT_DIM}${_}`)}l(`${i.length} server(s)`)}})}});var dt=w({command:"auth [name]",describe:"authenticate with an OAuth-enabled MCP server",builder:(o)=>o.positional("name",{describe:"name of the MCP server",type:"string"}).command(ct),async handler(o){await $.provide({directory:process.cwd(),async fn(){f.empty(),O("MCP OAuth Authentication");let{config:e,auth:r}=await S(),i=e.mcp??{},m=C(e);if(m.length===0){t.warn("No OAuth-capable MCP servers configured"),t.info("Remote MCP servers support OAuth by default. Add a remote server in qitqode.json:"),t.info(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dh as H}from"./chunk-vs3s49jw.js";import{Go as T,lo as k,mo as X,po as O,qo as b,ro as F,uo as h,vo as C}from"./chunk-
|
|
2
|
+
import{Dh as H}from"./chunk-vs3s49jw.js";import{Go as T,lo as k,mo as X,po as O,qo as b,ro as F,uo as h,vo as C}from"./chunk-4y9wbfd2.js";import w from"http";var B="/callback",U=[51737,51738],K=new Set;function _(f){return f.replace(/[&<>\"']/g,(y)=>{switch(y){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return"'"}})}function z(f){return`http://127.0.0.1:${f}${B}`}async function S(f){return new Promise((y,N)=>{let J=w.createServer();J.listen(f,"127.0.0.1",()=>{J.close(()=>y(f))}),J.on("error",N)})}async function E(){for(let f of U){if(K.has(f))continue;K.add(f);try{return await S(f)}catch{K.delete(f)}}throw new X(`Could not bind to any loopback port (tried ${U.join(", ")}). Free one of those ports and retry.`)}function R(f,y,N,J){return new Promise((Q,x)=>{let V=()=>K.delete(f),m=w.createServer(($,Y)=>{try{let Z=new URL($.url??"/",`http://localhost:${f}`);if(Z.pathname!==B){Y.writeHead(404),Y.end();return}let W=Z.searchParams.get("code"),D=Z.searchParams.get("state"),M=Z.searchParams.get("error"),q=Z.searchParams.get("error_description");if(M){let L=`${_(M)}${q?": "+_(q):""}`;Y.writeHead(200,{"Content-Type":"text/html"}),Y.end(`<html><body style="font-family:sans-serif;padding:2rem"><h2>Authorization failed</h2><p>${L}</p><p>You can close this tab.</p></body></html>`),m.close(),x(new X(`Authorization error: ${M}${q?" \u2014 "+q:""}`));return}if(!W||D!==y){Y.writeHead(400),Y.end("Invalid request");return}Y.writeHead(200,{"Content-Type":"text/html"}),Y.end('<html><body style="font-family:sans-serif;padding:2rem"><h2>Signed in! You can close this tab.</h2><p>Return to your terminal to continue.</p></body></html>'),m.close(),Q({code:W})}catch(Z){m.close(),x(Z)}});if(N?.aborted){V(),x(new X("Login cancelled"));return}let G=()=>{V(),m.close(()=>x(new X("Login cancelled")))};if(N?.addEventListener("abort",G,{once:!0}),N?.aborted){G();return}m.listen(f,"127.0.0.1",()=>{V(),J?.()}),m.on("error",($)=>{V(),x($)})})}function I(f,y){return new Promise((N,J)=>{if(y?.aborted){J(new X("Login cancelled"));return}let Q,x=()=>{clearTimeout(Q),y?.removeEventListener("abort",x),J(new X("Login cancelled"))};if(Q=setTimeout(()=>{y?.removeEventListener("abort",x),N()},f),y?.addEventListener("abort",x,{once:!0}),y?.aborted)x()})}function j(f,y=300000){if(!f)return!1;return Date.now()>=f-y}async function A(f){if(f.method==="api-key")return T({});let{issuer:y}=await k();return T({issuer:y,accessToken:f.key})}var d=300000;async function P(){let{issuer:f,clientId:y}=await k(),{verifier:N,challenge:J,state:Q}=O(),x=await E(),V=z(x),m=b({issuer:f,clientId:y,redirectUri:V,challenge:J,state:Q});return{issuer:f,clientId:y,verifier:N,port:x,redirectUri:V,authorizeStr:m,state:Q}}async function p(f){let{issuer:y,clientId:N}=await k(),{deviceCode:J,info:Q,intervalMs:x}=await h({issuer:y,clientId:N,signal:f.signal});if(f.onCode(Q),f.tryOpen){let m=Q.verificationUriComplete??Q.verificationUri;H(m)}let V=x;while(Date.now()<Q.expiresAt){await I(V,f.signal);let m=await C({issuer:y,clientId:N,deviceCode:J,currentIntervalMs:V,signal:f.signal});if(m.kind==="success")return m.profile;V=m.intervalMs}throw new X("The sign-in code expired before it was approved. Try again.")}async function g(){let{issuer:f,clientId:y,verifier:N,port:J,redirectUri:Q,authorizeStr:x,state:V}=await P();process.stdout.write(`
|
|
3
3
|
`),process.stdout.write(` Opening Forgewise sign-in in your browser...
|
|
4
4
|
`),process.stdout.write(" Sign-in URL: "+x+`
|
|
5
5
|
`),process.stdout.write(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ar as g,Cr as h,Dr as i,Er as j,Fr as k,Gr as l,Ir as m,Jr as n,yr as e,zr as f}from"./chunk-
|
|
2
|
+
import{Ar as g,Cr as h,Dr as i,Er as j,Fr as k,Gr as l,Ir as m,Jr as n,yr as e,zr as f}from"./chunk-rwwvy89t.js";import{Or as d}from"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import{zs as c}from"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import{Xs as b}from"./chunk-59csnjc3.js";import{gt as a}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-e0vrxetq.js";export{h as getEnvInfo,c as Wildcard,n as Token,m as Rpc,d as Process,b as Log,l as Lock,k as Locale,j as LocalContext,i as Keybind,a as Filesystem,g as EffectUtil,f as Color,e as Archive};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{es as X}from"./chunk-
|
|
2
|
+
import{es as X}from"./chunk-gswhjd1h.js";function D(j){return j.parserConfiguration({"populate--":!0}).scriptName("qitqode").wrap(100).help("help","show help").alias("help","h").version("version","show version number",X).alias("version","v").option("print-logs",{describe:"print logs to stderr",type:"boolean"}).option("log-level",{describe:"log level",type:"string",choices:["DEBUG","INFO","WARN","ERROR"]}).option("pure",{describe:"run without external plugins",type:"boolean"})}var H={port:{type:"number",describe:"port to listen on",default:0},hostname:{type:"string",describe:"hostname to listen on",default:"127.0.0.1"},mdns:{type:"boolean",describe:"enable mDNS service discovery (defaults hostname to 0.0.0.0)",default:!1},"mdns-domain":{type:"string",describe:"custom domain name for mDNS service (default: qitqode.local)",default:"qitqode.local"},cors:{type:"string",array:!0,describe:"additional domains to allow for CORS",default:[]},"no-auth":{type:"boolean",describe:"allow starting without authentication on non-loopback addresses (DANGEROUS)",default:!1}};function u(j){return j.options(H)}function F(j,z=process.argv){return z.some((B)=>B===j||B.startsWith(`${j}=`))}function P(j,z=process.argv){return F("--port",z)||F("--hostname",z)||F("--mdns",z)||!!j.mdns||j.port!==0||j.hostname!=="127.0.0.1"}function _(j,z,B=process.argv){let J=F("--port",B),Z=F("--hostname",B),$=F("--mdns",B),q=F("--mdns-domain",B),K=$?j.mdns:z?.server?.mdns??j.mdns,M=q?j["mdns-domain"]:z?.server?.mdnsDomain??j["mdns-domain"],N=J?j.port:z?.server?.port??j.port,U=Z?j.hostname:K&&!z?.server?.hostname?"0.0.0.0":z?.server?.hostname??j.hostname,V=z?.server?.cors??[],Y=Array.isArray(j.cors)?j.cors:j.cors?[j.cors]:[],b=[...V,...Y],A=j["no-auth"];return{hostname:U,port:N,mdns:K,mdnsDomain:M,cors:b,noAuth:A}}var k={model:{type:"string",alias:["m"],describe:"model to use in the format of provider/model"},continue:{alias:["c"],describe:"continue the last session",type:"boolean"},session:{alias:["s"],type:"string",describe:"session id to continue"},fork:{type:"boolean",describe:"fork the session when continuing (use with --continue or --session)"},prompt:{type:"string",describe:"prompt to use"},agent:{type:"string",describe:"agent to use"},dark:{type:"boolean",describe:"start in dark theme (overrides saved theme preference for this launch)"},light:{type:"boolean",describe:"start in light theme (overrides saved theme preference for this launch)"},monochrome:{type:"boolean",describe:"start in monochrome accessible rendering \u2014 no color, plain terminal, screen-reader friendly"},headless:{type:"boolean",describe:"headless permissionless mode for AI subagent use \u2014 auto-approves all tool permissions, implies --never-ask"},fullauto:{type:"boolean",describe:"full-auto mode for the interactive TUI \u2014 never asks: starts in build mode, auto-decides questions and auto-approves every tool permission that is not explicitly denied by your config (dangerous!)"},"api-key":{type:"string",describe:"Qortex API key for non-interactive authentication in headless mode (can also be set via $QLEX_API_KEY)"},sso:{type:"boolean",describe:"sign in via SSO device-code flow before starting a headless session \u2014 prints a URL and code, waits for browser approval (requires --headless)"},free:{type:"boolean",describe:"start in Free tier (no cost) \u2014 shorthand for the Free model tier"},adaptive:{type:"boolean",describe:"start in Adaptive tier \u2014 shorthand for the Adaptive model tier"},fast:{type:"boolean",describe:"start in Fast tier \u2014 shorthand for the Fast model tier"},economical:{type:"boolean",describe:"start in Economical tier \u2014 shorthand for the Economical model tier"},maxInt:{type:"boolean",describe:"start in Max intelligence tier \u2014 shorthand for the Max intelligence model tier"},orchestrated:{type:"boolean",describe:"start in Orchestrated tier \u2014 shorthand for the Orchestrated model tier"}},L=36,W="\x1B[38;5;214m",I="\x1B[0;2m",Q="\x1B[0m";function G(j,z){let B=Math.round(j/100*L),J=`${"\u25A0".repeat(B)}${"\uFF65".repeat(L-B)}`;return`\r${W}${J} ${j.toString().padStart(3)}%${Q} ${I}${z}${Q}`}
|
|
3
3
|
export{D as Xf,H as Yf,u as Zf,P as _f,_ as $f,k as ag,G as bg};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rd as T,Td as q,Ud as N,Vd as w,Wd as X,Zd as D}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{eg as Q}from"./chunk-bwadggys.js";import{Ch as A}from"./chunk-
|
|
2
|
+
import{Rd as T,Td as q,Ud as N,Vd as w,Wd as X,Zd as D}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{eg as Q}from"./chunk-bwadggys.js";import{Ch as A}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import"./chunk-k1qd8ecm.js";import{gl as $}from"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import{Or as _}from"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import{gt as Y,lt as W}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";import V from"fs/promises";import L from"path";import R from"os";var g={command:"uninstall",describe:"uninstall qitqode and remove all related files",builder:(j)=>j.option("keep-config",{alias:"c",type:"boolean",describe:"keep configuration files",default:!1}).option("keep-data",{alias:"d",type:"boolean",describe:"keep session data and snapshots",default:!1}).option("dry-run",{type:"boolean",describe:"show what would be removed without removing",default:!1}).option("force",{alias:"f",type:"boolean",describe:"skip confirmation prompts",default:!1}),handler:async(j)=>{Q.empty(),Q.println(Q.logo(" ")),Q.empty(),w("Uninstall QitQode");let B=await A.runPromise($.Service.use((J)=>J.method()));N.info(`Installation method: ${B}`);let E=await v(j,B);if(await z(E,B),!j.force&&!j.dryRun){let J=await q({message:"Are you sure you want to uninstall?",initialValue:!1});if(!J||T(J)){X("Cancelled");return}}if(j.dryRun){N.warn("Dry run - no changes made"),X("Done");return}await G(B,E),X("Done")}};async function v(j,B){let E=[{path:W.Path.data,label:"Data",keep:j.keepData},{path:W.Path.cache,label:"Cache",keep:!1},{path:W.Path.config,label:"Config",keep:j.keepConfig},{path:W.Path.state,label:"State",keep:!1}],J=B==="curl"?await P():null,H=B==="curl"?process.execPath:null;return{directories:E,shellConfig:J,binary:H}}async function z(j,B){N.message("The following will be removed:");for(let E of j.directories){if(!await V.access(E.path).then(()=>!0).catch(()=>!1))continue;let H=await F(E.path),K=S(H),O=E.keep?Q.Style.TEXT_DIM+"(keeping)":"",M=E.keep?"\u25CB":"\u2713";N.info(` ${M} ${E.label}: ${Z(E.path)} ${Q.Style.TEXT_DIM}(${K})${O}`)}if(j.binary)N.info(` \u2713 Binary: ${Z(j.binary)}`);if(j.shellConfig)N.info(` \u2713 Shell PATH in ${Z(j.shellConfig)}`);if(B!=="curl"&&B!=="unknown"){let E={npm:"npm uninstall -g @qitqode/cli",pnpm:"pnpm uninstall -g @qitqode/cli",bun:"bun remove -g @qitqode/cli"};N.info(` \u2713 Package: ${E[B]||B}`)}}async function G(j,B){let E=D(),J=[];for(let H of B.directories){if(H.keep){N.step(`Skipping ${H.label} (--keep-${H.label.toLowerCase()})`);continue}if(!await V.access(H.path).then(()=>!0).catch(()=>!1))continue;E.start(`Removing ${H.label}...`);let O=await V.rm(H.path,{recursive:!0,force:!0}).catch((M)=>M);if(O){E.stop(`Failed to remove ${H.label}`,1),J.push(`${H.label}: ${O.message}`);continue}E.stop(`Removed ${H.label}`)}if(B.shellConfig){E.start("Cleaning shell config...");let H=await k(B.shellConfig).catch((K)=>K);if(H)E.stop("Failed to clean shell config",1),J.push(`Shell config: ${H.message}`);else E.stop("Cleaned shell config")}if(j!=="curl"&&j!=="unknown"){let K={npm:["npm","uninstall","-g","@qitqode/cli"],pnpm:["pnpm","uninstall","-g","@qitqode/cli"],bun:["bun","remove","-g","@qitqode/cli"]}[j];if(K){E.start(`Running ${K.join(" ")}...`);let O=await _.run(K,{nothrow:!0});if(O.code!==0)E.stop(`Package manager uninstall failed: exit code ${O.code}`,1),N.warn(`You may need to run manually: ${K.join(" ")}`);else E.stop("Package removed")}else N.warn(`Uninstall not supported for method "${j}" yet, skipping package removal`)}if(j==="curl"&&B.binary){Q.empty(),N.message("To finish removing the binary, run:"),N.info(` rm "${B.binary}"`);let H=L.dirname(B.binary);if(H.includes(".qitqode"))N.info(` rmdir "${H}" 2>/dev/null`)}if(J.length>0){Q.empty(),N.warn("Some operations failed:");for(let H of J)N.error(` ${H}`)}Q.empty(),N.success("Thank you for using QitQode!")}async function P(){let j=L.basename(process.env.SHELL||"bash"),B=R.homedir(),E=process.env.XDG_CONFIG_HOME||L.join(B,".config"),J={fish:[L.join(E,"fish","config.fish")],zsh:[L.join(B,".zshrc"),L.join(B,".zshenv"),L.join(E,"zsh",".zshrc"),L.join(E,"zsh",".zshenv")],bash:[L.join(B,".bashrc"),L.join(B,".bash_profile"),L.join(B,".profile"),L.join(E,"bash",".bashrc"),L.join(E,"bash",".bash_profile")],ash:[L.join(B,".ashrc"),L.join(B,".profile")],sh:[L.join(B,".profile")]},H=J[j]||J.bash;for(let K of H){if(!await V.access(K).then(()=>!0).catch(()=>!1))continue;let M=await Y.readText(K).catch(()=>"");if(M.includes("# qitqode")||M.includes(".qitqode/bin"))return K}return null}async function k(j){let E=(await Y.readText(j)).split(`
|
|
3
3
|
`),J=[],H=!1;for(let O of E){let M=O.trim();if(M==="# qitqode"){H=!0;continue}if(H){if(H=!1,M.includes(".qitqode/bin")||M.includes("fish_add_path"))continue}if(M.startsWith("export PATH=")&&M.includes(".qitqode/bin")||M.startsWith("fish_add_path")&&M.includes(".qitqode"))continue;J.push(O)}while(J.length>0&&J[J.length-1].trim()==="")J.pop();let K=J.join(`
|
|
4
4
|
`)+`
|
|
5
5
|
`;await Y.write(j,K)}async function F(j){let B=0,E=async(J)=>{let H=await V.readdir(J,{withFileTypes:!0}).catch(()=>[]);for(let K of H){let O=L.join(J,K.name);if(K.isDirectory()){await E(O);continue}if(K.isFile()){let M=await V.stat(O).catch(()=>null);if(M)B+=M.size}}};return await E(j),B}function S(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;if(j<1073741824)return`${(j/1048576).toFixed(1)} MB`;return`${(j/1073741824).toFixed(1)} GB`}function Z(j){let B=R.homedir();if(j===B||j.startsWith(B+L.sep))return"~"+j.slice(B.length);return j}export{g as UninstallCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Qn as G$}from"./chunk-6tqbnxar.js";import{Kr as A$}from"./chunk-z0kbyr00.js";import{Pr as k$}from"./chunk-sbjymf20.js";import{$s as CZ,Ys as Y$,Zs as U$,at as KZ}from"./chunk-1bxfzd6r.js";import{mt as SZ}from"./chunk-6p6m5956.js";import{CA as rZ,CE as RZ,CF as h,CJ as X$,DA as sZ,DF as K$,Ez as a,FF as c,FG as EZ,GF as vZ,HJ as JZ,KJ as fZ,LJ as iZ,MH as YZ,ND as Z$,PH as V$,PJ as PZ,QF as IZ,QJ as lZ,SI as d,TF as zZ,TG as p,UD as $$,UI as m,UJ as cZ,VD as E,XD as WZ,Xz as L,YD as q$,YJ as v,Yz as eZ,_J as B$,_z as ZZ,aA as oZ,fH as P,gK as F$,iF as $Z,jF as LZ,kF as qZ,kG as xZ,lF as f,lG as Q$,lJ as DZ,nB as gZ,nF as jZ,pF as D$,pJ as C,qF as i,tF as J$,wF as o,xE as z$,xJ as r,yA as kZ,yF as l}from"./chunk-g7v6sp3c.js";import{tO as u$,vO as BZ,xO as h$}from"./chunk-e0vrxetq.js";var pZ={};BZ(pZ,{makeHandle:()=>AZ,make:()=>GZ,ProcessId:()=>UZ,ExitCode:()=>FZ,ChildProcessSpawner:()=>W});var FZ=YZ(),UZ=YZ(),hZ="~effect/ChildProcessSpawner/ChildProcessHandle",j$={[hZ]:hZ,...kZ,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},AZ=(Z)=>Object.assign(Object.create(j$),Z),GZ=(Z)=>{let q=(B,Q)=>Z(B).pipe(h((U)=>fZ(Q?.includeStderr===!0?U.all:U.stdout)),r),z=(B,Q)=>iZ(q(B,Q));return W.of({spawn:Z,exitCode:(B)=>xZ(o(Z(B),(Q)=>Q.exitCode)),streamString:q,streamLines:z,lines:(B,Q)=>lZ(z(B,Q)),string:(B,Q)=>cZ(q(B,Q))})};class W extends gZ()("effect/process/ChildProcessSpawner"){}var x={};BZ(x,{setEnv:()=>HZ,setCwd:()=>yZ,prefix:()=>C$,pipeTo:()=>P$,parseFdName:()=>g,make:()=>k,isStandardCommand:()=>I$,isPipedCommand:()=>E$,isCommand:()=>s,fdName:()=>NZ});var MZ="~effect/unstable/process/ChildProcess",aZ={...rZ,...sZ,[MZ]:MZ,asEffect(){return W.use((Z)=>Z.spawn(this))}},s=(Z)=>oZ(Z,MZ),I$=(Z)=>Z._tag==="StandardCommand",E$=(Z)=>Z._tag==="PipedCommand",I=(Z,q,z)=>Object.assign(Object.create(aZ),{_tag:"StandardCommand",command:Z,args:q,options:z}),e=(Z,q,z={})=>Object.assign(Object.create(aZ),{_tag:"PipedCommand",left:Z,right:q,options:z}),k=function(...q){if(OZ(q[0])){let[U,...A]=q,G=bZ(U,A);return I(G[0]??"",G.slice(1),{})}if(typeof q[0]==="object"&&!Array.isArray(q[0])&&!OZ(q[0])){let U=q[0];return function(A,...G){let b=bZ(A,G);return I(b[0]??"",b.slice(1),U)}}if(typeof q[0]==="string"&&!Array.isArray(q[1])){let[U,A={}]=q;return I(U,[],A)}let[z,B=[],Q={}]=q;return I(z,B,Q)},P$=a((Z)=>s(Z[0])&&s(Z[1]),(Z,q,z)=>e(Z,q,z??{})),C$=function(...q){if(s(q[0])&&q.length>1){let[B,...Q]=q,U=dZ(Q);return _Z(B,U)}let z=dZ(q);return(B)=>_Z(B,z)},dZ=(Z)=>{if(OZ(Z[0])){let[B,...Q]=Z,U=bZ(B,Q);return{command:U[0]??"",args:U.slice(1)}}let[q,z=[]]=Z;return{command:q,args:z}},_Z=(Z,q)=>{switch(Z._tag){case"StandardCommand":return I(q.command,[...q.args,Z.command,...Z.args],Z.options);case"PipedCommand":return e(_Z(Z.left,q),Z.right,Z.options)}},yZ=a(2,(Z,q)=>{switch(Z._tag){case"StandardCommand":return I(Z.command,Z.args,{...Z.options,cwd:q});case"PipedCommand":return e(yZ(Z.left,q),yZ(Z.right,q),Z.options)}}),HZ=a(2,(Z,q)=>{switch(Z._tag){case"StandardCommand":{let z=Z.options.env===void 0?q:{...Z.options.env,...q};return I(Z.command,Z.args,{...Z.options,env:z})}case"PipedCommand":return e(HZ(Z.left,q),HZ(Z.right,q),Z.options)}}),OZ=(Z)=>Array.isArray(Z)&&("raw"in Z)&&Array.isArray(Z.raw),g=(Z)=>{let q=/^fd(\d+)$/.exec(Z);if(q===null)return;let z=parseInt(q[1],10);return z>=3?z:void 0},NZ=(Z)=>`fd${Z}`,bZ=(Z,q)=>{let z=[];for(let[B,Q]of Z.entries())z=S$(Z,q,z,Q,B);return z},S$=(Z,q,z,B,Q)=>{let U=Z.raw[Q];if(U===void 0)throw Error(`Invalid backslash sequence: ${Z.raw[Q]}`);let{hasLeadingWhitespace:A,hasTrailingWhitespace:G,tokens:b}=w$(B,U),N=nZ(z,b,A);if(Q===q.length)return N;let S=q[Q],QZ=Array.isArray(S)?S.map((VZ)=>mZ(VZ)):[mZ(S)];return nZ(N,QZ,G)},mZ=(Z)=>{if(typeof Z==="string")return Z;return String(Z)},tZ=new Set([" ","\t","\r",`
|
|
3
3
|
`]),T$={x:3,u:5},w$=(Z,q)=>{if(q.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let z=tZ.has(q[0]),B=[],Q=0;for(let A=0,G=0;A<Z.length;A+=1,G+=1){let b=q[G];if(tZ.has(b)){if(Q!==A)B.push(Z.slice(Q,A));Q=A+1}else if(b==="\\"){let N=q[G+1];if(N===`
|
|
4
|
-
`)A-=1,G+=1;else if(N==="u"&&q[G+2]==="{")G=q.indexOf("}",G+3);else G+=T$[N]??1}}let U=Q===Z.length;if(!U)B.push(Z.slice(Q));return{tokens:B,hasLeadingWhitespace:z,hasTrailingWhitespace:U}},nZ=(Z,q,z)=>z||Z.length===0||q.length===0?[...Z,...q]:[...Z.slice(0,-1),`${Z.at(-1)}${q.at(0)}`,...q.slice(1)];var _$=u$(k$(),1);import*as M$ from"child_process";import{PassThrough as g$}from"stream";var R=(Z)=>Z instanceof globalThis.Error?Z:new globalThis.Error(String(Z)),x$=(Z)=>{switch(Z.code){case"ENOENT":return"NotFound";case"EACCES":return"PermissionDenied";case"EEXIST":return"AlreadyExists";case"EISDIR":return"BadResource";case"ENOTDIR":return"BadResource";case"EBUSY":return"Busy";case"ELOOP":return"BadResource";default:return"Unknown"}},y$=(Z)=>{let q=[],z=[],B=(A)=>{switch(A._tag){case"StandardCommand":q.push(A);return;case"PipedCommand":B(A.left),z.push(A.options),B(A.right);return}};if(B(Z),q.length===0)throw Error("flatten produced empty commands array");let[Q,...U]=q;return{commands:[Q,...U],opts:z}},O=(Z,q,z)=>{let B=y$(z).commands.map((Q)=>`${Q.command} ${Q.args.join(" ")}`).join(" | ");return V$({_tag:x$(q),module:"ChildProcess",method:Z,pathOrDescriptor:B,syscall:q.syscall,cause:q})},f$=D$(function*(){let Z=yield*B$,q=yield*F$,z=p(function*($){if(L($.cwd))return;return yield*Z.access($.cwd),q.resolve($.cwd)}),B=($)=>$.extendEnv?{...A$(),...$.env}:$.env,Q=($)=>DZ($)?"pipe":$,U=($)=>d($)?"pipe":$,A=($)=>{let D={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(L($.stdin))return D;if(typeof $.stdin==="string")return{...D,stream:$.stdin};if(DZ($.stdin))return{...D,stream:$.stdin};return{stream:$.stdin.stream,encoding:$.stdin.encoding??D.encoding,endOnDone:$.stdin.endOnDone??D.endOnDone}},G=($,D)=>{let J=$[D];if(L(J))return{stream:"pipe"};if(typeof J==="string")return{stream:J};if(d(J))return{stream:J};return{stream:J.stream}},b=($)=>{if(L($.additionalFds))return[];return Object.entries($.additionalFds).flatMap(([D,J])=>{let K=g(D);return L(K)?[]:[{fd:K,config:J}]}).toSorted((D,J)=>D.fd-J.fd)},N=($,D,J,K)=>{let X=(F)=>process.platform==="win32"&&F==="pipe"?"overlapped":F,Y=[X(Q($.stream)),X(U(D.stream)),X(U(J.stream))];if(K.length===0)return Y;let V=K.reduce((F,_)=>Math.max(F,_.fd),2);for(let F=3;F<=V;F++)Y[F]="ignore";for(let F of K)Y[F.fd]=X("pipe");return Y},S=p(function*($,D,J){if(J.length===0)return{getInputFd:()=>m,getOutputFd:()=>C};let K=new Map,X=new Map;for(let Y of J){let V=D.stdio[Y.fd];switch(Y.config.type){case"input":{let F=m;if(V&&"write"in V)F=CZ.fromWritable({evaluate:()=>V,onError:(_)=>O(`fromWritable(fd${Y.fd})`,R(_),$),endOnDone:!0});if(Y.config.stream)yield*EZ(PZ(Y.config.stream,F));K.set(Y.fd,F);break}case"output":{let F=C;if(V&&"read"in V){let _=new g$;V.on("error",(y)=>_.destroy(R(y))),V.pipe(_),F=KZ.fromReadable({evaluate:()=>_,onError:(y)=>O(`fromReadable(fd${Y.fd})`,R(y),$)})}if(Y.config.sink)F=JZ(F,Y.config.sink);X.set(Y.fd,F);break}}}return{getInputFd:(Y)=>K.get(Y)??m,getOutputFd:(Y)=>X.get(Y)??C}}),QZ=($,D,J)=>LZ(()=>{let K=m;if(ZZ(D.stdin))K=CZ.fromWritable({evaluate:()=>D.stdin,onError:(X)=>O("fromWritable(stdin)",R(X),$),endOnDone:J.endOnDone,encoding:J.encoding});if(DZ(J.stream))return K$(EZ(PZ(J.stream,K)),K);return $Z(K)}),VZ=($,D,J,K)=>{let X=D.stdout?KZ.fromReadable({evaluate:()=>D.stdout,onError:(V)=>O("fromReadable(stdout)",R(V),$)}):C,Y=D.stderr?KZ.fromReadable({evaluate:()=>D.stderr,onError:(V)=>O("fromReadable(stderr)",R(V),$)}):C;if(d(J.stream))X=JZ(X,J.stream);if(d(K.stream))Y=JZ(Y,K.stream);return{stdout:X,stderr:Y,all:X$(X,Y)}},b$=($,D)=>jZ((J)=>{let K=$$(),X=_$.default($.command,$.args,D),Y=!1,V;return X.on("error",(F)=>{J(i(O("spawn",F,$)))}),X.on("exit",(...F)=>{V=F}),X.on("close",(...F)=>{if(Y)return;Y=!0,q$(K,Z$(V??F))}),X.on("spawn",()=>{J($Z([X,K]))}),qZ(()=>{X.kill("SIGTERM")})}),XZ=($,D,J)=>{if(globalThis.process.platform==="win32")return jZ((K)=>{M$.exec(`taskkill /pid ${D.pid} /T /F`,{windowsHide:!0},(X)=>{if(X)return K(i(O("kill",R(X),$)));K(f)})});return J$({try:()=>{globalThis.process.kill(-D.pid,J)},catch:(K)=>O("kill",R(K),$)})},wZ=($,D,J)=>LZ(()=>{if(D.kill(J))return f;return i(O("kill",Error("Failed to kill child process"),$))}),N$=($,D,J)=>(K)=>{let X=J?.killSignal??"SIGTERM";if(L(J?.forceKillAfter))return K(D,$,X);return zZ(K(D,$,X),{duration:J.forceKillAfter,orElse:()=>K(D,$,"SIGKILL")})},W$=($,D)=>{let J=D??"stdout";switch(J){case"stdout":return $.stdout;case"stderr":return $.stderr;case"all":return $.all;default:{let K=g(J);return eZ(K)?$.getOutputFd(K):$.stdout}}},T=p(function*($){switch($._tag){case"StandardCommand":{let D=A($.options),J=G($.options,"stdout"),K=G($.options,"stderr"),X=b($.options),Y=yield*z($.options),[V,F]=yield*Q$(b$($,{cwd:Y,env:B($.options),stdio:N(D,J,K,X),detached:$.options.detached??process.platform!=="win32",shell:$.options.shell,windowsHide:process.platform==="win32"}),p(function*([M,H]){let t=yield*WZ(H),n=N$(M,$,$.options);if(t){let[u]=yield*E(H);if(process.platform==="win32")return yield*f;if(u!==0&&ZZ(u))return yield*IZ(n(XZ));return yield*f}let w=(u)=>vZ(XZ($,M,u),()=>wZ($,M,u)),R$=$.options.killSignal??"SIGTERM",uZ=w(R$).pipe(l(E(H)),c),L$=$.options.forceKillAfter?zZ(uZ,{duration:$.options.forceKillAfter,orElse:()=>w("SIGKILL").pipe(l(E(H)),c)}):uZ;return yield*IZ(L$)})),_=yield*S($,V,X),y=VZ($,V,J,K),j=!0;return AZ({pid:UZ(V.pid),stdin:yield*QZ($,V,D),stdout:y.stdout,stderr:y.stderr,all:y.all,getInputFd:_.getInputFd,getOutputFd:_.getOutputFd,isRunning:h(WZ(F),(M)=>!M),exitCode:o(E(F),([M,H])=>{if(ZZ(M))return $Z(FZ(M));return i(O("exitCode",Error(`Process interrupted due to receipt of signal: '${H}'`),$))}),kill:(M)=>{let H=M?.killSignal??"SIGTERM",t=(w)=>vZ(XZ($,V,w),()=>wZ($,V,w)),n=t(H).pipe(l(E(F)),c);if(!M?.forceKillAfter)return n;return zZ(n,{duration:M.forceKillAfter,orElse:()=>t("SIGKILL").pipe(l(E(F)),c)})},unref:qZ(()=>{if(j)V.unref(),j=!1;return qZ(()=>{if(!j)V.ref(),j=!0})})})}case"PipedCommand":{let D=y$($),[J,...K]=D.commands,X=T(J);for(let Y=0;Y<K.length;Y++){let V=K[Y],F=D.opts[Y]??{},_=A(V.options),y=r(h(X,(H)=>W$(H,F.from))),j=F.to??"stdin";if(j==="stdin"){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}let M=g(j);if(L(M)){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}X=T(k(V.command,V.args,{...V.options,additionalFds:{...V.options.additionalFds,[NZ(M)]:{type:"input",stream:y}}}))}return yield*X}}});return GZ(T)}),i$=z$(W,f$),l$=i$.pipe(RZ(Y$.layer),RZ(U$)),Bq=G$(async()=>{let{makeRuntime:Z}=await import("./chunk-
|
|
4
|
+
`)A-=1,G+=1;else if(N==="u"&&q[G+2]==="{")G=q.indexOf("}",G+3);else G+=T$[N]??1}}let U=Q===Z.length;if(!U)B.push(Z.slice(Q));return{tokens:B,hasLeadingWhitespace:z,hasTrailingWhitespace:U}},nZ=(Z,q,z)=>z||Z.length===0||q.length===0?[...Z,...q]:[...Z.slice(0,-1),`${Z.at(-1)}${q.at(0)}`,...q.slice(1)];var _$=u$(k$(),1);import*as M$ from"child_process";import{PassThrough as g$}from"stream";var R=(Z)=>Z instanceof globalThis.Error?Z:new globalThis.Error(String(Z)),x$=(Z)=>{switch(Z.code){case"ENOENT":return"NotFound";case"EACCES":return"PermissionDenied";case"EEXIST":return"AlreadyExists";case"EISDIR":return"BadResource";case"ENOTDIR":return"BadResource";case"EBUSY":return"Busy";case"ELOOP":return"BadResource";default:return"Unknown"}},y$=(Z)=>{let q=[],z=[],B=(A)=>{switch(A._tag){case"StandardCommand":q.push(A);return;case"PipedCommand":B(A.left),z.push(A.options),B(A.right);return}};if(B(Z),q.length===0)throw Error("flatten produced empty commands array");let[Q,...U]=q;return{commands:[Q,...U],opts:z}},O=(Z,q,z)=>{let B=y$(z).commands.map((Q)=>`${Q.command} ${Q.args.join(" ")}`).join(" | ");return V$({_tag:x$(q),module:"ChildProcess",method:Z,pathOrDescriptor:B,syscall:q.syscall,cause:q})},f$=D$(function*(){let Z=yield*B$,q=yield*F$,z=p(function*($){if(L($.cwd))return;return yield*Z.access($.cwd),q.resolve($.cwd)}),B=($)=>$.extendEnv?{...A$(),...$.env}:$.env,Q=($)=>DZ($)?"pipe":$,U=($)=>d($)?"pipe":$,A=($)=>{let D={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(L($.stdin))return D;if(typeof $.stdin==="string")return{...D,stream:$.stdin};if(DZ($.stdin))return{...D,stream:$.stdin};return{stream:$.stdin.stream,encoding:$.stdin.encoding??D.encoding,endOnDone:$.stdin.endOnDone??D.endOnDone}},G=($,D)=>{let J=$[D];if(L(J))return{stream:"pipe"};if(typeof J==="string")return{stream:J};if(d(J))return{stream:J};return{stream:J.stream}},b=($)=>{if(L($.additionalFds))return[];return Object.entries($.additionalFds).flatMap(([D,J])=>{let K=g(D);return L(K)?[]:[{fd:K,config:J}]}).toSorted((D,J)=>D.fd-J.fd)},N=($,D,J,K)=>{let X=(F)=>process.platform==="win32"&&F==="pipe"?"overlapped":F,Y=[X(Q($.stream)),X(U(D.stream)),X(U(J.stream))];if(K.length===0)return Y;let V=K.reduce((F,_)=>Math.max(F,_.fd),2);for(let F=3;F<=V;F++)Y[F]="ignore";for(let F of K)Y[F.fd]=X("pipe");return Y},S=p(function*($,D,J){if(J.length===0)return{getInputFd:()=>m,getOutputFd:()=>C};let K=new Map,X=new Map;for(let Y of J){let V=D.stdio[Y.fd];switch(Y.config.type){case"input":{let F=m;if(V&&"write"in V)F=CZ.fromWritable({evaluate:()=>V,onError:(_)=>O(`fromWritable(fd${Y.fd})`,R(_),$),endOnDone:!0});if(Y.config.stream)yield*EZ(PZ(Y.config.stream,F));K.set(Y.fd,F);break}case"output":{let F=C;if(V&&"read"in V){let _=new g$;V.on("error",(y)=>_.destroy(R(y))),V.pipe(_),F=KZ.fromReadable({evaluate:()=>_,onError:(y)=>O(`fromReadable(fd${Y.fd})`,R(y),$)})}if(Y.config.sink)F=JZ(F,Y.config.sink);X.set(Y.fd,F);break}}}return{getInputFd:(Y)=>K.get(Y)??m,getOutputFd:(Y)=>X.get(Y)??C}}),QZ=($,D,J)=>LZ(()=>{let K=m;if(ZZ(D.stdin))K=CZ.fromWritable({evaluate:()=>D.stdin,onError:(X)=>O("fromWritable(stdin)",R(X),$),endOnDone:J.endOnDone,encoding:J.encoding});if(DZ(J.stream))return K$(EZ(PZ(J.stream,K)),K);return $Z(K)}),VZ=($,D,J,K)=>{let X=D.stdout?KZ.fromReadable({evaluate:()=>D.stdout,onError:(V)=>O("fromReadable(stdout)",R(V),$)}):C,Y=D.stderr?KZ.fromReadable({evaluate:()=>D.stderr,onError:(V)=>O("fromReadable(stderr)",R(V),$)}):C;if(d(J.stream))X=JZ(X,J.stream);if(d(K.stream))Y=JZ(Y,K.stream);return{stdout:X,stderr:Y,all:X$(X,Y)}},b$=($,D)=>jZ((J)=>{let K=$$(),X=_$.default($.command,$.args,D),Y=!1,V;return X.on("error",(F)=>{J(i(O("spawn",F,$)))}),X.on("exit",(...F)=>{V=F}),X.on("close",(...F)=>{if(Y)return;Y=!0,q$(K,Z$(V??F))}),X.on("spawn",()=>{J($Z([X,K]))}),qZ(()=>{X.kill("SIGTERM")})}),XZ=($,D,J)=>{if(globalThis.process.platform==="win32")return jZ((K)=>{M$.exec(`taskkill /pid ${D.pid} /T /F`,{windowsHide:!0},(X)=>{if(X)return K(i(O("kill",R(X),$)));K(f)})});return J$({try:()=>{globalThis.process.kill(-D.pid,J)},catch:(K)=>O("kill",R(K),$)})},wZ=($,D,J)=>LZ(()=>{if(D.kill(J))return f;return i(O("kill",Error("Failed to kill child process"),$))}),N$=($,D,J)=>(K)=>{let X=J?.killSignal??"SIGTERM";if(L(J?.forceKillAfter))return K(D,$,X);return zZ(K(D,$,X),{duration:J.forceKillAfter,orElse:()=>K(D,$,"SIGKILL")})},W$=($,D)=>{let J=D??"stdout";switch(J){case"stdout":return $.stdout;case"stderr":return $.stderr;case"all":return $.all;default:{let K=g(J);return eZ(K)?$.getOutputFd(K):$.stdout}}},T=p(function*($){switch($._tag){case"StandardCommand":{let D=A($.options),J=G($.options,"stdout"),K=G($.options,"stderr"),X=b($.options),Y=yield*z($.options),[V,F]=yield*Q$(b$($,{cwd:Y,env:B($.options),stdio:N(D,J,K,X),detached:$.options.detached??process.platform!=="win32",shell:$.options.shell,windowsHide:process.platform==="win32"}),p(function*([M,H]){let t=yield*WZ(H),n=N$(M,$,$.options);if(t){let[u]=yield*E(H);if(process.platform==="win32")return yield*f;if(u!==0&&ZZ(u))return yield*IZ(n(XZ));return yield*f}let w=(u)=>vZ(XZ($,M,u),()=>wZ($,M,u)),R$=$.options.killSignal??"SIGTERM",uZ=w(R$).pipe(l(E(H)),c),L$=$.options.forceKillAfter?zZ(uZ,{duration:$.options.forceKillAfter,orElse:()=>w("SIGKILL").pipe(l(E(H)),c)}):uZ;return yield*IZ(L$)})),_=yield*S($,V,X),y=VZ($,V,J,K),j=!0;return AZ({pid:UZ(V.pid),stdin:yield*QZ($,V,D),stdout:y.stdout,stderr:y.stderr,all:y.all,getInputFd:_.getInputFd,getOutputFd:_.getOutputFd,isRunning:h(WZ(F),(M)=>!M),exitCode:o(E(F),([M,H])=>{if(ZZ(M))return $Z(FZ(M));return i(O("exitCode",Error(`Process interrupted due to receipt of signal: '${H}'`),$))}),kill:(M)=>{let H=M?.killSignal??"SIGTERM",t=(w)=>vZ(XZ($,V,w),()=>wZ($,V,w)),n=t(H).pipe(l(E(F)),c);if(!M?.forceKillAfter)return n;return zZ(n,{duration:M.forceKillAfter,orElse:()=>t("SIGKILL").pipe(l(E(F)),c)})},unref:qZ(()=>{if(j)V.unref(),j=!1;return qZ(()=>{if(!j)V.ref(),j=!0})})})}case"PipedCommand":{let D=y$($),[J,...K]=D.commands,X=T(J);for(let Y=0;Y<K.length;Y++){let V=K[Y],F=D.opts[Y]??{},_=A(V.options),y=r(h(X,(H)=>W$(H,F.from))),j=F.to??"stdin";if(j==="stdin"){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}let M=g(j);if(L(M)){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}X=T(k(V.command,V.args,{...V.options,additionalFds:{...V.options.additionalFds,[NZ(M)]:{type:"input",stream:y}}}))}return yield*X}}});return GZ(T)}),i$=z$(W,f$),l$=i$.pipe(RZ(Y$.layer),RZ(U$)),Bq=G$(async()=>{let{makeRuntime:Z}=await import("./chunk-m4g4djss.js");return Z(W,l$)});var H$=(Z,q)=>P.gen(function*(){let z=yield*Z.spawn(q),[B,Q]=yield*P.all([v.mkString(v.decodeText(z.stdout)),v.mkString(v.decodeText(z.stderr))],{concurrency:2});return{code:yield*z.exitCode,text:B,stderr:Q}}).pipe(P.scoped),Mq=H$,_q=(Z,q,z)=>H$(Z,x.make("git",q,{cwd:z?.cwd,extendEnv:!0,stdin:"ignore"}));var TZ={};BZ(TZ,{payloads:()=>p$,define:()=>c$,BusEvent:()=>TZ});var O$=new Map;function c$(Z,q){let z={type:Z,properties:q};return O$.set(Z,z),z}function p$(){return O$.entries().map(([Z,q])=>{return SZ.object({type:SZ.literal(Z),properties:q.properties}).meta({ref:`Event.${q.type}`})}).toArray()}
|
|
5
5
|
export{W as Tl,pZ as Ul,x as Vl,l$ as Wl,H$ as Xl,Mq as Yl,_q as Zl,TZ as _l};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h as _}from"./chunk-
|
|
2
|
+
import{h as _}from"./chunk-vd8cmdpv.js";import{F as W,G as Y,H as G}from"./chunk-vgt3artc.js";import{be as X}from"./chunk-f4mnp6xd.js";import{eg as j}from"./chunk-bwadggys.js";import{Fg as O}from"./chunk-nsp1za8t.js";import{Ch as v}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{yj as H}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import{Co as F,ho as K}from"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import{fH as z}from"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";var Q="forgewise";function R(D){return z.gen(function*(){let M=yield*D.get(Q);if(!M||M.type!=="api")return;return(M.metadata??{}).sub})}var w=()=>z.gen(function*(){if((yield*_())==="revoked")return null;let D=yield*z.promise(()=>K());if(!D)return yield*z.sync(()=>j.println(j.Style.TEXT_DANGER+"Not signed in to Forgewise. Run `qitqode auth login` first."+j.Style.TEXT_NORMAL)),null;let M=yield*H.Service,T=D.method==="sso"?yield*R(M):void 0;return{key:D.key,method:D.method,sub:T}}),b=()=>z.gen(function*(){let D=yield*w();if(!D)return;let M=yield*z.tryPromise({try:()=>O(D),catch:(P)=>P}).pipe(z.map((P)=>({ok:!0,result:P})),z.catch((P)=>z.succeed({ok:!1,error:P})));if(!M.ok){let P=M.error instanceof F?M.error.message:"Could not fetch balance.";yield*z.sync(()=>j.println(j.Style.TEXT_DANGER+P+j.Style.TEXT_NORMAL));return}let T=M.result;if(!T){yield*z.sync(()=>j.println(j.Style.TEXT_DANGER+"Could not fetch balance."+j.Style.TEXT_NORMAL));return}yield*z.sync(()=>j.println(j.Style.TEXT_SUCCESS+"Qredits balance: "+j.Style.TEXT_NORMAL+j.Style.TEXT_HIGHLIGHT_BOLD+G(T.balance)+j.Style.TEXT_NORMAL))}).pipe(z.withSpan("qredits.balance")),q=()=>z.gen(function*(){let D=yield*w();if(!D)return;let M=D.method==="sso"&&D.sub?{userId:D.sub,accessToken:D.key}:{},T=yield*z.tryPromise({try:()=>Y({...M,limit:20}),catch:(J)=>J}).pipe(z.map((J)=>({ok:!0,result:J})),z.catch((J)=>z.succeed({ok:!1,error:J})));if(!T.ok){let J=T.error,$=J instanceof F?J.message+"\nPer-session spend is available with `qitqode usage`.":J instanceof W?J.message:String(J);yield*z.sync(()=>j.println(j.Style.TEXT_DANGER+"Could not fetch history: "+$+j.Style.TEXT_NORMAL));return}let P=T.result;if(P.length===0){yield*z.sync(()=>j.println("No spend history yet."));return}let Z=j.Style.TEXT_DIM,V=j.Style.TEXT_NORMAL,x=j.Style.TEXT_DANGER;yield*z.sync(()=>{j.println(Z+" Date Description Amount"+V),j.println(Z+" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500"+V);for(let J of P){let $=(J.date||"").slice(0,10).padEnd(18),L=(J.description||"").slice(0,32).padEnd(32),N=(J.amount<0?"-":" ")+G(Math.abs(J.amount)),B=J.amount<0?x:V;j.println(` ${Z}${$}${V} ${L} ${B}${N}${V}`)}})}).pipe(z.withSpan("qredits.history")),m=X({command:"qredits <command>",describe:"Check Qredits balance and spend history",builder:(D)=>D.command(X({command:"balance",describe:"Show current Qredits balance",builder:(M)=>M,async handler(){j.empty(),await v.runPromise(b())}})).command(X({command:"history",describe:"Show recent Qredit spend history",builder:(M)=>M,async handler(){j.empty(),await v.runPromise(q())}})).demandCommand(),async handler(){}});export{q as historyEffect,b as balanceEffect,m as QreditsCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mr as x}from"./chunk-z0kbyr00.js";import{As as q,Bs as H,es as K,fs as j,ts as V}from"./chunk-
|
|
2
|
+
import{Mr as x}from"./chunk-z0kbyr00.js";import{As as q,Bs as H,es as K,fs as j,ts as V}from"./chunk-gswhjd1h.js";import{gt as M,lt as I}from"./chunk-1bxfzd6r.js";import{_D as v,fH as _}from"./chunk-g7v6sp3c.js";import{vO as a}from"./chunk-e0vrxetq.js";var U={};a(U,{validateArchiveMetadata:()=>P,validateArchiveEntries:()=>g,replaceDirectoryAtomically:()=>C,extractZip:()=>p,assertArchiveDestinationSafe:()=>T});import m from"path";import c from"fs/promises";function g(o,r){let n=m.resolve(r);for(let e of o){let t=e.trim().replaceAll("\\","/");if(!t)continue;if(t.includes("\x00")||m.posix.isAbsolute(t)||/^[a-z]:\//i.test(t))throw Error(`Unsafe archive entry: ${e}`);if(t.split("/").includes(".."))throw Error(`Unsafe archive entry: ${e}`);let s=m.resolve(n,...t.split("/"));if(s!==n&&!s.startsWith(`${n}${m.sep}`))throw Error(`Unsafe archive entry: ${e}`)}}function P(o){for(let r of o.split(/\r?\n/))if(/^[bclps]/.test(r))throw Error("Archive contains an unsafe special entry")}async function u(o){let r=await c.readdir(o,{withFileTypes:!0});await Promise.all(r.map(async(n)=>{let e=m.join(o,n.name);if(n.isSymbolicLink())throw Error(`Archive contains a symbolic link: ${n.name}`);if(n.isDirectory())await u(e)}))}async function b(o){return c.lstat(o).catch((r)=>{if(r.code==="ENOENT")return;throw r})}async function T(o){let r=m.resolve(o),n=m.parse(r),e=n.root;for(let t of r.slice(n.root.length).split(m.sep).filter(Boolean)){e=m.join(e,t);let s=await b(e);if(!s)return;if(s.isSymbolicLink())throw Error(`Archive destination contains a symbolic link: ${e}`)}}async function C(o,r){let n=m.resolve(r);await T(n);let e=await b(n);if(e&&!e.isDirectory())throw Error("Archive destination must be a directory");let t=m.join(m.dirname(n),`.qitqode-backup-${crypto.randomUUID()}`);if(e)await c.rename(n,t);try{await c.rename(o,n)}catch(s){if(e)await c.rename(t,n);throw s}if(e)await c.rm(t,{recursive:!0,force:!0})}async function p(o,r){let n=m.resolve(o),e=m.resolve(r),t=await x(process.platform==="win32"?["tar","-tf",n]:["unzip","-Z1",n]);g(t.stdout.toString().split(/\r?\n/),e);let s=await x(process.platform==="win32"?["tar","-tvf",n]:["unzip","-Z","-l",n]);P(s.stdout.toString()),await T(m.dirname(e)),await c.mkdir(m.dirname(e),{recursive:!0}),await T(m.dirname(e));let f=await c.mkdtemp(m.join(m.dirname(e),".qitqode-extract-"));try{if(process.platform==="win32"){let w=n.replace(/'/g,"''"),R=f.replace(/'/g,"''"),S=`$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${w}' -DestinationPath '${R}' -Force`;await x(["powershell","-NoProfile","-NonInteractive","-Command",S])}else await x(["unzip","-o","-q",n,"-d",f]);await u(f),await C(f,e)}finally{await c.rm(f,{recursive:!0,force:!0})}}var $={};a($,{isValidHex:()=>J,hexToRgb:()=>F,hexToAnsiBold:()=>y});function J(o){if(!o)return!1;return/^#[0-9a-fA-F]{6}$/.test(o)}function F(o){let r=parseInt(o.slice(1,3),16),n=parseInt(o.slice(3,5),16),e=parseInt(o.slice(5,7),16);return{r,g:n,b:e}}function y(o){if(!J(o))return;let{r,g:n,b:e}=F(o);return`\x1B[38;2;${r};${n};${e}m\x1B[1m`}var Q={};a(Q,{awaitDeferred:()=>k});function k(o,r){return _.ensuring(v.await(o),_.sync(r))}import d from"os";import oo from"path";var i;async function A(){if(i)return i;let o=oo.join(I.Path.data,"installation_id"),r=await M.readText(o).catch(()=>{return});if(r&&r.trim())return i=r.trim(),i;return i=crypto.randomUUID(),await M.write(o,i),i}function ro(){if(process.env.USER)return process.env.USER;if(process.env.USERNAME)return process.env.USERNAME;return d.userInfo().username}function no(){return Intl.DateTimeFormat().resolvedOptions().locale}function eo(){return Intl.DateTimeFormat().resolvedOptions().timeZone}async function to(){let o=d.cpus();return{os:{platform:d.platform(),arch:d.arch(),release:d.release(),hostname:d.hostname()},cpu:{model:o[0]?.model??"unknown",count:o.length},memory:{total_bytes:d.totalmem()},user:{username:ro(),homedir:d.homedir()},runtime:{bun_version:Bun.version,node_version:process.versions.node,pid:process.pid,timezone:eo(),locale:no()},paths:{cwd:process.cwd(),data:I.Path.data,config:I.Path.config},qitqode:{version:K,channel:j,installation_id:await A(),run_id:q,process_role:H}}}var W={};a(W,{toString:()=>mo,parse:()=>co,match:()=>so,fromParsedKey:()=>fo});function so(o,r){if(!o)return!1;let n={...o,super:o.super??!1},e={...r,super:r.super??!1};return V(n,e)}function fo(o,r=!1){return{name:o.name===" "?"space":o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??!1,leader:r}}function mo(o){if(!o)return"";let r=[];if(o.ctrl)r.push("ctrl");if(o.meta)r.push("alt");if(o.super)r.push("super");if(o.shift)r.push("shift");if(o.name)if(o.name==="delete")r.push("del");else r.push(o.name);let n=r.join("+");if(o.leader)n=n?`<leader> ${n}`:"<leader>";return n}function co(o){if(o==="none")return[];return o.split(",").map((r)=>{let e=r.replace(/<leader>/g,"leader+").toLowerCase().split("+"),t={ctrl:!1,meta:!1,shift:!1,leader:!1,name:""};for(let s of e)switch(s){case"ctrl":t.ctrl=!0;break;case"alt":case"meta":case"option":t.meta=!0;break;case"super":t.super=!0;break;case"shift":t.shift=!0;break;case"leader":t.leader=!0;break;case"esc":t.name="escape";break;default:t.name=s;break}return t})}var B={};a(B,{create:()=>io,NotFound:()=>O});import{AsyncLocalStorage as ao}from"async_hooks";class O extends Error{name;constructor(o){super(`No context found for ${o}`);this.name=o}}function io(o){let r=new ao;return{use(){let n=r.getStore();if(!n)throw new O(o);return n},provide(n,e){return r.run(n,e)}}}var X={};a(X,{truncateMiddle:()=>To,truncate:()=>Ro,todayTimeOrDateTime:()=>xo,titlecase:()=>wo,time:()=>N,pluralize:()=>Mo,number:()=>Io,duration:()=>Eo,datetime:()=>G});function wo(o){return o.replace(/\b\w/g,(r)=>r.toUpperCase())}function N(o){return new Date(o).toLocaleTimeString(void 0,{timeStyle:"short"})}function G(o){let r=new Date(o),n=N(o),e=r.toLocaleDateString();return`${n} \xB7 ${e}`}function xo(o){let r=new Date(o),n=new Date;if(r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate())return N(o);else return G(o)}function Io(o){if(o>=1e6)return(o/1e6).toFixed(1)+"M";else if(o>=1000)return(o/1000).toFixed(1)+"K";return o.toString()}function Eo(o){if(o<1000)return`${o}ms`;if(o<60000)return`${(o/1000).toFixed(1)}s`;if(o<3600000){let e=Math.floor(o/60000),t=Math.floor(o%60000/1000);return`${e}m ${t}s`}if(o<86400000){let e=Math.floor(o/3600000),t=Math.floor(o%3600000/60000);return`${e}h ${t}m`}let r=Math.floor(o%86400000/3600000);return`${Math.floor(o/86400000)}d ${r}h`}function Ro(o,r){if(r<=0)return"";if(o.length<=r)return o;return o.slice(0,r-1)+"\u2026"}function To(o,r=35){if(r<=0)return"";if(o.length<=r)return o;let n="\u2026",e=Math.ceil((r-n.length)/2),t=Math.floor((r-n.length)/2);return o.slice(0,e)+n+(t>0?o.slice(-t):"")}function Mo(o,r,n){return(o===1?r:n).replace("{}",o.toString())}var h={};a(h,{write:()=>Oo,read:()=>_o});var E=new Map;function Y(o){if(!E.has(o))E.set(o,{readers:0,writer:!1,waitingReaders:[],waitingWriters:[]});return E.get(o)}function So(o){let r=E.get(o);if(!r||r.writer||r.readers>0)return;if(r.waitingWriters.length>0){r.waitingWriters.shift()();return}while(r.waitingReaders.length>0)r.waitingReaders.shift()();if(r.readers===0&&!r.writer&&r.waitingReaders.length===0&&r.waitingWriters.length===0)E.delete(o)}function L(o){return new Promise((r)=>{let n=()=>{o.acquire();let e=!1;r({[Symbol.dispose]:()=>{if(e)return;e=!0,o.release(),So(o.key)}})};if(o.available())n();else o.waiting.push(n)})}async function _o(o){let r=Y(o);return L({key:o,available:()=>!r.writer&&r.waitingWriters.length===0,acquire:()=>r.readers++,release:()=>r.readers--,waiting:r.waitingReaders})}async function Oo(o){let r=Y(o);return L({key:o,available:()=>!r.writer&&r.readers===0,acquire:()=>{r.writer=!0},release:()=>{r.writer=!1},waiting:r.waitingWriters})}var z={};a(z,{listen:()=>No,emit:()=>go,client:()=>Po});function No(o){onmessage=async(r)=>{let n=JSON.parse(r.data);if(n.type==="rpc.request")try{let e=await o[n.method](n.input);postMessage(JSON.stringify({type:"rpc.result",result:e,id:n.id}))}catch(e){postMessage(JSON.stringify({type:"rpc.result",error:e instanceof Error?e.message:String(e),id:n.id}))}}}function go(o,r){postMessage(JSON.stringify({type:"rpc.event",event:o,data:r}))}function Po(o){let r=new Map,n=new Map,e=0;return o.onmessage=async(t)=>{let s=JSON.parse(t.data);if(s.type==="rpc.result"){let f=r.get(s.id);if(f)if(r.delete(s.id),"error"in s)f.reject(Error(typeof s.error==="string"?s.error:"RPC call failed"));else f.resolve(s.result)}if(s.type==="rpc.event"){let f=n.get(s.event);if(f)for(let w of f)w(s.data)}},{call(t,s){let f=e++;return new Promise((w,R)=>{r.set(f,{resolve:w,reject:R});try{o.postMessage(JSON.stringify({type:"rpc.request",method:t,input:s,id:f}))}catch(S){r.delete(f),R(S)}})},on(t,s){let f=n.get(t);if(!f)f=new Set,n.set(t,f);return f.add(s),()=>{f.delete(s)}}}}var D={};a(D,{estimate:()=>Z});function Z(o){return Math.max(0,Math.round((o||"").length/4))}export{U as yr,$ as zr,Q as Ar,A as Br,to as Cr,W as Dr,B as Er,X as Fr,h as Gr,Po as Hr,z as Ir,D as Jr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p as y,q as T,r as M,s as D,t as U}from"./chunk-
|
|
2
|
+
import{p as y,q as T,r as M,s as D,t as U}from"./chunk-maa21rh9.js";import{Ud as X,Vd as _,Wd as $,Zd as v}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{be as j}from"./chunk-f4mnp6xd.js";import{eg as V}from"./chunk-bwadggys.js";import{Ol as J}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import{kn as F,yn as G}from"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-gswhjd1h.js";import{Is as Z}from"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import{lt as E}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-e0vrxetq.js";import h from"path";var b={spinner:()=>v(),log:{error:(w)=>X.error(w),info:(w)=>X.info(w),success:(w)=>X.success(w)},resolve:(w)=>G(w),...T,global:E.Path.config};function P(w){if(!w||typeof w!=="object")return;if(!("cause"in w))return;return w.cause}function I(w,q=b){let H=w.mod,K=Boolean(w.force),W=Boolean(w.global);return async(O)=>{let R=q.spinner();R.start("Installing plugin package...");let S=await M(H,q);if(!S.ok){R.stop("Install failed",1),q.log.error(`Could not install "${H}"`);let B=y(S.error);if(B.detail)q.log.error(B.detail);if(B.missing)q.log.info("This package depends on a version that is not available in your npm registry."),q.log.info("Check npm registry/auth settings and try again.");return!1}R.stop("Plugin package ready");let L=q.spinner();L.start("Reading plugin manifest...");let z=await D(S.target);if(!z.ok){if(z.code==="manifest_read_failed")return L.stop("Manifest read failed",1),q.log.error(`Installed "${H}" but failed to read ${z.file}`),q.log.error(Z(P(z.error)??z.error)),!1;if(z.code==="manifest_no_targets")return L.stop("No plugin targets found",1),q.log.error(`"${H}" does not expose plugin entrypoints in package.json`),q.log.info('Expected one of: exports["./tui"], exports["./server"], package.json main for server, or package.json["oc-themes"] for tui themes.'),!1;return L.stop("Manifest read failed",1),!1}L.stop(`Detected ${z.targets.map((B)=>B.kind).join(" + ")} target${z.targets.length===1?"":"s"}`);let N=q.spinner();N.start("Updating plugin config...");let A=await U({spec:H,targets:z.targets,force:K,global:W,vcs:O.vcs,worktree:O.worktree,directory:O.directory,config:q.global},q);if(!A.ok){if(A.code==="invalid_json")return N.stop(`Failed updating ${A.kind} config`,1),q.log.error(`Invalid JSON in ${A.file} (${A.parse} at line ${A.line}, column ${A.col})`),q.log.info("Fix the config file and run the command again."),!1;return N.stop("Failed updating plugin config",1),q.log.error(Z(A.error)),!1}N.stop("Plugin config updated");for(let B of A.items){if(B.mode==="noop"){q.log.info(`Already configured in ${B.file}`);continue}if(B.mode==="replace"){q.log.info(`Replaced in ${B.file}`);continue}q.log.info(`Added to ${B.file}`)}return q.log.success(`Installed ${H}`),q.log.info(W?`Scope: global (${A.dir})`:`Scope: local (${A.dir})`),!0}}async function x(w,q=b,H=(K)=>V.println(K)){let K=w.vcs==="git"&&w.worktree!=="/",W=[{scope:"local",dir:h.join(K?w.worktree:w.directory,".qitqode")},{scope:"global",dir:q.global}],O=0;for(let{scope:R,dir:S}of W)for(let L of["qitqode","tui"])for(let z of q.files(S,L)){if(!await q.exists(z))continue;let N=await q.readText(z).catch(()=>{return});if(N===void 0)continue;let A=[],B=F(N,A,{allowTrailingComma:!0});if(A.length){q.log.error(`Invalid JSON in ${z} \u2014 skipped`);continue}let Y=B?.plugin;if(!Array.isArray(Y)||Y.length===0)continue;q.log.info(`${R} \xB7 ${z}`);for(let Q of Y){let C=typeof Q==="string"?Q:Array.isArray(Q)?String(Q[0]):void 0;if(!C)continue;let k=Array.isArray(Q)&&Q[1]?" (with options)":"";H(" "+C+k),O++}}if(O===0)q.log.info("No plugins configured.")}var i=j({command:"plugin <module>",aliases:["plug"],describe:"install plugin and update config",builder:(w)=>{return w.positional("module",{type:"string",describe:"npm module name"}).option("global",{alias:["g"],type:"boolean",default:!1,describe:"install in global config"}).option("force",{alias:["f"],type:"boolean",default:!1,describe:"replace existing plugin version"})},handler:async(w)=>{let q=String(w.module??"").trim();if(!q){V.error("module is required"),process.exitCode=1;return}if(q==="list"){V.empty(),_("Configured plugins"),await J.provide({directory:process.cwd(),fn:async()=>{await x({vcs:J.project.vcs,worktree:J.worktree,directory:J.directory})}}),$("Done");return}V.empty(),_(`Install plugin ${q}`);let H=I({mod:q,global:Boolean(w.global),force:Boolean(w.force)}),K=!0;if(await J.provide({directory:process.cwd(),fn:async()=>{K=await H({vcs:J.project.vcs,worktree:J.worktree,directory:J.directory})}}),$("Done"),!K)process.exitCode=1}});export{x as listPlugins,I as createPlugTask,i as PluginCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{be as b}from"./chunk-f4mnp6xd.js";import{eg as t}from"./chunk-bwadggys.js";import{Ch as u}from"./chunk-
|
|
2
|
+
import{be as b}from"./chunk-f4mnp6xd.js";import{eg as t}from"./chunk-bwadggys.js";import{Ch as u}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{$j as m,Uk as y}from"./chunk-k1qd8ecm.js";import{ql as v}from"./chunk-bhg69t69.js";import{Ol as a}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import{fH as s}from"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";import{EOL as f}from"os";var M=b({command:"models [provider]",describe:"list all available models",builder:(r)=>{return r.positional("provider",{describe:"provider ID to filter models by",type:"string",array:!1}).option("verbose",{describe:"use more verbose model output (includes metadata like costs)",type:"boolean"}).option("refresh",{describe:"refresh the models cache from models.dev",type:"boolean"})},handler:async(r)=>{if(r.refresh)await v.refresh(!0),t.println(t.Style.TEXT_SUCCESS_BOLD+"Models cache refreshed"+t.Style.TEXT_NORMAL);await a.provide({directory:process.cwd(),async fn(){await u.runPromise(s.gen(function*(){let n=yield*(yield*y.Service).list(),l=(e,o)=>{let i=n[e],d=Object.entries(i.models).sort(([c],[p])=>c.localeCompare(p));for(let[c,p]of d)if(process.stdout.write(`${e}/${c}`),process.stdout.write(f),o)process.stdout.write(JSON.stringify(p,null,2)),process.stdout.write(f)};if(r.provider){let e=m.make(r.provider);if(!n[e]){yield*s.sync(()=>t.error(`Provider not found: ${r.provider}`));return}yield*s.sync(()=>l(e,r.verbose));return}let h=Object.keys(n).sort((e,o)=>{let i=e.startsWith("opencode"),d=o.startsWith("opencode");if(i&&!d)return-1;if(!i&&d)return 1;return e.localeCompare(o)});yield*s.sync(()=>{for(let e of h)l(m.make(e),r.verbose)})}))}})}});export{M as ModelsCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{be as a}from"./chunk-f4mnp6xd.js";import{bg as d}from"./chunk-
|
|
2
|
+
import{be as a}from"./chunk-f4mnp6xd.js";import{bg as d}from"./chunk-qsme16gk.js";import{eg as i}from"./chunk-bwadggys.js";import{Cl as p,El as n}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import{en as f}from"./chunk-rmsqb6r4.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-gswhjd1h.js";import{Is as m}from"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-e0vrxetq.js";import{spawn as y}from"child_process";import{Database as g}from"bun:sqlite";import{EOL as l}from"os";var b=a({command:"$0 [query]",describe:"open an interactive sqlite3 shell or run a query",builder:(t)=>{return t.positional("query",{type:"string",describe:"SQL query to execute"}).option("format",{type:"string",choices:["json","tsv"],default:"tsv",describe:"Output format"})},handler:async(t)=>{let o=t.query;if(o){let r=new g(n.Path,{readonly:!0});try{let e=r.query(o).all();if(t.format==="json")console.log(JSON.stringify(e,null,2));else if(e.length>0){let s=Object.keys(e[0]);console.log(s.join("\t"));for(let u of e)console.log(s.map((h)=>u[h]).join("\t"))}}catch(e){i.error(m(e)),process.exit(1)}r.close();return}let c=y("sqlite3",[n.Path],{stdio:"inherit"});await new Promise((r)=>c.on("close",r))}}),w=a({command:"path",describe:"print the database path",handler:()=>{console.log(n.Path)}}),q=a({command:"migrate",describe:"migrate JSON data to SQLite (merges with existing data)",handler:async()=>{let t=new g(n.Path),o=process.stderr.isTTY,c=-1;if(o)process.stderr.write("\x1B[?25l");try{let r=await p.run(f({client:t}),{progress:(e)=>{let s=Math.floor(e.current/e.total*100);if(s===c)return;if(c=s,o)process.stderr.write(d(s,`${e.current}/${e.total}`)+" ");else process.stderr.write(`sqlite-migration:${s}${l}`)}});if(o)process.stderr.write(`
|
|
3
3
|
`);if(o)process.stderr.write("\x1B[?25h");else process.stderr.write(`sqlite-migration:done${l}`);if(i.println(`Migration complete: ${r.projects} projects, ${r.sessions} sessions, ${r.messages} messages`),r.errors.length>0)i.println(`${r.errors.length} errors occurred during migration`)}catch(r){if(o)process.stderr.write("\x1B[?25h");i.error(`Migration failed: ${m(r)}`),process.exit(1)}finally{t.close()}}}),v=a({command:"db",describe:"database tools",builder:(t)=>{return t.command(b).command(w).command(q).demandCommand()},handler:()=>{}});export{v as DbCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{n as a,o as b}from"./chunk-
|
|
2
|
+
import{n as a,o as b}from"./chunk-702bt91p.js";import"./chunk-maa21rh9.js";import"./chunk-y31f8k5f.js";import"./chunk-c8k32724.js";import"./chunk-vgt3artc.js";import"./chunk-53jstmdp.js";import"./chunk-gbkz04ke.js";import"./chunk-c987bemn.js";import"./chunk-a1z8rnq7.js";import"./chunk-5r7c6vvx.js";import"./chunk-rk0fnvp5.js";import"./chunk-8p0t8qah.js";import"./chunk-52xvhxek.js";import"./chunk-mr17tppa.js";import"./chunk-h8mfbbjh.js";import"./chunk-13jq2ygc.js";import"./chunk-bwadggys.js";import"./chunk-mrq35ftw.js";import"./chunk-nsp1za8t.js";import"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-8jmb5bd4.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";export{b as tui,a as rendererConfig};
|