@visulima/cerebro 3.0.0-alpha.10 → 3.0.0-alpha.11

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 CHANGED
@@ -1,3 +1,33 @@
1
+ ## @visulima/cerebro [3.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.10...@visulima/cerebro@3.0.0-alpha.11) (2026-04-22)
2
+
3
+ ### Features
4
+
5
+ * **cerebro:** expose rawUnknown on the Toolbox ([0d92cdf](https://github.com/visulima/visulima/commit/0d92cdf22270db5420af8b639b135b75e043de08))
6
+
7
+ ### Bug Fixes
8
+
9
+ * **cerebro:** cast positionals argument to string array ([432ac5d](https://github.com/visulima/visulima/commit/432ac5dab63a71583e3d170dc1c014dc735d6a1d))
10
+ * **cerebro:** resolve eslint and formatting issues ([d362f80](https://github.com/visulima/visulima/commit/d362f8011afa2fdf7195544a05468ad425904c27))
11
+ * Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
12
+ * **terminal:** resolve eslint and formatting issues ([12ef283](https://github.com/visulima/visulima/commit/12ef283684d1808fbcfe44077a0cfe8324801485))
13
+ * **terminal:** resolve eslint and formatting issues ([8f30389](https://github.com/visulima/visulima/commit/8f30389deb9ff81e7afce0aa064ef11fcb179f23))
14
+
15
+ ### Miscellaneous Chores
16
+
17
+ * bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
18
+ * **cerebro:** apply formatter and lint fixes ([25aedfa](https://github.com/visulima/visulima/commit/25aedfa32a9476e8a127580e2a4154bca512342d))
19
+ * **cerebro:** apply formatter and lint fixes ([f2d19a1](https://github.com/visulima/visulima/commit/f2d19a167b8ebef07e2c2cce241673a6c34a8112))
20
+ * **cerebro:** apply pending changes ([5502fd8](https://github.com/visulima/visulima/commit/5502fd8399ef704bf9d5c192642aef35b73275ef))
21
+ * **cerebro:** apply pending lint and source updates ([727956c](https://github.com/visulima/visulima/commit/727956c737b9a1f811bc71c5343bcc56f91e5097))
22
+ * **cerebro:** enforce curly braces and apply lint fixes ([79f5b19](https://github.com/visulima/visulima/commit/79f5b19bf8f1c6e6f4d2c47f4a160bfcf44b6bb4))
23
+ * fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * **@visulima/boxen:** upgraded to 3.0.0-alpha.10
29
+ * **@visulima/pail:** upgraded to 4.0.0-alpha.11
30
+
1
31
  ## @visulima/cerebro [3.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.9...@visulima/cerebro@3.0.0-alpha.10) (2026-04-08)
2
32
 
3
33
  ### Features
@@ -1,5 +1,5 @@
1
1
  import { inverse, cyan, green, yellow } from '@visulima/colorize';
2
- import { t as templateFormat, c as commandLineUsage } from '../packem_shared/index-CS31xKFe.js';
2
+ import { t as templateFormat, c as commandLineUsage } from '../packem_shared/index-DNXLgme3.js';
3
3
 
4
4
  const defaultEnv = [
5
5
  {
@@ -31,7 +31,7 @@ const {
31
31
  dirname
32
32
  } = __cjs_getBuiltinModule("node:path");
33
33
  import GithubSlugger from 'github-slugger';
34
- import { c as commandLineUsage } from '../packem_shared/index-CS31xKFe.js';
34
+ import { c as commandLineUsage } from '../packem_shared/index-DNXLgme3.js';
35
35
  import { g as getCwd, a as getVersions, b as getPlatform, c as getArch } from '../packem_shared/runtime-process-B6ZplyWn.js';
36
36
 
37
37
  const slugger = new GithubSlugger();
@@ -90,9 +90,7 @@ const formatCommandHelp = (command, cliName) => {
90
90
  if (Array.isArray(command.options) && command.options.length > 0) {
91
91
  usageGroups.push({
92
92
  header: " Command Options ",
93
- optionList: command.options.filter(
94
- (option) => !option.hidden
95
- )
93
+ optionList: command.options.filter((option) => !option.hidden)
96
94
  });
97
95
  }
98
96
  addEnvironmentVariables(command, usageGroups);
@@ -172,14 +170,7 @@ const generateMultiCommands = async (commands, outputDirectory, cliName, options
172
170
  const groupPath = group.replaceAll(":", "/");
173
171
  const filePath = join(".", outputDirectory, `${groupPath}.md`);
174
172
  const bin = `\`${cliName} ${group}\``;
175
- const document = `${[
176
- bin,
177
- "=".repeat(bin.length),
178
- "",
179
- `Commands in the ${group} group.`,
180
- "",
181
- generateCommands(groupCommands, cliName)
182
- ].join("\n").trim()}
173
+ const document = `${[bin, "=".repeat(bin.length), "", `Commands in the ${group} group.`, "", generateCommands(groupCommands, cliName)].join("\n").trim()}
183
174
  `;
184
175
  if (!options.dryRun) {
185
176
  await writeFileWithDirectory(resolve(getCwd(), filePath), document);
@@ -10,6 +10,7 @@ declare class EmptyToolbox implements Partial<IToolbox> {
10
10
  env?: IToolbox["env"];
11
11
  logger?: IToolbox["logger"];
12
12
  runtime?: IToolbox["runtime"];
13
+ rawUnknown?: IToolbox["rawUnknown"];
13
14
  constructor(commandName: IToolbox["commandName"], command: IToolbox["command"]);
14
15
  }
15
16
  export default EmptyToolbox;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Cli } from './packem_shared/Cerebro-bgCm5Tb1.js';
1
+ import { Cli } from './packem_shared/Cerebro-CXEIHSN2.js';
2
2
  export { VERBOSITY_DEBUG, VERBOSITY_NORMAL, VERBOSITY_QUIET, VERBOSITY_VERBOSE } from './packem_shared/VERBOSITY_QUIET-Dp46zlLW.js';
3
3
  export { VisulimaError } from './packem_shared/VisulimaError-DA7QsCxH.js';
4
4
 
@@ -1126,6 +1126,7 @@ class EmptyToolbox {
1126
1126
  env;
1127
1127
  logger;
1128
1128
  runtime;
1129
+ rawUnknown;
1129
1130
  constructor(commandName, command) {
1130
1131
  this.commandName = commandName;
1131
1132
  this.command = command;
@@ -1286,13 +1287,14 @@ const buildOptionMaps = (commandOptions) => {
1286
1287
  };
1287
1288
  const prepareToolbox = (command, parsedArgs, booleanValues, extraOptions) => {
1288
1289
  const toolbox = new EmptyToolbox(command.name, command);
1289
- const { _all, positionals } = parsedArgs;
1290
+ const { _all, _unknown, positionals } = parsedArgs;
1290
1291
  const hasBooleanValues = Object.keys(booleanValues).length > 0;
1291
1292
  const mergedAll = hasBooleanValues ? { ..._all, ...booleanValues } : _all;
1292
1293
  if (POSITIONALS_KEY in mergedAll) {
1293
1294
  delete mergedAll[POSITIONALS_KEY];
1294
1295
  }
1295
1296
  toolbox.argument = positionals?.[POSITIONALS_KEY] ?? [];
1297
+ toolbox.rawUnknown = (_unknown ?? []).slice();
1296
1298
  const hasExtraOptions = Object.keys(extraOptions).length > 0;
1297
1299
  toolbox.options = hasExtraOptions ? { ...mergedAll, ...extraOptions } : mergedAll;
1298
1300
  toolbox.env = processEnvVariables(command.env);
@@ -2820,7 +2822,10 @@ class Cli {
2820
2822
  this.#logger.debug(`command '${pathKey}' found, parsing command args: ${commandArguments.join(", ")}`);
2821
2823
  const { arguments_, booleanValues, parsedArgs } = processCommandArgs(command, commandArguments, this.#getAllGlobalOptions());
2822
2824
  const hasBooleanValues = Object.keys(booleanValues).length > 0;
2823
- const commandArgs = hasBooleanValues ? { ...parsedArgs, _all: { ...parsedArgs._all, ...booleanValues } } : parsedArgs;
2825
+ let commandArgs = parsedArgs;
2826
+ if (hasBooleanValues) {
2827
+ commandArgs = { ...parsedArgs, _all: { ...parsedArgs._all, ...booleanValues } };
2828
+ }
2824
2829
  validateRequiredOptions(arguments_, commandArgs, command);
2825
2830
  const toolbox = prepareToolbox(command, parsedArgs, booleanValues, extraOptions);
2826
2831
  toolbox.runtime = this;
@@ -3102,7 +3107,9 @@ class Cli {
3102
3107
  }
3103
3108
  const existingNames = new Set(this.#customGlobalOptions.map((o) => o.name));
3104
3109
  if (existingNames.has(optionDefinition.name)) {
3105
- throw new CerebroError(`Global option "--${optionDefinition.name}" has already been added`, "DUPLICATE_OPTION", { optionName: optionDefinition.name });
3110
+ throw new CerebroError(`Global option "--${optionDefinition.name}" has already been added`, "DUPLICATE_OPTION", {
3111
+ optionName: optionDefinition.name
3112
+ });
3106
3113
  }
3107
3114
  optionDefinition.group = "global";
3108
3115
  mapOptionTypeLabel(optionDefinition);
@@ -124,7 +124,8 @@ class ContentSection extends BaseSection {
124
124
  table.addRow([templateFormat(content)]);
125
125
  return table.toString();
126
126
  }
127
- if (Array.isArray(content) && content.every((value) => typeof value === "string" || Array.isArray(value) && value.every((value2) => typeof value2 === "string"))) {
127
+ if (Array.isArray(content) && // eslint-disable-next-line @typescript-eslint/no-shadow
128
+ content.every((value) => typeof value === "string" || Array.isArray(value) && value.every((value2) => typeof value2 === "string"))) {
128
129
  const table = createTable({
129
130
  showHeader: false,
130
131
  style: {
@@ -213,7 +214,10 @@ class OptionListSection extends BaseSection {
213
214
  });
214
215
  definitions.forEach((definition) => {
215
216
  const typedDefinition = definition;
216
- table.addRow([this.getOptionNames(typedDefinition, data.reverseNameOrder ?? false, data.isArgument ?? false), templateFormat(typedDefinition.description)]);
217
+ table.addRow([
218
+ this.getOptionNames(typedDefinition, data.reverseNameOrder ?? false, data.isArgument ?? false),
219
+ templateFormat(typedDefinition.description)
220
+ ]);
217
221
  });
218
222
  this.add(table.toString());
219
223
  this.lines.push("");
@@ -482,7 +482,8 @@ const updateNotifierPlugin = (options = {}) => {
482
482
  updateCheckInterval: 1e3 * 60 * 60 * 24,
483
483
  ...options
484
484
  };
485
- const shouldCheck = Boolean(updateNotifierOptions.alwaysRun) || !(env.NO_UPDATE_NOTIFIER || env.NODE_ENV === "test" || toolbox.argv.includes("--no-update-notifier") || ciInfoExports.isCI);
485
+ const shouldCheck = Boolean(updateNotifierOptions.alwaysRun) || // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentional boolean coercion for truthy check
486
+ !(env.NO_UPDATE_NOTIFIER || env.NODE_ENV === "test" || toolbox.argv.includes("--no-update-notifier") || ciInfoExports.isCI);
486
487
  if (!shouldCheck) {
487
488
  logger.debug("Update notifier: skipping check (disabled by environment or flags)");
488
489
  return;
@@ -89,6 +89,30 @@ export interface Toolbox<TLogger extends Console = Console, TOptions extends Rec
89
89
  * ```
90
90
  */
91
91
  options: TOptions;
92
+ /**
93
+ * Raw tokens that command-line-args could not assign to a defined
94
+ * option — typically everything after a `--` separator, since
95
+ * cerebro runs the parser with `stopAtFirstUnknown: true`.
96
+ *
97
+ * Use this for passthrough patterns like
98
+ * `my-cmd foo bar -- --flag=value --other`, where everything after
99
+ * `--` is forwarded to an inner tool (`create-vite`, a template
100
+ * runner, etc.). Empty array when there was no `--` segment.
101
+ * @example
102
+ * ```typescript
103
+ * cli.addCommand({
104
+ * name: "create",
105
+ * argument: { name: "template", type: String },
106
+ * execute: ({ argument, rawUnknown }) => {
107
+ * // `vis create vite my-app -- --template react-ts`
108
+ * // → argument === ["vite", "my-app"]
109
+ * // → rawUnknown === ["--template", "react-ts"]
110
+ * spawnSync("npm", ["create", "vite", ...rawUnknown]);
111
+ * },
112
+ * });
113
+ * ```
114
+ */
115
+ rawUnknown: ReadonlyArray<string>;
92
116
  /**
93
117
  * This is the instance of the CLI that is running the command.
94
118
  */
@@ -5,5 +5,5 @@
5
5
  * @param logger Console-like logger instance for error reporting
6
6
  * @returns Cleanup function to remove event listeners
7
7
  */
8
- declare const registerExceptionHandler: (logger: Console) => () => void;
8
+ declare const registerExceptionHandler: (logger: Console) => (() => void);
9
9
  export default registerExceptionHandler;
@@ -62,4 +62,4 @@ export type ProcessEventHandler = (...args: unknown[]) => void;
62
62
  * @param handler Handler function
63
63
  * @returns Cleanup function to remove the handler
64
64
  */
65
- export declare const onProcessEvent: (event: ProcessEventType, handler: ProcessEventHandler) => () => void;
65
+ export declare const onProcessEvent: (event: ProcessEventType, handler: ProcessEventHandler) => (() => void);
@@ -9,7 +9,7 @@ export declare const validateStringArray: (value: unknown, fieldName: string) =>
9
9
  /**
10
10
  * Validates that a value is a function.
11
11
  */
12
- export declare const validateFunction: (value: unknown, fieldName: string) => (...args: unknown[]) => unknown;
12
+ export declare const validateFunction: (value: unknown, fieldName: string) => ((...args: unknown[]) => unknown);
13
13
  /**
14
14
  * Validates that a value is an object (but not null).
15
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "3.0.0-alpha.10",
3
+ "version": "3.0.0-alpha.11",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -111,15 +111,15 @@
111
111
  "LICENSE.md"
112
112
  ],
113
113
  "dependencies": {
114
- "@visulima/colorize": "2.0.0-alpha.8",
115
- "@visulima/tabular": "4.0.0-alpha.9",
114
+ "@visulima/colorize": "2.0.0-alpha.10",
115
+ "@visulima/tabular": "4.0.0-alpha.11",
116
116
  "fastest-levenshtein": "^1.0.16"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "@bomb.sh/tab": "0.0.14",
120
- "@visulima/boxen": "3.0.0-alpha.9",
121
- "@visulima/find-cache-dir": "3.0.0-alpha.7",
122
- "@visulima/pail": "4.0.0-alpha.10",
120
+ "@visulima/boxen": "3.0.0-alpha.10",
121
+ "@visulima/find-cache-dir": "3.0.0-alpha.9",
122
+ "@visulima/pail": "4.0.0-alpha.11",
123
123
  "github-slugger": "2.0.0"
124
124
  },
125
125
  "peerDependenciesMeta": {
@@ -140,7 +140,7 @@
140
140
  }
141
141
  },
142
142
  "engines": {
143
- "node": ">=22.13 <=25.x"
143
+ "node": "^22.14.0 || >=24.10.0"
144
144
  },
145
145
  "os": [
146
146
  "darwin",