@visulima/cerebro 3.0.0-alpha.13 → 3.0.0-alpha.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE.md +92 -91
  3. package/dist/commands/completion-command.d.ts +1 -1
  4. package/dist/commands/completion-command.js +5 -204
  5. package/dist/commands/help-command.d.ts +1 -1
  6. package/dist/commands/help-command.js +1 -262
  7. package/dist/commands/readme-command.d.ts +1 -1
  8. package/dist/commands/readme-command.js +32 -317
  9. package/dist/commands/version-command.d.ts +1 -1
  10. package/dist/commands/version-command.js +1 -18
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.js +1 -8
  13. package/dist/logger/create-pail-logger.js +1 -34
  14. package/dist/packem_chunks/has-new-version.js +1 -264
  15. package/dist/packem_shared/Cerebro-Cnr7AGMP.js +4 -0
  16. package/dist/packem_shared/VERBOSITY_QUIET-XPultrIA.js +1 -0
  17. package/dist/packem_shared/VisulimaError-Bh91XNXu.js +76 -0
  18. package/dist/packem_shared/cerebro-error-BnJTixb2.js +1 -0
  19. package/dist/packem_shared/index-B0BiusY7.js +6 -0
  20. package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +1 -0
  21. package/dist/packem_shared/lazyNamed-DOmefeJM.js +1 -0
  22. package/dist/packem_shared/{plugin-manager.d-Du-YXFui.d.ts → plugin-manager.d-Dz-wu1tI.d.ts} +3 -0
  23. package/dist/packem_shared/renderError-B_XyYPKJ-B65kP-Ou.js +24 -0
  24. package/dist/packem_shared/runtime-process-DKHFvYkv.js +1 -0
  25. package/dist/plugins/error-handler-plugin.d.ts +1 -1
  26. package/dist/plugins/error-handler-plugin.js +1 -648
  27. package/dist/plugins/runtime-version-check-plugin.d.ts +1 -1
  28. package/dist/plugins/runtime-version-check-plugin.js +1 -77
  29. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +1 -1
  30. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -517
  31. package/dist/util/general/compile-cache.js +1 -16
  32. package/dist/util/general/heap-tuning.js +1 -91
  33. package/package.json +23 -23
  34. package/dist/packem_shared/Cerebro-C1h3DXwy.js +0 -3509
  35. package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +0 -10
  36. package/dist/packem_shared/VisulimaError-DA7QsCxH.js +0 -34
  37. package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +0 -16
  38. package/dist/packem_shared/index--1UArng3.js +0 -267
  39. package/dist/packem_shared/lazyNamed-B278Tf9_.js +0 -6
  40. package/dist/packem_shared/runtime-process-B6ZplyWn.js +0 -187
package/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## @visulima/cerebro [3.0.0-alpha.15](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.14...@visulima/cerebro@3.0.0-alpha.15) (2026-05-06)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **cerebro:** apply prettier and eslint quote-style auto-fix ([31132ae](https://github.com/visulima/visulima/commit/31132aeab40b3f6fa920a37635813e14d7e8b17e))
6
+ * **cerebro:** fix lint errors ([87649b0](https://github.com/visulima/visulima/commit/87649b0408ce3667bf1be9be795321851e6e8f15))
7
+ * **cerebro:** housekeeping cleanup ([643b7d9](https://github.com/visulima/visulima/commit/643b7d9e268dca11544f0b9476b011a8620c04c8))
8
+
9
+ ### Continuous Integration
10
+
11
+ * integrate codspeed for benchmark tracking ([e758f3d](https://github.com/visulima/visulima/commit/e758f3da491cc00d3f8bbf10d7ba3fdf8deb5325))
12
+
13
+
14
+ ### Dependencies
15
+
16
+ * **@visulima/error:** upgraded to 6.0.0-alpha.16
17
+ * **@visulima/pail:** upgraded to 4.0.0-alpha.13
18
+
19
+ ## @visulima/cerebro [3.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.13...@visulima/cerebro@3.0.0-alpha.14) (2026-05-04)
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * **@visulima/error:** upgraded to 6.0.0-alpha.15
25
+
1
26
  ## @visulima/cerebro [3.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.12...@visulima/cerebro@3.0.0-alpha.13) (2026-04-30)
2
27
 
3
28
  ### Features
package/LICENSE.md CHANGED
@@ -133,44 +133,20 @@ Repository: git+https://github.com/visulima/visulima.git
133
133
  > > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
134
134
  > > >
135
135
  > > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136
- > >
137
- > >
138
- > >
139
- > >
140
- > >
141
- > > # Licenses of bundled types
142
- > > The published @visulima/error artifact additionally contains code with the following licenses:
143
- > > Apache-2.0
144
- > >
145
- > > # Bundled types:
146
- > > ## ai
147
- > > License: Apache-2.0
148
- > > Repository: https://github.com/vercel/ai
149
- > >
150
- > > > Copyright 2023 Vercel, Inc.
151
- > > >
152
- > > > Licensed under the Apache License, Version 2.0 (the "License");
153
- > > > you may not use this file except in compliance with the License.
154
- > > > You may obtain a copy of the License at
155
- > > >
156
- > > > http://www.apache.org/licenses/LICENSE-2.0
157
- > > >
158
- > > > Unless required by applicable law or agreed to in writing, software
159
- > > > distributed under the License is distributed on an "AS IS" BASIS,
160
- > > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
161
- > > > See the License for the specific language governing permissions and
162
- > > > limitations under the License.
163
136
  >
164
137
  >
165
138
  >
166
139
  >
167
140
  >
168
141
  > # Licenses of bundled types
142
+ >
169
143
  > The published @visulima/command-line-args artifact additionally contains code with the following licenses:
170
144
  > MIT
171
145
  >
172
146
  > # Bundled types:
147
+ >
173
148
  > ## @visulima/error
149
+ >
174
150
  > License: MIT
175
151
  > By: Daniel Bannert
176
152
  > Repository: git+https://github.com/visulima/visulima.git
@@ -198,6 +174,40 @@ Repository: git+https://github.com/visulima/visulima.git
198
174
  > > SOFTWARE.
199
175
  > >
200
176
  > >
177
+ >
178
+ > # Licenses of bundled dependencies
179
+ > The published @visulima/command-line-args artifact additionally contains code with the following licenses:
180
+ > MIT
181
+ >
182
+ > # Bundled dependencies:
183
+ > ## @visulima/error
184
+ > License: MIT
185
+ > By: Daniel Bannert
186
+ > Repository: git+https://github.com/visulima/visulima.git
187
+ >
188
+ > > MIT License
189
+ > >
190
+ > > Copyright (c) 2026 visulima
191
+ > >
192
+ > > Permission is hereby granted, free of charge, to any person obtaining a copy
193
+ > > of this software and associated documentation files (the "Software"), to deal
194
+ > > in the Software without restriction, including without limitation the rights
195
+ > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
196
+ > > copies of the Software, and to permit persons to whom the Software is
197
+ > > furnished to do so, subject to the following conditions:
198
+ > >
199
+ > > The above copyright notice and this permission notice shall be included in all
200
+ > > copies or substantial portions of the Software.
201
+ > >
202
+ > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
203
+ > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
204
+ > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
205
+ > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
206
+ > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207
+ > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
208
+ > > SOFTWARE.
209
+ > >
210
+ > >
201
211
  > >
202
212
  > > # Licenses of bundled dependencies
203
213
  > > The published @visulima/error artifact additionally contains code with the following licenses:
@@ -218,19 +228,20 @@ Repository: git+https://github.com/visulima/visulima.git
218
228
  > > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
219
229
  > > >
220
230
  > > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
221
- > >
222
- > >
223
- > >
224
- > >
231
+ >
232
+ >
225
233
  > >
226
234
  > > # Licenses of bundled types
235
+ > >
227
236
  > > The published @visulima/error artifact additionally contains code with the following licenses:
228
237
  > > Apache-2.0
229
238
  > >
230
239
  > > # Bundled types:
240
+ > >
231
241
  > > ## ai
242
+ > >
232
243
  > > License: Apache-2.0
233
- > > Repository: https://github.com/vercel/ai
244
+ > > Repository: git+https://github.com/vercel/ai.git
234
245
  > >
235
246
  > > > Copyright 2023 Vercel, Inc.
236
247
  > > >
@@ -278,11 +289,14 @@ Repository: git+https://github.com/visulima/visulima.git
278
289
  >
279
290
  >
280
291
  > # Licenses of bundled dependencies
292
+ >
281
293
  > The published @visulima/error artifact additionally contains code with the following licenses:
282
294
  > MIT
283
295
  >
284
296
  > # Bundled dependencies:
297
+ >
285
298
  > ## is-plain-obj
299
+ >
286
300
  > License: MIT
287
301
  > By: Sindre Sorhus
288
302
  > Repository: sindresorhus/is-plain-obj
@@ -1231,44 +1245,20 @@ Repository: git+https://github.com/visulima/visulima.git
1231
1245
  > > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1232
1246
  > > >
1233
1247
  > > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1234
- > >
1235
- > >
1236
- > >
1237
- > >
1238
- > >
1239
- > > # Licenses of bundled types
1240
- > > The published @visulima/error artifact additionally contains code with the following licenses:
1241
- > > Apache-2.0
1242
- > >
1243
- > > # Bundled types:
1244
- > > ## ai
1245
- > > License: Apache-2.0
1246
- > > Repository: https://github.com/vercel/ai
1247
- > >
1248
- > > > Copyright 2023 Vercel, Inc.
1249
- > > >
1250
- > > > Licensed under the Apache License, Version 2.0 (the "License");
1251
- > > > you may not use this file except in compliance with the License.
1252
- > > > You may obtain a copy of the License at
1253
- > > >
1254
- > > > http://www.apache.org/licenses/LICENSE-2.0
1255
- > > >
1256
- > > > Unless required by applicable law or agreed to in writing, software
1257
- > > > distributed under the License is distributed on an "AS IS" BASIS,
1258
- > > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1259
- > > > See the License for the specific language governing permissions and
1260
- > > > limitations under the License.
1261
1248
  >
1262
1249
  > <!-- /DEPENDENCIES -->
1263
1250
  >
1264
1251
  >
1265
1252
  >
1266
1253
  > # Licenses of bundled types
1254
+ >
1267
1255
  > The published @visulima/command-line-args artifact additionally contains code with the following licenses:
1268
1256
  > MIT
1269
1257
  >
1270
1258
  > # Bundled types:
1259
+ >
1271
1260
  > ## @visulima/error
1261
+ >
1272
1262
  > License: MIT
1273
1263
  > By: Daniel Bannert
1274
1264
  > Repository: git+https://github.com/visulima/visulima.git
@@ -1296,6 +1286,40 @@ Repository: git+https://github.com/visulima/visulima.git
1296
1286
  > > SOFTWARE.
1297
1287
  > >
1298
1288
  > > <!-- DEPENDENCIES -->
1289
+ >
1290
+ > # Licenses of bundled dependencies
1291
+ > The published @visulima/command-line-args artifact additionally contains code with the following licenses:
1292
+ > MIT
1293
+ >
1294
+ > # Bundled dependencies:
1295
+ > ## @visulima/error
1296
+ > License: MIT
1297
+ > By: Daniel Bannert
1298
+ > Repository: git+https://github.com/visulima/visulima.git
1299
+ >
1300
+ > > MIT License
1301
+ > >
1302
+ > > Copyright (c) 2026 visulima
1303
+ > >
1304
+ > > Permission is hereby granted, free of charge, to any person obtaining a copy
1305
+ > > of this software and associated documentation files (the "Software"), to deal
1306
+ > > in the Software without restriction, including without limitation the rights
1307
+ > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1308
+ > > copies of the Software, and to permit persons to whom the Software is
1309
+ > > furnished to do so, subject to the following conditions:
1310
+ > >
1311
+ > > The above copyright notice and this permission notice shall be included in all
1312
+ > > copies or substantial portions of the Software.
1313
+ > >
1314
+ > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1315
+ > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1316
+ > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1317
+ > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1318
+ > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1319
+ > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1320
+ > > SOFTWARE.
1321
+ > >
1322
+ > >
1299
1323
  > >
1300
1324
  > > # Licenses of bundled dependencies
1301
1325
  > > The published @visulima/error artifact additionally contains code with the following licenses:
@@ -1316,19 +1340,20 @@ Repository: git+https://github.com/visulima/visulima.git
1316
1340
  > > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1317
1341
  > > >
1318
1342
  > > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1319
- > >
1320
- > > <!-- /DEPENDENCIES -->
1321
- > >
1322
- > >
1343
+ >
1344
+ > <!-- /DEPENDENCIES -->
1323
1345
  > >
1324
1346
  > > # Licenses of bundled types
1347
+ > >
1325
1348
  > > The published @visulima/error artifact additionally contains code with the following licenses:
1326
1349
  > > Apache-2.0
1327
1350
  > >
1328
1351
  > > # Bundled types:
1352
+ > >
1329
1353
  > > ## ai
1354
+ > >
1330
1355
  > > License: Apache-2.0
1331
- > > Repository: https://github.com/vercel/ai
1356
+ > > Repository: git+https://github.com/vercel/ai.git
1332
1357
  > >
1333
1358
  > > > Copyright 2023 Vercel, Inc.
1334
1359
  > > >
@@ -1376,11 +1401,14 @@ Repository: git+https://github.com/visulima/visulima.git
1376
1401
  > <!-- DEPENDENCIES -->
1377
1402
  >
1378
1403
  > # Licenses of bundled dependencies
1404
+ >
1379
1405
  > The published @visulima/error artifact additionally contains code with the following licenses:
1380
1406
  > MIT
1381
1407
  >
1382
1408
  > # Bundled dependencies:
1409
+ >
1383
1410
  > ## is-plain-obj
1411
+ >
1384
1412
  > License: MIT
1385
1413
  > By: Sindre Sorhus
1386
1414
  > Repository: sindresorhus/is-plain-obj
@@ -1506,33 +1534,6 @@ Repository: git+https://github.com/visulima/visulima.git
1506
1534
  > > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1507
1535
  > > >
1508
1536
  > > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1509
- > >
1510
- > >
1511
- > >
1512
- > >
1513
- > >
1514
- > > # Licenses of bundled types
1515
- > > The published @visulima/error artifact additionally contains code with the following licenses:
1516
- > > Apache-2.0
1517
- > >
1518
- > > # Bundled types:
1519
- > > ## ai
1520
- > > License: Apache-2.0
1521
- > > Repository: https://github.com/vercel/ai
1522
- > >
1523
- > > > Copyright 2023 Vercel, Inc.
1524
- > > >
1525
- > > > Licensed under the Apache License, Version 2.0 (the "License");
1526
- > > > you may not use this file except in compliance with the License.
1527
- > > > You may obtain a copy of the License at
1528
- > > >
1529
- > > > http://www.apache.org/licenses/LICENSE-2.0
1530
- > > >
1531
- > > > Unless required by applicable law or agreed to in writing, software
1532
- > > > distributed under the License is distributed on an "AS IS" BASIS,
1533
- > > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1534
- > > > See the License for the specific language governing permissions and
1535
- > > > limitations under the License.
1536
1537
  >
1537
1538
  > ---------------------------------------
1538
1539
  >
@@ -1,4 +1,4 @@
1
- import { C as Command } from "../packem_shared/plugin-manager.d-Du-YXFui.js";
1
+ import { C as Command } from "../packem_shared/plugin-manager.d-Dz-wu1tI.js";
2
2
  import '@visulima/tabular';
3
3
  /**
4
4
  * Generates shell completion scripts for the CLI application.
@@ -1,204 +1,5 @@
1
- import tab from '@bomb.sh/tab';
2
- import { C as CerebroError } from '../packem_shared/cerebro-error-GmJ3jN7Q.js';
3
-
4
- class CompletionError extends CerebroError {
5
- troubleshooting;
6
- constructor(message, code, troubleshooting = []) {
7
- super(message, code, { troubleshooting });
8
- this.name = "CompletionError";
9
- this.troubleshooting = troubleshooting;
10
- if (troubleshooting.length > 0) {
11
- this.hint = troubleshooting.join("\n");
12
- }
13
- }
14
- }
15
-
16
- const validShells = ["bash", "zsh", "fish", "powershell"];
17
- const validRuntimes = ["node", "bun", "deno"];
18
- const hasDeno = (global) => "Deno" in global;
19
- const hasBun = (global) => "Bun" in global;
20
- const detectRuntime = () => {
21
- if (hasDeno(globalThis)) {
22
- return "deno";
23
- }
24
- if (hasBun(globalThis)) {
25
- return "bun";
26
- }
27
- return "node";
28
- };
29
- const detectShell = (toolboxEnv) => {
30
- const starshipShell = toolboxEnv?.starshipShell;
31
- const shell = starshipShell ?? toolboxEnv?.shell;
32
- if (shell) {
33
- const shellPath = shell.toLowerCase();
34
- if (shellPath.includes("zsh")) {
35
- return "zsh";
36
- }
37
- if (shellPath.includes("bash")) {
38
- return "bash";
39
- }
40
- if (shellPath.includes("fish")) {
41
- return "fish";
42
- }
43
- }
44
- const psModulePath = toolboxEnv?.psModulePath;
45
- const prompt = toolboxEnv?.prompt;
46
- if (psModulePath || prompt?.includes("PS")) {
47
- return "powershell";
48
- }
49
- const comSpec = toolboxEnv?.comSpec;
50
- if (comSpec?.toLowerCase().includes("cmd.exe")) {
51
- return "bash";
52
- }
53
- return void 0;
54
- };
55
- const tabInstance = tab;
56
- const registerCommandOptions = (cmd, options) => {
57
- for (const option of options) {
58
- if (option.hidden) {
59
- continue;
60
- }
61
- if (option.name) {
62
- cmd.option(option.name, option.description ?? "");
63
- }
64
- if (option.alias) {
65
- cmd.option(option.alias, option.description ?? "");
66
- }
67
- }
68
- };
69
- const registerCommands = (tabInstance2, commands) => {
70
- for (const [commandName, command] of commands) {
71
- if (command.name !== commandName || command.hidden) {
72
- continue;
73
- }
74
- const cmd = tabInstance2.command(command.name, command.description ?? "");
75
- if (command.options) {
76
- registerCommandOptions(cmd, command.options);
77
- }
78
- }
79
- };
80
- const validateShell = (shell) => {
81
- if (!validShells.includes(shell)) {
82
- throw new CompletionError(`Invalid shell type: ${shell}`, "INVALID_SHELL", [
83
- `Valid shells are: ${validShells.join(", ")}`,
84
- "Shell will be auto-detected if not specified"
85
- ]);
86
- }
87
- };
88
- const validateRuntime = (runtime) => {
89
- if (runtime && !validRuntimes.includes(runtime)) {
90
- throw new CompletionError(`Invalid runtime: ${runtime}`, "INVALID_RUNTIME", [
91
- `Valid runtimes are: ${validRuntimes.join(", ")}`,
92
- "Runtime will be auto-detected if not specified"
93
- ]);
94
- }
95
- };
96
- const printUsageInstructions = (logger, cliName) => {
97
- logger.error("Could not detect current shell");
98
- const usageInfo = [
99
- `Usage: ${cliName} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,
100
- "",
101
- "Examples:",
102
- ` # Install completions for zsh:`,
103
- ` ${cliName} completion --shell=zsh > ~/.${cliName}-completion.zsh`,
104
- ` echo 'source ~/.${cliName}-completion.zsh' >> ~/.zshrc`,
105
- "",
106
- ` # Install completions for bash with custom runtime:`,
107
- ` ${cliName} completion --shell=bash --runtime=bun > ~/.${cliName}-completion.bash`,
108
- ` echo 'source ~/.${cliName}-completion.bash' >> ~/.bashrc`,
109
- "",
110
- ` # Install completions for fish:`,
111
- ` ${cliName} completion --shell=fish > ~/.config/fish/completions/${cliName}.fish`
112
- ].join("\n");
113
- logger.info(usageInfo);
114
- };
115
- const completionCommand = {
116
- description: "Generate shell completion scripts",
117
- env: [
118
- {
119
- description: "Shell path (Unix-like systems). Used for shell detection.",
120
- name: "SHELL",
121
- type: String
122
- },
123
- {
124
- description: "Starship shell configuration. Takes precedence over SHELL for detection.",
125
- name: "STARSHIP_SHELL",
126
- type: String
127
- },
128
- {
129
- description: "PowerShell module path (Windows). Used for PowerShell detection.",
130
- name: "PSModulePath",
131
- type: String
132
- },
133
- {
134
- description: "Command prompt variable (Windows). Used for PowerShell detection.",
135
- name: "PROMPT",
136
- type: String
137
- },
138
- {
139
- description: "Command processor (Windows). Used for Windows Command Prompt detection.",
140
- name: "ComSpec",
141
- type: String
142
- }
143
- ],
144
- // eslint-disable-next-line @typescript-eslint/require-await
145
- execute: async ({ env: toolboxEnv, logger, options, runtime }) => {
146
- const cliName = runtime.getCliName();
147
- const shell = options.shell ?? detectShell(toolboxEnv);
148
- if (!shell) {
149
- printUsageInstructions(logger, cliName);
150
- return;
151
- }
152
- try {
153
- validateShell(shell);
154
- validateRuntime(options.runtime);
155
- registerCommands(tabInstance, runtime.getCommands());
156
- const jsRuntime = options.runtime ?? detectRuntime();
157
- const scriptPath = `${jsRuntime} ${cliName}`;
158
- tabInstance.setup(cliName, scriptPath, shell);
159
- } catch (error) {
160
- if (error instanceof CompletionError) {
161
- const errorMessages = [`Failed to generate completion script: ${error.message}`, `Error code: ${error.code}`];
162
- if (error.troubleshooting.length > 0) {
163
- errorMessages.push("", "Troubleshooting:", ...error.troubleshooting.map((tip) => ` • ${tip}`));
164
- }
165
- logger.error(errorMessages.join("\n"));
166
- throw error;
167
- } else {
168
- const errorMessage = error instanceof Error ? error.message : String(error);
169
- const errorMessages = [
170
- "Failed to generate completion script",
171
- `Error: ${errorMessage}`,
172
- "",
173
- "Troubleshooting:",
174
- " • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",
175
- ` • Verify shell is supported: ${validShells.join(", ")}`,
176
- ` • Verify runtime is supported: ${validRuntimes.join(", ")}`,
177
- " • Check that your CLI name is correct"
178
- ];
179
- logger.error(errorMessages.join("\n"));
180
- }
181
- }
182
- },
183
- name: "completion",
184
- options: [
185
- {
186
- defaultOption: true,
187
- defaultValue: detectShell(),
188
- description: "Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",
189
- name: "shell",
190
- type: String,
191
- typeLabel: "{underline shell}"
192
- },
193
- {
194
- defaultOption: true,
195
- defaultValue: detectRuntime(),
196
- description: "JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",
197
- name: "runtime",
198
- type: String,
199
- typeLabel: "{underline runtime}"
200
- }
201
- ]
202
- };
203
-
204
- export { completionCommand as default };
1
+ var g=Object.defineProperty;var a=(e,t)=>g(e,"name",{value:t,configurable:!0});import S from"@bomb.sh/tab";import{c as $}from"../packem_shared/cerebro-error-BnJTixb2.js";var w=Object.defineProperty,y=a((e,t)=>w(e,"name",{value:t,configurable:!0}),"n");class p extends ${static{a(this,"l")}static{y(this,"CompletionError")}troubleshooting;constructor(t,o,n=[]){super(t,o,{troubleshooting:n}),this.name="CompletionError",this.troubleshooting=n,n.length>0&&(this.hint=n.join(`
2
+ `))}}var C=Object.defineProperty,s=a((e,t)=>C(e,"name",{value:t,configurable:!0}),"s");const h=["bash","zsh","fish","powershell"],d=["node","bun","deno"],v=s(e=>"Deno"in e,"hasDeno"),L=s(e=>"Bun"in e,"hasBun"),u=s(()=>v(globalThis)?"deno":L(globalThis)?"bun":"node","detectRuntime"),m=s(e=>{const t=e?.starshipShell??e?.shell;if(t){const r=t.toLowerCase();if(r.includes("zsh"))return"zsh";if(r.includes("bash"))return"bash";if(r.includes("fish"))return"fish"}const o=e?.psModulePath,n=e?.prompt;if(o||n?.includes("PS"))return"powershell";if(e?.comSpec?.toLowerCase().includes("cmd.exe"))return"bash"},"detectShell"),f=S,I=s((e,t)=>{for(const o of t)o.hidden||(o.name&&e.option(o.name,o.description??""),o.alias&&e.option(o.alias,o.description??""))},"registerCommandOptions"),P=s((e,t)=>{for(const[o,n]of t){if(n.name!==o||n.hidden)continue;const r=e.command(n.name,n.description??"");n.options&&I(r,n.options)}},"registerCommands"),E=s(e=>{if(!h.includes(e))throw new p(`Invalid shell type: ${e}`,"INVALID_SHELL",[`Valid shells are: ${h.join(", ")}`,"Shell will be auto-detected if not specified"])},"validateShell"),j=s(e=>{if(e&&!d.includes(e))throw new p(`Invalid runtime: ${e}`,"INVALID_RUNTIME",[`Valid runtimes are: ${d.join(", ")}`,"Runtime will be auto-detected if not specified"])},"validateRuntime"),z=s((e,t)=>{e.error("Could not detect current shell");const o=[`Usage: ${t} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,"","Examples:"," # Install completions for zsh:",` ${t} completion --shell=zsh > ~/.${t}-completion.zsh`,` echo 'source ~/.${t}-completion.zsh' >> ~/.zshrc`,""," # Install completions for bash with custom runtime:",` ${t} completion --shell=bash --runtime=bun > ~/.${t}-completion.bash`,` echo 'source ~/.${t}-completion.bash' >> ~/.bashrc`,""," # Install completions for fish:",` ${t} completion --shell=fish > ~/.config/fish/completions/${t}.fish`].join(`
3
+ `);e.info(o)},"printUsageInstructions"),x={description:"Generate shell completion scripts",env:[{description:"Shell path (Unix-like systems). Used for shell detection.",name:"SHELL",type:String},{description:"Starship shell configuration. Takes precedence over SHELL for detection.",name:"STARSHIP_SHELL",type:String},{description:"PowerShell module path (Windows). Used for PowerShell detection.",name:"PSModulePath",type:String},{description:"Command prompt variable (Windows). Used for PowerShell detection.",name:"PROMPT",type:String},{description:"Command processor (Windows). Used for Windows Command Prompt detection.",name:"ComSpec",type:String}],execute:s(async({env:e,logger:t,options:o,runtime:n})=>{const r=n.getCliName(),c=o.shell??m(e);if(!c){z(t,r);return}try{E(c),j(o.runtime),P(f,n.getCommands());const i=`${o.runtime??u()} ${r}`;f.setup(r,i,c)}catch(i){if(i instanceof p){const l=[`Failed to generate completion script: ${i.message}`,`Error code: ${i.code}`];throw i.troubleshooting.length>0&&l.push("","Troubleshooting:",...i.troubleshooting.map(b=>` • ${b}`)),t.error(l.join(`
4
+ `)),i}else{const l=["Failed to generate completion script",`Error: ${i instanceof Error?i.message:String(i)}`,"","Troubleshooting:"," • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",` • Verify shell is supported: ${h.join(", ")}`,` • Verify runtime is supported: ${d.join(", ")}`," • Check that your CLI name is correct"];t.error(l.join(`
5
+ `))}}},"execute"),name:"completion",options:[{defaultOption:!0,defaultValue:m(),description:"Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",name:"shell",type:String,typeLabel:"{underline shell}"},{defaultOption:!0,defaultValue:u(),description:"JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",name:"runtime",type:String,typeLabel:"{underline runtime}"}]};export{x as default};
@@ -1,4 +1,4 @@
1
- import { O as OptionDefinition, C as Command, T as Toolbox } from "../packem_shared/plugin-manager.d-Du-YXFui.js";
1
+ import { O as OptionDefinition, C as Command, T as Toolbox } from "../packem_shared/plugin-manager.d-Dz-wu1tI.js";
2
2
  import '@visulima/tabular';
3
3
  declare class HelpCommand<TLogger extends Console = Console> implements Command<OptionDefinition<string>, TLogger> {
4
4
  name: string;