@vee-stack/delta-cli 2.0.7 → 2.0.9

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 (109) hide show
  1. package/dist/adapters/analysis.adapter.js +42 -0
  2. package/dist/analyzer/commands/analyze.js +74 -114
  3. package/dist/auth/device-auth.js +261 -0
  4. package/dist/auth/secure-auth.js +45 -16
  5. package/dist/commands/analyze.js +30 -27
  6. package/dist/commands/auth.js +13 -16
  7. package/dist/commands/status.js +2 -2
  8. package/dist/commands/whoami.js +6 -6
  9. package/dist/components/Dashboard.js +3 -5
  10. package/dist/components/DeltaApp.js +1 -1
  11. package/dist/components/UnifiedManager.js +48 -20
  12. package/dist/core/completion.js +14 -3
  13. package/dist/core/engine.js +10 -4
  14. package/dist/core/exit-codes.js +12 -4
  15. package/dist/core/wizard.js +1 -1
  16. package/dist/index.js +21 -5
  17. package/dist/providers/remote-provider.js +2 -2
  18. package/dist/telemetry/wrapper.js +114 -0
  19. package/dist/ui.js +9 -2
  20. package/dist/welcome.js +14 -4
  21. package/package.json +3 -1
  22. package/dist/apps/cli/src/analyzer/commands/analyze.js +0 -256
  23. package/dist/apps/cli/src/analyzer/commands/config.js +0 -83
  24. package/dist/apps/cli/src/analyzer/commands/report.js +0 -38
  25. package/dist/apps/cli/src/analyzer/generators/report.generator.js +0 -123
  26. package/dist/apps/cli/src/analyzer/index.js +0 -44
  27. package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +0 -92
  28. package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +0 -42
  29. package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +0 -40
  30. package/dist/apps/cli/src/analyzer/validators/observability.validator.js +0 -39
  31. package/dist/apps/cli/src/analyzer/validators/performance.validator.js +0 -42
  32. package/dist/apps/cli/src/analyzer/validators/security.validator.js +0 -66
  33. package/dist/apps/cli/src/analyzer/validators/soc.validator.js +0 -75
  34. package/dist/apps/cli/src/auth/secure-auth.js +0 -312
  35. package/dist/apps/cli/src/commands/analyze.js +0 -286
  36. package/dist/apps/cli/src/commands/auth-new.js +0 -37
  37. package/dist/apps/cli/src/commands/auth.js +0 -122
  38. package/dist/apps/cli/src/commands/config.js +0 -49
  39. package/dist/apps/cli/src/commands/deploy.js +0 -6
  40. package/dist/apps/cli/src/commands/init.js +0 -47
  41. package/dist/apps/cli/src/commands/logout.js +0 -23
  42. package/dist/apps/cli/src/commands/plugins.js +0 -21
  43. package/dist/apps/cli/src/commands/status.js +0 -80
  44. package/dist/apps/cli/src/commands/sync.js +0 -6
  45. package/dist/apps/cli/src/commands/whoami.js +0 -115
  46. package/dist/apps/cli/src/components/Dashboard.js +0 -168
  47. package/dist/apps/cli/src/components/DeltaApp.js +0 -56
  48. package/dist/apps/cli/src/components/UnifiedManager.js +0 -324
  49. package/dist/apps/cli/src/core/audit.js +0 -184
  50. package/dist/apps/cli/src/core/completion.js +0 -294
  51. package/dist/apps/cli/src/core/contracts.js +0 -6
  52. package/dist/apps/cli/src/core/engine.js +0 -124
  53. package/dist/apps/cli/src/core/exit-codes.js +0 -71
  54. package/dist/apps/cli/src/core/hooks.js +0 -181
  55. package/dist/apps/cli/src/core/index.js +0 -7
  56. package/dist/apps/cli/src/core/policy.js +0 -115
  57. package/dist/apps/cli/src/core/profiles.js +0 -161
  58. package/dist/apps/cli/src/core/wizard.js +0 -203
  59. package/dist/apps/cli/src/index.js +0 -636
  60. package/dist/apps/cli/src/interactive/index.js +0 -11
  61. package/dist/apps/cli/src/plugins/GitStatusPlugin.js +0 -99
  62. package/dist/apps/cli/src/providers/ai-provider.js +0 -74
  63. package/dist/apps/cli/src/providers/local-provider.js +0 -302
  64. package/dist/apps/cli/src/providers/remote-provider.js +0 -100
  65. package/dist/apps/cli/src/types/api.js +0 -3
  66. package/dist/apps/cli/src/ui.js +0 -219
  67. package/dist/apps/cli/src/welcome.js +0 -81
  68. package/dist/bundle.js +0 -504
  69. package/dist/packages/domain/src/constitution/contracts/index.js +0 -43
  70. package/dist/packages/domain/src/constitution/contracts/ts.rules.js +0 -268
  71. package/dist/packages/domain/src/constitution/index.js +0 -139
  72. package/dist/packages/domain/src/constitution/maintainability/index.js +0 -43
  73. package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +0 -344
  74. package/dist/packages/domain/src/constitution/observability/index.js +0 -43
  75. package/dist/packages/domain/src/constitution/observability/ts.rules.js +0 -307
  76. package/dist/packages/domain/src/constitution/performance/index.js +0 -43
  77. package/dist/packages/domain/src/constitution/performance/ts.rules.js +0 -325
  78. package/dist/packages/domain/src/constitution/security/index.js +0 -50
  79. package/dist/packages/domain/src/constitution/security/ts.rules.js +0 -267
  80. package/dist/packages/domain/src/constitution/soc/index.js +0 -43
  81. package/dist/packages/domain/src/constitution/soc/ts.rules.js +0 -360
  82. package/dist/packages/domain/src/contracts/analysis.contract.js +0 -18
  83. package/dist/packages/domain/src/contracts/index.js +0 -7
  84. package/dist/packages/domain/src/contracts/projects.contract.js +0 -18
  85. package/dist/packages/domain/src/control/registry/rules.registry.js +0 -29
  86. package/dist/packages/domain/src/control/schemas/policies.js +0 -6
  87. package/dist/packages/domain/src/core/analysis/discovery.js +0 -163
  88. package/dist/packages/domain/src/core/analysis/engine.contract.js +0 -298
  89. package/dist/packages/domain/src/core/analysis/engine.js +0 -77
  90. package/dist/packages/domain/src/core/analysis/index.js +0 -14
  91. package/dist/packages/domain/src/core/analysis/orchestrator.js +0 -242
  92. package/dist/packages/domain/src/core/comparison/engine.js +0 -29
  93. package/dist/packages/domain/src/core/comparison/index.js +0 -5
  94. package/dist/packages/domain/src/core/documentation/index.js +0 -5
  95. package/dist/packages/domain/src/core/documentation/pipeline.js +0 -41
  96. package/dist/packages/domain/src/core/fs/adapter.js +0 -111
  97. package/dist/packages/domain/src/core/fs/index.js +0 -5
  98. package/dist/packages/domain/src/core/parser/unified-parser.js +0 -166
  99. package/dist/packages/domain/src/index.js +0 -33
  100. package/dist/packages/domain/src/plugin/registry.js +0 -195
  101. package/dist/packages/domain/src/plugin/types.js +0 -6
  102. package/dist/packages/domain/src/ports/analysis.engine.js +0 -7
  103. package/dist/packages/domain/src/ports/audit.logger.js +0 -7
  104. package/dist/packages/domain/src/ports/project.repository.js +0 -7
  105. package/dist/packages/domain/src/rules/index.js +0 -134
  106. package/dist/packages/domain/src/types/analysis.js +0 -6
  107. package/dist/packages/domain/src/types/errors.js +0 -53
  108. package/dist/packages/domain/src/types/fs.js +0 -6
  109. package/dist/packages/domain/src/types/index.js +0 -7
@@ -1,168 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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
- import Divider from 'ink-divider';
10
- // Sparkline chart component
11
- const Sparkline = ({ data, width = 20 }) => {
12
- if (data.length === 0)
13
- return _jsx(Text, { dimColor: true, children: "no data" });
14
- const max = Math.max(...data, 1);
15
- const min = Math.min(...data, 0);
16
- const range = max - min || 1;
17
- const bars = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
18
- const normalized = data.map(v => {
19
- const idx = Math.floor(((v - min) / range) * (bars.length - 1));
20
- return bars[Math.min(idx, bars.length - 1)];
21
- });
22
- // Truncate or pad to width
23
- const display = normalized.slice(-width);
24
- while (display.length < width) {
25
- display.unshift(bars[0]);
26
- }
27
- return _jsx(Text, { color: "cyan", children: display.join('') });
28
- };
29
- // Progress bar component
30
- const ProgressBar = ({ value, max, width = 20 }) => {
31
- const percentage = Math.min(Math.max(value / max, 0), 1);
32
- const filled = Math.floor(percentage * width);
33
- const empty = width - filled;
34
- const bar = '█'.repeat(filled) + '░'.repeat(empty);
35
- const color = percentage > 0.7 ? 'red' : percentage > 0.4 ? 'yellow' : 'green';
36
- return (_jsxs(Text, { children: [_jsx(Text, { color: color, children: bar }), _jsxs(Text, { dimColor: true, children: [" ", Math.round(percentage * 100), "%"] })] }));
37
- };
38
- // Status indicator
39
- const StatusIndicator = ({ status }) => {
40
- const icons = { ok: '✅', warning: '⚠️', error: '❌' };
41
- const colors = { ok: 'green', warning: 'yellow', error: 'red' };
42
- return _jsx(Text, { color: colors[status], children: icons[status] });
43
- };
44
- // Project row component
45
- const ProjectRow = ({ project, isSelected }) => {
46
- const timeAgo = project.lastAnalyze
47
- ? formatTimeAgo(project.lastAnalyze)
48
- : 'never';
49
- const totalFindings = project.findings.high + project.findings.medium + project.findings.low;
50
- const findingsColor = project.findings.high > 0 ? 'red' : project.findings.medium > 0 ? 'yellow' : 'green';
51
- 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"] }) })] }));
52
- };
53
- // Stats box component
54
- const StatsBox = ({ stats }) => {
55
- 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' })] })] }));
56
- };
57
- // Findings chart
58
- const FindingsChart = ({ projects }) => {
59
- const totalFindings = projects.reduce((sum, p) => sum + p.findings.high + p.findings.medium + p.findings.low, 0);
60
- const highCount = projects.reduce((sum, p) => sum + p.findings.high, 0);
61
- const mediumCount = projects.reduce((sum, p) => sum + p.findings.medium, 0);
62
- const lowCount = projects.reduce((sum, p) => sum + p.findings.low, 0);
63
- 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] })] })] })] }));
64
- };
65
- // Mock data generator
66
- const generateMockData = () => {
67
- const projects = [
68
- {
69
- name: 'MyApp',
70
- path: './myapp',
71
- status: 'ok',
72
- lastAnalyze: new Date(Date.now() - 2 * 60 * 1000),
73
- findings: { high: 0, medium: 2, low: 14 },
74
- duration: 1250,
75
- filesAnalyzed: 42,
76
- },
77
- {
78
- name: 'WebApp',
79
- path: './webapp',
80
- status: 'warning',
81
- lastAnalyze: new Date(Date.now() - 10 * 60 * 1000),
82
- findings: { high: 2, medium: 3, low: 8 },
83
- duration: 890,
84
- filesAnalyzed: 28,
85
- },
86
- {
87
- name: 'API Server',
88
- path: './api',
89
- status: 'ok',
90
- lastAnalyze: new Date(Date.now() - 30 * 60 * 1000),
91
- findings: { high: 0, medium: 0, low: 5 },
92
- duration: 2100,
93
- filesAnalyzed: 156,
94
- },
95
- {
96
- name: 'Frontend',
97
- path: './frontend',
98
- status: 'error',
99
- lastAnalyze: new Date(Date.now() - 60 * 60 * 1000),
100
- findings: { high: 5, medium: 12, low: 20 },
101
- duration: 3400,
102
- filesAnalyzed: 203,
103
- },
104
- ];
105
- const stats = {
106
- totalCommands: 127,
107
- successRate: 94,
108
- avgDuration: 1450,
109
- mostUsed: ['analyze', 'status', 'init'],
110
- };
111
- return { projects, stats };
112
- };
113
- // Helper function
114
- const formatTimeAgo = (date) => {
115
- const seconds = Math.floor((Date.now() - date.getTime()) / 1000);
116
- if (seconds < 60)
117
- return `${seconds}s ago`;
118
- const minutes = Math.floor(seconds / 60);
119
- if (minutes < 60)
120
- return `${minutes}m ago`;
121
- const hours = Math.floor(minutes / 60);
122
- if (hours < 24)
123
- return `${hours}h ago`;
124
- return `${Math.floor(hours / 24)}d ago`;
125
- };
126
- // Main Dashboard Component
127
- export const EnhancedDashboard = () => {
128
- const { exit } = useApp();
129
- const [loading, setLoading] = useState(true);
130
- const [data, setData] = useState(null);
131
- const [selectedIndex, setSelectedIndex] = useState(0);
132
- const [showDetail, setShowDetail] = useState(false);
133
- useEffect(() => {
134
- // Simulate loading data
135
- const timer = setTimeout(() => {
136
- setData(generateMockData());
137
- setLoading(false);
138
- }, 800);
139
- return () => clearTimeout(timer);
140
- }, []);
141
- useInput((input, key) => {
142
- if (key.escape || input === 'q') {
143
- exit();
144
- }
145
- if (key.return && data) {
146
- setShowDetail(true);
147
- }
148
- if (key.upArrow && data) {
149
- setSelectedIndex(i => Math.max(0, i - 1));
150
- }
151
- if (key.downArrow && data) {
152
- setSelectedIndex(i => Math.min(data.projects.length - 1, i + 1));
153
- }
154
- });
155
- if (loading) {
156
- 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..." })] }));
157
- }
158
- if (!data) {
159
- return (_jsx(Box, { padding: 2, children: _jsx(Text, { color: "red", children: "Failed to load dashboard data" }) }));
160
- }
161
- if (showDetail) {
162
- const project = data.projects[selectedIndex];
163
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Text, { bold: true, color: "cyan", children: ["\uD83D\uDCC1 Project Details: ", project.name] }), _jsx(Divider, {}), _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" }) })] }));
164
- }
165
- 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(Divider, { 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" }) })] }));
166
- };
167
- export default EnhancedDashboard;
168
- //# sourceMappingURL=Dashboard.js.map
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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
- import Divider from 'ink-divider';
7
- import { EnhancedDashboard } from './Dashboard.js';
8
- // Delta Logo Component
9
- export const DeltaLogo = () => {
10
- const [frame, setFrame] = useState(0);
11
- const frames = ['◐', '◓', '◑', '◒'];
12
- useEffect(() => {
13
- const timer = setInterval(() => {
14
- setFrame((f) => (f + 1) % frames.length);
15
- }, 100);
16
- return () => clearInterval(timer);
17
- }, []);
18
- 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"] }) })] }));
19
- };
20
- // Main App Component
21
- export const DeltaApp = () => {
22
- const { exit } = useApp();
23
- const [currentView, setCurrentView] = useState('menu');
24
- const menuItems = [
25
- { label: '📊 Dashboard', value: 'dashboard' },
26
- { label: '🔍 Analyze', value: 'analyze' },
27
- { label: '☁️ Sync', value: 'sync' },
28
- { label: '⚙️ Settings', value: 'settings' },
29
- { label: '❌ Exit', value: 'exit' },
30
- ];
31
- const handleSelect = (item) => {
32
- if (item.value === 'exit') {
33
- exit();
34
- }
35
- else if (item.value === 'dashboard') {
36
- setCurrentView('dashboard');
37
- }
38
- };
39
- if (currentView === 'dashboard') {
40
- return _jsx(EnhancedDashboard, {});
41
- }
42
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(DeltaLogo, {}), _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsx(Divider, { 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" }) })] }));
43
- };
44
- // Loading Screen
45
- export const LoadingScreen = ({ message = 'Loading...' }) => {
46
- return (_jsxs(Box, { flexDirection: "column", alignItems: "center", padding: 2, children: [_jsx(Text, { color: "cyan", children: _jsx(Spinner, { type: "dots" }) }), _jsxs(Text, { children: [" ", message] })] }));
47
- };
48
- // Error Display
49
- export const ErrorDisplay = ({ error }) => {
50
- return (_jsx(Box, { flexDirection: "column", padding: 1, children: _jsxs(Text, { bold: true, color: "red", children: ["\u274C Error: ", error.message] }) }));
51
- };
52
- // Success Message
53
- export const SuccessMessage = ({ message }) => {
54
- return (_jsx(Box, { padding: 1, children: _jsxs(Text, { color: "green", children: ["\u2713 ", message] }) }));
55
- };
56
- //# sourceMappingURL=DeltaApp.js.map
@@ -1,324 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Delta Unified Manager - Professional TUI Dashboard
4
- * World-class integrated terminal interface
5
- * Design matching GUI screenshot with sidebar, cards, and logs
6
- * Features: Keyboard Shortcuts, Log Filtering, Persistent State, Plugin System
7
- */
8
- import React, { useState, useEffect, useCallback, useRef } from 'react';
9
- import { Box, Text, useApp, useInput } from 'ink';
10
- import Spinner from 'ink-spinner';
11
- import { spawn } from 'child_process';
12
- import { platform, homedir } from 'os';
13
- import { join } from 'path';
14
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
15
- import { PluginRegistry } from '@delta/domain';
16
- import { GitStatusPlugin } from '../plugins/GitStatusPlugin.js';
17
- const CONFIG_DIR = join(homedir(), '.delta');
18
- const STATE_FILE = join(CONFIG_DIR, 'manager-state.json');
19
- const MENU_ITEMS = [
20
- { id: 'build', num: '1', label: 'Build All Apps', icon: '🔨' },
21
- { id: 'cli', num: '2', label: 'CLI Dev Server', icon: '🖥️' },
22
- { id: 'web', num: '3', label: 'Web Dev Server', icon: '🌐' },
23
- { id: 'docs', num: '4', label: 'Documentation', icon: '📖' },
24
- { id: 'test', num: '5', label: 'Run Tests', icon: '🧪' },
25
- { id: 'clean', num: '6', label: 'Clean Build', icon: '🧹' },
26
- { id: 'install', num: '7', label: 'Install Deps', icon: '📦' },
27
- { id: 'quit', num: '8', label: 'Quit', icon: '❌' },
28
- ];
29
- const SHORTCUTS = [
30
- { key: '?', desc: 'Show help' },
31
- { key: '/', desc: 'Search/Filter logs' },
32
- { key: 'f', desc: 'Toggle log filters' },
33
- { key: 'g', desc: 'Refresh Git Status (Plugin)' },
34
- { key: '↑↓', desc: 'Navigate menu' },
35
- { key: 'Enter', desc: 'Select/Execute' },
36
- { key: 'Esc / Q', desc: 'Quit/Back' },
37
- { key: '1-8', desc: 'Quick menu access' },
38
- ];
39
- const getSeverityFromType = (type) => {
40
- switch (type) {
41
- case 'error': return 'high';
42
- case 'warning': return 'medium';
43
- case 'success': return 'low';
44
- default: return 'low';
45
- }
46
- };
47
- const StatusBadge = ({ status, progress }) => {
48
- const config = {
49
- stopped: { color: 'gray', text: 'STOPPED', icon: '○' },
50
- running: { color: 'green', text: 'RUNNING', icon: '●' },
51
- error: { color: 'red', text: 'ERROR', icon: '✕' },
52
- building: { color: 'yellow', text: 'BUILDING', icon: '◐' },
53
- };
54
- const { color, text, icon } = config[status];
55
- return (_jsx(Text, { color: color, children: status === 'building' && progress !== undefined ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { type: "dots" }), " ", text, " ", progress, "%"] })) : (_jsxs(_Fragment, { children: [icon, " ", text] })) }));
56
- };
57
- const ProgressBar = ({ progress, width = 15 }) => {
58
- const filled = Math.floor((progress / 100) * width);
59
- const empty = width - filled;
60
- return (_jsxs(Text, { children: [_jsx(Text, { color: "green", children: '█'.repeat(filled) }), _jsx(Text, { color: "gray", children: '░'.repeat(empty) }), _jsxs(Text, { color: "cyan", children: [" ", progress, "%"] })] }));
61
- };
62
- const ServiceCard = ({ service }) => {
63
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: service.status === 'running' ? 'green' : service.status === 'error' ? 'red' : 'gray', paddingX: 2, paddingY: 1, width: 40, children: [_jsx(Text, { bold: true, color: "white", children: service.name }), _jsx(Box, { marginY: 1, children: _jsx(StatusBadge, { status: service.status, progress: service.progress }) }), service.port && service.status === 'running' && (_jsxs(Box, { children: [_jsx(Text, { color: "cyan", children: "Port: " }), _jsx(Text, { bold: true, color: "green", children: service.port })] })), service.status === 'building' && service.progress > 0 && (_jsx(Box, { marginY: 1, children: _jsx(ProgressBar, { progress: service.progress }) })), _jsx(Text, { dimColor: true, children: service.message })] }));
64
- };
65
- const LogEntry = ({ entry }) => {
66
- const colors = { info: 'white', success: 'green', error: 'red', warning: 'yellow' };
67
- const icons = { info: 'ℹ', success: '✓', error: '✗', warning: '⚠' };
68
- return (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: ["[", entry.timestamp, "] "] }), _jsxs(Text, { color: colors[entry.type], children: [icons[entry.type], " "] }), _jsxs(Text, { children: [entry.service, ": ", entry.message] })] }));
69
- };
70
- const MenuItem = ({ item, isSelected }) => {
71
- return (_jsxs(Box, { paddingX: 1, width: 28, children: [_jsxs(Text, { backgroundColor: isSelected ? 'blue' : undefined, color: isSelected ? 'white' : 'gray', children: [isSelected ? '❯ ' : ' ', isSelected ? '' : ' '] }), _jsx(Text, { backgroundColor: isSelected ? 'blue' : undefined, color: isSelected ? 'white' : 'cyan', bold: isSelected, children: item.num }), _jsx(Text, { backgroundColor: isSelected ? 'blue' : undefined, children: " " }), _jsx(Text, { backgroundColor: isSelected ? 'blue' : undefined, color: isSelected ? 'white' : 'gray', children: item.icon }), _jsx(Text, { backgroundColor: isSelected ? 'blue' : undefined, children: " " }), _jsx(Text, { backgroundColor: isSelected ? 'blue' : undefined, color: isSelected ? 'white' : 'gray', bold: isSelected, children: item.label }), _jsx(Text, { backgroundColor: isSelected ? 'blue' : undefined, children: ' '.repeat(28 - item.label.length - 4) })] }));
72
- };
73
- const HelpModal = ({ onClose }) => {
74
- useInput((_, key) => {
75
- if (key.escape || key.return)
76
- onClose();
77
- });
78
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, width: 50, children: [_jsx(Text, { bold: true, color: "cyan", children: "\u2328\uFE0F Keyboard Shortcuts" }), _jsx(Box, { marginY: 1 }), SHORTCUTS.map((s, i) => (_jsxs(Box, { children: [_jsx(Text, { color: "yellow", bold: true, children: s.key.padEnd(10) }), _jsx(Text, { color: "white", children: s.desc })] }, i))), _jsx(Box, { marginY: 1 }), _jsx(Text, { dimColor: true, children: "Press Enter or Esc to close" })] }));
79
- };
80
- const FilterBar = ({ severity, source, isActive }) => {
81
- const severities = ['all', 'high', 'medium', 'low'];
82
- const sources = ['all', 'CLI', 'Web', 'Tests', 'Build', 'System'];
83
- return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsxs(Box, { children: [_jsx(Text, { color: isActive ? 'cyan' : 'gray', bold: isActive, children: "Filter: " }), _jsx(Text, { color: "gray", children: "Severity[" }), severities.map((s, i) => (_jsxs(Text, { color: severity === s ? 'green' : 'gray', bold: severity === s, children: [s, i < severities.length - 1 ? '|' : ''] }, s))), _jsx(Text, { color: "gray", children: "] Source[" }), sources.map((s, i) => (_jsxs(Text, { color: source === s ? 'green' : 'gray', bold: source === s, children: [s, i < sources.length - 1 ? '|' : ''] }, s))), _jsx(Text, { color: "gray", children: "]" })] }) }));
84
- };
85
- const loadUserState = () => {
86
- try {
87
- if (existsSync(STATE_FILE)) {
88
- return JSON.parse(readFileSync(STATE_FILE, 'utf-8'));
89
- }
90
- }
91
- catch { }
92
- return null;
93
- };
94
- const saveUserState = (state) => {
95
- try {
96
- if (!existsSync(CONFIG_DIR))
97
- mkdirSync(CONFIG_DIR, { recursive: true });
98
- writeFileSync(STATE_FILE, JSON.stringify(state, null, 2));
99
- }
100
- catch { }
101
- };
102
- export const UnifiedManager = () => {
103
- const { exit } = useApp();
104
- const [selectedIndex, setSelectedIndex] = useState(0);
105
- const [logs, setLogs] = useState([]);
106
- const [showHelp, setShowHelp] = useState(false);
107
- const [searchMode, setSearchMode] = useState(false);
108
- const [filterMode, setFilterMode] = useState(false);
109
- const [searchQuery, setSearchQuery] = useState('');
110
- const [severityFilter, setSeverityFilter] = useState('all');
111
- const [sourceFilter, setSourceFilter] = useState('all');
112
- const [services, setServices] = useState([
113
- { id: 'cli', name: 'CLI Dev Server', port: undefined, status: 'stopped', message: 'Ready to start', progress: 0 },
114
- { id: 'web', name: 'Web Dev Server', port: undefined, status: 'stopped', message: 'Ready to start', progress: 0 },
115
- ]);
116
- const serviceProcesses = React.useRef(new Map());
117
- const pluginRegistryRef = useRef(null);
118
- // Create plugin context
119
- const createPluginContext = useCallback(() => ({
120
- addLog: (service, message, type) => {
121
- const timestamp = new Date().toLocaleTimeString('en-US', { hour12: false });
122
- const severity = getSeverityFromType(type);
123
- setLogs(prev => [...prev.slice(-50), { timestamp, service, message, type, severity }]);
124
- },
125
- getServices: () => services.map(s => ({ id: s.id, status: s.status, port: s.port })),
126
- getLogFilters: () => ({ severity: severityFilter, source: sourceFilter }),
127
- registerShortcut: () => { },
128
- getSettings: () => ({}),
129
- saveSettings: () => { },
130
- }), [services, severityFilter, sourceFilter]);
131
- // Initialize plugin system
132
- useEffect(() => {
133
- const context = createPluginContext();
134
- const registry = new PluginRegistry(context);
135
- pluginRegistryRef.current = registry;
136
- registry.register(new GitStatusPlugin(context)).catch(() => { });
137
- }, [createPluginContext]);
138
- useEffect(() => {
139
- const saved = loadUserState();
140
- if (saved) {
141
- setSeverityFilter(saved.logFilters.severity);
142
- setSourceFilter(saved.logFilters.source);
143
- setSearchQuery(saved.lastSearchQuery);
144
- }
145
- }, []);
146
- useEffect(() => {
147
- saveUserState({
148
- selectedView: 'dashboard',
149
- logFilters: { severity: severityFilter, source: sourceFilter },
150
- lastSearchQuery: searchQuery,
151
- });
152
- }, [severityFilter, sourceFilter, searchQuery]);
153
- const addLog = useCallback((service, message, type = 'info') => {
154
- const timestamp = new Date().toLocaleTimeString('en-US', { hour12: false });
155
- const severity = getSeverityFromType(type);
156
- setLogs(prev => [...prev.slice(-50), { timestamp, service, message, type, severity }]);
157
- }, []);
158
- const filteredLogs = logs.filter(entry => {
159
- if (severityFilter !== 'all' && entry.severity !== severityFilter)
160
- return false;
161
- if (sourceFilter !== 'all' && entry.service !== sourceFilter)
162
- return false;
163
- if (searchQuery && !entry.message.toLowerCase().includes(searchQuery.toLowerCase()))
164
- return false;
165
- return true;
166
- });
167
- const startService = useCallback((serviceId) => {
168
- const service = services.find(s => s.id === serviceId);
169
- if (!service)
170
- return;
171
- setServices(prev => prev.map(s => s.id === serviceId ? { ...s, status: 'building', message: 'Starting...', progress: 0 } : s));
172
- addLog(serviceId, 'Starting service...', 'info');
173
- let progress = 0;
174
- const progressInterval = setInterval(() => {
175
- progress += 10;
176
- setServices(prev => prev.map(s => s.id === serviceId ? { ...s, progress } : s));
177
- if (progress >= 100)
178
- clearInterval(progressInterval);
179
- }, 150);
180
- const proc = spawn('pnpm', ['dev'], {
181
- cwd: join(process.cwd(), serviceId === 'cli' ? 'apps/cli' : 'apps/web'),
182
- shell: true,
183
- stdio: ['ignore', 'pipe', 'pipe'],
184
- });
185
- serviceProcesses.current.set(serviceId, proc);
186
- proc.stdout?.on('data', (data) => {
187
- const output = data.toString().trim();
188
- const portMatch = output.match(/localhost:(\d+)/) || output.match(/:(\d+)/);
189
- if (portMatch) {
190
- const port = parseInt(portMatch[1]);
191
- setServices(prev => prev.map(s => s.id === serviceId ? { ...s, status: 'running', port, message: 'Watching files...', progress: 100 } : s));
192
- addLog(serviceId, `Server running on port ${port}`, 'success');
193
- }
194
- });
195
- proc.stderr?.on('data', (data) => addLog(serviceId, data.toString().trim(), 'error'));
196
- proc.on('exit', (code) => {
197
- clearInterval(progressInterval);
198
- setServices(prev => prev.map(s => s.id === serviceId ? { ...s, status: code === 0 ? 'stopped' : 'error', progress: 0, message: 'Stopped' } : s));
199
- serviceProcesses.current.delete(serviceId);
200
- addLog(serviceId, code === 0 ? 'Service stopped' : 'Service crashed', code === 0 ? 'info' : 'error');
201
- });
202
- }, [services, addLog]);
203
- const stopService = useCallback((serviceId) => {
204
- const proc = serviceProcesses.current.get(serviceId);
205
- if (proc) {
206
- proc.kill('SIGTERM');
207
- serviceProcesses.current.delete(serviceId);
208
- }
209
- setServices(prev => prev.map(s => s.id === serviceId ? { ...s, status: 'stopped', port: undefined, message: 'Stopped', progress: 0 } : s));
210
- addLog(serviceId, 'Service stopped', 'info');
211
- }, [addLog]);
212
- const buildAll = useCallback(() => {
213
- addLog('BUILD', 'Starting build process...', 'info');
214
- ['CLI', 'Web'].forEach((step, i) => {
215
- setTimeout(() => {
216
- addLog('BUILD', `${step} Build: SUCCESS`, 'success');
217
- if (i === 1)
218
- addLog('BUILD', 'All builds completed successfully!', 'success');
219
- }, (i + 1) * 1500);
220
- });
221
- }, [addLog]);
222
- useInput((input, key) => {
223
- if (showHelp)
224
- return;
225
- if (searchMode) {
226
- if (key.escape) {
227
- setSearchMode(false);
228
- setSearchQuery('');
229
- return;
230
- }
231
- if (key.return) {
232
- setSearchMode(false);
233
- return;
234
- }
235
- if (key.backspace || key.delete) {
236
- setSearchQuery(q => q.slice(0, -1));
237
- return;
238
- }
239
- if (input && !key.ctrl && !key.meta) {
240
- setSearchQuery(q => q + input);
241
- return;
242
- }
243
- return;
244
- }
245
- if (filterMode) {
246
- if (key.escape) {
247
- setFilterMode(false);
248
- return;
249
- }
250
- if (input === 's') {
251
- const severities = ['all', 'high', 'medium', 'low'];
252
- setSeverityFilter(prev => severities[(severities.indexOf(prev) + 1) % severities.length]);
253
- return;
254
- }
255
- if (input === 'r') {
256
- const sources = ['all', 'CLI', 'Web', 'Tests', 'Build', 'System'];
257
- setSourceFilter(prev => sources[(sources.indexOf(prev) + 1) % sources.length]);
258
- return;
259
- }
260
- if (key.return) {
261
- setFilterMode(false);
262
- return;
263
- }
264
- return;
265
- }
266
- if (input === '?') {
267
- setShowHelp(true);
268
- return;
269
- }
270
- if (input === '/') {
271
- setSearchMode(true);
272
- return;
273
- }
274
- if (input === 'g') {
275
- // GitStatusPlugin shortcut
276
- const registry = pluginRegistryRef.current;
277
- if (registry) {
278
- registry.executeCommand('git-status', 'refresh').catch(() => { });
279
- }
280
- return;
281
- }
282
- if (input === 'q' || key.escape) {
283
- serviceProcesses.current.forEach(proc => proc.kill('SIGTERM'));
284
- exit();
285
- }
286
- if (input >= '1' && input <= '8') {
287
- const index = parseInt(input) - 1;
288
- if (index < MENU_ITEMS.length)
289
- setSelectedIndex(index);
290
- return;
291
- }
292
- if (key.upArrow)
293
- setSelectedIndex(i => Math.max(0, i - 1));
294
- if (key.downArrow)
295
- setSelectedIndex(i => Math.min(MENU_ITEMS.length - 1, i + 1));
296
- if (key.return) {
297
- const item = MENU_ITEMS[selectedIndex];
298
- switch (item.id) {
299
- case 'build':
300
- buildAll();
301
- break;
302
- case 'cli':
303
- const cliService = services.find(s => s.id === 'cli');
304
- cliService?.status === 'running' ? stopService('cli') : startService('cli');
305
- break;
306
- case 'web':
307
- const webService = services.find(s => s.id === 'web');
308
- webService?.status === 'running' ? stopService('web') : startService('web');
309
- break;
310
- case 'quit':
311
- serviceProcesses.current.forEach(proc => proc.kill('SIGTERM'));
312
- exit();
313
- break;
314
- }
315
- }
316
- });
317
- useEffect(() => { addLog('SYSTEM', 'Delta Unified Manager started', 'info'); }, []);
318
- if (showHelp) {
319
- return (_jsx(Box, { flexDirection: "column", height: 28, justifyContent: "center", alignItems: "center", children: _jsx(HelpModal, { onClose: () => setShowHelp(false) }) }));
320
- }
321
- return (_jsxs(Box, { flexDirection: "column", height: 28, children: [_jsxs(Box, { justifyContent: "space-between", paddingX: 1, paddingY: 0, children: [_jsx(Text, { backgroundColor: "blue", bold: true, color: "white", children: " \uD83D\uDE80 Delta Project Manager " }), _jsx(Text, { backgroundColor: "blue", color: "white", children: " v2.0 " })] }), _jsxs(Box, { flexGrow: 1, children: [_jsx(Box, { flexDirection: "column", width: 30, borderStyle: "single", borderColor: "gray", paddingY: 1, children: MENU_ITEMS.map((item, index) => (_jsx(MenuItem, { item: item, isSelected: index === selectedIndex }, item.id))) }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, paddingX: 1, paddingY: 1, children: [_jsxs(Box, { flexDirection: "row", gap: 2, marginBottom: 1, children: [_jsx(ServiceCard, { service: services[0] }), _jsx(ServiceCard, { service: services[1] })] }), _jsxs(Box, { flexGrow: 1, flexDirection: "column", borderStyle: "round", borderColor: filterMode || searchMode ? 'cyan' : 'gray', paddingX: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\uD83D\uDCCB Build & Test Logs" }), searchMode && _jsxs(Text, { color: "yellow", children: [" [Search: ", searchQuery, "_]"] }), filterMode && _jsx(Text, { color: "yellow", children: " [Filter Mode - s:severity r:source Enter:done]" })] }), _jsx(FilterBar, { severity: severityFilter, source: sourceFilter, isActive: filterMode }), _jsx(Box, { flexDirection: "column", overflow: "hidden", children: filteredLogs.length === 0 ? (_jsx(Text, { dimColor: true, children: logs.length === 0 ? 'No activity yet...' : 'No logs match current filters' })) : (filteredLogs.slice(-15).map((entry, i) => _jsx(LogEntry, { entry: entry }, i))) })] })] })] }), _jsxs(Box, { justifyContent: "space-between", paddingX: 1, paddingY: 0, children: [_jsxs(Box, { children: [_jsx(Text, { backgroundColor: "gray", color: "white", children: "[" }), _jsx(Text, { backgroundColor: "gray", color: "cyan", children: "\u2191\u2193" }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "] Navigate " }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "[" }), _jsx(Text, { backgroundColor: "gray", color: "cyan", children: "Enter" }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "] Select " }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "[" }), _jsx(Text, { backgroundColor: "gray", color: "cyan", children: "?" }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "] Help " }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "[" }), _jsx(Text, { backgroundColor: "gray", color: "cyan", children: "Q" }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "] Quit" })] }), _jsxs(Box, { children: [_jsx(Text, { backgroundColor: "gray", color: "white", children: " CLI: " }), _jsx(Text, { backgroundColor: "gray", color: services[0].status === 'running' ? 'green' : 'gray', children: services[0].port ? `localhost:${services[0].port} ✓` : '○' }), _jsx(Text, { backgroundColor: "gray", color: "white", children: " | Web: " }), _jsx(Text, { backgroundColor: "gray", color: services[1].status === 'running' ? 'green' : 'gray', children: services[1].port ? `localhost:${services[1].port} ✓` : '○' }), _jsxs(Text, { backgroundColor: "gray", color: "white", children: [" | ", platform()] })] })] })] }));
322
- };
323
- export default UnifiedManager;
324
- //# sourceMappingURL=UnifiedManager.js.map