agentic-qe 2.6.2 → 2.6.3

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 (59) hide show
  1. package/.claude/agents/qe-code-intelligence.md +88 -1
  2. package/CHANGELOG.md +63 -0
  3. package/README.md +1 -1
  4. package/dist/agents/CodeIntelligenceAgent.d.ts +4 -1
  5. package/dist/agents/CodeIntelligenceAgent.d.ts.map +1 -1
  6. package/dist/agents/CodeIntelligenceAgent.js +30 -1
  7. package/dist/agents/CodeIntelligenceAgent.js.map +1 -1
  8. package/dist/cli/commands/knowledge-graph.d.ts +30 -0
  9. package/dist/cli/commands/knowledge-graph.d.ts.map +1 -1
  10. package/dist/cli/commands/knowledge-graph.js +206 -4
  11. package/dist/cli/commands/knowledge-graph.js.map +1 -1
  12. package/dist/cli/index.js +152 -0
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/code-intelligence/inference/ComponentBoundaryAnalyzer.d.ts +75 -0
  15. package/dist/code-intelligence/inference/ComponentBoundaryAnalyzer.d.ts.map +1 -0
  16. package/dist/code-intelligence/inference/ComponentBoundaryAnalyzer.js +400 -0
  17. package/dist/code-intelligence/inference/ComponentBoundaryAnalyzer.js.map +1 -0
  18. package/dist/code-intelligence/inference/ExternalSystemDetector.d.ts +31 -0
  19. package/dist/code-intelligence/inference/ExternalSystemDetector.d.ts.map +1 -0
  20. package/dist/code-intelligence/inference/ExternalSystemDetector.js +523 -0
  21. package/dist/code-intelligence/inference/ExternalSystemDetector.js.map +1 -0
  22. package/dist/code-intelligence/inference/ProjectMetadataAnalyzer.d.ts +78 -0
  23. package/dist/code-intelligence/inference/ProjectMetadataAnalyzer.d.ts.map +1 -0
  24. package/dist/code-intelligence/inference/ProjectMetadataAnalyzer.js +491 -0
  25. package/dist/code-intelligence/inference/ProjectMetadataAnalyzer.js.map +1 -0
  26. package/dist/code-intelligence/inference/index.d.ts +36 -0
  27. package/dist/code-intelligence/inference/index.d.ts.map +1 -0
  28. package/dist/code-intelligence/inference/index.js +65 -0
  29. package/dist/code-intelligence/inference/index.js.map +1 -0
  30. package/dist/code-intelligence/inference/types.d.ts +196 -0
  31. package/dist/code-intelligence/inference/types.d.ts.map +1 -0
  32. package/dist/code-intelligence/inference/types.js +9 -0
  33. package/dist/code-intelligence/inference/types.js.map +1 -0
  34. package/dist/code-intelligence/visualization/C4ComponentDiagramBuilder.d.ts +75 -0
  35. package/dist/code-intelligence/visualization/C4ComponentDiagramBuilder.d.ts.map +1 -0
  36. package/dist/code-intelligence/visualization/C4ComponentDiagramBuilder.js +267 -0
  37. package/dist/code-intelligence/visualization/C4ComponentDiagramBuilder.js.map +1 -0
  38. package/dist/code-intelligence/visualization/C4ContainerDiagramBuilder.d.ts +138 -0
  39. package/dist/code-intelligence/visualization/C4ContainerDiagramBuilder.d.ts.map +1 -0
  40. package/dist/code-intelligence/visualization/C4ContainerDiagramBuilder.js +343 -0
  41. package/dist/code-intelligence/visualization/C4ContainerDiagramBuilder.js.map +1 -0
  42. package/dist/code-intelligence/visualization/C4ContextDiagramBuilder.d.ts +67 -0
  43. package/dist/code-intelligence/visualization/C4ContextDiagramBuilder.d.ts.map +1 -0
  44. package/dist/code-intelligence/visualization/C4ContextDiagramBuilder.js +152 -0
  45. package/dist/code-intelligence/visualization/C4ContextDiagramBuilder.js.map +1 -0
  46. package/dist/code-intelligence/visualization/MermaidGenerator.d.ts +79 -0
  47. package/dist/code-intelligence/visualization/MermaidGenerator.d.ts.map +1 -1
  48. package/dist/code-intelligence/visualization/MermaidGenerator.js +143 -0
  49. package/dist/code-intelligence/visualization/MermaidGenerator.js.map +1 -1
  50. package/dist/config/ConfigLoader.d.ts +1 -0
  51. package/dist/config/ConfigLoader.d.ts.map +1 -1
  52. package/dist/config/ConfigLoader.js +33 -3
  53. package/dist/config/ConfigLoader.js.map +1 -1
  54. package/dist/mcp/handlers/integration/integration-test-orchestrate.d.ts.map +1 -1
  55. package/dist/mcp/handlers/integration/integration-test-orchestrate.js +6 -9
  56. package/dist/mcp/handlers/integration/integration-test-orchestrate.js.map +1 -1
  57. package/dist/mcp/server-instructions.d.ts +1 -1
  58. package/dist/mcp/server-instructions.js +1 -1
  59. package/package.json +2 -1
@@ -0,0 +1,400 @@
1
+ "use strict";
2
+ /**
3
+ * Component Boundary Analyzer for C4 Model Integration
4
+ *
5
+ * Detects logical component boundaries within a codebase for C4 Component diagrams.
6
+ * Analyzes directory structure, file organization, and import patterns to identify
7
+ * components and their relationships.
8
+ *
9
+ * Supports detection of:
10
+ * - Layered architecture (presentation, business, data layers)
11
+ * - Modular architecture (domain modules)
12
+ * - Feature-based architecture (vertical slices)
13
+ * - Package-based organization
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ var __importDefault = (this && this.__importDefault) || function (mod) {
49
+ return (mod && mod.__esModule) ? mod : { "default": mod };
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.ComponentBoundaryAnalyzer = void 0;
53
+ const path = __importStar(require("path"));
54
+ const fs = __importStar(require("fs/promises"));
55
+ const fast_glob_1 = __importDefault(require("fast-glob"));
56
+ const DEFAULT_CONFIG = {
57
+ rootDir: './src',
58
+ minFilesPerComponent: 2,
59
+ analyzeImports: true,
60
+ excludePatterns: ['**/*.test.ts', '**/*.spec.ts', '**/node_modules/**', '**/__mocks__/**'],
61
+ maxDepth: 5,
62
+ };
63
+ const LAYER_PATTERNS = [
64
+ {
65
+ name: 'Presentation',
66
+ type: 'presentation',
67
+ patterns: ['controllers', 'routes', 'handlers', 'views', 'pages', 'ui', 'api', 'cli', 'commands'],
68
+ responsibilities: ['Handle HTTP requests', 'Manage user interface', 'Process API calls', 'Execute CLI commands'],
69
+ },
70
+ {
71
+ name: 'Business Logic',
72
+ type: 'business',
73
+ patterns: ['services', 'domain', 'use-cases', 'usecases', 'business', 'logic', 'core', 'agents'],
74
+ responsibilities: ['Implement business rules', 'Coordinate operations', 'Process domain logic', 'Manage workflows'],
75
+ },
76
+ {
77
+ name: 'Data Access',
78
+ type: 'data',
79
+ patterns: ['repositories', 'models', 'entities', 'database', 'db', 'storage', 'dao', 'persistence'],
80
+ responsibilities: ['Access database', 'Manage data persistence', 'Query data stores', 'Handle data models'],
81
+ },
82
+ {
83
+ name: 'Infrastructure',
84
+ type: 'infrastructure',
85
+ patterns: ['mcp', 'providers', 'adapters', 'integrations', 'external', 'clients'],
86
+ responsibilities: ['External integrations', 'Third-party services', 'Infrastructure concerns', 'Service adapters'],
87
+ },
88
+ {
89
+ name: 'Core',
90
+ type: 'core',
91
+ patterns: ['core', 'shared', 'common'],
92
+ responsibilities: ['Shared functionality', 'Common utilities', 'Core abstractions', 'Base classes'],
93
+ },
94
+ {
95
+ name: 'Utilities',
96
+ type: 'utility',
97
+ patterns: ['utils', 'helpers', 'lib', 'tools'],
98
+ responsibilities: ['Helper functions', 'Utility methods', 'Support tools', 'Common helpers'],
99
+ },
100
+ ];
101
+ /**
102
+ * Component Boundary Analyzer
103
+ *
104
+ * Analyzes codebase structure to identify component boundaries
105
+ * for C4 Component diagrams.
106
+ */
107
+ class ComponentBoundaryAnalyzer {
108
+ constructor(rootDir, config = {}) {
109
+ this.componentIdCounter = 0;
110
+ this.relationshipIdCounter = 0;
111
+ this.config = {
112
+ ...DEFAULT_CONFIG,
113
+ ...config,
114
+ rootDir,
115
+ };
116
+ }
117
+ /**
118
+ * Analyze codebase to detect component boundaries.
119
+ */
120
+ async analyze() {
121
+ const startTime = Date.now();
122
+ // Step 1: Detect components based on directory structure
123
+ const components = await this.detectComponents();
124
+ // Step 2: Analyze relationships between components
125
+ const relationships = this.config.analyzeImports
126
+ ? await this.analyzeRelationships(components)
127
+ : [];
128
+ const analysisTime = Date.now() - startTime;
129
+ console.log(`[ComponentBoundaryAnalyzer] Analysis complete in ${analysisTime}ms`);
130
+ console.log(`[ComponentBoundaryAnalyzer] Found ${components.length} components, ${relationships.length} relationships`);
131
+ return {
132
+ components,
133
+ relationships,
134
+ metadata: {
135
+ timestamp: Date.now(),
136
+ durationMs: analysisTime,
137
+ filesAnalyzed: components.reduce((sum, c) => sum + c.files.length, 0),
138
+ containersDetected: 0,
139
+ layersDetected: components.filter(c => c.type === 'layer').length,
140
+ },
141
+ };
142
+ }
143
+ /**
144
+ * Detect components based on directory structure.
145
+ */
146
+ async detectComponents() {
147
+ const components = [];
148
+ // Get all source files
149
+ const files = await this.getSourceFiles();
150
+ // Group files by directory
151
+ const filesByDir = this.groupFilesByDirectory(files);
152
+ // Analyze each directory as potential component
153
+ for (const [dir, dirFiles] of filesByDir.entries()) {
154
+ if (dirFiles.length < this.config.minFilesPerComponent) {
155
+ continue;
156
+ }
157
+ const component = this.createComponentFromDirectory(dir, dirFiles);
158
+ if (component) {
159
+ components.push(component);
160
+ }
161
+ }
162
+ // Sort components by type and name
163
+ components.sort((a, b) => {
164
+ if (a.type !== b.type) {
165
+ return a.type.localeCompare(b.type);
166
+ }
167
+ return a.name.localeCompare(b.name);
168
+ });
169
+ return components;
170
+ }
171
+ /**
172
+ * Get all source files excluding test files and node_modules.
173
+ */
174
+ async getSourceFiles() {
175
+ const patterns = [
176
+ `${this.config.rootDir}/**/*.ts`,
177
+ `${this.config.rootDir}/**/*.tsx`,
178
+ `${this.config.rootDir}/**/*.js`,
179
+ `${this.config.rootDir}/**/*.jsx`,
180
+ `${this.config.rootDir}/**/*.py`,
181
+ `${this.config.rootDir}/**/*.go`,
182
+ `${this.config.rootDir}/**/*.rs`,
183
+ ];
184
+ const files = await (0, fast_glob_1.default)(patterns, {
185
+ ignore: this.config.excludePatterns,
186
+ absolute: true,
187
+ onlyFiles: true,
188
+ });
189
+ return files;
190
+ }
191
+ /**
192
+ * Group files by their parent directory.
193
+ */
194
+ groupFilesByDirectory(files) {
195
+ const filesByDir = new Map();
196
+ for (const file of files) {
197
+ const dir = path.dirname(file);
198
+ // Only consider directories at appropriate depth
199
+ const relativePath = path.relative(this.config.rootDir, dir);
200
+ const depth = relativePath.split(path.sep).length;
201
+ if (depth > this.config.maxDepth) {
202
+ continue;
203
+ }
204
+ const existing = filesByDir.get(dir) || [];
205
+ existing.push(file);
206
+ filesByDir.set(dir, existing);
207
+ }
208
+ return filesByDir;
209
+ }
210
+ /**
211
+ * Create a component from a directory and its files.
212
+ */
213
+ createComponentFromDirectory(dir, files) {
214
+ const relativePath = path.relative(this.config.rootDir, dir);
215
+ const dirName = path.basename(dir);
216
+ // Skip root directory
217
+ if (relativePath === '' || relativePath === '.') {
218
+ return null;
219
+ }
220
+ // Detect component type and metadata
221
+ const layerInfo = this.detectLayerType(dirName, relativePath);
222
+ const componentId = this.generateComponentId();
223
+ const componentName = this.formatComponentName(dirName);
224
+ const component = {
225
+ id: componentId,
226
+ name: componentName,
227
+ type: layerInfo.type,
228
+ description: layerInfo.description,
229
+ technology: this.detectTechnology(files),
230
+ files: files.map(f => path.relative(this.config.rootDir, f)),
231
+ responsibilities: layerInfo.responsibilities,
232
+ };
233
+ return component;
234
+ }
235
+ /**
236
+ * Detect layer type from directory name and path.
237
+ */
238
+ detectLayerType(dirName, relativePath) {
239
+ const lowerDirName = dirName.toLowerCase();
240
+ const lowerPath = relativePath.toLowerCase();
241
+ // Check against layer patterns
242
+ for (const layer of LAYER_PATTERNS) {
243
+ for (const pattern of layer.patterns) {
244
+ if (lowerDirName === pattern || lowerDirName.includes(pattern) || lowerPath.includes(pattern)) {
245
+ return {
246
+ type: 'layer',
247
+ description: `${layer.name} layer handling ${layer.responsibilities[0].toLowerCase()}`,
248
+ responsibilities: layer.responsibilities,
249
+ };
250
+ }
251
+ }
252
+ }
253
+ // Check for feature-based structure (e.g., src/features/user, src/domains/auth)
254
+ if (lowerPath.includes('features') || lowerPath.includes('domains') || lowerPath.includes('modules')) {
255
+ return {
256
+ type: 'feature',
257
+ description: `Feature module for ${dirName}`,
258
+ responsibilities: [`Manage ${dirName} feature`, 'Handle related business logic'],
259
+ };
260
+ }
261
+ // Default to module type
262
+ return {
263
+ type: 'module',
264
+ description: `Module for ${dirName}`,
265
+ responsibilities: [`Provide ${dirName} functionality`],
266
+ };
267
+ }
268
+ /**
269
+ * Detect primary technology from file extensions.
270
+ */
271
+ detectTechnology(files) {
272
+ const extensions = files.map(f => path.extname(f));
273
+ const counts = new Map();
274
+ for (const ext of extensions) {
275
+ counts.set(ext, (counts.get(ext) || 0) + 1);
276
+ }
277
+ // Find most common extension
278
+ let maxExt = '.ts';
279
+ let maxCount = 0;
280
+ for (const [ext, count] of counts.entries()) {
281
+ if (count > maxCount) {
282
+ maxExt = ext;
283
+ maxCount = count;
284
+ }
285
+ }
286
+ // Map extension to technology
287
+ const techMap = {
288
+ '.ts': 'TypeScript',
289
+ '.tsx': 'TypeScript/React',
290
+ '.js': 'JavaScript',
291
+ '.jsx': 'JavaScript/React',
292
+ '.py': 'Python',
293
+ '.go': 'Go',
294
+ '.rs': 'Rust',
295
+ };
296
+ return techMap[maxExt] || 'Unknown';
297
+ }
298
+ /**
299
+ * Analyze relationships between components based on import patterns.
300
+ */
301
+ async analyzeRelationships(components) {
302
+ const relationships = [];
303
+ const relationshipSet = new Set(); // Prevent duplicates
304
+ for (const sourceComponent of components) {
305
+ for (const file of sourceComponent.files) {
306
+ const filePath = path.join(this.config.rootDir, file);
307
+ try {
308
+ const content = await fs.readFile(filePath, 'utf-8');
309
+ const imports = this.extractImports(content);
310
+ for (const importPath of imports) {
311
+ const targetComponent = this.findComponentByImport(importPath, components, filePath);
312
+ if (targetComponent && targetComponent.id !== sourceComponent.id) {
313
+ const relationshipKey = `${sourceComponent.id}->${targetComponent.id}`;
314
+ if (!relationshipSet.has(relationshipKey)) {
315
+ relationships.push({
316
+ sourceId: sourceComponent.id,
317
+ targetId: targetComponent.id,
318
+ type: 'uses',
319
+ count: 1,
320
+ });
321
+ relationshipSet.add(relationshipKey);
322
+ }
323
+ }
324
+ }
325
+ }
326
+ catch (error) {
327
+ // Skip files that can't be read
328
+ console.warn(`[ComponentBoundaryAnalyzer] Failed to read ${filePath}:`, error);
329
+ }
330
+ }
331
+ }
332
+ return relationships;
333
+ }
334
+ /**
335
+ * Extract import paths from file content.
336
+ */
337
+ extractImports(content) {
338
+ const imports = [];
339
+ // Match ES6 imports
340
+ const es6ImportRegex = /import\s+(?:[\w*\s{},]*)\s+from\s+['"]([^'"]+)['"]/g;
341
+ let match;
342
+ while ((match = es6ImportRegex.exec(content)) !== null) {
343
+ imports.push(match[1]);
344
+ }
345
+ // Match CommonJS require
346
+ const requireRegex = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
347
+ while ((match = requireRegex.exec(content)) !== null) {
348
+ imports.push(match[1]);
349
+ }
350
+ return imports;
351
+ }
352
+ /**
353
+ * Find component that contains the imported file.
354
+ */
355
+ findComponentByImport(importPath, components, sourceFilePath) {
356
+ // Skip external packages
357
+ if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
358
+ return null;
359
+ }
360
+ // Resolve import path
361
+ const sourceDir = path.dirname(sourceFilePath);
362
+ const resolvedPath = path.resolve(sourceDir, importPath);
363
+ const relativePath = path.relative(this.config.rootDir, resolvedPath);
364
+ // Try with common extensions
365
+ const extensions = ['.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs'];
366
+ const candidates = [
367
+ relativePath,
368
+ ...extensions.map(ext => relativePath + ext),
369
+ path.join(relativePath, 'index.ts'),
370
+ path.join(relativePath, 'index.js'),
371
+ ];
372
+ // Find component containing any candidate path
373
+ for (const component of components) {
374
+ for (const candidate of candidates) {
375
+ if (component.files.some((f) => f === candidate || f.startsWith(candidate + path.sep))) {
376
+ return component;
377
+ }
378
+ }
379
+ }
380
+ return null;
381
+ }
382
+ /**
383
+ * Generate unique component ID.
384
+ */
385
+ generateComponentId() {
386
+ return `component-${++this.componentIdCounter}`;
387
+ }
388
+ /**
389
+ * Format directory name as component name.
390
+ */
391
+ formatComponentName(dirName) {
392
+ // Convert kebab-case or snake_case to Title Case
393
+ return dirName
394
+ .split(/[-_]/)
395
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
396
+ .join(' ');
397
+ }
398
+ }
399
+ exports.ComponentBoundaryAnalyzer = ComponentBoundaryAnalyzer;
400
+ //# sourceMappingURL=ComponentBoundaryAnalyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentBoundaryAnalyzer.js","sourceRoot":"","sources":["../../../src/code-intelligence/inference/ComponentBoundaryAnalyzer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,gDAAkC;AAClC,0DAA2B;AAQ3B,MAAM,cAAc,GAA4B;IAC9C,OAAO,EAAE,OAAO;IAChB,oBAAoB,EAAE,CAAC;IACvB,cAAc,EAA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Y,GAAG,GAAG,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;SACpC,CAAC;QAEF,+CAA+C;QAC/C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACnC,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;oBAC/F,OAAO,SAAS,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAGD;;OAEG;IACK,mBAAmB;QACzB,OAAO,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAClD,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,OAAe;QACzC,iDAAiD;QACjD,OAAO,OAAO;aACX,KAAK,CAAC,MAAM,CAAC;aACb,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aACzD,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;CACF;AA9WD,8DA8WC"}
@@ -0,0 +1,31 @@
1
+ import type { ExternalSystem } from './types';
2
+ /**
3
+ * Detects external systems and dependencies for C4 Context diagrams
4
+ */
5
+ export declare class ExternalSystemDetector {
6
+ private readonly rootDir;
7
+ private static readonly PACKAGE_MAPPINGS;
8
+ private static readonly ENV_PATTERNS;
9
+ constructor(rootDir: string);
10
+ /**
11
+ * Detect all external systems used by the project
12
+ */
13
+ detect(): Promise<ExternalSystem[]>;
14
+ /**
15
+ * Analyze package.json dependencies to identify external systems
16
+ */
17
+ private analyzePackageJson;
18
+ /**
19
+ * Analyze .env and .env.example files for external system hints
20
+ */
21
+ private analyzeEnvFiles;
22
+ /**
23
+ * Deduplicate systems by ID, merging descriptions
24
+ */
25
+ private deduplicateSystems;
26
+ /**
27
+ * Generate a unique system ID based on technology and type
28
+ */
29
+ private generateSystemId;
30
+ }
31
+ //# sourceMappingURL=ExternalSystemDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExternalSystemDetector.d.ts","sourceRoot":"","sources":["../../../src/code-intelligence/inference/ExternalSystemDetector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,SAAS,CAAC;AAErE;;GAEG;AACH,qBAAa,sBAAsB;IAuZrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAtZpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CA2StC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAuGlC;gBAE2B,OAAO,EAAE,MAAM;IAE5C;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAezC;;OAEG;YACW,kBAAkB;IAoChC;;OAEG;YACW,eAAe;IAgD7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsB1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAIzB"}