@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,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rules Implementation - First Rule Engine
|
|
3
|
-
* Concrete rule implementations using pure functions
|
|
4
|
-
* @module rules
|
|
5
|
-
*/
|
|
6
|
-
import { rulesRegistry } from '../control/registry/rules.registry.js';
|
|
7
|
-
/**
|
|
8
|
-
* File Size Rule
|
|
9
|
-
* Checks if file exceeds maximum size
|
|
10
|
-
*/
|
|
11
|
-
const fileSizeRule = (input, policy) => {
|
|
12
|
-
if (policy.type !== 'file-size')
|
|
13
|
-
return [];
|
|
14
|
-
const contentSizeKB = Buffer.byteLength(input.content, 'utf8') / 1024;
|
|
15
|
-
const findings = [];
|
|
16
|
-
if (policy.maxSizeKB && contentSizeKB > policy.maxSizeKB) {
|
|
17
|
-
findings.push({
|
|
18
|
-
id: `file-size-${input.file}`,
|
|
19
|
-
ruleId: policy.id,
|
|
20
|
-
severity: policy.severity,
|
|
21
|
-
category: policy.category,
|
|
22
|
-
message: `File size (${contentSizeKB.toFixed(2)} KB) exceeds maximum (${policy.maxSizeKB} KB)`,
|
|
23
|
-
filePath: input.file,
|
|
24
|
-
line: 1,
|
|
25
|
-
column: 1,
|
|
26
|
-
suggestion: 'Consider splitting this file into smaller modules',
|
|
27
|
-
relatedFindings: [],
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return findings;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Forbidden Patterns Rule
|
|
34
|
-
* Detects forbidden patterns in code
|
|
35
|
-
*/
|
|
36
|
-
const forbiddenPatternsRule = (input, policy) => {
|
|
37
|
-
if (policy.type !== 'forbidden-patterns')
|
|
38
|
-
return [];
|
|
39
|
-
const findings = [];
|
|
40
|
-
if (!policy.patterns)
|
|
41
|
-
return findings;
|
|
42
|
-
for (const pattern of policy.patterns) {
|
|
43
|
-
const regex = new RegExp(pattern.pattern, pattern.caseSensitive ? 'g' : 'gi');
|
|
44
|
-
const lines = input.content.split('\n');
|
|
45
|
-
for (let i = 0; i < lines.length; i++) {
|
|
46
|
-
const line = lines[i];
|
|
47
|
-
const matches = line.match(regex);
|
|
48
|
-
if (matches) {
|
|
49
|
-
findings.push({
|
|
50
|
-
id: `forbidden-${policy.id}-${i}`,
|
|
51
|
-
ruleId: policy.id,
|
|
52
|
-
severity: pattern.severity,
|
|
53
|
-
category: policy.category,
|
|
54
|
-
message: pattern.message,
|
|
55
|
-
filePath: input.file,
|
|
56
|
-
line: i + 1,
|
|
57
|
-
column: line.indexOf(matches[0]) + 1,
|
|
58
|
-
suggestion: 'Remove or replace this pattern',
|
|
59
|
-
relatedFindings: [],
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return findings;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Complexity Rule
|
|
68
|
-
* Calculates code complexity
|
|
69
|
-
*/
|
|
70
|
-
const complexityRule = (input, policy) => {
|
|
71
|
-
if (policy.type !== 'complexity')
|
|
72
|
-
return [];
|
|
73
|
-
const findings = [];
|
|
74
|
-
// Count decision points (if, switch, for, while, etc.)
|
|
75
|
-
const decisionPoints = [
|
|
76
|
-
/\bif\s*\(/g,
|
|
77
|
-
/\bswitch\s*\(/g,
|
|
78
|
-
/\bfor\s*\(/g,
|
|
79
|
-
/\bwhile\s*\(/g,
|
|
80
|
-
/\bcatch\s*\(/g,
|
|
81
|
-
/\?\s*[^:]+:/g, // ternary
|
|
82
|
-
];
|
|
83
|
-
let cyclomaticComplexity = 1; // base complexity
|
|
84
|
-
for (const pattern of decisionPoints) {
|
|
85
|
-
const matches = input.content.match(pattern);
|
|
86
|
-
if (matches) {
|
|
87
|
-
cyclomaticComplexity += matches.length;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (policy.maxCyclomaticComplexity && cyclomaticComplexity > policy.maxCyclomaticComplexity) {
|
|
91
|
-
findings.push({
|
|
92
|
-
id: `complexity-${input.file}`,
|
|
93
|
-
ruleId: policy.id,
|
|
94
|
-
severity: policy.severity,
|
|
95
|
-
category: policy.category,
|
|
96
|
-
message: `Cyclomatic complexity (${cyclomaticComplexity}) exceeds maximum (${policy.maxCyclomaticComplexity})`,
|
|
97
|
-
filePath: input.file,
|
|
98
|
-
line: 1,
|
|
99
|
-
column: 1,
|
|
100
|
-
suggestion: 'Refactor into smaller functions to reduce complexity',
|
|
101
|
-
relatedFindings: [],
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return findings;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Register all rules
|
|
108
|
-
*/
|
|
109
|
-
export function registerDefaultRules() {
|
|
110
|
-
rulesRegistry.register({
|
|
111
|
-
id: 'file-size',
|
|
112
|
-
name: 'File Size Check',
|
|
113
|
-
description: 'Checks if files exceed maximum size limits',
|
|
114
|
-
category: 'maintainability',
|
|
115
|
-
execute: fileSizeRule,
|
|
116
|
-
});
|
|
117
|
-
rulesRegistry.register({
|
|
118
|
-
id: 'forbidden-patterns',
|
|
119
|
-
name: 'Forbidden Patterns',
|
|
120
|
-
description: 'Detects forbidden patterns in code',
|
|
121
|
-
category: 'security',
|
|
122
|
-
execute: forbiddenPatternsRule,
|
|
123
|
-
});
|
|
124
|
-
rulesRegistry.register({
|
|
125
|
-
id: 'complexity',
|
|
126
|
-
name: 'Code Complexity',
|
|
127
|
-
description: 'Analyzes code complexity metrics',
|
|
128
|
-
category: 'maintainability',
|
|
129
|
-
execute: complexityRule,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
// Auto-register on module load
|
|
133
|
-
registerDefaultRules();
|
|
134
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base error class for Delta Platform
|
|
3
|
-
* @see docs/architecture/OVERVIEW.md#error-handling
|
|
4
|
-
*/
|
|
5
|
-
export class DeltaError extends Error {
|
|
6
|
-
code;
|
|
7
|
-
incidentId;
|
|
8
|
-
timestamp;
|
|
9
|
-
constructor(code, message, incidentId) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.code = code;
|
|
12
|
-
this.incidentId = incidentId;
|
|
13
|
-
this.timestamp = new Date();
|
|
14
|
-
this.name = 'DeltaError';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Configuration-related errors
|
|
19
|
-
*/
|
|
20
|
-
export class ConfigError extends DeltaError {
|
|
21
|
-
constructor(message, incidentId) {
|
|
22
|
-
super('CONFIG_ERROR', message, incidentId);
|
|
23
|
-
this.name = 'ConfigError';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Analysis-related errors
|
|
28
|
-
*/
|
|
29
|
-
export class AnalysisError extends DeltaError {
|
|
30
|
-
constructor(message, incidentId) {
|
|
31
|
-
super('ANALYSIS_ERROR', message, incidentId);
|
|
32
|
-
this.name = 'AnalysisError';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Sync-related errors
|
|
37
|
-
*/
|
|
38
|
-
export class SyncError extends DeltaError {
|
|
39
|
-
constructor(message, incidentId) {
|
|
40
|
-
super('SYNC_ERROR', message, incidentId);
|
|
41
|
-
this.name = 'SyncError';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* File system-related errors
|
|
46
|
-
*/
|
|
47
|
-
export class FileSystemError extends DeltaError {
|
|
48
|
-
constructor(message, incidentId) {
|
|
49
|
-
super('FS_ERROR', message, incidentId);
|
|
50
|
-
this.name = 'FileSystemError';
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* GitStatusPlugin - MVP Plugin Example
|
|
4
|
-
* Displays git repository status in the sidebar
|
|
5
|
-
* Demonstrates Plugin System capabilities
|
|
6
|
-
*/
|
|
7
|
-
import { execSync } from 'child_process';
|
|
8
|
-
import { Box, Text } from 'ink';
|
|
9
|
-
export class GitStatusPlugin {
|
|
10
|
-
id = 'git-status';
|
|
11
|
-
name = 'Git Status';
|
|
12
|
-
version = '1.0.0';
|
|
13
|
-
description = 'Displays git repository status in the dashboard';
|
|
14
|
-
context;
|
|
15
|
-
branch = 'unknown';
|
|
16
|
-
status = 'clean';
|
|
17
|
-
aheadBehind = '';
|
|
18
|
-
constructor(context) {
|
|
19
|
-
this.context = context;
|
|
20
|
-
}
|
|
21
|
-
onActivate() {
|
|
22
|
-
this.updateGitStatus();
|
|
23
|
-
// Auto-update every 10 seconds
|
|
24
|
-
setInterval(() => this.updateGitStatus(), 10000);
|
|
25
|
-
this.context.addLog('GitStatus', 'Git Status Plugin activated', 'info');
|
|
26
|
-
}
|
|
27
|
-
onDeactivate() {
|
|
28
|
-
this.context.addLog('GitStatus', 'Git Status Plugin deactivated', 'info');
|
|
29
|
-
}
|
|
30
|
-
registerCommands() {
|
|
31
|
-
return [
|
|
32
|
-
{
|
|
33
|
-
id: 'refresh',
|
|
34
|
-
label: 'Refresh Git Status',
|
|
35
|
-
shortcut: 'g',
|
|
36
|
-
icon: '🔄',
|
|
37
|
-
execute: () => {
|
|
38
|
-
this.updateGitStatus();
|
|
39
|
-
this.context.addLog('GitStatus', 'Git status refreshed manually', 'success');
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
registerDashboardWidgets() {
|
|
45
|
-
return [
|
|
46
|
-
{
|
|
47
|
-
id: 'git-info',
|
|
48
|
-
title: 'Git Status',
|
|
49
|
-
position: 'sidebar',
|
|
50
|
-
priority: 10,
|
|
51
|
-
render: () => this.renderWidget(),
|
|
52
|
-
updateInterval: 10000,
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
updateGitStatus() {
|
|
57
|
-
try {
|
|
58
|
-
// Check if we're in a git repo
|
|
59
|
-
execSync('git rev-parse --git-dir', { stdio: 'pipe' });
|
|
60
|
-
// Get current branch
|
|
61
|
-
this.branch = execSync('git branch --show-current', { encoding: 'utf-8' }).trim();
|
|
62
|
-
// Check for uncommitted changes
|
|
63
|
-
const status = execSync('git status --porcelain', { encoding: 'utf-8' });
|
|
64
|
-
this.status = status.trim() ? 'dirty' : 'clean';
|
|
65
|
-
// Get ahead/behind info
|
|
66
|
-
try {
|
|
67
|
-
const aheadBehind = execSync('git rev-list --left-right --count HEAD...@{u} 2>/dev/null || echo "0\t0"', { encoding: 'utf-8' }).trim();
|
|
68
|
-
const [ahead, behind] = aheadBehind.split('\t');
|
|
69
|
-
if (ahead !== '0' || behind !== '0') {
|
|
70
|
-
this.aheadBehind = `${ahead}↑ ${behind}↓`;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.aheadBehind = '';
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
this.aheadBehind = '';
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
this.branch = 'not a repo';
|
|
82
|
-
this.status = 'clean';
|
|
83
|
-
this.aheadBehind = '';
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
renderWidget() {
|
|
87
|
-
const statusIcon = this.status === 'clean' ? '✓' : '⚡';
|
|
88
|
-
const statusColor = this.status === 'clean' ? 'green' : 'yellow';
|
|
89
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, width: 28, marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\uD83C\uDF3F Git Status" }), _jsxs(Text, { color: "white", children: ["Branch: ", this.branch] }), _jsxs(Text, { color: statusColor, children: [statusIcon, " ", this.status === 'clean' ? 'Clean' : 'Modified'] }), this.aheadBehind ? _jsx(Text, { color: "yellow", children: this.aheadBehind }) : null] }));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
export default GitStatusPlugin;
|
|
93
|
-
//# sourceMappingURL=GitStatusPlugin.js.map
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Provider (Placeholder)
|
|
3
|
-
* Reserved for future AI integration without breaking existing architecture
|
|
4
|
-
*/
|
|
5
|
-
import { ExitCode } from '../core/exit-codes.js';
|
|
6
|
-
export class AIProviderPlaceholder {
|
|
7
|
-
name = 'ai';
|
|
8
|
-
version = '2.0.0-placeholder';
|
|
9
|
-
capabilities = {
|
|
10
|
-
commands: ['analyze'],
|
|
11
|
-
features: {
|
|
12
|
-
json: true,
|
|
13
|
-
streaming: true,
|
|
14
|
-
caching: false,
|
|
15
|
-
ai: true,
|
|
16
|
-
},
|
|
17
|
-
constraints: {
|
|
18
|
-
maxFileSize: 100 * 1024 * 1024, // 100MB
|
|
19
|
-
requiresAuth: true,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
config;
|
|
23
|
-
constructor(config) {
|
|
24
|
-
this.config = config;
|
|
25
|
-
}
|
|
26
|
-
async isAvailable() {
|
|
27
|
-
// AI provider is not available in current version
|
|
28
|
-
// This will return true when AI is implemented
|
|
29
|
-
return this.config.enabled && !!this.config.apiKey;
|
|
30
|
-
}
|
|
31
|
-
async execute(request) {
|
|
32
|
-
const startTime = Date.now();
|
|
33
|
-
// Placeholder: Return error indicating AI is not implemented
|
|
34
|
-
return {
|
|
35
|
-
success: false,
|
|
36
|
-
exitCode: ExitCode.POLICY_BLOCKED,
|
|
37
|
-
meta: {
|
|
38
|
-
command: request.command,
|
|
39
|
-
duration: Date.now() - startTime,
|
|
40
|
-
timestamp: new Date().toISOString(),
|
|
41
|
-
version: this.version,
|
|
42
|
-
provider: this.name,
|
|
43
|
-
},
|
|
44
|
-
error: {
|
|
45
|
-
code: 'AI_NOT_IMPLEMENTED',
|
|
46
|
-
message: 'AI features are reserved for future releases. Use --provider=local for now.',
|
|
47
|
-
details: {
|
|
48
|
-
note: 'AI integration will be available in v2.1.0 without requiring any CLI changes',
|
|
49
|
-
alternative: 'Use --provider=local for local execution or --provider=remote for cloud execution',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
// AI-specific methods (to be implemented)
|
|
55
|
-
async generate(input, _context) {
|
|
56
|
-
if (!this.config.enabled) {
|
|
57
|
-
throw new Error('AI provider is not enabled');
|
|
58
|
-
}
|
|
59
|
-
// Placeholder implementation
|
|
60
|
-
return `AI generation not implemented. Input received: ${input.substring(0, 50)}...`;
|
|
61
|
-
}
|
|
62
|
-
async analyzeCode(_code, _language) {
|
|
63
|
-
if (!this.config.enabled) {
|
|
64
|
-
throw new Error('AI provider is not enabled');
|
|
65
|
-
}
|
|
66
|
-
// Placeholder implementation
|
|
67
|
-
return {
|
|
68
|
-
insights: ['AI code analysis not yet implemented'],
|
|
69
|
-
suggestions: ['Use --provider=local for current analysis capabilities'],
|
|
70
|
-
score: 0,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=ai-provider.js.map
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local Execution Provider
|
|
3
|
-
* Implements all logic locally without external AI services
|
|
4
|
-
*/
|
|
5
|
-
import { ExitCode } from '../core/exit-codes.js';
|
|
6
|
-
import * as fs from 'fs/promises';
|
|
7
|
-
import * as path from 'path';
|
|
8
|
-
import { loadConfig } from '../commands/auth.js';
|
|
9
|
-
import { SecureTokenStore } from '../auth/secure-auth.js';
|
|
10
|
-
export class LocalProvider {
|
|
11
|
-
name = 'local';
|
|
12
|
-
version = '2.0.0';
|
|
13
|
-
capabilities = {
|
|
14
|
-
commands: ['analyze', 'init', 'status', 'config', 'auth'],
|
|
15
|
-
features: {
|
|
16
|
-
json: true,
|
|
17
|
-
streaming: false,
|
|
18
|
-
caching: true,
|
|
19
|
-
ai: false,
|
|
20
|
-
},
|
|
21
|
-
constraints: {
|
|
22
|
-
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
23
|
-
maxFiles: 1000,
|
|
24
|
-
requiresAuth: false,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
config;
|
|
28
|
-
constructor(config) {
|
|
29
|
-
this.config = config;
|
|
30
|
-
}
|
|
31
|
-
async isAvailable() {
|
|
32
|
-
// Local provider is always available
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
async execute(request) {
|
|
36
|
-
const startTime = Date.now();
|
|
37
|
-
try {
|
|
38
|
-
switch (request.type) {
|
|
39
|
-
case 'analyze':
|
|
40
|
-
return await this.executeAnalyze(request);
|
|
41
|
-
case 'init':
|
|
42
|
-
return await this.executeInit(request);
|
|
43
|
-
case 'status':
|
|
44
|
-
return await this.executeStatus(request);
|
|
45
|
-
case 'config':
|
|
46
|
-
return await this.executeConfig(request);
|
|
47
|
-
case 'auth':
|
|
48
|
-
return await this.executeAuth(request);
|
|
49
|
-
default:
|
|
50
|
-
throw new Error(`Task type '${request.type}' not supported by local provider`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
return {
|
|
55
|
-
success: false,
|
|
56
|
-
exitCode: ExitCode.EXECUTION_ERROR,
|
|
57
|
-
meta: {
|
|
58
|
-
command: request.command,
|
|
59
|
-
duration: Date.now() - startTime,
|
|
60
|
-
timestamp: new Date().toISOString(),
|
|
61
|
-
version: this.version,
|
|
62
|
-
provider: this.name,
|
|
63
|
-
},
|
|
64
|
-
error: {
|
|
65
|
-
code: 'LOCAL_EXECUTION_ERROR',
|
|
66
|
-
message: error instanceof Error ? error.message : String(error),
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Analyze task execution
|
|
72
|
-
async executeAnalyze(request) {
|
|
73
|
-
const { targetPath, options } = request.payload;
|
|
74
|
-
// Discover files
|
|
75
|
-
const files = await this.discoverFiles(targetPath, {
|
|
76
|
-
include: ['**/*.{ts,tsx,js,jsx}'],
|
|
77
|
-
exclude: this.config.excludePatterns,
|
|
78
|
-
maxSize: options.maxSize,
|
|
79
|
-
});
|
|
80
|
-
// Analyze files
|
|
81
|
-
const findings = [];
|
|
82
|
-
let totalLines = 0;
|
|
83
|
-
let totalFunctions = 0;
|
|
84
|
-
let totalClasses = 0;
|
|
85
|
-
for (const file of files) {
|
|
86
|
-
const content = await fs.readFile(file, 'utf-8');
|
|
87
|
-
const lines = content.split('\n');
|
|
88
|
-
totalLines += lines.length;
|
|
89
|
-
// Simple heuristics
|
|
90
|
-
if (content.includes('function '))
|
|
91
|
-
totalFunctions++;
|
|
92
|
-
if (content.includes('class '))
|
|
93
|
-
totalClasses++;
|
|
94
|
-
// Find issues
|
|
95
|
-
if (content.includes('eval(')) {
|
|
96
|
-
findings.push({
|
|
97
|
-
file: path.relative(targetPath, file),
|
|
98
|
-
type: 'security',
|
|
99
|
-
severity: 'high',
|
|
100
|
-
message: 'Use of eval() detected',
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
if (content.includes('console.log')) {
|
|
104
|
-
findings.push({
|
|
105
|
-
file: path.relative(targetPath, file),
|
|
106
|
-
type: 'maintainability',
|
|
107
|
-
severity: 'low',
|
|
108
|
-
message: 'Console.log statement found',
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Generate report
|
|
113
|
-
const report = {
|
|
114
|
-
schema_version: '1.0',
|
|
115
|
-
engine_version: this.version,
|
|
116
|
-
created_at: new Date().toISOString(),
|
|
117
|
-
project: {
|
|
118
|
-
name: options.projectName || path.basename(targetPath),
|
|
119
|
-
path: targetPath,
|
|
120
|
-
},
|
|
121
|
-
summary: {
|
|
122
|
-
total: findings.length,
|
|
123
|
-
high: findings.filter(f => f.severity === 'high').length,
|
|
124
|
-
medium: findings.filter(f => f.severity === 'medium').length,
|
|
125
|
-
low: findings.filter(f => f.severity === 'low').length,
|
|
126
|
-
},
|
|
127
|
-
metrics: {
|
|
128
|
-
totalFiles: files.length,
|
|
129
|
-
totalLines,
|
|
130
|
-
totalFunctions,
|
|
131
|
-
totalClasses,
|
|
132
|
-
},
|
|
133
|
-
findings,
|
|
134
|
-
};
|
|
135
|
-
// Save report
|
|
136
|
-
const outputDir = path.resolve(options.output);
|
|
137
|
-
await fs.mkdir(outputDir, { recursive: true });
|
|
138
|
-
const reportFile = path.join(outputDir, `report-${Date.now()}.json`);
|
|
139
|
-
await fs.writeFile(reportFile, JSON.stringify(report, null, 2));
|
|
140
|
-
return {
|
|
141
|
-
success: true,
|
|
142
|
-
exitCode: ExitCode.SUCCESS,
|
|
143
|
-
meta: {
|
|
144
|
-
command: request.command,
|
|
145
|
-
duration: 0,
|
|
146
|
-
timestamp: new Date().toISOString(),
|
|
147
|
-
version: this.version,
|
|
148
|
-
provider: this.name,
|
|
149
|
-
},
|
|
150
|
-
data: {
|
|
151
|
-
report,
|
|
152
|
-
reportFile,
|
|
153
|
-
filesAnalyzed: files.length,
|
|
154
|
-
findings: findings.length,
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
// Init task execution
|
|
159
|
-
async executeInit(request) {
|
|
160
|
-
const { projectPath, template } = request.payload;
|
|
161
|
-
await fs.mkdir(projectPath, { recursive: true });
|
|
162
|
-
const config = {
|
|
163
|
-
name: path.basename(projectPath),
|
|
164
|
-
version: '1.0.0',
|
|
165
|
-
template,
|
|
166
|
-
type: 'default',
|
|
167
|
-
created_at: new Date().toISOString(),
|
|
168
|
-
};
|
|
169
|
-
const configPath = path.join(projectPath, 'delta.config.json');
|
|
170
|
-
await fs.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
171
|
-
return {
|
|
172
|
-
success: true,
|
|
173
|
-
exitCode: ExitCode.SUCCESS,
|
|
174
|
-
meta: {
|
|
175
|
-
command: request.command,
|
|
176
|
-
duration: 0,
|
|
177
|
-
timestamp: new Date().toISOString(),
|
|
178
|
-
version: this.version,
|
|
179
|
-
provider: this.name,
|
|
180
|
-
},
|
|
181
|
-
data: {
|
|
182
|
-
projectPath,
|
|
183
|
-
configPath,
|
|
184
|
-
template,
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
// Status task execution
|
|
189
|
-
async executeStatus(request) {
|
|
190
|
-
const { projectPath } = request.payload;
|
|
191
|
-
// Check config
|
|
192
|
-
const configPath = path.join(projectPath, 'delta.config.json');
|
|
193
|
-
let hasConfig = false;
|
|
194
|
-
try {
|
|
195
|
-
await fs.access(configPath);
|
|
196
|
-
hasConfig = true;
|
|
197
|
-
}
|
|
198
|
-
catch {
|
|
199
|
-
hasConfig = false;
|
|
200
|
-
}
|
|
201
|
-
// Check auth
|
|
202
|
-
const auth = await loadConfig();
|
|
203
|
-
const hasPat = await SecureTokenStore.hasTokens();
|
|
204
|
-
return {
|
|
205
|
-
success: true,
|
|
206
|
-
exitCode: ExitCode.SUCCESS,
|
|
207
|
-
meta: {
|
|
208
|
-
command: request.command,
|
|
209
|
-
duration: 0,
|
|
210
|
-
timestamp: new Date().toISOString(),
|
|
211
|
-
version: this.version,
|
|
212
|
-
provider: this.name,
|
|
213
|
-
},
|
|
214
|
-
data: {
|
|
215
|
-
project: {
|
|
216
|
-
path: projectPath,
|
|
217
|
-
hasConfig,
|
|
218
|
-
configPath: hasConfig ? configPath : null,
|
|
219
|
-
},
|
|
220
|
-
auth: {
|
|
221
|
-
authenticated: hasPat,
|
|
222
|
-
apiUrl: auth.apiUrl || 'default',
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
// Config task execution
|
|
228
|
-
async executeConfig(request) {
|
|
229
|
-
// Simple config management
|
|
230
|
-
return {
|
|
231
|
-
success: true,
|
|
232
|
-
exitCode: ExitCode.SUCCESS,
|
|
233
|
-
meta: {
|
|
234
|
-
command: request.command,
|
|
235
|
-
duration: 0,
|
|
236
|
-
timestamp: new Date().toISOString(),
|
|
237
|
-
version: this.version,
|
|
238
|
-
provider: this.name,
|
|
239
|
-
},
|
|
240
|
-
data: {
|
|
241
|
-
action: request.payload.action,
|
|
242
|
-
config: {},
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
// Auth task execution
|
|
247
|
-
async executeAuth(request) {
|
|
248
|
-
const { action } = request.payload;
|
|
249
|
-
return {
|
|
250
|
-
success: true,
|
|
251
|
-
exitCode: ExitCode.SUCCESS,
|
|
252
|
-
meta: {
|
|
253
|
-
command: request.command,
|
|
254
|
-
duration: 0,
|
|
255
|
-
timestamp: new Date().toISOString(),
|
|
256
|
-
version: this.version,
|
|
257
|
-
provider: this.name,
|
|
258
|
-
},
|
|
259
|
-
data: {
|
|
260
|
-
action,
|
|
261
|
-
authenticated: action === 'login',
|
|
262
|
-
},
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
// File discovery helper
|
|
266
|
-
async discoverFiles(rootPath, options) {
|
|
267
|
-
const files = [];
|
|
268
|
-
async function walk(dir) {
|
|
269
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
270
|
-
for (const entry of entries) {
|
|
271
|
-
const fullPath = path.join(dir, entry.name);
|
|
272
|
-
if (entry.isDirectory()) {
|
|
273
|
-
if (options.exclude.some(e => entry.name.includes(e)))
|
|
274
|
-
continue;
|
|
275
|
-
await walk(fullPath);
|
|
276
|
-
}
|
|
277
|
-
else if (entry.isFile()) {
|
|
278
|
-
// Simple pattern matching
|
|
279
|
-
const shouldInclude = options.include.some(pattern => {
|
|
280
|
-
if (pattern.includes('**')) {
|
|
281
|
-
const ext = pattern.replace('**/*', '');
|
|
282
|
-
return entry.name.endsWith(ext);
|
|
283
|
-
}
|
|
284
|
-
return entry.name.includes(pattern.replace('*', ''));
|
|
285
|
-
});
|
|
286
|
-
if (shouldInclude) {
|
|
287
|
-
try {
|
|
288
|
-
const stats = await fs.stat(fullPath);
|
|
289
|
-
if (stats.size <= options.maxSize) {
|
|
290
|
-
files.push(fullPath);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
catch {
|
|
294
|
-
// Skip files we can't stat
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
await walk(rootPath);
|
|
301
|
-
return files;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
//# sourceMappingURL=local-provider.js.map
|