@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.
Files changed (135) hide show
  1. package/dist/analyzer/commands/analyze.js +260 -0
  2. package/dist/analyzer/commands/config.js +83 -0
  3. package/dist/analyzer/commands/report.js +38 -0
  4. package/dist/analyzer/generators/report.generator.js +123 -0
  5. package/dist/analyzer/index.js +44 -0
  6. package/dist/analyzer/scanners/project.scanner.js +92 -0
  7. package/dist/analyzer/validators/contracts.validator.js +42 -0
  8. package/dist/analyzer/validators/maintainability.validator.js +40 -0
  9. package/dist/analyzer/validators/observability.validator.js +39 -0
  10. package/dist/analyzer/validators/performance.validator.js +42 -0
  11. package/dist/analyzer/validators/security.validator.js +66 -0
  12. package/dist/analyzer/validators/soc.validator.js +75 -0
  13. package/dist/apps/cli/src/analyzer/commands/analyze.js +256 -0
  14. package/dist/apps/cli/src/analyzer/commands/config.js +83 -0
  15. package/dist/apps/cli/src/analyzer/commands/report.js +38 -0
  16. package/dist/apps/cli/src/analyzer/generators/report.generator.js +123 -0
  17. package/dist/apps/cli/src/analyzer/index.js +44 -0
  18. package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +92 -0
  19. package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +42 -0
  20. package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +40 -0
  21. package/dist/apps/cli/src/analyzer/validators/observability.validator.js +39 -0
  22. package/dist/apps/cli/src/analyzer/validators/performance.validator.js +42 -0
  23. package/dist/apps/cli/src/analyzer/validators/security.validator.js +66 -0
  24. package/dist/apps/cli/src/analyzer/validators/soc.validator.js +75 -0
  25. package/dist/apps/cli/src/auth/secure-auth.js +312 -0
  26. package/dist/apps/cli/src/commands/analyze.js +286 -0
  27. package/dist/apps/cli/src/commands/auth-new.js +37 -0
  28. package/dist/apps/cli/src/commands/auth.js +122 -0
  29. package/dist/apps/cli/src/commands/config.js +49 -0
  30. package/dist/apps/cli/src/commands/deploy.js +6 -0
  31. package/dist/apps/cli/src/commands/init.js +47 -0
  32. package/dist/apps/cli/src/commands/logout.js +23 -0
  33. package/dist/apps/cli/src/commands/plugins.js +21 -0
  34. package/dist/apps/cli/src/commands/status.js +80 -0
  35. package/dist/apps/cli/src/commands/sync.js +6 -0
  36. package/dist/apps/cli/src/commands/whoami.js +115 -0
  37. package/dist/apps/cli/src/components/Dashboard.js +168 -0
  38. package/dist/apps/cli/src/components/DeltaApp.js +56 -0
  39. package/dist/apps/cli/src/components/UnifiedManager.js +324 -0
  40. package/dist/apps/cli/src/core/audit.js +184 -0
  41. package/dist/apps/cli/src/core/completion.js +294 -0
  42. package/dist/apps/cli/src/core/contracts.js +6 -0
  43. package/dist/apps/cli/src/core/engine.js +124 -0
  44. package/dist/apps/cli/src/core/exit-codes.js +71 -0
  45. package/dist/apps/cli/src/core/hooks.js +181 -0
  46. package/dist/apps/cli/src/core/index.js +7 -0
  47. package/dist/apps/cli/src/core/policy.js +115 -0
  48. package/dist/apps/cli/src/core/profiles.js +161 -0
  49. package/dist/apps/cli/src/core/wizard.js +203 -0
  50. package/dist/apps/cli/src/index.js +636 -0
  51. package/dist/apps/cli/src/interactive/index.js +11 -0
  52. package/dist/apps/cli/src/plugins/GitStatusPlugin.js +99 -0
  53. package/dist/apps/cli/src/providers/ai-provider.js +74 -0
  54. package/dist/apps/cli/src/providers/local-provider.js +302 -0
  55. package/dist/apps/cli/src/providers/remote-provider.js +100 -0
  56. package/dist/apps/cli/src/types/api.js +3 -0
  57. package/dist/apps/cli/src/ui.js +219 -0
  58. package/dist/apps/cli/src/welcome.js +81 -0
  59. package/dist/auth/secure-auth.js +418 -0
  60. package/dist/bundle.js +45 -46
  61. package/dist/commands/analyze.js +363 -0
  62. package/dist/commands/auth-new.js +37 -0
  63. package/dist/commands/auth.js +133 -0
  64. package/dist/commands/config.js +50 -0
  65. package/dist/commands/deploy.js +6 -0
  66. package/dist/commands/init.js +47 -0
  67. package/dist/commands/logout.js +30 -0
  68. package/dist/commands/plugins.js +21 -0
  69. package/dist/commands/status.js +82 -0
  70. package/dist/commands/sync.js +6 -0
  71. package/dist/commands/whoami.js +71 -0
  72. package/dist/components/Dashboard.js +169 -0
  73. package/dist/components/DeltaApp.js +57 -0
  74. package/dist/components/UnifiedManager.js +344 -0
  75. package/dist/core/audit.js +184 -0
  76. package/dist/core/completion.js +294 -0
  77. package/dist/core/contracts.js +6 -0
  78. package/dist/core/engine.js +124 -0
  79. package/dist/core/exit-codes.js +71 -0
  80. package/dist/core/hooks.js +181 -0
  81. package/dist/core/index.js +7 -0
  82. package/dist/core/policy.js +115 -0
  83. package/dist/core/profiles.js +161 -0
  84. package/dist/core/wizard.js +203 -0
  85. package/dist/index.js +387 -0
  86. package/dist/interactive/index.js +11 -0
  87. package/dist/packages/domain/src/constitution/contracts/index.js +43 -0
  88. package/dist/packages/domain/src/constitution/contracts/ts.rules.js +268 -0
  89. package/dist/packages/domain/src/constitution/index.js +139 -0
  90. package/dist/packages/domain/src/constitution/maintainability/index.js +43 -0
  91. package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +344 -0
  92. package/dist/packages/domain/src/constitution/observability/index.js +43 -0
  93. package/dist/packages/domain/src/constitution/observability/ts.rules.js +307 -0
  94. package/dist/packages/domain/src/constitution/performance/index.js +43 -0
  95. package/dist/packages/domain/src/constitution/performance/ts.rules.js +325 -0
  96. package/dist/packages/domain/src/constitution/security/index.js +50 -0
  97. package/dist/packages/domain/src/constitution/security/ts.rules.js +267 -0
  98. package/dist/packages/domain/src/constitution/soc/index.js +43 -0
  99. package/dist/packages/domain/src/constitution/soc/ts.rules.js +360 -0
  100. package/dist/packages/domain/src/contracts/analysis.contract.js +18 -0
  101. package/dist/packages/domain/src/contracts/index.js +7 -0
  102. package/dist/packages/domain/src/contracts/projects.contract.js +18 -0
  103. package/dist/packages/domain/src/control/registry/rules.registry.js +29 -0
  104. package/dist/packages/domain/src/control/schemas/policies.js +6 -0
  105. package/dist/packages/domain/src/core/analysis/discovery.js +163 -0
  106. package/dist/packages/domain/src/core/analysis/engine.contract.js +298 -0
  107. package/dist/packages/domain/src/core/analysis/engine.js +77 -0
  108. package/dist/packages/domain/src/core/analysis/index.js +14 -0
  109. package/dist/packages/domain/src/core/analysis/orchestrator.js +242 -0
  110. package/dist/packages/domain/src/core/comparison/engine.js +29 -0
  111. package/dist/packages/domain/src/core/comparison/index.js +5 -0
  112. package/dist/packages/domain/src/core/documentation/index.js +5 -0
  113. package/dist/packages/domain/src/core/documentation/pipeline.js +41 -0
  114. package/dist/packages/domain/src/core/fs/adapter.js +111 -0
  115. package/dist/packages/domain/src/core/fs/index.js +5 -0
  116. package/dist/packages/domain/src/core/parser/unified-parser.js +166 -0
  117. package/dist/packages/domain/src/index.js +33 -0
  118. package/dist/packages/domain/src/plugin/registry.js +195 -0
  119. package/dist/packages/domain/src/plugin/types.js +6 -0
  120. package/dist/packages/domain/src/ports/analysis.engine.js +7 -0
  121. package/dist/packages/domain/src/ports/audit.logger.js +7 -0
  122. package/dist/packages/domain/src/ports/project.repository.js +7 -0
  123. package/dist/packages/domain/src/rules/index.js +134 -0
  124. package/dist/packages/domain/src/types/analysis.js +6 -0
  125. package/dist/packages/domain/src/types/errors.js +53 -0
  126. package/dist/packages/domain/src/types/fs.js +6 -0
  127. package/dist/packages/domain/src/types/index.js +7 -0
  128. package/dist/plugins/GitStatusPlugin.js +93 -0
  129. package/dist/providers/ai-provider.js +74 -0
  130. package/dist/providers/local-provider.js +304 -0
  131. package/dist/providers/remote-provider.js +100 -0
  132. package/dist/types/api.js +3 -0
  133. package/dist/ui.js +219 -0
  134. package/dist/welcome.js +81 -0
  135. package/package.json +18 -18
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Delta Constitution - Separation of Concerns Rules Index
3
+ * @description SoC rules for all supported languages
4
+ * @version 1.0.0
5
+ */
6
+ // TypeScript / Node.js Rules
7
+ export { default as ts, SocRules as TSSocRules } from './ts.rules';
8
+ // Language-agnostic exports
9
+ export const SocAxis = {
10
+ name: 'Separation of Concerns',
11
+ description: 'Clear layer boundaries, import rules, locality of behavior',
12
+ weight: 20,
13
+ languages: ['typescript', 'javascript', 'node'],
14
+ principles: [
15
+ {
16
+ id: 'SOC-001',
17
+ name: '7-Layer Architecture',
18
+ description: 'Entry → Features → Contracts → Modules → Core → Lib → Infrastructure',
19
+ },
20
+ {
21
+ id: 'SOC-002',
22
+ name: 'Import Direction',
23
+ description: 'Dependencies flow downwards only',
24
+ },
25
+ {
26
+ id: 'SOC-003',
27
+ name: 'Feature Structure',
28
+ description: 'Standard structure: components/, hooks/, services/',
29
+ },
30
+ {
31
+ id: 'SOC-004',
32
+ name: 'Core Principles',
33
+ description: 'Core: No UI deps, No side effects, Stateless',
34
+ },
35
+ {
36
+ id: 'SOC-005',
37
+ name: 'Locality of Behavior',
38
+ description: 'All related code in one place',
39
+ },
40
+ ],
41
+ };
42
+ export default SocAxis;
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,360 @@
1
+ /**
2
+ * Delta Constitution - Separation of Concerns (SoC) Rules
3
+ * @description Layer boundaries and architectural separation standards
4
+ * @version 1.0.0
5
+ * @see docs/architecture/CONSTITUTION.md
6
+ */
7
+ // =============================================================================
8
+ // SEPARATION OF CONCERNS RULE DEFINITIONS
9
+ // =============================================================================
10
+ export const SocRules = {
11
+ version: '1.0.0',
12
+ lastUpdated: '2026-02-10',
13
+ // ============================================================================
14
+ // 1. LAYER ARCHITECTURE
15
+ // ============================================================================
16
+ layers: {
17
+ enabled: true,
18
+ required: true,
19
+ description: '7-layer architecture with clear boundaries',
20
+ definitions: [
21
+ {
22
+ id: 'L1',
23
+ name: 'Entry Points',
24
+ path: 'src/cli/, src/app/',
25
+ responsibility: 'CLI tools, web pages, API routes',
26
+ canImportFrom: ['features', 'modules'],
27
+ cannotImportFrom: ['core', 'lib', 'infrastructure'],
28
+ examples: ['Next.js pages', 'CLI commands', 'API routes'],
29
+ },
30
+ {
31
+ id: 'L2',
32
+ name: 'Features',
33
+ path: 'src/features/',
34
+ responsibility: 'UI components, hooks, feature services',
35
+ canImportFrom: ['contracts', 'types'],
36
+ cannotImportFrom: ['core', 'modules', 'lib'],
37
+ examples: ['auth/', 'dashboard/', 'upload/', 'projects/'],
38
+ },
39
+ {
40
+ id: 'L3',
41
+ name: 'Contracts',
42
+ path: 'src/contracts/',
43
+ responsibility: 'Public API interfaces between layers',
44
+ canImportFrom: ['types'],
45
+ cannotImportFrom: ['features', 'modules', 'core', 'implementation'],
46
+ examples: ['auth.contract.ts', 'upload.contract.ts'],
47
+ },
48
+ {
49
+ id: 'L4',
50
+ name: 'Modules',
51
+ path: 'src/modules/',
52
+ responsibility: 'Business logic, policies, orchestration',
53
+ canImportFrom: ['core', 'lib', 'security'],
54
+ cannotImportFrom: ['features', 'contracts', 'entry points'],
55
+ examples: ['auth/', 'analysis/', 'upload/', 'projects/'],
56
+ },
57
+ {
58
+ id: 'L5',
59
+ name: 'Core',
60
+ path: 'src/core/',
61
+ responsibility: 'Pure domain logic, stateless functions',
62
+ canImportFrom: ['lib', 'types'],
63
+ cannotImportFrom: ['features', 'modules', 'contracts', 'entry points'],
64
+ examples: ['analysis/', 'comparison/', 'parser/', 'documentation/'],
65
+ },
66
+ {
67
+ id: 'L6',
68
+ name: 'Library',
69
+ path: 'src/lib/',
70
+ responsibility: 'Infrastructure adapters, utilities',
71
+ canImportFrom: ['types'],
72
+ cannotImportFrom: ['core', 'modules', 'features'],
73
+ examples: ['parser/', 'logger/', 'cache/', 'db/'],
74
+ },
75
+ {
76
+ id: 'L7',
77
+ name: 'Infrastructure',
78
+ path: 'src/infrastructure/',
79
+ responsibility: 'External services, database, cache',
80
+ canImportFrom: ['lib', 'config'],
81
+ cannotImportFrom: ['core', 'modules', 'features', 'business logic'],
82
+ examples: ['db/', 'cache/', 'storage/'],
83
+ },
84
+ ],
85
+ security: {
86
+ id: 'L-Security',
87
+ name: 'Security',
88
+ path: 'src/security/',
89
+ responsibility: 'Cross-cutting security concerns',
90
+ scope: 'all layers',
91
+ examples: ['audit/', 'policy-enforcement/', 'rate-limit/'],
92
+ },
93
+ },
94
+ // ============================================================================
95
+ // 2. IMPORT RULES
96
+ // ============================================================================
97
+ importRules: {
98
+ enabled: true,
99
+ required: true,
100
+ description: 'Strict import direction and boundaries',
101
+ direction: 'downwards only',
102
+ matrix: {
103
+ 'Entry Points': {
104
+ canImport: ['features', 'modules'],
105
+ cannotImport: ['core', 'lib', 'infrastructure'],
106
+ },
107
+ Features: { canImport: ['contracts', 'types'], cannotImport: ['core', 'modules', 'lib'] },
108
+ Contracts: {
109
+ canImport: ['types'],
110
+ cannotImport: ['features', 'modules', 'core', 'implementation'],
111
+ },
112
+ Modules: {
113
+ canImport: ['core', 'lib', 'security'],
114
+ cannotImport: ['features', 'contracts', 'entry points'],
115
+ },
116
+ Core: { canImport: ['lib', 'types'], cannotImport: ['features', 'modules', 'contracts'] },
117
+ Lib: { canImport: ['types'], cannotImport: ['core', 'modules', 'features'] },
118
+ Infrastructure: {
119
+ canImport: ['lib', 'config'],
120
+ cannotImport: ['core', 'modules', 'features'],
121
+ },
122
+ Security: { canImport: ['lib', 'types'], scope: 'cross-cutting' },
123
+ },
124
+ violations: [
125
+ {
126
+ id: 'SOC-IMPORT-001',
127
+ pattern: 'import { X } from "@/core/X" in Features',
128
+ severity: 'error',
129
+ message: 'Features cannot import directly from Core',
130
+ },
131
+ {
132
+ id: 'SOC-IMPORT-002',
133
+ pattern: 'import { X } from "@/modules/X" in Core',
134
+ severity: 'error',
135
+ message: 'Core cannot import from Modules',
136
+ },
137
+ {
138
+ id: 'SOC-IMPORT-003',
139
+ pattern: 'import { X } from "@/features/X" in Core/Modules',
140
+ severity: 'error',
141
+ message: 'Core/Modules cannot import from Features (UI)',
142
+ },
143
+ ],
144
+ },
145
+ // ============================================================================
146
+ // 3. FEATURE MODULE STRUCTURE
147
+ // ============================================================================
148
+ featureStructure: {
149
+ enabled: true,
150
+ required: true,
151
+ description: 'Standard structure for each Feature',
152
+ requiredDirectories: {
153
+ components: {
154
+ description: 'React components for this feature',
155
+ required: true,
156
+ pattern: '*.tsx',
157
+ },
158
+ hooks: {
159
+ description: 'Custom React hooks',
160
+ required: true,
161
+ pattern: 'use*.ts',
162
+ },
163
+ services: {
164
+ description: 'API services and business logic calls',
165
+ required: true,
166
+ pattern: '*.service.ts',
167
+ },
168
+ },
169
+ requiredFiles: {
170
+ 'index.ts': {
171
+ description: 'Public API exports',
172
+ required: true,
173
+ content: 'Export components, hooks, services for external use',
174
+ },
175
+ },
176
+ example: `
177
+ src/features/upload/
178
+ ├── components/
179
+ │ ├── FileUploader.tsx
180
+ │ ├── UploadProgress.tsx
181
+ │ └── FilePreview.tsx
182
+ ├── hooks/
183
+ │ ├── useUpload.ts
184
+ │ └── useFileValidation.ts
185
+ ├── services/
186
+ │ └── upload.service.ts
187
+ └── index.ts
188
+ `,
189
+ },
190
+ // ============================================================================
191
+ // 4. CORE PRINCIPLES
192
+ // ============================================================================
193
+ corePrinciples: {
194
+ enabled: true,
195
+ required: true,
196
+ description: 'Core layer must be pure and stateless',
197
+ rules: [
198
+ {
199
+ id: 'SOC-CORE-001',
200
+ name: 'No UI Dependencies',
201
+ description: 'Core cannot import React, Next.js, or any UI libraries',
202
+ severity: 'error',
203
+ check: 'import detection in src/core/',
204
+ },
205
+ {
206
+ id: 'SOC-CORE-002',
207
+ name: 'No Side Effects',
208
+ description: 'Core functions must be pure (no console, no network, no fs)',
209
+ severity: 'error',
210
+ check: 'AST analysis for side effects',
211
+ },
212
+ {
213
+ id: 'SOC-CORE-003',
214
+ name: 'Stateless Functions',
215
+ description: 'No global state, no singletons, no mutable state',
216
+ severity: 'error',
217
+ forbidden: ['let global', 'var global', 'class.*state', 'singleton'],
218
+ },
219
+ ],
220
+ },
221
+ // ============================================================================
222
+ // 5. MODULE BOUNDARIES
223
+ // ============================================================================
224
+ moduleBoundaries: {
225
+ enabled: true,
226
+ required: true,
227
+ description: 'Each module is a closed boundary',
228
+ publicApi: {
229
+ location: 'index.ts',
230
+ pattern: 'Export only intended public API',
231
+ internal: 'All other files are internal',
232
+ },
233
+ structure: {
234
+ required: ['index.ts'],
235
+ optional: ['policies/', 'types.ts', 'constants.ts'],
236
+ },
237
+ rules: [
238
+ {
239
+ id: 'SOC-MODULE-001',
240
+ name: 'Public API Only',
241
+ description: 'Only index.ts exports are public',
242
+ severity: 'warning',
243
+ },
244
+ {
245
+ id: 'SOC-MODULE-002',
246
+ name: 'Policy Separation',
247
+ description: 'Policies must be in policies/ subdirectory',
248
+ severity: 'error',
249
+ },
250
+ ],
251
+ },
252
+ // ============================================================================
253
+ // 6. LOCALITY OF BEHAVIOR
254
+ // ============================================================================
255
+ localityOfBehavior: {
256
+ enabled: true,
257
+ required: true,
258
+ description: 'Everything related to a feature in one place',
259
+ principle: 'Co-location of related code',
260
+ requirements: {
261
+ features: 'All UI, hooks, services in src/features/[name]/',
262
+ modules: 'All business logic in src/modules/[name]/',
263
+ core: 'All domain logic in src/core/[name]/',
264
+ tests: 'Tests co-located or in __tests__/ subdirectory',
265
+ },
266
+ benefits: [
267
+ 'Easy to find related code',
268
+ 'Clear ownership',
269
+ 'Simpler refactoring',
270
+ 'Better code reviews',
271
+ ],
272
+ },
273
+ };
274
+ export function validateLayerImport(analysis) {
275
+ const { source, importPath } = analysis;
276
+ // Define layer order (higher = can import from lower)
277
+ const layerOrder = {
278
+ entry: 7,
279
+ features: 6,
280
+ contracts: 5,
281
+ modules: 4,
282
+ core: 3,
283
+ lib: 2,
284
+ infrastructure: 1,
285
+ };
286
+ const sourceLayer = Object.keys(layerOrder).find(layer => source.includes(layer));
287
+ const targetLayer = Object.keys(layerOrder).find(layer => importPath.includes(`/${layer}/`));
288
+ if (!sourceLayer || !targetLayer) {
289
+ return { valid: true }; // Cannot determine, assume valid
290
+ }
291
+ const sourceLevel = layerOrder[sourceLayer];
292
+ const targetLevel = layerOrder[targetLayer];
293
+ // Can only import from lower layers
294
+ if (targetLevel >= sourceLevel) {
295
+ return {
296
+ valid: false,
297
+ violation: `SOC-IMPORT: ${sourceLayer} cannot import from ${targetLayer} (same or higher layer)`,
298
+ };
299
+ }
300
+ // Specific layer rules
301
+ if (sourceLayer === 'features' && targetLayer === 'core') {
302
+ return {
303
+ valid: false,
304
+ violation: 'SOC-IMPORT-001: Features cannot import directly from Core (must use Contracts)',
305
+ };
306
+ }
307
+ if (sourceLayer === 'core' && targetLayer === 'modules') {
308
+ return {
309
+ valid: false,
310
+ violation: 'SOC-IMPORT-002: Core cannot import from Modules',
311
+ };
312
+ }
313
+ return { valid: true };
314
+ }
315
+ export function validateFeatureStructure(_featurePath, existingFiles) {
316
+ const required = ['index.ts', 'components/', 'hooks/', 'services/'];
317
+ const missing = required.filter(req => !existingFiles.some(file => file.includes(req)));
318
+ const violations = [];
319
+ // Check for business logic in features (should be in services only)
320
+ const hasBusinessLogic = existingFiles.some(f => f.includes('logic') && !f.includes('services/'));
321
+ if (hasBusinessLogic) {
322
+ violations.push('SOC-FEATURE-001: Business logic found outside services/ directory');
323
+ }
324
+ return {
325
+ valid: missing.length === 0 && violations.length === 0,
326
+ missing,
327
+ violations,
328
+ };
329
+ }
330
+ export function calculateSocScore(checks) {
331
+ const maxScore = 100;
332
+ let score = 0;
333
+ // Layer boundaries (40 points)
334
+ if (checks.respectsLayerBoundaries)
335
+ score += 20;
336
+ if (checks.noCrossLayerImports)
337
+ score += 20;
338
+ // Feature structure (20 points)
339
+ if (checks.hasCorrectFeatureStructure)
340
+ score += 15;
341
+ if (checks.hasLocalityOfBehavior)
342
+ score += 5;
343
+ // Core principles (20 points)
344
+ if (checks.coreHasNoUIDependencies)
345
+ score += 10;
346
+ if (checks.coreIsStateless)
347
+ score += 10;
348
+ // Module boundaries (20 points)
349
+ if (checks.hasPublicApiOnly)
350
+ score += 10;
351
+ if (checks.hasProperSeparation)
352
+ score += 10;
353
+ return {
354
+ score,
355
+ maxScore,
356
+ percentage: Math.round((score / maxScore) * 100),
357
+ };
358
+ }
359
+ export default SocRules;
360
+ //# sourceMappingURL=ts.rules.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Analysis Contract v1
3
+ * @description Public API contract for Analysis Engine
4
+ * @version 1.0.0
5
+ *
6
+ * This contract defines the stable interface between:
7
+ * - Core Engine (analysis execution)
8
+ * - Modules (business logic)
9
+ * - API Layer (external interface)
10
+ *
11
+ * ⚠️ Breaking changes require v2 contract
12
+ */
13
+ // =============================================================================
14
+ // VERSION
15
+ // =============================================================================
16
+ /** Current contract version */
17
+ export const ANALYSIS_CONTRACT_VERSION = '1.0.0';
18
+ //# sourceMappingURL=analysis.contract.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Domain Contracts
3
+ * @module packages/domain/contracts
4
+ */
5
+ export * from './analysis.contract.js';
6
+ export * from './projects.contract.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Projects Contract v1
3
+ * @description Public API contract for Project Management
4
+ * @version 1.0.0
5
+ *
6
+ * This contract defines the stable interface between:
7
+ * - Projects Module (business logic)
8
+ * - API Layer (external interface)
9
+ * - Client Applications (UI/dashboard)
10
+ *
11
+ * ⚠️ Breaking changes require v2 contract
12
+ */
13
+ // =============================================================================
14
+ // VERSION
15
+ // =============================================================================
16
+ /** Current contract version */
17
+ export const PROJECTS_CONTRACT_VERSION = '1.0.0';
18
+ //# sourceMappingURL=projects.contract.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Rules Registry
3
+ * @module packages/domain/control/registry/rules.registry
4
+ */
5
+ class RulesRegistry {
6
+ rules = new Map();
7
+ register(definition) {
8
+ this.rules.set(definition.id, { name: definition.name, rule: definition.execute });
9
+ }
10
+ get(name) {
11
+ const entry = this.rules.get(name);
12
+ return entry?.rule;
13
+ }
14
+ getAll() {
15
+ return Array.from(this.rules.values()).map(entry => entry.rule);
16
+ }
17
+ has(name) {
18
+ return this.rules.has(name);
19
+ }
20
+ execute(name, input, policy) {
21
+ const rule = this.get(name);
22
+ if (!rule) {
23
+ return [];
24
+ }
25
+ return rule(input, policy);
26
+ }
27
+ }
28
+ export const rulesRegistry = new RulesRegistry();
29
+ //# sourceMappingURL=rules.registry.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Policies Schemas
3
+ * @module packages/domain/control/schemas/policies
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=policies.js.map
@@ -0,0 +1,163 @@
1
+ /**
2
+ * File Discovery Module
3
+ * Scans projects and discovers source files with intelligent filtering
4
+ */
5
+ import { globby } from 'globby';
6
+ import { promises as fs } from 'fs';
7
+ import path from 'path';
8
+ // Default exclusion patterns
9
+ const DEFAULT_EXCLUDES = [
10
+ '**/node_modules/**',
11
+ '**/dist/**',
12
+ '**/build/**',
13
+ '**/.git/**',
14
+ '**/.svn/**',
15
+ '**/.hg/**',
16
+ '**/coverage/**',
17
+ '**/.next/**',
18
+ '**/.nuxt/**',
19
+ '**/out/**',
20
+ '**/.cache/**',
21
+ '**/vendor/**',
22
+ '**/*.min.js',
23
+ '**/*.min.css',
24
+ '**/*.map',
25
+ '**/bundle.*',
26
+ '**/chunk-*',
27
+ ];
28
+ // Source file patterns
29
+ const SOURCE_PATTERNS = [
30
+ '**/*.js',
31
+ '**/*.jsx',
32
+ '**/*.ts',
33
+ '**/*.tsx',
34
+ '**/*.mjs',
35
+ '**/*.cjs',
36
+ '**/*.vue',
37
+ '**/*.svelte',
38
+ ];
39
+ /**
40
+ * Discover source files in a project
41
+ */
42
+ export async function discoverFiles(options) {
43
+ const { rootDir, include = SOURCE_PATTERNS, exclude = [], maxFileSize = 10 * 1024 * 1024, // 10MB
44
+ maxTotalSize = 100 * 1024 * 1024, // 100MB
45
+ maxFiles = 1000, } = options;
46
+ const normalizedRoot = path.resolve(rootDir);
47
+ // Combine exclusion patterns
48
+ const allExcludes = [...DEFAULT_EXCLUDES, ...exclude];
49
+ // Find all matching files
50
+ const globbyOptions = {
51
+ cwd: normalizedRoot,
52
+ absolute: true,
53
+ onlyFiles: true,
54
+ ignore: allExcludes,
55
+ dot: true,
56
+ };
57
+ const allPaths = await globby(include, globbyOptions);
58
+ const files = [];
59
+ let totalSize = 0;
60
+ let skippedCount = 0;
61
+ let excludedCount = 0;
62
+ // Filter and collect file info
63
+ for (const filePath of allPaths) {
64
+ // Check max files limit
65
+ if (files.length >= maxFiles) {
66
+ break;
67
+ }
68
+ try {
69
+ const stats = await fs.stat(filePath);
70
+ // Skip directories (shouldn't happen with onlyFiles: true)
71
+ if (!stats.isFile()) {
72
+ excludedCount++;
73
+ continue;
74
+ }
75
+ // Check file size
76
+ if (stats.size > maxFileSize) {
77
+ skippedCount++;
78
+ continue;
79
+ }
80
+ // Check total size limit
81
+ if (totalSize + stats.size > maxTotalSize) {
82
+ break;
83
+ }
84
+ const relativePath = path.relative(normalizedRoot, filePath);
85
+ const extension = path.extname(filePath).toLowerCase();
86
+ files.push({
87
+ path: filePath,
88
+ relativePath,
89
+ size: stats.size,
90
+ extension,
91
+ mtime: stats.mtime,
92
+ });
93
+ totalSize += stats.size;
94
+ }
95
+ catch (error) {
96
+ // Skip files we can't stat
97
+ excludedCount++;
98
+ }
99
+ }
100
+ return {
101
+ files,
102
+ totalFound: allPaths.length,
103
+ excludedCount,
104
+ skippedCount,
105
+ totalSize,
106
+ };
107
+ }
108
+ /**
109
+ * Check if a path is a valid project root
110
+ */
111
+ export async function isValidProjectRoot(projectPath) {
112
+ try {
113
+ const stats = await fs.stat(projectPath);
114
+ if (!stats.isDirectory()) {
115
+ return false;
116
+ }
117
+ // Check for common project indicators
118
+ const indicators = ['package.json', 'tsconfig.json', 'jsconfig.json', '.git', 'src'];
119
+ for (const indicator of indicators) {
120
+ try {
121
+ await fs.access(path.join(projectPath, indicator));
122
+ return true;
123
+ }
124
+ catch {
125
+ // Continue checking
126
+ }
127
+ }
128
+ return false;
129
+ }
130
+ catch {
131
+ return false;
132
+ }
133
+ }
134
+ /**
135
+ * Get project info from discovered files
136
+ */
137
+ export function analyzeProjectTypes(files) {
138
+ const extensions = files.map(f => f.extension);
139
+ const uniqueExtensions = new Set(extensions);
140
+ const hasJavaScript = uniqueExtensions.has('.js') ||
141
+ uniqueExtensions.has('.jsx') ||
142
+ uniqueExtensions.has('.mjs') ||
143
+ uniqueExtensions.has('.cjs');
144
+ const hasTypeScript = uniqueExtensions.has('.ts') ||
145
+ uniqueExtensions.has('.tsx') ||
146
+ uniqueExtensions.has('.mts') ||
147
+ uniqueExtensions.has('.cts');
148
+ const hasReact = uniqueExtensions.has('.jsx') || uniqueExtensions.has('.tsx');
149
+ const hasVue = uniqueExtensions.has('.vue');
150
+ const hasSvelte = uniqueExtensions.has('.svelte');
151
+ const isNodeProject = uniqueExtensions.has('.js') || uniqueExtensions.has('.ts') || hasVue || hasSvelte;
152
+ const isESM = uniqueExtensions.has('.mjs') || uniqueExtensions.has('.mts');
153
+ return {
154
+ hasJavaScript,
155
+ hasTypeScript,
156
+ hasReact,
157
+ hasVue,
158
+ hasSvelte,
159
+ isNodeProject,
160
+ isESM,
161
+ };
162
+ }
163
+ //# sourceMappingURL=discovery.js.map