tova 0.10.3 → 0.11.12

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.
@@ -0,0 +1,192 @@
1
+ import { color } from './utils.js';
2
+
3
+ export function completionsCommand(shell) {
4
+ if (!shell) {
5
+ console.error('Usage: tova completions <bash|zsh|fish>');
6
+ process.exit(1);
7
+ }
8
+
9
+ const commands = [
10
+ 'run', 'build', 'check', 'clean', 'dev', 'new', 'install', 'add', 'remove',
11
+ 'repl', 'lsp', 'fmt', 'test', 'bench', 'doc', 'init', 'upgrade', 'info',
12
+ 'explain', 'doctor', 'completions',
13
+ 'migrate:create', 'migrate:up', 'migrate:down', 'migrate:reset', 'migrate:fresh', 'migrate:status',
14
+ ];
15
+
16
+ const globalFlags = ['--help', '--version', '--output', '--production', '--watch', '--verbose', '--quiet', '--debug', '--strict', '--strict-security'];
17
+
18
+ switch (shell) {
19
+ case 'bash': {
20
+ const script = `# tova bash completions
21
+ # Add to ~/.bashrc: eval "$(tova completions bash)"
22
+ _tova() {
23
+ local cur prev commands
24
+ COMPREPLY=()
25
+ cur="\${COMP_WORDS[COMP_CWORD]}"
26
+ prev="\${COMP_WORDS[COMP_CWORD-1]}"
27
+ commands="${commands.join(' ')}"
28
+
29
+ case "\${prev}" in
30
+ tova)
31
+ COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
32
+ return 0
33
+ ;;
34
+ new)
35
+ COMPREPLY=( $(compgen -W "--template" -- "\${cur}") )
36
+ return 0
37
+ ;;
38
+ --template)
39
+ COMPREPLY=( $(compgen -W "fullstack spa site api script library blank" -- "\${cur}") )
40
+ return 0
41
+ ;;
42
+ completions)
43
+ COMPREPLY=( $(compgen -W "bash zsh fish" -- "\${cur}") )
44
+ return 0
45
+ ;;
46
+ run|build|check|fmt|doc)
47
+ COMPREPLY=( $(compgen -f -X '!*.tova' -- "\${cur}") $(compgen -d -- "\${cur}") )
48
+ return 0
49
+ ;;
50
+ esac
51
+
52
+ if [[ "\${cur}" == -* ]]; then
53
+ COMPREPLY=( $(compgen -W "${globalFlags.join(' ')} --filter --coverage --serial --check --template --dev --binary --no-cache" -- "\${cur}") )
54
+ return 0
55
+ fi
56
+ }
57
+ complete -F _tova tova
58
+ `;
59
+ console.log(script);
60
+ console.error(`${color.dim('# Add to your ~/.bashrc:')}`);
61
+ console.error(`${color.dim('# eval "$(tova completions bash)"')}`);
62
+ break;
63
+ }
64
+ case 'zsh': {
65
+ const script = `#compdef tova
66
+ # tova zsh completions
67
+ # Add to ~/.zshrc: eval "$(tova completions zsh)"
68
+
69
+ _tova() {
70
+ local -a commands
71
+ commands=(
72
+ ${commands.map(c => ` '${c}:${c} command'`).join('\n')}
73
+ )
74
+
75
+ _arguments -C \\
76
+ '1:command:->cmd' \\
77
+ '*::arg:->args'
78
+
79
+ case $state in
80
+ cmd)
81
+ _describe -t commands 'tova command' commands
82
+ ;;
83
+ args)
84
+ case $words[1] in
85
+ new)
86
+ _arguments \\
87
+ '--template[Project template]:template:(fullstack spa site api script library blank)' \\
88
+ '*:name:'
89
+ ;;
90
+ run|build|check|fmt|doc)
91
+ _files -g '*.tova'
92
+ ;;
93
+ test|bench)
94
+ _arguments \\
95
+ '--filter[Filter pattern]:pattern:' \\
96
+ '--watch[Watch mode]' \\
97
+ '--coverage[Enable coverage]' \\
98
+ '--serial[Sequential execution]'
99
+ ;;
100
+ completions)
101
+ _values 'shell' bash zsh fish
102
+ ;;
103
+ explain)
104
+ _message 'error code (e.g., E202)'
105
+ ;;
106
+ *)
107
+ _arguments \\
108
+ '--help[Show help]' \\
109
+ '--version[Show version]' \\
110
+ '--output[Output directory]:dir:_dirs' \\
111
+ '--production[Production build]' \\
112
+ '--watch[Watch mode]' \\
113
+ '--verbose[Verbose output]' \\
114
+ '--quiet[Quiet mode]' \\
115
+ '--debug[Debug output]' \\
116
+ '--strict[Strict type checking]'
117
+ ;;
118
+ esac
119
+ ;;
120
+ esac
121
+ }
122
+
123
+ _tova "$@"
124
+ `;
125
+ console.log(script);
126
+ console.error(`${color.dim('# Add to your ~/.zshrc:')}`);
127
+ console.error(`${color.dim('# eval "$(tova completions zsh)"')}`);
128
+ break;
129
+ }
130
+ case 'fish': {
131
+ const descriptions = {
132
+ run: 'Compile and execute a .tova file',
133
+ build: 'Compile .tova files to JavaScript',
134
+ check: 'Type-check without generating code',
135
+ clean: 'Delete build artifacts',
136
+ dev: 'Start development server',
137
+ new: 'Create a new Tova project',
138
+ install: 'Install npm dependencies',
139
+ add: 'Add an npm dependency',
140
+ remove: 'Remove an npm dependency',
141
+ repl: 'Start interactive REPL',
142
+ lsp: 'Start Language Server Protocol server',
143
+ fmt: 'Format .tova files',
144
+ test: 'Run test blocks',
145
+ bench: 'Run bench blocks',
146
+ doc: 'Generate documentation',
147
+ init: 'Initialize project in current directory',
148
+ upgrade: 'Upgrade Tova to latest version',
149
+ info: 'Show version and project info',
150
+ explain: 'Explain an error code',
151
+ doctor: 'Check development environment',
152
+ completions: 'Generate shell completions',
153
+ 'migrate:create': 'Create a migration file',
154
+ 'migrate:up': 'Run pending migrations',
155
+ 'migrate:down': 'Roll back last migration',
156
+ 'migrate:reset': 'Roll back all migrations',
157
+ 'migrate:fresh': 'Drop tables and re-migrate',
158
+ 'migrate:status': 'Show migration status',
159
+ };
160
+
161
+ let script = `# tova fish completions
162
+ # Save to: tova completions fish > ~/.config/fish/completions/tova.fish
163
+
164
+ `;
165
+ for (const [cmd, desc] of Object.entries(descriptions)) {
166
+ script += `complete -c tova -n '__fish_use_subcommand' -a '${cmd}' -d '${desc}'\n`;
167
+ }
168
+ script += `\n# Flags\n`;
169
+ script += `complete -c tova -l help -s h -d 'Show help'\n`;
170
+ script += `complete -c tova -l version -s v -d 'Show version'\n`;
171
+ script += `complete -c tova -l output -s o -d 'Output directory'\n`;
172
+ script += `complete -c tova -l production -d 'Production build'\n`;
173
+ script += `complete -c tova -l watch -d 'Watch mode'\n`;
174
+ script += `complete -c tova -l verbose -d 'Verbose output'\n`;
175
+ script += `complete -c tova -l quiet -d 'Quiet mode'\n`;
176
+ script += `complete -c tova -l debug -d 'Debug output'\n`;
177
+ script += `complete -c tova -l strict -d 'Strict type checking'\n`;
178
+ script += `\n# Template completions for 'new'\n`;
179
+ script += `complete -c tova -n '__fish_seen_subcommand_from new' -l template -d 'Project template' -xa 'fullstack spa site api script library blank'\n`;
180
+ script += `\n# Shell completions for 'completions'\n`;
181
+ script += `complete -c tova -n '__fish_seen_subcommand_from completions' -xa 'bash zsh fish'\n`;
182
+
183
+ console.log(script);
184
+ console.error(`${color.dim('# Save to:')}`);
185
+ console.error(`${color.dim('# tova completions fish > ~/.config/fish/completions/tova.fish')}`);
186
+ break;
187
+ }
188
+ default:
189
+ console.error(`Unknown shell: ${shell}. Supported: bash, zsh, fish`);
190
+ process.exit(1);
191
+ }
192
+ }
@@ -0,0 +1,15 @@
1
+ import { color } from './utils.js';
2
+
3
+ export async function deployCommand(args) {
4
+ const { parseDeployArgs } = await import('../deploy/deploy.js');
5
+ const deployArgs = parseDeployArgs(args);
6
+
7
+ if (!deployArgs.envName && !deployArgs.list) {
8
+ console.error(color.red('Error: deploy requires an environment name (e.g., tova deploy prod)'));
9
+ process.exit(1);
10
+ }
11
+
12
+ // For now, just parse and build — full SSH deployment is wired in integration
13
+ console.log(color.cyan('Deploy feature is being implemented...'));
14
+ console.log('Parsed args:', deployArgs);
15
+ }