@vee-stack/delta-cli 2.0.3 → 2.0.5
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/analyzer/commands/analyze.js +260 -0
- package/dist/analyzer/commands/config.js +83 -0
- package/dist/analyzer/commands/report.js +38 -0
- package/dist/analyzer/generators/report.generator.js +123 -0
- package/dist/analyzer/index.js +44 -0
- package/dist/analyzer/scanners/project.scanner.js +92 -0
- package/dist/analyzer/validators/contracts.validator.js +42 -0
- package/dist/analyzer/validators/maintainability.validator.js +40 -0
- package/dist/analyzer/validators/observability.validator.js +39 -0
- package/dist/analyzer/validators/performance.validator.js +42 -0
- package/dist/analyzer/validators/security.validator.js +66 -0
- package/dist/analyzer/validators/soc.validator.js +75 -0
- package/dist/apps/cli/src/analyzer/commands/analyze.js +256 -0
- package/dist/apps/cli/src/analyzer/commands/config.js +83 -0
- package/dist/apps/cli/src/analyzer/commands/report.js +38 -0
- package/dist/apps/cli/src/analyzer/generators/report.generator.js +123 -0
- package/dist/apps/cli/src/analyzer/index.js +44 -0
- package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +92 -0
- package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +42 -0
- package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +40 -0
- package/dist/apps/cli/src/analyzer/validators/observability.validator.js +39 -0
- package/dist/apps/cli/src/analyzer/validators/performance.validator.js +42 -0
- package/dist/apps/cli/src/analyzer/validators/security.validator.js +66 -0
- package/dist/apps/cli/src/analyzer/validators/soc.validator.js +75 -0
- package/dist/apps/cli/src/auth/secure-auth.js +312 -0
- package/dist/apps/cli/src/commands/analyze.js +286 -0
- package/dist/apps/cli/src/commands/auth-new.js +37 -0
- package/dist/apps/cli/src/commands/auth.js +122 -0
- package/dist/apps/cli/src/commands/config.js +49 -0
- package/dist/apps/cli/src/commands/deploy.js +6 -0
- package/dist/apps/cli/src/commands/init.js +47 -0
- package/dist/apps/cli/src/commands/logout.js +23 -0
- package/dist/apps/cli/src/commands/plugins.js +21 -0
- package/dist/apps/cli/src/commands/status.js +80 -0
- package/dist/apps/cli/src/commands/sync.js +6 -0
- package/dist/apps/cli/src/commands/whoami.js +115 -0
- package/dist/apps/cli/src/components/Dashboard.js +168 -0
- package/dist/apps/cli/src/components/DeltaApp.js +56 -0
- package/dist/apps/cli/src/components/UnifiedManager.js +324 -0
- package/dist/apps/cli/src/core/audit.js +184 -0
- package/dist/apps/cli/src/core/completion.js +294 -0
- package/dist/apps/cli/src/core/contracts.js +6 -0
- package/dist/apps/cli/src/core/engine.js +124 -0
- package/dist/apps/cli/src/core/exit-codes.js +71 -0
- package/dist/apps/cli/src/core/hooks.js +181 -0
- package/dist/apps/cli/src/core/index.js +7 -0
- package/dist/apps/cli/src/core/policy.js +115 -0
- package/dist/apps/cli/src/core/profiles.js +161 -0
- package/dist/apps/cli/src/core/wizard.js +203 -0
- package/dist/apps/cli/src/index.js +636 -0
- package/dist/apps/cli/src/interactive/index.js +11 -0
- package/dist/apps/cli/src/plugins/GitStatusPlugin.js +99 -0
- package/dist/apps/cli/src/providers/ai-provider.js +74 -0
- package/dist/apps/cli/src/providers/local-provider.js +302 -0
- package/dist/apps/cli/src/providers/remote-provider.js +100 -0
- package/dist/apps/cli/src/types/api.js +3 -0
- package/dist/apps/cli/src/ui.js +219 -0
- package/dist/apps/cli/src/welcome.js +81 -0
- package/dist/auth/secure-auth.js +418 -0
- package/dist/bundle.js +45 -46
- package/dist/commands/analyze.js +363 -0
- package/dist/commands/auth-new.js +37 -0
- package/dist/commands/auth.js +133 -0
- package/dist/commands/config.js +50 -0
- package/dist/commands/deploy.js +6 -0
- package/dist/commands/init.js +47 -0
- package/dist/commands/logout.js +30 -0
- package/dist/commands/plugins.js +21 -0
- package/dist/commands/status.js +82 -0
- package/dist/commands/sync.js +6 -0
- package/dist/commands/whoami.js +71 -0
- package/dist/components/Dashboard.js +169 -0
- package/dist/components/DeltaApp.js +57 -0
- package/dist/components/UnifiedManager.js +344 -0
- package/dist/core/audit.js +184 -0
- package/dist/core/completion.js +294 -0
- package/dist/core/contracts.js +6 -0
- package/dist/core/engine.js +124 -0
- package/dist/core/exit-codes.js +71 -0
- package/dist/core/hooks.js +181 -0
- package/dist/core/index.js +7 -0
- package/dist/core/policy.js +115 -0
- package/dist/core/profiles.js +161 -0
- package/dist/core/wizard.js +203 -0
- package/dist/index.js +387 -0
- package/dist/interactive/index.js +11 -0
- package/dist/packages/domain/src/constitution/contracts/index.js +43 -0
- package/dist/packages/domain/src/constitution/contracts/ts.rules.js +268 -0
- package/dist/packages/domain/src/constitution/index.js +139 -0
- package/dist/packages/domain/src/constitution/maintainability/index.js +43 -0
- package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +344 -0
- package/dist/packages/domain/src/constitution/observability/index.js +43 -0
- package/dist/packages/domain/src/constitution/observability/ts.rules.js +307 -0
- package/dist/packages/domain/src/constitution/performance/index.js +43 -0
- package/dist/packages/domain/src/constitution/performance/ts.rules.js +325 -0
- package/dist/packages/domain/src/constitution/security/index.js +50 -0
- package/dist/packages/domain/src/constitution/security/ts.rules.js +267 -0
- package/dist/packages/domain/src/constitution/soc/index.js +43 -0
- package/dist/packages/domain/src/constitution/soc/ts.rules.js +360 -0
- package/dist/packages/domain/src/contracts/analysis.contract.js +18 -0
- package/dist/packages/domain/src/contracts/index.js +7 -0
- package/dist/packages/domain/src/contracts/projects.contract.js +18 -0
- package/dist/packages/domain/src/control/registry/rules.registry.js +29 -0
- package/dist/packages/domain/src/control/schemas/policies.js +6 -0
- package/dist/packages/domain/src/core/analysis/discovery.js +163 -0
- package/dist/packages/domain/src/core/analysis/engine.contract.js +298 -0
- package/dist/packages/domain/src/core/analysis/engine.js +77 -0
- package/dist/packages/domain/src/core/analysis/index.js +14 -0
- package/dist/packages/domain/src/core/analysis/orchestrator.js +242 -0
- package/dist/packages/domain/src/core/comparison/engine.js +29 -0
- package/dist/packages/domain/src/core/comparison/index.js +5 -0
- package/dist/packages/domain/src/core/documentation/index.js +5 -0
- package/dist/packages/domain/src/core/documentation/pipeline.js +41 -0
- package/dist/packages/domain/src/core/fs/adapter.js +111 -0
- package/dist/packages/domain/src/core/fs/index.js +5 -0
- package/dist/packages/domain/src/core/parser/unified-parser.js +166 -0
- package/dist/packages/domain/src/index.js +33 -0
- package/dist/packages/domain/src/plugin/registry.js +195 -0
- package/dist/packages/domain/src/plugin/types.js +6 -0
- package/dist/packages/domain/src/ports/analysis.engine.js +7 -0
- package/dist/packages/domain/src/ports/audit.logger.js +7 -0
- package/dist/packages/domain/src/ports/project.repository.js +7 -0
- package/dist/packages/domain/src/rules/index.js +134 -0
- package/dist/packages/domain/src/types/analysis.js +6 -0
- package/dist/packages/domain/src/types/errors.js +53 -0
- package/dist/packages/domain/src/types/fs.js +6 -0
- package/dist/packages/domain/src/types/index.js +7 -0
- package/dist/plugins/GitStatusPlugin.js +93 -0
- package/dist/providers/ai-provider.js +74 -0
- package/dist/providers/local-provider.js +304 -0
- package/dist/providers/remote-provider.js +100 -0
- package/dist/types/api.js +3 -0
- package/dist/ui.js +219 -0
- package/dist/welcome.js +81 -0
- package/package.json +18 -18
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delta Constitution - Contracts Rules
|
|
3
|
+
* @description Contract standards and API interface definitions
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
* @see docs/architecture/CONSTITUTION.md
|
|
6
|
+
*/
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// CONTRACTS RULE DEFINITIONS
|
|
9
|
+
// =============================================================================
|
|
10
|
+
export const ContractsRules = {
|
|
11
|
+
version: '1.0.0',
|
|
12
|
+
lastUpdated: '2026-02-10',
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// 1. CONTRACT REQUIREMENTS
|
|
15
|
+
// ============================================================================
|
|
16
|
+
requirements: {
|
|
17
|
+
enabled: true,
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'Every Module must have a corresponding Contract',
|
|
20
|
+
requiredContracts: [
|
|
21
|
+
{
|
|
22
|
+
name: 'AuthContract',
|
|
23
|
+
file: 'src/contracts/auth.contract.ts',
|
|
24
|
+
module: 'src/modules/auth/',
|
|
25
|
+
features: ['src/features/auth/'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'UploadContract',
|
|
29
|
+
file: 'src/contracts/upload.contract.ts',
|
|
30
|
+
module: 'src/modules/upload/',
|
|
31
|
+
features: ['src/features/upload/'],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'ProjectsContract',
|
|
35
|
+
file: 'src/contracts/projects.contract.ts',
|
|
36
|
+
module: 'src/modules/projects/',
|
|
37
|
+
features: ['src/features/projects/'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'AnalysisContract',
|
|
41
|
+
file: 'src/contracts/analysis.contract.ts',
|
|
42
|
+
module: 'src/modules/analysis/',
|
|
43
|
+
features: ['src/features/dashboard/'],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
rules: [
|
|
47
|
+
{
|
|
48
|
+
id: 'CONTRACT-001',
|
|
49
|
+
name: 'One Contract Per Module',
|
|
50
|
+
description: 'Every module must export a corresponding contract',
|
|
51
|
+
severity: 'error',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'CONTRACT-002',
|
|
55
|
+
name: 'Features Use Contracts Only',
|
|
56
|
+
description: 'Features can only import from Contracts, not Modules directly',
|
|
57
|
+
severity: 'error',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// 2. CONTRACT STRUCTURE
|
|
63
|
+
// ============================================================================
|
|
64
|
+
structure: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
required: true,
|
|
67
|
+
description: 'Standard contract file structure',
|
|
68
|
+
requiredSections: {
|
|
69
|
+
header: {
|
|
70
|
+
description: 'JSDoc header with version and stability',
|
|
71
|
+
template: `
|
|
72
|
+
/**
|
|
73
|
+
* [Name] Contract v[version]
|
|
74
|
+
* @description [Description]
|
|
75
|
+
* @version [major].[minor].[patch]
|
|
76
|
+
* @stability [stable|experimental|deprecated]
|
|
77
|
+
*/`,
|
|
78
|
+
},
|
|
79
|
+
inputContracts: {
|
|
80
|
+
description: 'Input interfaces and types',
|
|
81
|
+
naming: '[Action]Input',
|
|
82
|
+
example: 'InitUploadInput, UploadChunkInput',
|
|
83
|
+
},
|
|
84
|
+
outputContracts: {
|
|
85
|
+
description: 'Output interfaces and types',
|
|
86
|
+
naming: '[Action]Output or [Entity]',
|
|
87
|
+
example: 'UploadSession, UploadResult',
|
|
88
|
+
},
|
|
89
|
+
errorContracts: {
|
|
90
|
+
description: 'Error types and codes',
|
|
91
|
+
required: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
example: `
|
|
95
|
+
/**
|
|
96
|
+
* Upload Contract v1.0.0
|
|
97
|
+
* @description Public API for File Upload operations
|
|
98
|
+
* @version 1.0.0
|
|
99
|
+
* @stability stable
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
// Input Contracts
|
|
103
|
+
export interface InitUploadInput {
|
|
104
|
+
filename: string;
|
|
105
|
+
fileSize: number;
|
|
106
|
+
// ...
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Output Contracts
|
|
110
|
+
export interface UploadSession {
|
|
111
|
+
id: string;
|
|
112
|
+
status: 'initializing' | 'uploading' | 'completed';
|
|
113
|
+
// ...
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Error Contracts
|
|
117
|
+
export interface UploadError {
|
|
118
|
+
code: string;
|
|
119
|
+
message: string;
|
|
120
|
+
statusCode: number;
|
|
121
|
+
}
|
|
122
|
+
`,
|
|
123
|
+
},
|
|
124
|
+
// ============================================================================
|
|
125
|
+
// 3. VERSIONING
|
|
126
|
+
// ============================================================================
|
|
127
|
+
versioning: {
|
|
128
|
+
enabled: true,
|
|
129
|
+
required: true,
|
|
130
|
+
description: 'Semantic versioning for contracts',
|
|
131
|
+
scheme: 'semver',
|
|
132
|
+
rules: {
|
|
133
|
+
major: {
|
|
134
|
+
bump: 'Breaking changes',
|
|
135
|
+
examples: [
|
|
136
|
+
'Removing or renaming interfaces',
|
|
137
|
+
'Changing required fields',
|
|
138
|
+
'Changing behavior significantly',
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
minor: {
|
|
142
|
+
bump: 'New features, backwards compatible',
|
|
143
|
+
examples: ['Adding optional fields', 'Adding new interfaces', 'Extending functionality'],
|
|
144
|
+
},
|
|
145
|
+
patch: {
|
|
146
|
+
bump: 'Bug fixes, documentation',
|
|
147
|
+
examples: ['Fixing types', 'Documentation updates', 'Non-breaking corrections'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
stability: {
|
|
151
|
+
stable: 'Production ready, no breaking changes expected',
|
|
152
|
+
experimental: 'May change, not recommended for production',
|
|
153
|
+
deprecated: 'Will be removed in next major version',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
// ============================================================================
|
|
157
|
+
// 4. INTERFACE DESIGN
|
|
158
|
+
// ============================================================================
|
|
159
|
+
interfaceDesign: {
|
|
160
|
+
enabled: true,
|
|
161
|
+
required: true,
|
|
162
|
+
description: 'Best practices for contract interfaces',
|
|
163
|
+
naming: {
|
|
164
|
+
inputs: '[Action]Input',
|
|
165
|
+
outputs: '[Action]Output or descriptive noun',
|
|
166
|
+
errors: '[Domain]Error',
|
|
167
|
+
enums: 'PascalCase',
|
|
168
|
+
},
|
|
169
|
+
requiredFields: {
|
|
170
|
+
id: 'Unique identifier for tracking',
|
|
171
|
+
timestamp: 'ISO 8601 timestamp',
|
|
172
|
+
userId: 'Actor who performed the action',
|
|
173
|
+
},
|
|
174
|
+
optionalFields: {
|
|
175
|
+
metadata: 'Additional context (key-value)',
|
|
176
|
+
tags: 'Labels for categorization',
|
|
177
|
+
},
|
|
178
|
+
documentation: {
|
|
179
|
+
required: true,
|
|
180
|
+
format: 'JSDoc',
|
|
181
|
+
content: 'Purpose, type, examples for each field',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
// ============================================================================
|
|
185
|
+
// 5. VALIDATION
|
|
186
|
+
// ============================================================================
|
|
187
|
+
validation: {
|
|
188
|
+
enabled: true,
|
|
189
|
+
required: true,
|
|
190
|
+
description: 'Contract input validation requirements',
|
|
191
|
+
schemas: {
|
|
192
|
+
required: true,
|
|
193
|
+
tool: 'Zod',
|
|
194
|
+
location: 'Contracts must include Zod schemas',
|
|
195
|
+
},
|
|
196
|
+
runtime: {
|
|
197
|
+
description: 'Validate at runtime using Zod',
|
|
198
|
+
pattern: 'parse() or safeParse()',
|
|
199
|
+
},
|
|
200
|
+
compileTime: {
|
|
201
|
+
description: 'TypeScript types from Zod schemas',
|
|
202
|
+
pattern: 'z.infer<typeof Schema>',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
// ============================================================================
|
|
206
|
+
// 6. BREAKING CHANGES
|
|
207
|
+
// ============================================================================
|
|
208
|
+
breakingChanges: {
|
|
209
|
+
enabled: true,
|
|
210
|
+
required: true,
|
|
211
|
+
description: 'Handling breaking changes in contracts',
|
|
212
|
+
policy: {
|
|
213
|
+
deprecation: 'Mark old contract as deprecated for 1 major version',
|
|
214
|
+
migration: 'Provide migration guide',
|
|
215
|
+
coexistence: 'Support both versions during transition period',
|
|
216
|
+
},
|
|
217
|
+
process: [
|
|
218
|
+
'1. Mark current contract as @deprecated',
|
|
219
|
+
'2. Create new contract with v[major+1]',
|
|
220
|
+
'3. Update all consumers gradually',
|
|
221
|
+
'4. Remove deprecated contract in next major release',
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
export function validateContract(check) {
|
|
226
|
+
const violations = [];
|
|
227
|
+
let score = 100;
|
|
228
|
+
if (!check.hasVersion) {
|
|
229
|
+
violations.push('CONTRACT-STRUCT-001: Missing version in contract header');
|
|
230
|
+
score -= 15;
|
|
231
|
+
}
|
|
232
|
+
if (!check.hasStability) {
|
|
233
|
+
violations.push('CONTRACT-STRUCT-002: Missing stability annotation');
|
|
234
|
+
score -= 10;
|
|
235
|
+
}
|
|
236
|
+
if (!check.hasInputContracts) {
|
|
237
|
+
violations.push('CONTRACT-STRUCT-003: Missing input contracts');
|
|
238
|
+
score -= 20;
|
|
239
|
+
}
|
|
240
|
+
if (!check.hasOutputContracts) {
|
|
241
|
+
violations.push('CONTRACT-STRUCT-004: Missing output contracts');
|
|
242
|
+
score -= 20;
|
|
243
|
+
}
|
|
244
|
+
if (!check.hasErrorContracts) {
|
|
245
|
+
violations.push('CONTRACT-STRUCT-005: Missing error contracts');
|
|
246
|
+
score -= 15;
|
|
247
|
+
}
|
|
248
|
+
if (!check.hasZodSchemas) {
|
|
249
|
+
violations.push('CONTRACT-VALID-001: Missing Zod validation schemas');
|
|
250
|
+
score -= 20;
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
valid: violations.length === 0,
|
|
254
|
+
violations,
|
|
255
|
+
score: Math.max(0, score),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
export function checkContractCoverage(existingContracts, requiredContracts) {
|
|
259
|
+
const missing = requiredContracts.filter(required => !existingContracts.some(existing => existing.includes(required)));
|
|
260
|
+
const percentage = Math.round(((requiredContracts.length - missing.length) / requiredContracts.length) * 100);
|
|
261
|
+
return {
|
|
262
|
+
complete: missing.length === 0,
|
|
263
|
+
missing,
|
|
264
|
+
percentage,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
export default ContractsRules;
|
|
268
|
+
//# sourceMappingURL=ts.rules.js.map
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delta Constitution
|
|
3
|
+
* @description The 7 Axes of Delta Architecture - Multi-language support
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
* @see docs/architecture/CONSTITUTION.md
|
|
6
|
+
*
|
|
7
|
+
* This module exports all constitutional rules for analyzing projects
|
|
8
|
+
* against the Delta Architecture standards.
|
|
9
|
+
*/
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// 7 AXES EXPORTS
|
|
12
|
+
// =============================================================================
|
|
13
|
+
export * as Security from './security';
|
|
14
|
+
export * as Performance from './performance';
|
|
15
|
+
export * as Soc from './soc';
|
|
16
|
+
export * as Contracts from './contracts';
|
|
17
|
+
export * as Maintainability from './maintainability';
|
|
18
|
+
export * as Observability from './observability';
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// 7 AXES METADATA
|
|
21
|
+
// =============================================================================
|
|
22
|
+
export const SevenAxes = [
|
|
23
|
+
{
|
|
24
|
+
name: 'Security',
|
|
25
|
+
weight: 25,
|
|
26
|
+
description: 'Policy-driven, Fail-Closed, Audit, Rate Limiting',
|
|
27
|
+
critical: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Performance',
|
|
31
|
+
weight: 20,
|
|
32
|
+
description: 'Lazy Loading, Caching, Code Splitting',
|
|
33
|
+
critical: false,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'Separation of Concerns',
|
|
37
|
+
weight: 20,
|
|
38
|
+
description: 'Layer boundaries, import rules, locality',
|
|
39
|
+
critical: true,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Contracts',
|
|
43
|
+
weight: 15,
|
|
44
|
+
description: 'Type-safe, versioned interfaces',
|
|
45
|
+
critical: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Maintainability',
|
|
49
|
+
weight: 10,
|
|
50
|
+
description: 'Tests, Docs, Pure Functions',
|
|
51
|
+
critical: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Observability',
|
|
55
|
+
weight: 5,
|
|
56
|
+
description: 'Health Checks, Logging, Metrics',
|
|
57
|
+
critical: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Best Practices',
|
|
61
|
+
weight: 5,
|
|
62
|
+
description: 'Clean Architecture, Stateless Core',
|
|
63
|
+
critical: false,
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
// =============================================================================
|
|
67
|
+
// SUPPORTED LANGUAGES
|
|
68
|
+
// =============================================================================
|
|
69
|
+
export const SupportedLanguages = [
|
|
70
|
+
{
|
|
71
|
+
code: 'ts',
|
|
72
|
+
name: 'TypeScript',
|
|
73
|
+
extension: '.ts',
|
|
74
|
+
runtime: 'Node.js',
|
|
75
|
+
status: 'stable',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
code: 'js',
|
|
79
|
+
name: 'JavaScript',
|
|
80
|
+
extension: '.js',
|
|
81
|
+
runtime: 'Node.js',
|
|
82
|
+
status: 'stable',
|
|
83
|
+
},
|
|
84
|
+
// Future support:
|
|
85
|
+
// { code: 'py', name: 'Python', extension: '.py', runtime: 'CPython', status: 'planned' },
|
|
86
|
+
// { code: 'java', name: 'Java', extension: '.java', runtime: 'JVM', status: 'planned' },
|
|
87
|
+
// { code: 'cs', name: 'C#', extension: '.cs', runtime: '.NET', status: 'planned' },
|
|
88
|
+
// { code: 'go', name: 'Go', extension: '.go', runtime: 'Go', status: 'planned' },
|
|
89
|
+
];
|
|
90
|
+
// =============================================================================
|
|
91
|
+
// CONSTITUTION VERSION
|
|
92
|
+
// =============================================================================
|
|
93
|
+
export const ConstitutionVersion = {
|
|
94
|
+
major: 1,
|
|
95
|
+
minor: 0,
|
|
96
|
+
patch: 0,
|
|
97
|
+
full: '1.0.0',
|
|
98
|
+
date: '2026-02-10',
|
|
99
|
+
status: 'stable',
|
|
100
|
+
};
|
|
101
|
+
export function calculateOverallScore(axisScores) {
|
|
102
|
+
const totalWeight = SevenAxes.reduce((sum, axis) => sum + axis.weight, 0);
|
|
103
|
+
let weightedScore = 0;
|
|
104
|
+
SevenAxes.forEach(axis => {
|
|
105
|
+
const score = axisScores[axis.name] || 0;
|
|
106
|
+
weightedScore += (score * axis.weight) / 100;
|
|
107
|
+
});
|
|
108
|
+
const percentage = Math.round((weightedScore / totalWeight) * 100);
|
|
109
|
+
const grade = percentage >= 90
|
|
110
|
+
? 'A'
|
|
111
|
+
: percentage >= 80
|
|
112
|
+
? 'B'
|
|
113
|
+
: percentage >= 70
|
|
114
|
+
? 'C'
|
|
115
|
+
: percentage >= 60
|
|
116
|
+
? 'D'
|
|
117
|
+
: 'F';
|
|
118
|
+
return { total: weightedScore, percentage, grade };
|
|
119
|
+
}
|
|
120
|
+
export function getRulesForLanguage(_language) {
|
|
121
|
+
// Language-specific rules can be loaded from axis subdirectories
|
|
122
|
+
// e.g., Security.ts, Performance.ts, etc.
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
export function isLanguageSupported(language) {
|
|
126
|
+
return SupportedLanguages.some(lang => lang.code === language.toLowerCase() || lang.name.toLowerCase() === language.toLowerCase());
|
|
127
|
+
}
|
|
128
|
+
// =============================================================================
|
|
129
|
+
// DEFAULT EXPORT
|
|
130
|
+
// =============================================================================
|
|
131
|
+
export default {
|
|
132
|
+
version: ConstitutionVersion,
|
|
133
|
+
axes: SevenAxes,
|
|
134
|
+
languages: SupportedLanguages,
|
|
135
|
+
calculateOverallScore,
|
|
136
|
+
getRulesForLanguage,
|
|
137
|
+
isLanguageSupported,
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delta Constitution - Maintainability Rules Index
|
|
3
|
+
* @description Maintainability rules for all supported languages
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
// TypeScript / Node.js Rules
|
|
7
|
+
export { default as ts, MaintainabilityRules as TSMaintainabilityRules } from './ts.rules';
|
|
8
|
+
// Language-agnostic exports
|
|
9
|
+
export const MaintainabilityAxis = {
|
|
10
|
+
name: 'Maintainability',
|
|
11
|
+
description: 'Locality of Behavior, Tests, Docs, Pure Functions',
|
|
12
|
+
weight: 10,
|
|
13
|
+
languages: ['typescript', 'javascript', 'node'],
|
|
14
|
+
principles: [
|
|
15
|
+
{
|
|
16
|
+
id: 'MAINT-001',
|
|
17
|
+
name: 'Locality of Behavior',
|
|
18
|
+
description: 'All related code in one place',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'MAINT-002',
|
|
22
|
+
name: 'Testing',
|
|
23
|
+
description: 'Unit ≥80%, Integration ≥60%, E2E ≥30% coverage',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'MAINT-003',
|
|
27
|
+
name: 'Documentation',
|
|
28
|
+
description: 'JSDoc, READMEs, Blueprints for every layer',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'MAINT-004',
|
|
32
|
+
name: 'Pure Functions',
|
|
33
|
+
description: 'Core uses pure functions only',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'MAINT-005',
|
|
37
|
+
name: 'Code Quality',
|
|
38
|
+
description: 'Linting, formatting, complexity limits',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
export default MaintainabilityAxis;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|