@vee-stack/delta-cli 2.0.8 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/analysis.adapter.d.ts +29 -0
- package/dist/analyzer/commands/analyze.d.ts +14 -0
- package/dist/analyzer/commands/config.d.ts +12 -0
- package/dist/analyzer/commands/report.d.ts +11 -0
- package/dist/analyzer/generators/report.generator.d.ts +43 -0
- package/dist/analyzer/index.d.ts +8 -0
- package/dist/analyzer/scanners/project.scanner.d.ts +29 -0
- package/dist/analyzer/validators/contracts.validator.d.ts +27 -0
- package/dist/analyzer/validators/maintainability.validator.d.ts +27 -0
- package/dist/analyzer/validators/observability.validator.d.ts +27 -0
- package/dist/analyzer/validators/performance.validator.d.ts +27 -0
- package/dist/analyzer/validators/security.validator.d.ts +27 -0
- package/dist/analyzer/validators/soc.validator.d.ts +27 -0
- package/dist/auth/device-auth.d.ts +18 -0
- package/dist/auth/secure-auth.d.ts +35 -0
- package/dist/bundle.mjs +422 -0
- package/dist/commands/analyze.d.ts +12 -0
- package/dist/commands/auth-new.d.ts +6 -0
- package/dist/commands/auth.d.ts +17 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/deploy.d.ts +5 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/plugins.d.ts +7 -0
- package/dist/commands/status.d.ts +5 -0
- package/dist/commands/sync.d.ts +5 -0
- package/dist/commands/whoami.d.ts +4 -0
- package/dist/components/Dashboard.d.ts +8 -0
- package/dist/components/DeltaApp.d.ts +13 -0
- package/dist/components/UnifiedManager.d.ts +10 -0
- package/dist/core/audit.d.ts +60 -0
- package/dist/core/completion.d.ts +79 -0
- package/dist/core/contracts.d.ts +127 -0
- package/dist/core/engine.d.ts +26 -0
- package/dist/core/exit-codes.d.ts +19 -0
- package/dist/core/hooks.d.ts +50 -0
- package/dist/{apps/cli/src/core/index.js → core/index.d.ts} +1 -1
- package/dist/core/policy.d.ts +24 -0
- package/dist/core/profiles.d.ts +45 -0
- package/dist/core/wizard.d.ts +28 -0
- package/dist/interactive/index.d.ts +5 -0
- package/dist/plugins/GitStatusPlugin.d.ts +25 -0
- package/dist/providers/ai-provider.d.ts +21 -0
- package/dist/providers/local-provider.d.ts +21 -0
- package/dist/providers/remote-provider.d.ts +15 -0
- package/dist/telemetry/wrapper.d.ts +18 -0
- package/dist/types/api.d.ts +46 -0
- package/dist/ui.d.ts +52 -0
- package/dist/welcome.d.ts +8 -0
- package/package.json +8 -8
- package/dist/analyzer/commands/analyze.js +0 -260
- package/dist/analyzer/commands/config.js +0 -83
- package/dist/analyzer/commands/report.js +0 -38
- package/dist/analyzer/generators/report.generator.js +0 -123
- package/dist/analyzer/index.js +0 -44
- package/dist/analyzer/scanners/project.scanner.js +0 -92
- package/dist/analyzer/validators/contracts.validator.js +0 -42
- package/dist/analyzer/validators/maintainability.validator.js +0 -40
- package/dist/analyzer/validators/observability.validator.js +0 -39
- package/dist/analyzer/validators/performance.validator.js +0 -42
- package/dist/analyzer/validators/security.validator.js +0 -66
- package/dist/analyzer/validators/soc.validator.js +0 -75
- package/dist/apps/cli/src/analyzer/commands/analyze.js +0 -256
- package/dist/apps/cli/src/analyzer/commands/config.js +0 -83
- package/dist/apps/cli/src/analyzer/commands/report.js +0 -38
- package/dist/apps/cli/src/analyzer/generators/report.generator.js +0 -123
- package/dist/apps/cli/src/analyzer/index.js +0 -44
- package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +0 -92
- package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +0 -42
- package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +0 -40
- package/dist/apps/cli/src/analyzer/validators/observability.validator.js +0 -39
- package/dist/apps/cli/src/analyzer/validators/performance.validator.js +0 -42
- package/dist/apps/cli/src/analyzer/validators/security.validator.js +0 -66
- package/dist/apps/cli/src/analyzer/validators/soc.validator.js +0 -75
- package/dist/apps/cli/src/auth/secure-auth.js +0 -312
- package/dist/apps/cli/src/commands/analyze.js +0 -286
- package/dist/apps/cli/src/commands/auth-new.js +0 -37
- package/dist/apps/cli/src/commands/auth.js +0 -122
- package/dist/apps/cli/src/commands/config.js +0 -49
- package/dist/apps/cli/src/commands/deploy.js +0 -6
- package/dist/apps/cli/src/commands/init.js +0 -47
- package/dist/apps/cli/src/commands/logout.js +0 -23
- package/dist/apps/cli/src/commands/plugins.js +0 -21
- package/dist/apps/cli/src/commands/status.js +0 -80
- package/dist/apps/cli/src/commands/sync.js +0 -6
- package/dist/apps/cli/src/commands/whoami.js +0 -115
- package/dist/apps/cli/src/components/Dashboard.js +0 -168
- package/dist/apps/cli/src/components/DeltaApp.js +0 -56
- package/dist/apps/cli/src/components/UnifiedManager.js +0 -324
- package/dist/apps/cli/src/core/audit.js +0 -184
- package/dist/apps/cli/src/core/completion.js +0 -294
- package/dist/apps/cli/src/core/contracts.js +0 -6
- package/dist/apps/cli/src/core/engine.js +0 -124
- package/dist/apps/cli/src/core/exit-codes.js +0 -71
- package/dist/apps/cli/src/core/hooks.js +0 -181
- package/dist/apps/cli/src/core/policy.js +0 -115
- package/dist/apps/cli/src/core/profiles.js +0 -161
- package/dist/apps/cli/src/core/wizard.js +0 -203
- package/dist/apps/cli/src/index.js +0 -636
- package/dist/apps/cli/src/interactive/index.js +0 -11
- package/dist/apps/cli/src/plugins/GitStatusPlugin.js +0 -99
- package/dist/apps/cli/src/providers/ai-provider.js +0 -74
- package/dist/apps/cli/src/providers/local-provider.js +0 -302
- package/dist/apps/cli/src/providers/remote-provider.js +0 -100
- package/dist/apps/cli/src/types/api.js +0 -3
- package/dist/apps/cli/src/ui.js +0 -219
- package/dist/apps/cli/src/welcome.js +0 -81
- package/dist/auth/secure-auth.js +0 -372
- package/dist/bundle.js +0 -504
- package/dist/commands/analyze.js +0 -390
- package/dist/commands/auth-new.js +0 -37
- package/dist/commands/auth.js +0 -134
- package/dist/commands/config.js +0 -51
- package/dist/commands/deploy.js +0 -6
- package/dist/commands/init.js +0 -47
- package/dist/commands/logout.js +0 -31
- package/dist/commands/plugins.js +0 -21
- package/dist/commands/status.js +0 -82
- package/dist/commands/sync.js +0 -6
- package/dist/commands/whoami.js +0 -72
- package/dist/components/Dashboard.js +0 -169
- package/dist/components/DeltaApp.js +0 -57
- package/dist/components/UnifiedManager.js +0 -344
- package/dist/core/audit.js +0 -184
- package/dist/core/completion.js +0 -294
- package/dist/core/contracts.js +0 -6
- package/dist/core/engine.js +0 -124
- package/dist/core/exit-codes.js +0 -71
- package/dist/core/hooks.js +0 -181
- package/dist/core/index.js +0 -7
- package/dist/core/policy.js +0 -115
- package/dist/core/profiles.js +0 -161
- package/dist/core/wizard.js +0 -203
- package/dist/index.js +0 -387
- package/dist/interactive/index.js +0 -11
- package/dist/packages/domain/src/constitution/contracts/index.js +0 -43
- package/dist/packages/domain/src/constitution/contracts/ts.rules.js +0 -268
- package/dist/packages/domain/src/constitution/index.js +0 -139
- package/dist/packages/domain/src/constitution/maintainability/index.js +0 -43
- package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +0 -344
- package/dist/packages/domain/src/constitution/observability/index.js +0 -43
- package/dist/packages/domain/src/constitution/observability/ts.rules.js +0 -307
- package/dist/packages/domain/src/constitution/performance/index.js +0 -43
- package/dist/packages/domain/src/constitution/performance/ts.rules.js +0 -325
- package/dist/packages/domain/src/constitution/security/index.js +0 -50
- package/dist/packages/domain/src/constitution/security/ts.rules.js +0 -267
- package/dist/packages/domain/src/constitution/soc/index.js +0 -43
- package/dist/packages/domain/src/constitution/soc/ts.rules.js +0 -360
- package/dist/packages/domain/src/contracts/analysis.contract.js +0 -18
- package/dist/packages/domain/src/contracts/index.js +0 -7
- package/dist/packages/domain/src/contracts/projects.contract.js +0 -18
- package/dist/packages/domain/src/control/registry/rules.registry.js +0 -29
- package/dist/packages/domain/src/control/schemas/policies.js +0 -6
- package/dist/packages/domain/src/core/analysis/discovery.js +0 -163
- package/dist/packages/domain/src/core/analysis/engine.contract.js +0 -298
- package/dist/packages/domain/src/core/analysis/engine.js +0 -77
- package/dist/packages/domain/src/core/analysis/index.js +0 -14
- package/dist/packages/domain/src/core/analysis/orchestrator.js +0 -242
- package/dist/packages/domain/src/core/comparison/engine.js +0 -29
- package/dist/packages/domain/src/core/comparison/index.js +0 -5
- package/dist/packages/domain/src/core/documentation/index.js +0 -5
- package/dist/packages/domain/src/core/documentation/pipeline.js +0 -41
- package/dist/packages/domain/src/core/fs/adapter.js +0 -111
- package/dist/packages/domain/src/core/fs/index.js +0 -5
- package/dist/packages/domain/src/core/parser/unified-parser.js +0 -166
- package/dist/packages/domain/src/index.js +0 -33
- package/dist/packages/domain/src/plugin/registry.js +0 -195
- package/dist/packages/domain/src/plugin/types.js +0 -6
- package/dist/packages/domain/src/ports/analysis.engine.js +0 -7
- package/dist/packages/domain/src/ports/audit.logger.js +0 -7
- package/dist/packages/domain/src/ports/project.repository.js +0 -7
- package/dist/packages/domain/src/rules/index.js +0 -134
- package/dist/packages/domain/src/types/analysis.js +0 -6
- package/dist/packages/domain/src/types/errors.js +0 -53
- package/dist/packages/domain/src/types/fs.js +0 -6
- package/dist/packages/domain/src/types/index.js +0 -7
- package/dist/plugins/GitStatusPlugin.js +0 -93
- package/dist/providers/ai-provider.js +0 -74
- package/dist/providers/local-provider.js +0 -304
- package/dist/providers/remote-provider.js +0 -100
- package/dist/types/api.js +0 -3
- package/dist/ui.js +0 -219
- package/dist/welcome.js +0 -81
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced Whoami Command - Professional user info display
|
|
3
|
-
*/
|
|
4
|
-
import { loadConfig } from './auth.js';
|
|
5
|
-
import { icons, startSpinner, stopSpinner, printHeader, printSection, printSuccess, printError, printWarning, printInfo, printCommandHint, createTable, formatBytes, printDivider, } from '../ui.js';
|
|
6
|
-
export async function whoamiCommand(_options) {
|
|
7
|
-
try {
|
|
8
|
-
const config = await loadConfig();
|
|
9
|
-
if (!config.pat) {
|
|
10
|
-
printHeader('Authentication Status');
|
|
11
|
-
printError('Not authenticated');
|
|
12
|
-
console.log();
|
|
13
|
-
printInfo('Please login first:');
|
|
14
|
-
printCommandHint('delta login', 'to authenticate with your PAT');
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
printHeader('Loading Account Information');
|
|
18
|
-
startSpinner('Fetching user data...');
|
|
19
|
-
const apiUrl = config.apiUrl || process.env.DELTA_API_URL || 'https://api.delta.dev';
|
|
20
|
-
const response = await fetch(`${apiUrl}/api/me/entitlements`, {
|
|
21
|
-
headers: {
|
|
22
|
-
'Authorization': `Bearer ${config.pat}`,
|
|
23
|
-
'Content-Type': 'application/json',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
stopSpinner(false);
|
|
28
|
-
if (response.status === 401) {
|
|
29
|
-
printError('Authentication expired or invalid');
|
|
30
|
-
console.log();
|
|
31
|
-
printInfo('Please login again:');
|
|
32
|
-
printCommandHint('delta login --token <new-pat>', 'to re-authenticate');
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
throw new Error(`API error: ${response.status} ${response.statusText}`);
|
|
36
|
-
}
|
|
37
|
-
const data = await response.json();
|
|
38
|
-
if (!data.success) {
|
|
39
|
-
throw new Error(data.error?.message || 'Failed to fetch user info');
|
|
40
|
-
}
|
|
41
|
-
stopSpinner(true);
|
|
42
|
-
console.log();
|
|
43
|
-
const user = data.data.user;
|
|
44
|
-
const quota = data.data.quota;
|
|
45
|
-
const limits = data.data.limits;
|
|
46
|
-
// User Info Section
|
|
47
|
-
printHeader('User Profile');
|
|
48
|
-
const userTable = createTable(['Property', 'Value']);
|
|
49
|
-
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]);
|
|
50
|
-
console.log(userTable.toString());
|
|
51
|
-
printDivider();
|
|
52
|
-
// Plan Limits Section
|
|
53
|
-
printSection('Plan Features');
|
|
54
|
-
const limitsTable = createTable(['Feature', 'Value']);
|
|
55
|
-
limitsTable.push([icons.chart + ' Max Reports/Month', limits.maxReportsPerMonth.toString()], [icons.package + ' Max Report Size', formatBytes(limits.maxReportSizeBytes)], [icons.lock + ' API Access', limits.allowApiAccess ? '✅ Yes' : '❌ No'], [icons.folder + ' Upload Allowed', limits.allowUpload ? '✅ Yes' : '❌ No']);
|
|
56
|
-
console.log(limitsTable.toString());
|
|
57
|
-
printDivider();
|
|
58
|
-
// Quota Section with visual bar
|
|
59
|
-
printSection('Usage This Month');
|
|
60
|
-
const usagePercent = (quota.used / quota.limit) * 100;
|
|
61
|
-
const bar = renderUsageBar(quota.used, quota.limit);
|
|
62
|
-
const quotaTable = createTable(['Metric', 'Value']);
|
|
63
|
-
quotaTable.push([icons.chart + ' Reports Used', `${quota.used} of ${quota.limit}`], [icons.chart + ' Remaining', quota.remaining.toString()], [icons.chart + ' Usage', bar], [icons.info + ' Resets On', new Date(quota.resetAt).toLocaleDateString('en-US', {
|
|
64
|
-
weekday: 'long',
|
|
65
|
-
year: 'numeric',
|
|
66
|
-
month: 'long',
|
|
67
|
-
day: 'numeric'
|
|
68
|
-
})]);
|
|
69
|
-
console.log(quotaTable.toString());
|
|
70
|
-
console.log();
|
|
71
|
-
if (usagePercent >= 90) {
|
|
72
|
-
printWarning(`You're using ${usagePercent.toFixed(0)}% of your monthly quota!`);
|
|
73
|
-
printCommandHint('delta upgrade', 'to increase your limits (coming soon)');
|
|
74
|
-
}
|
|
75
|
-
else if (usagePercent >= 75) {
|
|
76
|
-
printInfo(`Usage: ${usagePercent.toFixed(0)}% of monthly quota`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
printSuccess(`Usage: ${usagePercent.toFixed(0)}% of monthly quota`);
|
|
80
|
-
}
|
|
81
|
-
console.log();
|
|
82
|
-
printCommandHint('delta analyze', 'to run a code analysis');
|
|
83
|
-
printCommandHint('delta status', 'to check project status');
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
stopSpinner(false);
|
|
87
|
-
console.log();
|
|
88
|
-
printError(error instanceof Error ? error.message : String(error));
|
|
89
|
-
process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function formatPlan(plan) {
|
|
93
|
-
const planColors = {
|
|
94
|
-
'individual_free': '🔷 Free',
|
|
95
|
-
'individual_pro': '💎 Pro',
|
|
96
|
-
'individual_team': '👥 Team',
|
|
97
|
-
'enterprise': '🏢 Enterprise',
|
|
98
|
-
};
|
|
99
|
-
return planColors[plan] || plan;
|
|
100
|
-
}
|
|
101
|
-
function renderUsageBar(used, limit) {
|
|
102
|
-
const percentage = Math.min((used / limit) * 100, 100);
|
|
103
|
-
const filledBlocks = Math.round((percentage / 100) * 20);
|
|
104
|
-
const emptyBlocks = 20 - filledBlocks;
|
|
105
|
-
let color;
|
|
106
|
-
if (percentage >= 90)
|
|
107
|
-
color = (s) => `\x1b[31m${s}\x1b[0m`; // red
|
|
108
|
-
else if (percentage >= 75)
|
|
109
|
-
color = (s) => `\x1b[33m${s}\x1b[0m`; // yellow
|
|
110
|
-
else
|
|
111
|
-
color = (s) => `\x1b[32m${s}\x1b[0m`; // green
|
|
112
|
-
const bar = color('█'.repeat(filledBlocks)) + '░'.repeat(emptyBlocks);
|
|
113
|
-
return `${bar} ${percentage.toFixed(1)}%`;
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=whoami.js.map
|
|
@@ -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
|