mcp-adr-analysis-server 2.7.30 → 2.7.32

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 (34) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/package.json +1 -1
  3. package/dist/src/resources/adrs-review-resource.d.ts +0 -82
  4. package/dist/src/resources/adrs-review-resource.d.ts.map +0 -1
  5. package/dist/src/resources/adrs-review-resource.js +0 -160
  6. package/dist/src/resources/adrs-review-resource.js.map +0 -1
  7. package/dist/src/resources/architectural-context-resource.d.ts +0 -95
  8. package/dist/src/resources/architectural-context-resource.d.ts.map +0 -1
  9. package/dist/src/resources/architectural-context-resource.js +0 -428
  10. package/dist/src/resources/architectural-context-resource.js.map +0 -1
  11. package/dist/src/resources/memory-expand-resource.d.ts +0 -90
  12. package/dist/src/resources/memory-expand-resource.d.ts.map +0 -1
  13. package/dist/src/resources/memory-expand-resource.js +0 -176
  14. package/dist/src/resources/memory-expand-resource.js.map +0 -1
  15. package/dist/src/utils/bootstrap-task-integration.d.ts +0 -214
  16. package/dist/src/utils/bootstrap-task-integration.d.ts.map +0 -1
  17. package/dist/src/utils/bootstrap-task-integration.js +0 -365
  18. package/dist/src/utils/bootstrap-task-integration.js.map +0 -1
  19. package/dist/src/utils/index.d.ts +0 -9
  20. package/dist/src/utils/index.d.ts.map +0 -1
  21. package/dist/src/utils/index.js +0 -13
  22. package/dist/src/utils/index.js.map +0 -1
  23. package/dist/src/utils/interactive-approval.d.ts +0 -63
  24. package/dist/src/utils/interactive-approval.d.ts.map +0 -1
  25. package/dist/src/utils/interactive-approval.js +0 -445
  26. package/dist/src/utils/interactive-approval.js.map +0 -1
  27. package/dist/src/utils/llm-artifact-detector.d.ts +0 -76
  28. package/dist/src/utils/llm-artifact-detector.d.ts.map +0 -1
  29. package/dist/src/utils/llm-artifact-detector.js +0 -426
  30. package/dist/src/utils/llm-artifact-detector.js.map +0 -1
  31. package/dist/src/utils/location-filter.d.ts +0 -104
  32. package/dist/src/utils/location-filter.d.ts.map +0 -1
  33. package/dist/src/utils/location-filter.js +0 -593
  34. package/dist/src/utils/location-filter.js.map +0 -1
@@ -1,593 +0,0 @@
1
- /**
2
- * Enterprise Location-based filtering system with Tree-sitter intelligence
3
- *
4
- * Determines if files are in appropriate locations based on their type and content
5
- * Enhanced with AI-powered code analysis for multi-language DevOps stacks
6
- */
7
- import { basename, dirname } from 'path';
8
- import { TreeSitterAnalyzer } from './tree-sitter-analyzer.js';
9
- /**
10
- * Default location rules for common development artifacts
11
- */
12
- export const DEFAULT_LOCATION_RULES = [
13
- // Debug files
14
- {
15
- name: 'debug-scripts',
16
- description: 'debug scripts should be in development directories',
17
- filePattern: /^debug_.*\.(py|js|ts|sh|rb|go)$/,
18
- contentPattern: /print\s*\(.*debug.*\)|console\.log\s*\(.*debug.*\)|logging\.debug|debugger;/i,
19
- allowedPaths: ['tests/', 'test/', 'scripts/', 'tools/', 'dev/', 'debug/'],
20
- blockedPaths: ['src/', 'lib/', 'app/', './'],
21
- severity: 'warning',
22
- category: 'development',
23
- },
24
- // Test files
25
- {
26
- name: 'test-files',
27
- description: 'test files should be in test directories',
28
- filePattern: /^test_.*\.(py|js|ts|rb|go)$|.*\.test\.(js|ts|py)$|.*\.spec\.(js|ts|py)$/,
29
- allowedPaths: ['tests/', 'test/', '__tests__/', 'spec/', 'specs/'],
30
- blockedPaths: ['src/', 'lib/', 'app/', './'],
31
- severity: 'error',
32
- category: 'testing',
33
- },
34
- // Mock files
35
- {
36
- name: 'mock-data',
37
- description: 'Mock data files should be in test or fixture directories',
38
- filePattern: /^mock_.*\.(json|js|ts|py|yaml|yml)$/,
39
- contentPattern: /mock|fixture|fake.*data|dummy.*data/i,
40
- allowedPaths: ['tests/', 'test/', '__tests__/', 'fixtures/', 'mocks/', 'dev/'],
41
- blockedPaths: ['src/', 'lib/', 'app/', './'],
42
- severity: 'warning',
43
- category: 'testing',
44
- },
45
- // Temporary files
46
- {
47
- name: 'temporary-files',
48
- description: 'Temporary files should not be committed',
49
- filePattern: /^temp_.*|.*\.tmp$|.*\.temp$|.*\.bak$|.*\.orig$/,
50
- allowedPaths: ['tmp/', 'temp/', 'dev/'],
51
- blockedPaths: ['src/', 'lib/', 'app/', 'tests/', './'],
52
- severity: 'error',
53
- category: 'temporary',
54
- },
55
- // Log files
56
- {
57
- name: 'log-files',
58
- description: 'Log files should not be committed to main codebase',
59
- filePattern: /.*\.log$|.*\.out$|.*\.err$/,
60
- allowedPaths: ['logs/', 'dev/', 'examples/'],
61
- blockedPaths: ['src/', 'lib/', 'app/', 'tests/', './'],
62
- severity: 'error',
63
- category: 'temporary',
64
- },
65
- // Configuration files with secrets
66
- {
67
- name: 'config-secrets',
68
- description: 'Configuration files with secrets need careful review',
69
- filePattern: /\.env$|config\..*\.(json|yaml|yml|ini)$|secrets\..*$/,
70
- contentPattern: /password|secret|key|token|api.*key|private.*key/i,
71
- allowedPaths: ['config/', 'configs/', 'env/', 'examples/'],
72
- blockedPaths: ['./'],
73
- severity: 'error',
74
- category: 'security',
75
- },
76
- // Scripts
77
- {
78
- name: 'utility-scripts',
79
- description: 'Utility scripts should be in scripts directory',
80
- filePattern: /^util_.*\.(sh|py|js|ts|rb)$|^helper_.*\.(sh|py|js|ts|rb)$/,
81
- allowedPaths: ['scripts/', 'tools/', 'bin/', 'utils/'],
82
- blockedPaths: ['src/', 'lib/', 'app/', './'],
83
- severity: 'info',
84
- category: 'development',
85
- },
86
- // Experimental code
87
- {
88
- name: 'experimental-code',
89
- description: 'Experimental code should be in development directories',
90
- filePattern: /^experiment_.*|^poc_.*|^prototype_.*|^scratch_.*|^playground_.*/,
91
- allowedPaths: ['experiments/', 'poc/', 'dev/', 'playground/', 'prototypes/'],
92
- blockedPaths: ['src/', 'lib/', 'app/', './'],
93
- severity: 'warning',
94
- category: 'development',
95
- },
96
- // Documentation drafts
97
- {
98
- name: 'documentation-drafts',
99
- description: 'Documentation drafts should be organized properly',
100
- filePattern: /^draft_.*\.md$|^notes_.*\.md$|^todo_.*\.md$/,
101
- allowedPaths: ['docs/', 'documentation/', 'dev/', 'drafts/'],
102
- blockedPaths: ['src/', 'lib/', 'app/', './'],
103
- severity: 'info',
104
- category: 'development',
105
- },
106
- // Enterprise IaC Rules for RedHat/Cloud Architecture
107
- // Ansible Playbooks and Roles
108
- {
109
- name: 'ansible-structure',
110
- description: 'Ansible playbooks and roles must follow standard structure',
111
- filePattern: /.*\.(yml|yaml)$/,
112
- contentPattern: /hosts:|become:|tasks:|handlers:|vars:|playbook|ansible/i,
113
- allowedPaths: [
114
- 'ansible/',
115
- 'playbooks/',
116
- 'roles/',
117
- 'inventory/',
118
- 'group_vars/',
119
- 'host_vars/',
120
- 'automation/',
121
- ],
122
- blockedPaths: ['src/', 'lib/', 'app/', 'tests/', './'],
123
- severity: 'error',
124
- category: 'security',
125
- },
126
- // Terraform Infrastructure
127
- {
128
- name: 'terraform-organization',
129
- description: 'Terraform files must be properly organized by environment/provider',
130
- filePattern: /.*\.tf$|.*\.tfvars$|.*\.tfstate$/,
131
- allowedPaths: ['terraform/', 'infra/', 'infrastructure/', 'environments/', 'modules/'],
132
- blockedPaths: ['src/', 'lib/', 'app/', 'ansible/', './'],
133
- severity: 'error',
134
- category: 'security',
135
- },
136
- // Container Security
137
- {
138
- name: 'container-configs',
139
- description: 'Container configs must be in designated directories',
140
- filePattern: /Dockerfile|docker-compose.*\.ya?ml$|\.dockerignore$/,
141
- contentPattern: /FROM|COPY|RUN|EXPOSE|CMD|ENTRYPOINT/i,
142
- allowedPaths: ['docker/', 'containers/', 'deployments/', 'k8s/', 'kubernetes/', './'],
143
- blockedPaths: ['src/', 'lib/', 'ansible/'],
144
- severity: 'warning',
145
- category: 'security',
146
- },
147
- // Kubernetes Manifests
148
- {
149
- name: 'k8s-manifests',
150
- description: 'Kubernetes manifests must be properly organized',
151
- filePattern: /.*\.(yaml|yml)$/,
152
- contentPattern: /apiVersion:|kind:|metadata:|spec:|kubernetes|k8s/i,
153
- allowedPaths: ['k8s/', 'kubernetes/', 'manifests/', 'deployments/', 'helm/', 'charts/'],
154
- blockedPaths: ['src/', 'lib/', 'app/', 'ansible/', './'],
155
- severity: 'error',
156
- category: 'security',
157
- },
158
- // CI/CD Pipeline Security
159
- {
160
- name: 'cicd-security',
161
- description: 'CI/CD configs must not contain hardcoded secrets',
162
- filePattern: /\.github\/workflows\/.*\.ya?ml$|\.gitlab-ci\.ya?ml$|Jenkinsfile|\.tekton\/.*$/,
163
- contentPattern: /password|secret|token|key|credential/i,
164
- allowedPaths: ['.github/workflows/', '.gitlab/', 'jenkins/', 'tekton/', 'ci/', 'pipelines/'],
165
- blockedPaths: ['src/', 'lib/', 'app/'],
166
- severity: 'error',
167
- category: 'security',
168
- },
169
- // Python Virtual Environments and Dependencies
170
- {
171
- name: 'python-dependencies',
172
- description: 'Python virtual environments should not be committed',
173
- filePattern: /^venv\/|^\.venv\/|^env\/|^\.env\/|__pycache__\/|.*\.pyc$/,
174
- allowedPaths: [],
175
- blockedPaths: ['./'],
176
- severity: 'error',
177
- category: 'temporary',
178
- },
179
- // Node.js Enterprise Patterns
180
- {
181
- name: 'nodejs-enterprise',
182
- description: 'Node.js enterprise configs must be properly organized',
183
- filePattern: /package\.json$|package-lock\.json$|yarn\.lock$|\.npmrc$/,
184
- contentPattern: /registry|token|auth/i,
185
- allowedPaths: ['./', 'packages/', 'apps/', 'services/'],
186
- blockedPaths: [],
187
- severity: 'warning',
188
- category: 'security',
189
- },
190
- // RedHat OpenShift Configs
191
- {
192
- name: 'openshift-configs',
193
- description: 'OpenShift configs must be in designated directories',
194
- filePattern: /.*\.(yaml|yml)$/,
195
- contentPattern: /openshift|oc\s|route:|buildconfig:|deploymentconfig/i,
196
- allowedPaths: ['openshift/', 'ocp/', 'deployments/', 'k8s/', 'manifests/'],
197
- blockedPaths: ['src/', 'lib/', 'app/', './'],
198
- severity: 'error',
199
- category: 'security',
200
- },
201
- ];
202
- // Create tree-sitter analyzer instance
203
- let treeSitterAnalyzer = null;
204
- /**
205
- * Initialize tree-sitter analyzer (lazy loading)
206
- */
207
- async function getTreeSitterAnalyzer() {
208
- if (!treeSitterAnalyzer) {
209
- try {
210
- treeSitterAnalyzer = new TreeSitterAnalyzer();
211
- return treeSitterAnalyzer;
212
- }
213
- catch (error) {
214
- console.warn('Tree-sitter analyzer initialization failed:', error);
215
- return null;
216
- }
217
- }
218
- return treeSitterAnalyzer;
219
- }
220
- /**
221
- * Enhanced file location validation with tree-sitter intelligence
222
- */
223
- export async function validateFileLocationIntelligent(filePath, content, customRules = []) {
224
- // Perform basic validation first
225
- const basicResult = validateFileLocation(filePath, content, customRules);
226
- // Add tree-sitter analysis for enhanced intelligence
227
- try {
228
- const analyzer = await getTreeSitterAnalyzer();
229
- if (analyzer && content) {
230
- const analysis = await analyzer.analyzeFile(filePath, content);
231
- // Enhance validation with tree-sitter insights
232
- const intelligentResult = enhanceValidationWithTreeSitter(basicResult, analysis, filePath);
233
- return {
234
- ...intelligentResult,
235
- treeSitterAnalysis: analysis,
236
- };
237
- }
238
- }
239
- catch (error) {
240
- console.warn('Tree-sitter analysis failed:', error);
241
- }
242
- return basicResult;
243
- }
244
- /**
245
- * Legacy function for backward compatibility
246
- * Validate file location against rules
247
- */
248
- export function validateFileLocation(filePath, content, customRules = []) {
249
- const fileName = basename(filePath);
250
- const dirPath = dirname(filePath);
251
- const allRules = [...customRules, ...DEFAULT_LOCATION_RULES]; // Custom rules first for priority
252
- // Check each rule
253
- for (const rule of allRules) {
254
- // Rule matches if either:
255
- // 1. File pattern matches AND no content pattern specified
256
- // 2. File pattern matches AND content pattern matches (if content provided)
257
- // 3. Content pattern matches (regardless of file pattern, if content provided)
258
- const fileMatches = rule.filePattern.test(fileName);
259
- const hasContentPattern = !!rule.contentPattern;
260
- const contentMatches = hasContentPattern && content ? rule.contentPattern.test(content) : false;
261
- // Rule applies if:
262
- // - File pattern matches (regardless of content pattern)
263
- // - Content pattern matches (when content is provided)
264
- const ruleApplies = fileMatches || contentMatches;
265
- if (ruleApplies) {
266
- // Check if current path is blocked
267
- const isBlocked = rule.blockedPaths.some(blocked => {
268
- const cleanBlocked = blocked.replace(/\/$/, ''); // Remove trailing slash
269
- return (dirPath.startsWith(cleanBlocked + '/') ||
270
- dirPath === cleanBlocked ||
271
- filePath.startsWith(cleanBlocked + '/'));
272
- });
273
- if (isBlocked) {
274
- return {
275
- isValid: false,
276
- rule,
277
- currentPath: filePath,
278
- suggestedPaths: rule.allowedPaths,
279
- severity: rule.severity,
280
- message: `${rule.description}. File '${fileName}' currently in '${dirPath}/', should be in: ${rule.allowedPaths.join(', ')}`,
281
- };
282
- }
283
- // Check if current path is allowed
284
- const isAllowed = rule.allowedPaths.length === 0 ||
285
- rule.allowedPaths.some(allowed => {
286
- const cleanAllowed = allowed.replace(/\/$/, ''); // Remove trailing slash
287
- return (dirPath.includes(cleanAllowed) ||
288
- dirPath === cleanAllowed ||
289
- filePath.startsWith(cleanAllowed + '/') ||
290
- (cleanAllowed === '.' && dirPath === '.') ||
291
- (cleanAllowed === './' && (dirPath === '.' || dirPath === '')));
292
- });
293
- if (!isAllowed) {
294
- return {
295
- isValid: false,
296
- rule,
297
- currentPath: filePath,
298
- suggestedPaths: rule.allowedPaths,
299
- severity: rule.severity,
300
- message: `${rule.description}. File '${fileName}' currently in '${dirPath}/', should be in: ${rule.allowedPaths.join(', ')}`,
301
- };
302
- }
303
- // File is in correct location
304
- return {
305
- isValid: true,
306
- rule,
307
- currentPath: filePath,
308
- suggestedPaths: [],
309
- severity: 'info',
310
- message: `File is correctly located in '${dirPath}/'`,
311
- };
312
- }
313
- }
314
- // No specific rule found, file is generally acceptable
315
- return {
316
- isValid: true,
317
- currentPath: filePath,
318
- suggestedPaths: [],
319
- severity: 'info',
320
- message: 'No specific location restrictions apply',
321
- };
322
- }
323
- /**
324
- * Get location suggestions for a file (backward compatible overloads)
325
- */
326
- export function getLocationSuggestions(filePath, categoryOrDescription) {
327
- const fileName = basename(filePath);
328
- // Check if this is the old API (category parameter) or new API (description parameter)
329
- // Old API can be valid categories OR any other single-word string that isn't a description
330
- const validOldCategories = ['development', 'security', 'temporary', 'testing'];
331
- const isOldApi = validOldCategories.includes(categoryOrDescription || '') ||
332
- (categoryOrDescription &&
333
- categoryOrDescription.length < 20 &&
334
- !categoryOrDescription.includes(' '));
335
- let category;
336
- if (isOldApi) {
337
- // Old API: category is provided (might be unknown)
338
- category = categoryOrDescription;
339
- }
340
- else {
341
- // New API: determine category based on filename patterns
342
- category = 'development';
343
- if (fileName.startsWith('temp_') || fileName.includes('.tmp') || fileName.includes('.temp')) {
344
- category = 'temporary';
345
- }
346
- else if (fileName.startsWith('test_') ||
347
- fileName.includes('.test.') ||
348
- fileName.includes('.spec.')) {
349
- category = 'testing';
350
- }
351
- else if (fileName.includes('config') ||
352
- fileName.includes('.env') ||
353
- fileName.includes('secret')) {
354
- category = 'security';
355
- }
356
- }
357
- const categoryMap = {
358
- testing: ['tests/', 'test/', '__tests__/'],
359
- development: ['dev/', 'tools/', 'scripts/'],
360
- temporary: ['tmp/', 'temp/'],
361
- security: ['config/', 'env/', 'examples/'],
362
- };
363
- const baseSuggestions = categoryMap[category] || [];
364
- if (isOldApi) {
365
- // Old API: return array with file names included
366
- // For unknown categories, return empty array
367
- if (!categoryMap[category]) {
368
- return [];
369
- }
370
- return baseSuggestions.map(dir => `${dir}${fileName}`);
371
- }
372
- else {
373
- // New API: return object with suggestions and category
374
- return {
375
- suggestions: baseSuggestions,
376
- category,
377
- };
378
- }
379
- }
380
- /**
381
- * Check if a file should be ignored based on common patterns
382
- */
383
- export function shouldIgnoreFile(filePath) {
384
- const fileName = basename(filePath);
385
- // Temporary files that should definitely be ignored
386
- const temporaryPatterns = [
387
- { pattern: /.*\.tmp$/, reason: 'Temporary file' },
388
- { pattern: /.*\.temp$/, reason: 'Temporary file' },
389
- { pattern: /.*\.bak$/, reason: 'Backup file' },
390
- { pattern: /.*\.orig$/, reason: 'Original file backup' },
391
- { pattern: /.*~$/, reason: 'Editor backup file' },
392
- { pattern: /^\.DS_Store$/, reason: 'macOS system file' },
393
- { pattern: /^Thumbs\.db$/, reason: 'Windows system file' },
394
- { pattern: /^\.env\.local$/, reason: 'Local environment file' },
395
- { pattern: /^\.env\.dev$/, reason: 'Development environment file' },
396
- ];
397
- for (const { pattern, reason } of temporaryPatterns) {
398
- if (pattern.test(fileName)) {
399
- return {
400
- shouldIgnore: true,
401
- reason,
402
- severity: 'error',
403
- };
404
- }
405
- }
406
- // Development files that should probably be ignored
407
- const developmentPatterns = [
408
- { pattern: /^debug_/, reason: 'Debug script' },
409
- { pattern: /^scratch_/, reason: 'Scratch file' },
410
- { pattern: /^playground_/, reason: 'Playground file' },
411
- { pattern: /^experiment_/, reason: 'Experimental file' },
412
- { pattern: /.*\.debug$/, reason: 'Debug file' },
413
- { pattern: /.*\.log$/, reason: 'Log file' },
414
- ];
415
- for (const { pattern, reason } of developmentPatterns) {
416
- if (pattern.test(fileName)) {
417
- return {
418
- shouldIgnore: true,
419
- reason,
420
- severity: 'warning',
421
- };
422
- }
423
- }
424
- return {
425
- shouldIgnore: false,
426
- reason: 'File appears to be legitimate',
427
- severity: 'info',
428
- };
429
- }
430
- /**
431
- * Create a custom location rule
432
- */
433
- export function createLocationRule(name, description, filePattern, allowedPaths, blockedPaths = [], severity = 'warning', category = 'development', contentPattern) {
434
- return {
435
- name,
436
- description,
437
- filePattern: new RegExp(filePattern),
438
- ...(contentPattern && { contentPattern: new RegExp(contentPattern, 'i') }),
439
- allowedPaths,
440
- blockedPaths,
441
- severity,
442
- category,
443
- };
444
- }
445
- /**
446
- * Load location rules from project configuration
447
- */
448
- export function loadLocationRules(_projectPath) {
449
- // This would load from .smartgit.json or similar configuration file
450
- // For now, return default rules
451
- return DEFAULT_LOCATION_RULES;
452
- }
453
- /**
454
- * Validate multiple files at once
455
- */
456
- export function validateMultipleFiles(filePaths, fileContents, customRules = []) {
457
- return filePaths.map((filePath, index) => {
458
- const content = fileContents?.[index];
459
- return validateFileLocation(filePath, content, customRules);
460
- });
461
- }
462
- /**
463
- * Enhance validation result with tree-sitter intelligence
464
- */
465
- function enhanceValidationWithTreeSitter(basicResult, analysis, filePath) {
466
- const intelligentReasons = [];
467
- let newSeverity = basicResult.severity;
468
- let isValid = basicResult.isValid;
469
- // Security-based location enforcement
470
- if (analysis.hasSecrets) {
471
- intelligentReasons.push(`Contains ${analysis.secrets.length} potential secret(s): ${analysis.secrets.map(s => s.type).join(', ')}`);
472
- // Force security files to secure locations
473
- if (!isInSecureLocation(filePath)) {
474
- isValid = false;
475
- newSeverity = 'error';
476
- intelligentReasons.push('Files with secrets must be in secure locations (config/, env/, examples/)');
477
- }
478
- }
479
- // Infrastructure analysis
480
- if (analysis.infraStructure.length > 0) {
481
- const infraTypes = analysis.infraStructure.map(i => i.resourceType);
482
- intelligentReasons.push(`Infrastructure resources detected: ${infraTypes.join(', ')}`);
483
- // Terraform files with dangerous resources
484
- const dangerousResources = analysis.infraStructure.filter(i => i.securityRisks.length > 0);
485
- if (dangerousResources.length > 0) {
486
- intelligentReasons.push('Contains infrastructure with security risks');
487
- if (newSeverity === 'info')
488
- newSeverity = 'warning';
489
- }
490
- }
491
- // Dangerous import analysis
492
- const dangerousImports = analysis.imports.filter(i => i.isDangerous);
493
- if (dangerousImports.length > 0) {
494
- intelligentReasons.push(`Contains dangerous imports: ${dangerousImports.map(i => i.module).join(', ')}`);
495
- if (newSeverity === 'info')
496
- newSeverity = 'warning';
497
- }
498
- // Security-sensitive functions
499
- const sensitiveFunctions = analysis.functions.filter(f => f.securitySensitive);
500
- if (sensitiveFunctions.length > 0) {
501
- intelligentReasons.push(`Contains security-sensitive functions: ${sensitiveFunctions.map(f => f.name).join(', ')}`);
502
- }
503
- // High complexity functions (potential technical debt)
504
- const complexFunctions = analysis.functions.filter(f => f.complexity > 10);
505
- if (complexFunctions.length > 0) {
506
- intelligentReasons.push(`Contains high-complexity functions (>10): ${complexFunctions.map(f => f.name).join(', ')}`);
507
- }
508
- // Enterprise architecture violations
509
- const violations = detectArchitecturalViolations(analysis, filePath);
510
- if (violations.length > 0) {
511
- intelligentReasons.push(...violations);
512
- isValid = false;
513
- newSeverity = 'error';
514
- }
515
- return {
516
- ...basicResult,
517
- isValid,
518
- severity: newSeverity,
519
- intelligentReasons,
520
- message: intelligentReasons.length > 0
521
- ? `${basicResult.message} | Tree-sitter analysis: ${intelligentReasons.join('; ')}`
522
- : basicResult.message,
523
- };
524
- }
525
- /**
526
- * Check if file is in a secure location
527
- */
528
- function isInSecureLocation(filePath) {
529
- const secureLocations = ['config/', 'env/', 'examples/', 'secrets/', '.env', 'vault/'];
530
- return secureLocations.some(location => filePath.includes(location));
531
- }
532
- /**
533
- * Detect architectural violations based on imports and function calls
534
- */
535
- function detectArchitecturalViolations(analysis, filePath) {
536
- const violations = [];
537
- // Database access in UI layer
538
- if (filePath.includes('/ui/') || filePath.includes('/components/')) {
539
- const dbImports = analysis.imports.filter(i => i.module.includes('sql') ||
540
- i.module.includes('database') ||
541
- i.module.includes('mongoose') ||
542
- i.module.includes('sequelize'));
543
- if (dbImports.length > 0) {
544
- violations.push('UI layer contains direct database imports (violates clean architecture)');
545
- }
546
- }
547
- // Business logic in view layer
548
- if (filePath.includes('/views/') || filePath.includes('/templates/')) {
549
- const businessLogic = analysis.functions.filter(f => f.name.includes('calculate') ||
550
- f.name.includes('process') ||
551
- f.name.includes('validate') ||
552
- f.complexity > 5);
553
- if (businessLogic.length > 0) {
554
- violations.push('View layer contains business logic (should be in service/business layer)');
555
- }
556
- }
557
- // Cloud provider coupling
558
- const awsImports = analysis.imports.filter(i => i.module.includes('aws'));
559
- const gcpImports = analysis.imports.filter(i => i.module.includes('gcp') || i.module.includes('google-cloud'));
560
- const azureImports = analysis.imports.filter(i => i.module.includes('azure'));
561
- const cloudProviders = [
562
- ...(awsImports.length > 0 ? ['AWS'] : []),
563
- ...(gcpImports.length > 0 ? ['GCP'] : []),
564
- ...(azureImports.length > 0 ? ['Azure'] : []),
565
- ];
566
- if (cloudProviders.length > 1) {
567
- violations.push(`Multi-cloud coupling detected: ${cloudProviders.join(', ')} (consider abstraction layer)`);
568
- }
569
- return violations;
570
- }
571
- /**
572
- * Get summary statistics for location validation
573
- */
574
- export function getLocationValidationSummary(results) {
575
- const summary = {
576
- totalFiles: results.length,
577
- validFiles: results.filter(r => r.isValid).length,
578
- invalidFiles: results.filter(r => !r.isValid).length,
579
- errorCount: results.filter(r => r.severity === 'error').length,
580
- warningCount: results.filter(r => r.severity === 'warning').length,
581
- infoCount: results.filter(r => r.severity === 'info').length,
582
- categorySummary: {},
583
- };
584
- // Count by category
585
- for (const result of results) {
586
- if (result.rule) {
587
- const category = result.rule.category;
588
- summary.categorySummary[category] = (summary.categorySummary[category] || 0) + 1;
589
- }
590
- }
591
- return summary;
592
- }
593
- //# sourceMappingURL=location-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"location-filter.js","sourceRoot":"","sources":["../../../src/utils/location-filter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAA2B,MAAM,2BAA2B,CAAC;AA8CxF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,cAAc;IACd;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,oDAAoD;QACjE,WAAW,EAAE,iCAAiC;QAC9C,cAAc,EAAE,8EAA8E;QAC9F,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;QACzE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;QAC5C,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,aAAa;KACxB;IAED,aAAa;IACb;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,0CAA0C;QACvD,WAAW,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