@kumori/kdsl 0.0.13 → 0.0.15
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/dist/build/deployment_spec.d.ts +21095 -0
- package/dist/build/deployment_spec.js +292 -0
- package/dist/build/deployment_spec.js.map +1 -0
- package/dist/build/helpers/builtin.d.ts +17 -0
- package/dist/build/helpers/builtin.js +82 -0
- package/dist/build/helpers/builtin.js.map +1 -0
- package/dist/build/helpers/component.d.ts +17 -0
- package/dist/build/helpers/component.js +212 -0
- package/dist/build/helpers/component.js.map +1 -0
- package/dist/build/helpers/connector.d.ts +13 -0
- package/dist/build/helpers/connector.js +190 -0
- package/dist/build/helpers/connector.js.map +1 -0
- package/dist/build/helpers/deployment.d.ts +326 -0
- package/dist/build/helpers/deployment.js +86 -0
- package/dist/build/helpers/deployment.js.map +1 -0
- package/dist/build/helpers/resource.d.ts +97 -0
- package/dist/build/helpers/resource.js +54 -0
- package/dist/build/helpers/resource.js.map +1 -0
- package/dist/build/helpers/service.d.ts +27 -0
- package/dist/build/helpers/service.js +199 -0
- package/dist/build/helpers/service.js.map +1 -0
- package/dist/build/helpers/utils.d.ts +22 -0
- package/dist/build/helpers/utils.js +55 -0
- package/dist/build/helpers/utils.js.map +1 -0
- package/dist/build/main.d.ts +17 -0
- package/dist/build/main.js +139 -0
- package/dist/build/main.js.map +1 -0
- package/dist/build/solution.d.ts +20 -0
- package/dist/build/solution.js +72 -0
- package/dist/build/solution.js.map +1 -0
- package/dist/check/main.d.ts +21 -0
- package/dist/check/main.js +99 -0
- package/dist/check/main.js.map +1 -0
- package/dist/clean/main.d.ts +11 -0
- package/dist/clean/main.js +26 -0
- package/dist/clean/main.js.map +1 -0
- package/dist/help/main.d.ts +13 -0
- package/dist/help/main.js +49 -0
- package/dist/help/main.js.map +1 -0
- package/dist/help/topic/build.d.ts +2 -0
- package/dist/help/topic/build.js +7 -0
- package/dist/help/topic/build.js.map +1 -0
- package/dist/help/topic/mod_dep.d.ts +2 -0
- package/dist/help/topic/mod_dep.js +8 -0
- package/dist/help/topic/mod_dep.js.map +1 -0
- package/dist/help/topic/mod_dl.d.ts +2 -0
- package/dist/help/topic/mod_dl.js +25 -0
- package/dist/help/topic/mod_dl.js.map +1 -0
- package/dist/index/create/main.d.ts +14 -0
- package/dist/index/create/main.js +264 -0
- package/dist/index/create/main.js.map +1 -0
- package/dist/index/main.d.ts +8 -0
- package/dist/index/main.js +17 -0
- package/dist/index/main.js.map +1 -0
- package/dist/lib/build.d.ts +42 -0
- package/dist/lib/build.js +28 -0
- package/dist/lib/build.js.map +1 -0
- package/dist/lib/check.d.ts +41 -0
- package/dist/lib/check.js +15 -0
- package/dist/lib/check.js.map +1 -0
- package/dist/lib/clean.d.ts +31 -0
- package/dist/lib/clean.js +1 -0
- package/dist/lib/clean.js.map +1 -0
- package/dist/lib/index-cmd.d.ts +54 -0
- package/dist/lib/index-cmd.js +57 -0
- package/dist/lib/index-cmd.js.map +1 -0
- package/dist/lib/index.d.ts +56 -0
- package/dist/lib/index.js +117 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/io/lib.kumori +5 -0
- package/dist/lib/kumori/builtin/httpinbound.h.kumori +27 -0
- package/dist/lib/kumori/builtin/tcpinbound.h.kumori +25 -0
- package/dist/lib/kumori/builtin.kumori +18 -0
- package/dist/lib/kumori/component.kumori +120 -0
- package/dist/lib/kumori/deployment.kumori +16 -0
- package/dist/lib/kumori/resource.kumori +25 -0
- package/dist/lib/kumori/service.kumori +49 -0
- package/dist/lib/kumori/shared.kumori +11 -0
- package/dist/lib/kumori/sized.kumori +25 -0
- package/dist/lib/logger.d.ts +10 -0
- package/dist/lib/logger.js +23 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/mod.d.ts +156 -0
- package/dist/lib/mod.js +70 -0
- package/dist/lib/mod.js.map +1 -0
- package/dist/lib/registry.d.ts +61 -0
- package/dist/lib/registry.js +1 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/sized.kumori +8 -0
- package/dist/lib/std.kumori +8 -0
- package/dist/lib/strconv/lib.kumori +11 -0
- package/dist/lib/types.d.ts +26 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +35 -0
- package/dist/main.js.map +1 -0
- package/dist/mod/checksum/main.d.ts +11 -0
- package/dist/mod/checksum/main.js +33 -0
- package/dist/mod/checksum/main.js.map +1 -0
- package/dist/mod/dependency/main.d.ts +19 -0
- package/dist/mod/dependency/main.js +156 -0
- package/dist/mod/dependency/main.js.map +1 -0
- package/dist/mod/download/functions.d.ts +53 -0
- package/dist/mod/download/functions.js +235 -0
- package/dist/mod/download/functions.js.map +1 -0
- package/dist/mod/download/main.d.ts +26 -0
- package/dist/mod/download/main.js +89 -0
- package/dist/mod/download/main.js.map +1 -0
- package/dist/mod/init/main.d.ts +13 -0
- package/dist/mod/init/main.js +66 -0
- package/dist/mod/init/main.js.map +1 -0
- package/dist/mod/jsonschema/gen/main.d.ts +11 -0
- package/dist/mod/jsonschema/gen/main.js +281 -0
- package/dist/mod/jsonschema/gen/main.js.map +1 -0
- package/dist/mod/jsonschema/get/kdslschema.d.ts +28 -0
- package/dist/mod/jsonschema/get/kdslschema.js +3 -0
- package/dist/mod/jsonschema/get/kdslschema.js.map +1 -0
- package/dist/mod/jsonschema/get/main.d.ts +76 -0
- package/dist/mod/jsonschema/get/main.js +338 -0
- package/dist/mod/jsonschema/get/main.js.map +1 -0
- package/dist/mod/jsonschema/main.d.ts +8 -0
- package/dist/mod/jsonschema/main.js +20 -0
- package/dist/mod/jsonschema/main.js.map +1 -0
- package/dist/mod/main.d.ts +8 -0
- package/dist/mod/main.js +27 -0
- package/dist/mod/main.js.map +1 -0
- package/dist/mod/update/main.d.ts +17 -0
- package/dist/mod/update/main.js +69 -0
- package/dist/mod/update/main.js.map +1 -0
- package/dist/registry/add.d.ts +15 -0
- package/dist/registry/add.js +53 -0
- package/dist/registry/add.js.map +1 -0
- package/dist/registry/list.d.ts +15 -0
- package/dist/registry/list.js +29 -0
- package/dist/registry/list.js.map +1 -0
- package/dist/registry/main.d.ts +8 -0
- package/dist/registry/main.js +21 -0
- package/dist/registry/main.js.map +1 -0
- package/dist/registry/remove.d.ts +15 -0
- package/dist/registry/remove.js +34 -0
- package/dist/registry/remove.js.map +1 -0
- package/dist/util/err-format.d.ts +2 -0
- package/dist/util/err-format.js +11 -0
- package/dist/util/err-format.js.map +1 -0
- package/dist/util/err-handler.d.ts +3 -0
- package/dist/util/err-handler.js +11 -0
- package/dist/util/err-handler.js.map +1 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +2 -0
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/out/lib/build.cjs +29 -0
- package/out/lib/check.cjs +16 -0
- package/out/lib/clean.cjs +2 -0
- package/out/lib/index-cmd.cjs +58 -0
- package/out/lib/index.cjs +118 -0
- package/out/lib/mod.cjs +71 -0
- package/out/lib/registry.cjs +2 -0
- package/out/main.cjs +172 -172
- package/package.json +50 -6
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var li=Object.create;var ze=Object.defineProperty,Di=Object.defineProperties,ci=Object.getOwnPropertyDescriptor,di=Object.getOwnPropertyDescriptors,mi=Object.getOwnPropertyNames,fr=Object.getOwnPropertySymbols,fi=Object.getPrototypeOf,hr=Object.prototype.hasOwnProperty,pi=Object.prototype.propertyIsEnumerable;var pr=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var wt=(e,t,r)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F=(e,t)=>{for(var r in t||(t={}))hr.call(t,r)&&wt(e,r,t[r]);if(fr)for(var r of fr(t))pi.call(t,r)&&wt(e,r,t[r]);return e},x=(e,t)=>Di(e,di(t));var Fr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var b=(e,t)=>()=>(e&&(t=e(e=0)),t);var vt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ue=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})},hi=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of mi(t))!hr.call(e,n)&&n!==r&&ze(e,n,{get:()=>t[n],enumerable:!(o=ci(t,n))||o.enumerable});return e};var Bt=(e,t,r)=>(r=e!=null?li(fi(e)):{},hi(t||!e||!e.__esModule?ze(r,"default",{value:e,enumerable:!0}):r,e));var B=(e,t,r)=>(wt(e,typeof t!="symbol"?t+"":t,r),r),bt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var w=(e,t,r)=>(bt(e,t,"read from private field"),r?r.call(e):t.get(e)),$=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ee=(e,t,r,o)=>(bt(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var z=(e,t,r)=>(bt(e,t,"access private method"),r);var gr=(e,t,r)=>{if(t!=null){if(typeof t!="object"&&typeof t!="function")throw TypeError("Object expected");var o;if(r&&(o=t[pr("asyncDispose")]),o===void 0&&(o=t[pr("dispose")]),typeof o!="function")throw TypeError("Object not disposable");e.push([r,o,t])}else r&&e.push([r]);return t},Cr=(e,t,r)=>{var o=typeof SuppressedError=="function"?SuppressedError:function(i,s,a,c){return c=Error(a),c.name="SuppressedError",c.error=i,c.suppressed=s,c},n=i=>t=r?new o(i,t,"An error was suppressed during disposal"):(r=!0,i),u=i=>{for(;i=e.pop();)try{var s=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(s).then(u,a=>(n(a),u()))}catch(a){n(a)}if(r)throw t};return u()};import{Result as uu}from"@kumori/kdsl-lsp/util/result.js";function Ce(e,t){if(uu.isErr(t)){for(let r of t.err)e.error(r);process.exit(1)}return t.value}var Qe=b(()=>{"use strict"});import{ParseQuery as _r}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as Ye,None as su,Some as au}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as H,Ok as Rt,Result as re}from"@kumori/kdsl-lsp/util/result.js";import{Version as Ir}from"@kumori/kdsl-lsp/module/version.js";import{ListDependencies as lu}from"@kumori/kdsl-lsp/module/dependency/list.js";import Mt from"assert";import{LocateDependency as jr}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{ModuleContext as Du}from"@kumori/kdsl-lsp/module/context.js";import{MkdirTemp as cu}from"@kumori/kdsl-lsp/util/tmp.js";import{ValidateChecksum as du}from"@kumori/kdsl-lsp/module/integrity/validate.js";import{URI as mu,UriUtils as fu}from"langium";import{mkdir as pu,rename as hu,rm as Fu}from"fs/promises";import{ForURL as gu}from"@kumori/kdsl-lsp/module/remote/factory.js";import{SemVer as Nr}from"@kumori/kdsl-lsp/util/semver.js";import{URL as Cu}from"@kumori/kdsl-lsp/util/url.js";import{DependencyId as Ur}from"@kumori/kdsl-lsp/module/dependency/id.js";async function Kr(e){let t=new Map;return await Jr(e,t),t}async function Vr(e,t){let r=new Map;console.log(t);for(let o of t){let n=_r(o);if(Ye.isNone(n)){let a=`invalid download query '${o}': failed to parse`;r.set(o,x(F({},H(a)),{required:!0}));continue}let u=Ir(n.value.Version);if(Ye.isNone(u)){let a=`invalid download query '${o}': invalid version specifier '${n.value.Version}': failed to parse`;r.set(o,x(F({},H(a)),{required:!0}));continue}if(!Ir.isSemVer(u.value)){let a=`invalid download query '${o}': invalid version specifier '${n.value.Version}': invalid semver`;r.set(o,x(F({},H(a)),{required:!0}));continue}let i=`${n.value.Scheme}://${n.value.Location}`,s=n.value.Version;await qr(e,i,s,r)}return r}async function Jr(e,t){var o;let r=lu(e.Current);for(let n of r.keys()){let u=r.get(n);if(u.length<1)continue;let{target:i,version:s}=u[0];await qr(e,i,s,t);let a=u.reduce((D,l)=>D||l.interface===void 0,!1),c=Ur(i,s);Mt(t.has(c)),(o=t.get(c)).required||(o.required=a)}}async function qr(e,t,r,o){let n=Ur(t,r);if(o.has(n))return;let u=await Eu(e,t,r);if(o.set(n,x(F({},u),{required:!1})),re.isErr(u))return;let i=await jr(e,t,r);Mt(Ye.isSome(i));let s=await Du.Move(e,e.FS,i.value.Root);Mt(re.isOk(s)),e=F(F({},e),s.value),await Jr(e,o)}async function Eu(e,t,r){var c=[];try{let o=await jr(e,t,r);if(re.isOk(o))return Rt(su);let n=gr(c,await cu(),!0);let u=await kt(e,t,r,n.Path);if(re.isErr(u))return H(`failed to fetch ${t}@${r}: ${u.err}`);let i=await du(e.SumDB,mu.file(n.Path),e,t,u.value);if(re.isErr(i))return i;let s=`${t}@${r}`;let a=fu.joinPath(e.Locations.Cache(),s);await pu(a.fsPath,{recursive:!0});await Fu(a.fsPath,{recursive:!0,force:!0});await hu(n.Path,a.fsPath);return Rt(au(s))}catch(D){var l=D,d=!0}finally{var p=Cr(c,l,d);p&&await p}}async function kt(e,t,r,o){let n=`${t}@${r}`,u=_r(n);if(Ye.isNone(u))return H(`failed to resolve ${n}: invalid download query`);let i=Nr(u.value.Version),s=new Cu(`${u.value.Scheme}://${u.value.Location}`),a=gu(e.Remotes,s);if(re.isErr(a))return H(`failed to resolve ${n}': invalid remote ${s}: ${a.err}`);let c=await a.value.Versions(s);if(re.isErr(c))return H(`failed to read ${s}: ${c.err}`);let D=i,l=c.value.filter(f=>Nr.Compare(f,D)===0);if(l.length===0)return H(`no remote matches for ${s}@v${i}`);if(l.length>1){let f=`[${l.map(String).join(", ")}]`;return H(`ambiguous match for ${s}@v${i}: found ${f}`)}let d=l[0],p=await a.value.Get(s,d.toString(),o);return re.isErr(p)?H(`failed to fetch ${s}@${i.toString()}: ${p.err}`):Rt(d)}var Pt=b(()=>{"use strict"});var Yr={};ue(Yr,{Action:()=>Qr,Description:()=>Hr,Download:()=>le,Register:()=>Wr,default:()=>Au});import{ModuleContext as yu}from"@kumori/kdsl-lsp/module/context.js";import{SumDB as wu}from"@kumori/kdsl-lsp/module/integrity/sumdb.js";import{RemoteFetcherFactory as Gr}from"@kumori/kdsl-lsp/module/remote/factory.js";import{Maybe as vu}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as zr,Ok as Bu,Result as ke}from"@kumori/kdsl-lsp/util/result.js";import{URI as bu}from"langium";import{NodeFileSystem as xu}from"langium/node";import{createKumoriServices as Su}from"@kumori/kdsl-lsp/language/kumori.js";import{RegistryManager as Lu}from"@kumori/kdsl-lsp/module/registry/manager.js";function Wr(e,t){return e.command("download").alias("dl").summary(Ou).argument("[module...]").option("-q, --quiet","do not log warnings").description(Hr).helpOption(!0).action(Qr(t))}function Qr(e){let t=Su(xu).Kumori,r=o=>Ce(e,o);return async(o,n)=>{await new Lu().ensureIndexes(),r(await le(e,t,process.cwd(),o,n))}}var Au,Ou,Hr,le,Ze=b(()=>{"use strict";Qe();Pt();Au={Register:Wr};Ou="download modules to local cache",Hr=`
|
|
2
|
+
Downloads the specified modules, which can be module patterns selecting depen-
|
|
3
|
+
dencies of the current module or module queries of the form path@version.
|
|
4
|
+
|
|
5
|
+
With no arguments, download applies to the modules needed to build the packages
|
|
6
|
+
in the current module.
|
|
7
|
+
|
|
8
|
+
The kdsl command will automatically download modules as needed during ordinary
|
|
9
|
+
execution. The "kdsl mod download" command is useful mainly for pre-filling the
|
|
10
|
+
local cache.
|
|
11
|
+
|
|
12
|
+
By default, download writes nothing to standard output. It may print progress
|
|
13
|
+
messages and errors to standard error.
|
|
14
|
+
`.trim();le=async(e,t,r,o,n)=>{let u=t.shared.workspace.FileSystemProvider,i=await yu(u,bu.file(r));if(ke.isErr(i))return zr([i.err]);let s=await wu.Open(i.value.Locations.Checksum());if(ke.isErr(s))return ke.mapErr(s,l=>[l]);let a;o.length?a=await Vr(x(F({},i.value),{FS:u,Remotes:Gr(),SumDB:s.value}),o):a=await Kr(x(F({},i.value),{FS:u,Remotes:Gr(),SumDB:s.value}));let c=[];for(let[l,d]of a){if(ke.isOk(d)){vu.isSome(d.value)&&e.info(`Downloaded dependency ${l}`);continue}d.required?c.push(`${l}: ${d.err}`):n.quiet||(e.warn(`${l}: ${d.err}`),e.warn(`${l}: not required - continuing`))}return Array.from(a.entries()).filter(([,l])=>ke.isErr(l)&&l.required).length>0?zr(c):Bu(void 0)}});var oo={};ue(oo,{Action:()=>to,Check:()=>Q,RawCheck:()=>ro,Register:()=>eo,default:()=>Ku});import{createKumoriServices as Ru}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as Mu,UriUtils as $t}from"langium";import{NodeFileSystem as ku}from"langium/node";import{DiagnosticSeverity as Zr}from"vscode-languageserver";import{Err as Tt,Ok as Xr,Result as Pe}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as Pu}from"@kumori/kdsl-lsp/module/context.js";import Tu from"path";import{RegistryManager as $u}from"@kumori/kdsl-lsp/module/registry/manager.js";function eo(e,t){return e.command("check").argument("[directory]","directory containing a Kumori module").description(Nu).summary(Iu).action(to(t))}function to(e){return async t=>{await new $u().ensureIndexes();let o=Ru(ku).Kumori,n=o.shared.workspace.FileSystemProvider,u=s=>Ce(e,s),i=u(Pe.mapErr(await Pu(n,Mu.file(Tu.resolve(t!=null?t:"."))),s=>[s]));u(await Q(e,o,i))}}function _u(e,t){return`lexer error: ${$t.relative(process.cwd(),e.uri.fsPath)}:${t.line||1}:${t.column||1}: ${t.message}`}function ju(e,t){return`parser error: ${$t.relative(process.cwd(),e.uri.fsPath)}:${t.token.startLine||1}:${t.token.startColumn||1}: ${t.message}`}function Uu(e,t){return`diagnostic error: ${$t.relative(process.cwd(),e.uri.fsPath)}:${t.range.start.line+1}:${t.range.start.character+1}: ${t.message}`}var Iu,Nu,Q,ro,Ku,Ee=b(()=>{"use strict";Ze();Qe();Iu="typecheck and validate a module",Nu=`
|
|
15
|
+
`.trim();Q=async(e,t,r)=>{let o=r.Current.Root,n=await le(e,t,o.fsPath,[],{quiet:!0});if(Pe.isErr(n))return n;let u=await ro(t,r);if(Pe.isErr(u)){let i=u.err.warnings.concat(u.err.errors);return Tt(i)}return Xr(void 0)},ro=async(e,t)=>{let r={errors:[],warnings:[]},o=e.shared.workspace.FileSystemProvider,n=t.Current.Root,u=await Pe.tryCatchAsync(()=>o.readDirectory(n));if(Pe.isErr(u)){let c=""+u.err;return u.err instanceof Error&&(c=u.err.message),r.errors.push(`failed to read directory '${n.fsPath}': ${c}`),Tt(r)}await e.shared.workspace.WorkspaceManager.initializeWorkspace([{name:"root",uri:n.toString()}]);let s=e.shared.workspace.LangiumDocuments;await e.shared.workspace.DocumentBuilder.build(s.all.toArray(),{validation:!0});for(let c of e.shared.workspace.LangiumDocuments.all){for(let D of c.parseResult.lexerErrors)r.errors.push(_u(c,D));for(let D of c.parseResult.parserErrors)r.errors.push(ju(c,D));for(let D of c.diagnostics||[]){let l=Uu(c,D);D.severity===Zr.Error&&r.errors.push(l),D.severity===Zr.Warning&&r.warnings.push(l)}}return r.errors.length>0?Tt(r):Xr(void 0)};Ku={Register:eo}});var po={};ue(po,{Action:()=>mo,Description:()=>co,NewModule:()=>fo,Register:()=>Do,default:()=>gs});import{Maybe as ds}from"@kumori/kdsl-lsp/util/maybe.js";import{mkdir as ms,writeFile as fs}from"fs/promises";import{URI as ps}from"langium";import{NodeFileSystem as hs}from"langium/node";import{LocateModuleManifest as Fs,MOD_FILE as lo}from"@kumori/kdsl-lsp/module/locator.js";import It from"path";function Do(e,t){return e.command("init").summary(Cs).argument("<name>","module name (e.g., kumori.systems/my-module)").argument("<version>","module version - defaults to 0.0.1").argument("[path]","location to create the module under - defaults to the current directory").argument("[cacheLocation]","location to store cached modules - default to .kumori/mod").description(co).helpOption(!0).action(mo(t))}function mo(e){return async(...t)=>{await fo(e,process.cwd(),...t)}}var gs,Cs,co,fo,ho=b(()=>{"use strict";gs={Register:Do};Cs="initializes a new kumori module",co=`
|
|
16
|
+
Initializes a new Kumori module, which effectively means to create a new
|
|
17
|
+
kumori.mod.json file or overwrite it in case it already exists.
|
|
18
|
+
It is required to provide a name and a version for the module and optionally
|
|
19
|
+
a location path where the new module is going to be initialized.
|
|
20
|
+
|
|
21
|
+
kdsl mod init kumori.systems/my-module
|
|
22
|
+
|
|
23
|
+
You could as well provide a custom location for the module's local cache,
|
|
24
|
+
where all the dependencies will be downloaded. By default, the cache location
|
|
25
|
+
is set to ".kumori/mod" under the module location.
|
|
26
|
+
|
|
27
|
+
kdsl mod init kumori.systems/my-module ./my-module
|
|
28
|
+
|
|
29
|
+
`.trim();fo=async(e,t,...[r,o,n,u])=>{let i=hs.fileSystemProvider();n=n!=null?n:t,It.isAbsolute(n)||(n=It.join(t,n));let s=await Fs(i,ps.file(n));ds.isSome(s)&&s.value.fsPath===n&&(e.error(`error: module ${n} already exists`),process.exit(1));let a={spec:"kumori/module/v1",kumori:"0.0.1",version:o,module:r,cacheLocation:u,requires:[]},c=It.join(n,lo);await ms(n,{recursive:!0}),await fs(c,JSON.stringify(a,null,4)),e.info(`creating new ${lo}: module ${r}`)}});var wo={};ue(wo,{Action:()=>Eo,Dependency:()=>yo,Description:()=>go,Register:()=>Co,default:()=>xs});import{URI as Es,UriUtils as Nt}from"langium";import{createKumoriServices as ys}from"@kumori/kdsl-lsp/language/kumori.js";import{NodeFileSystem as ws}from"langium/node";import{Result as $e}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as vs}from"@kumori/kdsl-lsp/module/context.js";import{writeFile as _t}from"fs/promises";import{MOD_FILE as jt}from"@kumori/kdsl-lsp/module/locator.js";import{ParseQuery as Fo}from"@kumori/kdsl-lsp/module/query.js";import{RegistryManager as Bs}from"@kumori/kdsl-lsp/module/registry/manager.js";function Co(e,t){return e.command("dependency").alias("dep").argument("<module>","Module URL with @<tag> (e.g. https://github.com/org/repo@v1.2.3)").option("--alias <alias>","Alias for the dependency").option("--headers <module>","Specify a separate location for the headers module").option("--remove","Remove the dependency").option("--download","Download the dependency after adding it").summary(bs).description(go).helpOption(!0).showHelpAfterError(!0).action(Eo(t))}function Eo(e){return async(t,r)=>{await new Bs().ensureIndexes();try{await yo(e,Es.file(process.cwd()),t,r)}catch(n){throw e.error(`Failed to manage dependency: ${n}`),n}}}var bs,go,xs,yo,vo=b(()=>{"use strict";Ze();bs="Add, update, or remove a dependency from the module declaration",go=`
|
|
30
|
+
Manage dependencies within the current module. It can add, update
|
|
31
|
+
or remove dependencies. Optionally, it can attempt to download the dependency after adding it.
|
|
32
|
+
Dependencies should resolve to a git repository.
|
|
33
|
+
|
|
34
|
+
To add a dependency:
|
|
35
|
+
kdsl mod dep github.com/org/repo@v1.0.0
|
|
36
|
+
|
|
37
|
+
To add a dependency with an alias:
|
|
38
|
+
kdsl mod dep github.com/org/repo@v1.0.0 --alias mydep
|
|
39
|
+
|
|
40
|
+
To update a dependency to a new version:
|
|
41
|
+
kdsl mod dep github.com/org/repo@v1.2.0
|
|
42
|
+
|
|
43
|
+
To remove a dependency:
|
|
44
|
+
kdsl mod dep github.com/org/repo --remove
|
|
45
|
+
|
|
46
|
+
To add a dependency and download it immediately:
|
|
47
|
+
kdsl mod dep github.com/org/repo@v1.0.0 --download
|
|
48
|
+
`.trim(),xs={Register:Co};yo=async(e,t,r,o)=>{let n=ys(ws).Kumori,u=n.shared.workspace.FileSystemProvider,i=await vs(u,t);if($e.isErr(i))throw new Error(i.err);let s=i.value.Current.Manifest,a=Fo(r);if($e.isErr(a))throw new Error(`invalid query '${r}': invalid format`);let c=null;if(o.headers&&(c=Fo(o.headers),$e.isErr(c)))throw new Error(`invalid query '${o.headers}': invalid format`);let D=c?c.value:null,l=a.value;l.Location.endsWith("/")&&(l.Location=l.Location.replace(/\/+$/,""));let d=o.alias;if(o.remove){let m=s.requires.findIndex(g=>g.target===l.Location&&g.version===l.Version);if(m===-1)throw new Error(`Dependency ${l} not found`);s.requires.splice(m,1),await _t(Nt.joinPath(i.value.Current.Root,jt).fsPath,JSON.stringify(s,void 0,4)),e.info(`Removed dependency ${l.toString()}`);return}if(d&&s.requires.some(m=>m.alias===d&&m.target!==l.Location))throw new Error(`Alias '${d}' is already used by another dependency`);let f=s.requires.find(m=>m.target===l.Location);if(f){if(d?f.alias=d:delete f.alias,D&&(f.headers={target:D.Location,version:D.Version}),await _t(Nt.joinPath(i.value.Current.Root,jt).fsPath,JSON.stringify(s,void 0,4)),o.download){let m=await le(e,n,t.fsPath,[],{quiet:!0});if($e.isErr(m))throw new Error(`Failed to download dependency: ${m.err.join(", ")}`)}e.info(`Updated dependency ${l.Location} to version ${l.Version}`+(d?` (alias: ${d})`:"")+(D?` (headers: ${D})`:""))}else{let m=l.Version,g=F(F({target:l.Location,version:m},d?{alias:d}:{}),D?{headers:{target:D.Location,version:D.Version}}:{});if(s.requires.push(g),await _t(Nt.joinPath(i.value.Current.Root,jt).fsPath,JSON.stringify(s,void 0,4)),o.download){let h=await le(e,n,t.fsPath,[],{quiet:!0});if($e.isErr(h))throw new Error(`Failed to download dependency: ${h.err.join(", ")}`)}e.info(`Added dependency ${l.toString()}`+(d?` (alias: ${d})`:"")+(D?` (headers: ${D})`:"")+" to module manifest")}}});var Ao={};ue(Ao,{Action:()=>So,Description:()=>xo,NewModule:()=>Lo,Register:()=>bo,default:()=>Ms});import{Maybe as Ss}from"@kumori/kdsl-lsp/util/maybe.js";import{mkdir as Ls,writeFile as As}from"fs/promises";import{URI as Bo}from"langium";import{NodeFileSystem as Os}from"langium/node";import{LocateModuleManifest as Rs,MOD_FILE as Ut}from"@kumori/kdsl-lsp/module/locator.js";import Xe from"path";function bo(e,t){return e.command("update").summary(ks).option("-v, --version <version>","new module version").option("-p, --path <location>","location where the module to update is located - defaults to the current directory").option("-c, --cacheLocation <cacheLocation>","new cache location").description(xo).helpOption(!0).action(So(t))}function So(e){return async t=>{await Lo(e,process.cwd(),t)}}var Ms,ks,xo,Lo,Oo=b(()=>{"use strict";Ms={Register:bo};ks="updates an existing kumori module's version or cache location",xo=`
|
|
49
|
+
This command updates an existing Kumori module's version or cache location in the kumori.mod.json file. It is required to provide the new version and optionally
|
|
50
|
+
a new cache location for the module.
|
|
51
|
+
|
|
52
|
+
kdsl mod update -v 1.0.0
|
|
53
|
+
|
|
54
|
+
You could as well provide a new location for the module's local cache,
|
|
55
|
+
where all the dependencies will be downloaded.
|
|
56
|
+
|
|
57
|
+
kdsl mod update -v 1.0.0 -c ./my-mod-cache
|
|
58
|
+
|
|
59
|
+
If the module is not located in the current directory, you can provide a custom location path.
|
|
60
|
+
|
|
61
|
+
kdsl mod update -v 1.0.0 -p ./my-module
|
|
62
|
+
`.trim();Lo=async(e,t,r)=>{var D,l,d;let o=Os.fileSystemProvider(),n=(D=r.path)!=null?D:t;Xe.isAbsolute(n)||(n=Xe.join(t,n));let u=await Rs(o,Bo.file(n));Ss.isSome(u)&&u.value.fsPath===n&&(e.error(`error: module ${n} already exists`),process.exit(1));let i=await o.readFile(Bo.file(Xe.join(n,Ut))),s=JSON.parse(i),a={spec:"kumori/module/v1",kumori:"0.0.1",version:(l=r.version)!=null?l:s.version,module:s.module,cacheLocation:(d=r.cacheLocation)!=null?d:s.cacheLocation,requires:[]},c=Xe.join(n,Ut);await Ls(n,{recursive:!0}),await As(c,JSON.stringify(a,null,4)),e.info(`updated ${Ut}: module ${a.module}`)}});import{AstUtils as Ps,UriUtils as Ts}from"langium";function Ro(e){var o,n;let t=(n=(o=e.node.$cstNode)==null?void 0:o.range)!=null?n:{start:{line:-1,character:-1},end:{line:-1,character:-1}},r=Ps.getDocument(e.node);return`${Ts.relative(process.cwd(),r.uri.fsPath)}:${t.start.line+1}:${t.start.character+1}: ${e.message}`}var Mo=b(()=>{"use strict"});var Jo={};ue(Jo,{Action:()=>Uo,Description:()=>jo,GetSchema:()=>et,LocateModule:()=>Ko,Register:()=>_o,ToJSONSchema:()=>Vo,ToJSONSchemaInternal:()=>Y,default:()=>sa});import{createKumoriServices as $s}from"@kumori/kdsl-lsp/language/kumori.js";import{ModuleContext as Is}from"@kumori/kdsl-lsp/module/context.js";import{ParseQuery as Ns}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as To,None as _s,Some as js}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as J,Ok as j,Result as T}from"@kumori/kdsl-lsp/util/result.js";import{TempCache as Us}from"@kumori/kdsl-lsp/util/tmp.js";import{NodeFileSystem as $o}from"langium/node";import we from"path";import{AstUtils as Io,URI as Ks,UriUtils as No}from"langium";import Ie from"assert";import{TAny as ko,TBoolean as Vs,TEither as Js,TFunction as qs,TList as Gs,TNumber as zs,TOptional as Po,TString as Ws,TStruct as Hs,TTypeDefAlias as Qs,TTypeDefNamed as Ys,TypeSystemError as Zs,TypeToString as Xs}from"@kumori/kdsl-lsp/language/type-system/type.js";import{ModuleDescriptor as ea}from"@kumori/kdsl-lsp/module/descriptor.js";import{isBuiltinArtifact as ta,isComponentArtifact as ra,isServiceArtifact as oa}from"@kumori/kdsl-lsp/language/generated/ast.js";import{Scheme as na}from"@kumori/kdsl-lsp/language/builtin/util.js";import{GatherModuleDocuments as ia}from"@kumori/kdsl-lsp/module/documents.js";import{RemoteFetcherFactory as ua}from"@kumori/kdsl-lsp/module/remote/factory.js";function _o(e,t){return e.command("get").summary(aa).argument("<target>",'Unique path of the kmodule where the artifact is defined. Accepts remote targets (e.g., "github.com/MyOrg/component@v1.2.3") or local paths (e.g. "/abs/path/to/module", "../rel/path/to/module").').argument("<package-path>",`Relative path to the package that contains the artifact (e.g., "internal/service"). For artifacts in the module's root package, use ".".`).argument("<artifact-name>",'Name of the target artifact (e.g., "ExampleService").').description(jo).helpOption(!0).action(Uo(t))}function Uo(e){return async(t,r,o)=>{let n=$s($o).Kumori,u=D=>Ce(e,D),i=u(await Ko(t)),s=n.shared.workspace.FileSystemProvider,a=u(T.mapErr(await Is(s,Ks.file(i.fsPath)),D=>[D]));u(await Q(e,n,a));let c=u(await et(n,a,r,o));console.log(JSON.stringify(c,null,4))}}async function Ko(e){let t=await Us(),r=$o.fileSystemProvider(),o=e;if(e[0]==="."||we.isAbsolute(e)){let D=we.isAbsolute(e)?e:we.resolve(process.cwd(),e);return j({$type:"local",fsPath:D})}let u=Ns(e);if(To.isNone(u))return J([`invalid remote target '${e}': invalid syntax`]);let i=u.value.Version,s=`${u.value.Location}@${i}`,a=No.joinPath(t,s),c=await ea(r,a);if(T.isErr(c)){let D=await kt({Remotes:ua()},u.value.Location,i,a.fsPath);if(T.isErr(D))return J([`failed to fetch ${o}: ${D.err}`])}return j({$type:"remote",fsPath:a.fsPath,query:u.value})}async function et(e,t,r,o){let n=No.joinPath(t.Current.Root,we.normalize(r)),u=e.references.KumoriPackages.GetPackage(n);if(T.isErr(u))return J([`error: failed to retrieve package: ${n.toString()}`]);let i=new Set(u.value.docs.map(m=>m.uri.toString())),s=e.shared.workspace.IndexManager.allElements(void 0,i).toArray().filter(m=>m.name===o);if(s.length<1)return J([`error: no artifact named defined in ${n.toString()}`]);if(s.length>2)return J([`error: too many matches in ${n.toString()}`]);let a=s[0].node;if(!(ra(a)||oa(a)||ta(a)))return J([`invalid reference to node of type: ${a.$type}`]);if(!Io.getDocument(a).uri.fsPath.endsWith(".h.kumori")){if(!a.name.value.ref)return J(["no headers found for component"]);a=a.name.value.ref}let D=e.validation.KumoriTypeSystem,l=e.validation.KumoriValidations.ctx(),[d,p]=D.Infer(l,a);if(p.length>0){let m=[];return p.map(g=>m.concat(g.message)),J([`type inference failed with errors: ${m}`])}let f=await Vo(e,t,d,we.join(t.Current.Manifest.module,r+"@"+o));return T.mapErr(f,m=>m.map(Ro))}async function Vo(e,t,r,o){return T.map(await Y({svcs:e,mod:t},r),n=>F({$schema:"https://json-schema.org/draft/2020-12/schema",$spec:"kumori/schema/v1",$id:o},n))}async function Y(e,t){if(ko.is(t))return j({});if(qs.is(t))return Y(e,t.returns);if(Po.is(t))return Y(e,t.inner);if(Qs.is(t))return Y(e,t.spec);if(zs.is(t))return t.literal===void 0?j({type:"number"}):j({const:t.literal});if(Ws.is(t))return t.literal===void 0?j({type:"string"}):j({const:t.literal});if(Vs.is(t))return t.literal===void 0?j({type:"boolean"}):j({const:t.literal});if(Gs.is(t)){let r=await Y(e,t.restriction);return T.isErr(r)?r:j({type:"array",items:r.value})}if(Js.is(t)){let r=await Promise.all(t.variations.map(u=>Y(e,u))),o=r.filter(T.isErr).map(u=>u.err).flat();if(o.length>0)return J(o);let n=r.filter(T.isOk).map(u=>u.value);return Ie(n.length===r.length),j({oneOf:n})}if(Hs.is(t)){let r=await Promise.all(Object.entries(t.parameters).map(async i=>({key:i[0],value:i[1],schema:await Y(e,i[1].value)}))),o=r.map(i=>i.schema).filter(i=>T.isErr(i)).map(i=>i.err).flat(),n=_s;if(t.restriction!==void 0&&!ko.is(t.restriction)){let i=await Y(e,t.restriction);T.isOk(i)?n=js(i.value):o=o.concat(i.err)}if(o.length>0)return J(o);let u={type:"object",properties:Object.fromEntries(r.map(i=>(Ie(T.isOk(i.schema)),[i.key,i.schema.value]))),required:r.filter(i=>i.value.optional===!1&&!Po.is(i.value.value)).map(i=>i.key)};return To.isSome(n)&&(u=x(F({},u),{additionalProperties:n.value})),j(u)}if(Ys.is(t)){let r=await Y(e,t.spec);return T.isErr(r)?r:j({type:"object",properties:{$kdsl:{const:{NamedType:await la(e,t)}},inner:r.value},required:["$kdsl","inner"]})}return J([Zs.create({node:t,message:`cannot convert definition to JSONSchema: ${Xs(t)}`})])}var sa,aa,jo,la,Kt=b(()=>{"use strict";Ee();Qe();Mo();Pt();sa={Register:_o};aa="extracts jsonschema for a specified module and artifact",jo=`
|
|
63
|
+
Generates and outputs the JSON Schema that describes a particular Kumori DSL
|
|
64
|
+
artifact. This schema defines the artifact's configurable properties, resource
|
|
65
|
+
requirements, and overall structure, making it valuable for programmatic
|
|
66
|
+
interaction, validation, or documentation purposes.
|
|
67
|
+
|
|
68
|
+
The command allows you to specify artifacts from both remote/external modules
|
|
69
|
+
and local modules.
|
|
70
|
+
`.trim();la=async(e,t)=>{let r=t.node;Ie(r);let o=e.svcs.shared.references.KumoriModules,n=Io.getDocument(r).uri,u=e.svcs.references.KumoriPackages.GetPackage(r),i=e.mod.Current;if(Ie(T.isOk(u)),n.scheme===na)return{Import:u.value.uri.path.slice(1),Name:t.meta.name};if(!(await ia(e.svcs.shared,e.mod.Root.Root)).map(d=>d.fsPath).includes(n.fsPath)){let d=o.getModule(n);Ie(T.isOk(d)),i=d.value}let D=i.Root,l=u.value.uri.fsPath.slice(D.fsPath.length);return{Import:we.join(i.Manifest.module,l),Name:t.meta.name}}});var Gt,Ne,_e,qo=b(()=>{Gt=e=>e.name==="backspace",Ne=e=>e.name==="tab",_e=e=>e.name==="enter"||e.name==="return"});var ot,nt,je,it,ut,st=b(()=>{ot=class extends Error{constructor(r){super();B(this,"name","AbortPromptError");B(this,"message","Prompt was aborted");this.cause=r==null?void 0:r.cause}},nt=class extends Error{constructor(){super(...arguments);B(this,"name","CancelPromptError");B(this,"message","Prompt was canceled")}},je=class extends Error{constructor(){super(...arguments);B(this,"name","ExitPromptError")}},it=class extends Error{constructor(){super(...arguments);B(this,"name","HookError")}},ut=class extends Error{constructor(){super(...arguments);B(this,"name","ValidationError")}}});import{AsyncLocalStorage as Ea,AsyncResource as ya}from"async_hooks";function wa(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function zo(e,t){let r=wa(e);return Go.run(r,()=>{function o(n){r.handleChange=()=>{r.index=0,n()},r.handleChange()}return t(o)})}function De(){let e=Go.getStore();if(!e)throw new it("[Inquirer] Hook functions can only be called from within a prompt");return e}function zt(){return De().rl}function Wt(e){let t=(...r)=>{let o=De(),n=!1,u=o.handleChange;o.handleChange=()=>{n=!0};let i=e(...r);return n&&u(),o.handleChange=u,i};return ya.bind(t)}function at(e){let t=De(),{index:r}=t,o={get(){return t.hooks[r]},set(u){t.hooks[r]=u},initialized:r in t.hooks},n=e(o);return t.index++,n}function Wo(){De().handleChange()}var Go,ce,Be=b(()=>{st();Go=new Ea;ce={queue(e){let t=De(),{index:r}=t;t.hooksEffect.push(()=>{var n,u;(u=(n=t.hooksCleanup)[r])==null||u.call(n);let o=e(zt());if(o!=null&&typeof o!="function")throw new ut("useEffect return value must be a cleanup function or nothing.");t.hooksCleanup[r]=o})},run(){let e=De();Wt(()=>{e.hooksEffect.forEach(t=>{t()}),e.hooksEffect.length=0})()},clearAll(){let e=De();e.hooksCleanup.forEach(t=>{t==null||t()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}}});import{AsyncResource as va}from"async_hooks";function N(e){return at(t=>{let r=va.bind(function(u){t.get()!==u&&(t.set(u),Wo())});if(t.initialized)return[t.get(),r];let o=typeof e=="function"?e():e;return t.set(o),[o,r]})}var lt=b(()=>{Be()});function de(e,t){at(r=>{let o=r.get();(!Array.isArray(o)||t.some((u,i)=>!Object.is(u,o[i])))&&ce.queue(e),r.set(t)})}var Dt=b(()=>{Be()});import Z from"process";function Ba(){return Z.platform!=="win32"?Z.env.TERM!=="linux":!!Z.env.WT_SESSION||!!Z.env.TERMINUS_SUBLIME||Z.env.ConEmuTask==="{cmd::Cmder}"||Z.env.TERM_PROGRAM==="Terminus-Sublime"||Z.env.TERM_PROGRAM==="vscode"||Z.env.TERM==="xterm-256color"||Z.env.TERM==="alacritty"||Z.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ho,Qo,ba,xa,Sa,La,Aa,Yo,Pm,Zo=b(()=>{Ho={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Qo={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},ba={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},xa=F(F({},Ho),Qo),Sa=F(F({},Ho),ba),La=Ba(),Aa=La?xa:Sa,Yo=Aa,Pm=Object.entries(Qo)});import{styleText as q}from"util";var Xo,en=b(()=>{Zo();Xo={prefix:{idle:q("blue","?"),done:q("green",Yo.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map(e=>q("yellow",e))},style:{answer:e=>q("cyan",e),message:e=>q("bold",e),error:e=>q("red",`> ${e}`),defaultAnswer:e=>q("dim",`(${e})`),help:e=>q("dim",e),highlight:e=>q("cyan",e),key:e=>q("cyan",q("bold",`<${e}>`))}}});function tn(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function rn(...e){let t={};for(let r of e)for(let[o,n]of Object.entries(r)){let u=t[o];t[o]=tn(u)&&tn(n)?rn(u,n):n}return t}function me(...e){let t=[Xo,...e.filter(r=>r!=null)];return rn(...t)}var Ht=b(()=>{en()});function Ue({status:e="idle",theme:t}){var c;let[r,o]=N(!1),[n,u]=N(0),{prefix:i,spinner:s}=me(t);return de(()=>{if(e==="loading"){let D,l=-1,d=setTimeout(()=>{o(!0),D=setInterval(()=>{l=l+1,u(l%s.frames.length)},s.interval)},300);return()=>{clearTimeout(d),clearInterval(D)}}else o(!1)},[e]),r?s.frames[n]:typeof i=="string"?i:(c=i[e==="loading"?"idle":e])!=null?c:i.idle}var on=b(()=>{lt();Dt();Ht()});function nn(e){return N({current:e})[0]}var un=b(()=>{lt()});function Ke(e){let t=nn(e);t.current=e,de(r=>{let o=!1,n=Wt((u,i)=>{o||t.current(i,r)});return r.input.on("keypress",n),()=>{o=!0,r.input.removeListener("keypress",n)}},[])}var sn=b(()=>{un();Dt();Be()});var ln=vt((Zm,an)=>{"use strict";an.exports=Ra;function Oa(e){let t={defaultWidth:0,output:process.stdout,tty:Fr("tty")};return e?(Object.keys(t).forEach(function(r){e[r]||(e[r]=t[r])}),e):t}function Ra(e){let t=Oa(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let r=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(r)&&r!==0)return r}return t.defaultWidth}});function Qt({onlyFirst:e=!1}={}){let n="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(n,e?void 0:"g")}var Dn=b(()=>{});function Ve(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Ma,"")}var Ma,Yt=b(()=>{Dn();Ma=Qt()});function cn(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function dn(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function mn(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}var fn=b(()=>{});function ka(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function pn(e,{ambiguousAsWide:t=!1}={}){return ka(e),dn(e)||mn(e)||t&&cn(e)?2:1}var hn=b(()=>{fn()});var gn=vt((sf,Fn)=>{Fn.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function fe(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:o=!1}=t;if(o||(e=Ve(e)),e.length===0)return 0;let n=0,u={ambiguousAsWide:!r};for(let{segment:i}of Pa.segment(e)){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159)&&!(s>=8203&&s<=8207||s===65279)&&!(s>=768&&s<=879||s>=6832&&s<=6911||s>=7616&&s<=7679||s>=8400&&s<=8447||s>=65056&&s<=65071)&&!(s>=55296&&s<=57343)&&!(s>=65024&&s<=65039)&&!Ta.test(i)){if((0,Cn.default)().test(i)){n+=2;continue}n+=pn(s,u)}}return n}var Cn,Pa,Ta,En=b(()=>{Yt();hn();Cn=Bt(gn(),1),Pa=new Intl.Segmenter,Ta=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Na(){let e=new Map;for(let[t,r]of Object.entries(L)){for(let[o,n]of Object.entries(r))L[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[o]=L[o],e.set(n[0],n[1]);Object.defineProperty(L,t,{value:r,enumerable:!1})}return Object.defineProperty(L,"codes",{value:e,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=yn(),L.color.ansi256=wn(),L.color.ansi16m=vn(),L.bgColor.ansi=yn(10),L.bgColor.ansi256=wn(10),L.bgColor.ansi16m=vn(10),Object.defineProperties(L,{rgbToAnsi256:{value(t,r,o){return t===r&&r===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[o]=r;o.length===3&&(o=[...o].map(u=>u+u).join(""));let n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>L.rgbToAnsi256(...L.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,o,n;if(t>=232)r=((t-232)*10+8)/255,o=r,n=r;else{t-=16;let s=t%36;r=Math.floor(t/36)/5,o=Math.floor(s/6)/5,n=s%6/5}let u=Math.max(r,o,n)*2;if(u===0)return 30;let i=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(r));return u===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(t,r,o)=>L.ansi256ToAnsi(L.rgbToAnsi256(t,r,o)),enumerable:!1},hexToAnsi:{value:t=>L.ansi256ToAnsi(L.hexToAnsi256(t)),enumerable:!1}}),L}var yn,wn,vn,L,cf,$a,Ia,df,_a,Bn,bn=b(()=>{yn=(e=0)=>t=>`\x1B[${t+e}m`,wn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,vn=(e=0)=>(t,r,o)=>`\x1B[${38+e};2;${t};${r};${o}m`,L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},cf=Object.keys(L.modifier),$a=Object.keys(L.color),Ia=Object.keys(L.bgColor),df=[...$a,...Ia];_a=Na(),Bn=_a});function er(e,t,r){return String(e).normalize().replaceAll(`\r
|
|
71
|
+
`,`
|
|
72
|
+
`).split(`
|
|
73
|
+
`).map(o=>Ja(o,t,r)).join(`
|
|
74
|
+
`)}var dt,ja,Xt,Ln,Ua,An,ct,xn,Sn,Ka,Zt,Va,Ja,On=b(()=>{En();Yt();bn();dt=new Set(["\x1B","\x9B"]),ja=39,Xt="\x07",Ln="[",Ua="]",An="m",ct=`${Ua}8;;`,xn=e=>`${dt.values().next().value}${Ln}${e}${An}`,Sn=e=>`${dt.values().next().value}${ct}${e}${Xt}`,Ka=e=>e.split(" ").map(t=>fe(t)),Zt=(e,t,r)=>{let o=[...t],n=!1,u=!1,i=fe(Ve(e.at(-1)));for(let[s,a]of o.entries()){let c=fe(a);if(i+c<=r?e[e.length-1]+=a:(e.push(a),i=0),dt.has(a)&&(n=!0,u=o.slice(s+1,s+1+ct.length).join("")===ct),n){u?a===Xt&&(n=!1,u=!1):a===An&&(n=!1);continue}i+=c,i===r&&s<o.length-1&&(e.push(""),i=0)}!i&&e.at(-1).length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Va=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(fe(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Ja=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let o="",n,u,i=Ka(e),s=[""];for(let[l,d]of e.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s.at(-1).trimStart());let p=fe(s.at(-1));if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&i[l]>t){let f=t-p,m=1+Math.floor((i[l]-f-1)/t);Math.floor((i[l]-1)/t)<m&&s.push(""),Zt(s,d,t);continue}if(p+i[l]>t&&p>0&&i[l]>0){if(r.wordWrap===!1&&p<t){Zt(s,d,t);continue}s.push("")}if(p+i[l]>t&&r.wordWrap===!1){Zt(s,d,t);continue}s[s.length-1]+=d}r.trim!==!1&&(s=s.map(l=>Va(l)));let a=s.join(`
|
|
75
|
+
`),c=[...a],D=0;for(let[l,d]of c.entries()){if(o+=d,dt.has(d)){let{groups:f}=new RegExp(`(?:\\${Ln}(?<code>\\d+)m|\\${ct}(?<uri>.*)${Xt})`).exec(a.slice(D))||{groups:{}};if(f.code!==void 0){let m=Number.parseFloat(f.code);n=m===ja?void 0:m}else f.uri!==void 0&&(u=f.uri.length===0?void 0:f.uri)}let p=Bn.codes.get(Number(n));c[l+1]===`
|
|
76
|
+
`?(u&&(o+=Sn("")),n&&p&&(o+=xn(p))):d===`
|
|
77
|
+
`&&(n&&p&&(o+=xn(n)),u&&(o+=Sn(u))),D+=d.length}return o}});function tr(e,t){return e.split(`
|
|
78
|
+
`).flatMap(r=>er(r,t,{trim:!1,hard:!0}).split(`
|
|
79
|
+
`).map(o=>o.trimEnd())).join(`
|
|
80
|
+
`)}function Mn(){return(0,Rn.default)({defaultWidth:80,output:zt().output})}var Rn,kn=b(()=>{Rn=Bt(ln(),1);On();Be()});var Tn=vt((yf,Pn)=>{var qa=Fr("stream"),be,xe,mt,Se,ft,rr=class extends qa{constructor(r={}){super(r);$(this,xe);$(this,Se);$(this,be,null);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=r.replace,this._prompt=r.prompt||null,this._hadControl=!1}get isTTY(){return w(this,be)!==null?w(this,be):z(this,xe,mt).call(this,"isTTY",!1)}set isTTY(r){ee(this,be,r)}get rows(){return z(this,xe,mt).call(this,"rows")}get columns(){return z(this,xe,mt).call(this,"columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(r){this._src=r}pipe(r,o){return this._dest=r,super.pipe(r,o)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(r){if(this.muted){if(!this.replace)return!0;if(r.match(/^\u001b/))return r.indexOf(this._prompt)===0&&(r=r.slice(this._prompt.length),r=r.replace(/./g,this.replace),r=this._prompt+r),this._hadControl=!0,this.emit("data",r);this._prompt&&this._hadControl&&r.indexOf(this._prompt)===0&&(this._hadControl=!1,this.emit("data",this._prompt),r=r.slice(this._prompt.length)),r=r.toString().replace(/./g,this.replace)}this.emit("data",r)}end(r){this.muted&&(r&&this.replace?r=r.toString().replace(/./g,this.replace):r=null),r&&this.emit("data",r),this.emit("end")}destroy(...r){return z(this,Se,ft).call(this,"destroy",...r)}destroySoon(...r){return z(this,Se,ft).call(this,"destroySoon",...r)}close(...r){return z(this,Se,ft).call(this,"close",...r)}};be=new WeakMap,xe=new WeakSet,mt=function(r,o){return this._dest?this._dest[r]:this._src?this._src[r]:o},Se=new WeakSet,ft=function(r,...o){var n,u;typeof((n=this._dest)==null?void 0:n[r])=="function"&&this._dest[r](...o),typeof((u=this._src)==null?void 0:u[r])=="function"&&this._src[r](...o)};Pn.exports=rr});var pe,$n=b(()=>{pe=[];pe.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&pe.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&pe.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var pt,or,nr,Ga,ir,ht,za,ur,Ft,U,A,Le,Ae,he,oe,gt,In,Ct,Nn,sr,ar,_n,bf,xf,jn=b(()=>{$n();pt=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",or=Symbol.for("signal-exit emitter"),nr=globalThis,Ga=Object.defineProperty.bind(Object),ir=class{constructor(){B(this,"emitted",{afterExit:!1,exit:!1});B(this,"listeners",{afterExit:[],exit:[]});B(this,"count",0);B(this,"id",Math.random());if(nr[or])return nr[or];Ga(nr,or,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let o=this.listeners[t],n=o.indexOf(r);n!==-1&&(n===0&&o.length===1?o.length=0:o.splice(n,1))}emit(t,r,o){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let u of this.listeners[t])n=u(r,o)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,o)||n),n}},ht=class{},za=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),ur=class extends ht{onExit(){return()=>{}}load(){}unload(){}},sr=class extends ht{constructor(r){super();$(this,gt);$(this,Ct);$(this,Ft,ar.platform==="win32"?"SIGINT":"SIGHUP");$(this,U,new ir);$(this,A,void 0);$(this,Le,void 0);$(this,Ae,void 0);$(this,he,{});$(this,oe,!1);ee(this,A,r),ee(this,he,{});for(let o of pe)w(this,he)[o]=()=>{let n=w(this,A).listeners(o),{count:u}=w(this,U),i=r;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(u+=i.__signal_exit_emitter__.count),n.length===u){this.unload();let s=w(this,U).emit("exit",null,o),a=o==="SIGHUP"?w(this,Ft):o;s||r.kill(r.pid,a)}};ee(this,Ae,r.reallyExit),ee(this,Le,r.emit)}onExit(r,o){if(!pt(w(this,A)))return()=>{};w(this,oe)===!1&&this.load();let n=o!=null&&o.alwaysLast?"afterExit":"exit";return w(this,U).on(n,r),()=>{w(this,U).removeListener(n,r),w(this,U).listeners.exit.length===0&&w(this,U).listeners.afterExit.length===0&&this.unload()}}load(){if(!w(this,oe)){ee(this,oe,!0),w(this,U).count+=1;for(let r of pe)try{let o=w(this,he)[r];o&&w(this,A).on(r,o)}catch(o){}w(this,A).emit=(r,...o)=>z(this,Ct,Nn).call(this,r,...o),w(this,A).reallyExit=r=>z(this,gt,In).call(this,r)}}unload(){w(this,oe)&&(ee(this,oe,!1),pe.forEach(r=>{let o=w(this,he)[r];if(!o)throw new Error("Listener not defined for signal: "+r);try{w(this,A).removeListener(r,o)}catch(n){}}),w(this,A).emit=w(this,Le),w(this,A).reallyExit=w(this,Ae),w(this,U).count-=1)}};Ft=new WeakMap,U=new WeakMap,A=new WeakMap,Le=new WeakMap,Ae=new WeakMap,he=new WeakMap,oe=new WeakMap,gt=new WeakSet,In=function(r){return pt(w(this,A))?(w(this,A).exitCode=r||0,w(this,U).emit("exit",w(this,A).exitCode,null),w(this,Ae).call(w(this,A),w(this,A).exitCode)):0},Ct=new WeakSet,Nn=function(r,...o){let n=w(this,Le);if(r==="exit"&&pt(w(this,A))){typeof o[0]=="number"&&(w(this,A).exitCode=o[0]);let u=n.call(w(this,A),r,...o);return w(this,U).emit("exit",w(this,A).exitCode,null),u}else return n.call(w(this,A),r,...o)};ar=globalThis.process,{onExit:_n,load:bf,unload:xf}=za(pt(ar)?new sr(ar):new ur)});var ne,Wa,Af,Kn,lr,Dr,cr,Un,dr,Vn=b(()=>{ne="\x1B[",Wa=ne+"G",Af=ne+"?25l",Kn=ne+"?25h",lr=(e=1)=>e>0?`${ne}${e}A`:"",Dr=(e=1)=>e>0?`${ne}${e}B`:"",cr=(e,t)=>typeof t=="number"&&!Number.isNaN(t)?`${ne}${t+1};${e+1}H`:`${ne}${e+1}G`,Un=ne+"2K",dr=e=>e>0?(Un+lr(1)).repeat(e-1)+Un+Wa:""});import{stripVTControlCharacters as Ha}from"util";var Jn,Qa,Je,qn=b(()=>{kn();Vn();Jn=e=>e.split(`
|
|
81
|
+
`).length,Qa=e=>{var t;return(t=e.split(`
|
|
82
|
+
`).pop())!=null?t:""},Je=class{constructor(t){B(this,"height",0);B(this,"extraLinesUnderPrompt",0);B(this,"cursorPos");B(this,"rl");this.rl=t,this.cursorPos=t.getCursorPos()}write(t){this.rl.output.unmute(),this.rl.output.write(t),this.rl.output.mute()}render(t,r=""){let o=Qa(t),n=Ha(o),u=n;this.rl.line.length>0&&(u=u.slice(0,-this.rl.line.length)),this.rl.setPrompt(u),this.cursorPos=this.rl.getCursorPos();let i=Mn();t=tr(t,i),r=tr(r,i),n.length%i===0&&(t+=`
|
|
83
|
+
`);let s=t+(r?`
|
|
84
|
+
`+r:""),c=Math.floor(n.length/i)-this.cursorPos.rows+(r?Jn(r):0);c>0&&(s+=lr(c)),s+=cr(this.cursorPos.cols),this.write(Dr(this.extraLinesUnderPrompt)+dr(this.height)+s),this.extraLinesUnderPrompt=c,this.height=Jn(s)}checkCursorPos(){let t=this.rl.getCursorPos();t.cols!==this.cursorPos.cols&&(this.write(cr(t.cols)),this.cursorPos=t)}done({clearContent:t}){this.rl.setPrompt("");let r=Dr(this.extraLinesUnderPrompt);r+=t?dr(this.height):`
|
|
85
|
+
`,r+=Kn,this.write(r),this.rl.close()}}});var Et,Gn=b(()=>{Et=class extends Promise{static withResolver(){let t,r;return{promise:new Promise((n,u)=>{t=n,r=u}),resolve:t,reject:r}}}});import*as zn from"readline";import{AsyncResource as Ya}from"async_hooks";function Za(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(r,o)=>{let n=o.slice(1);return t=n,n},new Error().stack}catch(r){return t}return Error.prepareStackTrace=e,t}function qe(e){let t=Za();return(o,n={})=>{var h;let{input:u=process.stdin,signal:i}=n,s=new Set,a=new Wn.default;a.pipe((h=n.output)!=null?h:process.stdout);let c=zn.createInterface({terminal:!0,input:u,output:a}),D=new Je(c),{promise:l,resolve:d,reject:p}=Et.withResolver(),f=()=>p(new nt);if(i){let C=()=>p(new ot({cause:i.reason}));if(i.aborted)return C(),Object.assign(l,{cancel:f});i.addEventListener("abort",C),s.add(()=>i.removeEventListener("abort",C))}s.add(_n((C,E)=>{p(new je(`User force closed the prompt with ${C} ${E}`))}));let m=()=>p(new je("User force closed the prompt with SIGINT"));c.on("SIGINT",m),s.add(()=>c.removeListener("SIGINT",m));let g=()=>D.checkCursorPos();return c.input.on("keypress",g),s.add(()=>c.input.removeListener("keypress",g)),zo(c,C=>{let E=Ya.bind(()=>ce.clearAll());return c.on("close",E),s.add(()=>c.removeListener("close",E)),C(()=>{var y;try{let S=e(o,K=>{setImmediate(()=>d(K))});if(S===void 0){let K=(y=t[1])==null?void 0:y.getFileName();throw new Error(`Prompt functions must return a string.
|
|
86
|
+
at ${K}`)}let[O,G]=typeof S=="string"?[S]:S;D.render(O,G),ce.run()}catch(S){p(S)}}),Object.assign(l.then(y=>(ce.clearAll(),y),y=>{throw ce.clearAll(),y}).finally(()=>{s.forEach(y=>y()),D.done({clearContent:!!n.clearPromptOnDone}),a.end()}).then(()=>l),{cancel:f})})}}var Wn,Hn=b(()=>{Wn=Bt(Tn(),1);jn();qn();Gn();Be();st()});var mr=b(()=>{qo();st();on();lt();Dt();sn();Ht();Hn()});function Qn(e,t){let r=t!==!1;return/^(y|yes)/i.test(e)?r=!0:/^(n|no)/i.test(e)&&(r=!1),r}function Yn(e){return e?"Yes":"No"}var Ge,Zn=b(()=>{mr();Ge=qe((e,t)=>{let{transformer:r=Yn}=e,[o,n]=N("idle"),[u,i]=N(""),s=me(e.theme),a=Ue({status:o,theme:s});Ke((d,p)=>{if(o==="idle")if(_e(d)){let f=Qn(u,e.default);i(r(f)),n("done"),t(f)}else if(Ne(d)){let f=Yn(!Qn(u,e.default));p.clearLine(0),p.write(f),i(f)}else i(p.line)});let c=u,D="";o==="done"?c=s.style.answer(u):D=` ${s.style.defaultAnswer(e.default===!1?"y/N":"Y/n")}`;let l=s.style.message(e.message,o);return`${a} ${l}${D} ${c}`})});var Xa,ie,Xn=b(()=>{mr();Xa={validationFailureMode:"keep"},ie=qe((e,t)=>{let{prefill:r="tab"}=e,o=me(Xa,e.theme),[n,u]=N("idle"),[i="",s]=N(e.default),[a,c]=N(),[D,l]=N(""),d=Ue({status:n,theme:o});async function p(C){let{required:E,pattern:y,patternError:S="Invalid input"}=e;return E&&!C?"You must provide a value":y&&!y.test(C)?S:typeof e.validate=="function"?await e.validate(C)||"You must provide a valid value":!0}Ke(async(C,E)=>{if(n==="idle")if(_e(C)){let y=D||i;u("loading");let S=await p(y);S===!0?(l(y),u("done"),t(y)):(o.validationFailureMode==="clear"?l(""):E.write(D),c(S),u("idle"))}else Gt(C)&&!D?s(void 0):Ne(C)&&!D?(s(void 0),E.clearLine(0),E.write(i),l(i)):(l(E.line),c(void 0))}),de(C=>{r==="editable"&&i&&(C.write(i),l(i))},[]);let f=o.style.message(e.message,n),m=D;typeof e.transformer=="function"?m=e.transformer(D,{isFinal:n==="done"}):n==="done"&&(m=o.style.answer(D));let g;i&&n!=="done"&&!D&&(g=o.style.defaultAnswer(i));let h="";return a&&(h=o.style.error(a)),[[d,f,g,m].filter(C=>C!==void 0).join(" "),h]})});var ei=b(()=>{Zn();Xn()});var ii={};ue(ii,{Action:()=>ni,Description:()=>ri,Register:()=>oi,default:()=>sl});import{createKumoriServices as el}from"@kumori/kdsl-lsp/language/kumori.js";import{NodeFileSystem as tl}from"langium/node";import{ModuleContext as rl}from"@kumori/kdsl-lsp/module/context.js";import{URI as Fe}from"langium";import X from"path";import{Result as ti}from"@kumori/kdsl-lsp/util/result.js";import{RegistryManager as ol}from"@kumori/kdsl-lsp/module/registry/manager.js";import{GatherModuleDocuments as nl}from"@kumori/kdsl-lsp/module/documents.js";import{promises as yt}from"fs";import{CalculateChecksum as il}from"@kumori/kdsl-lsp/module/integrity/checksum.js";function oi(e,t){return e.command("create").option("--module <module>","Path to the module to generate the index entry for. It can be either a relative or absolute path. Defaults to the current directory.").option("--index <index>","Path to the index file to append the new entry to. It can be either a relative or absolute path. If not provided, the entry will be printed to standard output.").summary(ul).description(ri).action(ni(t))}function ni(e){return async t=>{let r=el(tl).Kumori,o=r.shared.workspace.FileSystemProvider,n=process.cwd();t.module&&(t.module[0]==="."||X.isAbsolute(t.module))&&(n=X.isAbsolute(t.module)?t.module:X.resolve(process.cwd(),t.module));let u=await rl(o,Fe.file(n));if(ti.isErr(u))throw new Error(u.err);await Q(e,r,u.value);let i=null;t.index&&(t.index[0]==="."||X.isAbsolute(t.index)?i=X.isAbsolute(t.index)?t.index:X.resolve(process.cwd(),t.index):i=X.resolve(process.cwd(),t.index)),console.log(i);let s=null;if(i)try{let m=null;try{m=await o.readFile(Fe.file(i))}catch(C){m=""}if(m===null||m===""){s={modules:[]},e.info(`Index file at ${i} is either missing or empty. A new one will be created.`);try{await yt.mkdir(X.dirname(i),{recursive:!0}),await yt.writeFile(Fe.file(i).fsPath,JSON.stringify(s,null,2)),e.info(`Created new index file at ${i}`)}catch(C){e.error(`Failed to create new index file at ${i}: ${C}`);return}}try{m=await o.readFile(Fe.file(i)),s=await JSON.parse(m)}catch(C){throw new Error(`Failed to parse index file at ${i}: ${C}`)}if(!new ol().validateIndexSchema(s))throw new Error(`Index schema validation failed for ${i}`)}catch(m){e.error(`Failed to read index file at ${i}: ${m}`);return}let a;if(s!=null&&s.modules&&(a=s.modules.find(m=>m.domain===u.value.Current.Manifest.module&&m.version===u.value.Current.Manifest.version)),a&&(e.warn(`Module ${a.domain} version ${a.version} already exists in the index file at ${i}. Proceeding will override the current entry.`),!await Ge({message:"Do you want to proceed anyway?",default:!1}))){e.info("Aborting index entry creation.");return}let c=await nl(r.shared,u.value.Current.Root),D={};for(let m of c)if(X.basename(m.path).endsWith(".h.kumori")){let h=m.path.substring(Fe.parse(n).fsPath.length),C=X.dirname(h),y=(await o.readFile(m)).split(`
|
|
87
|
+
`);for(let S of y){let O=S.match(/service\s+(\w+)/),G=S.match(/component\s+(\w+)/);O?D[C]={name:O[1],type:"service"}:G&&(D[C]={name:G[1],type:"component"})}}let l=u.value.Current.Manifest,d=await il(n),p=await ie({message:"Enter the module location (remember it has to be a valid Git repository):",required:!0}),f={domain:l.module,version:l.version,location:p,checksum:d,releaseDate:new Date().toISOString().split("T")[0],artifacts:[]};for(let[m,g]of Object.entries(D)){if(!await Ge({message:`Do you want to include artifact ${g.name} located at route ${m} in the index?`,default:!0}))continue;let C=await et(r,u.value,m,g.name);if(ti.isErr(C))throw new Error(`Failed to generate JSON Schema for artifact ${g.name} at route ${m}: ${C.err}`);let E=await ie({message:`Enter the route for artifact ${g.name} (default: ${m}):`,default:m,required:!0}),y=await ie({message:`Enter a description for artifact ${g.name} (optional):`}),S=await Ge({message:`Do you want to publish artifact ${g.name} to the marketplace?`,default:!0}),O=await ie({message:`Enter an icon route for artifact ${g.name}. This is an optional field and it should be a path to an image file within the artifact route.
|
|
88
|
+
For example, your icon could be located at ${E}/icon.png or ${E}/img/icon.jpg`}),G=await ie({message:`Enter categories for artifact ${g.name}, separated by commas. For example: utility,network,storage (optional):`}).then(R=>R?R.split(",").map(M=>M.trim()):[]),K=await ie({message:`Enter tags for artifact ${g.name}, separated by commas. For example: sql,database,relational (optional):`}).then(R=>R?R.split(",").map(M=>M.trim()):[]);f.artifacts.push({name:g.name,description:y,location:E,type:g.type,marketplace:S,schema:C.value,icon:O,categories:G,tags:K})}if(i&&s)if(a){s.modules=s.modules.map(g=>g.domain===a.domain&&g.version===a.version?f:g);let m=JSON.stringify(s,null,2);await yt.writeFile(Fe.file(i).fsPath,m),e.info(`Updated module entry in index file at ${i}`)}else{s.modules.push(f);let m=JSON.stringify(s,null,2);await yt.writeFile(Fe.file(i).fsPath,m),e.info(`Appended new module entry to index file at ${i}`)}else console.log(JSON.stringify({modules:[f]},null,2))}}var ul,ri,sl,ui=b(()=>{"use strict";ei();Kt();Ee();ul="Creates an index file",ri=`
|
|
89
|
+
Creates a new index file entry for the current module. Additionally, you can provide
|
|
90
|
+
the location of the module from which generate the entry for.
|
|
91
|
+
|
|
92
|
+
This command will generate the entry for the current module:
|
|
93
|
+
kdsl index create
|
|
94
|
+
|
|
95
|
+
Or you can provide a module location to generate the entry for:
|
|
96
|
+
kdsl index create --module path/to/module
|
|
97
|
+
|
|
98
|
+
The generated index entry will be printed to the standard output. However, you can directly add
|
|
99
|
+
the new entry onto an existing index file by providing the --index option:
|
|
100
|
+
kdsl index create --index path/to/index/file.json
|
|
101
|
+
|
|
102
|
+
If the index file is empty, a new index file will be created with just the new entry. Otherwise,
|
|
103
|
+
if the index file already contains entries, the new entry will be appended to the existing ones.
|
|
104
|
+
`.trim(),sl={Register:oi}});var _=function(e){return e.info="info",e.warn="warn",e.error="error",e.debug="debug",e.trace="trace",e.fatal="fatal",e}({}),cl={[_.trace]:10,[_.debug]:20,[_.info]:30,[_.warn]:40,[_.error]:50,[_.fatal]:60},dl={10:_.trace,20:_.debug,30:_.info,40:_.warn,50:_.error,60:_.fatal};var I=function(e){return e.onBeforeDataOut="onBeforeDataOut",e.shouldSendToLogger="shouldSendToLogger",e.onMetadataCalled="onMetadataCalled",e.onBeforeMessageOut="onBeforeMessageOut",e.onContextCalled="onContextCalled",e}({});var v=function(e){return e.info="info",e.warn="warn",e.error="error",e.debug="debug",e.trace="trace",e.fatal="fatal",e}({}),Oe={[v.trace]:10,[v.debug]:20,[v.info]:30,[v.warn]:40,[v.error]:50,[v.fatal]:60},hl={10:v.trace,20:v.debug,30:v.info,40:v.warn,50:v.error,60:v.fatal};var Er=class yr{constructor(){B(this,"context",{});B(this,"hasContext",!1)}setContext(t){if(!t){this.context={},this.hasContext=!1;return}this.context=t,this.hasContext=!0}appendContext(t){this.context=F(F({},this.context),t),this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}onChildLoggerCreated({parentContextManager:t,childContextManager:r}){if(t.hasContextData()){let o=t.getContext();r.setContext(F({},o))}}clone(){let t=new yr;return t.setContext(F({},this.context)),t.hasContext=this.hasContext,t}};var wr=class{constructor(e){B(this,"err");B(this,"metadata");B(this,"structuredLogger");B(this,"hasMetadata");B(this,"pluginManager");this.err=null,this.metadata={},this.structuredLogger=e,this.hasMetadata=!1,this.pluginManager=e.pluginManager}withMetadata(e){let{pluginManager:t,structuredLogger:{_config:{consoleDebug:r}}}=this;if(!e)return r&&console.debug("[LogLayer] withMetadata was called with no metadata; dropping."),this;let o=e;return t.hasPlugins(I.onMetadataCalled)&&(o=t.runOnMetadataCalled(e,this.structuredLogger),!o)?(r&&console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value."),this):(this.metadata=F(F({},this.metadata),o),this.hasMetadata=!0,this)}withError(e){return this.err=e,this}info(...e){this.structuredLogger.isLevelEnabled(v.info)&&(this.structuredLogger._formatMessage(e),this.formatLog(v.info,e))}warn(...e){this.structuredLogger.isLevelEnabled(v.warn)&&(this.structuredLogger._formatMessage(e),this.formatLog(v.warn,e))}error(...e){this.structuredLogger.isLevelEnabled(v.error)&&(this.structuredLogger._formatMessage(e),this.formatLog(v.error,e))}debug(...e){this.structuredLogger.isLevelEnabled(v.debug)&&(this.structuredLogger._formatMessage(e),this.formatLog(v.debug,e))}trace(...e){this.structuredLogger.isLevelEnabled(v.trace)&&(this.structuredLogger._formatMessage(e),this.formatLog(v.trace,e))}fatal(...e){this.structuredLogger.isLevelEnabled(v.fatal)&&(this.structuredLogger._formatMessage(e),this.formatLog(v.fatal,e))}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(e,t){let{muteMetadata:r}=this.structuredLogger._config,o=r?!1:this.hasMetadata;this.structuredLogger._formatLog({logLevel:e,params:t,metadata:o?this.metadata:null,err:this.err})}},Fi=[I.onBeforeDataOut,I.onMetadataCalled,I.shouldSendToLogger,I.onBeforeMessageOut,I.onContextCalled],vr=class{constructor(e){B(this,"idToPlugin");B(this,"onBeforeDataOut",[]);B(this,"shouldSendToLogger",[]);B(this,"onMetadataCalled",[]);B(this,"onBeforeMessageOut",[]);B(this,"onContextCalled",[]);this.idToPlugin={},this.mapPlugins(e),this.indexPlugins()}mapPlugins(e){for(let t of e){if(t.id||(t.id=Date.now().toString()+Math.random().toString()),this.idToPlugin[t.id])throw new Error(`[LogLayer] Plugin with id ${t.id} already exists.`);t.registeredAt=Date.now(),this.idToPlugin[t.id]=t}}indexPlugins(){this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let e=Object.values(this.idToPlugin).sort((t,r)=>t.registeredAt-r.registeredAt);for(let t of e){if(t.disabled)return;for(let r of Fi)t[r]&&t.id&&this[r].push(t.id)}}hasPlugins(e){return this[e].length>0}countPlugins(e){return e?this[e].length:Object.keys(this.idToPlugin).length}addPlugins(e){this.mapPlugins(e),this.indexPlugins()}enablePlugin(e){let t=this.idToPlugin[e];t&&(t.disabled=!1),this.indexPlugins()}disablePlugin(e){let t=this.idToPlugin[e];t&&(t.disabled=!0),this.indexPlugins()}removePlugin(e){delete this.idToPlugin[e],this.indexPlugins()}runOnBeforeDataOut(e,t){let r=F({},e);for(let o of this.onBeforeDataOut){let n=this.idToPlugin[o];if(n.onBeforeDataOut){let u=n.onBeforeDataOut({data:r.data,logLevel:r.logLevel,error:r.error,metadata:r.metadata,context:r.context},t);u&&(r.data||(r.data={}),Object.assign(r.data,u))}}return r.data}runShouldSendToLogger(e,t){return!this.shouldSendToLogger.some(r=>{var o,n;return!((n=(o=this.idToPlugin[r]).shouldSendToLogger)!=null&&n.call(o,e,t))})}runOnMetadataCalled(e,t){var o,n;let r=F({},e);for(let u of this.onMetadataCalled){let i=(n=(o=this.idToPlugin[u]).onMetadataCalled)==null?void 0:n.call(o,r,t);if(i)r=i;else return null}return r}runOnBeforeMessageOut(e,t){var o,n;let r=[...e.messages];for(let u of this.onBeforeMessageOut){let i=(n=(o=this.idToPlugin[u]).onBeforeMessageOut)==null?void 0:n.call(o,{messages:r,logLevel:e.logLevel},t);i&&(r=i)}return r}runOnContextCalled(e,t){var o,n;let r=F({},e);for(let u of this.onContextCalled){let i=(n=(o=this.idToPlugin[u]).onContextCalled)==null?void 0:n.call(o,r,t);if(i)r=i;else return null}return r}},Br=class br{constructor(t){B(this,"pluginManager");B(this,"idToTransport");B(this,"hasMultipleTransports");B(this,"singleTransport");B(this,"contextManager");B(this,"logLevelEnabledStatus",{info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0});B(this,"_config");var r;this._config=x(F({},t),{enabled:(r=t.enabled)!=null?r:!0}),this._config.enabled||this.disableLogging(),this.contextManager=new Er,this.pluginManager=new vr(t.plugins||[]),this._config.errorFieldName||(this._config.errorFieldName="err"),this._config.copyMsgOnOnlyError||(this._config.copyMsgOnOnlyError=!1),this._initializeTransports(this._config.transport)}withContextManager(t){return this.contextManager&&typeof this.contextManager[Symbol.dispose]=="function"&&this.contextManager[Symbol.dispose](),this.contextManager=t,this}getContextManager(){return this.contextManager}_initializeTransports(t){if(this.idToTransport)for(let r in this.idToTransport)this.idToTransport[r]&&typeof this.idToTransport[r][Symbol.dispose]=="function"&&this.idToTransport[r][Symbol.dispose]();this.hasMultipleTransports=Array.isArray(t)&&t.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(t)?t[0]:t,Array.isArray(t)?this.idToTransport=t.reduce((r,o)=>(r[o.id]=o,r),{}):this.idToTransport={[t.id]:t}}withPrefix(t){let r=this.child();return r._config.prefix=t,r}withContext(t){let r=t;return t?this.pluginManager.hasPlugins(I.onContextCalled)&&(r=this.pluginManager.runOnContextCalled(t,this),!r)?(this._config.consoleDebug&&console.debug("[LogLayer] Context was dropped due to plugin returning falsy value."),this):(this.contextManager.appendContext(r),this):(this._config.consoleDebug&&console.debug("[LogLayer] withContext was called with no context; dropping."),this)}clearContext(){return this.contextManager.setContext(void 0),this}getContext(){return this.contextManager.getContext()}addPlugins(t){this.pluginManager.addPlugins(t)}enablePlugin(t){this.pluginManager.enablePlugin(t)}disablePlugin(t){this.pluginManager.disablePlugin(t)}removePlugin(t){this.pluginManager.removePlugin(t)}withMetadata(t){return new wr(this).withMetadata(t)}withError(t){return new wr(this).withError(t)}child(){let t=new br(x(F({},this._config),{transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport})).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:t.contextManager,parentLogger:this,childLogger:t}),t}withFreshTransports(t){return this._config.transport=t,this._initializeTransports(t),this}withFreshPlugins(t){return this._config.plugins=t,this.pluginManager=new vr(t),this}withPluginManager(t){return this.pluginManager=t,this}errorOnly(t,r){let o=(r==null?void 0:r.logLevel)||v.error;if(!this.isLevelEnabled(o))return;let{copyMsgOnOnlyError:n}=this._config,u={logLevel:o,err:t};(n&&(r==null?void 0:r.copyMsg)!==!1||(r==null?void 0:r.copyMsg)===!0)&&(t!=null&&t.message)&&(u.params=[t.message]),this._formatLog(u)}metadataOnly(t,r=v.info){if(!this.isLevelEnabled(r))return;let{muteMetadata:o,consoleDebug:n}=this._config;if(o)return;if(!t){n&&console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let u=t;if(this.pluginManager.hasPlugins(I.onMetadataCalled)&&(u=this.pluginManager.runOnMetadataCalled(t,this),!u)){n&&console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}let i={logLevel:r,metadata:u};this._formatLog(i)}info(...t){this.isLevelEnabled(v.info)&&(this._formatMessage(t),this._formatLog({logLevel:v.info,params:t}))}warn(...t){this.isLevelEnabled(v.warn)&&(this._formatMessage(t),this._formatLog({logLevel:v.warn,params:t}))}error(...t){this.isLevelEnabled(v.error)&&(this._formatMessage(t),this._formatLog({logLevel:v.error,params:t}))}debug(...t){this.isLevelEnabled(v.debug)&&(this._formatMessage(t),this._formatLog({logLevel:v.debug,params:t}))}trace(...t){this.isLevelEnabled(v.trace)&&(this._formatMessage(t),this._formatLog({logLevel:v.trace,params:t}))}fatal(...t){this.isLevelEnabled(v.fatal)&&(this._formatMessage(t),this._formatLog({logLevel:v.fatal,params:t}))}raw(t){if(!this.isLevelEnabled(t.logLevel))return;let r={logLevel:t.logLevel,params:t.messages,metadata:t.metadata,err:t.error,context:t.context};this._formatMessage(t.messages),this._formatLog(r)}disableLogging(){for(let t of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[t]=!1;return this}enableLogging(){for(let t of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[t]=!0;return this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(t){let r=t;return r in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[r]=!0),this}disableIndividualLevel(t){let r=t;return r in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[r]=!1),this}setLevel(t){let r=Oe[t];for(let o of Object.values(v)){let n=o,u=Oe[o];this.logLevelEnabledStatus[n]=u>=r}return this}isLevelEnabled(t){let r=t;return this.logLevelEnabledStatus[r]}formatContext(t){let{contextFieldName:r,muteContext:o}=this._config;return t&&Object.keys(t).length>0&&!o?r?{[r]:F({},t)}:F({},t):{}}formatMetadata(t=null){let{metadataFieldName:r,muteMetadata:o}=this._config;return t&&!o?r?{[r]:F({},t)}:F({},t):{}}getLoggerInstance(t){let r=this.idToTransport[t];if(r)return r.getLoggerInstance()}_formatMessage(t=[]){let{prefix:r}=this._config;r&&typeof t[0]=="string"&&(t[0]=`${r} ${t[0]}`)}_formatLog({logLevel:t,params:r=[],metadata:o=null,err:n,context:u=null}){var m;let{errorSerializer:i,errorFieldInMetadata:s,muteContext:a,contextFieldName:c,metadataFieldName:D,errorFieldName:l}=this._config,d=u!==null?u:this.contextManager.getContext(),p=!!o||(a?!1:u!==null?Object.keys(u).length>0:this.contextManager.hasContextData()),f={};if(p)if(c&&c===D){let g=this.formatContext(d)[c],h=this.formatMetadata(o)[D];f={[c]:F(F({},g),h)}}else f=F(F({},this.formatContext(d)),this.formatMetadata(o));if(n){let g=i?i(n):n;s&&o&&D?f!=null&&f[D]?f[D][l]=g:f=x(F({},f),{[D]:{[l]:g}}):s&&!o&&D?f=x(F({},f),{[D]:{[l]:g}}):f=x(F({},f),{[l]:g}),p=!0}if(this.pluginManager.hasPlugins(I.onBeforeDataOut)&&(f=this.pluginManager.runOnBeforeDataOut({data:p?f:void 0,logLevel:t,error:n,metadata:o,context:d},this),f&&!p&&(p=!0)),this.pluginManager.hasPlugins(I.onBeforeMessageOut)&&(r=this.pluginManager.runOnBeforeMessageOut({messages:[...r],logLevel:t},this)),this.hasMultipleTransports){let g=this._config.transport.filter(h=>h.enabled).map(async h=>{if(!(this.pluginManager.hasPlugins(I.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...r],data:p?f:void 0,logLevel:t,transportId:h.id,error:n,metadata:o,context:d},this)))return h._sendToLogger({logLevel:t,messages:[...r],data:p?f:void 0,hasData:p,error:n,metadata:o,context:d})});Promise.all(g).catch(h=>{this._config.consoleDebug&&console.error("[LogLayer] Error executing transports:",h)})}else{if(!((m=this.singleTransport)!=null&&m.enabled)||this.pluginManager.hasPlugins(I.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...r],data:p?f:void 0,logLevel:t,transportId:this.singleTransport.id,error:n,metadata:o,context:d},this))return;this.singleTransport._sendToLogger({logLevel:t,messages:[...r],data:p?f:void 0,hasData:p,error:n,metadata:o,context:d})}}};function xr(){let e={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}};return new Br({transport:e})}function k(e){return e!=null?e:xr()}import{RegistryManager as Xu}from"@kumori/kdsl-lsp/module/registry/manager.js";import{DeploymentArtifact as Vu,isDeploymentArtifact as Ju}from"@kumori/kdsl-lsp/language/generated/ast.js";import{createKumoriServices as kc}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as qu,UriUtils as Gu}from"langium";import{NodeFileSystem as Ic}from"langium/node";import{Result as Te,Err as ye,Ok as zu}from"@kumori/kdsl-lsp/util/result.js";import{Deployment as ru}from"@kumori/kdsl-lsp/language/builtin/lib/kumori/deployment.js";import{toJSON as ou}from"@kumori/kdsl-lsp/language/type-system/toJSON.js";import{Result as nu,Err as Ot,Ok as iu}from"@kumori/kdsl-lsp/util/result.js";import{AstUtils as Tr}from"langium";import{ToUnits as Vi}from"@kumori/kdsl-lsp/util/sized.js";import{EphemeralName as gi,Ephemeral as Ci,PersistentName as Ei,Persistent as yi,RegisteredName as wi,Registered as vi,VolatileName as Bi,Volatile as bi,PersistedName as xi,Persisted as Si,NonReplicatedName as Li,NonReplicated as Ai,CAName as Oi,CA as Ri,CertificateName as Mi,SecretName as ki,Secret as Pi,DomainName as Ti,PortName as $i,Port as Ii,Domain as Ni,Certificate as _i}from"@kumori/kdsl-lsp/language/builtin/lib/kumori/resource.js";function W(e){if(e.$type===gi){let t=Ci.parse(e);return{volume:{size:t.value.size,unit:t.value.unit,kind:"storage"}}}if(e.$type===Ei)return{volume:yi.parse(e).value};if(e.$type===wi)return{volume:vi.parse(e).value};if(e.$type===Bi){let t=bi.parse(e);return{volume:{size:t.value.size,unit:t.value.unit,kind:"storage",type:"volatile"}}}if(e.$type===xi){let t=Si.parse(e);return{volume:{size:t.value.size,unit:t.value.unit,kind:"storage",type:"persistent"}}}if(e.$type===Li){let t=Ai.parse(e);return{volume:{size:t.value.size,unit:t.value.unit,kind:"storage",type:"nonreplicated"}}}if(e.$type===Oi)return{ca:Ri.parse(e).value};if(e.$type===Mi)return{certificate:_i.parse(e).value};if(e.$type===ki)return{secret:Pi.parse(e).value};if(e.$type===Ti)return{domain:Ni.parse(e).value};if(e.$type===$i)return{port:Ii.parse(e).value};throw new Error(`unknown resource type '${e.$type}'`)}import{ParseOCIString as ji}from"@kumori/kdsl-lsp/util/oci.js";import{Result as Re}from"@kumori/kdsl-lsp/util/result.js";import{AstUtils as Ui}from"langium";import{basename as Ki}from"path";function Sr(e){return typeof e=="string"?Re.orElse(Re.map(ji(e),t=>{var r,o;return{tag:t.tag,hub:{name:t.hub,secret:typeof e=="string"?"":(o=(r=e.hub)==null?void 0:r.secret)!=null?o:""}}}),t=>{throw new Error(t)}):e}function se(e,t){if(!t)return[];let r=Ui.getDocument(t).uri,o=e.getModule(r);if(Re.isErr(o))return[];let n=Re.tryCatch(()=>new URL(`file://${o.value.Manifest.module}`));if(Re.isErr(n))return[];let u=[];return n.value.hostname.length&&u.push(i=>i.domain=n.value.hostname),n.value.pathname.length&&u.push(i=>{i.module=n.value.pathname.replace(/^\//,""),i.name=Ki(i.module)}),u}import{isComponentArtifact as Ji}from"@kumori/kdsl-lsp/language/generated/ast.js";function Lr(e,t){let r={version:[0,0,0],kind:"service",domain:"unknown",module:"unknown",name:"unknown"},o=e.svcs.shared.references.KumoriModules,n=se(o,e.nodes.get(t));for(let s of n)s(r);let u=e.nodes.get(t),i="";if(u&&Ji(u)&&(i=u.name.value.$refText),i==="")throw new Error("Unable to determine component name for service artifact conversion.");return{spec:[1,0],ref:r,description:{builtin:!1,connector:{},config:{resilience:0,scale:{},parameter:{},resource:{}},role:{[i]:{name:i,meta:{},artifact:xt(e,t)}}}}}function xt(e,t){var c,D,l,d,p,f,m,g,h,C;let r={version:[0,0,0],kind:"component",domain:"unknown",module:"unknown",name:"unknown"},o=e.svcs.shared.references.KumoriModules,n=se(o,e.nodes.get(t));for(let E of n)E(r);function u(E,y=!1){return Object.fromEntries(Object.entries(E!=null?E:{}).map(([S,O])=>{var K,R;return[S,{name:S,init:y,entrypoint:O.entrypoint,image:Sr(O.image),cmd:O.cmd,size:{memory:x(F({},O.size.memory),{kind:"ram"}),cpu:x(F({},O.size.cpu),{kind:"cpu"}),mincpu:O.size.mincpu?O.size.mincpu.size:O.size.cpu.size},mapping:{filesystem:Object.fromEntries(Object.entries((K=O.fs)!=null?K:{}).map(([M,P])=>[M,qi(M,P)])),env:Object.fromEntries(Object.entries((R=O.env)!=null?R:{}).map(([M,P])=>{let V=M,ai=typeof P=="string"||typeof P=="number"||typeof P=="boolean"?{value:String(P)}:P;return[V,ai]}))}}]}))}let i=Object.fromEntries(((c=t.init)!=null?c:[]).map((E,y)=>[`INIT_${y}`,E])),s=u(t.code),a=u(i,!0);return{spec:[1,0],ref:r,description:{builtin:!1,config:{resilience:0,scale:{hsize:1},parameter:t.config,resource:Object.fromEntries(Object.entries((D=t.resource)!=null?D:{}).map(([E,y])=>[E,W(y)]))},size:{bandwidth:x(F({},t.size.bandwidth),{kind:"bandwidth"}),minbandwidth:Math.ceil(Vi((l=t.size.minbandwidth)!=null?l:t.size.bandwidth,t.size.bandwidth.unit).size),mincpu:x(F({},t.size.mincpu),{kind:"cpu"})},profile:{threadability:"*",iopsintensive:!1},srv:{client:Object.fromEntries(Object.entries((p=(d=t.srv)==null?void 0:d.client)!=null?p:{}).map(([E,y])=>[E,{protocol:y,inherited:!1}])),server:Object.fromEntries(Object.entries((m=(f=t.srv)==null?void 0:f.server)!=null?m:{}).map(([E,y])=>{let S;return typeof y=="string"?S={port:80,portnum:1,inherited:!1,protocol:y}:S=x(F({},y),{portnum:1,inherited:!1}),[E,S]})),duplex:Object.fromEntries(Object.entries((h=(g=t.srv)==null?void 0:g.duplex)!=null?h:{}).map(([E,y])=>{let S;return typeof y=="string"?S={port:80,portnum:1,inherited:!1,protocol:y}:S=x(F({},y),{portnum:1,inherited:!1}),[E,S]}))},code:F(F({},a),s),probe:Object.fromEntries(Object.entries((C=t.probe)!=null?C:{}).map(([E,y])=>[E,y]))}}}function qi(e,t){var r,o,n,u;if(typeof t=="string")return{path:e,data:{value:t},format:"text"};if(typeof t=="object"){if("volume"in t)return{path:e,volume:t.volume};if("data"in t)return{path:e,data:{value:t.data},format:(r=t.format)!=null?r:"text",mode:(o=t.mode)!=null?o:420};let s=["secret","port","domain","certificate","ca"].find(a=>a in t);if(s){let a=s;return{path:e,data:{[a]:t[a]},format:(n=t.format)!=null?n:"text",mode:(u=t.mode)!=null?u:420}}}throw new Error(`Unknown key '${e}': ${JSON.stringify(t)}`)}import{Maybe as Qi,None as Yi,Some as Zi}from"@kumori/kdsl-lsp/util/maybe.js";import{SemVer as Gi}from"@kumori/kdsl-lsp/util/semver.js";function zi(e){var r,o,n;let t=Gi(e.id.version);return{spec:[1,0],ref:{version:[t.major,t.minor,t.patch],kind:e.id.kind,domain:e.id.domain,module:e.id.module,name:e.id.name},description:{builtin:!0,srv:{client:Object.fromEntries(Object.entries((r=e.srv.client)!=null?r:{}).map(([u])=>[u,{protocol:"http",inherited:!1}])),server:Object.fromEntries(Object.entries((o=e.srv.server)!=null?o:{}).map(([u,i])=>{let s;return typeof i=="string"?s={port:80,portnum:1,inherited:!1,protocol:i}:s=x(F({},i),{inherited:!1}),[u,s]})),duplex:Object.fromEntries(Object.entries((n=e.srv.duplex)!=null?n:{}).map(([u,i])=>{let s;return typeof i=="string"?s={port:80,portnum:1,inherited:!1,protocol:i}:s=x(F({},i),{inherited:!1}),[u,s]}))},config:{resilience:0,scale:{},parameter:e.config,resource:Object.fromEntries(Object.entries(e.resource).map(([u,i])=>[u,W(i)]))},connector:{},role:{}}}}function Ar(e,t){var r,o;return{name:ae(e),up:ge(e),meta:{},config:{resilience:0,scale:{},parameter:(r=t.config)!=null?r:{},resource:Object.fromEntries(Object.entries((o=t.resource)!=null?o:{}).map(([n,u])=>[n,W(u)]))},artifact:zi(t)}}import{LoadBalancerName as Wi,FullConnectorName as Hi}from"@kumori/kdsl-lsp/language/builtin/lib/kumori/service.js";function We(e,t,r,o){let n=e.svcs.shared.references.KumoriModules,u=se(n,e.nodes.get(t));for(let i of u)i(r);return o&&(r.kind="service"),r}function St(e,t){return e.some(r=>JSON.stringify(r)===JSON.stringify(t))}function Lt(e,t){return{role:e,channel:t}}function He(e,t,r){return{meta:e,links:[{role:t,channel:r}]}}function Or(e,t,r){var n,u,i,s;let o={version:[0,0,0],kind:"component",domain:"unknown",module:"unknown",name:"unknown"};if(r.$type===Wi){r=r;let a=[],c=[];if("from"in r.value&&Array.isArray(r.value.from)&&"to"in r.value&&Array.isArray(r.value.to))for(let D of r.value.from){c.push(Lt(D.target,D.channel));for(let l of r.value.to){let d=t.role[l.target=="self"?D.target:l.target],p=te(d.artifact)||l.target=="self";We(e,d,o,p);let f=(n=r.value.meta)!=null?n:[{auto:{channel:l.target!=="self"?l.target+"."+l.channel:l.channel,compRef:o,roleName:l.target=="self"?D.target:l.target},user:{}}],m=He(f,l.target,l.channel);St(a,m)||a.push(m)}}else if("from"in r.value&&!Array.isArray(r.value.from)&&!Array.isArray(r.value.to)){let D=r.value.from,l=r.value.to;c.push(Lt(D.target,D.channel));let d=t.role[l.target=="self"?D.target:l.target],p=te(d.artifact)||l.target=="self";We(e,d,o,p);let f=(u=r.value.meta)!=null?u:[{auto:{channel:l.target!=="self"?l.target+"."+l.channel:l.channel,compRef:o,roleName:l.target=="self"?D.target:l.target},user:{}}],m=He(f,l.target,l.channel);St(a,m)||a.push(m)}return{kind:"lb",clients:c,servers:a}}if(r.$type===Hi){r=r;let a=[],c=[];if("from"in r.value&&Array.isArray(r.value.from)&&"to"in r.value&&Array.isArray(r.value.to))for(let D of r.value.from){c.push(Lt(D.target,D.channel));for(let l of r.value.to){let d=t.role[l.target=="self"?D.target:l.target],p=te(d.artifact);We(e,d,o,p);let f=(i=r.value.meta)!=null?i:[{auto:{channel:l.target!=="self"?l.target+"."+l.channel:l.channel,compRef:o,roleName:l.target=="self"?D.target:l.target},user:{}}],m=He(f,l.target,l.channel);St(a,m)||a.push(m)}}else if("target"in r.value&&"channel"in r.value){let D=t.role[r.value.target],l=te(D.artifact);We(e,D,o,l);let d=(s=r.value.meta)!=null?s:[{auto:{channel:r.value.channel,compRef:o,roleName:r.value.target},user:{}}];a.push(He(d,r.value.target,r.value.channel))}return{kind:"full",clients:c,servers:a}}throw new Error(`unknown connection type '${r.$type}'`)}function At(e,t){var i,s,a,c,D,l,d,p,f,m,g;let r={version:[0,0,0],kind:"service",domain:"unknown",module:"unknown",name:"unknown"},o=e.svcs.shared.references.KumoriModules,n=se(o,e.nodes.get(t));for(let h of n)h(r);let u={spec:[1,0],ref:r,description:{builtin:!1,config:{resilience:0,scale:{detail:Object.fromEntries(Object.entries((i=t.role)!=null?i:{}).map(([h])=>[h,{hsize:1}]))},parameter:(s=t==null?void 0:t.config)!=null?s:{},resource:Object.fromEntries(Object.entries((a=t.resource)!=null?a:{}).map(([h,C])=>[h,W(C)]))},role:{},connector:Object.fromEntries(Object.entries((c=t.connect)!=null?c:{}).map(([h,C])=>[h,Or(e,t,C)])),srv:{client:Object.fromEntries(Object.entries((l=(D=t.srv)==null?void 0:D.client)!=null?l:{}).map(([h,C])=>[h,{protocol:C,inherited:!1}])),server:Object.fromEntries(Object.entries((p=(d=t.srv)==null?void 0:d.server)!=null?p:{}).map(([h,C])=>{let E;return typeof C=="string"?E={port:80,inherited:!1,protocol:C}:E=x(F({},C),{inherited:!1}),[h,E]})),duplex:Object.fromEntries(Object.entries((m=(f=t.srv)==null?void 0:f.duplex)!=null?m:{}).map(([h,C])=>{let E;return typeof C=="string"?E={port:80,inherited:!1,protocol:C}:E=x(F({},C),{inherited:!1}),[h,E]}))}}};return u.description.role=Object.fromEntries(Object.entries((g=t.role)!=null?g:{}).map(([h,C])=>[h,eu(e,h,C,u)]).filter(([,h])=>Qi.isSome(h)).map(([h,C])=>[h,C.value])),u}function Xi(e,t){var r,o,n,u,i,s,a;return{name:ae(e),up:ge(e),meta:{},config:{resilience:0,scale:(n=(r=t.config)==null?void 0:r.scale)!=null?n:{hsize:(o=t.config)==null?void 0:o.scale},parameter:(i=(u=t.config)==null?void 0:u.parameter)!=null?i:{},resource:Object.fromEntries(Object.entries((a=(s=t.config)==null?void 0:s.resource)!=null?a:{}).map(([c,D])=>[c,W(D)]))},artifact:At(e,t)}}function eu(e,t,r,o){var i,s,a,c,D,l,d,p,f,m,g,h,C,E,y,S,O,G;if(Me(r.artifact))return Zi({name:t,meta:r.meta,config:{resilience:0,scale:{hsize:1},parameter:(i=r.artifact.config)!=null?i:{},resource:{}},artifact:xt(e,r.artifact)});let n=r.artifact;e=Rr(e,t),Mr(e,te(n)?Xi(e,n):Ar(e,n)),(a=(s=o.description).srv)!=null||(s.srv={}),(D=(c=o.description.srv).server)!=null||(c.server={}),(d=(l=o.description.srv).client)!=null||(l.client={});for(let[,K]of Object.entries((p=o.description.connector)!=null?p:{})){for(let R of K.clients){if(R.role!==t)continue;let M=F({},R),P=`${R.role}.${R.channel}`,V=((m=(f=n==null?void 0:n.srv)==null?void 0:f.client)!=null?m:{})[R.channel];o.description.srv.server[P]={inherited:!0,protocol:R.channel=="inbound"?"http":V},R.role="self",R.channel=P,(h=(g=e.root).links)!=null||(g.links=[]),e.root.links.push({meta:{},s_d:ae(e),s_c:M.channel,t_d:ge(e),t_c:P})}for(let R of K.servers)for(let M of R.links)if(M.role===t){let P=`${M.role}.${M.channel}`,V=((E=(C=n==null?void 0:n.srv)==null?void 0:C.server)!=null?E:{})[M.channel];V===void 0&&(V=((S=(y=n==null?void 0:n.srv)==null?void 0:y.duplex)!=null?S:{})[M.channel]),o.description.srv.client[P]={inherited:!0,protocol:typeof V=="string"?V:V.protocol,port:typeof V=="object"?V.port:void 0},(G=(O=e.root).links)!=null||(O.links=[]),e.root.links.push({meta:{},s_d:ge(e),s_c:P,t_d:ae(e),t_c:M.channel}),M.role="self",M.channel=P}}return Yi}import{isComponentArtifact as tu}from"@kumori/kdsl-lsp/language/generated/ast.js";var ae=e=>e.path.join("."),ge=e=>e.path.slice(0,-1).join("."),Rr=(e,t)=>x(F({},e),{path:[...e.path,t]}),Mr=(e,t)=>e.root.deployments[ae(e)]=t;function kr(e,t,r){var u,i,s;let o={top:r.name,deployments:{},links:[]},n={svcs:e,path:[r.name],root:o,nodes:t};return o.deployments[r.name]={name:r.name,meta:r.meta,config:{parameter:(u=r.config)!=null?u:{},resource:Object.fromEntries(Object.entries((i=r.resource)!=null?i:{}).map(([a,c])=>[a,W(c)])),resilience:(s=r.resilience)!=null?s:0,scale:{detail:(()=>{var a;if(Me(r.artifact)){let c=n.nodes.get(r.artifact),D="";if(c&&tu(c)&&(D=c.name.value.$refText),D==="")throw new Error("Unable to determine component name for scale detail.");return{[D]:{hsize:typeof r.scale=="number"?r.scale:1}}}if(te(r.artifact)){let c=Object.entries((a=r.artifact.role)!=null?a:{});return Object.fromEntries(c.map(([D])=>[D,{hsize:r.scale&&typeof r.scale=="object"&&!Array.isArray(r.scale)&&D in r.scale?r.scale[D]:1}]))}return{}})()}},artifact:(()=>{if(Me(r.artifact))return Lr(n,r.artifact);if(te(r.artifact))return At(n,r.artifact);throw Pr(r.artifact)?new Error("not implemented: handle builtin"):new Error("unknown artifact")})()},o}function Me(e){return"size"in e}function te(e){return!(Me(e)||Pr(e))}function Pr(e){return"id"in e}function $r(e,t,r){var D,l;let o=t.validation.KumoriTypeSystem,[{Value:n},u]=o.Eval(t.validation.KumoriValidations.ctx(),r);if(u.length!==0){let d=[];for(let p of u){let f=p.node,m=Tr.getDocument(f),g=((D=f.$cstNode)==null?void 0:D.range.start)||{line:0,character:0},h=`${m.uri.fsPath}:${g.line}:${g.character}: type error: ${p.message}`;e.error(h),d.push(h)}return Ot(d)}let i=new Map,s=ou({svcs:t,nodes:i},n);if(nu.isErr(s)){let d=[];for(let p of s.err){let f=p.node,m=Tr.getDocument(f),g=((l=f.$cstNode)==null?void 0:l.range.start)||{line:0,character:0},h=`${m.uri.fsPath}:${g.line}:${g.character}: json conversion error: ${p.message}`;e.error(h),d.push(h)}return Ot(d)}let a=ru.safeParse(s.value);if(!a.success){let d=[];for(let p of a.error.issues){let f=`${p.code}: ${p.path}: invalid deployment: ${p.message}`;e.error(f),d.push(f)}return Ot(d)}let c=JSON.stringify(kr(t,i,s.value),null,2);return iu(c)}Ee();import{ModuleContext as uo}from"@kumori/kdsl-lsp/module/context.js";import{ListDependencies as Wu}from"@kumori/kdsl-lsp/module/dependency/list.js";import no from"assert";import{LocateDependency as Hu}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{Maybe as Qu}from"@kumori/kdsl-lsp/util/maybe.js";import{DependencyId as Yu}from"@kumori/kdsl-lsp/module/dependency/id.js";import io from"path";import{promises as Zu}from"fs";import{RegistryManager as Yc}from"@kumori/kdsl-lsp/module/registry/manager.js";var Zc=`
|
|
105
|
+
Generates a solution.json file for a specified Kumori package containing deployment definitions.
|
|
106
|
+
The command requires the path to the package as an argument, and optionally accepts a directory
|
|
107
|
+
path where the Kumori module is located. If the directory is not provided, the current working
|
|
108
|
+
directory is used by default.
|
|
109
|
+
|
|
110
|
+
Some usage examples:
|
|
111
|
+
kdsl build
|
|
112
|
+
kdsl build my-package
|
|
113
|
+
kdsl build my-package path/to/module
|
|
114
|
+
|
|
115
|
+
The generated solution.json file will be created in the package directory, containing all necessary
|
|
116
|
+
information for deploying the resources defined in the package's deployment artifacts.
|
|
117
|
+
`.trim();async function so(e,t,r,o){let n=t.shared.workspace.FileSystemProvider,u=await uo(n,qu.file(io.resolve(o)));if(Te.isErr(u)){let h=`error: ${u.err}`;return e.error(h),ye([h])}let i=F({FS:n},u.value),s=await ao(i);if(s.size>0){let h=["error: missing modules"];e.error(h[0]);for(let E of s){let y=`+ ${E}`;e.error(y),h.push(y)}let C="unable to build solution.json";return e.error(C),h.push(C),ye(h)}let a=await Q(e,t,u.value);if(Te.isErr(a))return a;let c=Gu.joinPath(u.value.Current.Root,r),D=t.references.KumoriPackages.GetPackage(c);if(Te.isErr(D)){let h=`error: failed to retrieve package: ${c.toString()}`;return e.error(h),ye([h])}let l=new Set(D.value.docs.map(h=>h.uri.toString())),d=t.shared.workspace.IndexManager.allElements(Vu.$type,l).toArray();if(d.length<1){let h=`error: no deployment defined in ${c.toString()}`;return e.error(h),ye([h])}if(d.length>1){let h=`error: too many deployments in ${c.toString()}`;return e.error(h),ye([h])}let p=d[0],f=p.node;if(!Ju(f)){let h=`error: invalid target doc=${p.documentUri} location=${p.path}`;return e.error(h),ye([h])}let m=$r(e,t,f);if(Te.isErr(m))return m;let g=io.join(c.fsPath,"solution.json");return await Zu.writeFile(g,m.value,"utf-8"),e.info(`solution.json written to ${g}`),zu(void 0)}async function ao(e,t=new Set){let r=Wu(e.Current);for(let[,o]of r.entriesGroupedByKey()){no(o.length>0);let{target:n,version:u}=o[0],i=await Hu(e,n,u);if(Qu.isNone(i)){t.add(Yu(n,u));continue}let s=await uo.Move(e,e.FS,i.value.Root);no(Te.isOk(s));let a=F(F({},e),s.value);await ao(a,t)}return t}async function es(e){var i,s,a;let t=k(e.logger),r=(i=e.package)!=null?i:".",o=(a=(s=e.directory)!=null?s:e.cwd)!=null?a:".",n=e.services;return await new Xu().ensureIndexes(),await so(t,n,r,o)}Ee();import{ModuleContext as ts}from"@kumori/kdsl-lsp/module/context.js";import{URI as rs}from"langium";import{Result as os,Err as ns}from"@kumori/kdsl-lsp/util/result.js";import is from"path";async function us(e){var i,s;let t=k(e.logger),r=(s=(i=e.directory)!=null?i:e.cwd)!=null?s:".",o=e.services,n=o.shared.workspace.FileSystemProvider,u=await ts(n,rs.file(is.resolve(r)));return os.isErr(u)?ns([u.err]):await Q(t,o,u.value)}import{TempCache as ss}from"@kumori/kdsl-lsp/util/tmp.js";import{rm as as}from"fs/promises";import{Ok as ls,Err as Ds}from"@kumori/kdsl-lsp/util/result.js";async function cs(e={}){let t=k(e.logger);try{let r=await ss();return t.info(r.fsPath),await as(r.fsPath,{force:!0,recursive:!0}),ls(void 0)}catch(r){return Ds([String(r)])}}import{createKumoriServices as Rp}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as Da}from"langium";import{Result as tt,Err as ve,Ok as rt}from"@kumori/kdsl-lsp/util/result.js";async function ca(e){var o;let t=k(e.logger),{NewModule:r}=await Promise.resolve().then(()=>(ho(),po));try{let n=(o=e.cwd)!=null?o:process.cwd();return await r(t,n,e.name,e.version,e.location,e.cacheLocation),rt(void 0)}catch(n){return ve([String(n)])}}async function da(e){var i;let t=k(e.logger),r=Da.file((i=e.cwd)!=null?i:process.cwd()),{Dependency:o}=await Promise.resolve().then(()=>(vo(),wo)),{RegistryManager:n}=await import("@kumori/kdsl-lsp/module/registry/manager.js");await new n().ensureIndexes();try{return await o(t,r,e.module,{alias:e.alias,headers:e.headers,remove:e.remove?!0:void 0,download:e.download?!0:void 0}),rt(void 0)}catch(s){return ve([String(s)])}}async function ma(e){var u,i;let t=k(e.logger),{Download:r}=await Promise.resolve().then(()=>(Ze(),Yr)),{RegistryManager:o}=await import("@kumori/kdsl-lsp/module/registry/manager.js");return await new o().ensureIndexes(),await r(t,e.services,(u=e.cwd)!=null?u:process.cwd(),(i=e.modules)!=null?i:[],{quiet:e.quiet?!0:void 0})}async function fa(e){var o;let t=k(e.logger),{NewModule:r}=await Promise.resolve().then(()=>(Oo(),Ao));try{return await r(t,(o=e.cwd)!=null?o:process.cwd(),{version:e.version,cacheLocation:e.cacheLocation,path:e.path}),rt(void 0)}catch(n){return ve([String(n)])}}async function pa(e){var a,c;let{CalculateChecksum:t}=await import("@kumori/kdsl-lsp/module/integrity/checksum.js"),{ModuleContext:r}=await import("@kumori/kdsl-lsp/module/context.js"),{URI:o}=await import("langium"),n=await import("path"),u=e.services.shared.workspace.FileSystemProvider,i=(c=(a=e.directory)!=null?a:e.cwd)!=null?c:".",s=await r(u,o.file(n.resolve(i)));if(tt.isErr(s))return ve([s.err]);try{let D=await t(s.value.Current.Root.fsPath);return rt(D)}catch(D){return ve([String(D)])}}async function ha(e){let t=k(e.logger),{LocateModule:r,GetSchema:o}=await Promise.resolve().then(()=>(Kt(),Jo)),{ModuleContext:n}=await import("@kumori/kdsl-lsp/module/context.js"),{Check:u}=await Promise.resolve().then(()=>(Ee(),oo)),{URI:i}=await import("langium"),s=e.services,a=s.shared.workspace.FileSystemProvider,c=await r(e.target);if(tt.isErr(c))return c;let D=await n(a,i.file(c.value.fsPath));if(tt.isErr(D))return ve([D.err]);let l=await u(t,s,D.value);return tt.isErr(l)?l:await o(s,D.value,e.packagePath,e.artifactName)}import{RegistryManager as Vt}from"@kumori/kdsl-lsp/module/registry/manager.js";import{Ok as Jt,Err as qt}from"@kumori/kdsl-lsp/util/result.js";async function Fa(e){let t=k(e.logger),r=new Vt,o={selector:e.selector,version:e.version,indexUrl:e.url};try{return r.add(o),t.info(`Registry '${e.selector}' added at ${e.url}`),Jt(void 0)}catch(n){return qt([`Failed to add registry: ${n}`])}}async function ga(e={}){let t=k(e.logger),r=new Vt;try{let o=r.list();return t.info("Configured Registries:"),Jt(o)}catch(o){return qt([`Failed to list registries: ${o}`])}}async function Ca(e){let t=k(e.logger),r=new Vt;try{return r.remove(e.name),t.info(`Registry '${e.name}' removed`),Jt(void 0)}catch(o){return qt([`Failed to remove registry: ${o}`])}}import{Ok as al,Err as si}from"@kumori/kdsl-lsp/util/result.js";async function ll(e){var r,o;let t=k(e.logger);if(!e.interactive)return si(["Index create command requires interactive mode. Set interactive: true to use this command programmatically with prompts, or use the CLI directly: kdsl index create"]);try{let{Action:n}=await Promise.resolve().then(()=>(ui(),ii));return await n(t)({module:(r=e.module)!=null?r:void 0,index:(o=e.indexFile)!=null?o:void 0}),al(void 0)}catch(n){return si([String(n)])}}export{es as build,us as check,cs as clean,Rp as createKumoriServices,xr as createSilentLogger,k as getLogger,ll as indexCreate,pa as moduleChecksum,da as moduleDependency,ma as moduleDownload,ca as moduleInit,ha as moduleSchemaGet,fa as moduleUpdate,Fa as registryAdd,ga as registryList,Ca as registryRemove};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,uBAAuB;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAG1E,yBAAyB;AACzB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAA;AAUjB,2BAA2B;AAC3B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAOzE,wBAAwB;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAK5C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package builtin
|
|
2
|
+
|
|
3
|
+
import "kumori"
|
|
4
|
+
|
|
5
|
+
builtin HTTPInbound {
|
|
6
|
+
id {
|
|
7
|
+
name "inbound"
|
|
8
|
+
kind "service"
|
|
9
|
+
domain "kumori.systems"
|
|
10
|
+
module "builtins/inbound"
|
|
11
|
+
version "1.3.0"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
srv {
|
|
15
|
+
client { inbound "http" }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
config {
|
|
19
|
+
type "https"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
resource {
|
|
23
|
+
servercert: kumori.Certificate
|
|
24
|
+
serverdomain: kumori.Domain
|
|
25
|
+
clientcertca?: kumori.CA
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package builtin
|
|
2
|
+
|
|
3
|
+
import "kumori"
|
|
4
|
+
|
|
5
|
+
builtin TCPInbound {
|
|
6
|
+
id {
|
|
7
|
+
name "inbound"
|
|
8
|
+
kind "service"
|
|
9
|
+
domain "kumori.systems"
|
|
10
|
+
module "builtins/inbound"
|
|
11
|
+
version "1.3.0"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
srv {
|
|
15
|
+
client { inbound "tcp" }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
config {
|
|
19
|
+
type "tcp"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
resource {
|
|
23
|
+
port: kumori.Port
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package kumori
|
|
2
|
+
|
|
3
|
+
library
|
|
4
|
+
|
|
5
|
+
alias builtin struct {
|
|
6
|
+
id Ref
|
|
7
|
+
srv Links
|
|
8
|
+
config struct open[]
|
|
9
|
+
resource struct open[Resource]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
alias Ref struct {
|
|
13
|
+
name string
|
|
14
|
+
kind "service" | "component"
|
|
15
|
+
domain string
|
|
16
|
+
module string
|
|
17
|
+
version string
|
|
18
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
package kumori
|
|
2
|
+
|
|
3
|
+
library
|
|
4
|
+
|
|
5
|
+
alias ComponentInterface struct {
|
|
6
|
+
srv? Links
|
|
7
|
+
config? struct open[]
|
|
8
|
+
resource? struct open[Resource]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
alias component struct {
|
|
12
|
+
srv? Links
|
|
13
|
+
config? struct open[]
|
|
14
|
+
resource? struct open[Resource]
|
|
15
|
+
|
|
16
|
+
code? struct open[Code]
|
|
17
|
+
init? []struct {
|
|
18
|
+
cmd? []string
|
|
19
|
+
image Image
|
|
20
|
+
entrypoint? []string
|
|
21
|
+
|
|
22
|
+
size struct {
|
|
23
|
+
memory RAMSized
|
|
24
|
+
cpu CPUSized
|
|
25
|
+
mincpu? CPUSized
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
env? struct open[Env]
|
|
29
|
+
fs? struct open[File]
|
|
30
|
+
}
|
|
31
|
+
size struct {
|
|
32
|
+
bandwidth BandwidthSized
|
|
33
|
+
minbandwidth? BandwidthSized
|
|
34
|
+
mincpu CPUSized
|
|
35
|
+
}
|
|
36
|
+
probe? struct open[Probes]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
alias Code struct {
|
|
40
|
+
cmd? []string
|
|
41
|
+
image Image
|
|
42
|
+
entrypoint? []string
|
|
43
|
+
|
|
44
|
+
size struct {
|
|
45
|
+
memory RAMSized
|
|
46
|
+
cpu CPUSized
|
|
47
|
+
mincpu? CPUSized
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
env? struct open[Env]
|
|
51
|
+
fs? struct open[File]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
alias Image string | struct { hub: struct { name: string, secret?: string }, tag: string }
|
|
55
|
+
|
|
56
|
+
alias File string | FSMap | struct { volume: string }
|
|
57
|
+
alias FSMap FSData | FSSecret | FSPort | FSDomain | FSCertificate | FSCa
|
|
58
|
+
|
|
59
|
+
alias AllowedFormat "text" | "json" | "yaml" | "flatdict"
|
|
60
|
+
|
|
61
|
+
alias FSData struct { data: string, mode?: number, format?: AllowedFormat }
|
|
62
|
+
alias FSSecret struct { secret: string, mode?: number, format?: AllowedFormat }
|
|
63
|
+
alias FSPort struct { port: string, mode?: number, format?: AllowedFormat }
|
|
64
|
+
alias FSDomain struct { domain: string, mode?: number, format?: AllowedFormat }
|
|
65
|
+
alias FSCertificate struct { certificate: string, mode?: number, format?: AllowedFormat }
|
|
66
|
+
alias FSCa struct { ca: string, mode?: number, format?: AllowedFormat }
|
|
67
|
+
|
|
68
|
+
alias Env string | bool | number | struct { secret: string }
|
|
69
|
+
|
|
70
|
+
alias Probes struct {
|
|
71
|
+
liveness? LivenessProbeAttributes
|
|
72
|
+
readiness? ReadinessProbeAttributes
|
|
73
|
+
pmetrics? PrometheusMetricsProbeAttributes
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
alias LivenessProbeAttributes struct {
|
|
77
|
+
protocol ProbeProtocol
|
|
78
|
+
startupGraceWindow? StartupGraceWindow
|
|
79
|
+
frequency? any
|
|
80
|
+
timeout? number
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
alias ReadinessProbeAttributes struct {
|
|
84
|
+
protocol ProbeProtocol
|
|
85
|
+
frequency? any
|
|
86
|
+
timeout? number
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
alias PrometheusMetricsProbeAttributes struct {
|
|
90
|
+
protocol HTTPOnlyProbeProtocol
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
alias ProbeProtocol struct {
|
|
94
|
+
http? HTTPProbeProtocol
|
|
95
|
+
tcp? TCPProbeProtocol
|
|
96
|
+
exec? ExecProbeProtocol
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
alias HTTPOnlyProbeProtocol struct {
|
|
100
|
+
http HTTPProbeProtocol
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
alias HTTPProbeProtocol struct {
|
|
104
|
+
port number
|
|
105
|
+
path string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
alias TCPProbeProtocol struct {
|
|
109
|
+
port number
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
alias ExecProbeProtocol struct {
|
|
113
|
+
path string
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
alias StartupGraceWindow struct {
|
|
117
|
+
unit "ms" | "attempt"
|
|
118
|
+
duration number
|
|
119
|
+
probe bool
|
|
120
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package kumori
|
|
2
|
+
|
|
3
|
+
library
|
|
4
|
+
|
|
5
|
+
alias deployment struct {
|
|
6
|
+
name string
|
|
7
|
+
artifact any
|
|
8
|
+
resilience? number
|
|
9
|
+
|
|
10
|
+
scale? ScaleSpec
|
|
11
|
+
config? struct open[]
|
|
12
|
+
resource? struct open[Resource]
|
|
13
|
+
meta? struct open[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
alias ScaleSpec struct open[] | number
|