@runium/cli 0.3.0 → 2026.1.0-beta
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/app.js +2 -2
- package/package.json +2 -2
- package/services/config.js +1 -1
- package/utils/index.js +1 -1
- package/utils/parse-root-options.js +1 -0
package/app.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as p}from"node:fs";import{resolve as c}from"node:path";import{Command as u}from"commander";import{Container as o}from"typedi";import*as v from"./commands/index.js";import{CommandService as l,ConfigService as g,ProfileService as m,PluginService as h,ShutdownService as d,OutputService as S,OutputLevel as n,PluginContextService as f}from"./services/index.js";import{getVersion as P,parseRootOptions as C}from"./utils/index.js";const b=`\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
2
2
|
\u2551 \u2554\u2550\u2557 \u2566 \u2566 \u2554\u2557\u2554 \u2566 \u2566 \u2566 \u2554\u2566\u2557 \u2551
|
|
3
3
|
\u2551 \u2560\u2566\u255D \u2551 \u2551 \u2551\u2551\u2551 \u2551 \u2551 \u2551 \u2551\u2551\u2551 \u2551
|
|
4
4
|
\u2551 \u2569\u255A\u2550 \u255A\u2550\u255D \u255D\u255A\u255D \u2569 \u255A\u2550\u255D \u2569 \u2569 \u2551
|
|
5
5
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
6
|
-
One Tool to Run Them All!`;class
|
|
6
|
+
One Tool to Run Them All!`;class I{program;commandService;configService;profileService;pluginService;shutdownService;outputService;pluginContextService;constructor(){this.program=new u("runium"),this.configService=o.get(g),this.profileService=o.get(m),this.pluginService=o.get(h),this.shutdownService=o.get(d),this.outputService=o.get(S),this.pluginContextService=o.get(f),this.commandService=o.get(l)}async start(){const{debug:i,profile:e}=C();return await this.configService.init({profilePath:e,debug:i}).catch(t=>{throw this.initOutput(),t}),this.initOutput(),await this.shutdownService.init(),await this.profileService.init(),await this.pluginContextService.init(),this.initEnv(),await this.loadPlugins(),await this.initProgram(),await this.initPlugins(),this.program.parseAsync()}async loadPlugins(){const i=this.profileService.getPlugins();for(const e of i)if(e.disabled!==!0)try{const t=this.pluginService.resolvePath(e.path,e.file);await this.pluginService.loadPlugin(t,e.options)}catch(t){this.outputService.error(`Failed to load plugin "${e.name}"`);const{code:r,message:s,payload:a}=t;this.outputService.debug("Error details:",{message:s,code:r,payload:a})}}async initProgram(){const i=this.program;i.option("-D, --debug","enable debug mode"),i.option("-E, --env [paths...]","load env files"),i.option("-P, --profile <path>","set profile path"),i.version(`runium ${P()}`),i.description(b),i.on("option:debug",()=>{this.setDebugMode()}),i.on("option:env",e=>{this.loadEnvFiles([e])}),Object.values(v).forEach(e=>{this.commandService.registerCommand(e,i)})}initOutput(){this.configService.get("output").debug&&this.setDebugMode()}setDebugMode(){this.outputService.getLevel()!==n.DEBUG&&(this.outputService.setLevel(n.DEBUG),this.outputService.debug("Debug mode enabled"))}initEnv(){const i=this.configService.get("env");i.path.length>0&&this.loadEnvFiles(i.path)}loadEnvFiles(i){for(const e of i){const t=c(e&&e.trim()||".env");p(t)?(this.outputService.debug(`Loading env file "${t}"`),process.loadEnvFile(t)):this.outputService.error(`Env file "${t}" not found`)}}async initPlugins(){const i=this.pluginService.getAllPlugins();for(const e of i){const t=e.app?.commands;if(t)for(const r of t)this.commandService.registerCommand(r,this.program,e.name)}await this.pluginService.runHook("app.afterInit",{profilePath:this.configService.get("profile").path})}}export{I as RuniumCliApp};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runium/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2026.1.0-beta",
|
|
4
4
|
"description": "Runium CLI",
|
|
5
5
|
"author": "TheBeastApp",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"module": "./index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@runium/core": "^0.
|
|
16
|
+
"@runium/core": "^1.0.0",
|
|
17
17
|
"@segment/ajv-human-errors": "^2.15.0",
|
|
18
18
|
"commander": "^14.0.2",
|
|
19
19
|
"reflect-metadata": "^0.2.2",
|
package/services/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var m=function(
|
|
1
|
+
var m=function(s,t,r,e){var o=arguments.length,i=o<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,r):e,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,t,r,e);else for(var n=s.length-1;n>=0;n--)(a=s[n])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};import{existsSync as u}from"node:fs";import{homedir as g}from"node:os";import{join as c,resolve as p}from"node:path";import{Service as v}from"typedi";import{readJsonFile as _,RuniumError as O}from"@runium/core";import{ErrorCode as j}from"../constants/index.js";import{createValidator as I,getConfigSchema as E,getErrorMessages as b}from"../validation/index.js";const C=".runiumrc.json",f=c(process.cwd(),C),d=".runium",F=c(g(),d),h=c(process.cwd(),d);function A(s){const t=E(),r=I(t);if(!r(s)&&r.errors){const o=b(r.errors);throw new O(`Invalid "${f}" configuration data`,j.CONFIG_INVALID_DATA,o)}}let l=class{data={profile:{path:F},plugins:{},projects:{},output:{debug:!1},env:{path:[]}};async init({profilePath:t,debug:r}={}){if(t?this.data.profile.path=p(t):u(h)&&(this.data.profile.path=h),this.data.output.debug=r??!1,u(f)){const e=await _(f);if(e){A(e);const o={env:Object.assign({},this.data.env,e.env??{}),output:Object.assign({},this.data.output,e.output??{}),profile:Object.assign({},this.data.profile,e.profile??{}),plugins:Object.assign({},this.data.plugins,e.plugins??{}),projects:Object.assign({},this.data.projects,e.projects??{})};o.env.path=o.env.path.map(i=>p(i)),o.profile.path=p(o.profile.path),this.data=o}}}get(t){return this.data[t]}};l=m([v()],l);export{l as ConfigService};
|
package/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{convertPathToValidFileName as r}from"./convert-path-to-valid-file-name.js";import{debounce as m}from"./debounce.js";import{formatTimestamp as
|
|
1
|
+
import{convertPathToValidFileName as r}from"./convert-path-to-valid-file-name.js";import{debounce as m}from"./debounce.js";import{formatTimestamp as a}from"./format-timestamp.js";import{getVersion as i}from"./get-version.js";import{parseRootOptions as n}from"./parse-root-options.js";export{r as convertPathToValidFileName,m as debounce,a as formatTimestamp,i as getVersion,n as parseRootOptions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(i=process.argv.slice(2)){const o={profile:"",debug:!1};for(let e=0;e<i.length;e++){const t=i[e];t==="-D"||t==="--debug"?o.debug=!0:t==="-P"||t==="--profile"?e+1<i.length&&!i[e+1].startsWith("-")&&(o.profile=i[e+1],e++):t.startsWith("--profile=")&&(o.profile=t.substring(10))}return o}export{r as parseRootOptions};
|