@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,372 +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, dirname } 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':
42
- return 'high';
43
- case 'warning':
44
- return 'medium';
45
- case 'success':
46
- return 'low';
47
- default:
48
- return 'low';
49
- }
50
- };
51
- const StatusBadge = ({ status, progress, }) => {
52
- const config = {
53
- stopped: { color: 'gray', text: 'STOPPED', icon: '○' },
54
- running: { color: 'green', text: 'RUNNING', icon: '●' },
55
- error: { color: 'red', text: 'ERROR', icon: '✕' },
56
- building: { color: 'yellow', text: 'BUILDING', icon: '◐' },
57
- };
58
- const { color, text, icon } = config[status];
59
- return (_jsx(Text, { color: color, children: status === 'building' && progress !== undefined ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { type: "dots" }), " ", text, " ", progress, "%"] })) : (_jsxs(_Fragment, { children: [icon, " ", text] })) }));
60
- };
61
- const ProgressBar = ({ progress, width = 15 }) => {
62
- const filled = Math.floor((progress / 100) * width);
63
- const empty = width - filled;
64
- return (_jsxs(Text, { children: [_jsx(Text, { color: "green", children: '█'.repeat(filled) }), _jsx(Text, { color: "gray", children: '░'.repeat(empty) }), _jsxs(Text, { color: "cyan", children: [" ", progress, "%"] })] }));
65
- };
66
- const ServiceCard = ({ service }) => {
67
- 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 })] }));
68
- };
69
- const LogEntry = ({ entry }) => {
70
- const colors = { info: 'white', success: 'green', error: 'red', warning: 'yellow' };
71
- const icons = { info: 'ℹ', success: '✓', error: '✗', warning: '⚠' };
72
- 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] })] }));
73
- };
74
- const MenuItem = ({ item, isSelected, }) => {
75
- return (_jsxs(Box, { paddingX: 1, width: 28, children: [_jsxs(Text, { color: isSelected ? 'cyan' : 'gray', bold: isSelected, children: [isSelected ? '❯ ' : ' ', isSelected ? '' : ' '] }), _jsx(Text, { color: isSelected ? 'cyan' : 'cyan', bold: isSelected, children: item.num }), _jsx(Text, { children: " " }), _jsx(Text, { color: isSelected ? 'white' : 'gray', children: item.icon }), _jsx(Text, { children: " " }), _jsx(Text, { color: isSelected ? 'white' : 'gray', bold: isSelected, children: item.label }), _jsx(Text, { children: ' '.repeat(28 - item.label.length - 4) })] }));
76
- };
77
- const HelpModal = ({ onClose }) => {
78
- useInput((_, key) => {
79
- if (key.escape || key.return)
80
- onClose();
81
- });
82
- 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" })] }));
83
- };
84
- const FilterBar = ({ severity, source, isActive }) => {
85
- const severities = ['all', 'high', 'medium', 'low'];
86
- const sources = ['all', 'CLI', 'Web', 'Tests', 'Build', 'System'];
87
- return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsxs(Box, { children: [_jsxs(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: "]" })] }) }));
88
- };
89
- const loadUserState = () => {
90
- try {
91
- if (existsSync(STATE_FILE)) {
92
- return JSON.parse(readFileSync(STATE_FILE, 'utf-8'));
93
- }
94
- }
95
- catch (err) {
96
- void err;
97
- }
98
- return null;
99
- };
100
- const saveUserState = (state) => {
101
- try {
102
- if (!existsSync(CONFIG_DIR))
103
- mkdirSync(CONFIG_DIR, { recursive: true });
104
- writeFileSync(STATE_FILE, JSON.stringify(state, null, 2));
105
- }
106
- catch (err) {
107
- void err;
108
- }
109
- };
110
- export const UnifiedManager = () => {
111
- const { exit } = useApp();
112
- const [selectedIndex, setSelectedIndex] = useState(0);
113
- const [logs, setLogs] = useState([]);
114
- const [showHelp, setShowHelp] = useState(false);
115
- const [searchMode, setSearchMode] = useState(false);
116
- const [filterMode, setFilterMode] = useState(false);
117
- const [searchQuery, setSearchQuery] = useState('');
118
- const [severityFilter, setSeverityFilter] = useState('all');
119
- const [sourceFilter, setSourceFilter] = useState('all');
120
- const [services, setServices] = useState([
121
- {
122
- id: 'cli',
123
- name: 'CLI Dev Server',
124
- port: undefined,
125
- status: 'stopped',
126
- message: 'Ready to start',
127
- progress: 0,
128
- },
129
- {
130
- id: 'web',
131
- name: 'Web Dev Server',
132
- port: undefined,
133
- status: 'stopped',
134
- message: 'Ready to start',
135
- progress: 0,
136
- },
137
- ]);
138
- const serviceProcesses = React.useRef(new Map());
139
- const pluginRegistryRef = useRef(null);
140
- // Create plugin context
141
- const createPluginContext = useCallback(() => ({
142
- addLog: (service, message, type) => {
143
- const timestamp = new Date().toLocaleTimeString('en-US', { hour12: false });
144
- const severity = getSeverityFromType(type);
145
- setLogs(prev => [...prev.slice(-50), { timestamp, service, message, type, severity }]);
146
- },
147
- getServices: () => services.map(s => ({ id: s.id, status: s.status, port: s.port })),
148
- getLogFilters: () => ({ severity: severityFilter, source: sourceFilter }),
149
- registerShortcut: () => { },
150
- getSettings: () => ({}),
151
- saveSettings: () => { },
152
- }), [services, severityFilter, sourceFilter]);
153
- // Initialize plugin system
154
- useEffect(() => {
155
- const context = createPluginContext();
156
- const registry = new PluginRegistry(context);
157
- pluginRegistryRef.current = registry;
158
- registry.register(new GitStatusPlugin(context)).catch(() => { });
159
- }, [createPluginContext]);
160
- useEffect(() => {
161
- const saved = loadUserState();
162
- if (saved) {
163
- setSeverityFilter(saved.logFilters.severity);
164
- setSourceFilter(saved.logFilters.source);
165
- setSearchQuery(saved.lastSearchQuery);
166
- }
167
- }, []);
168
- useEffect(() => {
169
- saveUserState({
170
- selectedView: 'dashboard',
171
- logFilters: { severity: severityFilter, source: sourceFilter },
172
- lastSearchQuery: searchQuery,
173
- });
174
- }, [severityFilter, sourceFilter, searchQuery]);
175
- const addLog = useCallback((service, message, type = 'info') => {
176
- const timestamp = new Date().toLocaleTimeString('en-US', { hour12: false });
177
- const severity = getSeverityFromType(type);
178
- setLogs(prev => [...prev.slice(-50), { timestamp, service, message, type, severity }]);
179
- }, []);
180
- const filteredLogs = logs.filter(entry => {
181
- if (severityFilter !== 'all' && entry.severity !== severityFilter)
182
- return false;
183
- if (sourceFilter !== 'all' && entry.service !== sourceFilter)
184
- return false;
185
- if (searchQuery && !entry.message.toLowerCase().includes(searchQuery.toLowerCase()))
186
- return false;
187
- return true;
188
- });
189
- const startService = useCallback((serviceId) => {
190
- const service = services.find(s => s.id === serviceId);
191
- if (!service)
192
- return;
193
- setServices(prev => prev.map(s => s.id === serviceId
194
- ? { ...s, status: 'building', message: 'Starting...', progress: 0 }
195
- : s));
196
- addLog(serviceId, 'Starting service...', 'info');
197
- let progress = 0;
198
- const progressInterval = setInterval(() => {
199
- progress += 10;
200
- setServices(prev => prev.map(s => (s.id === serviceId ? { ...s, progress } : s)));
201
- if (progress >= 100)
202
- clearInterval(progressInterval);
203
- }, 150);
204
- // Find monorepo root by looking for pnpm-workspace.yaml
205
- const findRoot = (startPath) => {
206
- let current = startPath;
207
- while (current !== dirname(current)) {
208
- if (existsSync(join(current, 'pnpm-workspace.yaml'))) {
209
- return current;
210
- }
211
- current = dirname(current);
212
- }
213
- return process.cwd();
214
- };
215
- const rootDir = findRoot(process.cwd());
216
- const isWindows = platform() === 'win32';
217
- const proc = spawn(isWindows ? 'pnpm.cmd' : 'pnpm', ['dev'], {
218
- cwd: join(rootDir, serviceId === 'cli' ? 'apps/cli' : 'apps/web'),
219
- stdio: ['ignore', 'pipe', 'pipe'],
220
- });
221
- serviceProcesses.current.set(serviceId, proc);
222
- proc.stdout?.on('data', data => {
223
- const output = data.toString().trim();
224
- const portMatch = output.match(/localhost:(\d+)/) || output.match(/:(\d+)/);
225
- if (portMatch) {
226
- const port = parseInt(portMatch[1]);
227
- setServices(prev => prev.map(s => s.id === serviceId
228
- ? { ...s, status: 'running', port, message: 'Watching files...', progress: 100 }
229
- : s));
230
- addLog(serviceId, `Server running on port ${port}`, 'success');
231
- }
232
- });
233
- proc.stderr?.on('data', data => addLog(serviceId, data.toString().trim(), 'error'));
234
- proc.on('exit', code => {
235
- clearInterval(progressInterval);
236
- setServices(prev => prev.map(s => s.id === serviceId
237
- ? { ...s, status: code === 0 ? 'stopped' : 'error', progress: 0, message: 'Stopped' }
238
- : s));
239
- serviceProcesses.current.delete(serviceId);
240
- addLog(serviceId, code === 0 ? 'Service stopped' : 'Service crashed', code === 0 ? 'info' : 'error');
241
- });
242
- }, [services, addLog]);
243
- const stopService = useCallback((serviceId) => {
244
- const proc = serviceProcesses.current.get(serviceId);
245
- if (proc) {
246
- proc.kill('SIGTERM');
247
- serviceProcesses.current.delete(serviceId);
248
- }
249
- setServices(prev => prev.map(s => s.id === serviceId
250
- ? { ...s, status: 'stopped', port: undefined, message: 'Stopped', progress: 0 }
251
- : s));
252
- addLog(serviceId, 'Service stopped', 'info');
253
- }, [addLog]);
254
- const buildAll = useCallback(() => {
255
- addLog('BUILD', 'Starting build process...', 'info');
256
- ['CLI', 'Web'].forEach((step, i) => {
257
- setTimeout(() => {
258
- addLog('BUILD', `${step} Build: SUCCESS`, 'success');
259
- if (i === 1)
260
- addLog('BUILD', 'All builds completed successfully!', 'success');
261
- }, (i + 1) * 1500);
262
- });
263
- }, [addLog]);
264
- useInput((input, key) => {
265
- if (showHelp)
266
- return;
267
- if (searchMode) {
268
- if (key.escape) {
269
- setSearchMode(false);
270
- setSearchQuery('');
271
- return;
272
- }
273
- if (key.return) {
274
- setSearchMode(false);
275
- return;
276
- }
277
- if (key.backspace || key.delete) {
278
- setSearchQuery(q => q.slice(0, -1));
279
- return;
280
- }
281
- if (input && !key.ctrl && !key.meta) {
282
- setSearchQuery(q => q + input);
283
- return;
284
- }
285
- return;
286
- }
287
- if (filterMode) {
288
- if (key.escape) {
289
- setFilterMode(false);
290
- return;
291
- }
292
- if (input === 's') {
293
- const severities = ['all', 'high', 'medium', 'low'];
294
- setSeverityFilter(prev => severities[(severities.indexOf(prev) + 1) % severities.length]);
295
- return;
296
- }
297
- if (input === 'r') {
298
- const sources = ['all', 'CLI', 'Web', 'Tests', 'Build', 'System'];
299
- setSourceFilter(prev => sources[(sources.indexOf(prev) + 1) % sources.length]);
300
- return;
301
- }
302
- if (key.return) {
303
- setFilterMode(false);
304
- return;
305
- }
306
- return;
307
- }
308
- if (input === '?') {
309
- setShowHelp(true);
310
- return;
311
- }
312
- if (input === '/') {
313
- setSearchMode(true);
314
- return;
315
- }
316
- if (input === 'g') {
317
- // GitStatusPlugin shortcut
318
- const registry = pluginRegistryRef.current;
319
- if (registry) {
320
- registry.executeCommand('git-status', 'refresh').catch(() => { });
321
- }
322
- return;
323
- }
324
- if (input === 'q' || key.escape) {
325
- serviceProcesses.current.forEach(proc => proc.kill('SIGTERM'));
326
- exit();
327
- }
328
- if (input >= '1' && input <= '8') {
329
- const index = parseInt(input) - 1;
330
- if (index < MENU_ITEMS.length)
331
- setSelectedIndex(index);
332
- return;
333
- }
334
- if (key.upArrow)
335
- setSelectedIndex(i => Math.max(0, i - 1));
336
- if (key.downArrow)
337
- setSelectedIndex(i => Math.min(MENU_ITEMS.length - 1, i + 1));
338
- if (key.return) {
339
- const item = MENU_ITEMS[selectedIndex];
340
- switch (item.id) {
341
- case 'build':
342
- buildAll();
343
- break;
344
- case 'cli':
345
- {
346
- const cliService = services.find(s => s.id === 'cli');
347
- cliService?.status === 'running' ? stopService('cli') : startService('cli');
348
- }
349
- break;
350
- case 'web':
351
- {
352
- const webService = services.find(s => s.id === 'web');
353
- webService?.status === 'running' ? stopService('web') : startService('web');
354
- }
355
- break;
356
- case 'quit':
357
- serviceProcesses.current.forEach(proc => proc.kill('SIGTERM'));
358
- exit();
359
- break;
360
- }
361
- }
362
- });
363
- useEffect(() => {
364
- addLog('SYSTEM', 'Delta Unified Manager started', 'info');
365
- }, []);
366
- if (showHelp) {
367
- return (_jsx(Box, { flexDirection: "column", height: 28, justifyContent: "center", alignItems: "center", children: _jsx(HelpModal, { onClose: () => setShowHelp(false) }) }));
368
- }
369
- return (_jsxs(Box, { flexDirection: "column", height: 28, children: [_jsxs(Box, { justifyContent: "space-between", paddingX: 1, paddingY: 0, children: [_jsxs(Text, { backgroundColor: "blue", bold: true, color: "white", children: [' ', "\uD83D\uDE80 Delta Project Manager", ' '] }), _jsxs(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" }), _jsxs(Text, { backgroundColor: "gray", color: "white", children: ["] Navigate", ' '] }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "[" }), _jsx(Text, { backgroundColor: "gray", color: "cyan", children: "Enter" }), _jsxs(Text, { backgroundColor: "gray", color: "white", children: ["] Select", ' '] }), _jsx(Text, { backgroundColor: "gray", color: "white", children: "[" }), _jsx(Text, { backgroundColor: "gray", color: "cyan", children: "?" }), _jsxs(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: [_jsxs(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} ✓` : '○' }), _jsxs(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()] })] })] })] }));
370
- };
371
- export default UnifiedManager;
372
- //# sourceMappingURL=UnifiedManager.js.map
@@ -1,184 +0,0 @@
1
- /**
2
- * Audit Logger for Delta CLI
3
- * Tracks all commands, results, and performance metrics
4
- * Enterprise-grade logging for compliance and debugging
5
- */
6
- import { promises as fs } from 'fs';
7
- import { homedir } from 'os';
8
- import { join } from 'path';
9
- const DEFAULT_CONFIG = {
10
- enabled: true,
11
- logLevel: 'standard',
12
- retentionDays: 30,
13
- maxEntries: 10000,
14
- includeMetadata: true,
15
- };
16
- const AUDIT_DIR = join(homedir(), '.delta', 'audit');
17
- const AUDIT_FILE = join(AUDIT_DIR, 'commands.jsonl');
18
- const CONFIG_FILE = join(AUDIT_DIR, 'config.json');
19
- export class AuditLogger {
20
- config;
21
- initialized = false;
22
- constructor() {
23
- this.config = DEFAULT_CONFIG;
24
- }
25
- async initialize() {
26
- if (this.initialized)
27
- return;
28
- try {
29
- await fs.mkdir(AUDIT_DIR, { recursive: true });
30
- // Load config if exists
31
- try {
32
- const configData = await fs.readFile(CONFIG_FILE, 'utf-8');
33
- this.config = { ...DEFAULT_CONFIG, ...JSON.parse(configData) };
34
- }
35
- catch {
36
- // Use defaults
37
- }
38
- this.initialized = true;
39
- }
40
- catch (error) {
41
- console.error('Failed to initialize audit logger:', error);
42
- }
43
- }
44
- async logCommand(command, args, options, response, startTime) {
45
- if (!this.config.enabled)
46
- return;
47
- await this.initialize();
48
- const entry = {
49
- id: this.generateId(),
50
- timestamp: new Date().toISOString(),
51
- command,
52
- args,
53
- options: this.sanitizeOptions(options),
54
- exitCode: response.exitCode || (response.success ? 0 : 1),
55
- success: response.success,
56
- duration: Date.now() - startTime,
57
- provider: response.meta?.provider || 'unknown',
58
- error: response.error,
59
- };
60
- if (this.config.includeMetadata) {
61
- entry.metadata = {
62
- nodeVersion: process.version,
63
- platform: process.platform,
64
- cwd: process.cwd(),
65
- ci: process.env.CI === 'true',
66
- };
67
- }
68
- // Write to log file
69
- await this.appendEntry(entry);
70
- // Send to remote if configured
71
- if (this.config.remoteEndpoint) {
72
- await this.sendRemote(entry).catch(() => { });
73
- }
74
- }
75
- async getRecentEntries(limit = 50) {
76
- await this.initialize();
77
- try {
78
- const data = await fs.readFile(AUDIT_FILE, 'utf-8');
79
- const lines = data.trim().split('\n').filter(Boolean);
80
- return lines
81
- .slice(-limit)
82
- .map(line => JSON.parse(line))
83
- .reverse();
84
- }
85
- catch {
86
- return [];
87
- }
88
- }
89
- async getStats() {
90
- const entries = await this.getRecentEntries(1000);
91
- if (entries.length === 0) {
92
- return {
93
- totalCommands: 0,
94
- successRate: 0,
95
- avgDuration: 0,
96
- mostUsed: [],
97
- lastUsed: 'Never',
98
- };
99
- }
100
- const commands = entries.map(e => e.command);
101
- const successCount = entries.filter(e => e.success).length;
102
- const totalDuration = entries.reduce((sum, e) => sum + e.duration, 0);
103
- // Count command frequency
104
- const frequency = {};
105
- commands.forEach(cmd => {
106
- frequency[cmd] = (frequency[cmd] || 0) + 1;
107
- });
108
- const mostUsed = Object.entries(frequency)
109
- .sort((a, b) => b[1] - a[1])
110
- .slice(0, 5)
111
- .map(([cmd]) => cmd);
112
- return {
113
- totalCommands: entries.length,
114
- successRate: Math.round((successCount / entries.length) * 100),
115
- avgDuration: Math.round(totalDuration / entries.length),
116
- mostUsed,
117
- lastUsed: entries[0]?.timestamp || 'Never',
118
- };
119
- }
120
- async appendEntry(entry) {
121
- const line = JSON.stringify(entry) + '\n';
122
- await fs.appendFile(AUDIT_FILE, line, 'utf-8');
123
- }
124
- async sendRemote(entry) {
125
- if (!this.config.remoteEndpoint)
126
- return;
127
- try {
128
- await fetch(this.config.remoteEndpoint, {
129
- method: 'POST',
130
- headers: { 'Content-Type': 'application/json' },
131
- body: JSON.stringify(entry),
132
- });
133
- }
134
- catch {
135
- // Silently fail - don't block CLI execution
136
- }
137
- }
138
- sanitizeOptions(options) {
139
- const sensitiveKeys = ['token', 'password', 'secret', 'key', 'auth'];
140
- const sanitized = {};
141
- for (const [key, value] of Object.entries(options)) {
142
- if (sensitiveKeys.some(sk => key.toLowerCase().includes(sk))) {
143
- sanitized[key] = '[REDACTED]';
144
- }
145
- else {
146
- sanitized[key] = value;
147
- }
148
- }
149
- return sanitized;
150
- }
151
- generateId() {
152
- return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
153
- }
154
- // Cleanup old entries
155
- async cleanup() {
156
- if (!this.config.enabled)
157
- return;
158
- try {
159
- const entries = await this.getRecentEntries(this.config.maxEntries);
160
- const cutoff = new Date();
161
- cutoff.setDate(cutoff.getDate() - this.config.retentionDays);
162
- const validEntries = entries.filter(e => new Date(e.timestamp) > cutoff);
163
- // Rewrite file with only valid entries
164
- const data = validEntries.map(e => JSON.stringify(e)).join('\n') + '\n';
165
- await fs.writeFile(AUDIT_FILE, data, 'utf-8');
166
- }
167
- catch {
168
- // Ignore cleanup errors
169
- }
170
- }
171
- }
172
- // Singleton instance
173
- let auditLogger = null;
174
- export function getAuditLogger() {
175
- if (!auditLogger) {
176
- auditLogger = new AuditLogger();
177
- }
178
- return auditLogger;
179
- }
180
- // Export for testing
181
- export function resetAuditLogger() {
182
- auditLogger = null;
183
- }
184
- //# sourceMappingURL=audit.js.map