11// TODO: i do not see any completion functionality in this file. nothing is being provided for the defined commands of these package managers. this is a blocker for release. every each of them should be handled.
2- import { Completion } from '../src/index.js' ;
3-
4- const noopCompletion = async ( ) => [ ] ;
2+ import { PackageManagerCompletion } from './package-manager-completion.js' ;
53
64export function setupCompletionForPackageManager (
75 packageManager : string ,
8- completion : Completion
6+ completion : PackageManagerCompletion
97) {
108 if ( packageManager === 'pnpm' ) {
119 setupPnpmCompletions ( completion ) ;
@@ -17,54 +15,59 @@ export function setupCompletionForPackageManager(
1715 setupBunCompletions ( completion ) ;
1816 }
1917
20- // TODO: the core functionality of tab should have nothing related to package managers. even though completion is not there anymore, but this is something to consider.
21- completion . setPackageManager ( packageManager ) ;
18+ // Note: Package manager logic is now handled by PackageManagerCompletion wrapper
2219}
2320
24- export function setupPnpmCompletions ( completion : Completion ) {
25- completion . addCommand ( 'add' , 'Install a package' , [ ] , noopCompletion ) ;
26- completion . addCommand ( 'remove' , 'Remove a package' , [ ] , noopCompletion ) ;
27- completion . addCommand (
28- 'install' ,
29- 'Install all dependencies' ,
30- [ ] ,
31- noopCompletion
32- ) ;
33- completion . addCommand ( 'update' , 'Update packages' , [ ] , noopCompletion ) ;
34- completion . addCommand ( 'exec' , 'Execute a command' , [ ] , noopCompletion ) ;
35- completion . addCommand ( 'run' , 'Run a script' , [ ] , noopCompletion ) ;
36- completion . addCommand ( 'publish' , 'Publish package' , [ ] , noopCompletion ) ;
37- completion . addCommand ( 'test' , 'Run tests' , [ ] , noopCompletion ) ;
38- completion . addCommand ( 'build' , 'Build project' , [ ] , noopCompletion ) ;
21+ export function setupPnpmCompletions ( completion : PackageManagerCompletion ) {
22+ completion . command ( 'add' , 'Install a package' ) ;
23+ completion . command ( 'remove' , 'Remove a package' ) ;
24+ completion . command ( 'install' , 'Install dependencies' ) ;
25+ completion . command ( 'update' , 'Update dependencies' ) ;
26+ completion . command ( 'run' , 'Run a script' ) ;
27+ completion . command ( 'exec' , 'Execute a command' ) ;
28+ completion . command ( 'dlx' , 'Run a package without installing' ) ;
29+ completion . command ( 'create' , 'Create a new project' ) ;
30+ completion . command ( 'init' , 'Initialize a new project' ) ;
31+ completion . command ( 'publish' , 'Publish the package' ) ;
32+ completion . command ( 'pack' , 'Create a tarball' ) ;
33+ completion . command ( 'link' , 'Link a package' ) ;
34+ completion . command ( 'unlink' , 'Unlink a package' ) ;
35+ completion . command ( 'outdated' , 'Check for outdated packages' ) ;
36+ completion . command ( 'audit' , 'Run security audit' ) ;
37+ completion . command ( 'list' , 'List installed packages' ) ;
3938}
4039
41- export function setupNpmCompletions ( completion : Completion ) {
42- completion . addCommand ( 'install' , 'Install a package' , [ ] , noopCompletion ) ;
43- completion . addCommand ( 'uninstall' , 'Uninstall a package' , [ ] , noopCompletion ) ;
44- completion . addCommand ( 'run' , 'Run a script' , [ ] , noopCompletion ) ;
45- completion . addCommand ( 'test' , 'Run tests' , [ ] , noopCompletion ) ;
46- completion . addCommand ( 'publish' , 'Publish package' , [ ] , noopCompletion ) ;
47- completion . addCommand ( 'update' , 'Update packages' , [ ] , noopCompletion ) ;
48- completion . addCommand ( 'start' , 'Start the application' , [ ] , noopCompletion ) ;
49- completion . addCommand ( 'build' , 'Build project' , [ ] , noopCompletion ) ;
40+ export function setupNpmCompletions ( completion : PackageManagerCompletion ) {
41+ completion . command ( 'install' , 'Install a package' ) ;
42+ completion . command ( 'uninstall' , 'Remove a package' ) ;
43+ completion . command ( 'update' , 'Update dependencies' ) ;
44+ completion . command ( 'run' , 'Run a script' ) ;
45+ completion . command ( 'exec' , 'Execute a command' ) ;
46+ completion . command ( 'init' , 'Initialize a new project' ) ;
47+ completion . command ( 'publish' , 'Publish the package' ) ;
48+ completion . command ( 'pack' , 'Create a tarball' ) ;
49+ completion . command ( 'link' , 'Link a package' ) ;
50+ completion . command ( 'unlink' , 'Unlink a package' ) ;
5051}
5152
52- export function setupYarnCompletions ( completion : Completion ) {
53- completion . addCommand ( 'add' , 'Add a package' , [ ] , noopCompletion ) ;
54- completion . addCommand ( 'remove' , 'Remove a package' , [ ] , noopCompletion ) ;
55- completion . addCommand ( 'run' , 'Run a script' , [ ] , noopCompletion ) ;
56- completion . addCommand ( 'test' , 'Run tests' , [ ] , noopCompletion ) ;
57- completion . addCommand ( 'publish' , 'Publish package' , [ ] , noopCompletion ) ;
58- completion . addCommand ( 'install' , 'Install dependencies' , [ ] , noopCompletion ) ;
59- completion . addCommand ( 'build' , 'Build project' , [ ] , noopCompletion ) ;
53+ export function setupYarnCompletions ( completion : PackageManagerCompletion ) {
54+ completion . command ( 'add' , 'Install a package' ) ;
55+ completion . command ( 'remove' , 'Remove a package' ) ;
56+ completion . command ( 'install' , 'Install dependencies' ) ;
57+ completion . command ( 'upgrade' , 'Update dependencies' ) ;
58+ completion . command ( 'run' , 'Run a script' ) ;
59+ completion . command ( 'exec' , 'Execute a command' ) ;
60+ completion . command ( 'create' , 'Create a new project' ) ;
61+ completion . command ( 'init' , 'Initialize a new project' ) ;
6062}
6163
62- export function setupBunCompletions ( completion : Completion ) {
63- completion . addCommand ( 'add' , 'Add a package' , [ ] , noopCompletion ) ;
64- completion . addCommand ( 'remove' , 'Remove a package' , [ ] , noopCompletion ) ;
65- completion . addCommand ( 'run' , 'Run a script' , [ ] , noopCompletion ) ;
66- completion . addCommand ( 'test' , 'Run tests' , [ ] , noopCompletion ) ;
67- completion . addCommand ( 'install' , 'Install dependencies' , [ ] , noopCompletion ) ;
68- completion . addCommand ( 'update' , 'Update packages' , [ ] , noopCompletion ) ;
69- completion . addCommand ( 'build' , 'Build project' , [ ] , noopCompletion ) ;
64+ export function setupBunCompletions ( completion : PackageManagerCompletion ) {
65+ completion . command ( 'add' , 'Install a package' ) ;
66+ completion . command ( 'remove' , 'Remove a package' ) ;
67+ completion . command ( 'install' , 'Install dependencies' ) ;
68+ completion . command ( 'update' , 'Update dependencies' ) ;
69+ completion . command ( 'run' , 'Run a script' ) ;
70+ completion . command ( 'x' , 'Execute a command' ) ;
71+ completion . command ( 'create' , 'Create a new project' ) ;
72+ completion . command ( 'init' , 'Initialize a new project' ) ;
7073}
0 commit comments