@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,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,167 +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 ? formatTimeAgo(project.lastAnalyze) : 'never';
48
- const totalFindings = project.findings.high + project.findings.medium + project.findings.low;
49
- const findingsColor = project.findings.high > 0 ? 'red' : project.findings.medium > 0 ? 'yellow' : 'green';
50
- 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"] }) })] }));
51
- };
52
- // Stats box component
53
- const StatsBox = ({ stats }) => {
54
- 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' })] })] }));
55
- };
56
- // Findings chart
57
- const FindingsChart = ({ projects }) => {
58
- const totalFindings = projects.reduce((sum, p) => sum + p.findings.high + p.findings.medium + p.findings.low, 0);
59
- const highCount = projects.reduce((sum, p) => sum + p.findings.high, 0);
60
- const mediumCount = projects.reduce((sum, p) => sum + p.findings.medium, 0);
61
- const lowCount = projects.reduce((sum, p) => sum + p.findings.low, 0);
62
- 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] })] })] })] }));
63
- };
64
- // Mock data generator
65
- const generateMockData = () => {
66
- const projects = [
67
- {
68
- name: 'MyApp',
69
- path: './myapp',
70
- status: 'ok',
71
- lastAnalyze: new Date(Date.now() - 2 * 60 * 1000),
72
- findings: { high: 0, medium: 2, low: 14 },
73
- duration: 1250,
74
- filesAnalyzed: 42,
75
- },
76
- {
77
- name: 'WebApp',
78
- path: './webapp',
79
- status: 'warning',
80
- lastAnalyze: new Date(Date.now() - 10 * 60 * 1000),
81
- findings: { high: 2, medium: 3, low: 8 },
82
- duration: 890,
83
- filesAnalyzed: 28,
84
- },
85
- {
86
- name: 'API Server',
87
- path: './api',
88
- status: 'ok',
89
- lastAnalyze: new Date(Date.now() - 30 * 60 * 1000),
90
- findings: { high: 0, medium: 0, low: 5 },
91
- duration: 2100,
92
- filesAnalyzed: 156,
93
- },
94
- {
95
- name: 'Frontend',
96
- path: './frontend',
97
- status: 'error',
98
- lastAnalyze: new Date(Date.now() - 60 * 60 * 1000),
99
- findings: { high: 5, medium: 12, low: 20 },
100
- duration: 3400,
101
- filesAnalyzed: 203,
102
- },
103
- ];
104
- const stats = {
105
- totalCommands: 127,
106
- successRate: 94,
107
- avgDuration: 1450,
108
- mostUsed: ['analyze', 'status', 'init'],
109
- };
110
- return { projects, stats };
111
- };
112
- // Helper function
113
- const formatTimeAgo = (date) => {
114
- const seconds = Math.floor((Date.now() - date.getTime()) / 1000);
115
- if (seconds < 60)
116
- return `${seconds}s ago`;
117
- const minutes = Math.floor(seconds / 60);
118
- if (minutes < 60)
119
- return `${minutes}m ago`;
120
- const hours = Math.floor(minutes / 60);
121
- if (hours < 24)
122
- return `${hours}h ago`;
123
- return `${Math.floor(hours / 24)}d ago`;
124
- };
125
- // Main Dashboard Component
126
- export const EnhancedDashboard = () => {
127
- const { exit } = useApp();
128
- const [loading, setLoading] = useState(true);
129
- const [data, setData] = useState(null);
130
- const [selectedIndex, setSelectedIndex] = useState(0);
131
- const [showDetail, setShowDetail] = useState(false);
132
- useEffect(() => {
133
- // Simulate loading data
134
- const timer = setTimeout(() => {
135
- setData(generateMockData());
136
- setLoading(false);
137
- }, 800);
138
- return () => clearTimeout(timer);
139
- }, []);
140
- useInput((input, key) => {
141
- if (key.escape || input === 'q') {
142
- exit();
143
- }
144
- if (key.return && data) {
145
- setShowDetail(true);
146
- }
147
- if (key.upArrow && data) {
148
- setSelectedIndex(i => Math.max(0, i - 1));
149
- }
150
- if (key.downArrow && data) {
151
- setSelectedIndex(i => Math.min(data.projects.length - 1, i + 1));
152
- }
153
- });
154
- if (loading) {
155
- 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..." })] }));
156
- }
157
- if (!data) {
158
- return (_jsx(Box, { padding: 2, children: _jsx(Text, { color: "red", children: "Failed to load dashboard data" }) }));
159
- }
160
- if (showDetail) {
161
- const project = data.projects[selectedIndex];
162
- 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" }) })] }));
163
- }
164
- 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" }) })] }));
165
- };
166
- export default EnhancedDashboard;
167
- //# 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