@visulima/cerebro 3.0.0-alpha.9 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +593 -0
- package/LICENSE.md +1295 -3950
- package/README.md +182 -2
- package/dist/commands/completion-command.d.ts +6 -5
- package/dist/commands/completion-command.js +5 -203
- package/dist/commands/help-command.d.ts +10 -9
- package/dist/commands/help-command.js +1 -3
- package/dist/commands/readme-command.d.ts +6 -5
- package/dist/commands/readme-command.js +32 -330
- package/dist/commands/version-command.d.ts +4 -3
- package/dist/commands/version-command.js +1 -18
- package/dist/index.d.ts +516 -95
- package/dist/index.js +1 -7
- package/dist/logger/create-pail-logger.d.ts +770 -8
- package/dist/logger/create-pail-logger.js +1 -34
- package/dist/packem_chunks/has-new-version.js +1 -259
- package/dist/packem_shared/Cerebro-Czc4t-75.js +4 -0
- package/dist/packem_shared/VERBOSITY_DEBUG-XPultrIA.js +1 -0
- package/dist/packem_shared/VisulimaError-C90oeIMu.js +76 -0
- package/dist/packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js +1 -0
- package/dist/packem_shared/cerebro-error-BjBcYVRO.js +1 -0
- package/dist/packem_shared/command.d-DbhtfXF4.d.ts +639 -0
- package/dist/packem_shared/index-DvVGK4kr.js +29 -0
- package/dist/packem_shared/index.d-BL4NtVR3.d.ts +127 -0
- package/dist/packem_shared/lazyNamed-DMUm8mZe.js +1 -0
- package/dist/packem_shared/renderError-B3ePOoBG-BmZlyMcr.js +25 -0
- package/dist/packem_shared/runtime-process-Dmz0vCJy.js +1 -0
- package/dist/packem_shared/split-by-case-Dbpgd7rf.js +1 -0
- package/dist/plugins/error-handler-plugin.d.ts +21 -19
- package/dist/plugins/error-handler-plugin.js +1 -636
- package/dist/plugins/runtime-version-check-plugin.d.ts +22 -20
- package/dist/plugins/runtime-version-check-plugin.js +1 -77
- package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +28 -8
- package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -517
- package/dist/util/general/compile-cache.d.ts +41 -0
- package/dist/util/general/compile-cache.js +1 -0
- package/dist/util/general/heap-tuning.d.ts +18 -0
- package/dist/util/general/heap-tuning.js +1 -0
- package/package.json +53 -48
- package/dist/cli.d.ts +0 -203
- package/dist/constants.d.ts +0 -29
- package/dist/default-env.d.ts +0 -7
- package/dist/default-options.d.ts +0 -3
- package/dist/empty-toolbox.d.ts +0 -15
- package/dist/errors/cerebro-error.d.ts +0 -10
- package/dist/errors/command-not-found-error.d.ts +0 -9
- package/dist/errors/command-validation-error.d.ts +0 -10
- package/dist/errors/completion-error.d.ts +0 -9
- package/dist/errors/conflicting-options-error.d.ts +0 -10
- package/dist/errors/plugin-error.d.ts +0 -9
- package/dist/errors/update-notifier-error.d.ts +0 -7
- package/dist/packem_shared/Cerebro-C2mnCyQf.js +0 -3313
- package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +0 -10
- package/dist/packem_shared/VisulimaError-DA7QsCxH.js +0 -34
- package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +0 -16
- package/dist/packem_shared/help-command-BY7rQUvM.js +0 -249
- package/dist/packem_shared/index-C2-8b3A4.js +0 -259
- package/dist/packem_shared/runtime-process-B6ZplyWn.js +0 -187
- package/dist/plugin-manager.d.ts +0 -53
- package/dist/plugins/update-notifier/cache.d.ts +0 -11
- package/dist/plugins/update-notifier/get-distribution-version.d.ts +0 -2
- package/dist/plugins/update-notifier/has-new-version.d.ts +0 -14
- package/dist/types/cli.d.ts +0 -102
- package/dist/types/command-line-usage.d.ts +0 -37
- package/dist/types/command.d.ts +0 -136
- package/dist/types/option-types.d.ts +0 -83
- package/dist/types/options.d.ts +0 -4
- package/dist/types/plugin.d.ts +0 -53
- package/dist/types/toolbox.d.ts +0 -96
- package/dist/util/arg-processing/get-boolean-values.d.ts +0 -7
- package/dist/util/arg-processing/get-parameter-option.d.ts +0 -7
- package/dist/util/arg-processing/map-option-type-label.d.ts +0 -3
- package/dist/util/arg-processing/option-is-boolean.d.ts +0 -9
- package/dist/util/arg-processing/remove-boolean-values.d.ts +0 -9
- package/dist/util/command-line-commands.d.ts +0 -10
- package/dist/util/command-line-usage/get-terminal-width.d.ts +0 -7
- package/dist/util/command-line-usage/index.d.ts +0 -3
- package/dist/util/command-line-usage/section/base-section.d.ts +0 -8
- package/dist/util/command-line-usage/section/content-section.d.ts +0 -65
- package/dist/util/command-line-usage/section/option-list-section.d.ts +0 -44
- package/dist/util/command-processing/command-processor.d.ts +0 -37
- package/dist/util/command-processing/command-validation.d.ts +0 -17
- package/dist/util/command-processing/nested-command-parser.d.ts +0 -25
- package/dist/util/command-processing/option-processor.d.ts +0 -44
- package/dist/util/data-processing/list-missing-arguments.d.ts +0 -15
- package/dist/util/data-processing/merge-arguments.d.ts +0 -7
- package/dist/util/general/find-alternatives.d.ts +0 -8
- package/dist/util/general/hide-bin.d.ts +0 -2
- package/dist/util/general/parse-raw-command.d.ts +0 -7
- package/dist/util/general/register-exception-handler.d.ts +0 -9
- package/dist/util/general/runtime-process.d.ts +0 -65
- package/dist/util/general/semver-gt.d.ts +0 -2
- package/dist/util/general/validate-input.d.ts +0 -24
- package/dist/util/process-env-variables.d.ts +0 -9
- package/dist/util/security.d.ts +0 -58
- package/dist/util/text-processing/template-format.d.ts +0 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface HeapTuningOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Fraction of total system memory to allocate as `--max-old-space-size`.
|
|
4
|
+
* Must be between 0 and 1. Default: `0.75` (75%).
|
|
5
|
+
*/
|
|
6
|
+
maxOldSpacePercent?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Apply heap memory tuning to the current process.
|
|
10
|
+
*
|
|
11
|
+
* When tuning is needed, this function re-spawns the process with computed
|
|
12
|
+
* V8 memory flags and **never returns** — the parent exits with the child's
|
|
13
|
+
* exit code. When no tuning is needed (flags already set), it returns
|
|
14
|
+
* immediately.
|
|
15
|
+
* @param options Optional configuration for heap tuning.
|
|
16
|
+
*/
|
|
17
|
+
declare const applyHeapTuning: (options?: HeapTuningOptions) => void;
|
|
18
|
+
export { type HeapTuningOptions, applyHeapTuning };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as g}from"node:module";import{d as x,h as y,c as b,e as d,i as j}from"../../packem_shared/runtime-process-Dmz0vCJy.js";const h=g(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[o,s]=t.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return t.getBuiltinModule(e)}return h(e)},{execFileSync:_}=u("node:child_process"),{totalmem:v}=u("node:os"),M=/--max-old-space-size=(\d+)/,z=/--max-semi-space-size=(\d+)/,E=e=>Math.floor(v()/1024/1024*e),P=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,l=(e,o)=>{for(const s of o){const i=e.exec(s);if(i)return Number.parseInt(i[1],10)}},q=e=>{const o=e?.maxOldSpacePercent??.75,s=[...j()],i=[...x()],n=l(M,s),c=l(z,s);if(n!==void 0&&c!==void 0)return;const a=n??E(o),m=c??P(a),r=[];if(n===void 0&&r.push(`--max-old-space-size=${String(a)}`),c===void 0&&r.push(`--max-semi-space-size=${String(m)}`),r.length!==0)try{_(y(),[...r,...s,...i.slice(1)],{env:b(),stdio:"inherit"}),d(0)}catch(f){const p=f.status;d(typeof p=="number"?p:1)}};export{q as applyHeapTuning};
|
package/package.json
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/cerebro",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"visulima",
|
|
7
|
-
"command",
|
|
8
|
-
"line",
|
|
9
|
-
"class",
|
|
10
|
-
"terminal",
|
|
11
6
|
"ansi",
|
|
12
|
-
"cli",
|
|
13
|
-
"opts",
|
|
14
|
-
"nopt",
|
|
15
|
-
"options",
|
|
16
7
|
"args",
|
|
8
|
+
"argument",
|
|
17
9
|
"argv",
|
|
18
|
-
"interactive",
|
|
19
|
-
"commander",
|
|
20
10
|
"clap",
|
|
11
|
+
"class",
|
|
12
|
+
"cli",
|
|
21
13
|
"cli-app",
|
|
22
|
-
"
|
|
14
|
+
"command",
|
|
23
15
|
"command line apps",
|
|
24
16
|
"command-line-usage",
|
|
25
|
-
"
|
|
26
|
-
"parser",
|
|
27
|
-
"argument",
|
|
17
|
+
"commander",
|
|
28
18
|
"flag",
|
|
29
19
|
"gluegun",
|
|
20
|
+
"interactive",
|
|
21
|
+
"line",
|
|
30
22
|
"meow",
|
|
23
|
+
"minimist",
|
|
24
|
+
"nopt",
|
|
31
25
|
"oclif",
|
|
26
|
+
"option",
|
|
27
|
+
"options",
|
|
28
|
+
"opts",
|
|
29
|
+
"parser",
|
|
30
|
+
"terminal",
|
|
31
|
+
"visulima",
|
|
32
32
|
"yargs"
|
|
33
33
|
],
|
|
34
34
|
"homepage": "https://visulima.com/packages/cerebro",
|
|
35
|
-
"bugs":
|
|
36
|
-
|
|
35
|
+
"bugs": "https://github.com/visulima/visulima/issues",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"author": {
|
|
38
|
+
"name": "Daniel Bannert",
|
|
39
|
+
"email": "d.bannert@anolilab.de"
|
|
37
40
|
},
|
|
38
41
|
"repository": {
|
|
39
42
|
"type": "git",
|
|
@@ -50,13 +53,19 @@
|
|
|
50
53
|
"url": "https://anolilab.com/support"
|
|
51
54
|
}
|
|
52
55
|
],
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
"files": [
|
|
57
|
+
"dist",
|
|
58
|
+
"README.md",
|
|
59
|
+
"CHANGELOG.md",
|
|
60
|
+
"LICENSE.md"
|
|
61
|
+
],
|
|
62
|
+
"os": [
|
|
63
|
+
"darwin",
|
|
64
|
+
"linux",
|
|
65
|
+
"win32"
|
|
66
|
+
],
|
|
59
67
|
"type": "module",
|
|
68
|
+
"sideEffects": false,
|
|
60
69
|
"exports": {
|
|
61
70
|
".": {
|
|
62
71
|
"types": "./dist/index.d.ts",
|
|
@@ -90,29 +99,35 @@
|
|
|
90
99
|
"types": "./dist/plugins/update-notifier/update-notifier-plugin.d.ts",
|
|
91
100
|
"default": "./dist/plugins/update-notifier/update-notifier-plugin.js"
|
|
92
101
|
},
|
|
102
|
+
"./compile-cache": {
|
|
103
|
+
"types": "./dist/util/general/compile-cache.d.ts",
|
|
104
|
+
"default": "./dist/util/general/compile-cache.js"
|
|
105
|
+
},
|
|
106
|
+
"./heap-tuning": {
|
|
107
|
+
"types": "./dist/util/general/heap-tuning.d.ts",
|
|
108
|
+
"default": "./dist/util/general/heap-tuning.js"
|
|
109
|
+
},
|
|
93
110
|
"./logger/pail": {
|
|
94
111
|
"types": "./dist/logger/create-pail-logger.d.ts",
|
|
95
112
|
"default": "./dist/logger/create-pail-logger.js"
|
|
96
113
|
},
|
|
97
114
|
"./package.json": "./package.json"
|
|
98
115
|
},
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
"LICENSE.md"
|
|
104
|
-
],
|
|
116
|
+
"publishConfig": {
|
|
117
|
+
"access": "public",
|
|
118
|
+
"provenance": true
|
|
119
|
+
},
|
|
105
120
|
"dependencies": {
|
|
106
|
-
"@visulima/colorize": "2.0.0
|
|
107
|
-
"@visulima/tabular": "4.0.0
|
|
121
|
+
"@visulima/colorize": "2.0.0",
|
|
122
|
+
"@visulima/tabular": "4.0.0",
|
|
108
123
|
"fastest-levenshtein": "^1.0.16"
|
|
109
124
|
},
|
|
110
125
|
"peerDependencies": {
|
|
111
|
-
"@bomb.sh/tab": "0.0.
|
|
112
|
-
"@visulima/boxen": "3.0.0
|
|
113
|
-
"@visulima/find-cache-dir": "3.0.0
|
|
114
|
-
"@visulima/pail": "4.0.0
|
|
115
|
-
"github-slugger": "2.0.0"
|
|
126
|
+
"@bomb.sh/tab": ">=0.0.16",
|
|
127
|
+
"@visulima/boxen": "3.0.0",
|
|
128
|
+
"@visulima/find-cache-dir": "3.0.0",
|
|
129
|
+
"@visulima/pail": "4.0.0",
|
|
130
|
+
"github-slugger": ">=2.0.0"
|
|
116
131
|
},
|
|
117
132
|
"peerDependenciesMeta": {
|
|
118
133
|
"@bomb.sh/tab": {
|
|
@@ -131,17 +146,7 @@
|
|
|
131
146
|
"optional": true
|
|
132
147
|
}
|
|
133
148
|
},
|
|
134
|
-
"optionalDependencies": {},
|
|
135
149
|
"engines": {
|
|
136
|
-
"node": "
|
|
137
|
-
},
|
|
138
|
-
"os": [
|
|
139
|
-
"darwin",
|
|
140
|
-
"linux",
|
|
141
|
-
"win32"
|
|
142
|
-
],
|
|
143
|
-
"publishConfig": {
|
|
144
|
-
"access": "public",
|
|
145
|
-
"provenance": true
|
|
150
|
+
"node": "^22.14.0 || >=24.10.0"
|
|
146
151
|
}
|
|
147
152
|
}
|
package/dist/cli.d.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import PluginManager from "./plugin-manager.d.ts";
|
|
2
|
-
import type { Cli as ICli, CliRunOptions, CommandSection as ICommandSection, RunCommandOptions } from "./types/cli.d.ts";
|
|
3
|
-
import type { Command as ICommand, OptionDefinition } from "./types/command.d.ts";
|
|
4
|
-
import type { Plugin } from "./types/plugin.d.ts";
|
|
5
|
-
export type CliOptions<T extends Console = Console> = {
|
|
6
|
-
argv?: ReadonlyArray<string>;
|
|
7
|
-
cwd?: string;
|
|
8
|
-
logger?: T;
|
|
9
|
-
packageName?: string;
|
|
10
|
-
packageVersion?: string;
|
|
11
|
-
};
|
|
12
|
-
export declare class Cli<T extends Console = Console> implements ICli<T> {
|
|
13
|
-
#private;
|
|
14
|
-
/**
|
|
15
|
-
* Create a new CLI instance.
|
|
16
|
-
* @param cliName
|
|
17
|
-
* @param options The options for the CLI.
|
|
18
|
-
* @param options.argv The command line arguments.
|
|
19
|
-
* @param options.cwd The current working directory.
|
|
20
|
-
* @param options.logger The logger to use.
|
|
21
|
-
* @param options.packageName
|
|
22
|
-
* @param options.packageVersion
|
|
23
|
-
*/
|
|
24
|
-
constructor(cliName: string, options?: CliOptions<T>);
|
|
25
|
-
/**
|
|
26
|
-
* Sets the command section configuration for help display.
|
|
27
|
-
*
|
|
28
|
-
* This affects how the CLI name and version are displayed in help output.
|
|
29
|
-
* @param commandSection The command section configuration
|
|
30
|
-
* @returns The CLI instance for method chaining
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* cli.setCommandSection({
|
|
34
|
-
* header: 'My App v2.0.0',
|
|
35
|
-
* footer: 'For more info, visit https://example.com'
|
|
36
|
-
* });
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
setCommandSection(commandSection: ICommandSection): this;
|
|
40
|
-
/**
|
|
41
|
-
* Gets the current command section configuration.
|
|
42
|
-
* @returns The command section configuration
|
|
43
|
-
*/
|
|
44
|
-
getCommandSection(): ICommandSection;
|
|
45
|
-
/**
|
|
46
|
-
* Sets the default command to run when no command is specified.
|
|
47
|
-
*
|
|
48
|
-
* By default, this is set to 'help'. The command must already be registered
|
|
49
|
-
* with the CLI instance.
|
|
50
|
-
* @param commandName The command name to use as the default
|
|
51
|
-
* @returns The CLI instance for method chaining
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* cli.setDefaultCommand('start');
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
setDefaultCommand(commandName: string): this;
|
|
58
|
-
/**
|
|
59
|
-
* Gets the current default command.
|
|
60
|
-
* @returns The name of the default command
|
|
61
|
-
*/
|
|
62
|
-
get defaultCommand(): string;
|
|
63
|
-
/**
|
|
64
|
-
* Adds a command to the CLI.
|
|
65
|
-
*
|
|
66
|
-
* Commands define the available operations that users can execute.
|
|
67
|
-
* Each command can have options, arguments, aliases, and custom execution logic.
|
|
68
|
-
* @template OD - The option definition type for the command
|
|
69
|
-
* @param command The command configuration object
|
|
70
|
-
* @returns The CLI instance for method chaining
|
|
71
|
-
* @throws {CerebroError} If the command name already exists or validation fails
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* cli.addCommand({
|
|
75
|
-
* name: 'build',
|
|
76
|
-
* description: 'Build the project',
|
|
77
|
-
* options: [
|
|
78
|
-
* {
|
|
79
|
-
* name: 'output',
|
|
80
|
-
* alias: 'o',
|
|
81
|
-
* type: String,
|
|
82
|
-
* description: 'Output directory'
|
|
83
|
-
* }
|
|
84
|
-
* ],
|
|
85
|
-
* execute: ({ options }) => {
|
|
86
|
-
* console.log(`Building to ${options.output || 'dist'}`);
|
|
87
|
-
* }
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
addCommand<OD extends OptionDefinition<unknown> = OptionDefinition<unknown>>(command: ICommand<OD, T>): this;
|
|
92
|
-
/**
|
|
93
|
-
* Adds a plugin to extend the CLI functionality.
|
|
94
|
-
*
|
|
95
|
-
* Plugins can hook into various lifecycle events and modify the toolbox
|
|
96
|
-
* to provide additional functionality to commands.
|
|
97
|
-
* @param plugin The plugin to register
|
|
98
|
-
* @returns The CLI instance for method chaining
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* cli.addPlugin({
|
|
102
|
-
* name: 'logger',
|
|
103
|
-
* execute: (toolbox) => {
|
|
104
|
-
* toolbox.logger = createCustomLogger();
|
|
105
|
-
* }
|
|
106
|
-
* });
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
addPlugin(plugin: Plugin<T>): this;
|
|
110
|
-
/**
|
|
111
|
-
* Gets the plugin manager instance for advanced plugin management.
|
|
112
|
-
* @returns The plugin manager instance
|
|
113
|
-
*/
|
|
114
|
-
getPluginManager(): PluginManager<T>;
|
|
115
|
-
/**
|
|
116
|
-
* Gets the CLI application name.
|
|
117
|
-
*/
|
|
118
|
-
getCliName(): string;
|
|
119
|
-
/**
|
|
120
|
-
* Gets the package version if configured.
|
|
121
|
-
* @returns The package version or undefined
|
|
122
|
-
*/
|
|
123
|
-
getPackageVersion(): string | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Gets the package name if configured.
|
|
126
|
-
* @returns The package name or undefined
|
|
127
|
-
*/
|
|
128
|
-
getPackageName(): string | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* Gets all registered commands.
|
|
131
|
-
* @returns A map of command names to command definitions
|
|
132
|
-
*/
|
|
133
|
-
getCommands(): Map<string, ICommand<OptionDefinition<unknown>, T>>;
|
|
134
|
-
/**
|
|
135
|
-
* Gets the current working directory.
|
|
136
|
-
* @returns The current working directory path
|
|
137
|
-
*/
|
|
138
|
-
getCwd(): string;
|
|
139
|
-
/**
|
|
140
|
-
* Disposes the CLI instance and cleans up resources.
|
|
141
|
-
*
|
|
142
|
-
* This method removes event listeners and performs cleanup to prevent memory leaks.
|
|
143
|
-
* Call this method when the CLI instance is no longer needed, especially in long-running
|
|
144
|
-
* processes or when creating multiple CLI instances.
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const cli = new Cerebro('my-app');
|
|
148
|
-
* // ... use the cli
|
|
149
|
-
* cli.dispose(); // Clean up when done
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
dispose(): void;
|
|
153
|
-
/**
|
|
154
|
-
* Runs the CLI application.
|
|
155
|
-
*
|
|
156
|
-
* This method parses command line arguments, executes the appropriate command,
|
|
157
|
-
* and handles the complete CLI lifecycle including plugin initialization,
|
|
158
|
-
* error handling, process termination, and automatic cleanup.
|
|
159
|
-
* @param extraOptions Additional options to pass to commands
|
|
160
|
-
* @param extraOptions.shouldExitProcess Whether to exit the process after execution (default: true)
|
|
161
|
-
* @param extraOptions.autoDispose Whether to automatically cleanup/dispose resources after execution (default: true)
|
|
162
|
-
* @returns A promise that resolves when execution completes
|
|
163
|
-
* @throws {CommandNotFoundError} If the specified command doesn't exist
|
|
164
|
-
* @throws {Error} If command arguments are invalid or conflicting options are provided
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* // Run with default behavior (exits process and auto-disposes)
|
|
168
|
-
* await cli.run();
|
|
169
|
-
*
|
|
170
|
-
* // Run without exiting (for testing)
|
|
171
|
-
* await cli.run({ shouldExitProcess: false });
|
|
172
|
-
*
|
|
173
|
-
* // Run without auto-disposing (for reuse)
|
|
174
|
-
* await cli.run({ autoDispose: false });
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
run(extraOptions?: CliRunOptions): Promise<void>;
|
|
178
|
-
/**
|
|
179
|
-
* Runs a command programmatically from within another command.
|
|
180
|
-
*
|
|
181
|
-
* This method allows commands to call other commands during execution,
|
|
182
|
-
* enabling composition of commands and reusable command logic.
|
|
183
|
-
* @param commandName The name of the command to execute
|
|
184
|
-
* @param options Optional options including argv and other command options
|
|
185
|
-
* @returns A promise that resolves with the command's result
|
|
186
|
-
* @throws {CommandNotFoundError} If the specified command doesn't exist
|
|
187
|
-
* @throws {CerebroError} If command validation fails
|
|
188
|
-
* @example
|
|
189
|
-
* ```typescript
|
|
190
|
-
* cli.addCommand({
|
|
191
|
-
* name: 'deploy',
|
|
192
|
-
* execute: async ({ runtime, logger }) => {
|
|
193
|
-
* logger.info('Building...');
|
|
194
|
-
* await runtime.runCommand('build', { argv: ['--production'] });
|
|
195
|
-
*
|
|
196
|
-
* logger.info('Testing...');
|
|
197
|
-
* await runtime.runCommand('test', { argv: ['--coverage'] });
|
|
198
|
-
* }
|
|
199
|
-
* });
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
runCommand(commandName: string, options?: RunCommandOptions): Promise<unknown>;
|
|
203
|
-
}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Output with this option will be formatted.
|
|
3
|
-
*/
|
|
4
|
-
export declare const OUTPUT_NORMAL = 1;
|
|
5
|
-
/**
|
|
6
|
-
* Output with this option will be passed as-is.
|
|
7
|
-
*/
|
|
8
|
-
export declare const OUTPUT_RAW = 2;
|
|
9
|
-
/**
|
|
10
|
-
* Output with this option will have any formatting stripped away.
|
|
11
|
-
*/
|
|
12
|
-
export declare const OUTPUT_PLAIN = 4;
|
|
13
|
-
/**
|
|
14
|
-
* Output with this verbosity won't write anything at all.
|
|
15
|
-
*/
|
|
16
|
-
export declare const VERBOSITY_QUIET = 16;
|
|
17
|
-
/**
|
|
18
|
-
* Output with this verbosity will write default content.
|
|
19
|
-
*/
|
|
20
|
-
export declare const VERBOSITY_NORMAL = 32;
|
|
21
|
-
/**
|
|
22
|
-
* Output with this verbosity will be more detailed.
|
|
23
|
-
*/
|
|
24
|
-
export declare const VERBOSITY_VERBOSE = 64;
|
|
25
|
-
/**
|
|
26
|
-
* Output with this verbosity will reveal internals.
|
|
27
|
-
*/
|
|
28
|
-
export declare const VERBOSITY_DEBUG = 128;
|
|
29
|
-
export declare const POSITIONALS_KEY = "positionals";
|
package/dist/default-env.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { EnvDefinition } from "./types/command.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Default environment variables used by Cerebro CLI framework.
|
|
4
|
-
* These are displayed in the help output.
|
|
5
|
-
*/
|
|
6
|
-
declare const defaultEnv: (EnvDefinition<string> | EnvDefinition<number> | EnvDefinition<boolean>)[];
|
|
7
|
-
export default defaultEnv;
|
package/dist/empty-toolbox.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Toolbox as IToolbox } from "./types/toolbox.d.ts";
|
|
2
|
-
declare class EmptyToolbox implements Partial<IToolbox> {
|
|
3
|
-
[x: string]: unknown;
|
|
4
|
-
result?: unknown;
|
|
5
|
-
argv?: IToolbox["argv"];
|
|
6
|
-
options?: IToolbox["options"];
|
|
7
|
-
argument?: IToolbox["argument"];
|
|
8
|
-
command: IToolbox["command"];
|
|
9
|
-
commandName: IToolbox["commandName"];
|
|
10
|
-
env?: IToolbox["env"];
|
|
11
|
-
logger?: IToolbox["logger"];
|
|
12
|
-
runtime?: IToolbox["runtime"];
|
|
13
|
-
constructor(commandName: IToolbox["commandName"], command: IToolbox["command"]);
|
|
14
|
-
}
|
|
15
|
-
export default EmptyToolbox;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { VisulimaError } from "@visulima/error";
|
|
2
|
-
/**
|
|
3
|
-
* Base error class for Cerebro CLI operations.
|
|
4
|
-
*/
|
|
5
|
-
declare class CerebroError extends VisulimaError {
|
|
6
|
-
readonly code: string;
|
|
7
|
-
readonly context?: Record<string, unknown>;
|
|
8
|
-
constructor(message: string, code: string, context?: Record<string, unknown>);
|
|
9
|
-
}
|
|
10
|
-
export default CerebroError;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import CerebroError from "./cerebro-error.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when a command is not found.
|
|
4
|
-
*/
|
|
5
|
-
declare class CommandNotFoundError extends CerebroError {
|
|
6
|
-
readonly commandName: string;
|
|
7
|
-
constructor(commandName: string, suggestions?: string[]);
|
|
8
|
-
}
|
|
9
|
-
export default CommandNotFoundError;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import CerebroError from "./cerebro-error.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when command validation fails.
|
|
4
|
-
*/
|
|
5
|
-
declare class CommandValidationError extends CerebroError {
|
|
6
|
-
readonly commandName: string;
|
|
7
|
-
readonly missingOptions: string[];
|
|
8
|
-
constructor(commandName: string, missingOptions: string[]);
|
|
9
|
-
}
|
|
10
|
-
export default CommandValidationError;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import CerebroError from "./cerebro-error.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when completion command operations fail.
|
|
4
|
-
*/
|
|
5
|
-
declare class CompletionError extends CerebroError {
|
|
6
|
-
readonly troubleshooting: string[];
|
|
7
|
-
constructor(message: string, code: string, troubleshooting?: string[]);
|
|
8
|
-
}
|
|
9
|
-
export default CompletionError;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import CerebroError from "./cerebro-error.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when there are conflicting options.
|
|
4
|
-
*/
|
|
5
|
-
declare class ConflictingOptionsError extends CerebroError {
|
|
6
|
-
readonly option1: string;
|
|
7
|
-
readonly option2: string;
|
|
8
|
-
constructor(option1: string, option2: string);
|
|
9
|
-
}
|
|
10
|
-
export default ConflictingOptionsError;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import CerebroError from "./cerebro-error.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when plugin operations fail.
|
|
4
|
-
*/
|
|
5
|
-
declare class PluginError extends CerebroError {
|
|
6
|
-
readonly pluginName: string;
|
|
7
|
-
constructor(pluginName: string, message: string, originalError?: Error);
|
|
8
|
-
}
|
|
9
|
-
export default PluginError;
|