@visulima/cerebro 3.0.0-alpha.6 → 3.0.0-alpha.8
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 +40 -0
- package/LICENSE.md +24 -24
- package/dist/commands/completion-command.js +203 -5
- package/dist/commands/help-command.js +3 -1
- package/dist/commands/readme-command.js +330 -32
- package/dist/commands/version-command.js +18 -1
- package/dist/index.js +7 -1
- package/dist/logger/create-pail-logger.js +34 -1
- package/dist/packem_chunks/has-new-version.js +259 -1
- package/dist/packem_shared/Cerebro-C2mnCyQf.js +3313 -0
- package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +10 -0
- package/dist/packem_shared/VisulimaError-DA7QsCxH.js +34 -0
- package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +16 -0
- package/dist/packem_shared/help-command-BY7rQUvM.js +249 -0
- package/dist/packem_shared/index-C2-8b3A4.js +259 -0
- package/dist/packem_shared/runtime-process-B6ZplyWn.js +187 -0
- package/dist/plugins/error-handler-plugin.js +636 -24
- package/dist/plugins/runtime-version-check-plugin.js +77 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.js +517 -1
- package/package.json +8 -7
- package/dist/packem_shared/Cerebro-CI6nbG1o.js +0 -4
- package/dist/packem_shared/VERBOSITY_QUIET-XPultrIA.js +0 -1
- package/dist/packem_shared/VisulimaError-rZ7cJo5A.js +0 -1
- package/dist/packem_shared/cerebro-error-CXXSmFtP.js +0 -1
- package/dist/packem_shared/help-command-CIRIXN03.js +0 -1
- package/dist/packem_shared/index-DQ3pvLQH.js +0 -6
- package/dist/packem_shared/runtime-process-G-n-wOub.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## @visulima/cerebro [3.0.0-alpha.8](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.7...@visulima/cerebro@3.0.0-alpha.8) (2026-03-26)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **cerebro:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([6647854](https://github.com/visulima/visulima/commit/6647854b69a518466318af623938c0435f3a2579))
|
|
6
|
+
* **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
|
|
7
|
+
|
|
8
|
+
### Miscellaneous Chores
|
|
9
|
+
|
|
10
|
+
* **cerebro:** migrate deps to pnpm catalogs ([75cfac0](https://github.com/visulima/visulima/commit/75cfac01080464cc07279164520177472aff3b13))
|
|
11
|
+
|
|
12
|
+
### Code Refactoring
|
|
13
|
+
|
|
14
|
+
* **docs:** migrate Nextra components to fumadocs-ui, remove Nextra stripping ([484878f](https://github.com/visulima/visulima/commit/484878f01879363ef5e9a0282904dc4627d6060c))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* **@visulima/colorize:** upgraded to 2.0.0-alpha.6
|
|
20
|
+
* **@visulima/tabular:** upgraded to 4.0.0-alpha.7
|
|
21
|
+
* **@visulima/boxen:** upgraded to 3.0.0-alpha.7
|
|
22
|
+
* **@visulima/command-line-args:** upgraded to 2.0.0-alpha.5
|
|
23
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.6
|
|
24
|
+
* **@visulima/find-cache-dir:** upgraded to 3.0.0-alpha.5
|
|
25
|
+
* **@visulima/pail:** upgraded to 4.0.0-alpha.8
|
|
26
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.6
|
|
27
|
+
* **@visulima/string:** upgraded to 3.0.0-alpha.7
|
|
28
|
+
|
|
29
|
+
## @visulima/cerebro [3.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.6...@visulima/cerebro@3.0.0-alpha.7) (2026-03-16)
|
|
30
|
+
|
|
31
|
+
### Miscellaneous Chores
|
|
32
|
+
|
|
33
|
+
* **cerebro:** update dependencies ([401f0bf](https://github.com/visulima/visulima/commit/401f0bf2bab395ac191e48cded78fa354970b245))
|
|
34
|
+
* visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Dependencies
|
|
38
|
+
|
|
39
|
+
* **@visulima/pail:** upgraded to 4.0.0-alpha.7
|
|
40
|
+
|
|
1
41
|
## @visulima/cerebro [3.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.5...@visulima/cerebro@3.0.0-alpha.6) (2026-03-06)
|
|
2
42
|
|
|
3
43
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -92,7 +92,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
92
92
|
>
|
|
93
93
|
> > MIT License
|
|
94
94
|
> >
|
|
95
|
-
> > Copyright (c)
|
|
95
|
+
> > Copyright (c) 2026 visulima
|
|
96
96
|
> >
|
|
97
97
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
98
98
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -126,7 +126,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
126
126
|
> >
|
|
127
127
|
> > > MIT License
|
|
128
128
|
> > >
|
|
129
|
-
> > > Copyright (c)
|
|
129
|
+
> > > Copyright (c) 2026 visulima
|
|
130
130
|
> > >
|
|
131
131
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
132
132
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -312,7 +312,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
312
312
|
>
|
|
313
313
|
> > MIT License
|
|
314
314
|
> >
|
|
315
|
-
> > Copyright (c)
|
|
315
|
+
> > Copyright (c) 2026 visulima
|
|
316
316
|
> >
|
|
317
317
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
318
318
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -346,7 +346,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
346
346
|
> >
|
|
347
347
|
> > > MIT License
|
|
348
348
|
> > >
|
|
349
|
-
> > > Copyright (c)
|
|
349
|
+
> > > Copyright (c) 2026 visulima
|
|
350
350
|
> > >
|
|
351
351
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
352
352
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -488,7 +488,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
488
488
|
|
|
489
489
|
> MIT License
|
|
490
490
|
>
|
|
491
|
-
> Copyright (c)
|
|
491
|
+
> Copyright (c) 2026 visulima
|
|
492
492
|
>
|
|
493
493
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
494
494
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -522,7 +522,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
522
522
|
>
|
|
523
523
|
> > MIT License
|
|
524
524
|
> >
|
|
525
|
-
> > Copyright (c)
|
|
525
|
+
> > Copyright (c) 2026 visulima
|
|
526
526
|
> >
|
|
527
527
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
528
528
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1463,7 +1463,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1463
1463
|
>
|
|
1464
1464
|
> > MIT License
|
|
1465
1465
|
> >
|
|
1466
|
-
> > Copyright (c)
|
|
1466
|
+
> > Copyright (c) 2026 visulima
|
|
1467
1467
|
> >
|
|
1468
1468
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1469
1469
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1497,7 +1497,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1497
1497
|
> >
|
|
1498
1498
|
> > > MIT License
|
|
1499
1499
|
> > >
|
|
1500
|
-
> > > Copyright (c)
|
|
1500
|
+
> > > Copyright (c) 2026 visulima
|
|
1501
1501
|
> > >
|
|
1502
1502
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1503
1503
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1683,7 +1683,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1683
1683
|
>
|
|
1684
1684
|
> > MIT License
|
|
1685
1685
|
> >
|
|
1686
|
-
> > Copyright (c)
|
|
1686
|
+
> > Copyright (c) 2026 visulima
|
|
1687
1687
|
> >
|
|
1688
1688
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1689
1689
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1717,7 +1717,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1717
1717
|
> >
|
|
1718
1718
|
> > > MIT License
|
|
1719
1719
|
> > >
|
|
1720
|
-
> > > Copyright (c)
|
|
1720
|
+
> > > Copyright (c) 2026 visulima
|
|
1721
1721
|
> > >
|
|
1722
1722
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1723
1723
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1859,7 +1859,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1859
1859
|
|
|
1860
1860
|
> MIT License
|
|
1861
1861
|
>
|
|
1862
|
-
> Copyright (c)
|
|
1862
|
+
> Copyright (c) 2026 visulima
|
|
1863
1863
|
>
|
|
1864
1864
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1865
1865
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1893,7 +1893,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
1893
1893
|
>
|
|
1894
1894
|
> > MIT License
|
|
1895
1895
|
> >
|
|
1896
|
-
> > Copyright (c)
|
|
1896
|
+
> > Copyright (c) 2026 visulima
|
|
1897
1897
|
> >
|
|
1898
1898
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1899
1899
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -2808,7 +2808,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
2808
2808
|
>
|
|
2809
2809
|
> > MIT License
|
|
2810
2810
|
> >
|
|
2811
|
-
> > Copyright (c)
|
|
2811
|
+
> > Copyright (c) 2026 visulima
|
|
2812
2812
|
> >
|
|
2813
2813
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2814
2814
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -2842,7 +2842,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
2842
2842
|
> >
|
|
2843
2843
|
> > > MIT License
|
|
2844
2844
|
> > >
|
|
2845
|
-
> > > Copyright (c)
|
|
2845
|
+
> > > Copyright (c) 2026 visulima
|
|
2846
2846
|
> > >
|
|
2847
2847
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2848
2848
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -3028,7 +3028,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
3028
3028
|
>
|
|
3029
3029
|
> > MIT License
|
|
3030
3030
|
> >
|
|
3031
|
-
> > Copyright (c)
|
|
3031
|
+
> > Copyright (c) 2026 visulima
|
|
3032
3032
|
> >
|
|
3033
3033
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3034
3034
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -3062,7 +3062,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
3062
3062
|
> >
|
|
3063
3063
|
> > > MIT License
|
|
3064
3064
|
> > >
|
|
3065
|
-
> > > Copyright (c)
|
|
3065
|
+
> > > Copyright (c) 2026 visulima
|
|
3066
3066
|
> > >
|
|
3067
3067
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3068
3068
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -3204,7 +3204,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
3204
3204
|
|
|
3205
3205
|
> MIT License
|
|
3206
3206
|
>
|
|
3207
|
-
> Copyright (c)
|
|
3207
|
+
> Copyright (c) 2026 visulima
|
|
3208
3208
|
>
|
|
3209
3209
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3210
3210
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -3238,7 +3238,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
3238
3238
|
>
|
|
3239
3239
|
> > MIT License
|
|
3240
3240
|
> >
|
|
3241
|
-
> > Copyright (c)
|
|
3241
|
+
> > Copyright (c) 2026 visulima
|
|
3242
3242
|
> >
|
|
3243
3243
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3244
3244
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4148,7 +4148,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
4148
4148
|
>
|
|
4149
4149
|
> > MIT License
|
|
4150
4150
|
> >
|
|
4151
|
-
> > Copyright (c)
|
|
4151
|
+
> > Copyright (c) 2026 visulima
|
|
4152
4152
|
> >
|
|
4153
4153
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4154
4154
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4182,7 +4182,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
4182
4182
|
> >
|
|
4183
4183
|
> > > MIT License
|
|
4184
4184
|
> > >
|
|
4185
|
-
> > > Copyright (c)
|
|
4185
|
+
> > > Copyright (c) 2026 visulima
|
|
4186
4186
|
> > >
|
|
4187
4187
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4188
4188
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4368,7 +4368,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
4368
4368
|
>
|
|
4369
4369
|
> > MIT License
|
|
4370
4370
|
> >
|
|
4371
|
-
> > Copyright (c)
|
|
4371
|
+
> > Copyright (c) 2026 visulima
|
|
4372
4372
|
> >
|
|
4373
4373
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4374
4374
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4402,7 +4402,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
4402
4402
|
> >
|
|
4403
4403
|
> > > MIT License
|
|
4404
4404
|
> > >
|
|
4405
|
-
> > > Copyright (c)
|
|
4405
|
+
> > > Copyright (c) 2026 visulima
|
|
4406
4406
|
> > >
|
|
4407
4407
|
> > > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4408
4408
|
> > > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4544,7 +4544,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
4544
4544
|
|
|
4545
4545
|
> MIT License
|
|
4546
4546
|
>
|
|
4547
|
-
> Copyright (c)
|
|
4547
|
+
> Copyright (c) 2026 visulima
|
|
4548
4548
|
>
|
|
4549
4549
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4550
4550
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4578,7 +4578,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
4578
4578
|
>
|
|
4579
4579
|
> > MIT License
|
|
4580
4580
|
> >
|
|
4581
|
-
> > Copyright (c)
|
|
4581
|
+
> > Copyright (c) 2026 visulima
|
|
4582
4582
|
> >
|
|
4583
4583
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4584
4584
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,5 +1,203 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
execute: async ({ env: toolboxEnv, logger, options, runtime }) => {
|
|
145
|
+
const cliName = runtime.getCliName();
|
|
146
|
+
const shell = options?.shell || detectShell(toolboxEnv);
|
|
147
|
+
if (!shell) {
|
|
148
|
+
printUsageInstructions(logger, cliName);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
validateShell(shell);
|
|
153
|
+
validateRuntime(options?.runtime);
|
|
154
|
+
registerCommands(tabInstance, runtime.getCommands());
|
|
155
|
+
const jsRuntime = options?.runtime || detectRuntime();
|
|
156
|
+
const scriptPath = `${jsRuntime} ${cliName}`;
|
|
157
|
+
tabInstance.setup(cliName, scriptPath, shell);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (error instanceof CompletionError) {
|
|
160
|
+
const errorMessages = [`Failed to generate completion script: ${error.message}`, `Error code: ${error.code}`];
|
|
161
|
+
if (error.troubleshooting.length > 0) {
|
|
162
|
+
errorMessages.push("", "Troubleshooting:", ...error.troubleshooting.map((tip) => ` • ${tip}`));
|
|
163
|
+
}
|
|
164
|
+
logger.error(errorMessages.join("\n"));
|
|
165
|
+
throw error;
|
|
166
|
+
} else {
|
|
167
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
168
|
+
const errorMessages = [
|
|
169
|
+
"Failed to generate completion script",
|
|
170
|
+
`Error: ${errorMessage}`,
|
|
171
|
+
"",
|
|
172
|
+
"Troubleshooting:",
|
|
173
|
+
" • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",
|
|
174
|
+
` • Verify shell is supported: ${validShells.join(", ")}`,
|
|
175
|
+
` • Verify runtime is supported: ${validRuntimes.join(", ")}`,
|
|
176
|
+
" • Check that your CLI name is correct"
|
|
177
|
+
];
|
|
178
|
+
logger.error(errorMessages.join("\n"));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
name: "completion",
|
|
183
|
+
options: [
|
|
184
|
+
{
|
|
185
|
+
defaultOption: true,
|
|
186
|
+
defaultValue: detectShell(),
|
|
187
|
+
description: "Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",
|
|
188
|
+
name: "shell",
|
|
189
|
+
type: String,
|
|
190
|
+
typeLabel: "{underline shell}"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
defaultOption: true,
|
|
194
|
+
defaultValue: detectRuntime(),
|
|
195
|
+
description: "JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",
|
|
196
|
+
name: "runtime",
|
|
197
|
+
type: String,
|
|
198
|
+
typeLabel: "{underline runtime}"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export { completionCommand as default };
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@visulima/colorize';
|
|
2
|
+
export { H as default } from '../packem_shared/help-command-BY7rQUvM.js';
|
|
3
|
+
import '../packem_shared/index-C2-8b3A4.js';
|