@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,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Report Generator
|
|
3
|
-
* @description Generates analysis reports in various formats
|
|
4
|
-
*/
|
|
5
|
-
export class ReportGenerator {
|
|
6
|
-
static generateHTML(result) {
|
|
7
|
-
return `<!DOCTYPE html>
|
|
8
|
-
<html>
|
|
9
|
-
<head>
|
|
10
|
-
<title>Delta Analysis - ${result.project.name}</title>
|
|
11
|
-
<style>
|
|
12
|
-
body { font-family: system-ui, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; }
|
|
13
|
-
.header { background: #1a1a2e; color: white; padding: 30px; border-radius: 8px; margin-bottom: 20px; }
|
|
14
|
-
.score { font-size: 48px; font-weight: bold; }
|
|
15
|
-
.grade { font-size: 24px; opacity: 0.8; }
|
|
16
|
-
.axis { background: #f5f5f5; padding: 15px; margin: 10px 0; border-radius: 6px; }
|
|
17
|
-
.bar { background: #ddd; height: 20px; border-radius: 10px; overflow: hidden; }
|
|
18
|
-
.bar-fill { background: #4CAF50; height: 100%; transition: width 0.3s; }
|
|
19
|
-
.violation { padding: 10px; margin: 5px 0; border-left: 4px solid; }
|
|
20
|
-
.critical { border-color: #f44336; background: #ffebee; }
|
|
21
|
-
.error { border-color: #ff9800; background: #fff3e0; }
|
|
22
|
-
.warning { border-color: #ffeb3b; background: #fffde7; }
|
|
23
|
-
</style>
|
|
24
|
-
</head>
|
|
25
|
-
<body>
|
|
26
|
-
<div class="header">
|
|
27
|
-
<h1>📊 Delta Constitution Analysis</h1>
|
|
28
|
-
<div class="score">${result.overall.percentage}%</div>
|
|
29
|
-
<div class="grade">Grade: ${result.overall.grade}</div>
|
|
30
|
-
<p>Project: ${result.project.name} | ${result.project.fileCount} files</p>
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
<h2>Axis Scores</h2>
|
|
34
|
-
${Object.entries(result.scores)
|
|
35
|
-
.map(([name, score]) => `
|
|
36
|
-
<div class="axis">
|
|
37
|
-
<strong>${name}</strong>: ${score.percentage}%
|
|
38
|
-
<div class="bar"><div class="bar-fill" style="width: ${score.percentage}%"></div></div>
|
|
39
|
-
</div>
|
|
40
|
-
`)
|
|
41
|
-
.join('')}
|
|
42
|
-
|
|
43
|
-
<h2>Violations (${result.violations.length})</h2>
|
|
44
|
-
${result.violations
|
|
45
|
-
.slice(0, 20)
|
|
46
|
-
.map(v => `
|
|
47
|
-
<div class="violation ${v.severity}">
|
|
48
|
-
<strong>[${v.axis}] ${v.id}</strong>: ${v.message}
|
|
49
|
-
</div>
|
|
50
|
-
`)
|
|
51
|
-
.join('')}
|
|
52
|
-
|
|
53
|
-
<h2>Recommendations</h2>
|
|
54
|
-
${result.recommendations
|
|
55
|
-
.slice(0, 5)
|
|
56
|
-
.map(r => `
|
|
57
|
-
<div class="axis">
|
|
58
|
-
<strong>[${r.axis}] ${r.priority}</strong>
|
|
59
|
-
<p>${r.description}</p>
|
|
60
|
-
<small>Action: ${r.action}</small>
|
|
61
|
-
</div>
|
|
62
|
-
`)
|
|
63
|
-
.join('')}
|
|
64
|
-
|
|
65
|
-
<footer style="margin-top: 40px; padding-top: 20px; border-top: 1px solid #ddd; color: #666;">
|
|
66
|
-
Generated: ${result.timestamp} | Delta Constitution v1.0.0
|
|
67
|
-
</footer>
|
|
68
|
-
</body>
|
|
69
|
-
</html>`;
|
|
70
|
-
}
|
|
71
|
-
static generateMarkdown(result) {
|
|
72
|
-
return `# Delta Constitution Analysis Report
|
|
73
|
-
|
|
74
|
-
## Project: ${result.project.name}
|
|
75
|
-
|
|
76
|
-
- **Path**: ${result.project.path}
|
|
77
|
-
- **Language**: ${result.project.language}
|
|
78
|
-
- **Files**: ${result.project.fileCount}
|
|
79
|
-
- **Generated**: ${result.timestamp}
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Overall Score: ${result.overall.percentage}% (Grade: ${result.overall.grade})
|
|
84
|
-
|
|
85
|
-
**Status**: ${result.overall.compliant ? '✅ Compliant' : '❌ Non-Compliant'}
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Axis Scores
|
|
90
|
-
|
|
91
|
-
| Axis | Score | Weight | Status |
|
|
92
|
-
|------|-------|--------|--------|
|
|
93
|
-
${Object.entries(result.scores)
|
|
94
|
-
.map(([name, s]) => `| ${name} | ${s.percentage}% | ${s.weight}% | ${s.percentage >= 70 ? '✅' : '⚠️'} |`)
|
|
95
|
-
.join('\n')}
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Violations (${result.violations.length})
|
|
100
|
-
|
|
101
|
-
${result.violations
|
|
102
|
-
.slice(0, 30)
|
|
103
|
-
.map(v => `- **[${v.axis}]** \`${v.id}\` (${v.severity}): ${v.message}`)
|
|
104
|
-
.join('\n')}
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## Top Recommendations
|
|
109
|
-
|
|
110
|
-
${result.recommendations
|
|
111
|
-
.slice(0, 10)
|
|
112
|
-
.map((r, i) => `${i + 1}. **[${r.axis}]** ${r.description}
|
|
113
|
-
- Priority: ${r.priority}
|
|
114
|
-
- Action: ${r.action}`)
|
|
115
|
-
.join('\n\n')}
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
*Report generated by Delta Analyzer v1.0.0*
|
|
120
|
-
`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=report.generator.js.map
|
package/dist/analyzer/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Delta CLI Analyzer
|
|
4
|
-
* @description Analyze projects against Delta Constitution
|
|
5
|
-
* @version 1.0.0
|
|
6
|
-
*/
|
|
7
|
-
import { Command } from 'commander';
|
|
8
|
-
import { analyzeCommand } from './commands/analyze';
|
|
9
|
-
import { reportCommand } from './commands/report';
|
|
10
|
-
import { configCommand } from './commands/config';
|
|
11
|
-
const program = new Command();
|
|
12
|
-
program
|
|
13
|
-
.name('delta-analyze')
|
|
14
|
-
.description('Analyze projects against Delta Constitution')
|
|
15
|
-
.version('1.0.0');
|
|
16
|
-
// Analyze command
|
|
17
|
-
program
|
|
18
|
-
.command('analyze')
|
|
19
|
-
.description('Analyze a project against Delta Constitution')
|
|
20
|
-
.argument('<path>', 'Project path to analyze')
|
|
21
|
-
.option('-l, --language <lang>', 'Project language', 'typescript')
|
|
22
|
-
.option('-o, --output <format>', 'Output format (json|html|markdown)', 'json')
|
|
23
|
-
.option('-d, --depth <level>', 'Analysis depth (quick|standard|deep)', 'standard')
|
|
24
|
-
.option('--config <path>', 'Configuration file path')
|
|
25
|
-
.option('--strict', 'Fail on any violation', false)
|
|
26
|
-
.action(analyzeCommand);
|
|
27
|
-
// Report command
|
|
28
|
-
program
|
|
29
|
-
.command('report')
|
|
30
|
-
.description('Generate report from previous analysis')
|
|
31
|
-
.argument('<analysis-file>', 'Previous analysis JSON file')
|
|
32
|
-
.option('-t, --template <type>', 'Report template (html|markdown|pdf)', 'html')
|
|
33
|
-
.option('-o, --output <path>', 'Output file path')
|
|
34
|
-
.action(reportCommand);
|
|
35
|
-
// Config command
|
|
36
|
-
program
|
|
37
|
-
.command('config')
|
|
38
|
-
.description('Manage analyzer configuration')
|
|
39
|
-
.option('--init', 'Initialize configuration file')
|
|
40
|
-
.option('--show', 'Show current configuration')
|
|
41
|
-
.option('--set <key=value>', 'Set configuration value')
|
|
42
|
-
.action(configCommand);
|
|
43
|
-
program.parse();
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project Scanner
|
|
3
|
-
* @description Scans project structure and extracts metadata
|
|
4
|
-
*/
|
|
5
|
-
import * as fs from 'fs/promises';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
export class ProjectScanner {
|
|
8
|
-
static async scan(projectPath, language) {
|
|
9
|
-
const files = [];
|
|
10
|
-
const directories = [];
|
|
11
|
-
const totalSize = 0;
|
|
12
|
-
// Scan directory recursively
|
|
13
|
-
await this.scanDirectory(projectPath, '', files, directories, totalSize);
|
|
14
|
-
// Detect project metadata
|
|
15
|
-
const hasPackageJson = files.some(f => f.endsWith('package.json'));
|
|
16
|
-
const hasTsConfig = files.some(f => f.endsWith('tsconfig.json'));
|
|
17
|
-
const hasTests = files.some(f => f.includes('.test.') || f.includes('.spec.'));
|
|
18
|
-
// Extract imports
|
|
19
|
-
const imports = await this.extractImports(files, projectPath);
|
|
20
|
-
return {
|
|
21
|
-
path: projectPath,
|
|
22
|
-
name: path.basename(projectPath),
|
|
23
|
-
language,
|
|
24
|
-
size: totalSize,
|
|
25
|
-
fileCount: files.length,
|
|
26
|
-
files,
|
|
27
|
-
directories,
|
|
28
|
-
imports,
|
|
29
|
-
hasPackageJson,
|
|
30
|
-
hasTsConfig,
|
|
31
|
-
hasTests,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
static async scanDirectory(basePath, relativePath, files, directories, totalSize) {
|
|
35
|
-
const fullPath = path.join(basePath, relativePath);
|
|
36
|
-
try {
|
|
37
|
-
const entries = await fs.readdir(fullPath, { withFileTypes: true });
|
|
38
|
-
for (const entry of entries) {
|
|
39
|
-
const entryRelativePath = path.join(relativePath, entry.name);
|
|
40
|
-
// Skip node_modules and hidden directories
|
|
41
|
-
if (entry.name === 'node_modules' || entry.name.startsWith('.')) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (entry.isDirectory()) {
|
|
45
|
-
directories.push(entryRelativePath);
|
|
46
|
-
await this.scanDirectory(basePath, entryRelativePath, files, directories, totalSize);
|
|
47
|
-
}
|
|
48
|
-
else if (entry.isFile()) {
|
|
49
|
-
// Only include source files
|
|
50
|
-
if (this.isSourceFile(entry.name)) {
|
|
51
|
-
files.push(entryRelativePath);
|
|
52
|
-
const stats = await fs.stat(path.join(fullPath, entry.name));
|
|
53
|
-
totalSize += stats.size;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
// Directory not accessible, skip
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
static isSourceFile(filename) {
|
|
63
|
-
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.json', '.md'];
|
|
64
|
-
return extensions.some(ext => filename.endsWith(ext));
|
|
65
|
-
}
|
|
66
|
-
static async extractImports(files, projectPath) {
|
|
67
|
-
const imports = [];
|
|
68
|
-
for (const file of files) {
|
|
69
|
-
if (!file.endsWith('.ts') && !file.endsWith('.tsx'))
|
|
70
|
-
continue;
|
|
71
|
-
try {
|
|
72
|
-
const content = await fs.readFile(path.join(projectPath, file), 'utf-8');
|
|
73
|
-
const importMatches = content.match(/import\s+.*?\s+from\s+['"]([^'"]+)['"];?/g) || [];
|
|
74
|
-
for (const match of importMatches) {
|
|
75
|
-
const importPath = match.match(/from\s+['"]([^'"]+)['"]/)?.[1];
|
|
76
|
-
if (importPath) {
|
|
77
|
-
imports.push({
|
|
78
|
-
source: file,
|
|
79
|
-
target: importPath,
|
|
80
|
-
type: importPath.startsWith('.') ? 'internal' : 'external',
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
// Skip files that can't be read
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return imports;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=project.scanner.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contracts Validator
|
|
3
|
-
* @description Validates Contracts rules
|
|
4
|
-
*/
|
|
5
|
-
export class ContractsValidator {
|
|
6
|
-
static async validate(project, _options) {
|
|
7
|
-
const violations = [];
|
|
8
|
-
let score = 100;
|
|
9
|
-
// Check for contract files
|
|
10
|
-
const contractFiles = project.files.filter(f => f.includes('.contract.'));
|
|
11
|
-
if (contractFiles.length === 0) {
|
|
12
|
-
violations.push({
|
|
13
|
-
id: 'CONTRACT-001',
|
|
14
|
-
severity: 'error',
|
|
15
|
-
message: 'No contract files found',
|
|
16
|
-
rule: 'Contracts Required',
|
|
17
|
-
});
|
|
18
|
-
score -= 30;
|
|
19
|
-
}
|
|
20
|
-
// Check for required contracts
|
|
21
|
-
const requiredContracts = ['auth', 'upload', 'projects', 'analysis'];
|
|
22
|
-
for (const contract of requiredContracts) {
|
|
23
|
-
const hasContract = contractFiles.some(f => f.includes(`${contract}.contract`));
|
|
24
|
-
if (!hasContract) {
|
|
25
|
-
violations.push({
|
|
26
|
-
id: 'CONTRACT-002',
|
|
27
|
-
severity: 'warning',
|
|
28
|
-
message: `Missing ${contract}.contract.ts`,
|
|
29
|
-
rule: 'Required Contracts',
|
|
30
|
-
});
|
|
31
|
-
score -= 10;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
score: Math.max(0, score),
|
|
36
|
-
maxScore: 100,
|
|
37
|
-
percentage: Math.max(0, score),
|
|
38
|
-
violations,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=contracts.validator.js.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maintainability Validator
|
|
3
|
-
* @description Validates Maintainability rules
|
|
4
|
-
*/
|
|
5
|
-
export class MaintainabilityValidator {
|
|
6
|
-
static async validate(project, _options) {
|
|
7
|
-
const violations = [];
|
|
8
|
-
let score = 100;
|
|
9
|
-
// Check for tests
|
|
10
|
-
const testFiles = project.files.filter(f => f.includes('.test.') || f.includes('.spec.'));
|
|
11
|
-
const testRatio = testFiles.length / (project.fileCount || 1);
|
|
12
|
-
if (testRatio < 0.1) {
|
|
13
|
-
violations.push({
|
|
14
|
-
id: 'MAINT-TEST-001',
|
|
15
|
-
severity: 'warning',
|
|
16
|
-
message: `Low test coverage: ${(testRatio * 100).toFixed(1)}% of files are tests`,
|
|
17
|
-
rule: 'Testing Required',
|
|
18
|
-
});
|
|
19
|
-
score -= 20;
|
|
20
|
-
}
|
|
21
|
-
// Check for documentation
|
|
22
|
-
const hasReadme = project.files.some(f => f.toLowerCase() === 'readme.md' || f.toLowerCase().endsWith('/readme.md'));
|
|
23
|
-
if (!hasReadme) {
|
|
24
|
-
violations.push({
|
|
25
|
-
id: 'MAINT-DOC-001',
|
|
26
|
-
severity: 'warning',
|
|
27
|
-
message: 'No README.md found',
|
|
28
|
-
rule: 'Documentation Required',
|
|
29
|
-
});
|
|
30
|
-
score -= 10;
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
score: Math.max(0, score),
|
|
34
|
-
maxScore: 100,
|
|
35
|
-
percentage: Math.max(0, score),
|
|
36
|
-
violations,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=maintainability.validator.js.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Observability Validator
|
|
3
|
-
* @description Validates Observability rules
|
|
4
|
-
*/
|
|
5
|
-
export class ObservabilityValidator {
|
|
6
|
-
static async validate(project, _options) {
|
|
7
|
-
const violations = [];
|
|
8
|
-
let score = 100;
|
|
9
|
-
// Check for health endpoint
|
|
10
|
-
const hasHealthEndpoint = project.files.some(f => f.includes('health') || f.includes('ready') || f.includes('live'));
|
|
11
|
-
if (!hasHealthEndpoint) {
|
|
12
|
-
violations.push({
|
|
13
|
-
id: 'OBS-HEALTH-001',
|
|
14
|
-
severity: 'warning',
|
|
15
|
-
message: 'No health check endpoint found',
|
|
16
|
-
rule: 'Health Checks Required',
|
|
17
|
-
});
|
|
18
|
-
score -= 20;
|
|
19
|
-
}
|
|
20
|
-
// Check for logging
|
|
21
|
-
const hasLogging = project.files.some(f => f.includes('logger') || f.includes('log'));
|
|
22
|
-
if (!hasLogging) {
|
|
23
|
-
violations.push({
|
|
24
|
-
id: 'OBS-LOG-001',
|
|
25
|
-
severity: 'warning',
|
|
26
|
-
message: 'No logging implementation found',
|
|
27
|
-
rule: 'Structured Logging Required',
|
|
28
|
-
});
|
|
29
|
-
score -= 20;
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
score: Math.max(0, score),
|
|
33
|
-
maxScore: 100,
|
|
34
|
-
percentage: Math.max(0, score),
|
|
35
|
-
violations,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=observability.validator.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performance Validator
|
|
3
|
-
* @description Validates performance rules
|
|
4
|
-
*/
|
|
5
|
-
export class PerformanceValidator {
|
|
6
|
-
static async validate(project, _options) {
|
|
7
|
-
const violations = [];
|
|
8
|
-
let score = 100;
|
|
9
|
-
// Check for lazy loading patterns
|
|
10
|
-
const hasDynamicImports = project.files.some(f => {
|
|
11
|
-
// Would check file content for dynamic imports
|
|
12
|
-
return f.includes('dynamic') || f.includes('lazy');
|
|
13
|
-
});
|
|
14
|
-
if (!hasDynamicImports && project.fileCount > 50) {
|
|
15
|
-
violations.push({
|
|
16
|
-
id: 'PERF-LAZY-001',
|
|
17
|
-
severity: 'warning',
|
|
18
|
-
message: 'No lazy loading patterns detected in large project',
|
|
19
|
-
rule: 'Lazy Loading Recommended',
|
|
20
|
-
});
|
|
21
|
-
score -= 10;
|
|
22
|
-
}
|
|
23
|
-
// Check for caching implementation
|
|
24
|
-
const hasCaching = project.files.some(f => f.includes('cache') || f.includes('redis') || f.includes('swr'));
|
|
25
|
-
if (!hasCaching) {
|
|
26
|
-
violations.push({
|
|
27
|
-
id: 'PERF-CACHE-001',
|
|
28
|
-
severity: 'warning',
|
|
29
|
-
message: 'No caching implementation found',
|
|
30
|
-
rule: 'Caching Layer Recommended',
|
|
31
|
-
});
|
|
32
|
-
score -= 15;
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
score: Math.max(0, score),
|
|
36
|
-
maxScore: 100,
|
|
37
|
-
percentage: Math.max(0, score),
|
|
38
|
-
violations,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=performance.validator.js.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Validator
|
|
3
|
-
* @description Validates security rules against project
|
|
4
|
-
*/
|
|
5
|
-
export class SecurityValidator {
|
|
6
|
-
static async validate(project, options) {
|
|
7
|
-
const violations = [];
|
|
8
|
-
let score = 100;
|
|
9
|
-
// Check 1: Policy Registry exists
|
|
10
|
-
const hasPolicyRegistry = project.directories.some(d => d.includes('modules') && d.includes('policies'));
|
|
11
|
-
if (!hasPolicyRegistry) {
|
|
12
|
-
violations.push({
|
|
13
|
-
id: 'SEC-POL-002',
|
|
14
|
-
severity: 'error',
|
|
15
|
-
message: 'Missing policies/ directory in modules',
|
|
16
|
-
rule: 'Policy Registry Required',
|
|
17
|
-
});
|
|
18
|
-
score -= 15;
|
|
19
|
-
}
|
|
20
|
-
// Check 2: Audit logging
|
|
21
|
-
const hasAuditFile = project.files.some(f => f.includes('audit') || f.includes('logger'));
|
|
22
|
-
if (!hasAuditFile) {
|
|
23
|
-
violations.push({
|
|
24
|
-
id: 'SEC-AUDIT-001',
|
|
25
|
-
severity: 'warning',
|
|
26
|
-
message: 'No audit logging implementation found',
|
|
27
|
-
rule: 'Audit Logging Required',
|
|
28
|
-
});
|
|
29
|
-
score -= 10;
|
|
30
|
-
}
|
|
31
|
-
// Check 3: Rate limiting
|
|
32
|
-
const hasRateLimit = project.files.some(f => f.includes('rate') || f.includes('limit'));
|
|
33
|
-
if (!hasRateLimit) {
|
|
34
|
-
violations.push({
|
|
35
|
-
id: 'SEC-RATE-001',
|
|
36
|
-
severity: 'warning',
|
|
37
|
-
message: 'No rate limiting implementation found',
|
|
38
|
-
rule: 'Rate Limiting Required',
|
|
39
|
-
});
|
|
40
|
-
score -= 10;
|
|
41
|
-
}
|
|
42
|
-
// Check 4: Security directory
|
|
43
|
-
const hasSecurityDir = project.directories.some(d => d.includes('security'));
|
|
44
|
-
if (!hasSecurityDir) {
|
|
45
|
-
violations.push({
|
|
46
|
-
id: 'SEC-DIR-001',
|
|
47
|
-
severity: 'error',
|
|
48
|
-
message: 'Missing security/ directory',
|
|
49
|
-
rule: 'Security Layer Required',
|
|
50
|
-
});
|
|
51
|
-
score -= 15;
|
|
52
|
-
}
|
|
53
|
-
// Deep scan for Fail-Open patterns (if requested)
|
|
54
|
-
if (options.depth === 'deep') {
|
|
55
|
-
// This would scan file contents for fail-open patterns
|
|
56
|
-
// For now, just check structure
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
score: Math.max(0, score),
|
|
60
|
-
maxScore: 100,
|
|
61
|
-
percentage: Math.max(0, score),
|
|
62
|
-
violations,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=security.validator.js.map
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SoC Validator
|
|
3
|
-
* @description Validates Separation of Concerns rules
|
|
4
|
-
*/
|
|
5
|
-
export class SocValidator {
|
|
6
|
-
static async validate(project, _options) {
|
|
7
|
-
const violations = [];
|
|
8
|
-
let score = 100;
|
|
9
|
-
// Check for proper layer structure
|
|
10
|
-
const hasFeatures = project.directories.some(d => d.includes('features'));
|
|
11
|
-
const hasModules = project.directories.some(d => d.includes('modules'));
|
|
12
|
-
const hasCore = project.directories.some(d => d.includes('core'));
|
|
13
|
-
const hasContracts = project.directories.some(d => d.includes('contracts'));
|
|
14
|
-
if (!hasFeatures) {
|
|
15
|
-
violations.push({
|
|
16
|
-
id: 'SOC-LAYER-001',
|
|
17
|
-
severity: 'error',
|
|
18
|
-
message: 'Missing features/ layer',
|
|
19
|
-
rule: '7-Layer Architecture',
|
|
20
|
-
});
|
|
21
|
-
score -= 20;
|
|
22
|
-
}
|
|
23
|
-
if (!hasModules) {
|
|
24
|
-
violations.push({
|
|
25
|
-
id: 'SOC-LAYER-002',
|
|
26
|
-
severity: 'error',
|
|
27
|
-
message: 'Missing modules/ layer',
|
|
28
|
-
rule: '7-Layer Architecture',
|
|
29
|
-
});
|
|
30
|
-
score -= 20;
|
|
31
|
-
}
|
|
32
|
-
if (!hasCore) {
|
|
33
|
-
violations.push({
|
|
34
|
-
id: 'SOC-LAYER-003',
|
|
35
|
-
severity: 'error',
|
|
36
|
-
message: 'Missing core/ layer',
|
|
37
|
-
rule: '7-Layer Architecture',
|
|
38
|
-
});
|
|
39
|
-
score -= 20;
|
|
40
|
-
}
|
|
41
|
-
if (!hasContracts) {
|
|
42
|
-
violations.push({
|
|
43
|
-
id: 'SOC-LAYER-004',
|
|
44
|
-
severity: 'warning',
|
|
45
|
-
message: 'Missing contracts/ layer',
|
|
46
|
-
rule: '7-Layer Architecture',
|
|
47
|
-
});
|
|
48
|
-
score -= 10;
|
|
49
|
-
}
|
|
50
|
-
// Check feature structure
|
|
51
|
-
if (hasFeatures) {
|
|
52
|
-
const featureDirs = project.directories.filter(d => d.startsWith('features/'));
|
|
53
|
-
for (const featureDir of featureDirs) {
|
|
54
|
-
const hasComponents = project.directories.some(d => d.startsWith(`${featureDir}/components`));
|
|
55
|
-
const hasHooks = project.directories.some(d => d.startsWith(`${featureDir}/hooks`));
|
|
56
|
-
if (!hasComponents || !hasHooks) {
|
|
57
|
-
violations.push({
|
|
58
|
-
id: 'SOC-FEAT-001',
|
|
59
|
-
severity: 'warning',
|
|
60
|
-
message: `Feature ${featureDir} missing components/ or hooks/`,
|
|
61
|
-
rule: 'Feature Structure',
|
|
62
|
-
});
|
|
63
|
-
score -= 5;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
score: Math.max(0, score),
|
|
69
|
-
maxScore: 100,
|
|
70
|
-
percentage: Math.max(0, score),
|
|
71
|
-
violations,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=soc.validator.js.map
|