@runium/cli 0.3.0 → 2026.1.0

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 CHANGED
@@ -1,6 +1,6 @@
1
- import{existsSync as c}from"node:fs";import{resolve as u}from"node:path";import{Command as v}from"commander";import{Container as o}from"typedi";import*as p from"./commands/index.js";import{CommandService as g,ConfigService as l,ProfileService as m,PluginService as d,ShutdownService as h,OutputService as S,OutputLevel as n,PluginContextService as f}from"./services/index.js";import{getVersion as P}from"./utils/index.js";const C=`\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
1
+ import{existsSync as p}from"node:fs";import{resolve as u}from"node:path";import{parseArgs as c}from"node:util";import{Command as v}from"commander";import{Container as o}from"typedi";import*as l from"./commands/index.js";import{CommandService as g,ConfigService as m,ProfileService as h,PluginService as d,ShutdownService as f,OutputService as S,OutputLevel as n,PluginContextService as P}from"./services/index.js";import{getVersion 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 A{program;commandService;configService;profileService;pluginService;shutdownService;outputService;pluginContextService;constructor(){this.program=new v("runium"),this.configService=o.get(l),this.profileService=o.get(m),this.pluginService=o.get(d),this.shutdownService=o.get(h),this.outputService=o.get(S),this.pluginContextService=o.get(f),this.commandService=o.get(g)}async start(){return await this.configService.init().catch(i=>{throw this.initOutput(),i}),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.version(`runium ${P()}`),i.description(C),i.on("option:debug",()=>{this.setDebugMode()}),i.on("option:env",e=>{this.loadEnvFiles([e])}),Object.values(p).forEach(e=>{this.commandService.registerCommand(e,i)})}initOutput(){(this.configService.get("output").debug||process.argv.includes("-D")||process.argv.includes("--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=u(e&&e.trim()||".env");c(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{A as RuniumCliApp};
6
+ One Tool to Run Them All!`,w={debug:{type:"boolean",short:"D",default:!1},env:{type:"string",short:"E",default:""},profile:{type:"string",short:"P",default:""},version:{type:"boolean",short:"V",default:!1}};class L{program;commandService;configService;profileService;pluginService;shutdownService;outputService;pluginContextService;constructor(){this.program=new v("runium"),this.configService=o.get(m),this.profileService=o.get(h),this.pluginService=o.get(d),this.shutdownService=o.get(f),this.outputService=o.get(S),this.pluginContextService=o.get(P),this.commandService=o.get(g)}async start(){const{values:{debug:i,profile:e}}=c({options:w,allowPositionals:!0});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 ${C()}`),i.description(b),i.on("option:debug",()=>{this.setDebugMode()}),i.on("option:env",e=>{this.loadEnvFiles([e])}),Object.values(l).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=u(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{L as RuniumCliApp};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runium/cli",
3
- "version": "0.3.0",
3
+ "version": "2026.1.0",
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.3.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",
@@ -1 +1 @@
1
- var m=function(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var n=i.length-1;n>=0;n--)(a=i[n])&&(o=(s<3?a(o):s>3?a(t,e,o):a(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o};import{existsSync as l}from"node:fs";import{homedir as g}from"node:os";import{join as c,resolve as u}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",p=c(process.cwd(),C),h=".runium",F=c(g(),h),d=c(process.cwd(),h);function A(i){const t=E(),e=I(t);if(!e(i)&&e.errors){const s=b(e.errors);throw new O(`Invalid "${p}" configuration data`,j.CONFIG_INVALID_DATA,s)}}let f=class{data={profile:{path:F},plugins:{},projects:{},output:{debug:!1},env:{path:[]}};async init(){if(l(d)&&(this.data.profile.path=d),l(p)){const t=await _(p);if(t){A(t);const e={env:Object.assign({},this.data.env,t.env??{}),output:Object.assign({},this.data.output,t.output??{}),profile:Object.assign({},this.data.profile,t.profile??{}),plugins:Object.assign({},this.data.plugins,t.plugins??{}),projects:Object.assign({},this.data.projects,t.projects??{})};e.env.path=e.env.path.map(r=>u(r)),e.profile.path=u(e.profile.path),this.data=e}}}get(t){return this.data[t]}};f=m([v()],f);export{f as ConfigService};
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};