@vee-stack/delta-cli 2.0.9 → 2.0.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.
Files changed (98) hide show
  1. package/dist/adapters/analysis.adapter.d.ts +29 -0
  2. package/dist/analyzer/commands/analyze.d.ts +14 -0
  3. package/dist/analyzer/commands/config.d.ts +12 -0
  4. package/dist/analyzer/commands/report.d.ts +11 -0
  5. package/dist/analyzer/generators/report.generator.d.ts +43 -0
  6. package/dist/analyzer/index.d.ts +8 -0
  7. package/dist/analyzer/scanners/project.scanner.d.ts +29 -0
  8. package/dist/analyzer/validators/contracts.validator.d.ts +27 -0
  9. package/dist/analyzer/validators/maintainability.validator.d.ts +27 -0
  10. package/dist/analyzer/validators/observability.validator.d.ts +27 -0
  11. package/dist/analyzer/validators/performance.validator.d.ts +27 -0
  12. package/dist/analyzer/validators/security.validator.d.ts +27 -0
  13. package/dist/analyzer/validators/soc.validator.d.ts +27 -0
  14. package/dist/auth/device-auth.d.ts +18 -0
  15. package/dist/auth/secure-auth.d.ts +35 -0
  16. package/dist/bundle.mjs +422 -0
  17. package/dist/commands/analyze.d.ts +12 -0
  18. package/dist/commands/auth-new.d.ts +6 -0
  19. package/dist/commands/auth.d.ts +17 -0
  20. package/dist/commands/config.d.ts +8 -0
  21. package/dist/commands/deploy.d.ts +5 -0
  22. package/dist/commands/init.d.ts +7 -0
  23. package/dist/commands/logout.d.ts +2 -0
  24. package/dist/commands/plugins.d.ts +7 -0
  25. package/dist/commands/status.d.ts +5 -0
  26. package/dist/commands/sync.d.ts +5 -0
  27. package/dist/commands/whoami.d.ts +4 -0
  28. package/dist/components/Dashboard.d.ts +8 -0
  29. package/dist/components/DeltaApp.d.ts +13 -0
  30. package/dist/components/UnifiedManager.d.ts +10 -0
  31. package/dist/core/audit.d.ts +60 -0
  32. package/dist/core/completion.d.ts +79 -0
  33. package/dist/core/contracts.d.ts +127 -0
  34. package/dist/core/engine.d.ts +26 -0
  35. package/dist/core/exit-codes.d.ts +19 -0
  36. package/dist/core/hooks.d.ts +50 -0
  37. package/dist/core/{index.js → index.d.ts} +1 -1
  38. package/dist/core/policy.d.ts +24 -0
  39. package/dist/core/profiles.d.ts +45 -0
  40. package/dist/core/wizard.d.ts +28 -0
  41. package/dist/interactive/index.d.ts +5 -0
  42. package/dist/plugins/GitStatusPlugin.d.ts +25 -0
  43. package/dist/providers/ai-provider.d.ts +21 -0
  44. package/dist/providers/local-provider.d.ts +21 -0
  45. package/dist/providers/remote-provider.d.ts +15 -0
  46. package/dist/telemetry/wrapper.d.ts +18 -0
  47. package/dist/types/api.d.ts +46 -0
  48. package/dist/ui.d.ts +52 -0
  49. package/dist/welcome.d.ts +8 -0
  50. package/package.json +8 -10
  51. package/dist/adapters/analysis.adapter.js +0 -42
  52. package/dist/analyzer/commands/analyze.js +0 -220
  53. package/dist/analyzer/commands/config.js +0 -83
  54. package/dist/analyzer/commands/report.js +0 -38
  55. package/dist/analyzer/generators/report.generator.js +0 -123
  56. package/dist/analyzer/index.js +0 -44
  57. package/dist/analyzer/scanners/project.scanner.js +0 -92
  58. package/dist/analyzer/validators/contracts.validator.js +0 -42
  59. package/dist/analyzer/validators/maintainability.validator.js +0 -40
  60. package/dist/analyzer/validators/observability.validator.js +0 -39
  61. package/dist/analyzer/validators/performance.validator.js +0 -42
  62. package/dist/analyzer/validators/security.validator.js +0 -66
  63. package/dist/analyzer/validators/soc.validator.js +0 -75
  64. package/dist/auth/device-auth.js +0 -261
  65. package/dist/auth/secure-auth.js +0 -401
  66. package/dist/commands/analyze.js +0 -393
  67. package/dist/commands/auth-new.js +0 -37
  68. package/dist/commands/auth.js +0 -131
  69. package/dist/commands/config.js +0 -51
  70. package/dist/commands/deploy.js +0 -6
  71. package/dist/commands/init.js +0 -47
  72. package/dist/commands/logout.js +0 -31
  73. package/dist/commands/plugins.js +0 -21
  74. package/dist/commands/status.js +0 -82
  75. package/dist/commands/sync.js +0 -6
  76. package/dist/commands/whoami.js +0 -72
  77. package/dist/components/Dashboard.js +0 -167
  78. package/dist/components/DeltaApp.js +0 -57
  79. package/dist/components/UnifiedManager.js +0 -372
  80. package/dist/core/audit.js +0 -184
  81. package/dist/core/completion.js +0 -305
  82. package/dist/core/contracts.js +0 -6
  83. package/dist/core/engine.js +0 -130
  84. package/dist/core/exit-codes.js +0 -79
  85. package/dist/core/hooks.js +0 -181
  86. package/dist/core/policy.js +0 -115
  87. package/dist/core/profiles.js +0 -161
  88. package/dist/core/wizard.js +0 -203
  89. package/dist/index.js +0 -403
  90. package/dist/interactive/index.js +0 -11
  91. package/dist/plugins/GitStatusPlugin.js +0 -93
  92. package/dist/providers/ai-provider.js +0 -74
  93. package/dist/providers/local-provider.js +0 -304
  94. package/dist/providers/remote-provider.js +0 -100
  95. package/dist/telemetry/wrapper.js +0 -114
  96. package/dist/types/api.js +0 -3
  97. package/dist/ui.js +0 -226
  98. package/dist/welcome.js +0 -91
@@ -1,305 +0,0 @@
1
- /**
2
- * Tab Autocomplete System for Delta CLI
3
- * Provides shell completion for commands, flags, and options
4
- */
5
- // Completion items database
6
- export const completionDatabase = {
7
- commands: [
8
- { name: 'help', alias: ['/?', '/h'], desc: 'Show help' },
9
- { name: 'analyze', alias: ['/a', '/analyze'], desc: 'Code analysis' },
10
- { name: 'init', alias: ['/i', '/init'], desc: 'Initialize project' },
11
- { name: 'status', alias: ['/st', '/status'], desc: 'Check status' },
12
- { name: 'login', alias: ['/login'], desc: 'Authenticate' },
13
- { name: 'logout', alias: ['/logout'], desc: 'Sign out' },
14
- { name: 'whoami', alias: ['/me', '/whoami'], desc: 'User info' },
15
- { name: 'config', alias: ['/config'], desc: 'Configuration' },
16
- { name: 'dashboard', alias: ['/ui', '/dashboard'], desc: 'Interactive UI' },
17
- { name: 'sync', alias: ['/sync'], desc: 'Cloud sync' },
18
- { name: 'deploy', alias: ['/deploy'], desc: 'Deploy project' },
19
- { name: 'plugins', alias: ['/plugins'], desc: 'Manage plugins' },
20
- ],
21
- globalFlags: [
22
- { name: '--json', desc: 'Output as JSON' },
23
- { name: '--provider', values: ['local', 'remote', 'ai'], desc: 'Execution provider' },
24
- {
25
- name: '--theme',
26
- values: ['delta', 'cyber', 'sunset', 'neon', 'ocean', 'fire'],
27
- desc: 'Color theme',
28
- },
29
- { name: '--verbose', desc: 'Verbose logging' },
30
- { name: '--no-color', desc: 'Disable colors' },
31
- { name: '--interactive', alias: '-i', desc: 'Interactive mode' },
32
- { name: '--version', alias: '-v', desc: 'Show version' },
33
- { name: '--help', alias: '-h', desc: 'Show help' },
34
- ],
35
- commandFlags: {
36
- analyze: [
37
- { name: '--format', values: ['json', 'html', 'markdown', 'sarif'], desc: 'Output format' },
38
- { name: '--output', values: ['./delta-reports'], desc: 'Output directory' },
39
- { name: '--include', desc: 'Include patterns' },
40
- { name: '--exclude', desc: 'Exclude patterns' },
41
- { name: '--max-size', desc: 'Max file size' },
42
- { name: '--upload', desc: 'Upload to cloud' },
43
- { name: '--share', desc: 'Generate shareable link' },
44
- { name: '--project-name', desc: 'Project name' },
45
- { name: '--ai-insights', desc: 'AI insights' },
46
- { name: '--security-scan', desc: 'Security scan' },
47
- { name: '--performance', desc: 'Performance analysis' },
48
- ],
49
- init: [
50
- {
51
- name: '--template',
52
- values: ['default', 'nextjs', 'react', 'node', 'python'],
53
- desc: 'Project template',
54
- },
55
- { name: '--force', alias: '-f', desc: 'Overwrite existing' },
56
- { name: '--git', desc: 'Initialize git' },
57
- ],
58
- status: [
59
- { name: '--diagnostics', desc: 'Full diagnostics' },
60
- { name: '--fix', desc: 'Auto-fix issues' },
61
- ],
62
- login: [
63
- { name: '--method', values: ['oauth', 'pat', 'github', 'google'], desc: 'Auth method' },
64
- { name: '--token', desc: 'PAT token' },
65
- ],
66
- config: [
67
- { name: '--get', desc: 'Get config value' },
68
- { name: '--set', desc: 'Set config value' },
69
- { name: '--list', alias: '-l', desc: 'List all config' },
70
- { name: '--reset', desc: 'Reset to default' },
71
- ],
72
- },
73
- };
74
- // Generate shell completion script
75
- export function generateCompletionScript(shell) {
76
- const cliName = 'delta';
77
- switch (shell) {
78
- case 'bash':
79
- return generateBashCompletion(cliName);
80
- case 'zsh':
81
- return generateZshCompletion(cliName);
82
- case 'fish':
83
- return generateFishCompletion(cliName);
84
- case 'powershell':
85
- return generatePowershellCompletion(cliName);
86
- default:
87
- throw new Error(`Unsupported shell: ${shell}`);
88
- }
89
- }
90
- function generateBashCompletion(cliName) {
91
- const commands = completionDatabase.commands.map(c => c.name).join(' ');
92
- const slashCommands = completionDatabase.commands
93
- .flatMap(c => c.alias)
94
- .filter(a => a.startsWith('/'))
95
- .join(' ');
96
- return `#!/bin/bash
97
- # Delta CLI Bash Completion
98
- # Source this file: source <(delta completion bash)
99
-
100
- _${cliName}_completions() {
101
- local cur prev opts
102
- COMPREPLY=()
103
- cur="\${COMP_WORDS[COMP_CWORD]}"
104
- prev="\${COMP_WORDS[COMP_CWORD-1]}"
105
-
106
- # Commands list
107
- local commands="${commands} ${slashCommands}"
108
- local global_flags="--json --provider --theme --verbose --no-color --interactive --version --help -i -v -h"
109
-
110
- # Complete commands
111
- if [[ \${COMP_CWORD} -eq 1 ]]; then
112
- COMPREPLY=( $(compgen -W "\${commands} \${global_flags}" -- \${cur}) )
113
- return 0
114
- fi
115
-
116
- # Complete flags based on command
117
- case "\${COMP_WORDS[1]}" in
118
- analyze|/a|/analyze)
119
- opts="--format --output --include --exclude --max-size --upload --share --project-name --ai-insights --security-scan --performance --json --provider"
120
- ;;
121
- init|/i|/init)
122
- opts="--template --force --git --json --provider -f"
123
- ;;
124
- status|/st|/status)
125
- opts="--diagnostics --fix --json"
126
- ;;
127
- login|/login)
128
- opts="--method --token --json"
129
- ;;
130
- config|/config)
131
- opts="--get --set --list --reset -l --json"
132
- ;;
133
- *)
134
- opts="\${global_flags}"
135
- ;;
136
- esac
137
-
138
- # Complete flag values
139
- case "\${prev}" in
140
- --provider)
141
- COMPREPLY=( $(compgen -W "local remote ai" -- \${cur}) )
142
- return 0
143
- ;;
144
- --theme)
145
- COMPREPLY=( $(compgen -W "delta cyber sunset neon ocean fire" -- \${cur}) )
146
- return 0
147
- ;;
148
- --format)
149
- COMPREPLY=( $(compgen -W "json html markdown sarif" -- \${cur}) )
150
- return 0
151
- ;;
152
- --template)
153
- COMPREPLY=( $(compgen -W "default nextjs react node python" -- \${cur}) )
154
- return 0
155
- ;;
156
- --method)
157
- COMPREPLY=( $(compgen -W "oauth pat github google" -- \${cur}) )
158
- return 0
159
- ;;
160
- esac
161
-
162
- COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
163
- return 0
164
- }
165
-
166
- complete -F _${cliName}_completions ${cliName}
167
- `;
168
- }
169
- function generateZshCompletion(cliName) {
170
- return `#compdef ${cliName}
171
- # Delta CLI Zsh Completion
172
-
173
- _${cliName}() {
174
- local curcontext="$curcontext" state line
175
- typeset -A opt_args
176
-
177
- _arguments -C \\
178
- '(-h --help)'{-h,--help}'[Show help]' \\
179
- '(-v --version)'{-v,--version}'[Show version]' \\
180
- '(-i --interactive)'{-i,--interactive}'[Interactive mode]' \\
181
- '--json[Output as JSON]' \\
182
- '--provider[Execution provider]:provider:(local remote ai)' \\
183
- '--theme[Color theme]:theme:(delta cyber sunset neon ocean fire)' \\
184
- '--verbose[Verbose logging]' \\
185
- '--no-color[Disable colors]' \\
186
- '1: :->command' \\
187
- '*:: :->args'
188
-
189
- case "$state" in
190
- command)
191
- _values 'commands' \\
192
- 'help[Show help]' \\
193
- 'analyze[Code analysis]' \\
194
- 'init[Initialize project]' \\
195
- 'status[Check status]' \\
196
- 'login[Authenticate]' \\
197
- 'logout[Sign out]' \\
198
- 'whoami[User info]' \\
199
- 'config[Configuration]' \\
200
- 'dashboard[Interactive UI]' \\
201
- 'sync[Cloud sync]' \\
202
- 'deploy[Deploy project]' \\
203
- 'plugins[Manage plugins]'
204
- ;;
205
- args)
206
- case "$line[1]" in
207
- analyze)
208
- _arguments \\
209
- '--format[Output format]:format:(json html markdown sarif)' \\
210
- '--output[Output directory]' \\
211
- '--include[Include patterns]' \\
212
- '--exclude[Exclude patterns]' \\
213
- '--upload[Upload to cloud]' \\
214
- '--share[Generate shareable link]' \\
215
- '--project-name[Project name]'
216
- ;;
217
- init)
218
- _arguments \\
219
- '--template[Project template]:template:(default nextjs react node python)' \\
220
- '(-f --force)'{-f,--force}'[Overwrite existing]' \\
221
- '--git[Initialize git]'
222
- ;;
223
- status)
224
- _arguments \\
225
- '--diagnostics[Full diagnostics]' \\
226
- '--fix[Auto-fix issues]'
227
- ;;
228
- esac
229
- ;;
230
- esac
231
- }
232
-
233
- _${cliName} "$@"
234
- `;
235
- }
236
- function generateFishCompletion(cliName) {
237
- return `# Delta CLI Fish Completion
238
-
239
- # Commands
240
- complete -c ${cliName} -f
241
- complete -c ${cliName} -n '__fish_use_subcommand' -a 'help' -d 'Show help'
242
- complete -c ${cliName} -n '__fish_use_subcommand' -a 'analyze' -d 'Code analysis'
243
- complete -c ${cliName} -n '__fish_use_subcommand' -a 'init' -d 'Initialize project'
244
- complete -c ${cliName} -n '__fish_use_subcommand' -a 'status' -d 'Check status'
245
- complete -c ${cliName} -n '__fish_use_subcommand' -a 'login' -d 'Authenticate'
246
- complete -c ${cliName} -n '__fish_use_subcommand' -a 'logout' -d 'Sign out'
247
-
248
- # Global flags
249
- complete -c ${cliName} -l json -d 'Output as JSON'
250
- complete -c ${cliName} -l provider -d 'Execution provider' -xa 'local remote ai'
251
- complete -c ${cliName} -l theme -d 'Color theme' -xa 'delta cyber sunset neon ocean fire'
252
- complete -c ${cliName} -l verbose -d 'Verbose logging'
253
- complete -c ${cliName} -l no-color -d 'Disable colors'
254
- complete -c ${cliName} -s i -l interactive -d 'Interactive mode'
255
- complete -c ${cliName} -s v -l version -d 'Show version'
256
- complete -c ${cliName} -s h -l help -d 'Show help'
257
- `;
258
- }
259
- function generatePowershellCompletion(cliName) {
260
- return `# Delta CLI PowerShell Completion
261
- # Add to $PROFILE: . delta completion powershell | Out-String | Invoke-Expression
262
-
263
- Register-ArgumentCompleter -Native -CommandName ${cliName} -ScriptBlock {
264
- param($wordToComplete, $commandAst, $cursorPosition)
265
-
266
- $commands = @('help', 'analyze', 'init', 'status', 'login', 'logout', 'whoami', 'config', 'dashboard', 'sync', 'deploy', 'plugins')
267
- $slashCommands = @('/help', '/h', '/analyze', '/a', '/init', '/i', '/status', '/st', '/login', '/logout', '/me', '/whoami', '/config', '/ui', '/sync', '/deploy', '/plugins')
268
-
269
- $command = $commandAst.CommandElements[1].Value
270
-
271
- if ($commandAst.CommandElements.Count -eq 1 -or
272
- ($commandAst.CommandElements.Count -eq 2 -and $wordToComplete -ne '')) {
273
- $commands + $slashCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
274
- [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
275
- }
276
- return
277
- }
278
-
279
- switch ($command) {
280
- { $_ -in 'analyze', '/a', '/analyze' } {
281
- $flags = @('--format', '--output', '--include', '--exclude', '--upload', '--share', '--json', '--provider')
282
- $flags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
283
- [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterName', $_)
284
- }
285
- }
286
- { $_ -in 'init', '/i', '/init' } {
287
- $flags = @('--template', '--force', '--git', '--json')
288
- $flags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
289
- [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterName', $_)
290
- }
291
- }
292
- }
293
- }
294
- `;
295
- }
296
- // Install completion for current shell
297
- export async function installCompletion(shell) {
298
- const detectedShell = shell || process.env.SHELL?.split('/').pop() || 'bash';
299
- console.log(`Installing completion for ${detectedShell}...\n`);
300
- const script = generateCompletionScript(detectedShell);
301
- console.log('Add this to your shell config:\n');
302
- console.log(script);
303
- console.log('\nOr run: eval "$(delta completion ' + detectedShell + ')"');
304
- }
305
- //# sourceMappingURL=completion.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Core Contracts - Interface definitions for Delta CLI
3
- * AI-Ready Architecture: Separate CLI from Business Logic
4
- */
5
- export {};
6
- //# sourceMappingURL=contracts.js.map
@@ -1,130 +0,0 @@
1
- /**
2
- * Delta Engine - Core Execution Engine
3
- * Mediator between CLI and Execution Providers
4
- */
5
- import { ExitCode, getExitCode } from './exit-codes.js';
6
- export class DeltaEngine {
7
- providers = new Map();
8
- config;
9
- policy;
10
- listeners = [];
11
- version = '2.0.0';
12
- constructor(config, policy) {
13
- this.config = config;
14
- this.policy = policy;
15
- }
16
- // Register an execution provider
17
- registerProvider(provider) {
18
- this.providers.set(provider.name, provider);
19
- }
20
- // Get registered provider
21
- getProvider(name) {
22
- return this.providers.get(name);
23
- }
24
- // Execute a task through the engine
25
- async execute(request) {
26
- const startTime = Date.now();
27
- // Emit start event
28
- this.emit({ type: 'task:start', request });
29
- try {
30
- // Validate request with policy (includes capability check)
31
- const validation = this.policy.validate(request);
32
- if (!validation.valid) {
33
- const exitCode = validation.exitCode || ExitCode.VALIDATION_ERROR;
34
- throw Object.assign(new Error(validation.reason || 'Task validation failed'), {
35
- code: exitCode === ExitCode.POLICY_BLOCKED ? 'POLICY_BLOCKED' : 'VALIDATION_ERROR',
36
- exitCode,
37
- });
38
- }
39
- // Transform request if needed (includes non-TTY detection)
40
- const transformedRequest = this.policy.transform?.(request) || request;
41
- // Select appropriate provider using policy
42
- const provider = this.policy.selectProvider(transformedRequest, this.providers);
43
- if (!provider) {
44
- throw Object.assign(new Error(`No provider available for task type '${transformedRequest.type}'`), { code: 'NO_PROVIDER', exitCode: ExitCode.POLICY_BLOCKED });
45
- }
46
- // Check provider availability
47
- const available = await provider.isAvailable();
48
- if (!available) {
49
- throw Object.assign(new Error(`Provider '${provider.name}' is not available`), {
50
- code: 'PROVIDER_UNAVAILABLE',
51
- exitCode: ExitCode.NETWORK_ERROR,
52
- });
53
- }
54
- // Execute task
55
- this.emit({ type: 'task:progress', request: transformedRequest, progress: 0.5 });
56
- const response = await provider.execute(transformedRequest);
57
- // Enrich response with engine metadata
58
- const enrichedResponse = {
59
- ...response,
60
- meta: {
61
- ...response.meta,
62
- command: request.command,
63
- duration: Date.now() - startTime,
64
- timestamp: new Date().toISOString(),
65
- version: this.version,
66
- coldStart: Date.now() - startTime - response.meta.duration,
67
- provider: provider.name,
68
- },
69
- };
70
- // Emit completion
71
- this.emit({
72
- type: 'task:complete',
73
- request: transformedRequest,
74
- response: enrichedResponse,
75
- });
76
- return enrichedResponse;
77
- }
78
- catch (error) {
79
- // Emit error
80
- this.emit({
81
- type: 'task:error',
82
- request,
83
- error: error instanceof Error ? error : new Error(String(error)),
84
- });
85
- return {
86
- success: false,
87
- exitCode: getExitCode(error),
88
- meta: {
89
- command: request.command,
90
- duration: Date.now() - startTime,
91
- timestamp: new Date().toISOString(),
92
- version: this.version,
93
- provider: 'engine',
94
- },
95
- error: {
96
- code: error instanceof Error && 'code' in error
97
- ? error.code
98
- : 'EXECUTION_ERROR',
99
- message: error instanceof Error ? error.message : String(error),
100
- },
101
- };
102
- }
103
- }
104
- // Subscribe to engine events
105
- on(_event, listener) {
106
- this.listeners.push(listener);
107
- }
108
- // Emit event to all listeners
109
- emit(event) {
110
- this.listeners.forEach(listener => listener(event));
111
- }
112
- // Get engine status
113
- getStatus() {
114
- return {
115
- version: this.version,
116
- providers: Array.from(this.providers.keys()),
117
- defaultProvider: this.config.defaultProvider,
118
- };
119
- }
120
- }
121
- // Singleton instance
122
- let engineInstance = null;
123
- export function createEngine(config, policy) {
124
- engineInstance = new DeltaEngine(config, policy);
125
- return engineInstance;
126
- }
127
- export function getEngine() {
128
- return engineInstance;
129
- }
130
- //# sourceMappingURL=engine.js.map
@@ -1,79 +0,0 @@
1
- /**
2
- * Exit Code Contract - Enterprise-grade error classification
3
- * Critical for CI/CD integration and automation
4
- */
5
- export var ExitCode;
6
- (function (ExitCode) {
7
- ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
8
- ExitCode[ExitCode["VALIDATION_ERROR"] = 1] = "VALIDATION_ERROR";
9
- ExitCode[ExitCode["NETWORK_ERROR"] = 2] = "NETWORK_ERROR";
10
- ExitCode[ExitCode["AUTH_ERROR"] = 3] = "AUTH_ERROR";
11
- ExitCode[ExitCode["POLICY_BLOCKED"] = 4] = "POLICY_BLOCKED";
12
- ExitCode[ExitCode["EXECUTION_ERROR"] = 5] = "EXECUTION_ERROR";
13
- ExitCode[ExitCode["UNKNOWN_ERROR"] = 6] = "UNKNOWN_ERROR";
14
- })(ExitCode || (ExitCode = {}));
15
- // Error to Exit Code mapping
16
- export function getExitCode(error) {
17
- const errorStr = typeof error === 'string'
18
- ? error
19
- : error instanceof Error
20
- ? error.message
21
- : error.message || String(error);
22
- const errorCode = typeof error === 'object' && 'code' in error ? error.code : undefined;
23
- // Check error codes first
24
- if (errorCode) {
25
- switch (errorCode) {
26
- case 'VALIDATION_ERROR':
27
- case 'INVALID_INPUT':
28
- case 'MISSING_ARGUMENT':
29
- return ExitCode.VALIDATION_ERROR;
30
- case 'AUTH_ERROR':
31
- case 'UNAUTHORIZED':
32
- case 'TOKEN_EXPIRED':
33
- return ExitCode.AUTH_ERROR;
34
- case 'NETWORK_ERROR':
35
- case 'CONNECTION_FAILED':
36
- case 'TIMEOUT':
37
- return ExitCode.NETWORK_ERROR;
38
- case 'POLICY_BLOCKED':
39
- case 'QUOTA_EXCEEDED':
40
- case 'PERMISSION_DENIED':
41
- return ExitCode.POLICY_BLOCKED;
42
- case 'EXECUTION_ERROR':
43
- return ExitCode.EXECUTION_ERROR;
44
- }
45
- }
46
- // Check error messages
47
- if (errorStr.includes('validation') ||
48
- errorStr.includes('invalid') ||
49
- errorStr.includes('required')) {
50
- return ExitCode.VALIDATION_ERROR;
51
- }
52
- if (errorStr.includes('auth') ||
53
- errorStr.includes('token') ||
54
- errorStr.includes('unauthorized')) {
55
- return ExitCode.AUTH_ERROR;
56
- }
57
- if (errorStr.includes('network') ||
58
- errorStr.includes('connection') ||
59
- errorStr.includes('timeout')) {
60
- return ExitCode.NETWORK_ERROR;
61
- }
62
- if (errorStr.includes('policy') ||
63
- errorStr.includes('quota') ||
64
- errorStr.includes('permission')) {
65
- return ExitCode.POLICY_BLOCKED;
66
- }
67
- return ExitCode.EXECUTION_ERROR;
68
- }
69
- // Human-readable exit code descriptions
70
- export const ExitCodeDescription = {
71
- [ExitCode.SUCCESS]: 'Success',
72
- [ExitCode.VALIDATION_ERROR]: 'Validation error - check your input',
73
- [ExitCode.NETWORK_ERROR]: 'Network error - check your connection',
74
- [ExitCode.AUTH_ERROR]: 'Authentication error - please login',
75
- [ExitCode.POLICY_BLOCKED]: 'Policy blocked - insufficient permissions or quota',
76
- [ExitCode.EXECUTION_ERROR]: 'Execution error - task failed during execution',
77
- [ExitCode.UNKNOWN_ERROR]: 'Unknown error - please report this issue',
78
- };
79
- //# sourceMappingURL=exit-codes.js.map