@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,31 +0,0 @@
1
- /**
2
- * Logout Command - Remove stored authentication
3
- */
4
- import * as fs from 'fs/promises';
5
- import { CONFIG_FILE } from './auth.js';
6
- import { SecureTokenStore } from '../auth/secure-auth.js';
7
- export async function logoutCommand() {
8
- try {
9
- const hasToken = await SecureTokenStore.hasTokens();
10
- if (!hasToken) {
11
- console.log('ℹ️ Not currently authenticated');
12
- process.exit(0);
13
- }
14
- // Clear tokens from keychain and remove config file
15
- await SecureTokenStore.clearTokens();
16
- try {
17
- await fs.unlink(CONFIG_FILE);
18
- }
19
- catch {
20
- // File may not exist, that's fine
21
- }
22
- console.log('✅ Successfully logged out');
23
- console.log(' Authentication data removed');
24
- process.exit(0);
25
- }
26
- catch (error) {
27
- console.error('❌ Error during logout:', error instanceof Error ? error.message : String(error));
28
- process.exit(1);
29
- }
30
- }
31
- //# sourceMappingURL=logout.js.map
@@ -1,21 +0,0 @@
1
- import { printSuccess, printInfo } from '../ui.js';
2
- export async function pluginsCommand(options) {
3
- if (options.list) {
4
- printInfo('Installed plugins:');
5
- }
6
- else if (options.install) {
7
- printInfo(`Installing plugin: ${options.install}`);
8
- printSuccess('Plugin installed successfully');
9
- }
10
- else if (options.uninstall) {
11
- printInfo(`Uninstalling plugin: ${options.uninstall}`);
12
- printSuccess('Plugin uninstalled successfully');
13
- }
14
- else if (options.search) {
15
- printInfo(`Searching for plugins: ${options.search}`);
16
- }
17
- else {
18
- printInfo('Use --list, --install, --uninstall, or --search');
19
- }
20
- }
21
- //# sourceMappingURL=plugins.js.map
@@ -1,82 +0,0 @@
1
- /**
2
- * Enhanced Status Command - Professional project and connection status
3
- */
4
- import * as fs from 'fs/promises';
5
- import * as path from 'path';
6
- import { loadConfig } from './auth.js';
7
- import { SecureTokenStore } from '../auth/secure-auth.js';
8
- import { icons, startSpinner, stopSpinner, printWelcome, printHeader, printSection, printSuccess, printError, printWarning, printInfo, printKeyValue, printCommandHint, createTable, printDivider, confirm, } from '../ui.js';
9
- export async function statusCommand(projectPath, _options) {
10
- const targetPath = path.resolve(projectPath);
11
- printWelcome();
12
- printHeader('Project Status Check');
13
- printKeyValue('Path', targetPath);
14
- console.log();
15
- // Check for delta config
16
- printSection('Project Configuration');
17
- const configPath = path.join(targetPath, 'delta.config.json');
18
- try {
19
- await fs.access(configPath);
20
- const config = JSON.parse(await fs.readFile(configPath, 'utf-8'));
21
- printSuccess('Configuration found');
22
- const configTable = createTable(['Property', 'Value']);
23
- configTable.push([icons.folder + ' Name', config.name || 'Unnamed'], [icons.folder + ' Type', config.type || 'default'], [icons.gear + ' Version', config.version || 'N/A'], [icons.info + ' Config File', configPath]);
24
- console.log(configTable.toString());
25
- }
26
- catch {
27
- printWarning('No Delta project found');
28
- printInfo('Initialize a new project:');
29
- printCommandHint(`delta init ${projectPath}`, 'to create a new project');
30
- const shouldInit = await confirm('Would you like to initialize now?', true);
31
- if (shouldInit) {
32
- console.log();
33
- printInfo('Run: delta init ' + projectPath);
34
- }
35
- }
36
- console.log();
37
- printDivider();
38
- // Check auth status
39
- printSection('Authentication');
40
- const auth = await loadConfig();
41
- const pat = await SecureTokenStore.getAccessToken();
42
- if (pat) {
43
- printSuccess('Authenticated');
44
- printKeyValue('API URL', auth.apiUrl || 'default');
45
- // Test connection
46
- const apiUrl = auth.apiUrl || process.env.DELTA_API_URL || 'http://localhost:3000';
47
- startSpinner('Testing connection...');
48
- try {
49
- const response = await fetch(`${apiUrl}/api/me/entitlements`, {
50
- headers: { 'Authorization': `Bearer ${pat}` },
51
- });
52
- if (response.ok) {
53
- stopSpinner(true, 'Connection active');
54
- const data = await response.json();
55
- if (data.success) {
56
- printKeyValue('User', data.data.user.email);
57
- printKeyValue('Plan', data.data.user.plan);
58
- }
59
- }
60
- else {
61
- stopSpinner(false, 'Authentication expired');
62
- printError('Your session has expired');
63
- printCommandHint('delta login --token <new-pat>', 'to re-authenticate');
64
- }
65
- }
66
- catch {
67
- stopSpinner(false, 'API unreachable');
68
- printError('Cannot connect to Delta API');
69
- printInfo('Check your internet connection or API URL configuration');
70
- }
71
- }
72
- else {
73
- printError('Not authenticated');
74
- printInfo('Please login to access cloud features:');
75
- printCommandHint('delta login --token <pat>', 'to authenticate');
76
- }
77
- console.log();
78
- printDivider();
79
- printCommandHint('delta analyze', 'to analyze your project');
80
- printCommandHint('delta whoami', 'to see account details');
81
- }
82
- //# sourceMappingURL=status.js.map
@@ -1,6 +0,0 @@
1
- import { printSuccess, printInfo } from '../ui.js';
2
- export async function syncCommand(_options) {
3
- printInfo('Syncing with Delta cloud...');
4
- printSuccess('Sync completed successfully');
5
- }
6
- //# sourceMappingURL=sync.js.map
@@ -1,72 +0,0 @@
1
- /**
2
- * Enhanced Whoami Command - Professional user info display
3
- */
4
- import { loadConfig } from './auth.js';
5
- import { SecureTokenStore } from '../auth/secure-auth.js';
6
- import { icons, startSpinner, stopSpinner, printHeader, printSuccess, printError, printInfo, printCommandHint, createTable, printDivider, } from '../ui.js';
7
- export async function whoamiCommand(_options) {
8
- try {
9
- const config = await loadConfig();
10
- const pat = await SecureTokenStore.getAccessToken();
11
- if (!pat) {
12
- printHeader('Authentication Status');
13
- printError('Not authenticated');
14
- console.log();
15
- printInfo('Please login first:');
16
- printCommandHint('delta login', 'to authenticate with your PAT');
17
- process.exit(1);
18
- }
19
- printHeader('Loading Account Information');
20
- startSpinner('Fetching user data...');
21
- const apiUrl = config.apiUrl || process.env.DELTA_API_URL || 'http://localhost:3000';
22
- const response = await fetch(`${apiUrl}/api/auth/me`, {
23
- headers: {
24
- 'Authorization': `Bearer ${pat}`,
25
- 'Content-Type': 'application/json',
26
- },
27
- });
28
- if (!response.ok) {
29
- stopSpinner(false);
30
- if (response.status === 401) {
31
- printError('Authentication expired or invalid');
32
- console.log();
33
- printInfo('Please login again:');
34
- printCommandHint('delta login --token <new-pat>', 'to re-authenticate');
35
- process.exit(1);
36
- }
37
- throw new Error(`API error: ${response.status} ${response.statusText}`);
38
- }
39
- const data = await response.json();
40
- stopSpinner(true);
41
- console.log();
42
- const user = data;
43
- // User Info Section
44
- printHeader('User Profile');
45
- const userTable = createTable(['Property', 'Value']);
46
- userTable.push([icons.user + ' Email', user.email], [icons.user + ' User ID', user.id], [icons.package + ' Plan', formatPlan(user.plan)], [icons.star + ' Role', user.role || user.plan], [icons.info + ' Status', user.status || 'active'], [icons.bullet + ' Created', new Date(user.created_at).toLocaleDateString('en-US')]);
47
- console.log(userTable.toString());
48
- printDivider();
49
- console.log();
50
- printSuccess('✓ Authenticated successfully');
51
- console.log();
52
- printCommandHint('delta analyze', 'to run a code analysis');
53
- printCommandHint('delta status', 'to check project status');
54
- process.exit(0);
55
- }
56
- catch (error) {
57
- stopSpinner(false);
58
- console.log();
59
- printError(error instanceof Error ? error.message : String(error));
60
- process.exit(1);
61
- }
62
- }
63
- function formatPlan(plan) {
64
- const planColors = {
65
- 'individual_free': '🔷 Free',
66
- 'individual_pro': '💎 Pro',
67
- 'individual_team': '👥 Team',
68
- 'enterprise': '🏢 Enterprise',
69
- };
70
- return planColors[plan] || plan;
71
- }
72
- //# sourceMappingURL=whoami.js.map
@@ -1,169 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Enhanced Dashboard Component
4
- * Visual dashboard with project status, analysis reports, and charts
5
- */
6
- import { useState, useEffect } from 'react';
7
- import { Box, Text, useApp, useInput } from 'ink';
8
- import Spinner from 'ink-spinner';
9
- // Custom Divider component (replacement for ink-divider with type issues)
10
- const CustomDivider = ({ title }) => (_jsx(Box, { marginY: 1, children: _jsxs(Text, { color: "gray", children: ['─'.repeat(40), title ? ` ${title} ` : '', '─'.repeat(40)] }) }));
11
- // Sparkline chart component
12
- const Sparkline = ({ data, width = 20 }) => {
13
- if (data.length === 0)
14
- return _jsx(Text, { dimColor: true, children: "no data" });
15
- const max = Math.max(...data, 1);
16
- const min = Math.min(...data, 0);
17
- const range = max - min || 1;
18
- const bars = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
19
- const normalized = data.map(v => {
20
- const idx = Math.floor(((v - min) / range) * (bars.length - 1));
21
- return bars[Math.min(idx, bars.length - 1)];
22
- });
23
- // Truncate or pad to width
24
- const display = normalized.slice(-width);
25
- while (display.length < width) {
26
- display.unshift(bars[0]);
27
- }
28
- return _jsx(Text, { color: "cyan", children: display.join('') });
29
- };
30
- // Progress bar component
31
- const ProgressBar = ({ value, max, width = 20 }) => {
32
- const percentage = Math.min(Math.max(value / max, 0), 1);
33
- const filled = Math.floor(percentage * width);
34
- const empty = width - filled;
35
- const bar = '█'.repeat(filled) + '░'.repeat(empty);
36
- const color = percentage > 0.7 ? 'red' : percentage > 0.4 ? 'yellow' : 'green';
37
- return (_jsxs(Text, { children: [_jsx(Text, { color: color, children: bar }), _jsxs(Text, { dimColor: true, children: [" ", Math.round(percentage * 100), "%"] })] }));
38
- };
39
- // Status indicator
40
- const StatusIndicator = ({ status }) => {
41
- const icons = { ok: '✅', warning: '⚠️', error: '❌' };
42
- const colors = { ok: 'green', warning: 'yellow', error: 'red' };
43
- return _jsx(Text, { color: colors[status], children: icons[status] });
44
- };
45
- // Project row component
46
- const ProjectRow = ({ project, isSelected }) => {
47
- const timeAgo = project.lastAnalyze
48
- ? formatTimeAgo(project.lastAnalyze)
49
- : 'never';
50
- const totalFindings = project.findings.high + project.findings.medium + project.findings.low;
51
- const findingsColor = project.findings.high > 0 ? 'red' : project.findings.medium > 0 ? 'yellow' : 'green';
52
- return (_jsxs(Box, { flexDirection: "row", gap: 2, children: [_jsx(Box, { width: 3, children: isSelected ? _jsx(Text, { color: "cyan", children: "\u276F" }) : _jsx(Text, { children: " " }) }), _jsx(Box, { width: 12, children: _jsx(StatusIndicator, { status: project.status }) }), _jsx(Box, { width: 20, children: _jsx(Text, { bold: isSelected, children: project.name }) }), _jsx(Box, { width: 12, children: _jsx(Text, { dimColor: true, children: timeAgo }) }), _jsx(Box, { width: 10, children: _jsxs(Text, { color: findingsColor, children: [totalFindings, " (", project.findings.high, "H)"] }) }), _jsx(Box, { width: 10, children: _jsxs(Text, { dimColor: true, children: [project.duration, "ms"] }) })] }));
53
- };
54
- // Stats box component
55
- const StatsBox = ({ stats }) => {
56
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 2, paddingY: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\uD83D\uDCCA Usage Statistics" }), _jsx(Box, { children: _jsxs(Box, { flexDirection: "row", gap: 4, children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "Total Commands" }), _jsx(Text, { bold: true, children: stats.totalCommands })] }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "Success Rate" }), _jsxs(Text, { bold: true, color: stats.successRate > 80 ? 'green' : 'yellow', children: [stats.successRate, "%"] }), _jsx(Sparkline, { data: [stats.successRate, 100 - stats.successRate], width: 10 })] }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "Avg Duration" }), _jsxs(Text, { bold: true, children: [stats.avgDuration, "ms"] })] })] }) }), _jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "Most Used: " }), _jsx(Text, { children: stats.mostUsed.join(', ') || 'none' })] })] }));
57
- };
58
- // Findings chart
59
- const FindingsChart = ({ projects }) => {
60
- const totalFindings = projects.reduce((sum, p) => sum + p.findings.high + p.findings.medium + p.findings.low, 0);
61
- const highCount = projects.reduce((sum, p) => sum + p.findings.high, 0);
62
- const mediumCount = projects.reduce((sum, p) => sum + p.findings.medium, 0);
63
- const lowCount = projects.reduce((sum, p) => sum + p.findings.low, 0);
64
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 2, paddingY: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\uD83D\uDD0D Findings Distribution" }), _jsxs(Box, { marginY: 1, flexDirection: "column", gap: 1, children: [_jsxs(Box, { flexDirection: "row", gap: 2, children: [_jsx(Box, { width: 10, children: _jsx(Text, { color: "red", children: "High:" }) }), _jsx(ProgressBar, { value: highCount, max: Math.max(totalFindings, 1), width: 25 }), _jsxs(Text, { color: "red", children: [" ", highCount] })] }), _jsxs(Box, { flexDirection: "row", gap: 2, children: [_jsx(Box, { width: 10, children: _jsx(Text, { color: "yellow", children: "Medium:" }) }), _jsx(ProgressBar, { value: mediumCount, max: Math.max(totalFindings, 1), width: 25 }), _jsxs(Text, { color: "yellow", children: [" ", mediumCount] })] }), _jsxs(Box, { flexDirection: "row", gap: 2, children: [_jsx(Box, { width: 10, children: _jsx(Text, { color: "green", children: "Low:" }) }), _jsx(ProgressBar, { value: lowCount, max: Math.max(totalFindings, 1), width: 25 }), _jsxs(Text, { color: "green", children: [" ", lowCount] })] })] })] }));
65
- };
66
- // Mock data generator
67
- const generateMockData = () => {
68
- const projects = [
69
- {
70
- name: 'MyApp',
71
- path: './myapp',
72
- status: 'ok',
73
- lastAnalyze: new Date(Date.now() - 2 * 60 * 1000),
74
- findings: { high: 0, medium: 2, low: 14 },
75
- duration: 1250,
76
- filesAnalyzed: 42,
77
- },
78
- {
79
- name: 'WebApp',
80
- path: './webapp',
81
- status: 'warning',
82
- lastAnalyze: new Date(Date.now() - 10 * 60 * 1000),
83
- findings: { high: 2, medium: 3, low: 8 },
84
- duration: 890,
85
- filesAnalyzed: 28,
86
- },
87
- {
88
- name: 'API Server',
89
- path: './api',
90
- status: 'ok',
91
- lastAnalyze: new Date(Date.now() - 30 * 60 * 1000),
92
- findings: { high: 0, medium: 0, low: 5 },
93
- duration: 2100,
94
- filesAnalyzed: 156,
95
- },
96
- {
97
- name: 'Frontend',
98
- path: './frontend',
99
- status: 'error',
100
- lastAnalyze: new Date(Date.now() - 60 * 60 * 1000),
101
- findings: { high: 5, medium: 12, low: 20 },
102
- duration: 3400,
103
- filesAnalyzed: 203,
104
- },
105
- ];
106
- const stats = {
107
- totalCommands: 127,
108
- successRate: 94,
109
- avgDuration: 1450,
110
- mostUsed: ['analyze', 'status', 'init'],
111
- };
112
- return { projects, stats };
113
- };
114
- // Helper function
115
- const formatTimeAgo = (date) => {
116
- const seconds = Math.floor((Date.now() - date.getTime()) / 1000);
117
- if (seconds < 60)
118
- return `${seconds}s ago`;
119
- const minutes = Math.floor(seconds / 60);
120
- if (minutes < 60)
121
- return `${minutes}m ago`;
122
- const hours = Math.floor(minutes / 60);
123
- if (hours < 24)
124
- return `${hours}h ago`;
125
- return `${Math.floor(hours / 24)}d ago`;
126
- };
127
- // Main Dashboard Component
128
- export const EnhancedDashboard = () => {
129
- const { exit } = useApp();
130
- const [loading, setLoading] = useState(true);
131
- const [data, setData] = useState(null);
132
- const [selectedIndex, setSelectedIndex] = useState(0);
133
- const [showDetail, setShowDetail] = useState(false);
134
- useEffect(() => {
135
- // Simulate loading data
136
- const timer = setTimeout(() => {
137
- setData(generateMockData());
138
- setLoading(false);
139
- }, 800);
140
- return () => clearTimeout(timer);
141
- }, []);
142
- useInput((input, key) => {
143
- if (key.escape || input === 'q') {
144
- exit();
145
- }
146
- if (key.return && data) {
147
- setShowDetail(true);
148
- }
149
- if (key.upArrow && data) {
150
- setSelectedIndex(i => Math.max(0, i - 1));
151
- }
152
- if (key.downArrow && data) {
153
- setSelectedIndex(i => Math.min(data.projects.length - 1, i + 1));
154
- }
155
- });
156
- if (loading) {
157
- return (_jsxs(Box, { flexDirection: "column", alignItems: "center", padding: 2, children: [_jsx(Text, { color: "cyan", children: _jsx(Spinner, { type: "dots" }) }), _jsx(Text, { children: " Loading dashboard data..." })] }));
158
- }
159
- if (!data) {
160
- return (_jsx(Box, { padding: 2, children: _jsx(Text, { color: "red", children: "Failed to load dashboard data" }) }));
161
- }
162
- if (showDetail) {
163
- const project = data.projects[selectedIndex];
164
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Text, { bold: true, color: "cyan", children: ["\uD83D\uDCC1 Project Details: ", project.name] }), _jsx(CustomDivider, {}), _jsxs(Box, { flexDirection: "column", gap: 1, marginY: 1, children: [_jsxs(Text, { children: ["Path: ", _jsx(Text, { color: "cyan", children: project.path })] }), _jsxs(Text, { children: ["Status: ", _jsx(StatusIndicator, { status: project.status })] }), _jsxs(Text, { children: ["Files Analyzed: ", _jsx(Text, { bold: true, children: project.filesAnalyzed })] }), _jsxs(Text, { children: ["Duration: ", _jsxs(Text, { bold: true, children: [project.duration, "ms"] })] }), _jsxs(Text, { children: ["Last Analysis: ", project.lastAnalyze?.toLocaleString() || 'never'] })] }), _jsxs(Box, { marginY: 1, children: [_jsx(Text, { bold: true, children: "Findings:" }), _jsxs(Box, { flexDirection: "row", gap: 4, children: [_jsxs(Text, { color: "red", children: ["High: ", project.findings.high] }), _jsxs(Text, { color: "yellow", children: ["Medium: ", project.findings.medium] }), _jsxs(Text, { color: "green", children: ["Low: ", project.findings.low] })] })] }), _jsx(Box, { marginTop: 2, children: _jsx(Text, { dimColor: true, children: "Press Esc or Q to go back" }) })] }));
165
- }
166
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, color: "cyan", backgroundColor: "gray", children: [' ', " Delta CLI Dashboard ", ' '] }) }), _jsxs(Box, { flexDirection: "row", gap: 2, marginBottom: 1, children: [_jsx(Box, { width: "50%", children: _jsx(StatsBox, { stats: data.stats }) }), _jsx(Box, { width: "50%", children: _jsx(FindingsChart, { projects: data.projects }) })] }), _jsx(CustomDivider, { title: "Projects" }), _jsxs(Box, { flexDirection: "row", gap: 2, marginY: 1, children: [_jsx(Box, { width: 3, children: _jsx(Text, { children: " " }) }), _jsx(Box, { width: 12, children: _jsx(Text, { dimColor: true, children: "Status" }) }), _jsx(Box, { width: 20, children: _jsx(Text, { dimColor: true, children: "Name" }) }), _jsx(Box, { width: 12, children: _jsx(Text, { dimColor: true, children: "Last" }) }), _jsx(Box, { width: 10, children: _jsx(Text, { dimColor: true, children: "Findings" }) }), _jsx(Box, { width: 10, children: _jsx(Text, { dimColor: true, children: "Duration" }) })] }), _jsx(Box, { flexDirection: "column", children: data.projects.map((project, index) => (_jsx(ProjectRow, { project: project, isSelected: index === selectedIndex }, project.name))) }), _jsx(Box, { marginTop: 2, children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 Navigate \u2022 Enter Details \u2022 Q/Esc Exit" }) })] }));
167
- };
168
- export default EnhancedDashboard;
169
- //# sourceMappingURL=Dashboard.js.map
@@ -1,57 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Box, Text, useApp } from 'ink';
4
- import SelectInput from 'ink-select-input';
5
- import Spinner from 'ink-spinner';
6
- // Custom Divider component (replacement for ink-divider with type issues)
7
- const CustomDivider = ({ title }) => (_jsx(Box, { marginY: 1, children: _jsxs(Text, { color: "gray", children: ['─'.repeat(40), title ? ` ${title} ` : '', '─'.repeat(40)] }) }));
8
- import { EnhancedDashboard } from './Dashboard.js';
9
- // Delta Logo Component
10
- export const DeltaLogo = () => {
11
- const [frame, setFrame] = useState(0);
12
- const frames = ['◐', '◓', '◑', '◒'];
13
- useEffect(() => {
14
- const timer = setInterval(() => {
15
- setFrame((f) => (f + 1) % frames.length);
16
- }, 100);
17
- return () => clearInterval(timer);
18
- }, []);
19
- return (_jsxs(Box, { flexDirection: "column", alignItems: "center", padding: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: "cyan", children: "\u2554\u2550\u2550\u2550" }), _jsx(Text, { color: "magenta", children: "DELTA" }), _jsx(Text, { color: "cyan", children: "\u2550\u2550\u2550\u2557" })] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: [frames[frame], " Next-gen code analysis"] }) })] }));
20
- };
21
- // Main App Component
22
- export const DeltaApp = () => {
23
- const { exit } = useApp();
24
- const [currentView, setCurrentView] = useState('menu');
25
- const menuItems = [
26
- { label: '📊 Dashboard', value: 'dashboard' },
27
- { label: '🔍 Analyze', value: 'analyze' },
28
- { label: '☁️ Sync', value: 'sync' },
29
- { label: '⚙️ Settings', value: 'settings' },
30
- { label: '❌ Exit', value: 'exit' },
31
- ];
32
- const handleSelect = (item) => {
33
- if (item.value === 'exit') {
34
- exit();
35
- }
36
- else if (item.value === 'dashboard') {
37
- setCurrentView('dashboard');
38
- }
39
- };
40
- if (currentView === 'dashboard') {
41
- return _jsx(EnhancedDashboard, {});
42
- }
43
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(DeltaLogo, {}), _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsx(CustomDivider, { title: "Main Menu" }) }), _jsx(Box, { children: _jsx(SelectInput, { items: menuItems, onSelect: handleSelect }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Enter to select \u2022 Q to quit" }) })] }));
44
- };
45
- // Loading Screen
46
- export const LoadingScreen = ({ message = 'Loading...' }) => {
47
- return (_jsxs(Box, { flexDirection: "column", alignItems: "center", padding: 2, children: [_jsx(Text, { color: "cyan", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", message] })] }));
48
- };
49
- // Error Display
50
- export const ErrorDisplay = ({ error }) => {
51
- return (_jsx(Box, { flexDirection: "column", padding: 1, children: _jsxs(Text, { bold: true, color: "red", children: ["\u274C Error: ", error.message] }) }));
52
- };
53
- // Success Message
54
- export const SuccessMessage = ({ message }) => {
55
- return (_jsx(Box, { padding: 1, children: _jsxs(Text, { color: "green", children: ["\u2713 ", message] }) }));
56
- };
57
- //# sourceMappingURL=DeltaApp.js.map