@vee-stack/delta-cli 2.0.8 → 2.0.10

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 (183) 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/{apps/cli/src/core/index.js → core/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 -8
  51. package/dist/analyzer/commands/analyze.js +0 -260
  52. package/dist/analyzer/commands/config.js +0 -83
  53. package/dist/analyzer/commands/report.js +0 -38
  54. package/dist/analyzer/generators/report.generator.js +0 -123
  55. package/dist/analyzer/index.js +0 -44
  56. package/dist/analyzer/scanners/project.scanner.js +0 -92
  57. package/dist/analyzer/validators/contracts.validator.js +0 -42
  58. package/dist/analyzer/validators/maintainability.validator.js +0 -40
  59. package/dist/analyzer/validators/observability.validator.js +0 -39
  60. package/dist/analyzer/validators/performance.validator.js +0 -42
  61. package/dist/analyzer/validators/security.validator.js +0 -66
  62. package/dist/analyzer/validators/soc.validator.js +0 -75
  63. package/dist/apps/cli/src/analyzer/commands/analyze.js +0 -256
  64. package/dist/apps/cli/src/analyzer/commands/config.js +0 -83
  65. package/dist/apps/cli/src/analyzer/commands/report.js +0 -38
  66. package/dist/apps/cli/src/analyzer/generators/report.generator.js +0 -123
  67. package/dist/apps/cli/src/analyzer/index.js +0 -44
  68. package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +0 -92
  69. package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +0 -42
  70. package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +0 -40
  71. package/dist/apps/cli/src/analyzer/validators/observability.validator.js +0 -39
  72. package/dist/apps/cli/src/analyzer/validators/performance.validator.js +0 -42
  73. package/dist/apps/cli/src/analyzer/validators/security.validator.js +0 -66
  74. package/dist/apps/cli/src/analyzer/validators/soc.validator.js +0 -75
  75. package/dist/apps/cli/src/auth/secure-auth.js +0 -312
  76. package/dist/apps/cli/src/commands/analyze.js +0 -286
  77. package/dist/apps/cli/src/commands/auth-new.js +0 -37
  78. package/dist/apps/cli/src/commands/auth.js +0 -122
  79. package/dist/apps/cli/src/commands/config.js +0 -49
  80. package/dist/apps/cli/src/commands/deploy.js +0 -6
  81. package/dist/apps/cli/src/commands/init.js +0 -47
  82. package/dist/apps/cli/src/commands/logout.js +0 -23
  83. package/dist/apps/cli/src/commands/plugins.js +0 -21
  84. package/dist/apps/cli/src/commands/status.js +0 -80
  85. package/dist/apps/cli/src/commands/sync.js +0 -6
  86. package/dist/apps/cli/src/commands/whoami.js +0 -115
  87. package/dist/apps/cli/src/components/Dashboard.js +0 -168
  88. package/dist/apps/cli/src/components/DeltaApp.js +0 -56
  89. package/dist/apps/cli/src/components/UnifiedManager.js +0 -324
  90. package/dist/apps/cli/src/core/audit.js +0 -184
  91. package/dist/apps/cli/src/core/completion.js +0 -294
  92. package/dist/apps/cli/src/core/contracts.js +0 -6
  93. package/dist/apps/cli/src/core/engine.js +0 -124
  94. package/dist/apps/cli/src/core/exit-codes.js +0 -71
  95. package/dist/apps/cli/src/core/hooks.js +0 -181
  96. package/dist/apps/cli/src/core/policy.js +0 -115
  97. package/dist/apps/cli/src/core/profiles.js +0 -161
  98. package/dist/apps/cli/src/core/wizard.js +0 -203
  99. package/dist/apps/cli/src/index.js +0 -636
  100. package/dist/apps/cli/src/interactive/index.js +0 -11
  101. package/dist/apps/cli/src/plugins/GitStatusPlugin.js +0 -99
  102. package/dist/apps/cli/src/providers/ai-provider.js +0 -74
  103. package/dist/apps/cli/src/providers/local-provider.js +0 -302
  104. package/dist/apps/cli/src/providers/remote-provider.js +0 -100
  105. package/dist/apps/cli/src/types/api.js +0 -3
  106. package/dist/apps/cli/src/ui.js +0 -219
  107. package/dist/apps/cli/src/welcome.js +0 -81
  108. package/dist/auth/secure-auth.js +0 -372
  109. package/dist/bundle.js +0 -504
  110. package/dist/commands/analyze.js +0 -390
  111. package/dist/commands/auth-new.js +0 -37
  112. package/dist/commands/auth.js +0 -134
  113. package/dist/commands/config.js +0 -51
  114. package/dist/commands/deploy.js +0 -6
  115. package/dist/commands/init.js +0 -47
  116. package/dist/commands/logout.js +0 -31
  117. package/dist/commands/plugins.js +0 -21
  118. package/dist/commands/status.js +0 -82
  119. package/dist/commands/sync.js +0 -6
  120. package/dist/commands/whoami.js +0 -72
  121. package/dist/components/Dashboard.js +0 -169
  122. package/dist/components/DeltaApp.js +0 -57
  123. package/dist/components/UnifiedManager.js +0 -344
  124. package/dist/core/audit.js +0 -184
  125. package/dist/core/completion.js +0 -294
  126. package/dist/core/contracts.js +0 -6
  127. package/dist/core/engine.js +0 -124
  128. package/dist/core/exit-codes.js +0 -71
  129. package/dist/core/hooks.js +0 -181
  130. package/dist/core/index.js +0 -7
  131. package/dist/core/policy.js +0 -115
  132. package/dist/core/profiles.js +0 -161
  133. package/dist/core/wizard.js +0 -203
  134. package/dist/index.js +0 -387
  135. package/dist/interactive/index.js +0 -11
  136. package/dist/packages/domain/src/constitution/contracts/index.js +0 -43
  137. package/dist/packages/domain/src/constitution/contracts/ts.rules.js +0 -268
  138. package/dist/packages/domain/src/constitution/index.js +0 -139
  139. package/dist/packages/domain/src/constitution/maintainability/index.js +0 -43
  140. package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +0 -344
  141. package/dist/packages/domain/src/constitution/observability/index.js +0 -43
  142. package/dist/packages/domain/src/constitution/observability/ts.rules.js +0 -307
  143. package/dist/packages/domain/src/constitution/performance/index.js +0 -43
  144. package/dist/packages/domain/src/constitution/performance/ts.rules.js +0 -325
  145. package/dist/packages/domain/src/constitution/security/index.js +0 -50
  146. package/dist/packages/domain/src/constitution/security/ts.rules.js +0 -267
  147. package/dist/packages/domain/src/constitution/soc/index.js +0 -43
  148. package/dist/packages/domain/src/constitution/soc/ts.rules.js +0 -360
  149. package/dist/packages/domain/src/contracts/analysis.contract.js +0 -18
  150. package/dist/packages/domain/src/contracts/index.js +0 -7
  151. package/dist/packages/domain/src/contracts/projects.contract.js +0 -18
  152. package/dist/packages/domain/src/control/registry/rules.registry.js +0 -29
  153. package/dist/packages/domain/src/control/schemas/policies.js +0 -6
  154. package/dist/packages/domain/src/core/analysis/discovery.js +0 -163
  155. package/dist/packages/domain/src/core/analysis/engine.contract.js +0 -298
  156. package/dist/packages/domain/src/core/analysis/engine.js +0 -77
  157. package/dist/packages/domain/src/core/analysis/index.js +0 -14
  158. package/dist/packages/domain/src/core/analysis/orchestrator.js +0 -242
  159. package/dist/packages/domain/src/core/comparison/engine.js +0 -29
  160. package/dist/packages/domain/src/core/comparison/index.js +0 -5
  161. package/dist/packages/domain/src/core/documentation/index.js +0 -5
  162. package/dist/packages/domain/src/core/documentation/pipeline.js +0 -41
  163. package/dist/packages/domain/src/core/fs/adapter.js +0 -111
  164. package/dist/packages/domain/src/core/fs/index.js +0 -5
  165. package/dist/packages/domain/src/core/parser/unified-parser.js +0 -166
  166. package/dist/packages/domain/src/index.js +0 -33
  167. package/dist/packages/domain/src/plugin/registry.js +0 -195
  168. package/dist/packages/domain/src/plugin/types.js +0 -6
  169. package/dist/packages/domain/src/ports/analysis.engine.js +0 -7
  170. package/dist/packages/domain/src/ports/audit.logger.js +0 -7
  171. package/dist/packages/domain/src/ports/project.repository.js +0 -7
  172. package/dist/packages/domain/src/rules/index.js +0 -134
  173. package/dist/packages/domain/src/types/analysis.js +0 -6
  174. package/dist/packages/domain/src/types/errors.js +0 -53
  175. package/dist/packages/domain/src/types/fs.js +0 -6
  176. package/dist/packages/domain/src/types/index.js +0 -7
  177. package/dist/plugins/GitStatusPlugin.js +0 -93
  178. package/dist/providers/ai-provider.js +0 -74
  179. package/dist/providers/local-provider.js +0 -304
  180. package/dist/providers/remote-provider.js +0 -100
  181. package/dist/types/api.js +0 -3
  182. package/dist/ui.js +0 -219
  183. package/dist/welcome.js +0 -81
@@ -1,134 +0,0 @@
1
- /**
2
- * Rules Implementation - First Rule Engine
3
- * Concrete rule implementations using pure functions
4
- * @module rules
5
- */
6
- import { rulesRegistry } from '../control/registry/rules.registry.js';
7
- /**
8
- * File Size Rule
9
- * Checks if file exceeds maximum size
10
- */
11
- const fileSizeRule = (input, policy) => {
12
- if (policy.type !== 'file-size')
13
- return [];
14
- const contentSizeKB = Buffer.byteLength(input.content, 'utf8') / 1024;
15
- const findings = [];
16
- if (policy.maxSizeKB && contentSizeKB > policy.maxSizeKB) {
17
- findings.push({
18
- id: `file-size-${input.file}`,
19
- ruleId: policy.id,
20
- severity: policy.severity,
21
- category: policy.category,
22
- message: `File size (${contentSizeKB.toFixed(2)} KB) exceeds maximum (${policy.maxSizeKB} KB)`,
23
- filePath: input.file,
24
- line: 1,
25
- column: 1,
26
- suggestion: 'Consider splitting this file into smaller modules',
27
- relatedFindings: [],
28
- });
29
- }
30
- return findings;
31
- };
32
- /**
33
- * Forbidden Patterns Rule
34
- * Detects forbidden patterns in code
35
- */
36
- const forbiddenPatternsRule = (input, policy) => {
37
- if (policy.type !== 'forbidden-patterns')
38
- return [];
39
- const findings = [];
40
- if (!policy.patterns)
41
- return findings;
42
- for (const pattern of policy.patterns) {
43
- const regex = new RegExp(pattern.pattern, pattern.caseSensitive ? 'g' : 'gi');
44
- const lines = input.content.split('\n');
45
- for (let i = 0; i < lines.length; i++) {
46
- const line = lines[i];
47
- const matches = line.match(regex);
48
- if (matches) {
49
- findings.push({
50
- id: `forbidden-${policy.id}-${i}`,
51
- ruleId: policy.id,
52
- severity: pattern.severity,
53
- category: policy.category,
54
- message: pattern.message,
55
- filePath: input.file,
56
- line: i + 1,
57
- column: line.indexOf(matches[0]) + 1,
58
- suggestion: 'Remove or replace this pattern',
59
- relatedFindings: [],
60
- });
61
- }
62
- }
63
- }
64
- return findings;
65
- };
66
- /**
67
- * Complexity Rule
68
- * Calculates code complexity
69
- */
70
- const complexityRule = (input, policy) => {
71
- if (policy.type !== 'complexity')
72
- return [];
73
- const findings = [];
74
- // Count decision points (if, switch, for, while, etc.)
75
- const decisionPoints = [
76
- /\bif\s*\(/g,
77
- /\bswitch\s*\(/g,
78
- /\bfor\s*\(/g,
79
- /\bwhile\s*\(/g,
80
- /\bcatch\s*\(/g,
81
- /\?\s*[^:]+:/g, // ternary
82
- ];
83
- let cyclomaticComplexity = 1; // base complexity
84
- for (const pattern of decisionPoints) {
85
- const matches = input.content.match(pattern);
86
- if (matches) {
87
- cyclomaticComplexity += matches.length;
88
- }
89
- }
90
- if (policy.maxCyclomaticComplexity && cyclomaticComplexity > policy.maxCyclomaticComplexity) {
91
- findings.push({
92
- id: `complexity-${input.file}`,
93
- ruleId: policy.id,
94
- severity: policy.severity,
95
- category: policy.category,
96
- message: `Cyclomatic complexity (${cyclomaticComplexity}) exceeds maximum (${policy.maxCyclomaticComplexity})`,
97
- filePath: input.file,
98
- line: 1,
99
- column: 1,
100
- suggestion: 'Refactor into smaller functions to reduce complexity',
101
- relatedFindings: [],
102
- });
103
- }
104
- return findings;
105
- };
106
- /**
107
- * Register all rules
108
- */
109
- export function registerDefaultRules() {
110
- rulesRegistry.register({
111
- id: 'file-size',
112
- name: 'File Size Check',
113
- description: 'Checks if files exceed maximum size limits',
114
- category: 'maintainability',
115
- execute: fileSizeRule,
116
- });
117
- rulesRegistry.register({
118
- id: 'forbidden-patterns',
119
- name: 'Forbidden Patterns',
120
- description: 'Detects forbidden patterns in code',
121
- category: 'security',
122
- execute: forbiddenPatternsRule,
123
- });
124
- rulesRegistry.register({
125
- id: 'complexity',
126
- name: 'Code Complexity',
127
- description: 'Analyzes code complexity metrics',
128
- category: 'maintainability',
129
- execute: complexityRule,
130
- });
131
- }
132
- // Auto-register on module load
133
- registerDefaultRules();
134
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Analysis types
3
- * @see docs/architecture/OVERVIEW.md#data-flow
4
- */
5
- export {};
6
- //# sourceMappingURL=analysis.js.map
@@ -1,53 +0,0 @@
1
- /**
2
- * Base error class for Delta Platform
3
- * @see docs/architecture/OVERVIEW.md#error-handling
4
- */
5
- export class DeltaError extends Error {
6
- code;
7
- incidentId;
8
- timestamp;
9
- constructor(code, message, incidentId) {
10
- super(message);
11
- this.code = code;
12
- this.incidentId = incidentId;
13
- this.timestamp = new Date();
14
- this.name = 'DeltaError';
15
- }
16
- }
17
- /**
18
- * Configuration-related errors
19
- */
20
- export class ConfigError extends DeltaError {
21
- constructor(message, incidentId) {
22
- super('CONFIG_ERROR', message, incidentId);
23
- this.name = 'ConfigError';
24
- }
25
- }
26
- /**
27
- * Analysis-related errors
28
- */
29
- export class AnalysisError extends DeltaError {
30
- constructor(message, incidentId) {
31
- super('ANALYSIS_ERROR', message, incidentId);
32
- this.name = 'AnalysisError';
33
- }
34
- }
35
- /**
36
- * Sync-related errors
37
- */
38
- export class SyncError extends DeltaError {
39
- constructor(message, incidentId) {
40
- super('SYNC_ERROR', message, incidentId);
41
- this.name = 'SyncError';
42
- }
43
- }
44
- /**
45
- * File system-related errors
46
- */
47
- export class FileSystemError extends DeltaError {
48
- constructor(message, incidentId) {
49
- super('FS_ERROR', message, incidentId);
50
- this.name = 'FileSystemError';
51
- }
52
- }
53
- //# sourceMappingURL=errors.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * File system types
3
- * @see docs/architecture/OVERVIEW.md#file-system-abstraction
4
- */
5
- export {};
6
- //# sourceMappingURL=fs.js.map
@@ -1,7 +0,0 @@
1
- /**
2
- * Core types index
3
- */
4
- export * from './errors.js';
5
- export * from './fs.js';
6
- export * from './analysis.js';
7
- //# sourceMappingURL=index.js.map
@@ -1,93 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * GitStatusPlugin - MVP Plugin Example
4
- * Displays git repository status in the sidebar
5
- * Demonstrates Plugin System capabilities
6
- */
7
- import { execSync } from 'child_process';
8
- import { Box, Text } from 'ink';
9
- export class GitStatusPlugin {
10
- id = 'git-status';
11
- name = 'Git Status';
12
- version = '1.0.0';
13
- description = 'Displays git repository status in the dashboard';
14
- context;
15
- branch = 'unknown';
16
- status = 'clean';
17
- aheadBehind = '';
18
- constructor(context) {
19
- this.context = context;
20
- }
21
- onActivate() {
22
- this.updateGitStatus();
23
- // Auto-update every 10 seconds
24
- setInterval(() => this.updateGitStatus(), 10000);
25
- this.context.addLog('GitStatus', 'Git Status Plugin activated', 'info');
26
- }
27
- onDeactivate() {
28
- this.context.addLog('GitStatus', 'Git Status Plugin deactivated', 'info');
29
- }
30
- registerCommands() {
31
- return [
32
- {
33
- id: 'refresh',
34
- label: 'Refresh Git Status',
35
- shortcut: 'g',
36
- icon: '🔄',
37
- execute: () => {
38
- this.updateGitStatus();
39
- this.context.addLog('GitStatus', 'Git status refreshed manually', 'success');
40
- },
41
- },
42
- ];
43
- }
44
- registerDashboardWidgets() {
45
- return [
46
- {
47
- id: 'git-info',
48
- title: 'Git Status',
49
- position: 'sidebar',
50
- priority: 10,
51
- render: () => this.renderWidget(),
52
- updateInterval: 10000,
53
- },
54
- ];
55
- }
56
- updateGitStatus() {
57
- try {
58
- // Check if we're in a git repo
59
- execSync('git rev-parse --git-dir', { stdio: 'pipe' });
60
- // Get current branch
61
- this.branch = execSync('git branch --show-current', { encoding: 'utf-8' }).trim();
62
- // Check for uncommitted changes
63
- const status = execSync('git status --porcelain', { encoding: 'utf-8' });
64
- this.status = status.trim() ? 'dirty' : 'clean';
65
- // Get ahead/behind info
66
- try {
67
- const aheadBehind = execSync('git rev-list --left-right --count HEAD...@{u} 2>/dev/null || echo "0\t0"', { encoding: 'utf-8' }).trim();
68
- const [ahead, behind] = aheadBehind.split('\t');
69
- if (ahead !== '0' || behind !== '0') {
70
- this.aheadBehind = `${ahead}↑ ${behind}↓`;
71
- }
72
- else {
73
- this.aheadBehind = '';
74
- }
75
- }
76
- catch {
77
- this.aheadBehind = '';
78
- }
79
- }
80
- catch {
81
- this.branch = 'not a repo';
82
- this.status = 'clean';
83
- this.aheadBehind = '';
84
- }
85
- }
86
- renderWidget() {
87
- const statusIcon = this.status === 'clean' ? '✓' : '⚡';
88
- const statusColor = this.status === 'clean' ? 'green' : 'yellow';
89
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, width: 28, marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\uD83C\uDF3F Git Status" }), _jsxs(Text, { color: "white", children: ["Branch: ", this.branch] }), _jsxs(Text, { color: statusColor, children: [statusIcon, " ", this.status === 'clean' ? 'Clean' : 'Modified'] }), this.aheadBehind ? _jsx(Text, { color: "yellow", children: this.aheadBehind }) : null] }));
90
- }
91
- }
92
- export default GitStatusPlugin;
93
- //# sourceMappingURL=GitStatusPlugin.js.map
@@ -1,74 +0,0 @@
1
- /**
2
- * AI Provider (Placeholder)
3
- * Reserved for future AI integration without breaking existing architecture
4
- */
5
- import { ExitCode } from '../core/exit-codes.js';
6
- export class AIProviderPlaceholder {
7
- name = 'ai';
8
- version = '2.0.0-placeholder';
9
- capabilities = {
10
- commands: ['analyze'],
11
- features: {
12
- json: true,
13
- streaming: true,
14
- caching: false,
15
- ai: true,
16
- },
17
- constraints: {
18
- maxFileSize: 100 * 1024 * 1024, // 100MB
19
- requiresAuth: true,
20
- },
21
- };
22
- config;
23
- constructor(config) {
24
- this.config = config;
25
- }
26
- async isAvailable() {
27
- // AI provider is not available in current version
28
- // This will return true when AI is implemented
29
- return this.config.enabled && !!this.config.apiKey;
30
- }
31
- async execute(request) {
32
- const startTime = Date.now();
33
- // Placeholder: Return error indicating AI is not implemented
34
- return {
35
- success: false,
36
- exitCode: ExitCode.POLICY_BLOCKED,
37
- meta: {
38
- command: request.command,
39
- duration: Date.now() - startTime,
40
- timestamp: new Date().toISOString(),
41
- version: this.version,
42
- provider: this.name,
43
- },
44
- error: {
45
- code: 'AI_NOT_IMPLEMENTED',
46
- message: 'AI features are reserved for future releases. Use --provider=local for now.',
47
- details: {
48
- note: 'AI integration will be available in v2.1.0 without requiring any CLI changes',
49
- alternative: 'Use --provider=local for local execution or --provider=remote for cloud execution',
50
- },
51
- },
52
- };
53
- }
54
- // AI-specific methods (to be implemented)
55
- async generate(input, _context) {
56
- if (!this.config.enabled) {
57
- throw new Error('AI provider is not enabled');
58
- }
59
- // Placeholder implementation
60
- return `AI generation not implemented. Input received: ${input.substring(0, 50)}...`;
61
- }
62
- async analyzeCode(_code, _language) {
63
- if (!this.config.enabled) {
64
- throw new Error('AI provider is not enabled');
65
- }
66
- // Placeholder implementation
67
- return {
68
- insights: ['AI code analysis not yet implemented'],
69
- suggestions: ['Use --provider=local for current analysis capabilities'],
70
- score: 0,
71
- };
72
- }
73
- }
74
- //# sourceMappingURL=ai-provider.js.map
@@ -1,304 +0,0 @@
1
- /**
2
- * Local Execution Provider
3
- * Implements all logic locally without external AI services
4
- */
5
- import { ExitCode } from '../core/exit-codes.js';
6
- import * as fs from 'fs/promises';
7
- import * as path from 'path';
8
- import { loadConfig } from '../commands/auth.js';
9
- import { SecureTokenStore } from '../auth/secure-auth.js';
10
- export class LocalProvider {
11
- name = 'local';
12
- version = '2.0.0';
13
- capabilities = {
14
- commands: ['analyze', 'init', 'status', 'config', 'auth'],
15
- features: {
16
- json: true,
17
- streaming: false,
18
- caching: true,
19
- ai: false,
20
- },
21
- constraints: {
22
- maxFileSize: 10 * 1024 * 1024, // 10MB
23
- maxFiles: 1000,
24
- requiresAuth: false,
25
- },
26
- };
27
- config;
28
- constructor(config) {
29
- this.config = config;
30
- }
31
- async isAvailable() {
32
- // Local provider is always available
33
- return true;
34
- }
35
- async execute(request) {
36
- const startTime = Date.now();
37
- try {
38
- switch (request.type) {
39
- case 'analyze':
40
- return await this.executeAnalyze(request);
41
- case 'init':
42
- return await this.executeInit(request);
43
- case 'status':
44
- return await this.executeStatus(request);
45
- case 'config':
46
- return await this.executeConfig(request);
47
- case 'auth':
48
- return await this.executeAuth(request);
49
- default:
50
- throw new Error(`Task type '${request.type}' not supported by local provider`);
51
- }
52
- }
53
- catch (error) {
54
- return {
55
- success: false,
56
- exitCode: ExitCode.EXECUTION_ERROR,
57
- meta: {
58
- command: request.command,
59
- duration: Date.now() - startTime,
60
- timestamp: new Date().toISOString(),
61
- version: this.version,
62
- provider: this.name,
63
- },
64
- error: {
65
- code: 'LOCAL_EXECUTION_ERROR',
66
- message: error instanceof Error ? error.message : String(error),
67
- },
68
- };
69
- }
70
- }
71
- // Analyze task execution
72
- async executeAnalyze(request) {
73
- const { targetPath, options } = request.payload;
74
- // Discover files
75
- const files = await this.discoverFiles(targetPath, {
76
- include: ['**/*.{ts,tsx,js,jsx}'],
77
- exclude: this.config.excludePatterns,
78
- maxSize: options.maxSize,
79
- });
80
- // Analyze files
81
- const findings = [];
82
- let totalLines = 0;
83
- let totalFunctions = 0;
84
- let totalClasses = 0;
85
- for (const file of files) {
86
- const content = await fs.readFile(file, 'utf-8');
87
- const lines = content.split('\n');
88
- totalLines += lines.length;
89
- // Simple heuristics
90
- if (content.includes('function '))
91
- totalFunctions++;
92
- if (content.includes('class '))
93
- totalClasses++;
94
- // Find issues
95
- if (content.includes('eval(')) {
96
- findings.push({
97
- file: path.relative(targetPath, file),
98
- type: 'security',
99
- severity: 'high',
100
- message: 'Use of eval() detected',
101
- });
102
- }
103
- if (content.includes('console.log')) {
104
- findings.push({
105
- file: path.relative(targetPath, file),
106
- type: 'maintainability',
107
- severity: 'low',
108
- message: 'Console.log statement found',
109
- });
110
- }
111
- }
112
- // Generate report
113
- const report = {
114
- schema_version: '1.0',
115
- engine_version: this.version,
116
- created_at: new Date().toISOString(),
117
- project: {
118
- name: options.projectName || path.basename(targetPath),
119
- path: targetPath,
120
- },
121
- summary: {
122
- total: findings.length,
123
- high: findings.filter(f => f.severity === 'high').length,
124
- medium: findings.filter(f => f.severity === 'medium').length,
125
- low: findings.filter(f => f.severity === 'low').length,
126
- },
127
- metrics: {
128
- totalFiles: files.length,
129
- totalLines,
130
- totalFunctions,
131
- totalClasses,
132
- },
133
- findings,
134
- };
135
- // Save report
136
- const outputDir = path.resolve(options.output);
137
- await fs.mkdir(outputDir, { recursive: true });
138
- const reportFile = path.join(outputDir, `report-${Date.now()}.json`);
139
- await fs.writeFile(reportFile, JSON.stringify(report, null, 2));
140
- return {
141
- success: true,
142
- exitCode: ExitCode.SUCCESS,
143
- meta: {
144
- command: request.command,
145
- duration: 0,
146
- timestamp: new Date().toISOString(),
147
- version: this.version,
148
- provider: this.name,
149
- },
150
- data: {
151
- report,
152
- reportFile,
153
- filesAnalyzed: files.length,
154
- findings: findings.length,
155
- },
156
- };
157
- }
158
- // Init task execution
159
- async executeInit(request) {
160
- const { projectPath, template } = request.payload;
161
- await fs.mkdir(projectPath, { recursive: true });
162
- const config = {
163
- name: path.basename(projectPath),
164
- version: '1.0.0',
165
- template,
166
- type: 'default',
167
- created_at: new Date().toISOString(),
168
- };
169
- const configPath = path.join(projectPath, 'delta.config.json');
170
- await fs.writeFile(configPath, JSON.stringify(config, null, 2));
171
- return {
172
- success: true,
173
- exitCode: ExitCode.SUCCESS,
174
- meta: {
175
- command: request.command,
176
- duration: 0,
177
- timestamp: new Date().toISOString(),
178
- version: this.version,
179
- provider: this.name,
180
- },
181
- data: {
182
- projectPath,
183
- configPath,
184
- template,
185
- },
186
- };
187
- }
188
- // Status task execution
189
- async executeStatus(request) {
190
- const { projectPath } = request.payload;
191
- // Check config
192
- const configPath = path.join(projectPath, 'delta.config.json');
193
- let hasConfig = false;
194
- try {
195
- await fs.access(configPath);
196
- hasConfig = true;
197
- }
198
- catch {
199
- hasConfig = false;
200
- }
201
- // Check auth
202
- const auth = await loadConfig();
203
- const hasPat = await SecureTokenStore.hasTokens();
204
- return {
205
- success: true,
206
- exitCode: ExitCode.SUCCESS,
207
- meta: {
208
- command: request.command,
209
- duration: 0,
210
- timestamp: new Date().toISOString(),
211
- version: this.version,
212
- provider: this.name,
213
- },
214
- data: {
215
- project: {
216
- path: projectPath,
217
- hasConfig,
218
- configPath: hasConfig ? configPath : null,
219
- },
220
- auth: {
221
- authenticated: hasPat,
222
- apiUrl: auth.apiUrl || 'default',
223
- },
224
- },
225
- };
226
- }
227
- // Config task execution
228
- async executeConfig(request) {
229
- // Simple config management
230
- return {
231
- success: true,
232
- exitCode: ExitCode.SUCCESS,
233
- meta: {
234
- command: request.command,
235
- duration: 0,
236
- timestamp: new Date().toISOString(),
237
- version: this.version,
238
- provider: this.name,
239
- },
240
- data: {
241
- action: request.payload.action,
242
- config: {},
243
- },
244
- };
245
- }
246
- // Auth task execution
247
- async executeAuth(request) {
248
- const { action } = request.payload;
249
- return {
250
- success: true,
251
- exitCode: ExitCode.SUCCESS,
252
- meta: {
253
- command: request.command,
254
- duration: 0,
255
- timestamp: new Date().toISOString(),
256
- version: this.version,
257
- provider: this.name,
258
- },
259
- data: {
260
- action,
261
- authenticated: action === 'login',
262
- },
263
- };
264
- }
265
- // File discovery helper
266
- async discoverFiles(rootPath, options) {
267
- const files = [];
268
- async function walk(dir) {
269
- const entries = await fs.readdir(dir, { withFileTypes: true });
270
- for (const entry of entries) {
271
- const fullPath = path.join(dir, entry.name);
272
- if (entry.isDirectory()) {
273
- if (options.exclude.some(e => entry.name.includes(e)))
274
- continue;
275
- await walk(fullPath);
276
- }
277
- else if (entry.isFile()) {
278
- // Simple pattern matching
279
- const shouldInclude = options.include.some(pattern => {
280
- if (pattern.includes('**')) {
281
- const ext = pattern.replace('**/*', '');
282
- return entry.name.endsWith(ext);
283
- }
284
- return entry.name.includes(pattern.replace('*', ''));
285
- });
286
- if (shouldInclude) {
287
- try {
288
- const stats = await fs.stat(fullPath);
289
- if (stats.size <= options.maxSize) {
290
- files.push(fullPath);
291
- }
292
- }
293
- catch {
294
- // Skip files we can't stat
295
- }
296
- }
297
- }
298
- }
299
- }
300
- await walk(rootPath);
301
- return files;
302
- }
303
- }
304
- //# sourceMappingURL=local-provider.js.map